Memory space implementation that exports a some memory-mapped data as a read-write memory space.
More...
#include <MemoryConfig.hxx>
|
| typedef uint32_t | address_t |
| |
| typedef uint16_t | errorcode_t |
| |
| static const errorcode_t | ERROR_AGAIN = 0x3FFF |
| | This error code signals that the operation was only partially completed, the again notify was used and will be notified when the operation can be re-tried).
|
| |
Memory space implementation that exports a some memory-mapped data as a read-write memory space.
The data must be given as a void* pointer pointing to RAM (or other memory-mapped structures).
Definition at line 184 of file MemoryConfig.hxx.
◆ ReadWriteMemoryBlock()
| openlcb::ReadWriteMemoryBlock::ReadWriteMemoryBlock |
( |
void * |
data, |
|
|
address_t |
len |
|
) |
| |
|
inline |
Initializes a memory block with a given block of memory.
The address range [data, data+len) must be dereferenceable for read and write so long as this object is alive.
Definition at line 190 of file MemoryConfig.hxx.
◆ max_address()
| address_t openlcb::ReadWriteMemoryBlock::max_address |
( |
| ) |
|
|
inlinevirtual |
- Returns
- the largest valid address for this block. A read of 1 from this address should succeed in returning the last byte.
Implements openlcb::MemorySpace.
Definition at line 202 of file MemoryConfig.hxx.
◆ read()
| size_t openlcb::ReadWriteMemoryBlock::read |
( |
address_t |
source, |
|
|
uint8_t * |
dst, |
|
|
size_t |
len, |
|
|
errorcode_t * |
error, |
|
|
Notifiable * |
again |
|
) |
| |
|
inlinevirtual |
- Returns
- the number of bytes successfully read (before hitting end of space). If *error is set to non-null, then the operation has failed. If the operation needs to be continued, then sets error to ERROR_AGAIN, and calls the Notifiable
- Parameters
-
| again | when a re-try makes sense. The caller should call read once more, with the offset adjusted with the previously returned bytes. |
Implements openlcb::MemorySpace.
Definition at line 207 of file MemoryConfig.hxx.
◆ read_only()
| bool openlcb::ReadWriteMemoryBlock::read_only |
( |
| ) |
|
|
inlinevirtual |
◆ write()
| size_t openlcb::ReadWriteMemoryBlock::write |
( |
address_t |
destination, |
|
|
const uint8_t * |
data, |
|
|
size_t |
len, |
|
|
errorcode_t * |
error, |
|
|
Notifiable * |
again |
|
) |
| |
|
inlinevirtual |
- Returns
- the number of bytes successfully written (before hitting end of space). If *error is set to non-null, then the operation has failed. If the operation needs to be continued, then sets error to MemorySpace::ERROR_AGAIN, and calls the Notifiable
- Parameters
-
| again | when a re-try makes sense. The caller should call write once more, with the offset adjusted with the previously returned bytes. |
Reimplemented from openlcb::MemorySpace.
Definition at line 223 of file MemoryConfig.hxx.
◆ data_
| uint8_t* openlcb::ReadWriteMemoryBlock::data_ |
|
private |
◆ len_
| const address_t openlcb::ReadWriteMemoryBlock::len_ |
|
private |
The documentation for this class was generated from the following file: