DVBCore  1.0
Open source DVB engine
platform/inc/stbhwmem.h File Reference

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

#include "stbhwdsk.h"
Include dependency graph for stbhwmem.h:

Go to the source code of this file.

Defines

#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.
BOOLEAN STB_MEMWriteNVM (U32BIT addr, U32BIT bytes, U8BIT *src_addr)
 Writes data to the NVM.
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+.
void STB_MEMReleaseSecureVariable (void *value)
 Releas the data returned by STB_MEMReadSecureVariable. This function is used for CI+.
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+.
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+.
U32BIT STB_MEMGetNVMSize (void)
 Returns the size (capacity) of the NVM.
U32BIT STB_MEMGetNVMOffset (void)
 Returns any offset required in NVM to avoid private data.
U8BIT STB_MEMGetNVMAlign (void)
 Returns the word alignment size of the NVM device.
void * STB_MEMGetSysRAM (U32BIT bytes)
 Allocates a new block of memory for system use.
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.
void STB_MEMFreeSysRAM (void *block)
 Releases a previously allocated block of system memory.
U8BIT STB_MEMSysRAMUsed (void)
 Returns the amount of available system memory consumed.
void * STB_MEMGetAppRAM (U32BIT bytes)
 Allocates a new block of memory for application use.
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.
void STB_MEMFreeAppRAM (void *block)
 Releases a previously allocated block of system memory.
U8BIT STB_MEMAppRAMUsed (void)
 Returns the amount of available application memory consumed.
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)
void * STB_NVMOpenFile (U8BIT *name, E_STB_DSK_FILE_MODE mode)
void STB_NVMCloseFile (void *file)
U32BIT STB_NVMReadFile (void *file, U8BIT *data, U32BIT size)
U32BIT STB_NVMWriteFile (void *file, U8BIT *data, U32BIT size)
BOOLEAN STB_NVMDeleteFile (U8BIT *filename)
void * STB_NVMOpenDirectory (U8BIT *dir_name)
BOOLEAN STB_NVMReadDirectory (void *dir, U8BIT *filename, U16BIT filename_len, E_STB_DIR_ENTRY_TYPE *entry_type)
void STB_NVMCloseDirectory (void *dir)

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
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
All Data Structures Files Functions Typedefs Defines