87 if (llist_hdr_array != NULL)
89 for (i = 0; i < DBA_NUM_RECORDS; i++)
91 llist_hdr_array[i].null_next = NULL;
92 llist_hdr_array[i].first = &llist_hdr_array[i];
93 llist_hdr_array[i].last = &llist_hdr_array[i];
120 for (i = 0; i < DBA_NUM_RECORDS; i++)
124 while (rec_ptr != NULL)
162 ASSERT(rec_id < DBA_NUM_RECORDS);
172 memset(rec_ptr, 0, size);
201 ASSERT(rec_ptr != NULL);
229 ASSERT(rec_ptr != NULL);
255 ASSERT(rec_ptr != NULL);
281 ASSERT(rec_ptr != NULL);
286 ret_val = NVM_INVALID_BLOCK_ID;
315 ASSERT(rec_ptr != NULL);
320 ret_val = NVM_INVALID_BLOCK_ID;
349 ASSERT(rec_ptr != NULL);
374 ASSERT(rec_ptr != NULL);
397 ASSERT(rec_ptr != NULL);
398 ASSERT(dst_ptr != NULL);
422 ASSERT(rec_ptr != NULL);
423 ASSERT(dst_ptr != NULL);
449 void *ret_val = NULL;
453 ASSERT(rec_id < DBA_NUM_RECORDS);
455 if (last_rec == NULL)
467 while ((rec_ptr != NULL) && (ret_val == NULL))
475 while (tmp_ptr != NULL)
514 void *ret_val = NULL;
519 for (i = 0; i < DBA_NUM_RECORDS; i++)
523 while (rec_ptr != NULL)
559 ASSERT(rec_ptr != NULL);
562 data_ptr = (U8BIT *)rec_ptr;
569 for (i = 0; i != size; i++)
571 *data_ptr++ =
string[i];
573 *(data_ptr - 1) =
'\0';
600 ASSERT(rec_ptr != NULL);
604 data_ptr = (U8BIT *)rec_ptr;
610 data_ptr += (size - 1);
611 for (i = 0; i != size; i++)
613 *data_ptr-- = (value & 0x000000ff);
614 value = (value >> 8);
634 long value = (long)ptr;
638 ASSERT(rec_ptr != NULL);
641 data_ptr = (U8BIT *)rec_ptr;
645 data_ptr += (
sizeof(
void*) - 1);
646 for (i = 0; i !=
sizeof(
void*); i++)
648 *data_ptr-- = (value & 0x000000ff);
649 value = (value >> 8);
672 USE_UNWANTED_PARAM(size);
674 ASSERT(rec_ptr != NULL);
677 data_ptr = (U8BIT *)rec_ptr;
705 ASSERT(rec_ptr != NULL);
709 data_ptr = (U8BIT *)rec_ptr;
715 for (i = 0; i != size; i++)
717 value = (value << 8);
718 value |= *data_ptr++;
745 ASSERT(rec_ptr != NULL);
748 data_ptr = (U8BIT *)rec_ptr;
754 for (i = 0; i !=
sizeof(
void*); i++)
756 value = (value << 8);
757 value |= *data_ptr++;
762 return((
void*)value);
U16BIT STB_GetRAMRecordNVMBlock(void *rec_ptr)
Returns NVM block number for given record pointer.
void STB_LLAddBlockToEnd(LINK_LIST_HEADER *hdr, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the end of the linked list identified by the list...
void * STB_GetMemory(U32BIT bytes)
Attempts to allocate memory from the heap.
NVM database access defines, structures and functions.
Header file - Function prototypes for RAM database.
void * STB_GetRAMRecordParent(void *rec_ptr)
Returns parent pointer for given record pointer.
LINK_LIST_PTR_BLK * STB_LLGetPrevBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the previous block in the linked list, or NULL if at the start of the list...
void * STB_GetRAMRecordPointer(void *rec_ptr, U16BIT offset)
Reads the specified value of a field from a RAM record.
void STB_SetRAMRecordString(void *rec_ptr, U16BIT offset, U16BIT size, U8BIT *string)
Writes the specified string into a field of a RAM record.
void * STB_CreateRAMRecord(U8BIT rec_id, U16BIT size, U16BIT nvm_block, void *parent)
Creates a record of the type given in RAM (mallocs block).
Header file - Function prototypes for NVM database.
void STB_SetRAMRecordParent(void *rec_ptr, void *parent)
Sets parent pointer for given record pointer.
U32BIT STB_GetRAMRecordNumber(void *rec_ptr, U16BIT offset, U16BIT size)
Reads the specified value of a field from a RAM record.
void STB_MoveRAMRecordBefore(void *rec_ptr, void *dst_ptr)
Moves RAM record before the specified record in the RAM linked list.
void STB_SetRAMRecordPointer(void *rec_ptr, U16BIT offset, void *ptr)
Writes the specified value into a field of a RAM record.
void STB_FreeMemory(void *addr)
Releases previously allocated heap memory.
U8BIT * STB_GetRAMRecordString(void *rec_ptr, U16BIT offset, U16BIT size)
Reads the specified value of a field from a RAM record.
void STB_InitRAMAccess(void)
Initialises parameters needed for RAM record access.
U16BIT STB_GetRAMRecordNextNVMBlock(void *rec_ptr)
Returns NVM block number for next record of given pointer.
void STB_MoveRAMRecordAfter(void *rec_ptr, void *dst_ptr)
Moves RAM record after the specified record in the RAM linked list.
Debug functions header file.
void STB_LLRemoveBlock(LINK_LIST_PTR_BLK *blk)
Removes the block identified by the blk pointer from its linked list.
Header file - Function prototypes for linked lists.
void * STB_FindRAMRecordFromId(U8BIT rec_id, void *parent, void *last_rec)
Returns pointer to RAM structure for the given record type. Finds the next record in the list after t...
LINK_LIST_PTR_BLK * STB_LLGetNextBlock(LINK_LIST_PTR_BLK *blk)
Returns a pointer to the next block in the linked list, or NULL if at the end of the list...
Database access defines, structures and public functions.
void STB_PurgeRAMRecords(void)
Initialises RAM database by destroying all records and linked lists.
void STB_SetRAMRecordNumber(void *rec_ptr, U16BIT offset, U16BIT size, U32BIT value)
Writes the specified value into a field of a RAM record.
U8BIT STB_GetRAMRecordId(void *rec_ptr)
Returns record type id for given record pointer.
LINK_LIST_PTR_BLK * STB_LLGetFirstBlock(LINK_LIST_HEADER *hdr)
Returns a pointer to the first block in the linked list, identified by hdr.
System Wide Global Technical Data Type Definitions.
void STB_LLAddBlockBefore(LINK_LIST_PTR_BLK *blk, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the linked list before the block identified by th...
U16BIT STB_GetRAMRecordPrevNVMBlock(void *rec_ptr)
Returns NVM block number for previous record of given pointer.
Header file - Function prototypes for heap memory.
void STB_LLAddBlockAfter(LINK_LIST_PTR_BLK *blk, LINK_LIST_PTR_BLK *new_blk)
Adds the block identified by the new_blk pointer to the linked list after the block identified by the...
void STB_DestroyRAMRecord(void *rec_ptr)
Destroys record given in RAM (frees block).
void * STB_FindRAMRecordFromNVMBlock(U16BIT nvm_block)
Returns pointer to RAM structure which relates to the given NVM record block no.