DVBCore  17.9.0
Open Source DVB Engine
 All Data Structures Files Functions Typedefs Macros Pages
Macros | Enumerations | Functions
stbhwmem.h File Reference

Header file - Function prototypes for NVM and Heap. More...

#include "techtype.h"
#include "stbhwdsk.h"

Go to the source code of this file.

Macros

#define ELOAD_RESERVED_NVM_OFFSET   0
 
#define ELOAD_RESERVED_NVM_SIZE_WIDTH   2
 
#define ELOAD_NVM_DATA_OFFSET   ELOAD_RESERVED_NVM_SIZE_WIDTH
 

Enumerations

enum  {
  SECURE_NVM_DEFAULT_ENCRYPTION_KEY, SECURE_NVM_DEFAULT_ENC_INIT_VECTOR, SECURE_NVM_CI_PLUS_ROOT_CERT, SECURE_NVM_CI_PLUS_BRAND_CERT,
  SECURE_NVM_CI_PLUS_DEVICE_CERT, SECURE_NVM_CI_PLUS_DEVICE_KEY, SECURE_NVM_CI_PLUS_DH_P, SECURE_NVM_CI_PLUS_DH_G,
  SECURE_NVM_CI_PLUS_DH_Q, SECURE_NVM_CI_PLUS_PRNG_KEY_K, SECURE_NVM_CI_PLUS_PRNG_SEED, SECURE_NVM_CI_PLUS_SIV,
  SECURE_NVM_CI_PLUS_SLK, SECURE_NVM_CI_PLUS_CLK, SECURE_NVM_CI_PLUS_CONTEXTS, SECURE_NVM_MHEG5_PRIVATE_KEY,
  SECURE_NVM_MHEG5_PRIVATE_KEY_VERSION, SECURE_NVM_SOFTWARE_UPGRADE_PUBLIC_KEY, SECURE_NVM_SOFTWARE_UPGRADE_SHARED_KEY
}
 

Functions

void STB_MEMInitialiseRAM (void)
 Initialises the heap.
 
void STB_MEMInitialiseNVM (void)
 Initialises Non-Volatile memory access. For a new NVM device, this function formats it ready for use, otherwise it prepares existing data for access.
 
BOOLEAN STB_MEMReadNVM (U32BIT addr, U32BIT bytes, U8BIT *dst_addr)
 Read data from the NVM. More...
 
BOOLEAN STB_MEMWriteNVM (U32BIT addr, U32BIT bytes, U8BIT *src_addr)
 Writes data to the NVM. More...
 
void * STB_MEMReadSecureVariable (U8BIT key, U32BIT *len)
 Read variable defined by the given key from secure NVM. The data must be released using STB_MEMReleaseSecureVariable. This function is used for CI+. More...
 
void STB_MEMReleaseSecureVariable (void *value)
 Releas the data returned by STB_MEMReadSecureVariable. This function is used for CI+. More...
 
BOOLEAN STB_MEMWriteSecureVariable (U8BIT key, void *value, U32BIT len)
 Writes data defined by the given key to secure NVM. This function is used for CI+. More...
 
const void * STB_MEMReadSecureConstant (U8BIT key, U32BIT *len)
 Read constant defined by the given key from secure NVM. The data must not be released (it is managed by the platform layer). This function is used for CI+. More...
 
U32BIT STB_MEMGetNVMSize (void)
 Returns the size (capacity) of the NVM. More...
 
U32BIT STB_MEMGetNVMOffset (void)
 Returns any offset required in NVM to avoid private data. More...
 
U8BIT STB_MEMGetNVMAlign (void)
 Returns the word alignment size of the NVM device. More...
 
void * STB_MEMGetSysRAM (U32BIT bytes)
 Allocates a new block of memory for system use. More...
 
void * STB_MEMResizeSysRAM (void *ptr, U32BIT new_num_bytes)
 Changes the size of the given block of memory ensuring data contained within the original memory block is maintained. More...
 
void STB_MEMFreeSysRAM (void *block)
 Releases a previously allocated block of system memory. More...
 
U8BIT STB_MEMSysRAMUsed (void)
 Returns the amount of available system memory consumed. More...
 
void * STB_MEMGetAppRAM (U32BIT bytes)
 Allocates a new block of memory for application use. More...
 
void * STB_MEMResizeAppRAM (void *ptr, U32BIT new_num_bytes)
 Changes the size of the given block of memory ensuring data contained within the original memory block is maintained. More...
 
void STB_MEMFreeAppRAM (void *block)
 Releases a previously allocated block of system memory. More...
 
U8BIT STB_MEMAppRAMUsed (void)
 Returns the amount of available application memory consumed. More...
 
BOOLEAN STB_MEMConfigMloaderForUpgrade (void *loader_data, U32BIT data_size)
 
BOOLEAN STB_MEMReadMloaderData (void *buffer, U32BIT size)
 
BOOLEAN STB_MEMWriteMloaderData (void *buffer, U32BIT size)
 
BOOLEAN STB_NVMFileSize (U8BIT *filename, U32BIT *filesize)
 Returns the size in KB of the given file. More...
 
void * STB_NVMOpenFile (U8BIT *name, E_STB_DSK_FILE_MODE mode)
 Opens an existing file or creates a new one. More...
 
void STB_NVMCloseFile (void *file)
 Flushes and closes an open file. More...
 
U32BIT STB_NVMReadFile (void *file, U8BIT *data, U32BIT size)
 Reads data from an open file. More...
 
U32BIT STB_NVMWriteFile (void *file, U8BIT *data, U32BIT size)
 Writes data to an open file. More...
 
BOOLEAN STB_NVMDeleteFile (U8BIT *filename)
 Deletes the file. More...
 
BOOLEAN STB_NVMMoveFile (U8BIT *oldname, U8BIT *newname)
 Move file or directory (and it's children). More...
 
void * STB_NVMOpenDirectory (U8BIT *dir_name)
 Opens a directory in order to read the entries. More...
 
BOOLEAN STB_NVMReadDirectory (void *dir, U8BIT *filename, U16BIT filename_len, E_STB_DIR_ENTRY_TYPE *entry_type)
 Reads the next entry from the directory, returning the name of the entry and the type of the entry. More...
 
void STB_NVMCloseDirectory (void *dir)
 Closes the directory for reading. More...
 

Detailed Description

Header file - Function prototypes for NVM and Heap.

Date
26/04/2002

Function Documentation

U8BIT STB_MEMAppRAMUsed ( void  )

Returns the amount of available application memory consumed.

Returns
Memory used as a percentage of available
void STB_MEMFreeAppRAM ( void *  block)

Releases a previously allocated block of system memory.

Parameters
block_ptraddress of block to be released
void STB_MEMFreeSysRAM ( void *  block)

Releases a previously allocated block of system memory.

Parameters
block_ptraddress of block to be released
void* STB_MEMGetAppRAM ( U32BIT  bytes)

Allocates a new block of memory for application use.

Parameters
bytesSize of required block in bytes
Returns
A pointer to the allocated block of memory
NULL allocation failed
U8BIT STB_MEMGetNVMAlign ( void  )

Returns the word alignment size of the NVM device.

Returns
Alignment in bytes
U32BIT STB_MEMGetNVMOffset ( void  )

Returns any offset required in NVM to avoid private data.

Returns
The offset in bytes
U32BIT STB_MEMGetNVMSize ( void  )

Returns the size (capacity) of the NVM.

Returns
Size of the NVM in bytes
void* STB_MEMGetSysRAM ( U32BIT  bytes)

Allocates a new block of memory for system use.

Parameters
bytesSize of required block in bytes
Returns
Pointer to the allocated block of memory or NULL if allocation failed
BOOLEAN STB_MEMReadNVM ( U32BIT  addr,
U32BIT  bytes,
U8BIT *  dst_addr 
)

Read data from the NVM.

Parameters
addrThe NVM start address
bytesThe number of bytes to read
dst_addrCaller's buffer for the data
Returns
TRUE if successful FALSE otherwise
const void* STB_MEMReadSecureConstant ( U8BIT  key,
U32BIT *  len 
)

Read constant defined by the given key from secure NVM. The data must not be released (it is managed by the platform layer). This function is used for CI+.

Parameters
keydata item to be read
lenreturned length of data read
Returns
Pointer to data read, or NULL on failure.
void* STB_MEMReadSecureVariable ( U8BIT  key,
U32BIT *  len 
)

Read variable defined by the given key from secure NVM. The data must be released using STB_MEMReleaseSecureVariable. This function is used for CI+.

Parameters
keydata item to be read
lenreturned length of data read
Returns
Pointer to data read, or NULL on failure.
void STB_MEMReleaseSecureVariable ( void *  value)

Releas the data returned by STB_MEMReadSecureVariable. This function is used for CI+.

Parameters
valuepointer to data to be released
void* STB_MEMResizeAppRAM ( void *  ptr,
U32BIT  new_num_bytes 
)

Changes the size of the given block of memory ensuring data contained within the original memory block is maintained.

Parameters
ptrpointer to memory already allocated from the app heap
new_num_bytessize of the memory block to be returned
Returns
Address of new block of memory
void* STB_MEMResizeSysRAM ( void *  ptr,
U32BIT  new_num_bytes 
)

Changes the size of the given block of memory ensuring data contained within the original memory block is maintained.

Parameters
ptrpointer to memory already allocated from the system heap
new_num_bytessize of the memory block to be returned
Returns
Address of new block of memory
U8BIT STB_MEMSysRAMUsed ( void  )

Returns the amount of available system memory consumed.

Returns
Memory used as a percentage of available
BOOLEAN STB_MEMWriteNVM ( U32BIT  addr,
U32BIT  bytes,
U8BIT *  src_addr 
)

Writes data to the NVM.

Parameters
addrThe NVM start address to write to
bytesThe number of bytes to be written
src_addrPointer to the data to be written
Returns
TRUE if successful, FALSE otherwise
BOOLEAN STB_MEMWriteSecureVariable ( U8BIT  key,
void *  value,
U32BIT  len 
)

Writes data defined by the given key to secure NVM. This function is used for CI+.

Parameters
keydata item to be written
valuepointer to data to be written
lendata size
Returns
TRUE if the data is written successfully, FALSE otherwise
void STB_NVMCloseDirectory ( void *  dir)

Closes the directory for reading.

Parameters
dirdirectory handle
void STB_NVMCloseFile ( void *  file)

Flushes and closes an open file.

Parameters
fileThe file handle
BOOLEAN STB_NVMDeleteFile ( U8BIT *  filename)

Deletes the file.

Parameters
filenamePath name of the file to be deleted
Returns
TRUE if successful, FALSE otherwise
BOOLEAN STB_NVMFileSize ( U8BIT *  filename,
U32BIT *  filesize 
)

Returns the size in KB of the given file.

Parameters
filenameName of the file in the nvm
filesizeReturned value giving the file size in KB
Returns
TRUE if the file exists, FALSE otherwise
BOOLEAN STB_NVMMoveFile ( U8BIT *  oldname,
U8BIT *  newname 
)

Move file or directory (and it's children).

Parameters
oldnamePath name of the file to be moved
newnamePath name of new file location
Returns
TRUE if successful, FALSE otherwise
void* STB_NVMOpenDirectory ( U8BIT *  dir_name)

Opens a directory in order to read the entries.

Parameters
dir_nameName of the directory to open
Returns
Handle to be used in all other operations, NULL if the open fails
void* STB_NVMOpenFile ( U8BIT *  name,
E_STB_DSK_FILE_MODE  mode 
)

Opens an existing file or creates a new one.

Parameters
name- The filename (including path). When the mode is FILE_MODE_OVERWRITE, the directories in the path will be created when they don't exist.
modeThe access mode
Returns
The file handle
BOOLEAN STB_NVMReadDirectory ( void *  dir,
U8BIT *  filename,
U16BIT  filename_len,
E_STB_DIR_ENTRY_TYPE *  entry_type 
)

Reads the next entry from the directory, returning the name of the entry and the type of the entry.

Parameters
dirHandle returned when the directory was opened
filenameArray in which the name is returned
filename_lenSize of the filename array
entry_typeType of entry
Returns
TRUE if and entry is read, FALSE otherwise which could indicate end of the directory
U32BIT STB_NVMReadFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Reads data from an open file.

Parameters
fileThe file handle
dataThe caller's buffer
sizeNumber of bytes to be read
Returns
Number of bytes successfully read
U32BIT STB_NVMWriteFile ( void *  file,
U8BIT *  data,
U32BIT  size 
)

Writes data to an open file.

Parameters
fileThe file handle
dataPointer to the data to be written
sizeNumber of bytes to write
Returns
Number of bytes successfully written