#include "CeylanARM7Base.h"
#include "CeylanARM7Codes.h"
#include "CeylanIPCCommands.h"
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 PM_BATTERY_STATUS BIT(0) |
#define PM_DSLITE_REG (4) |
#define PM_IS_LITE BIT(6) |
void atomicSleep | ( | ) |
Waits a short time slice.
Makes the process sleep for a quite small duration, which is probably the smallest possible duration on the system, scheduler-wise, i.e.
Needs the VBlank IRQ to be enabled.
Definition at line 199 of file CeylanARM7Base.c.
References Ceylan::System::basicSleep(), Ceylan::System::getSchedulingGranularity(), and Ceylan::System::InitializeInterrupts().
Referenced by Ceylan::System::FIFO::activate(), Ceylan::System::FIFO::deactivate(), Ceylan::System::FIFO::FIFO(), Ceylan::System::FIFO::getBatteryStatus(), Ceylan::getChar(), Ceylan::System::FIFO::getDSType(), initCeylanIPC(), initCeylanSound(), Ceylan::System::LibfatFileSystemManager::LibfatFileSystemManager(), Ceylan::System::smartSleep(), and Ceylan::waitForKey().
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 | ) |
FIFOCommandID getFIFOCommandIDFrom | ( | FIFOElement | element | ) |
FIFOCommandCount getProcessedCount | ( | ) |
FIFOCommandCount getSentCount | ( | ) |
void handleBatteryStatusRequest | ( | ) |
Definition at line 749 of file CeylanARM7Base.c.
References BatteryStatusAnswer, notifyCommandToARM9(), PM_BATTERY_STATUS, prepareFIFOCommand(), and writeBlocking().
Referenced by handleReceivedSystemSpecificCommand().
void handleDSTypeRequest | ( | ) |
Definition at line 774 of file CeylanARM7Base.c.
References DSTypeAnswer, notifyCommandToARM9(), PM_DSLITE_REG, PM_IS_LITE, prepareFIFOCommand(), and writeBlocking().
Referenced by handleReceivedSystemSpecificCommand().
void handleReceivedCommand | ( | ) |
Definition at line 893 of file CeylanARM7Base.c.
References CommandOverlapping, dataAvailableForReading(), generalUtils::false, getFIFOCommandCountFrom(), getFIFOCommandIDFrom(), handleReceivedApplicationCommand(), handleReceivedIntegratingLibrarySpecificCommand(), handleReceivedSystemSpecificCommand(), incrementProcessCount(), readBlocking(), remoteCommandCount, setError(), generalUtils::true, and UnexpectedCommandCount.
Referenced by initCeylanIPC().
void handleReceivedSystemSpecificCommand | ( | FIFOCommandID | commandID, | |
FIFOElement | firstElement | |||
) |
Manages a Ceylan-specific command.
Definition at line 809 of file CeylanARM7Base.c.
References BatteryStatusRequest, DSTypeRequest, handleBatteryStatusRequest(), handleDSTypeRequest(), handleShutdownIPCRequest(), handleStatusInitRequest(), HelloToTheARM7, setError(), ShutdownIPCRequest, StatusInitRequest, UnexpectedBehaviour, and UnexpectedSystemCommand.
Referenced by handleReceivedCommand().
void handleShutdownIPCRequest | ( | ) |
Definition at line 706 of file CeylanARM7Base.c.
References ARM7IPCShutdown, errorWordPointer, generalUtils::false, IPCAlreadyStopped, IPCRunning, NoError, setError(), and statusWordPointer.
Referenced by handleReceivedSystemSpecificCommand().
void handleStatusInitRequest | ( | ) |
Definition at line 657 of file CeylanARM7Base.c.
References ARM7Running, errorWordPointer, IncorrectInitialError, IncorrectInitialStatus, IPCAlreadyStarted, IPCRunning, NoError, NoErrorAvailable, NoStatusAvailable, readBlocking(), setError(), statusWordPointer, and generalUtils::true.
Referenced by handleReceivedSystemSpecificCommand().
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.
newMask | the masks describing all the interrupts that are to be enabled. |
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.
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.
Definition at line 218 of file CeylanARM7Base.c.
References ARM7InError, and statusWordPointer.
Referenced by readBlocking(), setError(), and writeBlocking().
bool spaceAvailableForWriting | ( | ) |
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 | ( | ) |
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().
const InterruptMask AllInterruptsDisabled = 0 |
To specify that all interrupts are to disabled (null value).
Definition at line 56 of file CeylanARM7Base.c.
Referenced by Ceylan::System::FIFO::activate(), Ceylan::System::CacheProtectedDelete(), Ceylan::System::CacheProtectedNew(), Ceylan::System::FIFO::deactivate(), initCeylanSound(), Ceylan::System::FIFO::sendBatteryStatusRequest(), and Ceylan::System::FIFO::sendDSTypeRequest().
ARM7ErrorCode volatile* volatile errorWordPointer = 0 |
Definition at line 147 of file CeylanARM7Base.c.
Referenced by handleShutdownIPCRequest(), handleStatusInitRequest(), setError(), and unsetErrorStatus().
touchPosition first |
Definition at line 67 of file CeylanARM7Base.c.
Referenced by Ceylan::System::FileSystemManager::diff().
volatile bool IPCRunning = false |
Definition at line 151 of file CeylanARM7Base.c.
Referenced by handleShutdownIPCRequest(), handleStatusInitRequest(), and initCeylanIPC().
volatile FIFOCommandCount localCommandCount = 0 |
volatile FIFOCommandCount processedCount = 0 |
Definition at line 182 of file CeylanARM7Base.c.
Referenced by getProcessedCount(), and incrementProcessCount().
volatile FIFOCommandCount remoteCommandCount = 0 |
volatile FIFOCommandCount sentCount = 0 |
Definition at line 190 of file CeylanARM7Base.c.
Referenced by getSentCount(), and notifyCommandToARM9().
ARM7StatusWord volatile* volatile statusWordPointer = 0 |
Definition at line 144 of file CeylanARM7Base.c.
Referenced by handleShutdownIPCRequest(), handleStatusInitRequest(), setStatusWord(), and unsetErrorStatus().
touchPosition tempPos |