DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
stbdbnvm.h
Go to the documentation of this file.
1 /*******************************************************************************
2  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
3  * Copyright © 2004 Ocean Blue Software Ltd
4  *
5  * This file is part of a DTVKit Software Component
6  * You are permitted to copy, modify or distribute this file subject to the terms
7  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
8  *
9  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
10  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
11  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
12  *
13  * If you or your organisation is not a member of DTVKit then you have access
14  * to this source code outside of the terms of the licence agreement
15  * and you are expected to delete this and any associated files immediately.
16  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
17  *******************************************************************************/
25 // pre-processor mechanism so multiple inclusions don't cause compilation error
26 
27 #ifndef _STBDBNVM_H
28 
29 #define _STBDBNVM_H
30 
31 #include "techtype.h"
32 #include "dba_nvm.h"
33 
34 //---Constant and macro definitions for public use-----------------------------
35 
36 #define NVM_INVALID_BLOCK_ID 0xffff
37 
38 //---Enumerations for public use-----------------------------------------------
39 
40 //---Global type defs for public use-------------------------------------------
41 
42 //---Global Function prototypes for public use---------------------------------
43 
44 void STB_InitNVMAccess(U16BIT offset);
45 void STB_InitNVMMap(void);
46 BOOLEAN STB_CheckNVMDatabaseIntegrity(void);
47 void STB_SetNVMAccessRAM(U8BIT *ram_ptr);
48 U8BIT* STB_GetNVMAccessRAM(void);
49 
50 U16BIT STB_GetNVMBlockCount(void);
51 U16BIT STB_GetNVMBlocksUsed(void);
52 U16BIT STB_GetNVMBlockSize(void);
53 U16BIT STB_GetNVMBlocksNeeded(U16BIT size);
54 
55 U16BIT STB_CreateNVMRecord(U8BIT rec_id, U16BIT size);
56 void STB_DestroyNVMRecord(U16BIT block_no);
57 
58 void STB_SetNextNVMBlock(U16BIT block_no, U16BIT next_block);
59 U16BIT STB_GetNextNVMBlock(U16BIT block_no);
60 
61 U16BIT STB_FindNVMRecordFromId(U8BIT rec_id, U16BIT last_blk);
62 
63 void STB_NVMChanged(BOOLEAN state);
64 void STB_NVMFlushCache(BOOLEAN clear);
65 void STB_NVMSave(void);
66 
67 void STB_SetNVMRecordString(U16BIT block_no, U16BIT offset, U16BIT size, U8BIT *string);
68 void STB_SetNVMRecordNumber(U16BIT block_no, U16BIT offset, U16BIT size, U32BIT value);
69 
70 U8BIT* STB_GetNVMRecordString(U16BIT block_no, U16BIT offset, U16BIT size);
71 U32BIT STB_GetNVMRecordNumber(U16BIT block_no, U16BIT offset, U16BIT size);
72 
73 void STB_WriteNVMData(U16BIT offset, U16BIT size, U8BIT *data_ptr);
74 BOOLEAN STB_ReadNVMData(U16BIT offset, U16BIT size, U8BIT *data_ptr);
75 
76 #endif // _STBDBNVM_H
77 
78 //*****************************************************************************
79 // End of file
80 //*****************************************************************************
81 
U16BIT STB_GetNVMBlocksNeeded(U16BIT size)
Returns number of NVM database blocks needed for specified number of bytes.
Definition: stbdbnvm.c:704
U16BIT STB_FindNVMRecordFromId(U8BIT rec_id, U16BIT last_blk)
Finds next record of the type given in NVM.
Definition: stbdbnvm.c:969
NVM database access defines, structures and functions.
BOOLEAN STB_ReadNVMData(U16BIT offset, U16BIT size, U8BIT *data_ptr)
Reads data from the NVM into the given buffer.
Definition: stbdbnvm.c:1291
void STB_WriteNVMData(U16BIT offset, U16BIT size, U8BIT *data_ptr)
Writes the given data to NVM.
Definition: stbdbnvm.c:1256
void STB_NVMSave(void)
Saves the RAM cache data to NVM.
Definition: stbdbnvm.c:1047
void STB_InitNVMAccess(U16BIT offset)
Initialises parameters needed for NVM block access.
Definition: stbdbnvm.c:472
U8BIT * STB_GetNVMRecordString(U16BIT block_no, U16BIT offset, U16BIT size)
Reads string of a field from a NVM record.
Definition: stbdbnvm.c:1165
void STB_SetNVMRecordString(U16BIT block_no, U16BIT offset, U16BIT size, U8BIT *string)
Writes the specified value into a field of a NVM record.
Definition: stbdbnvm.c:1074
U16BIT STB_GetNextNVMBlock(U16BIT block_no)
Returns the block number of the next NVM record pointed to by the NVM record starting at the specifie...
Definition: stbdbnvm.c:918
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 reco...
Definition: stbdbnvm.c:865
void STB_DestroyNVMRecord(U16BIT block_no)
Destroys NVM record by marking all NVM blocks used by the record as invalid.
Definition: stbdbnvm.c:805
System Wide Global Technical Data Type Definitions.
BOOLEAN STB_CheckNVMDatabaseIntegrity(void)
Reads each database block from NVM and checks its checksum. If the data has already been read into th...
Definition: stbdbnvm.c:564
U16BIT STB_GetNVMBlockSize(void)
Returns the size of an NVM database block, in bytes.
Definition: stbdbnvm.c:686
void STB_InitNVMMap(void)
Initialises parameters needed for NVM block access (calcs num blocks if required) ...
Definition: stbdbnvm.c:504
U16BIT STB_GetNVMBlockCount(void)
Returns total number of NVM database blocks.
Definition: stbdbnvm.c:637
U32BIT STB_GetNVMRecordNumber(U16BIT block_no, U16BIT offset, U16BIT size)
Reads the specified value of a field from a NVM record.
Definition: stbdbnvm.c:1202
void STB_SetNVMAccessRAM(U8BIT *ram_ptr)
Sets all DB NVM access to RAM block supplied instead of NVM (cancel if NULL).
Definition: stbdbnvm.c:599
U16BIT STB_GetNVMBlocksUsed(void)
Returns total number of NVM database blocks in use.
Definition: stbdbnvm.c:661
void STB_SetNVMRecordNumber(U16BIT block_no, U16BIT offset, U16BIT size, U32BIT value)
Writes the specified value into a field of a NVM record.
Definition: stbdbnvm.c:1114
void STB_NVMFlushCache(BOOLEAN clear)
Flush cached changes.
Definition: stbdbnvm.c:1017
U8BIT * STB_GetNVMAccessRAM(void)
Returns the current RAM pointer used for DB NVM access.
Definition: stbdbnvm.c:619
U16BIT STB_CreateNVMRecord(U8BIT rec_id, U16BIT size)
Creates a record of the type given in NVM by overwriting invalid blocks.
Definition: stbdbnvm.c:731