CeylanARM7Base.c File Reference

#include "CeylanARM7Base.h"
#include "CeylanARM7Codes.h"
#include "CeylanIPCCommands.h"

Include dependency graph for CeylanARM7Base.c:

Go to the source code of this file.

Defines

#define PM_BATTERY_STATUS   BIT(0)
#define PM_DSLITE_REG   (4)
#define PM_IS_LITE   BIT(6)

Functions

void VcountHandler ()
void atomicSleep ()
 Waits a short time slice.
void setStatusWord (ARM7StatusWord newStatus)
 Sets the ARM7 status word, for the ARM9.
void setError (ARM7ErrorCode newError)
 Sets the ARM7 error code, for the ARM9.
void unsetErrorStatus ()
 Unset any previous error status, for example when the error code has been taken into account already.
FIFOElement prepareFIFOCommand (FIFOCommandID id)
 Creates a FIFO element appropriate to begin a command for the ARM9.
FIFOCommandID getFIFOCommandIDFrom (FIFOElement element)
FIFOCommandCount getFIFOCommandCountFrom (FIFOElement element)
FIFOCommandCount getARM7ProcessedCount ()
FIFOCommandCount getARM9ProcessedCount ()
FIFOCommandCount getProcessedCount ()
FIFOCommandCount getSentCount ()
void sendSynchronizeInterruptToARM9 ()
void incrementProcessCount ()
InterruptMask setEnabledInterrupts (InterruptMask newMask)
 Sets the current set of interrupts enabled.
void notifyCommandToARM9 ()
 Warns the ARM9 that a new command has been sent by the ARM7 on the FIFO.
bool dataAvailableForReading ()
bool spaceAvailableForWriting ()
FIFOElement read ()
 Reads an element from the ARM7 FIFO, supposing there is at least one.
FIFOElement readBlocking ()
 Reads an element from the ARM7 FIFO, waiting if needed until there is one.
void write (FIFOElement toSend)
 Writes an element to the ARM7 FIFO, supposing there is room for it.
void writeBlocking (FIFOElement toSend)
 Writes an element to the ARM7 FIFO, waiting if needed until there is room for it.
void handleStatusInitRequest ()
void handleShutdownIPCRequest ()
void handleBatteryStatusRequest ()
void handleDSTypeRequest ()
void handleReceivedSystemSpecificCommand (FIFOCommandID commandID, FIFOElement firstElement)
 Manages a Ceylan-specific command.
void handleReceivedCommand ()
void initCeylanIPC ()
 Sets-up the IPC mechanism by synchronizing with the ARM9 and retrieving the status and error variables used by the ARM7 to report its state.
void initCeylanSound ()
 Sets-up the sound hardware.
void initCeylan ()
 Sets-up Ceylan and its prerequesites.

Variables

const InterruptMask AllInterruptsDisabled = 0
 To specify that all interrupts are to disabled (null value).
touchPosition first
touchPosition tempPos
ARM7StatusWord volatile *volatile statusWordPointer = 0
ARM7ErrorCode volatile *volatile errorWordPointer = 0
volatile bool IPCRunning = false
volatile FIFOCommandCount localCommandCount = 0
volatile FIFOCommandCount remoteCommandCount = 0
volatile FIFOCommandCount processedCount = 0
volatile FIFOCommandCount sentCount = 0


Define Documentation

#define PM_BATTERY_STATUS   BIT(0)

Definition at line 51 of file CeylanARM7Base.c.

Referenced by handleBatteryStatusRequest().

#define PM_DSLITE_REG   (4)

Definition at line 52 of file CeylanARM7Base.c.

Referenced by handleDSTypeRequest().

#define PM_IS_LITE   BIT(6)

Definition at line 53 of file CeylanARM7Base.c.

Referenced by handleDSTypeRequest().


Function Documentation

void atomicSleep (  ) 

bool dataAvailableForReading (  ) 

Definition at line 440 of file CeylanARM7Base.c.

Referenced by handleReceivedCommand(), read(), and readBlocking().

FIFOCommandCount getARM7ProcessedCount (  ) 

Definition at line 321 of file CeylanARM7Base.c.

FIFOCommandCount getARM9ProcessedCount (  ) 

Definition at line 331 of file CeylanARM7Base.c.

FIFOCommandCount getFIFOCommandCountFrom ( FIFOElement  element  ) 

Definition at line 312 of file CeylanARM7Base.c.

Referenced by handleReceivedCommand().

FIFOCommandID getFIFOCommandIDFrom ( FIFOElement  element  ) 

Definition at line 303 of file CeylanARM7Base.c.

Referenced by handleReceivedCommand().

FIFOCommandCount getProcessedCount (  ) 

Definition at line 342 of file CeylanARM7Base.c.

References processedCount.

FIFOCommandCount getSentCount (  ) 

Definition at line 352 of file CeylanARM7Base.c.

References sentCount.

void handleBatteryStatusRequest (  ) 

void handleDSTypeRequest (  ) 

void handleReceivedCommand (  ) 

void handleReceivedSystemSpecificCommand ( FIFOCommandID  commandID,
FIFOElement  firstElement 
)

void handleShutdownIPCRequest (  ) 

void handleStatusInitRequest (  ) 

void incrementProcessCount (  ) 

Definition at line 384 of file CeylanARM7Base.c.

References processedCount.

Referenced by handleReceivedCommand().

void initCeylan (  ) 

Sets-up Ceylan and its prerequesites.

Definition at line 1123 of file CeylanARM7Base.c.

References initCeylanIPC(), initCeylanSound(), and VcountHandler().

void initCeylanIPC (  ) 

Sets-up the IPC mechanism by synchronizing with the ARM9 and retrieving the status and error variables used by the ARM7 to report its state.

Definition at line 1024 of file CeylanARM7Base.c.

References atomicSleep(), handleReceivedCommand(), and IPCRunning.

Referenced by initCeylan().

void initCeylanSound (  ) 

Sets-up the sound hardware.

Definition at line 1097 of file CeylanARM7Base.c.

References AllInterruptsDisabled, atomicSleep(), and setEnabledInterrupts().

Referenced by initCeylan().

void notifyCommandToARM9 (  ) 

Warns the ARM9 that a new command has been sent by the ARM7 on the FIFO.

Definition at line 430 of file CeylanARM7Base.c.

References sendSynchronizeInterruptToARM9(), and sentCount.

Referenced by handleBatteryStatusRequest(), and handleDSTypeRequest().

FIFOElement prepareFIFOCommand ( FIFOCommandID  id  ) 

Creates a FIFO element appropriate to begin a command for the ARM9.

Definition at line 278 of file CeylanARM7Base.c.

References localCommandCount.

Referenced by handleBatteryStatusRequest(), and handleDSTypeRequest().

FIFOElement read (  ) 

Reads an element from the ARM7 FIFO, supposing there is at least one.

Definition at line 459 of file CeylanARM7Base.c.

References dataAvailableForReading(), FIFOErrorWhileReading, and setError().

Referenced by Ceylan::System::FDRead().

FIFOElement readBlocking (  ) 

Reads an element from the ARM7 FIFO, waiting if needed until there is one.

Definition at line 490 of file CeylanARM7Base.c.

References dataAvailableForReading(), FIFOErrorWhileReading, FIFOTimeOutWhileReading, setError(), setStatusWord(), StatusReset, and unsetErrorStatus().

Referenced by handleReceivedCommand(), and handleStatusInitRequest().

void sendSynchronizeInterruptToARM9 (  ) 

Definition at line 366 of file CeylanARM7Base.c.

Referenced by notifyCommandToARM9(), and writeBlocking().

InterruptMask setEnabledInterrupts ( InterruptMask  newMask  ) 

Sets the current set of interrupts enabled.

Parameters:
newMask the masks describing all the interrupts that are to be enabled.
Returns:
The previous mask that was used, before being replaced by the specified one.
Note:
Usually used to deactivate all IRQ.

Definition at line 417 of file CeylanARM7Base.c.

Referenced by initCeylanSound().

void setError ( ARM7ErrorCode  newError  ) 

Sets the ARM7 error code, for the ARM9.

Updates the status word accordingly.

Note:
If previous error code was not NoError, will be left as is. The first error (most interesting one) is kept.

Definition at line 241 of file CeylanARM7Base.c.

References ARM7InError, errorWordPointer, NoError, and setStatusWord().

Referenced by handleReceivedCommand(), handleReceivedSystemSpecificCommand(), handleShutdownIPCRequest(), handleStatusInitRequest(), read(), readBlocking(), write(), and writeBlocking().

void setStatusWord ( ARM7StatusWord  newStatus  ) 

Sets the ARM7 status word, for the ARM9.

Note:
If previous status was ARM7InError, will be left as is, so that error status is not lost.

Definition at line 218 of file CeylanARM7Base.c.

References ARM7InError, and statusWordPointer.

Referenced by readBlocking(), setError(), and writeBlocking().

bool spaceAvailableForWriting (  ) 

Definition at line 449 of file CeylanARM7Base.c.

Referenced by write(), and writeBlocking().

void unsetErrorStatus (  ) 

Unset any previous error status, for example when the error code has been taken into account already.

Definition at line 263 of file CeylanARM7Base.c.

References errorWordPointer, NoError, NoStatusAvailable, and statusWordPointer.

Referenced by readBlocking(), and writeBlocking().

void VcountHandler (  ) 

Definition at line 71 of file CeylanARM7Base.c.

References tempPos.

Referenced by initCeylan().

void write ( FIFOElement  toSend  ) 

Writes an element to the ARM7 FIFO, supposing there is room for it.

Definition at line 551 of file CeylanARM7Base.c.

References FIFOErrorWhileWriting, setError(), and spaceAvailableForWriting().

Referenced by Ceylan::System::FDWrite().

void writeBlocking ( FIFOElement  toSend  ) 

Writes an element to the ARM7 FIFO, waiting if needed until there is room for it.

Definition at line 592 of file CeylanARM7Base.c.

References FIFOErrorWhileWriting, FIFOTimeOutWhileWriting, sendSynchronizeInterruptToARM9(), setError(), setStatusWord(), spaceAvailableForWriting(), StatusReset, and unsetErrorStatus().

Referenced by handleBatteryStatusRequest(), and handleDSTypeRequest().


Variable Documentation

ARM7ErrorCode volatile* volatile errorWordPointer = 0

touchPosition first

Definition at line 67 of file CeylanARM7Base.c.

Referenced by Ceylan::System::FileSystemManager::diff().

volatile bool IPCRunning = false

Definition at line 163 of file CeylanARM7Base.c.

Referenced by prepareFIFOCommand().

Definition at line 182 of file CeylanARM7Base.c.

Referenced by getProcessedCount(), and incrementProcessCount().

Definition at line 171 of file CeylanARM7Base.c.

Referenced by handleReceivedCommand().

Definition at line 190 of file CeylanARM7Base.c.

Referenced by getSentCount(), and notifyCommandToARM9().

ARM7StatusWord volatile* volatile statusWordPointer = 0

touchPosition tempPos

Definition at line 67 of file CeylanARM7Base.c.

Referenced by VcountHandler().


Generated on Thu Jun 4 20:39:21 2009 for Ceylan by  doxygen 1.5.8