DVBCore  20.3.0
DVBCore Documentation
Macros | Functions
stbdbnvm.h File Reference

Header file - Function prototypes for NVM database. More...

#include "techtype.h"
#include "dba_nvm.h"

Go to the source code of this file.

Macros

#define NVM_INVALID_BLOCK_ID   0xffff
 

Functions

void STB_InitNVMAccess (U16BIT offset)
 Initialises parameters needed for NVM block access. More...
 
void STB_InitNVMMap (void)
 Initialises parameters needed for NVM block access (calcs num blocks if required)
 
BOOLEAN STB_CheckNVMDatabaseIntegrity (void)
 Reads each database block from NVM and checks its checksum. If the data has already been read into the RAM cache then the data will be checked from here, but this data has been read from NVM and is an exact copy, so the check is still valid. Note: It's assumed that STB_InitNVMAccess has already been called. More...
 
void STB_SetNVMAccessRAM (U8BIT *ram_ptr)
 Sets all DB NVM access to RAM block supplied instead of NVM (cancel if NULL). More...
 
U8BIT * STB_GetNVMAccessRAM (void)
 Returns the current RAM pointer used for DB NVM access. More...
 
U16BIT STB_GetNVMBlockCount (void)
 Returns total number of NVM database blocks. More...
 
U16BIT STB_GetNVMBlocksUsed (void)
 Returns total number of NVM database blocks in use. More...
 
U16BIT STB_GetNVMBlockSize (void)
 Returns the size of an NVM database block, in bytes. More...
 
U16BIT STB_GetNVMBlocksNeeded (U16BIT size)
 Returns number of NVM database blocks needed for specified number of bytes. More...
 
U16BIT STB_CreateNVMRecord (U8BIT rec_id, U16BIT size)
 Creates a record of the type given in NVM by overwriting invalid blocks. More...
 
void STB_DestroyNVMRecord (U16BIT block_no)
 Destroys NVM record by marking all NVM blocks used by the record as invalid. More...
 
void STB_SetNextNVMBlock (U16BIT block_no, U16BIT next_block)
 Repairs NVM linked list by pointing the NVM record starting at the specified block number to the record starting at the specified next block number. More...
 
U16BIT STB_GetNextNVMBlock (U16BIT block_no)
 Returns the block number of the next NVM record pointed to by the NVM record starting at the specified block number. More...
 
U16BIT STB_FindNVMRecordFromId (U8BIT rec_id, U16BIT last_blk)
 Finds next record of the type given in NVM. More...
 
void STB_NVMChanged (BOOLEAN state)
 
void STB_NVMFlushCache (BOOLEAN clear)
 Flush cached changes. More...
 
void STB_NVMSave (void)
 Saves the RAM cache data to NVM.
 
void STB_SetNVMRecordString (U16BIT block_no, U16BIT offset, U16BIT size, U8BIT *string)
 Writes the specified value into a field of a NVM record. More...
 
void STB_SetNVMRecordNumber (U16BIT block_no, U16BIT offset, U16BIT size, U32BIT value)
 Writes the specified value into a field of a NVM record. More...
 
U8BIT * STB_GetNVMRecordString (U16BIT block_no, U16BIT offset, U16BIT size)
 Reads string of a field from a NVM record. More...
 
U32BIT STB_GetNVMRecordNumber (U16BIT block_no, U16BIT offset, U16BIT size)
 Reads the specified value of a field from a NVM record. More...
 
void STB_WriteNVMData (U16BIT offset, U16BIT size, U8BIT *data_ptr)
 Writes the given data to NVM. More...
 
BOOLEAN STB_ReadNVMData (U16BIT offset, U16BIT size, U8BIT *data_ptr)
 Reads data from the NVM into the given buffer. More...
 

Detailed Description

Header file - Function prototypes for NVM database.

Date
06/09/2000

Definition in file stbdbnvm.h.

Function Documentation

◆ STB_CheckNVMDatabaseIntegrity()

BOOLEAN STB_CheckNVMDatabaseIntegrity ( void  )

Reads each database block from NVM and checks its checksum. If the data has already been read into the RAM cache then the data will be checked from here, but this data has been read from NVM and is an exact copy, so the check is still valid. Note: It's assumed that STB_InitNVMAccess has already been called.

Returns
TRUE if all checksums are valid, FALSE otherwise

Definition at line 564 of file stbdbnvm.c.

◆ STB_CreateNVMRecord()

U16BIT STB_CreateNVMRecord ( U8BIT  rec_id,
U16BIT  size 
)

Creates a record of the type given in NVM by overwriting invalid blocks.

Parameters
U8BITrec_id - the ID of the record to be created
U16BITsize - the size the record to be created (in bytes)
Returns
U16BIT - block number created if OK, else NVM_INVALID_BLOCK_ID.

Definition at line 731 of file stbdbnvm.c.

◆ STB_DestroyNVMRecord()

void STB_DestroyNVMRecord ( U16BIT  block_no)

Destroys NVM record by marking all NVM blocks used by the record as invalid.

Parameters
U16BITblock_no - the first NVM block number of the record

Definition at line 805 of file stbdbnvm.c.

◆ STB_FindNVMRecordFromId()

U16BIT STB_FindNVMRecordFromId ( U8BIT  rec_id,
U16BIT  last_blk 
)

Finds next record of the type given in NVM.

Parameters
U8BITrec_id - the ID of the record
U16BITlast_blk - last block found (NVM_INVALID_BLOCK_ID if none)
Returns
U16BIT - block number found if OK, else NVM_INVALID_BLOCK_ID.

Definition at line 969 of file stbdbnvm.c.

◆ STB_GetNextNVMBlock()

U16BIT STB_GetNextNVMBlock ( U16BIT  block_no)

Returns the block number of the next NVM record pointed to by the NVM record starting at the specified block number.

Parameters
U16BITblock_no - the NVM block number of the current record
Returns
U16BIT - the NVM block number of the next record.

Definition at line 918 of file stbdbnvm.c.

◆ STB_GetNVMAccessRAM()

U8BIT* STB_GetNVMAccessRAM ( void  )

Returns the current RAM pointer used for DB NVM access.

Returns
U8BIT* - pointer to RAM area

Definition at line 619 of file stbdbnvm.c.

◆ STB_GetNVMBlockCount()

U16BIT STB_GetNVMBlockCount ( void  )

Returns total number of NVM database blocks.

Returns
U16BIT - number of blocks.

Definition at line 637 of file stbdbnvm.c.

◆ STB_GetNVMBlockSize()

U16BIT STB_GetNVMBlockSize ( void  )

Returns the size of an NVM database block, in bytes.

Returns
size of block in bytes

Definition at line 686 of file stbdbnvm.c.

◆ STB_GetNVMBlocksNeeded()

U16BIT STB_GetNVMBlocksNeeded ( U16BIT  size)

Returns number of NVM database blocks needed for specified number of bytes.

Parameters
U16BITsize - the size (in bytes)
Returns
U16BIT - number of blocks.

Definition at line 704 of file stbdbnvm.c.

◆ STB_GetNVMBlocksUsed()

U16BIT STB_GetNVMBlocksUsed ( void  )

Returns total number of NVM database blocks in use.

Returns
U16BIT - number of blocks.

Definition at line 661 of file stbdbnvm.c.

◆ STB_GetNVMRecordNumber()

U32BIT STB_GetNVMRecordNumber ( U16BIT  block_no,
U16BIT  offset,
U16BIT  size 
)

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

Parameters
U16BITblock_no - the first NVM block number of the 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 1208 of file stbdbnvm.c.

◆ STB_GetNVMRecordString()

U8BIT* STB_GetNVMRecordString ( U16BIT  block_no,
U16BIT  offset,
U16BIT  size 
)

Reads string of a field from a NVM record.

Parameters
U16BITblock_no - the first NVM block number of the record
U16BIToffset - field byte offset into the record
U16BITsize - field byte size in the record
Returns
U8BIT* - string of the field.

Definition at line 1171 of file stbdbnvm.c.

◆ STB_InitNVMAccess()

void STB_InitNVMAccess ( U16BIT  offset)

Initialises parameters needed for NVM block access.

Parameters
U16BIToffset - offset to NVM blocks in bytes

Definition at line 472 of file stbdbnvm.c.

◆ STB_NVMFlushCache()

void STB_NVMFlushCache ( BOOLEAN  clear)

Flush cached changes.

Parameters
clearTRUE clear the cache after flushing cached changes, FALSE do not clear the cache

Definition at line 1017 of file stbdbnvm.c.

◆ STB_ReadNVMData()

BOOLEAN STB_ReadNVMData ( U16BIT  offset,
U16BIT  size,
U8BIT *  data_ptr 
)

Reads data from the NVM into the given buffer.

Parameters
U16BIToffset - byte offset from which to read the data
U16BITsize - number of bytes of data to read
U8BIT*data_ptr - address of buffer to read data into
Returns
BOOLEAN - TRUE on success, else FALSE.

Definition at line 1297 of file stbdbnvm.c.

◆ STB_SetNextNVMBlock()

void STB_SetNextNVMBlock ( U16BIT  block_no,
U16BIT  next_block 
)

Repairs NVM linked list by pointing the NVM record starting at the specified block number to the record starting at the specified next block number.

Parameters
U16BITblock_no - the NVM block number of the current record
U16BITnext_block - the NVM block number of the next record

Definition at line 865 of file stbdbnvm.c.

◆ STB_SetNVMAccessRAM()

void STB_SetNVMAccessRAM ( U8BIT *  ram_ptr)

Sets all DB NVM access to RAM block supplied instead of NVM (cancel if NULL).

Parameters
U8BIT*ram_ptr - pointer to RAM area

Definition at line 599 of file stbdbnvm.c.

◆ STB_SetNVMRecordNumber()

void STB_SetNVMRecordNumber ( U16BIT  block_no,
U16BIT  offset,
U16BIT  size,
U32BIT  value 
)

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

Parameters
U16BITblock_no - the first NVM block number of the record
U16BIToffset - field bit offset into the record
U16BITsize - field bit size in the record
U32BITvalue - the numeric value of the field

Definition at line 1120 of file stbdbnvm.c.

◆ STB_SetNVMRecordString()

void STB_SetNVMRecordString ( U16BIT  block_no,
U16BIT  offset,
U16BIT  size,
U8BIT *  string 
)

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

Parameters
U16BITblock_no - the first NVM block number of the record
U16BIToffset - field bit offset into the record
U16BITsize - field bit size in the record
U8BIT*string - the string value of the field

Definition at line 1074 of file stbdbnvm.c.

◆ STB_WriteNVMData()

void STB_WriteNVMData ( U16BIT  offset,
U16BIT  size,
U8BIT *  data_ptr 
)

Writes the given data to NVM.

Parameters
U16BIToffset - byte offset at which to write the data
U16BITsize - number of bytes of data to write
U8BIT*data_ptr - pointer to the data to be written

Definition at line 1262 of file stbdbnvm.c.