| 1 | /* |
|---|
| 2 | DMW_PsiDatabase.h |
|---|
| 3 | |
|---|
| 4 | DST TV MW PSI Scan Module |
|---|
| 5 | |
|---|
| 6 | PSI Database management implementation |
|---|
| 7 | |
|---|
| 8 | Copyright 2006~2010 Digital STREAM Technology, Inc. |
|---|
| 9 | All Rights Reserved |
|---|
| 10 | |
|---|
| 11 | */ |
|---|
| 12 | |
|---|
| 13 | |
|---|
| 14 | #ifndef __DMW_PSI_DATABASE_H__ |
|---|
| 15 | #define __DMW_PSI_DATABASE_H__ |
|---|
| 16 | |
|---|
| 17 | |
|---|
| 18 | #include "DMW_PsiConfig.h" |
|---|
| 19 | #include "DMW_PsiTypes.h" |
|---|
| 20 | |
|---|
| 21 | #include "DMW_PsiAPI.h" |
|---|
| 22 | |
|---|
| 23 | |
|---|
| 24 | #ifdef __cplusplus |
|---|
| 25 | extern "C" { |
|---|
| 26 | #endif |
|---|
| 27 | |
|---|
| 28 | |
|---|
| 29 | #if COMMENT |
|---|
| 30 | ____Overview____(){} |
|---|
| 31 | #endif |
|---|
| 32 | |
|---|
| 33 | |
|---|
| 34 | /* |
|---|
| 35 | |
|---|
| 36 | ÀÌ ¸ðµâ¿¡¼´Â PSI DBÀÇ °¢Á¾ Å×ÀÌºí¿¡ Á¢±ÙÇÒ ¼ö ÀÖ´Â functionÀ» ±¸ÇöÇÑ´Ù. |
|---|
| 37 | |
|---|
| 38 | |
|---|
| 39 | PSI DB¿¡ Á¢±ÙÇϱâ À§Çؼ »ç¿ëÇÏ´Â mutex lock API. |
|---|
| 40 | |
|---|
| 41 | ------------- Rule ------------- |
|---|
| 42 | |
|---|
| 43 | PsiTask ¿¡¼ DB´Â ÀÚÀ¯·Ó°Ô ÀÐÀ» ¼ö ÀÖÀ½. |
|---|
| 44 | PsiTask ¿¡¼´Â Lock ÈÄ DB ¼öÁ¤ °¡´É. |
|---|
| 45 | |
|---|
| 46 | ÀÓÀÇ task¿¡¼´Â Lock ÈÄ DB Àб⠰¡´É. |
|---|
| 47 | ÀÓÀÇ task¿¡¼ DBÀÇ º¯°æÀº Àý´ë ±ÝÁö. |
|---|
| 48 | |
|---|
| 49 | --------- End of Rule --------- |
|---|
| 50 | |
|---|
| 51 | ÀÏ¹Ý Caller task¿¡¼´Â DB ³»¿ëÀ» Àбâ Àü¿¡ ¹Ýµå½Ã |
|---|
| 52 | DMW_PSI_LockDB() API¸¦ ÀÌ¿ëÇÏ¿© lock µÈ ÈÄ¿¡ Àоî¾ß ÇÑ´Ù. |
|---|
| 53 | |
|---|
| 54 | ³»ºÎ ¸ðµâ¿¡¼´Â PSIDB_LockDB() ¸¦ »ç¿ëÇØµµ µÈ´Ù. |
|---|
| 55 | |
|---|
| 56 | ÀÏ¹Ý caller task¿¡¼ Á÷Á¢ DB ³»¿ëÀ» ¼öÁ¤ÇÏ´Â °ÍÀº Àý´ë ÇØ¼´Â ¾ÈµÈ´Ù. |
|---|
| 57 | |
|---|
| 58 | */ |
|---|
| 59 | |
|---|
| 60 | |
|---|
| 61 | #if COMMENT |
|---|
| 62 | ____Get____(){} |
|---|
| 63 | #endif |
|---|
| 64 | |
|---|
| 65 | /* |
|---|
| 66 | all of these call do unlocked access. |
|---|
| 67 | so, caller should be careful to race condition. |
|---|
| 68 | */ |
|---|
| 69 | |
|---|
| 70 | MPEG_PAT *PSIDB_GetPAT(int id); |
|---|
| 71 | MPEG_PMT **PSIDB_GetPMTs(int id); |
|---|
| 72 | mgtSectionPtr_t PSIDB_GetMgt(int id); |
|---|
| 73 | xvctPtr_t PSIDB_GetVct(int id); |
|---|
| 74 | sttSectionPtr_t PSIDB_GetStt(int id); |
|---|
| 75 | eitPtr_t *PSIDB_GetEits(int id, int source_id); |
|---|
| 76 | eitPtr_t PSIDB_GetEit(int id, int source_id, int iEit); |
|---|
| 77 | |
|---|
| 78 | S_PSIM_MGT_DIGEST *PSIDB_GetMgtDigest(int id); |
|---|
| 79 | |
|---|
| 80 | |
|---|
| 81 | BOOL PSIDB_IsPmtsCompleted(int id); |
|---|
| 82 | |
|---|
| 83 | BOOL PSIDB_IsSubChScanReadyToStart(int id); |
|---|
| 84 | BOOL PSIDB_IsSubChEitsCompleted(int id, int source_id); |
|---|
| 85 | BOOL PSIDB_IsAllSubChEitsCompleted(int id, int iEit); |
|---|
| 86 | BOOL PSIDB_IsSubChEttVRequired(int id, int source_id); |
|---|
| 87 | BOOL PSIDB_IsSubChEttSlotCompleted(int id, int source_id, int iEit); |
|---|
| 88 | BOOL PSIDB_IsSubChAllEttsCompleted(int id, int source_id); |
|---|
| 89 | |
|---|
| 90 | |
|---|
| 91 | #if COMMENT |
|---|
| 92 | ____DB_Op____(){} |
|---|
| 93 | #endif |
|---|
| 94 | |
|---|
| 95 | STATUS PSIDB_AllocateChInfoNode(int id); |
|---|
| 96 | STATUS PSIDB_RemoveChInfoNode(int id); |
|---|
| 97 | |
|---|
| 98 | |
|---|
| 99 | |
|---|
| 100 | #if COMMENT |
|---|
| 101 | ____Update____(){} |
|---|
| 102 | #endif |
|---|
| 103 | |
|---|
| 104 | /* |
|---|
| 105 | all of these update API do mutex lock internally. |
|---|
| 106 | they change something in database. |
|---|
| 107 | |
|---|
| 108 | */ |
|---|
| 109 | |
|---|
| 110 | STATUS PSIDB_UpdatePAT(int id, MPEG_PAT *pat); |
|---|
| 111 | STATUS PSIDB_UpdatePMT(int id, MPEG_PMT *pmt); |
|---|
| 112 | STATUS PSIDB_UpdateMgt(int id, mgtSectionPtr_t mgt); |
|---|
| 113 | STATUS PSIDB_UpdateVct(int id, xvctPtr_t vct); |
|---|
| 114 | |
|---|
| 115 | STATUS PSIDB_UpdateStt(int id, sttSectionPtr_t stt, UINT32 tick_stt_get); |
|---|
| 116 | STATUS PSIDB_InvalidateStt(int id); |
|---|
| 117 | |
|---|
| 118 | STATUS PSIDB_UpdateRrt(int id, rrtSectionPtr_t rrt); |
|---|
| 119 | |
|---|
| 120 | STATUS PSIDB_UpdateEit(int id, eitPtr_t eit, int index); |
|---|
| 121 | STATUS PSIDB_UpdateEtt(int id, ettSectionPtr_t ett, int index); |
|---|
| 122 | |
|---|
| 123 | void PSIDB_DeleteTables(int id); |
|---|
| 124 | void PSIDB_DeleteAllTables(void); |
|---|
| 125 | |
|---|
| 126 | void PSIDB_LockDB(BOOL bLock); |
|---|
| 127 | |
|---|
| 128 | S_PSIM_CHINFO *PSIDB_GetPsiChInfo(int id); |
|---|
| 129 | S_PSIM_SUBCHINFO *PSIDB_GetPsiSubChInfo(int id, int source_id); |
|---|
| 130 | |
|---|
| 131 | void PSIDB_PrintAllTables(int id, int source_id, BOOL bDetail); |
|---|
| 132 | |
|---|
| 133 | |
|---|
| 134 | #if COMMENT |
|---|
| 135 | ____Private____(){} |
|---|
| 136 | #endif |
|---|
| 137 | |
|---|
| 138 | // do not use these functions if you don't know what it does |
|---|
| 139 | void PSIDB_FreeEtts(S_PSIM_SUBCHINFO *subchInfo, int iEit); |
|---|
| 140 | void PSIDB_FreeEitAndRelatedEtts(S_PSIM_SUBCHINFO *subchInfo, int iEit); |
|---|
| 141 | void PSIDB_FreeSubChInfo(S_PSIM_SUBCHINFO *subchInfo); |
|---|
| 142 | void PSIDB_FreeChInfo(S_PSIM_CHINFO *chInfo); |
|---|
| 143 | |
|---|
| 144 | |
|---|
| 145 | #ifdef __cplusplus |
|---|
| 146 | } /* extern "C" */ |
|---|
| 147 | #endif |
|---|
| 148 | |
|---|
| 149 | |
|---|
| 150 | #endif // __DMW_PSI_DATABASE_H__ |
|---|
| 151 | |
|---|
| 152 | |
|---|
| 153 | |
|---|