DSMCC  15.3.1
source/dscore/src/module.h
Go to the documentation of this file.
00001 /*******************************************************************************
00002  * Copyright © 2014 The DTVKit Open Software Foundation Ltd (www.dtvkit.org)
00003  * Copyright © 2004 Ocean Blue Software Ltd
00004  * Copyright © 2001 Koninklijke Philips Electronics N.V
00005  *
00006  * This file is part of a DTVKit Software Component
00007  * You are permitted to copy, modify or distribute this file subject to the terms
00008  * of the DTVKit 1.0 Licence which can be found in licence.txt or at www.dtvkit.org
00009  * 
00010  * THIS CODE AND INFORMATION ARE PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND,
00011  * EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES
00012  * OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
00013  * 
00014  * If you or your organisation is not a member of DTVKit then you have access
00015  * to this source code outside of the terms of the licence agreement
00016  * and you are expected to delete this and any associated files immediately.
00017  * Further information on DTVKit, membership and terms can be found at www.dtvkit.org
00018  *******************************************************************************/
00026 #ifndef _MODULE_H_
00027 #define _MODULE_H_
00028 
00029 
00030 /*--------------------------------  Includes  --------------------------------*/
00031 #include "clDsmSystem.h"
00032 
00033 #include "linkList.h"
00034 #include "sectionFilter.h"
00035 
00036 #ifdef __cplusplus
00037 extern "C" {
00038 #endif
00039 
00040 
00041 /*-----------------------------  Exported Macros  ----------------------------*/
00042 
00043 
00044 /*------------------------------  Exported Types  ----------------------------*/
00045 
00046 /* -- NB. This is only here to allow debug checking of size from clDsmMain */
00047 typedef struct {
00048     U16BIT    numBlocks;
00049     U16BIT    blocksRqd;
00050     U32BIT    downloadSize;
00051     U16BIT    blockSize;
00052     U8BIT     blockRcvdRegister[(MAX_BLOCKS_IN_MODULE + 7)/8]; /* -- round up */
00053     MemHandle hModuleData;
00054 } ModuleBuilder_t, *pModuleBuilder_t;
00055 
00056 
00057 typedef enum {
00058     MS_INITIAL,         /* -- transient state */
00059     MS_PENDING_INFO,    /* -- waiting for DII info */
00060     MS_PENDING_DDB,     /* -- DII info available, waiting for first DDB */
00061     MS_BUILDING,        /* -- first DDB received */
00062     MS_CACHED,          /* -- module complete (compressed or decompressed) */
00063     MS_ACQ_FAILED,      /* -- acquisition failed due to decompress failure
00064                            -- (transient state)*/
00065     MS_ACQ_ABORTED,     /* -- acquisition aborted due to multiple decompress
00066                            -- failures */
00067     MS_EXPIRED          /* -- module stale (out of date) but still in use (ie.
00068                            -- has loaded object(s)) */
00069 } ModuleStatus_t;
00070 
00071 
00072 /* -- Default = UK MHEG profile 1 settings */
00073 typedef struct {
00074   U32BIT              moduleTimeout;
00075   U32BIT              blockTimeout;
00076   U32BIT              minBlockTime;
00077   ObjectTap_t         tap;
00078   /* MHP only requires following */
00079   BOOLEAN             compressed;
00080   U32BIT              originalSize;
00081 } ModuleInfoProfile_t, *pModuleInfoProfile_t;
00082 
00083 
00084 typedef struct {
00085     U16BIT              moduleId;
00086     U16BIT              blockSize;
00087 #ifndef NDEBUG
00088     U32BIT              blkRcvd;
00089 #endif
00090     U32BIT              moduleSize;
00091     ModuleInfoProfile_t profileInfo;
00092     U8BIT               version;
00093     U8BIT               priority;
00094     U8BIT               transparency;
00095 } ModuleInfo_t, *pModuleInfo_t;
00096 
00097 
00098 typedef struct s_Module {
00099     S_LLObject          llData[NUM_LISTS_MODULE];
00100     ModuleInfo_t        moduleInfo;
00101     ModuleStatus_t      status;
00102 
00103     /* -- DDB filter info */
00104     pSectionFilterInfo_t  pDdbSf;
00105 
00106     U16BIT              currentUseCount;            /* -- Limited by design */
00107     U16BIT              decompressFailureCount;     /* -- Limited by MAX_MODULE_DECOMPRESS_FAILURES */
00108 
00109     U16BIT              openCount;                  /* -- Limited by NUM_OPEN_DSM_OBJECTS_MAX */
00110 
00111     U32BIT              loadedCount;                /* -- Limited only by memory */
00112     U32BIT              clientRequestCount;         /* -- Limited only by memory */
00113 
00114     /* -- NOT CURRENTLY USED - Intended for making more intelligent
00115        -- decisions on whether to cache decompressed or not */
00116     U32BIT              numDirObjs;
00117 
00118     /* -- NB. Module inherits 'highest priority' caching rules of
00119        -- any object loaded from the module */
00120     clDsmCachingRules_t cachingRules;
00121 
00122     MemHandle           hModuleBuilder;
00123     MemHandle           hCompModuleData;
00124     MemHandle           hModuleData;
00125 
00126     P_LLControl         llcLoadRequests;
00127 } Module_t;
00128 
00129 
00130 /*------------------------------  Exported Data  -----------------------------*/
00131 
00132 
00133 /*---------------------------  Exported Prototypes  --------------------------*/
00134 #ifdef DSM_NO_MEM_CONTEXT
00135 #define moduleUse( x, a )                   moduleUse( a )
00136 #define moduleUnUse( x, a )                 moduleUnUse( a )
00137 #endif
00138 
00139 
00140 clDsmErr_t moduleCreate( pclDsmInstData_t idp,
00141                     U16BIT moduleId, MemHandle *phModule );
00142 
00143 void       moduleDestroy( pclDsmInstData_t idp, MemHandle *phModule );
00144 
00145 void       moduleUse( DSM_CONTEXT_DEFN, MemHandle hModule );
00146 
00147 void       moduleUnUse( DSM_CONTEXT_DEFN, MemHandle hModule );
00148 
00149 void       moduleResetState( pclDsmInstData_t idp,
00150                     pModule_t pModule, ModuleStatus_t reqdState );
00151 
00152 clDsmErr_t moduleBuild( pclDsmInstData_t idp,
00153                     MemHandle hModule, U8BIT* pDDBMsgPayload,
00154                     U16BIT ddbMsgPayloadLen, BOOLEAN *pCompleted );
00155 
00156 /* Generic module list functions */
00157 MemHandle moduleListFindById( P_LLControl pModuleList, U16BIT moduleId );
00158 
00159 
00160 /*----------------------------------------------------------------------------*/
00161 #ifdef __cplusplus
00162 }
00163 #endif
00164 #endif /* _MODULE_H_ */
 All Data Structures Files Functions Typedefs