|
Dawn Framework 1.0
Universal data acquisition framework for embedded systems
|
Binary device descriptor manager. More...
#include <descriptor.hxx>
Classes | |
| struct | SDescriptorBin |
| Complete binary descriptor container. More... | |
| struct | SDescriptorBinFtr |
| Binary descriptor footer structure. More... | |
| struct | SDescriptorBinHdr |
| Binary descriptor header structure. More... | |
Public Types | |
| enum | |
| Descriptor metadata configuration IDs. | |
| typedef std::function< void(CHandler &obj, CDescObject &desc)> | allocobj_func_t |
| Thread function callback storage. | |
Public Member Functions | |
| CDescriptor () | |
| Constructor - initialize empty descriptor. | |
| ~CDescriptor () | |
| Destructor - release loaded descriptor resources. | |
| SDescriptorBin * | getBin () |
| Get loaded descriptor binary structure. | |
| size_t | getBinLen () |
| Get loaded descriptor size in bytes. | |
| bool | getNoIdleQuit () const |
| Return true if the descriptor requests no idle quit. | |
| int | loadBin (uint32_t *bin, size_t len, bool force_valid=false, bool dump=false) |
| Load binary descriptor from memory. | |
| SObjectCfg::SObjectCfgData * | objectCfgAtOffset (size_t offset) |
| Get object configuration at offset. | |
| SObjectCfg::UObjectCfgId * | objectCfgIdAtOffset (size_t offset) |
| Get configuration ID at offset. | |
| void | reset () |
| Clear currently loaded descriptor state. | |
Static Public Member Functions | |
| static int | binCheckFill (uint32_t *bin, size_t len) |
| Calculate and store descriptor CRC32 checksum. | |
| static bool | binCheckValid (const uint32_t *bin, size_t len) |
| Validate descriptor CRC32 checksum. | |
| static void | binDump (const uint32_t *bin, size_t len) |
| Print descriptor contents to console (debug). | |
| static int | binValid (const uint32_t *bin, size_t len) |
| Validate binary descriptor integrity. | |
| static SObjectCfg::ObjectCfgId | cfgId (bool rw, uint8_t dtype, uint8_t size, uint8_t id) |
| Create ConfigID for metadata. | |
| static SObjectCfg::ObjectCfgId | cfgIdString (uint16_t size, bool rw=false) |
| Create ConfigID for device string. | |
| static SObjectCfg::ObjectCfgId | cfgIdVersion (bool rw=false) |
| Create ConfigID for firmware version. | |
| static SObjectId::ObjectId | objectId (uint16_t inst) |
| Construct 32-bit ObjectID from component fields. | |
Static Public Attributes | |
| static uint32_t | DAWN_DESCRIPTOR_FOOT = 0x02030a0d |
| Footer magic number (0x02030a0d). | |
| static uint32_t | DAWN_DESCRIPTOR_HDR = 0x0d0a0302 |
| Header magic number (0x0d0a0302). | |
Binary device descriptor manager.
Definition at line 20 of file descriptor.hxx.
| typedef std::function<void(CHandler &obj, CDescObject &desc)> dawn::CDescriptor::allocobj_func_t |
Thread function callback storage.
std::function allows storing any callable type set via setThreadFunc().
| h | Handler that will manage allocated objects. |
| func | Callback invoked for each object. |
Definition at line 191 of file descriptor.hxx.
|
static |
Calculate and store descriptor CRC32 checksum.
| bin | Pointer to binary descriptor data. |
| len | Length in 32-bit words. |
Definition at line 209 of file descriptor.cxx.
References DAWN_DESCRIPTOR_FOOT.
|
static |
Validate descriptor CRC32 checksum.
| bin | Pointer to binary descriptor data. |
| len | Length in 32-bit words. |
Definition at line 202 of file descriptor.cxx.
|
static |
Print descriptor contents to console (debug).
| bin | Pointer to binary descriptor data. |
| len | Length in 32-bit words. |
Definition at line 99 of file descriptor.cxx.
References dawn::SObjectCfg::UObjectCfgId::s, dawn::SObjectCfg::UObjectCfgId::size, and dawn::SObjectCfg::UObjectCfgId::v.
|
static |
Validate binary descriptor integrity.
| bin | Pointer to binary descriptor data. |
| len | Length in 32-bit words. |
Definition at line 160 of file descriptor.cxx.
References binCheckValid(), DAWN_DESCRIPTOR_HDR, and dawn::CObject::validateDesc().
|
inlinestatic |
Create ConfigID for metadata.
| rw | Read-write flag. |
| dtype | Data type. |
| size | Configuration data size in 32-bit words. |
| id | Configuration identifier. |
Definition at line 91 of file descriptor.hxx.
References dawn::SObjectCfg::objectCfg(), and dawn::SObjectId::OBJTYPE_ANY.
|
inlinestatic |
Create ConfigID for device string.
| size | Configuration data size in 32-bit words. |
| rw | Read-write flag (default: false). |
Definition at line 116 of file descriptor.hxx.
References cfgId(), and dawn::SObjectId::DTYPE_CHAR.
|
inlinestatic |
Create ConfigID for firmware version.
| rw | Read-write flag (default: false). |
Definition at line 103 of file descriptor.hxx.
References cfgId(), and dawn::SObjectId::DTYPE_UINT32.
| CDescriptor::SDescriptorBin * CDescriptor::getBin | ( | ) |
Get loaded descriptor binary structure.
Definition at line 359 of file descriptor.cxx.
| size_t CDescriptor::getBinLen | ( | ) |
Get loaded descriptor size in bytes.
Definition at line 364 of file descriptor.cxx.
| int CDescriptor::loadBin | ( | uint32_t * | bin, |
| size_t | len, | ||
| bool | force_valid = false, |
||
| bool | dump = false |
||
| ) |
Load binary descriptor from memory.
| bin | Pointer to binary descriptor data (32-bit aligned). |
| len | Length in 32-bit words. |
| force_valid | Recalculate and fill descriptor CRC if true. |
| dump | Dump descriptor contents if true (default false). |
Definition at line 317 of file descriptor.cxx.
References binCheckFill(), binDump(), binValid(), DAWN_DESCRIPTOR_FOOT, and reset().
| SObjectCfg::SObjectCfgData * CDescriptor::objectCfgAtOffset | ( | size_t | offset | ) |
Get object configuration at offset.
| offset | Offset in 32-bit words. |
Definition at line 391 of file descriptor.cxx.
| SObjectCfg::UObjectCfgId * CDescriptor::objectCfgIdAtOffset | ( | size_t | offset | ) |
Get configuration ID at offset.
| offset | Offset in 32-bit words. |
Definition at line 402 of file descriptor.cxx.
|
inlinestatic |
Construct 32-bit ObjectID from component fields.
Packs individual fields into a single 32-bit ObjectID value.
| inst | Instance number (typically 0). |
Definition at line 76 of file descriptor.hxx.
References dawn::SObjectId::objectId(), and dawn::SObjectId::OBJTYPE_ANY.
| void CDescriptor::reset | ( | ) |
Clear currently loaded descriptor state.
Releases cached descriptor object wrappers and clears binary pointers.
Definition at line 303 of file descriptor.cxx.