mirror of
https://github.com/osiweb/unified_retro_keyboard.git
synced 2024-11-24 02:34:04 +00:00
3.6 KiB
3.6 KiB
- EEPROM management
- Uses
- Allocate on demand
- System block does not change as keyboards are changed
- Items include:
- All system block allocation must occur before any keyboard allocation may occur.
- Once system EEPROM is allocated, system EEPROM is "locked"
- If system EEPROM is locked, then EEPROM cannot be reallocated, although the parameters may be re-written.
- provision to unlock EEPROM, for example, when firmware is updated, or during development
- Keyboard block is reset whenever the keyboard changes
- Architecture
- Device independent layer - allows diferent devices including on-chip EEPROM, off-chip EEPROM, and other technologies such as FRAM. An API that implements the following:
- Allocation layer
- Architecture for allocation layer:
- Pointer to first "free" block. This is a linked list of blocks.
- Table of starting positions and lengths. Starting position will be 2 bytes, and will indicate a 1 or 2 byte boundary1, 2, or 4-byte words, determined by storage size. Number of elements in table will also be determined by storage size, up to max 255.
- Initialize with a free block of all available storage
- Allocate storage from beginning of free block.
- The beginning of each block is a header including a "size" value (1 or 2 bytes) and a "link" address, 1, 2, or 4 bytes, same as the index table. For free blocks, the "size" is always a contiguous size. For allocated blocks, the size is the total size of all the blocks linked in a list.
- To allocate:
- Look up the first free block
- If the string can fit in the size of the free block:
- If the string cannot fit in the size of the free block:
- store the size in the size field
- Leave the "link" address, which points to the next free block
- Store the string text
- jump to the next free block, and repeat the above for the remainder of the string.
- keep repeating until the string can fit in a free block.
- If there is no more free block, and not enough room to store the text, then store as much as possible, then stop.
- To free: