xyControl
0.1
Quadrotor Flight Controller on AVR Basis
|
Allows access to external RAM with bank-switching. More...
Files | |
file | xmem.h |
XMEM API Header. | |
file | xmem.c |
XMEM API Implementation. | |
Data Structures | |
struct | MallocState |
All Malloc related State. More... | |
Macros | |
#define | MEMSWITCH(x) uint8_t oldMemBank=xmemGetBank();if(oldMemBank!=x)xmemSetBank(x); |
Switch the bank, if needed. More... | |
#define | MEMSWITCHBACK(x) if(oldMemBank!=x)xmemSetBank(oldMemBank); |
Switch back to the last bank, if needed. More... | |
#define | MEMBANKS 8 |
Available Memory Banks. More... | |
#define | BANK_GENERIC 0 |
Generic Memory Bank. More... | |
Functions | |
void | xmemInit (void) |
Initialize the External Memory Interface. More... | |
void | xmemSetBank (uint8_t bank) |
Switch the active memory bank. More... | |
uint8_t | xmemGetBank (void) |
Get the current memory bank. More... | |
void | saveState (uint8_t bank) |
Save the current malloc state. More... | |
void | restoreState (uint8_t bank) |
Restore the malloc state. More... | |
Variables | |
MallocState | states [MEMBANKS] |
MallocState for all Memory Banks. More... | |
uint8_t | currentBank |
Current active Memory Bank. More... | |
MallocState | states [MEMBANKS] |
MallocState for all Memory Banks. More... | |
uint8_t | currentBank = 0 |
Current active Memory Bank. More... | |
void * | __brkval |
Internal Malloc Heap-End Pointer. More... | |
void * | __flp |
Internal Malloc Free List Pointer (State) More... | |
Allows access to external RAM with bank-switching.
#define BANK_GENERIC 0 |
Generic Memory Bank.
Definition at line 55 of file xmem.h.
Referenced by addMenuCommand(), addTask(), removeTask(), tasks(), tasksRegistered(), uartMenuPrintHelp(), and uartMenuTask().
#define MEMBANKS 8 |
Available Memory Banks.
Definition at line 54 of file xmem.h.
Referenced by xmemInit(), and xmemSetBank().
#define MEMSWITCH | ( | x | ) | uint8_t oldMemBank=xmemGetBank();if(oldMemBank!=x)xmemSetBank(x); |
Switch the bank, if needed.
Stores the old bank in a variable oldMemBank.
x | New Bank |
Definition at line 47 of file xmem.h.
Referenced by addTask(), removeTask(), tasks(), and tasksRegistered().
#define MEMSWITCHBACK | ( | x | ) | if(oldMemBank!=x)xmemSetBank(oldMemBank); |
Switch back to the last bank, if needed.
x | New (current) Bank |
Definition at line 52 of file xmem.h.
Referenced by addTask(), removeTask(), tasks(), and tasksRegistered().
void restoreState | ( | uint8_t | bank | ) |
Restore the malloc state.
bank | Location of state to load. |
Definition at line 65 of file xmem.c.
References __brkval, __flp, MallocState::end, MallocState::fl, MallocState::start, and MallocState::val.
Referenced by xmemSetBank().
void saveState | ( | uint8_t | bank | ) |
Save the current malloc state.
bank | Current Bank Number |
Definition at line 55 of file xmem.c.
References __brkval, __flp, MallocState::end, MallocState::fl, MallocState::start, and MallocState::val.
Referenced by xmemInit(), and xmemSetBank().
uint8_t xmemGetBank | ( | void | ) |
Get the current memory bank.
Definition at line 105 of file xmem.c.
References currentBank.
Referenced by addMenuCommand(), uartMenuPrintHelp(), and uartMenuTask().
void xmemInit | ( | void | ) |
void xmemSetBank | ( | uint8_t | bank | ) |
Switch the active memory bank.
bank | New Memory Bank |
Definition at line 89 of file xmem.c.
References BANK0PIN, BANK0PORT, BANK1PIN, BANK1PORT, BANK2PIN, BANK2PORT, currentBank, MEMBANKS, restoreState(), and saveState().
Referenced by addMenuCommand(), uartMenuPrintHelp(), and uartMenuTask().
void* __brkval |
Internal Malloc Heap-End Pointer.
Referenced by restoreState(), and saveState().
void* __flp |
Internal Malloc Free List Pointer (State)
Referenced by restoreState(), and saveState().
uint8_t currentBank = 0 |
Current active Memory Bank.
Definition at line 47 of file xmem.c.
Referenced by xmemGetBank(), and xmemSetBank().
uint8_t currentBank |
Current active Memory Bank.
Definition at line 47 of file xmem.c.
Referenced by xmemGetBank(), and xmemSetBank().
MallocState states[MEMBANKS] |
MallocState for all Memory Banks.
MallocState states[MEMBANKS] |
MallocState for all Memory Banks.