Home2L - C/C++ API v1.4-0-g38cc (2024-05-25)
Smart Tools for a Private Home
|
Reference documentation of the Brownie virtual memory organization.
This section decribes the organization of the virtual memory as accessed by the BR_OP_MEM_READ() and BR_OP_MEM_WRITE() operations.
Classes | |
struct | SBrFeatureRecord |
Brownie feature record (stored in VROM). More... | |
struct | SBrConfigRecord |
Brownie configuration record (stored in EEPROM). More... | |
Version and Feature Record (VROM, Compile-Time) ... | |
typedef struct SBrFeatureRecord | TBrFeatureRecord |
Brownie feature record (stored in VROM). More... | |
#define | BR_MAGIC 0xb1 |
Magic byte value to identify this device as a brownie. | |
#define | brFeatureRecordRcVec0 offsetof (TBrFeatureRecord, features) |
Offset of first byte of the feature code stored in the database (key "features") and relevant for resources. | |
#define | brFeatureRecordRcVec1 offsetof (TBrFeatureRecord, reserved) |
Offset of first byte behind the feature code stored in the database (key "features") and relevant for resources. | |
Brownie ID (EEPROM, Run-Time Changable) ... | |
typedef char | TBrIdRecord[32] |
Brownie ID (stored in EEPROM). More... | |
Configuration Record (EEPROM, Run-Time Changeable) ... | |
typedef struct SBrConfigRecord | TBrConfigRecord |
Brownie configuration record (stored in EEPROM). More... | |
Memory Layout | |
#define | BR_MEM_PAGE_FLASH 0x0 |
... 0x7: Program flash memory pages (one page = 0x100 * BR_MEM_BLOCKSIZE bytes) | |
#define | BR_MEM_PAGE_SRAM 0x8 |
SRAM base page. | |
#define | BR_MEM_PAGE_EEPROM 0x9 |
EEPROM base page. | |
#define | BR_MEM_PAGE_VROM 0xa |
Version ROM base page (mapped to data array in program) | |
#define | BR_MEM_ADR_IS_FLASH(ADR) (((ADR) >> (BR_MEM_BLOCKSIZE_SHIFT+8)) <= BR_MEM_PAGE_FLASH + 7) |
#define | BR_MEM_ADR_IS_SRAM(ADR) (((ADR) >> (BR_MEM_BLOCKSIZE_SHIFT+8)) == BR_MEM_PAGE_SRAM) |
#define | BR_MEM_ADR_IS_EEPROM(ADR) (((ADR) >> (BR_MEM_BLOCKSIZE_SHIFT+8)) == BR_MEM_PAGE_EEPROM) |
#define | BR_MEM_ADR_IS_VROM(ADR) (((ADR) >> (BR_MEM_BLOCKSIZE_SHIFT+8)) == BR_MEM_PAGE_VROM) |
#define | BR_MEM_ADR_FLASH(OFS) ((OFS) | (BR_MEM_PAGE_FLASH << (BR_MEM_BLOCKSIZE_SHIFT+8))) |
#define | BR_MEM_ADR_SRAM(OFS) ((OFS) | (BR_MEM_PAGE_SRAM << (BR_MEM_BLOCKSIZE_SHIFT+8))) |
#define | BR_MEM_ADR_EEPROM(OFS) ((OFS) | (BR_MEM_PAGE_EEPROM << (BR_MEM_BLOCKSIZE_SHIFT+8))) |
#define | BR_MEM_ADR_VROM(OFS) ((OFS) | (BR_MEM_PAGE_VROM << (BR_MEM_BLOCKSIZE_SHIFT+8))) |
#define | BR_MEM_OFS(ADR) ((ADR) & ((BR_MEM_ADR_IS_FLASH(ADR) ? 0x7ff : 0x0ff) << BR_MEM_BLOCKSIZE_SHIFT)) |
#define | BR_FLASH_PAGESIZE 0x40 |
Size of a flash page to be used by communication peers (e.g. TWI masters). More... | |
#define | BR_FLASH_BASE_MAINTENANCE 0x0040 |
Byte address defining the start of the maintenance system. | |
#define | BR_FLASH_BASE_OPERATIONAL 0x0a00 |
Byte address defining the border between the maintenance and application system. Addresses below this are reserved for the maintenance system. | |
#define | BR_VROM_SIZE sizeof (TBrFeatureRecord) |
Size of the VROM. | |
#define | BR_EEPROM_ID_BASE 0x0000 |
Location of the ID string in the EEPROM. | |
#define | BR_EEPROM_ID_SIZE sizeof (TBrIdRecord) |
Size of the ID record. | |
#define | BR_EEPROM_CFG_BASE 0x0000 + BR_EEPROM_ID_SIZE |
Location of the configuration record in the EEPROM. | |
#define | BR_EEPROM_CFG_SIZE sizeof (TBrConfigRecord) |
Size of the configuration record. | |
... Matrix Dimensions ... | |
(for SBrFeatureRecord::matDim) | |
#define | BR_MATDIM_ROWS(X) ((X) >> 4) |
#define | BR_MATDIM_COLS(X) ((X) & 0x0f) |
... MCU Type IDs ... | |
(for SBrFeatureRecord::mcuType and for the 'config.h') | |
#define | BR_MCU_NONE 0 |
No or unknown MCU type. | |
#define | BR_MCU_ATTINY85 1 |
AVR ATtiny85 (8 pins) or any software- and pin-compatible model. | |
#define | BR_MCU_ATTINY84 2 |
AVR ATtiny84 (14 pins) or any software- and pin-compatible model. | |
#define | BR_MCU_ATTINY861 3 |
AVR ATtiny861 (20 pins) or any software- and pin-compatible model. | |
#define BR_FLASH_PAGESIZE 0x40 |
Size of a flash page to be used by communication peers (e.g. TWI masters).
This must be the smallest common multiple of all possible SPM_PAGESIZE values (or power-of-two multiple thereof).
Note: The value is typically a multiple of BR_MEM_BLOCKSIZE. Memory writes to flash must be extended to a multiple of this, since the brownie would otherwise not write back the last page.
Definition at line 290 of file interface.h.
typedef struct SBrFeatureRecord TBrFeatureRecord |
Brownie feature record (stored in VROM).
This record describes the firmware version and available features.
Note: The size of this structure must be equal to BR_VROM_SIZE and a multiple of BR_MEM_BLOCKSIZE. This can be checked by compiling and running 'home2l-brownie2l' (see entry of main() there).
typedef char TBrIdRecord[32] |
Brownie ID (stored in EEPROM).
This is a null-terminated string containing a unique identifier for the brownie. The size of this structure must be a multiple of BR_MEM_BLOCKSIZE (presently 0x10).
Note: The size of this structure must be equal to BR_EEPROM_ID_SIZE and a multiple of BR_MEM_BLOCKSIZE. This can be checked by compiling and running 'home2l-brownie2l' (see entry of main() there).
Definition at line 423 of file interface.h.
typedef struct SBrConfigRecord TBrConfigRecord |
Brownie configuration record (stored in EEPROM).
This record contains changeable configuration parameters.
The configuration is stored in the EEPROM at address BR_EEPROM_CFG_BASE (see below). On startup, an SRAM copy is made, accessible via 'brConfigRecord'. Hence, changes to the EEPROM only take effect after the next reboot. This is particularly relevant if the device address is changed.
Note: The size of this structure must be equal to BR_EEPROM_CFG_SIZE and a multiple of BR_MEM_BLOCKSIZE. This can be checked by compiling and running 'home2l-brownie2l' (see entry of main() there).