DVBCore  20.3.0
DVBCore Documentation
Classes | Functions
stbdbram.c File Reference

RAM database functions. More...

#include <string.h>
#include <techtype.h>
#include <dbgfuncs.h>
#include "dba.h"
#include "dba_nvm.h"
#include "stbdbram.h"
#include "stbdbnvm.h"
#include "stbllist.h"
#include "stbheap.h"

Go to the source code of this file.

Classes

struct  RAM_DB_HEADER
 

Functions

void STB_InitRAMAccess (void)
 Initialises parameters needed for RAM record access.
 
void STB_PurgeRAMRecords (void)
 Initialises RAM database by destroying all records and linked lists.
 
void * STB_CreateRAMRecord (U8BIT rec_id, U16BIT size, U16BIT nvm_block, void *parent)
 Creates a record of the type given in RAM (mallocs block). More...
 
void STB_DestroyRAMRecord (void *rec_ptr)
 Destroys record given in RAM (frees block). More...
 
U8BIT STB_GetRAMRecordId (void *rec_ptr)
 Returns record type id for given record pointer. More...
 
U16BIT STB_GetRAMRecordNVMBlock (void *rec_ptr)
 Returns NVM block number for given record pointer. More...
 
U16BIT STB_GetRAMRecordPrevNVMBlock (void *rec_ptr)
 Returns NVM block number for previous record of given pointer. More...
 
U16BIT STB_GetRAMRecordNextNVMBlock (void *rec_ptr)
 Returns NVM block number for next record of given pointer. More...
 
void * STB_GetRAMRecordParent (void *rec_ptr)
 Returns parent pointer for given record pointer. More...
 
void STB_SetRAMRecordParent (void *rec_ptr, void *parent)
 Sets parent pointer for given record pointer. More...
 
void STB_MoveRAMRecordBefore (void *rec_ptr, void *dst_ptr)
 Moves RAM record before the specified record in the RAM linked list. More...
 
void STB_MoveRAMRecordAfter (void *rec_ptr, void *dst_ptr)
 Moves RAM record after the specified record in the RAM linked list. More...
 
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 the last_rec or first if NULL. More...
 
void * STB_FindRAMRecordFromNVMBlock (U16BIT nvm_block)
 Returns pointer to RAM structure which relates to the given NVM record block no. More...
 
void STB_SetRAMRecordString (void *rec_ptr, U16BIT offset, U16BIT size, U8BIT *string)
 Writes the specified string into a field of a RAM record. More...
 
void STB_SetRAMRecordNumber (void *rec_ptr, U16BIT offset, U16BIT size, U32BIT value)
 Writes the specified value into a field of a RAM record. More...
 
void STB_SetRAMRecordPointer (void *rec_ptr, U16BIT offset, void *ptr)
 Writes the specified value into a field of a RAM record. More...
 
U8BIT * STB_GetRAMRecordString (void *rec_ptr, U16BIT offset, U16BIT size)
 Reads the specified value of a field from a RAM record. More...
 
U32BIT STB_GetRAMRecordNumber (void *rec_ptr, U16BIT offset, U16BIT size)
 Reads the specified value of a field from a RAM record. More...
 
void * STB_GetRAMRecordPointer (void *rec_ptr, U16BIT offset)
 Reads the specified value of a field from a RAM record. More...
 

Detailed Description

RAM database functions.

Date
06/09/2000

Definition in file stbdbram.c.

Function Documentation

◆ STB_CreateRAMRecord()

void* STB_CreateRAMRecord ( U8BIT  rec_id,
U16BIT  size,
U16BIT  nvm_block,
void *  parent 
)

Creates a record of the type given in RAM (mallocs block).

Parameters
U8BITrec_id - the ID of the record to be created
U16BITsize - the size the record to be created (in bytes)
U16BITnvm_block - the ID of the corresponding NVM block
void*parent - the pointer to record parent
Returns
void* - pointer to record created, NULL if failed.

Definition at line 156 of file stbdbram.c.

◆ STB_DestroyRAMRecord()

void STB_DestroyRAMRecord ( void *  rec_ptr)

Destroys record given in RAM (frees block).

Parameters
void*rec_ptr - pointer to the record to be deleted

Definition at line 197 of file stbdbram.c.

◆ STB_FindRAMRecordFromId()

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 the last_rec or first if NULL.

Parameters
U8BITrec_id - the ID of the record
void*parent - the parent of the record
void*last_rec - last record found (NULL in none)
Returns
void* - pointer to next record (NULL if no more).

Definition at line 445 of file stbdbram.c.

◆ STB_FindRAMRecordFromNVMBlock()

void* STB_FindRAMRecordFromNVMBlock ( U16BIT  nvm_block)

Returns pointer to RAM structure which relates to the given NVM record block no.

Parameters
U16BITnvm_blk - the block number of the NVM record
Returns
void* - pointer to RAM record (NULL if not found).

Definition at line 510 of file stbdbram.c.

◆ STB_GetRAMRecordId()

U8BIT STB_GetRAMRecordId ( void *  rec_ptr)

Returns record type id for given record pointer.

Parameters
void*rec_ptr - pointer to the record
Returns
U8BIT - record id.

Definition at line 223 of file stbdbram.c.

◆ STB_GetRAMRecordNextNVMBlock()

U16BIT STB_GetRAMRecordNextNVMBlock ( void *  rec_ptr)

Returns NVM block number for next record of given pointer.

Parameters
void*rec_ptr - pointer to the record
Returns
U16BIT - NVM block.

Definition at line 309 of file stbdbram.c.

◆ STB_GetRAMRecordNumber()

U32BIT STB_GetRAMRecordNumber ( void *  rec_ptr,
U16BIT  offset,
U16BIT  size 
)

Reads the specified value of a field from a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
Returns
U32BIT - the numeric value of the field.

Definition at line 697 of file stbdbram.c.

◆ STB_GetRAMRecordNVMBlock()

U16BIT STB_GetRAMRecordNVMBlock ( void *  rec_ptr)

Returns NVM block number for given record pointer.

Parameters
void*rec_ptr - pointer to the record
Returns
U16BIT - NVM block.

Definition at line 249 of file stbdbram.c.

◆ STB_GetRAMRecordParent()

void* STB_GetRAMRecordParent ( void *  rec_ptr)

Returns parent pointer for given record pointer.

Parameters
void*rec_ptr - pointer to the record
Returns
void* - pointer to the parent.

Definition at line 343 of file stbdbram.c.

◆ STB_GetRAMRecordPointer()

void* STB_GetRAMRecordPointer ( void *  rec_ptr,
U16BIT  offset 
)

Reads the specified value of a field from a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
Returns
U32BIT - the numeric value of the field.

Definition at line 737 of file stbdbram.c.

◆ STB_GetRAMRecordPrevNVMBlock()

U16BIT STB_GetRAMRecordPrevNVMBlock ( void *  rec_ptr)

Returns NVM block number for previous record of given pointer.

Parameters
void*rec_ptr - pointer to the record
Returns
U16BIT - NVM block.

Definition at line 275 of file stbdbram.c.

◆ STB_GetRAMRecordString()

U8BIT* STB_GetRAMRecordString ( void *  rec_ptr,
U16BIT  offset,
U16BIT  size 
)

Reads the specified value of a field from a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
U8BITtype - the datatype of 'value'
Returns
U32BIT - the numeric value of the field.

Definition at line 667 of file stbdbram.c.

◆ STB_MoveRAMRecordAfter()

void STB_MoveRAMRecordAfter ( void *  rec_ptr,
void *  dst_ptr 
)

Moves RAM record after the specified record in the RAM linked list.

Parameters
void*rec_ptr - pointer to the record
void*dst_ptr - pointer to destination

Definition at line 418 of file stbdbram.c.

◆ STB_MoveRAMRecordBefore()

void STB_MoveRAMRecordBefore ( void *  rec_ptr,
void *  dst_ptr 
)

Moves RAM record before the specified record in the RAM linked list.

Parameters
void*rec_ptr - pointer to the record
void*dst_ptr - pointer to destination

Definition at line 393 of file stbdbram.c.

◆ STB_SetRAMRecordNumber()

void STB_SetRAMRecordNumber ( void *  rec_ptr,
U16BIT  offset,
U16BIT  size,
U32BIT  value 
)

Writes the specified value into a field of a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
U32BITvalue - the numeric value of the field

Definition at line 593 of file stbdbram.c.

◆ STB_SetRAMRecordParent()

void STB_SetRAMRecordParent ( void *  rec_ptr,
void *  parent 
)

Sets parent pointer for given record pointer.

Parameters
void*rec_ptr - pointer to the record
void*parent - pointer to the required parent. Could be NULL for no parent.

Definition at line 370 of file stbdbram.c.

◆ STB_SetRAMRecordPointer()

void STB_SetRAMRecordPointer ( void *  rec_ptr,
U16BIT  offset,
void *  ptr 
)

Writes the specified value into a field of a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
U32BITvalue - the numeric value of the field

Definition at line 630 of file stbdbram.c.

◆ STB_SetRAMRecordString()

void STB_SetRAMRecordString ( void *  rec_ptr,
U16BIT  offset,
U16BIT  size,
U8BIT *  string 
)

Writes the specified string into a field of a RAM record.

Parameters
void*rec_ptr - pointer to the start of the RAM record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
U8BIT*string - pointer to string field

Definition at line 552 of file stbdbram.c.