33 #define KILOBYTES(n) (n << 10)
34 #define MEGABYTES(n) (n << 20)
36 #define INITERR(x, ...) if (pSetup->errPrintf) \
37 pSetup->errPrintf( "ERROR: " x "\n", ##__VA_ARGS__);
39 #define INITWRN(x, ...) if (pSetup->errPrintf) \
40 pSetup->errPrintf( "Warning: " x "\n", ##__VA_ARGS__);
70 if (pSetup->memAlloc == NULL)
72 INITERR(
"memAlloc NULL")
74 else if (pSetup->memFree == NULL)
76 INITERR(
"memFree NULL")
78 else if (pSetup->mutexLock == NULL)
80 INITERR(
"mutexLock NULL")
82 else if (pSetup->mutexUnlock == NULL)
84 INITERR(
"mutexUnlock NULL")
86 else if (pSetup->hwFilterCallback == NULL)
88 INITERR(
"hwFilterCallback NULL")
90 else if (pSetup->sfmMutex == NULL)
92 INITERR(
"sfmMutex NULL")
96 if (pSetup->maxPidFilters < 4)
98 INITWRN(
"maxPidFilters set to 4")
99 pSetup->maxPidFilters = 4;
101 else if (pSetup->maxPidFilters > 32)
103 INITWRN(
"maxPidFilters set to 32")
104 pSetup->maxPidFilters = 32;
106 if (pSetup->maxSecFiltersPerPid == 0)
108 INITWRN(
"maxSecFiltersPerPid set to 1")
109 pSetup->maxSecFiltersPerPid = 1;
111 if (pSetup->maxAvailableSectionFilters == 0 ||
112 pSetup->maxAvailableSectionFilters > NUM_SECTION_FILTERS_MAXIMUM)
114 INITWRN(
"maxAvailableSectionFilters set to %d", NUM_SECTION_FILTERS_MAXIMUM)
115 pSetup->maxAvailableSectionFilters = NUM_SECTION_FILTERS_MAXIMUM;
117 else if (pSetup->maxAvailableSectionFilters < NUM_SECTION_FILTERS_MINIMUM)
119 INITWRN(
"maxAvailableSectionFilters set to %d", NUM_SECTION_FILTERS_MINIMUM)
120 pSetup->maxAvailableSectionFilters = NUM_SECTION_FILTERS_MINIMUM;
125 INITERR(
"memory fail")
135 INITERR(
"PID resources fail")
136 sfm->setup.memFree( sfm );
139 sfm->cache = SFMCacheCreate( sfm );
140 if (sfm->cache == NULL)
142 INITWRN(
"Cache initialisation failed - zero cache")
162 void **pCchMtx,
void **pBufMtx )
168 *pSfmMtx = sfm->setup.sfmMutex;
172 *pCchMtx = sfm->setup.cacheMutex;
175 SFMCacheDestroy( sfm, pBufMtx );
179 sfm->setup.memFree( sfm );
193 F_Printf dbgPrintf, U32BIT dbgState )
197 sfm->setup.errPrintf = errPrintf;
198 sfm->setup.dbgPrintf = dbgPrintf;
199 sfm->setup.dbgState = dbgState;
211 sfm->setup.dbgState = dbgState;
258 U8BIT *pHeader,
void **phBuffer )
264 ASSERT((pHeader[5] & 0x1) == 0x1 )
267 (U16BIT)((pHeader[3] << 8) | pHeader[4]),
269 (pHeader[5] >> 1) & 0x1F,
272 DBGLOG(DF_HWSF,
"pfid=%x, sz=0x%x t=0x%x e=0x%x, %d, %d RESULT=%d", pfid,
273 (((
int)(pHeader[1] & 0x0f) << 8) | pHeader[2]) + 3, *pHeader,
274 ((pHeader[3] << 8) | pHeader[4]), pHeader[6] + 1, pHeader[7] + 1, result)
276 if (result == SFM_UPDATE_CACHE)
279 if (*phBuffer == NULL)
301 FUNCTION_START(SFM_AddSectionFilter)
302 if (SFMFilterValidHandle( sfm, hBuffer ))
312 ERRLOG(
"Invalid buffer handle")
314 FUNCTION_FINISH(SFM_AddSectionFilter)
H_SfmInstance SFM_CreateInstance(S_SfmSetup *pSetup)
Create Section Filter Manager instance, using setup structure.
void SFM_SetDemuxHandle(H_SfmInstance sfm, DMXREF demux)
Set handle to be passed to F_DvpFilterSetup and F_DvpFilterRemove.
void SFMFilterProcessSection(H_SfmInstance sfm, U8BIT *pSection, H_DsmResource pDsmRes)
Get DSM-CC filter request and pass section buffer to DSM-CC with it's filter handle This should only ...
BOOLEAN SFMFilterCreateResources(H_SfmInstance sfm)
Create Filter resources for Section Filter Manager instance.
void SFMCacheAddBlock(H_SfmInstance sfm, U8BIT size1, U8BIT bknum, void **phBuffer)
Allocates space in cache for section data If allocation is made, *phBuffer has holds cache location...
void SFM_SetDebugState(H_SfmInstance sfm, U32BIT dbgState)
This allows controlling software to reconfigure SFM debug output.
Section Filter Manasger (SFM): cache definitions.
Section Filter Manager (SFM): filters.
void SFMCacheProcessSection(H_SfmInstance sfm, U8BIT *pSection, H_CacheFilter cfilter)
Tells SFM Cache to update DSM-CC with cached buffer (reported to F_CacheMatch callback funtion...
Section Filter Manager (SFM): main definitions.
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...
E_SFM_STATUS SFMFilterRequiresSection(H_SfmInstance sfm, PIDFILT pfid, U16BIT teid, U8BIT tid, U8BIT vers, void **phBuffer)
This function performs minimal checking of section header data to find out whether SFM requires this ...
void SFMFilterDestroyResources(H_SfmInstance sfm)
Destroy Filter resources for Section Filter Manager instance.
void SFM_SetDebugConfig(H_SfmInstance sfm, F_Printf errPrintf, F_Printf dbgPrintf, U32BIT dbgState)
This allows controlling software to reconfigure SFM debug output.
BOOLEAN SFMCacheValidHandle(H_SfmInstance sfm, void *ptr)
void SFM_SetDsmInstance(H_SfmInstance sfm, H_DsmCoreInst dsmcc)
Set instance handle for DSM-CC that SFM is supporting.
void SFMFilterInitCaching(H_SfmInstance sfm)
Initialise caching references.
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...
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 ...