- edited description
Create DataPackage library
Issue #188
resolved
General Description:
There is a lot of functions in the system that handles read/write operations on buffers. Very often it is required to pass the buffer size and address to the function and also request about number of bytes that has been read/written. It has to be implemented in each module separately. The idea of the task is to prepare a simple module that helps in such operations. The module should be implemented as part of the Library Space in files oc_datapackage.h
and oc_datapackage.c
.
Interface
The library should provide the following interface:
// General structure for handling data package typedef struct { union { // Pointer to the buffer const void * WriteBuffer; void * ReadBuffer; const uint8_t * WriteArrayU8; uint8_t * ReadArrayU8; const uint16_t * WriteArrayU16; uint16_t * ReadArrayU16; const uint32_t * WriteArrayU32; uint32_t * ReadArrayU32; const uint64_t * WriteArrayU64; uint64_t * ReadArrayU64; }; bool ReadOnly; // Flag set if the buffer is read only oC_MemorySize_t BufferSize; // Size of the buffer in bytes oC_MemorySize_t DataLength; // Number of data bytes inside the buffer oC_MemorySize_t DataOffset; // Offset in the buffer where data has started } oC_DataPackage_t; static inline void oC_DataPackage_Initialize( oC_DataPackage_t * DataPackage, const void * Buffer , oC_MemorySize_t Size, oC_MemorySize_t DataLength, bool ReadOnly ) ; static inline bool oC_DataPackage_IsFull( const oC_DataPackage_t * DataPackage ); static inline bool oC_DataPackage_IsEmpty( const oC_DataPackage_t * DataPackage ); static inline bool oC_DataPackage_PutDataU8( oC_DataPackage_t * DataPackage, uint8_t Data ); static inline bool oC_DataPackage_PutDataU16( oC_DataPackage_t * DataPackage, uint16_t Data ); static inline bool oC_DataPackage_PutDataU32( oC_DataPackage_t * DataPackage, uint32_t Data ); static inline bool oC_DataPackage_PutDataU64( oC_DataPackage_t * DataPackage, uint64_t Data ); static inline uint8_t oC_DataPackage_GetDataU8( oC_DataPackage_t * DataPackage ); static inline uint16_t oC_DataPackage_GetDataU16( oC_DataPackage_t * DataPackage ); static inline uint32_t oC_DataPackage_GetDataU32( oC_DataPackage_t * DataPackage ); static inline uint64_t oC_DataPackage_GetDataU64( oC_DataPackage_t * DataPackage );
Comments (7)
-
reporter -
reporter - edited description
-
reporter - changed component to Library-Space
-
reporter - edited description
-
reporter - changed status to open
-
reporter - removed component
Removing component: Library-Space (automated comment)
-
reporter - changed status to resolved
The task has been implemented in https://bitbucket.org/chocos/chocos/pull-requests/41/blocker-implement-datapackage-library/diff
- Log in to comment