DSMCC  17.9.0
 All Data Structures Files Functions Typedefs
dsfm.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  *******************************************************************************/
24 #ifndef _DSFM_H_
25 #define _DSFM_H_
26 
27 #include "cldsmtypes.h"
28 #include "dmxtypes.h"
29 #include "stdfuncs.h"
30 #include "stb_filter.h"
31  #include "dsm_debug.h"
32 
33 #define SECTION_HEADER_LENGTH 8
34 
35 typedef enum
36 {
37  SFM_ERROR,
38  SFM_IGNORE,
39  SFM_UPDATE_CACHE,
40  SFM_UPDATE_LOW,
41  SFM_UPDATE_HIGH
42 } E_SFM_STATUS;
43 
44 typedef struct s_DmxPidFilter *H_DmxPidFilter;
45 
46 /*------------------- Functions supplied to SFM at setup ---------------------*/
47 
56 typedef void (*F_UpdateFilter)( H_SfmInstance sfm, H_DmxPidFilter hPF );
57 
70 typedef void (*F_CacheMatch)( H_SfmInstance sfm, U8BIT *pSection,
71  void *hBuffer, E_SFM_STATUS status );
72 
73 /*---------------- Setup structure for SFM initialisation -------------------*/
74 
75 typedef struct
76 {
77  /* ---------- Manditory functions ----------- */
78 
79  F_MemAlloc memAlloc;
80  F_MemFree memFree;
81 
82  F_Locking mutexLock;
83  F_Locking mutexUnlock;
84 
85  /* Hardware filter callback function that will handle section and lead to
86  * calling SFM_RequireSection() followed by SFM_ProcessSection()
87  */
88  F_FILTER_CALLBACK hwFilterCallback;
89 
90  /* Callback function to inform client that filters require updating
91  */
92  F_UpdateFilter updateFilter;
93 
94  /* ---------- Optional functions ----------- */
95 
96  /* cacheMatch function provided so that processing of section data matched
97  * in cache can happen after DSM-CC has finished processing request for
98  * relevant section filter.
99  * If 'cacheMatch' is NULL, then SFM_DsmccFilterAdd will directly call
100  * SFM_ProcessSection.
101  */
102  F_CacheMatch cacheMatch;
103 
104  /* -------- Optional debug functions --------- */
105 
106  /* errPrintf and dbgPrintf functions are only used in a debug build
107  * When not supplied, these must be set to NULL
108  */
109  F_Printf errPrintf;
110  F_Printf dbgPrintf;
111 
112  /* ------------- Mutex parameters ------------ */
113 
114  /* sfmMutex is manditory, used in mutexLock / mutexUnlock functions
115  * and must be created and valid before supplying to SFM_CreateInstance
116  */
117  void *sfmMutex;
118 
119  /* cacheMutex and bufferMutex are only required.if caching
120  * - see sectionBuffCacheSize
121  * It if used in mutexLock / mutexUnlock functions and must be created
122  * before supplying to SFM_CreateInstance
123  */
124  void *cacheMutex;
125  void *bufferMutex;
126 
127  /* -------- Configuration parameters --------- */
128 
129  /* Set maximum number of PID filters available to be used symultaneously
130  * Minimum value: 4
131  */
132  U8BIT maxPidFilters;
133 
134  /* Set maximum number of section filters per PID filter used symultaneously.
135  * Low values will increase requirement for SFM to do it's own
136  * software section filtering.
137  * Minimum value: 1
138  */
139  U8BIT maxSecFiltersPerPid;
140 
141  /* Size of section buffer manager cache in 64K byte blocks. This memory is
142  * used to store section data not immediately required by DSM-CC instance.
143  * This facilitates faster DSM-CC file loading - particularly when the number
144  * of section filters is limited. See maxSecFiltersPerPid (and maxPidFilters)
145  * Minimum value: 0
146  * Suggested value: 16
147  */
148  U8BIT sectionBuffCacheSize;
149 
150  /*
151  * Specifies the maximum number of section filters that are available
152  * to the DSM-CC instance for simultaneously acquiring DSM-CC private sections.
153  * This should be set with the same value as that given to the DSM-CC instance
154  * creation - see 'maxAvailableSectionFilters' in DSM-CC setup.
155  */
156  U16BIT maxAvailableSectionFilters;
157 
158  /* dbgState controls type of debug output for dbgPrintf
159  * For valid debug filter states see above
160  */
161  U32BIT dbgState;
162 } S_SfmSetup;
163 
164 
165 /*---------------------- Functions that configure SFM ------------------------*/
166 
173 
183 void SFM_DestroyInstance( H_SfmInstance sfm, void **pSfmMtx,
184  void **pCchMtx, void **pBufMtx );
185 
194 void SFM_SetDebugConfig( H_SfmInstance sfm, F_Printf errPrintf,
195  F_Printf dbgPrintf, U32BIT dbgState );
196 
203 void SFM_SetDebugState( H_SfmInstance sfm, U32BIT dbgState );
204 
212 
219 void SFM_SetDemuxHandle( H_SfmInstance sfm, DMXREF demux );
220 
221 
222 
223 /*----------------- Functions that process section data ---------------------*/
224 
240 E_SFM_STATUS SFM_RequireSection( H_SfmInstance sfm, PIDFILT pfid,
241  U8BIT *pHeader, void **phBuffer );
242 
254 U8BIT* SFM_CacheBuffer( H_SfmInstance sfm, void *hBuffer );
255 
264 void SFM_CacheReleaseBuffer( H_SfmInstance sfm, U8BIT *pSection, void *hBuffer );
265 
278 void SFM_ProcessSection( H_SfmInstance sfm, U8BIT *pSection, void *hBuffer );
279 
286 void SFM_FilterUpdate( H_SfmInstance sfm, H_DmxPidFilter hPF );
287 
288 /*-------------------- Functions to manage SFM caching -----------------------*/
289 
296 BOOLEAN SFM_CacheEnableSSF( H_SfmInstance sfm );
297 
304 
313 void SFM_CacheClear( H_SfmInstance sfm );
314 
315 
316 
317 /*----------------- Functions provided to DSM-CC component -------------------*/
318 
329 void* SFM_DsmccFilterAdd( H_SfmInstance sfm, P_SecFilter pFilter,
330  H_DscSFRef dsmSfRef );
331 
342 void SFM_DsmccFilterDelete( H_SfmInstance sfm, void *filterHandle,
343  H_DscSFRef dsmSfRef );
344 
345 
357 void SFM_DsmccFilterPriorityChange( H_SfmInstance sfm, void *filterHandle,
358  H_DscSFRef dsmSfRef,
359  E_SFPriority priority );
360 
361 #endif /*_DSFM_H_*/
void * SFM_DsmccFilterAdd(H_SfmInstance sfm, P_SecFilter pFilter, H_DscSFRef dsmSfRef)
Add DSM-CC section filter. Called by DSM-CC component, and given in clDsmSysCreate setup...
Definition: sfm_filter.c:959
void(* F_CacheMatch)(H_SfmInstance sfm, U8BIT *pSection, void *hBuffer, E_SFM_STATUS status)
Report to SFM client that there is an update to be processed. This is called in the normal DSM-CC thr...
Definition: dsfm.h:70
void SFM_CacheClear(H_SfmInstance sfm)
Clear all SFM cached section data. Not required to be called, if setup had sectionBuffCacheSize set t...
Definition: sfm_cache.c:541
BOOLEAN SFM_CacheEnableSSF(H_SfmInstance sfm)
Enables Full Sotfware Section Filtering using SFM cache. This will only be successfull if sufficient ...
void SFM_SetDsmInstance(H_SfmInstance sfm, H_DsmCoreInst dsmcc)
Set instance handle for DSM-CC that SFM is supporting.
Definition: sfm_main.c:220
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 ...
Definition: sfm_main.c:257
void SFM_DsmccFilterDelete(H_SfmInstance sfm, void *filterHandle, H_DscSFRef dsmSfRef)
Delete DSM-CC section filter. Called by DSM-CC component, and given in clDsmSysCreate setup...
Definition: sfm_filter.c:1026
DSM-CC API functions to control DSM-CC instance.
void SFM_DsmccFilterPriorityChange(H_SfmInstance sfm, void *filterHandle, H_DscSFRef dsmSfRef, E_SFPriority priority)
Change DSM-CC section filter priority Called by DSM-CC component, and given in clDsmSysCreate setup...
Definition: sfm_filter.c:1128
void SFM_CacheDisableSSF(H_SfmInstance sfm)
Disables Sotfware Section Filtering.
Define Demux types use in section filter API.
void SFM_SetDemuxHandle(H_SfmInstance sfm, DMXREF demux)
Set handle to be passed to F_DvpFilterSetup and F_DvpFilterRemove.
Definition: sfm_main.c:233
DSM-CC global types header Used by SI Query and Section Filter code.
U8BIT * SFM_CacheBuffer(H_SfmInstance sfm, void *hBuffer)
Get section data buffer pointer in SFM's cache for the handle. This should only be called after SFM_R...
Definition: sfm_cache.c:702
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...
Definition: sfm_main.c:161
void(* F_UpdateFilter)(H_SfmInstance sfm, H_DmxPidFilter hPF)
Report to SFM client that there is a filter update to be processed. The client must place the request...
Definition: dsfm.h:56
H_SfmInstance SFM_CreateInstance(S_SfmSetup *pSetup)
Create Section Filter Manager instance, using setup structure.
Definition: sfm_main.c:62
void SFM_FilterUpdate(H_SfmInstance sfm, H_DmxPidFilter hPF)
Update SFM PID filter to configure HW for latest requirements.
Definition: sfm_filter.c:1075
void SFM_CacheReleaseBuffer(H_SfmInstance sfm, U8BIT *pSection, void *hBuffer)
Release Cache buffer allocated by SFM_CacheBuffer.
Definition: sfm_cache.c:725
void SFM_SetDebugConfig(H_SfmInstance sfm, F_Printf errPrintf, F_Printf dbgPrintf, U32BIT dbgState)
This allows controlling software to reconfigure SFM debug output.
Definition: sfm_main.c:192
void SFM_ProcessSection(H_SfmInstance sfm, U8BIT *pSection, void *hBuffer)
Process required section buffer. This should only be called after SFM_RequireSection has returned SFM...
Definition: sfm_main.c:299
Interface to Platform Section Filtering.
Define standard function types.
void SFM_SetDebugState(H_SfmInstance sfm, U32BIT dbgState)
This allows controlling software to reconfigure SFM debug output.
Definition: sfm_main.c:209