|
Open Model Railroad Network (OpenMRN)
|
Static constants and helper functions related to the Memory Configuration Protocol. More...
#include <MemoryConfigDefs.hxx>
Public Types | |
| enum | commands { COMMAND_MASK = 0xFC , COMMAND_FLAG_MASK = 0x03 , COMMAND_PRESENT_MASK = 0x01 , COMMAND_REPLY_BIT_FOR_RW = 0x10 , COMMAND_WRITE = 0x00 , COMMAND_WRITE_UNDER_MASK = 0x08 , COMMAND_WRITE_REPLY = 0x10 , COMMAND_WRITE_FAILED = 0x18 , COMMAND_WRITE_STREAM = 0x20 , COMMAND_WRITE_STREAM_REPLY = 0x30 , COMMAND_WRITE_STREAM_FAILED = 0x38 , COMMAND_READ = 0x40 , COMMAND_READ_REPLY = 0x50 , COMMAND_READ_FAILED = 0x58 , COMMAND_READ_STREAM = 0x60 , COMMAND_READ_STREAM_REPLY = 0x70 , COMMAND_READ_STREAM_FAILED = 0x78 , COMMAND_MAX_FOR_RW = 0x80 , COMMAND_OPTIONS = 0x80 , COMMAND_OPTIONS_REPLY = 0x82 , COMMAND_INFORMATION = 0x84 , COMMAND_INFORMATION_REPLY = 0x86 , COMMAND_LOCK = 0x88 , COMMAND_LOCK_REPLY = 0x8A , COMMAND_UNIQUE_ID = 0x8C , COMMAND_UNIQUE_ID_REPLY = 0x8D , COMMAND_UPDATE_COMPLETE = 0xA8 , COMMAND_RESET = 0xA9 , COMMAND_FACTORY_RESET = 0xAA , COMMAND_ENTER_BOOTLOADER = 0xAB , COMMAND_FREEZE = 0xA1 , COMMAND_UNFREEZE = 0xA0 , COMMAND_PRESENT = 0x01 , COMMAND_CDI = 0x03 , COMMAND_ALL_MEMORY = 0x02 , COMMAND_CONFIG = 0x01 } |
| Possible Commands for a configuration datagram. More... | |
| enum | spaces { SPACE_SPECIAL = 0xFC , SPACE_CDI = 0xFF , SPACE_ALL_MEMORY = 0xFE , SPACE_CONFIG = 0xFD , SPACE_ACDI_SYS = 0xFC , SPACE_ACDI_USR = 0xFB , SPACE_FDI = 0xFA , SPACE_FUNCTION = 0xF9 , SPACE_DCC_CV = 0xF8 , SPACE_FIRMWARE = 0xEF } |
| Possible memory spaces. More... | |
| enum | available { AVAIL_WUM = 0x8000 , AVAIL_UR = 0x4000 , AVAIL_UW = 0x2000 , AVAIL_SR = 0x1000 , AVAIL_R0xFC = 0x0800 , AVAIL_R0xFB = 0x0400 , AVAIL_W0xFB = 0x0200 } |
| Possible available options. More... | |
| enum | lengths { LENGTH_1 = 0x80 , LENGTH_2 = 0x40 , LENGTH_4 = 0x20 , LENGTH_63 = 0x10 , LENGTH_ARBITRARY = 0x02 , LENGTH_STREAM = 0x01 } |
| Possible supported write lengths. More... | |
| enum | flags { FLAG_RO = 0x01 , FLAG_NZLA = 0x02 } |
| Possible address space information flags. More... | |
| enum | errors { ERROR_SPACE_NOT_KNOWN = Defs::ERROR_INVALID_ARGS | 0x0001 , ERROR_OUT_OF_BOUNDS = Defs::ERROR_INVALID_ARGS | 0x0002 , ERROR_WRITE_TO_RO = Defs::ERROR_INVALID_ARGS | 0x0003 } |
| using | DatagramPayload = string |
Static Public Member Functions | |
| static bool | is_special_space (uint8_t space) |
| static DatagramPayload | write_datagram (uint8_t space, uint32_t offset, const string &data="") |
| static DatagramPayload | read_datagram (uint8_t space, uint32_t offset, uint8_t length) |
| static DatagramPayload | read_stream_datagram (uint8_t space, uint32_t offset, uint8_t dst_stream_id, uint32_t length=0xFFFFFFFF) |
| static bool | payload_min_length_check (const DatagramPayload &payload, unsigned extra) |
| static uint8_t | get_space (const DatagramPayload &payload) |
| static unsigned | get_payload_offset (const DatagramPayload &payload) |
| static uint32_t | get_address (const DatagramPayload &payload) |
| static const uint8_t * | payload_bytes (const DatagramPayload &payload) |
| Type casts a DatagramPayload to an array of bytes. | |
Static Public Attributes | |
| static constexpr unsigned | MAX_DATAGRAM_RW_BYTES = 64 |
Private Member Functions | |
| MemoryConfigDefs () | |
| Do not instantiate this class. | |
Static constants and helper functions related to the Memory Configuration Protocol.
Definition at line 47 of file MemoryConfigDefs.hxx.
| using openlcb::MemoryConfigDefs::DatagramPayload = string |
Definition at line 49 of file MemoryConfigDefs.hxx.
Possible available options.
| Enumerator | |
|---|---|
| AVAIL_WUM | write under mask supported |
| AVAIL_UR | unaligned reads supported |
| AVAIL_UW | unaligned writes supported |
| AVAIL_SR | stream reads supported
|
| AVAIL_R0xFC | read from adddress space 0xFC available |
| AVAIL_R0xFB | read from adddress space 0xFB available |
| AVAIL_W0xFB | write from adddress space 0xFB available |
Definition at line 114 of file MemoryConfigDefs.hxx.
Possible Commands for a configuration datagram.
Definition at line 53 of file MemoryConfigDefs.hxx.
| enum openlcb::MemoryConfigDefs::errors |
Definition at line 147 of file MemoryConfigDefs.hxx.
Possible address space information flags.
| Enumerator | |
|---|---|
| FLAG_RO | space is read only |
| FLAG_NZLA | space has a nonzero low address |
Definition at line 141 of file MemoryConfigDefs.hxx.
Possible supported write lengths.
Definition at line 129 of file MemoryConfigDefs.hxx.
Possible memory spaces.
Definition at line 98 of file MemoryConfigDefs.hxx.
|
inlinestatic |
| payload | is a datagram read or write request or response |
Definition at line 284 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Definition at line 269 of file MemoryConfigDefs.hxx.
|
inlinestatic |
| payload | is a read or write datagram request or response message |
Definition at line 259 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Definition at line 156 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Type casts a DatagramPayload to an array of bytes.
| payload | datagram |
Definition at line 300 of file MemoryConfigDefs.hxx.
|
inlinestatic |
| payload | is a datagram (read or write, request or response) |
| extra | is the needed bytes after address and space, usually 0 for write and 1 for read. |
Definition at line 241 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Definition at line 184 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Definition at line 207 of file MemoryConfigDefs.hxx.
|
inlinestatic |
Definition at line 161 of file MemoryConfigDefs.hxx.
|
staticconstexpr |
Definition at line 154 of file MemoryConfigDefs.hxx.