DSMCC  17.9.0
 All Data Structures Files Functions Typedefs
Macros | Functions
sfm_main.c File Reference

Section Filter Manager: main functions. More...

#include <string.h>
#include "sfm_main.h"
#include "sfm_filter.h"
#include "sfm_cache.h"

Go to the source code of this file.

Macros

#define KILOBYTES(n)   (n << 10)
 
#define MEGABYTES(n)   (n << 20)
 
#define INITERR(x,...)
 
#define INITWRN(x,...)
 

Functions

H_SfmInstance SFM_CreateInstance (S_SfmSetup *pSetup)
 Create Section Filter Manager instance, using setup structure. More...
 
void SFM_DestroyInstance (H_SfmInstance sfm, void **pSfmMtx, void **pCchMtx, void **pBufMtx)
 Destroy Section Filter Manager instance, and return mutexes so that they may be destroyed by client. More...
 
void SFM_SetDebugConfig (H_SfmInstance sfm, F_Printf errPrintf, F_Printf dbgPrintf, U32BIT dbgState)
 This allows controlling software to reconfigure SFM debug output. More...
 
void SFM_SetDebugState (H_SfmInstance sfm, U32BIT dbgState)
 This allows controlling software to reconfigure SFM debug output. More...
 
void SFM_SetDsmInstance (H_SfmInstance sfm, H_DsmCoreInst dsmcc)
 Set instance handle for DSM-CC that SFM is supporting. More...
 
void SFM_SetDemuxHandle (H_SfmInstance sfm, DMXREF demux)
 Set handle to be passed to F_DvpFilterSetup and F_DvpFilterRemove. More...
 
E_SFM_STATUS SFM_RequireSection (H_SfmInstance sfm, PIDFILT pfid, U8BIT *pHeader, void **phBuffer)
 This function performs minimal checking of section header data to find out whether SFM requires this section. Number of header bytes required is SECTION_HEADER_LENGTH. It assumes CRC has been checked and is passing valid DSM-CC sections So the first byte of data must be table id 0x3B, 0x3C or 0x3D. Note for multi-tasking: this function uses mutex locking to protect shared data with SFM_AddSectionFilter and SFM_DelSectionFilter. It does NOT call any DSM-CC core functions. More...
 
void SFM_ProcessSection (H_SfmInstance sfm, U8BIT *pSection, void *hBuffer)
 Process required section buffer. This should only be called after calling SFM_RequireSection and with it returning SFM_UPDATE_... This function calls DSM-CC core functions. More...
 

Detailed Description

Section Filter Manager: main functions.

Date
16th October 2013
Author
Adam Sturtridge

Definition in file sfm_main.c.

Macro Definition Documentation

#define INITERR (   x,
  ... 
)
Value:
if (pSetup->errPrintf) \
pSetup->errPrintf( "ERROR: " x "\n", ##__VA_ARGS__);

Definition at line 36 of file sfm_main.c.

#define INITWRN (   x,
  ... 
)
Value:
if (pSetup->errPrintf) \
pSetup->errPrintf( "Warning: " x "\n", ##__VA_ARGS__);

Definition at line 39 of file sfm_main.c.

Function Documentation

H_SfmInstance SFM_CreateInstance ( S_SfmSetup pSetup)

Create Section Filter Manager instance, using setup structure.

Parameters
S_SfmSetupsetup setup parameters
Returns
SFM instance. NULL is failure.

Definition at line 62 of file sfm_main.c.

void SFM_DestroyInstance ( H_SfmInstance  sfm,
void **  pSfmMtx,
void **  pCchMtx,
void **  pBufMtx 
)

Destroy Section Filter Manager instance, and return mutexes so that they may be destroyed by client.

Parameters
H_SfmInstancesfm SFM instance handle.
void**pSfmMtx Pointer to sfmMutex provided in setup
void**pCchMtx Pointer to cacheMutex provided in setup
void**pBufMtx Pointer to bufferMutex provided in setup
Returns
void

Definition at line 161 of file sfm_main.c.

void SFM_ProcessSection ( H_SfmInstance  sfm,
U8BIT *  pSection,
void *  hBuffer 
)

Process required section buffer. This should only be called after calling SFM_RequireSection and with it returning SFM_UPDATE_... This function calls DSM-CC core functions.

Process required section buffer. This should only be called after SFM_RequireSection has returned SFM_UPDATE_HIGH or SFM_UPDATE_LOW. This function must be called in the normal DSM-CC thread environment, because it calls DSM-CC core functions.

Parameters
H_SfmInstancesfm SFM instance handle.
U8BIT*pSection Pointer to whole section data buffer
void*hBuffer SFM section handle returned by SFM_RequireSection
Returns
void.

Definition at line 299 of file sfm_main.c.

E_SFM_STATUS SFM_RequireSection ( H_SfmInstance  sfm,
PIDFILT  pfid,
U8BIT *  pHeader,
void **  phBuffer 
)

This function performs minimal checking of section header data to find out whether SFM requires this section. Number of header bytes required is SECTION_HEADER_LENGTH. It assumes CRC has been checked and is passing valid DSM-CC sections So the first byte of data must be table id 0x3B, 0x3C or 0x3D. Note for multi-tasking: this function uses mutex locking to protect shared data with SFM_AddSectionFilter and SFM_DelSectionFilter. It does NOT call any DSM-CC core functions.

This function performs minimal checking of section header data to find out whether SFM requires this section. Number of header bytes required is SECTION_HEADER_LENGTH. It assumes CRC has been checked and is passing valid DSM-CC sections So the first byte of data must be table id 0x3B, 0x3C or 0x3D. Note for multi-tasking: this function uses mutex locking to protect shared data with SFM_DsmccFilterAlloc and SFM_DsmccFilterDelete. It does NOT call any DSM-CC core functions.

Parameters
H_SfmInstancesfm SFM instance handle.
PIDFILTpfid PID filter with incoming section
U8BIT*pHeader Pointer to section header (min 8 bytes)
void**phBuffer Pointer to SFM section buffer handle
Returns
E_SFM_STATUS - status of required update

Definition at line 257 of file sfm_main.c.

void SFM_SetDebugConfig ( H_SfmInstance  sfm,
F_Printf  errPrintf,
F_Printf  dbgPrintf,
U32BIT  dbgState 
)

This allows controlling software to reconfigure SFM debug output.

Parameters
H_SfmInstancesfm SFM instance handle.
F_SfmPrintferrPrintf Error print function
F_SfmPrintfdbgPrintf Debug print function
U32BITdbgState State to filter debug printing
Returns

Definition at line 192 of file sfm_main.c.

void SFM_SetDebugState ( H_SfmInstance  sfm,
U32BIT  dbgState 
)

This allows controlling software to reconfigure SFM debug output.

Parameters
H_SfmInstancesfm SFM instance handle.
U32BITdbgState State to filter debug printing
Returns

Definition at line 209 of file sfm_main.c.

void SFM_SetDemuxHandle ( H_SfmInstance  sfm,
DMXREF  demux 
)

Set handle to be passed to F_DvpFilterSetup and F_DvpFilterRemove.

Parameters
H_SfmInstancesfm SFM instance handle.
DMXREFdemux Demux handle used by platform
Returns

Definition at line 233 of file sfm_main.c.

void SFM_SetDsmInstance ( H_SfmInstance  sfm,
H_DsmCoreInst  dsmcc 
)

Set instance handle for DSM-CC that SFM is supporting.

Parameters
H_SfmInstancesfm SFM instance handle.
H_DsmCoreInstdsmcc DSM-CC instance being supported
Returns

Definition at line 220 of file sfm_main.c.