DSMCC  22.11.0
Classes | Macros | Typedefs | Enumerations | Functions | Variables
dsm_control.c File Reference

DSM-CC control Manager. More...

#include <string.h>
#include <stdlib.h>
#include "stb_os.h"
#include "cldsmcc.h"
#include "cldsmdbg.h"
#include "dsfm.h"
#include "dsiq.h"
#include "sbm.h"
#include "stbsipmt.h"
#include "dm_debug.h"
#include "dsm_control.h"
#include "dsm_main.h"
#include "dsm_si.h"

Classes

struct  s_PmtInfo
 
struct  s_DsmMessage
 
struct  s_timer
 
struct  s_msgqueue
 
struct  s_DsmControl
 

Macros

#define MAIN_STACK_SIZE   0x8000
 
#define TIMER_RESOLUTION   100
 
#define RESTART_TIME   200
 
#define TIMEOUT_PAT   700
 
#define START_MAGIC   0xDEED
 
#define CLDSM_MAGIC   0xBADE
 
#define ERA_BITS   4
 
#define ERA_SHIFT   (32 - ERA_BITS)
 
#define ERA_LAST   ((1 << ERA_BITS) - 1)
 
#define ERA_FIRST   0x00
 
#define GETENV_DSMDBG(mskitem)
 

Typedefs

typedef struct s_PmtInfo S_TableInfo
 
typedef struct s_DsmMessage S_Message
 
typedef struct s_timer S_Timer
 
typedef struct s_msgqueue S_MsgQueue
 
typedef struct s_DsmControl S_DsmControl
 

Enumerations

enum  E_Q_PRIORITY { QP_TOP, QP_HIGH, QP_LOW, QP_TOTAL }
 
enum  E_DsmMsgType {
  DSM_MSG_PAT_DATA, DSM_MSG_PMT_DATA = 0x02, DSM_MSG_NEW_SECTION = 0x100, DSM_MSG_CACHE_SECTION,
  DSM_MSG_UPDATE_FILTER, DSM_MSG_PMT_REMOVED, DSM_MSG_DSI_START, DSM_MSG_CLOSE_DOWN
}
 
enum  E_STATUS { BL_WAITING, BL_BOOTING, BL_LOADED, BL_FAILED }
 

Functions

U32BIT StubRequestTable (void *pmtref, U16BIT pid, U16BIT xid, U8BIT tid)
 
void DestroyDsi (S_DsmControl *dsmctrl)
 
U32BIT DebugInstanceGetMask (H_DsmControl dsmctrl)
 
H_DsmControl DSMCC_Open (S_DsmccConfig *config)
 Open DSM-CC and create controling instance. More...
 
void DSMCC_Close (H_DsmControl dsmctrl)
 Close DSM-CC controling instance, and destroy all resources. More...
 
BOOLEAN DSMCC_Start (H_DsmControl dsmctrl, S_DvbLocator *locator, U32BIT boot_carousel_id, DMXREF dmxref)
 Start DSM-CC controling instance. This will start search for a boot carousel on service specified by locator. The search depends on the value given 'boot_carousel_id' parameter. When boot carousel id is set to INVALID_CAROUSEL_ID, DSM-CC will attempt to start on a carousel which the client recognises in callback function 'parseDataBroadcastId'. Even when the PMT does not contain a recognised data broadcast id, this function will return TRUE, and the DSM-CC will keep trying to load a boot carousel. When boot carousel id is set to a specific value or UNKNOWN_CAROUSEL_ID DSMCC_Start() will return FALSE if a carousel with the required ID is not present. When boot carousel id is set to UNKNOWN_CAROUSEL_ID, DSM-CC will attempt to start on whatever carousel is signalled in PMT for that service. More...
 
void DSMCC_SetTunedTransportInfo (H_DsmControl dsmctrl, U16BIT onet_id, U16BIT tran_id, DMXREF dmxref)
 Inform DSMCC instance of the tuned transport details. This must be called before calling DSMCC_StartFs() or DSMCC_StartSsu() More...
 
BOOLEAN DSMCC_StartFs (H_DsmControl dsmctrl, U16BIT service_id, U32BIT carousel_id)
 Start DSM-CC controlling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start search for an Object Carousel on the specified service. The search depends on the value given 'carousel_id' parameter. When carousel id is set to INVALID_CAROUSEL_ID, DSM-CC will attempt to start on a carousel which the client recognises in callback function 'parseDataBroadcastId'. Even when the PMT does not contain a recognised data broadcast id, this function will return TRUE, and the DSM-CC will keep searching. When the carousel id is set to a specific value or UNKNOWN_CAROUSEL_ID and a carousel of the required ID is not present, either this function will return FALSE or 'carouselLoad' callback will be passed a result of OC_LOAD_ABORTED_ERROR. When carousel id is set to UNKNOWN_CAROUSEL_ID, DSM-CC will attempt to start on whatever carousel is signalled in PMT for that service. More...
 
BOOLEAN DSMCC_StartSsu (H_DsmControl dsmctrl, U16BIT service_id, U32BIT oui)
 Start DSM-CC controling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start loading Update Carousel for SSU on specified service. More...
 
BOOLEAN DSMCC_StartSsuWithPid (H_DsmControl dsmctrl, U16BIT pid, U32BIT oui)
 Start DSM-CC controling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start loading Update Carousel for SSU on a single specified PID. More...
 
void DSMCC_Stop (H_DsmControl dsmctrl, E_DsmRstMode mode)
 Stop DSM-CC controling instance. Causes all carousels to unload. More...
 
void DSMCC_Reboot (H_DsmControl dsmctrl)
 Reboot DSM-CC controling instance. Causes all carousels to unload and initiate search for boot carousel. More...
 
H_ObjCarousel DSMCC_CurrentCarousel (H_DsmControl dsmctrl)
 Get currently loaded carousel handle. More...
 
U32BIT DSMCC_CurrentCarouselId (H_DsmControl dsmctrl)
 Get currently loaded carousel ID. More...
 
BOOLEAN DSMCC_SetCurrentCarousel (H_DsmControl dsmctrl, H_ObjCarousel hOC)
 Set current carousel. This does not unload any previously loaded carousels. More...
 
void DSMCC_UnloadCarousel (H_DsmControl dsmctrl, H_ObjCarousel hOC, E_DsmRstMode mode)
 Unload specified Carousel. More...
 
void DSMCC_SsuUnloadModule (H_DsmControl dsmctrl, H_DsmCarousel hCarousel, U32BIT moduleRef)
 Unload SSU module. To be called once the client has finished saving this modules data. This is needed to. More...
 
void DSMCC_SetFileSystemCacheLimit (H_DsmControl dsmctrl, U32BIT cacheSize)
 Set limit of DSMCC dynamic memory usage for file system caching This function overrides the default size is 6 MB. If this size is less than the currently allocated memory size, then it will release file system data until limit is reached - but only releasing data not currently in used by the client. More...
 
void DSMCC_SiqCacheClearPmt (H_DsmControl dsmctrl, U16BIT serviceId)
 Clear cached PMT for particular service. More...
 
const char * DSMCC_VersionString (void)
 Returns version major.minor.patch as string. More...
 
H_DsmControl DSMCC_FindInstance (U16BIT serviceId, DMXREF dmxref)
 Find DSMCC instance that has beed started on specified service. More...
 
U32BIT DSMCC_DebugGetMask (void)
 Get the DSMCC debug mask. More...
 
void DSMCC_DebugSetMask (U32BIT mask)
 Set the DSMCC debug mask. More...
 
U32BIT DSMCC_DebugInstanceGetMask (H_DsmControl instance)
 Get the DSMCC debug mask for instance. More...
 
void DSMCC_DebugInstanceSetMask (H_DsmControl instance, U32BIT mask)
 Set the DSMCC debug mask. More...
 
void DSMCC_DebugInstanceEnable (H_DsmControl dsmctrl, const char *rootname)
 Enable DSMCC debug for an instance, by reading environment variables with name format: <rootname>_<maskname>. E.g. DSMOTA_DS_PMT. More...
 

Variables

unsigned int gDebugState = DSM_DBG_MASK
 
S_DsmControlinstanceHead = NULL
 

Detailed Description

DSM-CC control Manager.

Date
17 October 2013
Author
Adam Sturtridge

Macro Definition Documentation

#define GETENV_DSMDBG (   mskitem)
Value:
strcpy(mskptr,#mskitem); \
value = getenv(envname); \
if (value != NULL) { \
if (atoi(value) == 1) mask |= mskitem; \
else mask &= ~mskitem; }

Function Documentation

void DSMCC_Close ( H_DsmControl  dsmctrl)

Close DSM-CC controling instance, and destroy all resources.

Parameters
dsmctrlDSM control instance handle
Returns
void
H_ObjCarousel DSMCC_CurrentCarousel ( H_DsmControl  dsmctrl)

Get currently loaded carousel handle.

Parameters
H_DsmControldsmctrl DSM control instance handle
Returns
H_ObjCarousel carousel handle - NULL if none loaded
U32BIT DSMCC_CurrentCarouselId ( H_DsmControl  dsmctrl)

Get currently loaded carousel ID.

Parameters
H_DsmControldsmctrl DSM control instance handle
Returns
U32BIT carousel id - INVALID_CAROUSEL_ID if none loaded
U32BIT DSMCC_DebugGetMask ( void  )

Get the DSMCC debug mask.

Returns
Debug mask
void DSMCC_DebugInstanceEnable ( H_DsmControl  dsmctrl,
const char *  rootname 
)

Enable DSMCC debug for an instance, by reading environment variables with name format: <rootname>_<maskname>. E.g. DSMOTA_DS_PMT.

Parameters
instanceDSM control instance handle
rootnameRoot name for environment variables for this instance
Returns
void
U32BIT DSMCC_DebugInstanceGetMask ( H_DsmControl  instance)

Get the DSMCC debug mask for instance.

Parameters
dsmctrlDSM control instance handle
Returns
Debug mask
void DSMCC_DebugInstanceSetMask ( H_DsmControl  instance,
U32BIT  mask 
)

Set the DSMCC debug mask.

Parameters
instanceDSM control instance handle
maskmask value
Returns
void
void DSMCC_DebugSetMask ( U32BIT  mask)

Set the DSMCC debug mask.

Parameters
maskmask value
Returns
void
H_DsmControl DSMCC_FindInstance ( U16BIT  serviceId,
DMXREF  dmxref 
)

Find DSMCC instance that has beed started on specified service.

Parameters
serviceIdService on which DSMCC is started
dmxrefdemux reference used for HW section filtering
Returns
H_DsmControl instance handle, or NULL if not found
H_DsmControl DSMCC_Open ( S_DsmccConfig config)

Open DSM-CC and create controling instance.

Parameters
S_DsmccConfig*config Configuration of control instance.
Returns
void
void DSMCC_Reboot ( H_DsmControl  dsmctrl)

Reboot DSM-CC controling instance. Causes all carousels to unload and initiate search for boot carousel.

Parameters
H_DsmControlinstance DSM control instance handle
Returns
void
BOOLEAN DSMCC_SetCurrentCarousel ( H_DsmControl  dsmctrl,
H_ObjCarousel  hOC 
)

Set current carousel. This does not unload any previously loaded carousels.

Parameters
H_DsmControldsmctrl DSM control instance handle
H_ObjCarouselhOC Handle to carousel
Returns
BOOLEAN - TRUE if success (i.e. had valid carousel handle)
void DSMCC_SetFileSystemCacheLimit ( H_DsmControl  dsmctrl,
U32BIT  cacheSize 
)

Set limit of DSMCC dynamic memory usage for file system caching This function overrides the default size is 6 MB. If this size is less than the currently allocated memory size, then it will release file system data until limit is reached - but only releasing data not currently in used by the client.

Parameters
dsmctrlDSM control instance handle.
cacheSizeSize in bytes (minimum of 1 MB)
Returns
void
void DSMCC_SetTunedTransportInfo ( H_DsmControl  dsmctrl,
U16BIT  onet_id,
U16BIT  tran_id,
DMXREF  dmxref 
)

Inform DSMCC instance of the tuned transport details. This must be called before calling DSMCC_StartFs() or DSMCC_StartSsu()

Parameters
dsmctrlDSM control instance handle
onet_idOriginal Network Id.
tran_idTransport ID for the transport stream.
DMXREFdmxref demux reference to be used in section filter API
Returns
BOOLEAN - TRUE if success
void DSMCC_SiqCacheClearPmt ( H_DsmControl  dsmctrl,
U16BIT  serviceId 
)

Clear cached PMT for particular service.

Parameters
H_DsmControldsmctrl DSM control instance handle.
U16BITserviceId Service whose PMT needs to be cleared
Returns
void
void DSMCC_SsuUnloadModule ( H_DsmControl  dsmctrl,
H_DsmCarousel  hCarousel,
U32BIT  moduleRef 
)

Unload SSU module. To be called once the client has finished saving this modules data. This is needed to.

Unload SSU module. This is intended to be called once the client has finished saving the data for this module.

Parameters
dsmctrlDSM control instance handle.
hCarouselHandle to the DSMCC Update Carousel
moduleRefReference to a module
Returns
void
BOOLEAN DSMCC_Start ( H_DsmControl  dsmctrl,
S_DvbLocator locator,
U32BIT  boot_carousel_id,
DMXREF  dmxref 
)

Start DSM-CC controling instance. This will start search for a boot carousel on service specified by locator. The search depends on the value given 'boot_carousel_id' parameter. When boot carousel id is set to INVALID_CAROUSEL_ID, DSM-CC will attempt to start on a carousel which the client recognises in callback function 'parseDataBroadcastId'. Even when the PMT does not contain a recognised data broadcast id, this function will return TRUE, and the DSM-CC will keep trying to load a boot carousel. When boot carousel id is set to a specific value or UNKNOWN_CAROUSEL_ID DSMCC_Start() will return FALSE if a carousel with the required ID is not present. When boot carousel id is set to UNKNOWN_CAROUSEL_ID, DSM-CC will attempt to start on whatever carousel is signalled in PMT for that service.

The function is depreciated. It starts DSM-CC controlling instance, and will start search for a boot carousel on service specified by locator. The search depends on 'boot_carousel_id' parameter. When boot carousel id is set to INVALID_CAROUSEL_ID, DSM-CC will attempt to start on a carousel which the client recognises in callback function 'parseDataBroadcastId'. Even when the PMT does not contain a recognised data broadcast id, DSMCC_Start() will return TRUE, and the DSM-CC will keep trying to load a boot carousel. When boot carousel id is set to a specific value or UNKNOWN_CAROUSEL_ID and a carousel of the required ID is not present, either DSMCC_Start() will return FALSE or 'carouselLoad' callback will be passed a result of OC_LOAD_ABORTED_ERROR. When boot carousel id is set to UNKNOWN_CAROUSEL_ID, DSM-CC will attempt to start on whatever carousel is signalled in PMT for that service.

Parameters
dsmctrlDSM control instance handle
locatorDVB location of service.
boot_carousel_idcarousel id - INVALID_CAROUSEL_ID, or UNKNOWN_CAROUSEL_ID, or a specific value.
DMXREFdmxref demux reference to be used in section filter API
Returns
BOOLEAN - TRUE if success
BOOLEAN DSMCC_StartFs ( H_DsmControl  dsmctrl,
U16BIT  service_id,
U32BIT  carousel_id 
)

Start DSM-CC controlling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start search for an Object Carousel on the specified service. The search depends on the value given 'carousel_id' parameter. When carousel id is set to INVALID_CAROUSEL_ID, DSM-CC will attempt to start on a carousel which the client recognises in callback function 'parseDataBroadcastId'. Even when the PMT does not contain a recognised data broadcast id, this function will return TRUE, and the DSM-CC will keep searching. When the carousel id is set to a specific value or UNKNOWN_CAROUSEL_ID and a carousel of the required ID is not present, either this function will return FALSE or 'carouselLoad' callback will be passed a result of OC_LOAD_ABORTED_ERROR. When carousel id is set to UNKNOWN_CAROUSEL_ID, DSM-CC will attempt to start on whatever carousel is signalled in PMT for that service.

Parameters
dsmctrlDSM control instance handle
service_idService Id.
carousel_idCarousel Id
Returns
BOOLEAN - TRUE if success
BOOLEAN DSMCC_StartSsu ( H_DsmControl  dsmctrl,
U16BIT  service_id,
U32BIT  oui 
)

Start DSM-CC controling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start loading Update Carousel for SSU on specified service.

Parameters
dsmctrlDSM control instance handle
service_idService Id.
ouiManufacturer's OUI
Returns
BOOLEAN - TRUE if success
BOOLEAN DSMCC_StartSsuWithPid ( H_DsmControl  dsmctrl,
U16BIT  pid,
U32BIT  oui 
)

Start DSM-CC controling instance. This must follow call to DSMCC_SetTunedTransportInfo. The function will start loading Update Carousel for SSU on a single specified PID.

Parameters
dsmctrlDSM control instance handle
pidPID on which to find all SSU data
ouiManufacturer's OUI
Returns
BOOLEAN - TRUE if success
void DSMCC_Stop ( H_DsmControl  dsmctrl,
E_DsmRstMode  mode 
)

Stop DSM-CC controling instance. Causes all carousels to unload.

Parameters
H_DsmControldsmctrl DSM control instance handle
E_DsmRstModemode Mode of operation when unloading
Returns
void
void DSMCC_UnloadCarousel ( H_DsmControl  dsmctrl,
H_ObjCarousel  hOC,
E_DsmRstMode  mode 
)

Unload specified Carousel.

Parameters
H_DsmControldsmctrl DSM control instance handle
H_ObjCarouselhOC Handle to carousel
E_DsmRstModemode Mode of operation when unloading
Returns
void
const char* DSMCC_VersionString ( void  )

Returns version major.minor.patch as string.

Returns
a version string