Declaration of the "low-level" memory block read/write functions that are provided in a separate DLL called Adapter_BackEnd.dll, which is wrapped or adapted to by the various programming languages as part of the Adapter Pattern examples. More...
#include <stdint.h>
Go to the source code of this file.
Macros | |
#define | __ADAPTER_BACKENDFUNCTIONS_H__ |
#define | DllExport |
Enumerations | |
enum | { DDR_MAX_OFFSET = 32 , DDR_INVALID_HANDLE = -1 } |
enum | DDR_ErrorCode { DDR_ErrorCode_Success = 0 , DDR_ErrorCode_Block_Already_Opened = 1 , DDR_ErrorCode_Block_Not_Opened = 2 , DDR_ErrorCode_Invalid_Block_Name = 3 , DDR_ErrorCode_Invalid_Handle = 4 , DDR_ErrorCode_Invalid_Offset = 5 , DDR_ErrorCode_Null_Argument = 6 } |
Represents the possible errors that can be returned from the memory block access functions. More... | |
Functions | |
DllExport DDR_ErrorCode | DDR_OpenMemoryBlock (const char *blockName, int *dataHandle) |
Open access to a memory block for exclusive use, given the name of the memory block. | |
DllExport DDR_ErrorCode | DDR_CloseMemoryBlock (int dataHandle) |
Close access to a previously opened memory block, thus releasing it for others to open. | |
DllExport DDR_ErrorCode | DDR_GetMemorySize (int dataHandle, int *memorySizeInChunks) |
Retrieve the number of chunks in the memory block indicated by the handle to the successfully opened memory block. | |
DllExport DDR_ErrorCode | DDR_GetDataChunk (int dataHandle, int chunkOffset, uint32_t *value) |
Read a single 32-bit value at the given offset in the memory block indicated by the specified handle. | |
DllExport DDR_ErrorCode | DDR_SetDataChunk (int dataHandle, int chunkOffset, uint32_t value) |
Writes a single 32-bit value to the given offset in the memory block indicated by the specified handle. | |
Variables | |
DllExport const char * | BLOCK_NAME_0 |
Name of the first block. | |
DllExport const char * | BLOCK_NAME_1 |
Name of the second block. | |
DllExport const char * | BLOCK_NAME_2 |
Name of the third block. | |
Declaration of the "low-level" memory block read/write functions that are provided in a separate DLL called Adapter_BackEnd.dll, which is wrapped or adapted to by the various programming languages as part of the Adapter Pattern examples.
Definition in file Adapter_BackEnd.h.
#define __ADAPTER_BACKENDFUNCTIONS_H__ |
Definition at line 10 of file Adapter_BackEnd.h.
#define DllExport |
Definition at line 21 of file Adapter_BackEnd.h.
anonymous enum |
Enumerator | |
---|---|
DDR_MAX_OFFSET | All offsets must from 0 to 1 less than this value. |
DDR_INVALID_HANDLE | Value indicating the handle is invalid. |
Definition at line 38 of file Adapter_BackEnd.h.
enum DDR_ErrorCode |
Represents the possible errors that can be returned from the memory block access functions.
Definition at line 48 of file Adapter_BackEnd.h.
DllExport DDR_ErrorCode DDR_CloseMemoryBlock | ( | int | dataHandle | ) |
Close access to a previously opened memory block, thus releasing it for others to open.
dataHandle | Handle to a previously opened memory block as obtained from the DDR_OpenMemoryBlock() function. |
Definition at line 150 of file Adapter_BackEnd.c.
References _ConvertHandleToBlockIndex(), DDR_ErrorCode_Block_Not_Opened, DDR_ErrorCode_Invalid_Handle, DDR_ErrorCode_Success, MemoryBlock::locked, and memory_blocks.
Referenced by Adapter_CloseMemory(), and DataReaderWriter::~DataReaderWriter().
DllExport DDR_ErrorCode DDR_GetDataChunk | ( | int | dataHandle, |
int | chunkOffset, | ||
uint32_t * | value | ||
) |
Read a single 32-bit value at the given offset in the memory block indicated by the specified handle.
dataHandle | Handle to a previously opened memory block as obtained from the DDR_OpenMemoryBlock() function. |
chunkOffset | Offset into the memory block from which to get the value (range is 0 to DDR_MAX_OFFSET-1). |
value | Returns the requested value. |
Definition at line 191 of file Adapter_BackEnd.c.
References _ConvertHandleToBlockIndex(), _IsValidOffset(), MemoryBlock::data, DDR_ErrorCode_Block_Not_Opened, DDR_ErrorCode_Invalid_Offset, DDR_ErrorCode_Null_Argument, DDR_ErrorCode_Success, and memory_blocks.
Referenced by Adapter_ReadMemory(), Adapter_WriteMemory(), DataReaderWriter::Read(), and DataReaderWriter::Write().
DllExport DDR_ErrorCode DDR_GetMemorySize | ( | int | dataHandle, |
int * | memorySizeInChunks | ||
) |
Retrieve the number of chunks in the memory block indicated by the handle to the successfully opened memory block.
dataHandle | Handle to a previously opened memory block as obtained from the DDR_OpenMemoryBlock() function. |
memorySizeInChunks | Returns the number of 32-bit chunks in the memory block. |
Definition at line 171 of file Adapter_BackEnd.c.
References _ConvertHandleToBlockIndex(), DDR_ErrorCode_Invalid_Handle, DDR_ErrorCode_Null_Argument, DDR_ErrorCode_Success, and MAX_DATA_SIZE.
Referenced by Adapter_GetMemorySize(), and DataReaderWriter::DataReaderWriter().
DllExport DDR_ErrorCode DDR_OpenMemoryBlock | ( | const char * | blockName, |
int * | dataHandle | ||
) |
Open access to a memory block for exclusive use, given the name of the memory block.
blockName | Name of the block to access (one of the predefined names, BLOCK_NAME_0 , BLOCK_NAME_1 , or BLOCK_NAME_2 ) |
dataHandle | Returns a handle to be used for accessing the specific memory block. |
Definition at line 121 of file Adapter_BackEnd.c.
References _FindBlock(), DDR_ErrorCode_Block_Already_Opened, DDR_ErrorCode_Invalid_Block_Name, DDR_ErrorCode_Null_Argument, DDR_ErrorCode_Success, DDR_INVALID_HANDLE, MemoryBlock::locked, and memory_blocks.
Referenced by Adapter_OpenMemory(), and DataReaderWriter::DataReaderWriter().
DllExport DDR_ErrorCode DDR_SetDataChunk | ( | int | dataHandle, |
int | chunkOffset, | ||
uint32_t | value | ||
) |
Writes a single 32-bit value to the given offset in the memory block indicated by the specified handle.
dataHandle | Handle to a previously opened memory block as obtained from the DDR_OpenMemoryBlock() function. |
chunkOffset | Offset into the memory block to which to set the value (range is 0 to DDR_MAX_OFFSET-1). |
value | The value to write to the memory block |
Definition at line 219 of file Adapter_BackEnd.c.
References _ConvertHandleToBlockIndex(), _IsValidOffset(), MemoryBlock::data, DDR_ErrorCode_Block_Not_Opened, DDR_ErrorCode_Invalid_Handle, DDR_ErrorCode_Invalid_Offset, DDR_ErrorCode_Success, and memory_blocks.
Referenced by Adapter_WriteMemory(), and DataReaderWriter::Write().
|
extern |
Name of the first block.
Definition at line 13 of file Adapter_BackEnd.c.
Referenced by DataReaderWriter::_GetBlockNameForBlockNumber(), and _GetBlockNameForBlockNumber().
|
extern |
Name of the second block.
Definition at line 14 of file Adapter_BackEnd.c.
Referenced by DataReaderWriter::_GetBlockNameForBlockNumber(), and _GetBlockNameForBlockNumber().
|
extern |
Name of the third block.
Definition at line 15 of file Adapter_BackEnd.c.
Referenced by DataReaderWriter::_GetBlockNameForBlockNumber(), and _GetBlockNameForBlockNumber().