48 #if (!defined(NDEBUG) && !defined(NO_DP))
56 #define DSI_MSG_ID 0x1006
57 #define DII_MSG_ID 0x1002
58 #define DDB_MSG_ID 0x1003
61 #if (!defined(NDEBUG) && !defined(NO_DP))
62 F_Printf DBG_ErrorPrintfFunc = NULL;
63 F_Printf DBG_WarnPrintfFunc = NULL;
64 F_Printf DBG_DebugPrintfFunc = NULL;
65 F_Printf DBG_InfoPrintfFunc = NULL;
66 U32BIT dsmDbgState = 0;
71 typedef struct _accelerate_carousel_loading_struct
75 U16BIT storedSectionsNB;
76 U16BIT SectionsReinjection;
77 BOOLEAN bLargeDDBFilterSet;
78 U16BIT requestedModidPos;
80 } accelerateCarouselLoading_t;
82 accelerateCarouselLoading_t accCarouselLoadingInfos;
86 #ifdef ACCELERATE_CAROUSEL_LOADING
90 #define kMAX_PRESTORED_SECTIONS 100
92 #define kMAX_SECTION_SIZE 5000
101 U8BIT section[kMAX_SECTION_SIZE];
104 tPrestoredSection *prestoredSectionsTable = NULL;
107 #define kMAX_MODULE_ID 0xFFFF
108 #define kNOT_REQUESTED 0
110 U8BIT *requestedModuleIDList = NULL;
112 U16BIT GBL_NewResquetedModuleID = 0;
127 #ifdef ACCELERATE_CAROUSEL_LOADING
133 E_DscError requestedModuleIdSet(U16BIT moduleID);
135 E_DscError requestedModuleIdReset(U16BIT moduleID);
146 F_Printf debugFunc, F_Printf infoFunc )
148 #if (!defined(NDEBUG) && !defined(NO_DP))
149 DBG_ErrorPrintfFunc = errorFunc;
150 DBG_WarnPrintfFunc = warnFunc;
151 DBG_DebugPrintfFunc = debugFunc;
152 DBG_InfoPrintfFunc = infoFunc;
158 #if (!defined(NDEBUG) && !defined(NO_DP))
172 dsm->dbgMask = (U16BIT)dbgMask;
183 E_DscError CDSM_SysCreate(
188 E_DscError err = CLDSM_OK;
189 E_DsmMemErr memErr = MEM_ERR_ALLOC_FAILED;
192 dsmDP1((
"CDSM_SysCreate( %p, %p, %p )\n", pSetup, pInstance, pMemContext));
196 dsmDP3((
"\n-----------------------------------------\n"));
197 dsmDP3((
"DEBUG CHECKS ON MEMORY SIZES (bytes):\n\n"));
198 dsmDP3((
"INFO: LinkList Ctrl block size = %u\n",
sizeof(
S_LLControl)));
199 dsmAssert((
sizeof(
S_LLControl) <= MIN_MEM_BLK_SIZE));
202 dsmDP3((
"INFO: Data Carousel size = %u\n",
sizeof(
S_DataCarousel)));
204 dsmDP3((
"INFO: Module size = %u\n",
sizeof(
S_Module)));
205 dsmAssert((
sizeof(
S_Module) <= MIN_MEM_BLK_SIZE));
208 dsmDP3((
"INFO: LoadRequest size = %u\n",
sizeof(
S_LoadRequest)));
210 dsmDP3((
"INFO: DSM Object size = %u\n",
sizeof(
S_DsmObject)));
211 dsmAssert((
sizeof(
S_DsmObject) <= MIN_MEM_BLK_SIZE));
212 dsmDP3((
"INFO: Max pathname size = %u\n", MAX_PATH_NAME_SIZE));
213 dsmAssert((MAX_PATH_NAME_SIZE <= MIN_MEM_BLK_SIZE));
216 dsmDP3((
"-----------------------------------------\n"));
218 dsmDP3((
"\nINFO: Core Instance data size (including zlib heap) = %u bytes\n",
219 sizeof(clDsmInstData_t)));
224 API_PARAM_CHK( pInstance, dsmDP1((
"ERROR: Illegal parameter\n")),
225 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
226 API_PARAM_CHK( pMemContext, dsmDP1((
"ERROR: Illegal parameter\n")),
227 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
228 API_PARAM_CHK( pSetup, dsmDP1((
"ERROR: Illegal setup\n")),
229 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
230 API_PARAM_CHK( pSetup->allocFunc, dsmDP1((
"ERROR: Illegal setup\n")),
231 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
232 API_PARAM_CHK( pSetup->freeFunc, dsmDP1((
"ERROR: Illegal setup\n")),
233 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
236 API_PARAM_CHK( pSetup->addSectionFilterFunc, dsmDP1((
"ERROR: Illegal setup\n")),
237 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
238 API_PARAM_CHK( pSetup->delSectionFilterFunc, dsmDP1((
"ERROR: Illegal setup\n")),
239 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
240 API_PARAM_CHK( pSetup->startSIQueryFunc, dsmDP1((
"ERROR: Illegal setup\n")),
241 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
242 API_PARAM_CHK( pSetup->stopSIQueryFunc, dsmDP1((
"ERROR: Illegal setup\n")),
243 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
244 API_PARAM_CHK( pSetup->startTimerFunc, dsmDP1((
"ERROR: Illegal setup\n")),
245 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
246 API_PARAM_CHK( pSetup->stopTimerFunc, dsmDP1((
"ERROR: Illegal setup\n")),
247 err = CLDSM_ERR_ILLEGAL_SETUP;
goto _return );
256 dsmDP1((
"ERROR: Unable to allocate instance memory\n"));
257 err = CLDSM_ERR_ALLOC_FAILED;
262 idp->setup = *pSetup;
266 idp->pfdlfCallDepth = 0;
267 idp->pfrdoCallDepth = 0;
268 idp->pfsdndCallDepth = 0;
273 if (idp->setup.storeSIQueryResults != TRUE)
275 idp->setup.storeSIQueryResults = FALSE;
278 if (idp->setup.turboCaching != TRUE)
280 idp->setup.turboCaching = FALSE;
286 idp->llcRootCarousels = NULL;
287 idp->llcLoadedModules = NULL;
288 idp->llcModulePriority = NULL;
289 idp->llcExpiredModules = NULL;
290 idp->llcCurrLoadRequests = NULL;
291 idp->llcCurrSiQueries = NULL;
293 idp->hSubscribedEventList = NULL;
296 idp->dvbLocator.service_id = 0;
297 idp->currentServiceSet = FALSE;
298 idp->cacheFull = FALSE;
302 idp->generation.ptr = NULL;
305 idp->cacheMemoryUsage = 0;
306 idp->cacheMaximumUsage = 0;
309 idp->pBootingCarousel = NULL;
310 idp->pCurrentCarousel = NULL;
313 idp->lastPIDResultStored = FALSE;
314 idp->lastServiceId = 0;
315 idp->lastAssociationTag = 0;
319 idp->dsmObjectsOpen = 0;
321 if (pSetup->maxAvailableSectionFilters == 0 ||
322 pSetup->maxAvailableSectionFilters > NUM_SECTION_FILTERS_MAXIMUM)
324 sfHeapSize = NUM_SECTION_FILTERS_MAXIMUM;
326 else if (pSetup->maxAvailableSectionFilters < NUM_SECTION_FILTERS_MINIMUM)
328 sfHeapSize = NUM_SECTION_FILTERS_MINIMUM;
332 sfHeapSize = pSetup->maxAvailableSectionFilters;
335 if (pSetup->maxMemorySize < DSMCC_MINIMUM_CACHE_SIZE)
337 dsmDP2((
"WARN: setting cache size to minimum %d\n", DSMCC_MINIMUM_CACHE_SIZE));
338 pSetup->maxMemorySize = DSMCC_MINIMUM_CACHE_SIZE;
342 idp->sectionFilterHeap = NULL;
343 err = DSC_SsectionFilterHeapCreate( idp, &idp->sectionFilterHeap, &sfHeapSize );
347 dsmDP1((
"ERROR: Unable to create section filter heap\n"));
348 idp->sectionFilterHeap = NULL;
353 moduleDecompressInit( idp );
356 memStart( MIN_MEM_BLK_SIZE, pSetup->maxMemorySize - (
sizeof(
S_DsmCoreInst) + sfHeapSize),
357 (NUM_INTERNAL_MEM_SEQ_MAX + NUM_OPEN_DSM_OBJECTS_MAX),
358 idp->setup.memMgrSetup,
361 if (memErr != MEM_NO_ERR)
363 dsmDP1((
"ERROR: Unable to start memory manager\n"));
364 err = CLDSM_ERR_MEMMGR_START_PROBLEM;
365 idp->memContext = NULL;
369 #ifdef ACCELERATE_CAROUSEL_LOADING
370 prestoredSectionsTable =
371 (tPrestoredSection *)pSetup->allocFunc(
sizeof(tPrestoredSection) * kMAX_PRESTORED_SECTIONS );
373 accCarouselLoadingInfos.bLargeDDBFilterSet = FALSE;
374 accCarouselLoadingInfos.largeDDBFilter = NULL;
376 requestedModuleIDList =
377 (U8BIT *)pSetup->allocFunc(kMAX_MODULE_ID + 1);
381 err = LLCreate( idp, NULL, ROOT_CAROUSEL_LIST,
382 &idp->llcRootCarousels );
386 err = LLCreate( idp, NULL, MODULE_LOADED_LIST,
387 &idp->llcLoadedModules );
391 err = LLCreate( idp, NULL, MODULE_PRIORITY_LIST,
392 &idp->llcModulePriority );
396 err = LLCreate( idp, NULL, MODULE_DELETE_LIST,
397 &idp->llcExpiredModules );
401 err = LLCreate( idp, NULL, CURR_LOAD_REQUEST_LIST,
402 &idp->llcCurrLoadRequests );
406 err = LLCreate( idp, NULL, CURR_SI_QUERY_LIST,
407 &idp->llcCurrSiQueries );
411 *pMemContext = idp->memContext;
420 if (idp->llcRootCarousels)
422 LLDestroy( idp, &idp->llcRootCarousels );
424 if (idp->llcLoadedModules)
426 LLDestroy( idp, &idp->llcLoadedModules );
428 if (idp->llcModulePriority)
430 LLDestroy( idp, &idp->llcModulePriority );
432 if (idp->llcExpiredModules)
434 LLDestroy( idp, &idp->llcExpiredModules );
436 if (idp->llcCurrLoadRequests)
438 LLDestroy( idp, &idp->llcCurrLoadRequests);
440 if (idp->llcCurrSiQueries)
442 LLDestroy( idp, &idp->llcCurrSiQueries );
445 if (memErr == MEM_NO_ERR)
447 memStop( MEM_CONTEXT );
449 if (idp->sectionFilterHeap)
451 idp->setup.freeFunc( idp->sectionFilterHeap );
453 idp->setup.freeFunc( idp );
457 DEBUG_CHK( err == CLDSM_OK,
458 dsmDP1((
"ERROR: clDsmSysCreate: %u\n", err)));
459 dsmDP1((
"exit clDsmSysCreate -> rtn: %u, o/p: %p, %p \n",
460 err, *pInstance, *pMemContext));
471 E_DscError err = CLDSM_OK;
472 E_DsmMemErr memErr = MEM_NO_ERR;
474 dsmDP2((
"CDSM_SysDestroy( %p )\n", instance));
476 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
477 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
481 if (idp->currentServiceSet)
483 err = CLDSM_ERR_INSTANCE_NOT_RESET;
488 LLDestroy( idp, &idp->llcRootCarousels );
489 LLDestroy( idp, &idp->llcLoadedModules );
490 LLDestroy( idp, &idp->llcModulePriority );
491 LLDestroy( idp, &idp->llcExpiredModules );
492 LLDestroy( idp, &idp->llcCurrLoadRequests );
493 LLDestroy( idp, &idp->llcCurrSiQueries );
497 dsmAssert((idp->sectionFilterHeap != NULL));
498 idp->setup.freeFunc( idp->sectionFilterHeap );
500 #ifdef ACCELERATE_CAROUSEL_LOADING
501 idp->setup.freeFunc((tPrestoredSection *)prestoredSectionsTable );
502 idp->setup.freeFunc((U8BIT *)requestedModuleIDList );
508 memErr = memStop( MEM_CONTEXT );
510 if ((!err) && memErr)
512 err = CLDSM_ERR_MEMMGR_STOP_PROBLEM;
514 *pSiqInst = idp->setup.siqInstance;
515 *pSfmInst = idp->setup.sfmInstance;
517 idp->setup.freeFunc( idp );
521 DEBUG_CHK( err == CLDSM_OK,
522 dsmDP1((
"ERROR: clDsmSysDestroy: %u\n", err)));
523 dsmDP2((
"exit clDsmSysDestroy -> rtn: %u \n", err));
535 return idp->setup.dsmControl;
538 E_DscError CDSM_UnloadAllCarousels(
P_DsmCoreInst idp, U8BIT mode )
541 E_DscError intErr = CLDSM_OK;
545 hOC = LLHead( idp->llcRootCarousels );
549 while (hOC && !intErr)
555 dsmAssert((intErr == CLDSM_OK));
561 hOC = LLHead( idp->llcRootCarousels );
568 static void CDSM_UnloadCarouselsOnService(
P_DsmCoreInst idp, U16BIT serviceId )
574 listId = LListId( idp->llcRootCarousels );
575 pRC = LLHead( idp->llcRootCarousels );
578 pNext = LLNext( pRC, listId );
579 if (pRC->serviceId == serviceId)
584 ERRPRINT(
"Unload carousel err=%d", err)
594 E_SiQueryState queryState;
598 pSiQueryRef = LLHead( idp->llcCurrSiQueries );
602 queryState = pSiQueryRef->state;
606 if ((queryState == SIQS_ABORTED) || (queryState == SIQS_EXPIRED))
608 dsmDP2((
"ClearAllQueries: Stopping SI Query=%p state=%d\n", pSiQueryRef, queryState));
621 ERRPRINT(
"Invalid query state")
627 pSiQueryRef = LLHead( idp->llcCurrSiQueries );
637 listId = LListId( idp->llcCurrLoadRequests );
638 pLoadRequest = LLHead( idp->llcCurrLoadRequests );
642 pNextRequest = LLNext( pLoadRequest, listId );
643 ERRPRINT(
"Load request status=%d", pLoadRequest->rlr.status)
645 pLoadRequest = pNextRequest;
647 while (pLoadRequest);
654 pModule = LLHead( llc );
657 pNextMod = LLNext( pModule, listId );
658 dsmAssert((pModule->loadedCount == 0));
659 dsmAssert((pModule->llcLoadRequests == NULL));
672 E_DscError err = CLDSM_OK;
675 dsmDP2((
"CDSM_SysReset( %p, %u )\n", instance, mode));
677 if (!idp || !idp->currentServiceSet)
679 ERRPRINT(
"ERROR: invalid instance? %p", idp);
683 err = CDSM_UnloadAllCarousels( idp, mode );
686 ERRPRINT(
"Failed to unload all carousels err=%d", err)
690 if (mode != RST_MODE_PENDING)
692 listCount = LLCount( idp->llcCurrLoadRequests );
695 ERRPRINT(
"Load requests still present, count=%d", listCount)
696 UnloadLoadRequests( idp );
699 listCount = LLCount( idp->llcModulePriority );
702 ERRPRINT(
"Priority Modules still present, count=%d", listCount)
703 UnloadModules( idp, idp->llcModulePriority, MODULE_PRIORITY_LIST );
705 listCount = LLCount( idp->llcLoadedModules );
708 ERRPRINT(
"Loaded Modules still present, count=%d", listCount)
709 UnloadModules( idp, idp->llcLoadedModules, MODULE_LOADED_LIST );
711 listCount = LLCount( idp->llcExpiredModules );
714 ERRPRINT(
"Expired Modules still present count=%d", listCount)
715 UnloadModules( idp, idp->llcExpiredModules, MODULE_DELETE_LIST );
718 ClearAllQueries( idp );
720 DSC_StrmEventListReset( idp );
723 dsmDP3((
"lastPID=%d lpStored=%d, lastAssocTag=%d",
724 idp->lastPID, idp->lastPIDResultStored, idp->lastAssociationTag));
726 if (idp->dvbLocator.service_id != 0)
728 if (idp->setup.unsubscribeSIChangeFunc != NULL)
731 idp->setup.unsubscribeSIChangeFunc( idp->setup.siqInstance, idp->dvbLocator.service_id );
736 idp->dvbLocator.service_id = 0;
737 idp->currentServiceSet = FALSE;
738 idp->cacheFull = FALSE;
741 idp->lastPIDResultStored = FALSE;
742 idp->lastAssociationTag = 0;
746 idp->pBootingCarousel = NULL;
750 dsmAssert((idp->dsmObjectsOpen == 0));
751 idp->dsmObjectsOpen = 0;
753 if (mode != RST_MODE_PENDING)
756 DSC_SsectionFilterHeapReset( idp );
759 moduleDecompressInit( idp );
762 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmSysReset: %u\n", err)));
763 dsmDP2((
"exit clDsmSysReset -> rtn: %u \n", err));
775 if (maxMemory > DSMCC_MINIMUM_CACHE_SIZE)
778 if (idp->setup.maxMemorySize > maxMemory)
780 DSC_CmMemPurgeCache( idp, maxMemory );
782 idp->setup.maxMemorySize = maxMemory;
820 U16BIT original_network_id, U16BIT transport_stream_id,
824 E_DscError err = CLDSM_OK;
827 dsmDP2((
"CDSM_SysSetCurrService( %p, %u, %u, %u )\n", instance,
828 original_network_id, transport_stream_id, service_id));
830 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
831 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
835 hOC = LLHead( idp->llcRootCarousels );
839 err = CLDSM_ERR_CAROUSELS_STILL_LOADED;
843 dsmDP4((
"lastPID=%d lpStored=%d, lastAssocTag=%d",
844 idp->lastPID, idp->lastPIDResultStored, idp->lastAssociationTag));
846 if (idp->dvbLocator.service_id == service_id &&
847 idp->dvbLocator.original_network_id == original_network_id)
849 idp->dvbLocator.transport_stream_id = transport_stream_id;
850 idp->currentServiceSet = TRUE;
854 if (idp->dvbLocator.service_id != 0)
856 if (NULL != idp->setup.unsubscribeSIChangeFunc)
859 idp->setup.unsubscribeSIChangeFunc( idp->setup.siqInstance, idp->dvbLocator.service_id );
862 idp->dvbLocator.original_network_id = original_network_id;
863 idp->dvbLocator.transport_stream_id = transport_stream_id;
864 idp->dvbLocator.service_id = service_id;
865 idp->currentServiceSet = TRUE;
868 if (NULL != idp->setup.subscribeSIChangeFunc)
870 idp->setup.subscribeSIChangeFunc( idp->setup.siqInstance, service_id );
876 idp->generation.u32++;
879 idp->lastPIDResultStored = FALSE;
880 idp->lastAssociationTag = 0;
883 #ifdef ACCELERATE_CAROUSEL_LOADING
885 memset(&requestedModuleIDList[0], 0, kMAX_MODULE_ID);
887 memset(&prestoredSectionsTable[0], 0,
sizeof(tPrestoredSection) * kMAX_PRESTORED_SECTIONS);
890 accCarouselLoadingInfos.storeWritePos = 0;
891 accCarouselLoadingInfos.storeReadPos = 0;
892 accCarouselLoadingInfos.storedSectionsNB = 0;
893 accCarouselLoadingInfos.bLargeDDBFilterSet = FALSE;
898 DEBUG_CHK( err == CLDSM_OK,
899 dsmDP1((
"ERROR: clDsmSysSetCurrService: %u\n", err)));
900 dsmDP2((
"exit clDsmSysSetCurrService -> rtn: %u \n", err));
907 return idp->dvbLocator.service_id;
917 void *clDsmTmrUserData, E_TimerStatus status,
void *timerHandle )
922 dsmDP3((
"CDSM_SysProcessTimerEvent( %p, %u, %p, %p )\n", instance,
923 status, clDsmTmrUserData, timerHandle));
925 if (pFilterInfo->tms.mainTimerHandle == timerHandle)
927 pFilterInfo->tms.mainTimerHandle = NULL;
929 else if (pFilterInfo->tms.nextTimerHandle == timerHandle)
931 pFilterInfo->tms.nextTimerHandle = NULL;
935 case TIMER_TRIGGERED:
936 switch (pFilterInfo->target.kind)
939 dsmDP2((
"TIMER_TRIGGERED: SFK_DSI: pFilterInfo = 0x%p\n", pFilterInfo));
940 if (DSC_RootCrslMagic(pFilterInfo->target.u.pRC) == OC_MAGIC)
942 lmObjCarouselTimeout(idp, pFilterInfo->target.u.pOC);
944 DSC_RootCrslLoadRequestFail(idp, pFilterInfo->target.u.pRC);
948 dsmDP2((
"TIMER_TRIGGERED: SFK_DII: pFilterInfo = 0x%p\n", pFilterInfo));
949 DSC_DataCrslDelete(idp, pFilterInfo->target.u.pDC);
953 dsmDP2((
"TIMER_TRIGGERED: SFK_DDB: pFilterInfo = 0x%p\n", pFilterInfo));
954 lmAbortLoadRequestsOnModuleTimeout(idp, pFilterInfo->target.u.pModule);
963 switch (pFilterInfo->target.kind)
966 dsmDP3((
"TIMER_ABORTED: SFK_DSI: pFilterInfo = 0x%p\n", pFilterInfo));
970 dsmDP3((
"TIMER_ABORTED: SFK_DII: pFilterInfo = 0x%p\n", pFilterInfo));
974 dsmDP3((
"TIMER_ABORTED: SFK_DDB: pFilterInfo = 0x%p\n", pFilterInfo));
983 dsmDP2((
"TIMER_STAUTS_???: pFilterInfo = 0x%p\n", pFilterInfo));
1035 H_SIQueryRef clDsmSIQueryRef,
void *clDsmSIUserData,
P_SIQueryResult pResult )
1037 E_DscError err = CLDSM_OK;
1040 E_DscError newErr = CLDSM_OK;
1042 dsmDP2((
"CDSM_SysProcessSIQueryEvent( %p, %p, %p )\n", idp, clDsmSIQueryRef, pResult));
1046 dsmDP1((
"ERROR: Invalid instance\n"));
1047 err = CLDSM_ERR_INVALID_INSTANCE;
1049 else if ((idp->currentServiceSet == FALSE) ||
1050 (idp->generation.ptr != clDsmSIUserData))
1054 dsmDP3((
"INFO: Stale siQuery discarded (generation)\n"));
1056 else if (!memValidate(pSiQueryRef))
1058 dsmDP1((
"API ERROR: Invalid SI Query ref (handle)\n"));
1059 err = CLDSM_ERR_INVALID_SI_QUERY_REF;
1063 if (pSiQueryRef->magic != SI_QUERY_MAGIC)
1065 dsmDP1((
"API ERROR: Invalid SI Query ref (magic)\n"));
1066 err = CLDSM_ERR_INVALID_SI_QUERY_REF;
1068 else if (pSiQueryRef->state == SIQS_COMPLETED)
1070 dsmDP1((
"API ERROR: Invalid SI Query ref (already completed)\n"));
1071 err = CLDSM_ERR_INVALID_SI_QUERY_REF;
1076 dsmAssert((pSiQueryRef->original == TRUE));
1078 if (pSiQueryRef->llcDuplSiQuerys != NULL)
1081 pDuplSiQueryRef = LLRemoveHead( pSiQueryRef->llcDuplSiQuerys );
1083 while (pDuplSiQueryRef != NULL)
1088 err = handleInLoopError( idp, err, newErr );
1090 pDuplSiQueryRef = LLRemoveHead( pSiQueryRef->llcDuplSiQuerys );
1093 LLDestroy( idp, &pSiQueryRef->llcDuplSiQuerys );
1099 err = handleInLoopError( idp, err, newErr );
1103 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: clDsmSysProcessSIQueryEvent: %u\n", err)));
1104 dsmDP2((
"exit clDsmSysProcessSIQueryEvent -> rtn: %u \n", err));
1114 E_SIChangeEvent event, U16BIT service_id, U32BIT carousel_id )
1117 E_DscError err = CLDSM_OK;
1118 H_DsmCarousel pOC = NULL;
1120 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
1121 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
1123 dsmDP2((
"CDSM_SysProcessSIChangeEvent( %p, %u, %u )\n", instance,
1124 service_id, event));
1126 dsmDP4((
"lastPID=%d lpStored=%d, lastAssocTag=%d",
1127 idp->lastPID, idp->lastPIDResultStored, idp->lastAssociationTag));
1132 case SICHANGE_SERVICE_UPDATED:
1133 if (idp->dvbLocator.service_id == service_id)
1135 idp->lastPIDResultStored = FALSE;
1138 err = pmtUpdtAllSectionFiltersReset(instance, service_id);
1141 case SICHANGE_CAROUSEL_DELETED:
1149 case SICHANGE_SERVICE_DELETED:
1150 CDSM_UnloadCarouselsOnService( instance, service_id );
1157 DEBUG_CHK( err == CLDSM_OK,
1158 dsmDP1((
"ERROR: clDsmSysProcessSIChangeEvent: %u\n", err)));
1159 dsmDP2((
"exit clDsmSysProcessSIChangeEvent -> rtn: %u \n", err));
1168 H_DscSFRef dsmFilterRef, E_SFPriority *priority )
1173 if (instance == NULL)
1175 err = CLDSM_ERR_INVALID_INSTANCE;
1176 ERRPRINT(
"ERROR: Invalid instance")
1181 pFilterInfo = DSC_SectionFilterRetrieve( idp, dsmFilterRef );
1182 if (pFilterInfo == NULL)
1184 err = CLDSM_ERR_ABORTED;
1185 DBGLOG(DD_SF,
"Stale section discarded")
1190 *priority = pFilterInfo->filter.priority;
1193 DBGLOG(DD_SF,
"rtn: %u", err)
1203 E_DscError CDSM_SysProcessPrivateSection(
H_DsmCoreInst idp,
1204 U8BIT *pSection, H_DscSFRef dsmFilterRef )
1208 #ifdef ACCELERATE_CAROUSEL_LOADING
1209 U8BIT *pTempSection = pSection;
1212 DBG3(DD_SF,
"CDSM_SysProcessPrivateSection( %p, %p, %p )", idp, pSection, dsmFilterRef)
1216 err = CLDSM_ERR_INVALID_INSTANCE;
1217 ERRPRINT(
"ERROR: Invalid instance")
1219 else if (pSection == NULL)
1221 err = CLDSM_ERR_ILLEGAL_PARAMETER;
1222 ERRPRINT(
"ERROR: Invalid section")
1226 dsmDP3((
"%s sz=0x%x tid=0x%x tide=0x%x, %d of %d\n", __FUNCTION__,
1227 (((
int)(pSection[1] & 0x0f) << 8) | pSection[2]) + 3, *pSection,
1228 ((pSection[3] << 8) | pSection[4]), pSection[6] + 1, pSection[7] + 1));
1230 pFilterInfo = DSC_SectionFilterRetrieve( idp, dsmFilterRef );
1231 if (pFilterInfo == NULL)
1233 err = CLDSM_ERR_ABORTED;
1234 DBGLOG(DD_SF,
"Stale section discarded ref=0x%x", dsmFilterRef)
1238 switch (pFilterInfo->target.kind)
1241 err = processDSI( idp, pSection, pFilterInfo );
1245 #ifdef ACCELERATE_CAROUSEL_LOADING
1246 GBL_NewResquetedModuleID = 0;
1248 err = processDII( idp, pSection, pFilterInfo );
1250 #ifdef ACCELERATE_CAROUSEL_LOADING
1251 if (accCarouselLoadingInfos.storedSectionsNB > 0)
1253 err = injectStoredSections(idp);
1259 #ifdef ACCELERATE_CAROUSEL_LOADING
1261 pTempSection = pSection;
1264 err = processDDB( idp, pSection, pFilterInfo );
1266 #ifdef ACCELERATE_CAROUSEL_LOADING
1267 if (CLDSM_OK != err)
1270 storeSection(idp, pTempSection);
1275 case SFK_STREAM_DESCR:
1276 err = DSC_StrmEventUpdate( idp, pSection, pFilterInfo->target.u.pEvent, pFilterInfo->target.id );
1281 DBGLOG(DD_SF,
"WARNING: Stale/invalid section filter handle (targetKind)")
1282 err = CLDSM_ERR_ABORTED;
1288 case CLDSM_ERR_INTERNAL:
1289 case CLDSM_ERR_SYSTEM_ADD_SECTION_FILTER:
1290 case CLDSM_ERR_SECTION_FILTER_HEAP_FULL:
1291 case CLDSM_ERR_MEM_HEAP_FULL:
1292 DBGLOG(DD_SF,
"rtn: %u", err)
1305 #ifdef ACCELERATE_CAROUSEL_LOADING
1306 E_DscError internalSysProcessPrivateSection(
H_DsmCoreInst instance,
1310 U16BIT tableIdExtension;
1311 E_DscError err = CLDSM_OK;
1317 dsmDP3((
"internalSysProcessPrivateSection( %p, %p, %x )\n",
1318 instance, pSection, clDsmFilterRef));
1319 API_PARAM_CHK( instance, dsmDP1((
"ERROR: Invalid instance\n")),
1320 err = CLDSM_ERR_INVALID_INSTANCE;
goto _return );
1321 API_PARAM_CHK( pSection, dsmDP1((
"ERROR: Illegal parameter\n")),
1322 err = CLDSM_ERR_ILLEGAL_PARAMETER;
goto _return );
1326 if (idp->currentServiceSet == FALSE)
1328 dsmDP3((
"INFO: Stale section discarded (generation)\n"));
1334 switch (pFilterInfo->target.kind)
1337 err = processDDB( idp, pSection, pFilterInfo );
1342 dsmDP2((
"WARNING: Stale/invalid section filter handle (targetKind)\n"));
1348 case CLDSM_ERR_INTERNAL:
1349 case CLDSM_ERR_SYSTEM_ADD_SECTION_FILTER:
1350 case CLDSM_ERR_SYSTEM_START_TIMER:
1351 case CLDSM_ERR_SECTION_FILTER_HEAP_FULL:
1352 case CLDSM_ERR_MEM_HEAP_FULL:
1363 err = CLDSM_ERR_ILLEGAL_PARAMETER;
1364 dsmDP1((
"API ERROR: No section filter reference supplied\n"));
1368 DEBUG_CHK( err == CLDSM_OK,
1369 dsmDP1((
"ERROR: clDsmSysProcessPrivateSection: %u\n", err)));
1374 dsmDP3((
"exit clDsmSysProcessPrivateSection -> rtn: %u \n", err));
1385 static U8BIT* ValidateDSI( U8BIT *pData, U16BIT *pPrivateDataLength, U32BIT *pTransactionId )
1387 U16BIT ui16, msglen;
1388 U8BIT ui8, adaptationHdrLen;
1391 READ_UINT8( pData, ui8 );
1394 DBG1(DD_OC,
"DATA ERROR: DSI tableId = %x", ui8)
1403 READ_UINT16( pData, ui16 );
1404 if (((ui16 & LSB12_MSK) > MAX_SECTION_LEN) ||
1405 (((ui16 & LSB12_MSK) - 9) < MIN_DSI_MSG_LEN))
1407 DBG1(DD_OC,
"DATA ERROR: DSI section len = %x", ui16)
1412 READ_UINT16( pData, ui16 );
1415 DBG1(DD_OC,
"DATA ERROR: DSI tableIdExtension = %x", ui16)
1420 SET_POS_REL( pData, 3 );
1424 READ_UINT8( pData, ui8 );
1427 DBG1(DD_OC,
"DATA ERROR: protocolDescriminator = %x", ui8)
1433 READ_UINT8( pData, ui8 );
1436 DBG1(DD_OC,
"DATA ERROR: DSI dsmccType = %x", ui8)
1442 READ_UINT16( pData, ui16 );
1443 if (ui16 != DSI_MSG_ID)
1445 DBG1(DD_OC,
"DATA ERROR: DSI messageID = %x", ui16)
1451 READ_UINT32( pData, *pTransactionId );
1452 if ((*pTransactionId & TRANSACTION_ID_ORIG_MASK) != 0x80000000)
1454 DBG1(DD_OC,
"DATA ERROR: DSI transactionId (originator (bits 31-30) != 10B) = %x", *pTransactionId)
1458 if ((*pTransactionId & TRANSACTION_ID_IDENT_MASK) != 0x00000000)
1460 DBG1(DD_OC,
"DATA ERROR: DSI transactionId (ID (bits 15-1) != 0x0000) = %x", *pTransactionId)
1465 SET_POS_REL( pData, 1 );
1468 READ_UINT8( pData, adaptationHdrLen );
1471 READ_UINT16( pData, msglen );
1472 if (msglen < (DSI_HDR_LEN+adaptationHdrLen))
1474 DBG1(DD_OC,
"DATA ERROR: DSI messageLength (< DSI_HDR_LEN) = %u", ui16)
1477 if (adaptationHdrLen)
1480 SET_POS_REL( pData, adaptationHdrLen );
1481 msglen -= adaptationHdrLen;
1487 SET_POS_REL( pData, 20 );
1490 READ_UINT16( pData, ui16 );
1493 DBG3(DD_OC,
"DSI compatibilityDescriptorLength (!= 0) = %u", ui16)
1499 SET_POS_REL( pData, ui16 );
1502 msglen -= DSI_HDR_LEN;
1505 READ_UINT16( pData, *pPrivateDataLength );
1506 if (msglen != *pPrivateDataLength)
1508 DBG1(DD_OC,
"DATA ERROR: DSI private data len, %u, not matching msgLen = %u", *pPrivateDataLength, msglen)
1541 E_DscError err = CLDSM_OK;
1543 U32BIT transactionId;
1544 U16BIT dsiPrivateLen;
1546 dsmAssert((idp != NULL));
1547 dsmAssert((pDSISection != NULL));
1549 #if defined(DEBUG_PROCESS_DSI) && (DSM_DP_LEVEL >= 3)
1551 dsmDP3((
"processDSI(pFilterInfo = %#p boot %#p)\n", pFilterInfo, idp->pBootingCarousel));
1552 dsmDP3((
"filter.PID = %x\n", pFilterInfo->filter.PID));
1553 dsmDP3((
"filter.tableId = %x\n", pFilterInfo->filter.tableId));
1554 dsmDP3((
"filter.tableIdExt = %x\n", pFilterInfo->filter.tableIdExt));
1557 U8BIT *ptr = pDSISection;
1559 for (i = 0; i < 32; i++)
1561 dsmDP3((
"%02x ", *ptr++));
1562 if (((i + 1) % 8 == 0) && i != 31)
1569 dsmAssert((pFilterInfo != NULL));
1570 pRC = pFilterInfo->target.u.pRC;
1571 if (FALSE == LLIsObjectInList(idp->llcRootCarousels, pRC))
1573 ERRLOG(DD_OC,
"pRC=%p NOT FOUND", pRC)
1575 else if (pFilterInfo != pRC->pDsiSf || pRC->pDsiSf->status != SFA_COMMITTED)
1577 ERRLOG(DD_OC,
" mis-match filter %p %p", pFilterInfo, pRC->pDsiSf)
1579 else if (pRC->rcid != pFilterInfo->target.id)
1581 ERRLOG(DD_OC,
"DATA ERROR: Mismatch Ids rcid=%d tid=%d",
1582 pRC->rcid, pFilterInfo->target.id )
1586 DBGLOG(DD_OC,
"pRC=%p", pRC)
1588 pDSISection = ValidateDSI( pDSISection, &dsiPrivateLen, &transactionId );
1589 if (pDSISection == NULL || pRC->dsiTransactionId == transactionId)
1591 DBG4(DD_OC,
"DSI discarded p=%p t=%x",pDSISection,transactionId)
1595 DBGLOG(DD_OC,
"dsiTransactionId change: %x, %x", pRC->dsiTransactionId, transactionId)
1596 pRC->dsiTransactionId = transactionId;
1601 err = DSC_ObjCrslParseSrgInfo( idp, (
P_ObjectCarousel)pRC, pDSISection, dsiPrivateLen );
1612 err = CLDSM_ERR_INVALID_CAROUSEL_HANDLE;
1616 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: processDSI: %u\n", err)));
1620 static U8BIT* ValidateDII( U8BIT *pData, U16BIT *pMsgLength, U32BIT *pTransactionId )
1622 U16BIT ui16, msglen;
1623 U8BIT ui8, adaptationHdrLen;
1626 READ_UINT8( pData, ui8 );
1629 DBG1(DD_OC,
"DATA ERROR: DII tableId = %x", ui8)
1638 READ_UINT16( pData, ui16 );
1639 if (((ui16 & LSB12_MSK) > MAX_SECTION_LEN) ||
1640 (((ui16 & LSB12_MSK) - 9) < MIN_DII_MSG_LEN))
1642 DBG1(DD_OC,
"DATA ERROR: DII section len = %x", ui16)
1647 READ_UINT16( pData, ui16 );
1650 DBG1(DD_OC,
"DATA ERROR: DII tableIdExtension = %x", ui16)
1655 SET_POS_REL( pData, 3 );
1659 READ_UINT8( pData, ui8 );
1662 DBG1(DD_OC,
"DATA ERROR: protocolDescriminator = %x", ui8)
1667 READ_UINT8( pData, ui8 );
1670 DBG1(DD_OC,
"DATA ERROR: dsmccType = %x", ui8)
1675 READ_UINT16( pData, ui16 );
1676 if (ui16 != DII_MSG_ID)
1678 DBG1(DD_OC,
"DATA ERROR: messageID = %x", ui16)
1683 READ_UINT32( pData, *pTransactionId );
1684 if ((*pTransactionId & TRANSACTION_ID_ORIG_MASK) != 0x80000000)
1686 DBG1(DD_OC,
"DATA ERROR: DSI transactionId (originator (bits 31-30) != 10B) = %x", *pTransactionId)
1691 SET_POS_REL( pData, 1 );
1694 READ_UINT8( pData, adaptationHdrLen );
1697 READ_UINT16( pData, msglen );
1698 if (msglen < MIN_DII_MSG_BODY_LEN)
1700 DBG1(DD_OC,
"DATA ERROR: DSI messageLength (< DSI_HDR_LEN) = %u", ui16)
1705 SET_POS_REL( pData, adaptationHdrLen );
1707 *pMsgLength = msglen - adaptationHdrLen;
1730 E_DscError err = CLDSM_OK;
1731 U16BIT diiMsgDataLen;
1733 U32BIT transactionId;
1735 dsmDP3((
"processDII() pFilterInfo = %p\n", pFilterInfo));
1736 dsmAssert((idp != NULL));
1737 dsmAssert((pDIISection != NULL));
1739 if (pFilterInfo == NULL)
1741 err = CLDSM_ERR_ILLEGAL_PARAMETER;
1742 dsmDP1((
"API ERROR: No section filter reference supplied\n"));
1746 dsmAssert((pFilterInfo->target.u.pDC != NULL));
1747 pDataCarousel = pFilterInfo->target.u.pDC;
1749 pDIISection = ValidateDII( pDIISection, &diiMsgDataLen, &transactionId );
1750 if (pDIISection == NULL)
1754 else if (pFilterInfo->target.id != (transactionId & TRANSACTION_ID_IDENT_MASK))
1757 dsmDP3((
"INFO: DII filter target ID != transactionId: %u, %u\n",
1758 pFilterInfo->target.id, (transactionId & TRANSACTION_ID_IDENT_MASK)));
1760 else if (pDataCarousel != NULL)
1764 dsmAssert((pFilterInfo == pDataCarousel->pDiiSf));
1765 dsmAssert((pDataCarousel->pDiiSf->status == SFA_COMMITTED));
1768 err = DSC_DataCrslUpdate( idp, pDataCarousel, transactionId, pDIISection, diiMsgDataLen );
1771 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: processDII: %u\n", err)));
1776 static U8BIT* ValidateDDB( U8BIT *pData, U16BIT *pMsgLength, U32BIT *pTransactionId )
1778 U16BIT ui16, msglen;
1779 U8BIT ui8, adaptationHdrLen;
1782 READ_UINT8( pData, ui8 );
1785 DBG1(DD_OC,
"DATA ERROR: TableId = %x", ui8)
1794 READ_UINT16( pData, ui16 );
1795 if (((ui16 & LSB12_MSK) > MAX_SECTION_LEN) ||
1796 (((ui16 & LSB12_MSK) - 9) < MIN_DDB_MSG_LEN))
1798 DBG1(DD_OC,
"DATA ERROR: section len = %x", ui16)
1804 SET_POS_REL( pData, 5 );
1808 READ_UINT8( pData, ui8 );
1811 DBG1(DD_OC,
"DATA ERROR: protocolDescriminator = %x", ui8)
1816 READ_UINT8( pData, ui8 );
1819 DBG1(DD_OC,
"DATA ERROR: dsmccType = %x", ui8)
1824 READ_UINT16( pData, ui16 );
1825 if (ui16 != DDB_MSG_ID)
1827 DBG1(DD_OC,
"DATA ERROR: messageID = %x", ui16)
1832 READ_UINT32( pData, *pTransactionId );
1837 SET_POS_REL( pData, 1 );
1840 READ_UINT8( pData, adaptationHdrLen );
1843 READ_UINT16( pData, msglen );
1844 if (msglen < MIN_DDB_MSG_BODY_LEN)
1846 DBG1(DD_OC,
"DATA ERROR: DSI messageLength (< DSI_HDR_LEN) = %u", ui16)
1851 SET_POS_REL( pData, adaptationHdrLen );
1853 *pMsgLength = msglen - adaptationHdrLen;
1879 E_DscError err = CLDSM_OK;
1880 U32BIT transactionId;
1881 U16BIT ddbMsgDataLen;
1884 dsmAssert((idp != NULL));
1885 dsmAssert((pDDBSection != NULL));
1887 if (pFilterInfo == NULL)
1889 err = CLDSM_ERR_ILLEGAL_PARAMETER;
1890 dsmDP1((
"API ERROR: No section filter reference supplied\n"));
1894 dsmAssert((pFilterInfo->target.u.pModule != NULL));
1896 pDDBSection = ValidateDDB( pDDBSection, &ddbMsgDataLen, &transactionId );
1897 if (pDDBSection != NULL)
1901 GET_UINT16( pDDBSection, moduleId );
1902 if (pFilterInfo->target.id != moduleId)
1905 dsmDP3((
"INFO: DDB filter target ID != moduleId: %u, %u\n", pFilterInfo->target.id, moduleId));
1910 pModule = pFilterInfo->target.u.pModule;
1911 if (pModule != NULL && pFilterInfo == pModule->pDdbSf)
1914 dsmAssert((pFilterInfo->status == SFA_COMMITTED));
1915 err = DSC_ModuleUpdate( idp, pModule, pDDBSection, ddbMsgDataLen );
1920 dsmDP3((
"INFO: DDB discarded - moduleId: %u\n", moduleId));
1922 #ifdef ACCELERATE_CAROUSEL_LOADING
1923 err = CLDSM_ERR_MODULE_ACQUISITION_FAILURE;
1929 DEBUG_CHK( err == CLDSM_OK, dsmDP1((
"ERROR: processDDB: %u\n", err)));
1933 #ifdef ACCELERATE_CAROUSEL_LOADING
1938 U8BIT *pDDBSectionIn = pDDBSection;
1939 E_DscError err = CLDSM_OK;
1940 U8BIT adaptationHdrLen;
1942 U16BIT ddbMsgDataLen;
1943 U16BIT moduleId, blockNum;
1946 U8BIT moduleVersion;
1948 BOOLEAN bStoreSection = TRUE;
1949 U16BIT msgLength = 0;
1950 U8BIT iMiddlePos = 0;
1953 ui8 += 0; ui16 += 0;
1956 dsmDP3((
"processDDB()\n"));
1957 dsmAssert((idp != NULL));
1958 dsmAssert((pDDBSection != NULL));
1968 ADV_UINT8_L2CHK( pDDBSection, ui8, ui8 == 0x3C,
1969 dsmDP2((
"DATA ERROR: DDB tableId = %x\n", ui8)),
1987 READ_UINT16( pDDBSection, msgLength );
1988 msgLength = msgLength & LSB12_MSK;
1992 SET_POS_REL( pDDBSection, 5 );
1999 ADV_UINT8_L1CHK( pDDBSection, ui8, ui8 == 0x11,
2000 dsmDP2((
"DATA ERROR: DDB protocolDescriminator = %x\n", ui8)),
2005 ADV_UINT8_L1CHK( pDDBSection, ui8, ui8 == 0x03,
2006 dsmDP2((
"DATA ERROR: DDB dsmccType = %x\n", ui8)),
2011 ADV_UINT16_L1CHK( pDDBSection, ui16, ui16 == 0x1003,
2012 dsmDP2((
"DATA ERROR: DDB messageID = %x\n", ui16)),
2018 SET_POS_REL( pDDBSection, 4 );
2021 SET_POS_REL( pDDBSection, 1 );
2024 READ_UINT8( pDDBSection, adaptationHdrLen );
2027 READ_UINT16( pDDBSection, ddbMsgLen );
2030 ddbMsgDataLen = (U16BIT)(ddbMsgLen - adaptationHdrLen);
2033 L2_DATA_CHK( ddbMsgDataLen >= MIN_DDB_MSG_BODY_LEN,
2034 dsmDP2((
"DATA ERROR: DDB messageLength (< MIN_DDB_MSG_BODY_LEN) = %x\n",
2039 SET_POS_REL( pDDBSection, adaptationHdrLen );
2045 GET_UINT16( pDDBSection, moduleId );
2048 SET_POS_REL( pDDBSection, 2 );
2051 READ_UINT8(pDDBSection, moduleVersion );
2054 SET_POS_REL(pDDBSection, 1 );
2057 READ_UINT16( pDDBSection, blockNum );
2060 iMiddlePos = accCarouselLoadingInfos.storedSectionsNB / 2;
2064 for (i = 0; i < iMiddlePos; i++)
2066 if ((prestoredSectionsTable[i].moduleID == moduleId) &&
2067 (prestoredSectionsTable[i].blockNum == blockNum))
2069 bStoreSection = FALSE;
2073 if ((prestoredSectionsTable[iMiddlePos + i].moduleID == moduleId) &&
2074 (prestoredSectionsTable[iMiddlePos + i].blockNum == blockNum))
2076 bStoreSection = FALSE;
2081 if ((prestoredSectionsTable[accCarouselLoadingInfos.storedSectionsNB - 1].moduleID == moduleId) &&
2082 (prestoredSectionsTable[accCarouselLoadingInfos.storedSectionsNB - 1].blockNum == blockNum))
2084 bStoreSection = FALSE;
2089 for (i = 0; i < accCarouselLoadingInfos.storedSectionsNB; i++)
2091 if ((prestoredSectionsTable[i].moduleID == moduleId) &&
2092 (prestoredSectionsTable[i].blockNum == blockNum))
2094 bStoreSection = FALSE;
2100 if (bStoreSection == TRUE)
2102 if (accCarouselLoadingInfos.storeWritePos >= kMAX_PRESTORED_SECTIONS)
2104 accCarouselLoadingInfos.storeWritePos = 0;
2107 prestoredSectionsTable[accCarouselLoadingInfos.storeWritePos].moduleID = moduleId;
2108 prestoredSectionsTable[accCarouselLoadingInfos.storeWritePos].blockNum = blockNum;
2111 prestoredSectionsTable[accCarouselLoadingInfos.storeWritePos].sectionSize = msgLength;
2112 memcpy(&prestoredSectionsTable[accCarouselLoadingInfos.storeWritePos].section[0], pDDBSectionIn, msgLength);
2114 accCarouselLoadingInfos.storeWritePos++;
2116 if (accCarouselLoadingInfos.storedSectionsNB < kMAX_PRESTORED_SECTIONS)
2118 accCarouselLoadingInfos.storedSectionsNB++;
2124 DEBUG_CHK( err == CLDSM_OK,
2125 dsmDP1((
"ERROR: storeSection: %u\n", err)));
2126 dsmDP3((
"exit storeSection -> rtn: %u\n", err));
2133 E_DscError err = CLDSM_OK;
2134 H_DscSFRef clDsmFilterRef;
2137 pModule pModule = NULL;
2139 U16BIT moduleCounter = 0;
2143 accCarouselLoadingInfos.storeReadPos = 0;
2144 accCarouselLoadingInfos.SectionsReinjection++;
2146 while (moduleCounter < accCarouselLoadingInfos.storedSectionsNB)
2150 if (accCarouselLoadingInfos.storeReadPos >= kMAX_PRESTORED_SECTIONS)
2152 accCarouselLoadingInfos.storeReadPos = 0;
2155 moduleId = prestoredSectionsTable[accCarouselLoadingInfos.storeReadPos].moduleID;
2157 if ((prestoredSectionsTable[accCarouselLoadingInfos.storeReadPos].injectionDone != 1) &&
2158 (requestedModuleIDList[moduleId] == kDO_INJECT))
2160 pDDBSection = &prestoredSectionsTable[accCarouselLoadingInfos.storeReadPos].section[0];
2162 pOC = LLHead( idp->llcRootCarousels );
2166 pModule = DSC_ModuleListFindById( pOC->llcOcModuleAcquires, moduleId );
2167 if (pModule != NULL)
2169 filterInfo.hCarousel = (MemHandle)pOC;
2170 filterInfo.target.u.pModule = pModule;
2171 filterInfo.target.id = prestoredSectionsTable[accCarouselLoadingInfos.storeReadPos].moduleID;
2172 filterInfo.target.kind = SFK_DDB;
2173 err = internalSysProcessPrivateSection( idp, pDDBSection, (
void *)&filterInfo);
2174 prestoredSectionsTable[accCarouselLoadingInfos.storeReadPos].injectionDone = 1;
2178 accCarouselLoadingInfos.storeReadPos++;
2182 E_DscError requestedModuleIdSet(U16BIT moduleID)
2184 if (moduleID < kMAX_MODULE_ID)
2186 if (requestedModuleIDList[moduleID] != kDO_INJECT)
2188 requestedModuleIDList[moduleID] = kDO_INJECT;
2189 GBL_NewResquetedModuleID++;
2194 E_DscError requestedModuleIdReset(U16BIT moduleID)
2196 if (moduleID < kMAX_MODULE_ID)
2198 requestedModuleIDList[moduleID] = kNOT_REQUESTED;
E_DscError CDSM_SysSetCurrService(H_DsmCoreInst instance, U16BIT original_network_id, U16BIT transport_stream_id, U16BIT service_id)
Set/notify the current service (initially and when changing it). This MUST be called initially (ie...
Header to the dataCarousel module - functions/methods for creating/destroying and managing attributes...
General include file for clDsm library internal definitions.
E_DscError CDSM_SysReset(H_DsmCoreInst instance, E_DsmRstMode mode)
Reset DSM-CC Core Layer instance. Resets conditions to the same state as after CDSM_SysCreate(ie. keeps setup parameters). In normal operation the client MUST first unsubscribe all events, close and and unload all objects and unload all carousels before calling this function. This will have also stopped/deleted all associated system resources (ie. SI queries, timers, SI change monitors, section filters). If any client transactions or system transactions are still active when clDsmReset is called the reset will not be executed and an error returned. NB. The calling environment (system side) must acknowledge stop commands for SI Queries and timers (via processSIQueryEvent, processTimerEvent) and that these may occur asynchronously (ie. after a delay). This means that there may still be some active system transactions for some time after all objects and carousels are unloaded. FORCING RESET IN ERROR CONDITIONS: If all client and system transactions are apparently completed but still returns an error (eg. because handles are unknown/lost or system resource stop requests are not acknowledged) then clDsmReset can be called with appropriate force switches to clear the error condition. Any client transaction errors must first be cleared before system transaction errors can be cleared and both force switches cannot be set at the same time. NB. Only use force switches in known error conditions. It is potentially fatal (may cause illegal memory access) to call the functions: streamEventUnsubscribe, unloadObject, unloadCarousel, processSIQueryEvent, processTimerEvent with old/stale handles after clDsmReset has been forced. CALLBACKS THAT MAY BE INITIATED DURING THIS CALL: deleteSectionFilter stopTimer stopSIQuery unsubscribeSIChange.
E_DscError siQueryProcessResult(P_DsmCoreInst idp, P_SiQuery pSiQueryRef, P_SIQueryResult pResult)
Processes and stops the specified SI Query.
Header to the loadMgr module.
Defines memory access utils to work with contiguous memory.
E_DscError CDSM_SysProcessSIQueryEvent(H_DsmCoreInst idp, H_SIQueryRef clDsmSIQueryRef, void *clDsmSIUserData, P_SIQueryResult pResult)
Notifies the result of the specified SI query (ie. a callback to startSIQueryFunc that returned SIQUE...
void CDSM_SetPrintFuncs(F_Printf errorFunc, F_Printf warnFunc, F_Printf debugFunc, F_Printf infoFunc)
Sets debug print functions for four different levels of detail. Any of these parameters can be set to...
DSM-CC functions related to PMT update (header)
Header to the linkList module - Functions/methods for managing linked lists of items created in manag...
P_RootCarousel DSC_RootCrslListFindById(P_LLControl plcCarousels, U16BIT serviceId, U32BIT couId)
Find Carousel from ID's.
E_DscError CDSM_SysProcessSIChangeEvent(H_DsmCoreInst instance, E_SIChangeEvent event, U16BIT service_id, U32BIT carousel_id)
Notify that the SI for the indicated service has changed Changes should be notified in the following ...
Header to the cacheMgr module.
void CDSM_SysSetMemoryMax(H_DsmCoreInst instance, U32BIT maxMemory)
Set maximum memory usage.
Header to the moduleDecompress module.
E_DscError DSC_UpdCrslParseGroupInfo(P_DsmCoreInst idp, P_UpdateCarousel pUC, U8BIT *pDsiPrivate, U16BIT dsiPrivateLen)
Parse DSI private data from Group Info of Update Carousel.
Header to dsmObject module - functions for managing DSM object heap.
Main API to DSM-CC core layer (provided functions and required callbacks).
E_DscError CDSM_SysProcessTimerEvent(H_DsmCoreInst instance, void *clDsmTmrUserData, E_TimerStatus status, void *timerHandle)
void CDSM_SetPrintState(U32BIT state)
Sets debug print state to select areas of debug.
E_DscError CDSM_UnloadCarousel(H_DsmCoreInst instance, H_DsmCarousel clDsmCarouselHandle, E_DsmRstMode mode)
Unload (or cancel the requested load of) a DSM-CC Object Carousel (service domain). The client MUST first unload all objects before calling this function (which implies it must also have previously closed and/or unsubscribed any events on any loaded objects). If there are any active object loads in the carousel when clDsmUnloadCarousel is called then the unload will not be executed and an error returned. If the carousel is in the process of loading and/or booting the load operation will be aborted (and the notifyCarouselLoadEventFunc callback made with status OC_LOAD_ABORTED_UNLOAD). Any carousel load request that returned a valid CDSM_CarouselHandle(ie. did not generate an error at clDsmLoadCarousel call time), must be explicitly unloaded via clDsmUnloadCarousel. This is necessary, whether the carousel was successfully loaded or the load was aborted due to timeout or error. Once unload is called for a carousel, the clDsmCarouselHandle is no longer valid and must not be used by the client/calling env. If it needs to access the carousel subsequently it must re-load it and get a new clDsmCarouselHandle value. To forcefully destroy loaded objects and/or carousels (eg. where the handles may be unknown/lost) then clDsmReset can be used with force switches. Note that this physically deletes them from the cache whereas unloading (objects or carousels) does not. CALLBACKS THAT MAY BE INITIATED DURING THIS CALL: delSectionFilterFunc stopTimerFunc stopSIQueryFunc unsubscribeSIChange notifyCarouselLoadEventFunc.
void CDSM_SetDebugState(H_DsmCoreInst dsm, U32BIT dbgMask)
Set Debug mask for core DSM.
void DSC_ModuleDeleteDcTidyUp(P_DsmCoreInst idp, P_Module pModule)
Delete module and destroy parent DC if now empty.
E_DscError CDSM_SysDestroy(H_DsmCoreInst instance, H_SiqInstance *pSiqInst, H_SfmInstance *pSfmInst)
Destroy DSM-CC Core Layer instance. De-allocates all 'static' memory used by the instance (via freeFu...
Header to dsmStreamEvent module - functions for managing DSM streamEvent.
Header to the sectionFilter module.
Header to the objectCarousel module.
Header to siQuery module - functions for managing SI queries.
void siQueryStop(P_DsmCoreInst idp, P_SiQuery pSiQueryRef)
Stops the specified SI Query. Removes from any lists it is in and destroys associated memory object...
H_DsmControl CDSM_SysGetControl(H_DsmCoreInst instance)
Get control handle from DSM instance .
Implementation of the Update Carousel module.
Header to the 'module' module - Functions/methods for creating/destroying and managing attributes of ...
eader to the clDsmUtils module.