/** @file DLIB_SDDS.h @brief Type defines used for SDDS (software download data service) */ #ifndef __DLIB_SDDS_H__ #define __DLIB_SDDS_H__ #include "DHL_Types.h" //#include "DLIB_BitOp.h" #ifdef __cplusplus extern "C" { #endif #if COMMENT ____Overview____(){} #endif #if COMMENT ____Config____(){} #endif #define SUPPORT_SDDS_DST_EXTENSION 1 #if COMMENT ____Types_Base____(){} #endif #define SDDS_Table_ID_Msg 0x3B #define SDDS_Table_ID_Data 0x3C #define SDDS_Message_ID_DSI 0x1006 #define SDDS_Message_ID_DII 0x1002 #define SDDS_Message_ID_DDB 0x1003 #define SDDS_Message_ID_DC 0x1005 typedef struct { UINT8 protocolDiscriminator; UINT8 dsmccType; UINT16 messageId; UINT32 transactionId; UINT8 adaptationLength; UINT16 messageLength; //dsmccAdaptationHeaderPtr_t adaptationHeader; } sddsMessageHeader_t; typedef struct { UINT8 table_id; UINT8 section_syntax_indicator; UINT16 table_id_extension; UINT8 version_number; // not used. always 0 UINT8 current_next_indicator; // not used. always 1 UINT8 section_number; UINT8 last_section_number; } sddsSectionHeader_t; #if COMMENT ____Compat_Desc____(){} #endif /** ¾Æ·¡ µÑ ÀÌ¿ÜÀÇ °ªÀº ¿¹¾à.. */ typedef enum { eSystemHardwareDescriptor = 0x01, eSystemSoftwareDescriptor = 0x02, } compatDescriptorType; /** sdds¿¡¼­ ÇöÀç Áö¿øÇϴ ŸÀÔÀº IEEE OUI ÇÑ Á¾·ù »ÓÀÌ´Ù. */ #define compatSpecifierType_IEEE_OUI 0x01 /* µðÁöÅнºÆ®¸²Å×Å©³î·ÎÁö OUI */ #define IEEE_OUI_DST 0x001E1B /** DST¿¡¼­ Á¤ÀÇÇÑ µð½ºÅ©¸³ÅÍ. °øÀå¿¡¼­ sdds°¡ ½ÇÇàµÇ´Â °æ¿ì, ÇØ´ç ½ºÆ®¸²¿¡ ÀÌ µð½ºÅ©¸³ÅͰ¡ Á¸ÀçÇØ¾ß ÇÑ´Ù. ¹æ¼Û±¹¿¡¼­ ¼ÛÃâÇÏ´Â sdds ½ºÆ®¸²¿¡´Â ÀÌ µð½ºÅ©¸³ÅͰ¡ ¾ø¾î¾ß ÇÑ´Ù. tag ¿Í ÇѹÙÀÌÆ® µ¥ÀÌÅ͸¸À¸·Î ±¸¼ºµÈ ¾ÆÁÖ °£´ÜÇÑ µð½ºÅ©¸³ÅÍ ÀÌ´Ù. length=1. TAG (8 bit), LENGTH (8 bit), DATA (8 bit) */ #define compatSubDescFactoryLocationTag 0xF7 #define compatSubDescFactoryLocationData 0x3E typedef struct { UINT8 subDescriptorType; // ÀÌ subdescriptor ÀÇ Å¸ÀÔ. ŸÀÔ °ªÀº specifier°¡ ¾Ë¾Æ¼­ Á¤ÇÔ. UINT8 subDescriptorLength; // ¾Æ·¡ additional InformationÀÇ ¹ÙÀÌÆ® ±æÀÌ. UINT8 *additionalInformation; // specifier(Á¦Á¶»ç)°¡ ÀÓÀÇ·Î »ç¿ë ÇÒ ¼ö ÀÖ´Â ¿µ¿ª. } sddsCompatSubDesc_t; typedef struct { UINT8 descriptorType; // one of compatDescriptorType // sdds ¿¡¼­´Â system HW, system SW µÎ°¡Áö¸¸ Áö¿øÇÑ´Ù. //UINT8 descriptorLength; // descriptorType, descriptorLength (ÀÚ½Å)À» Á¦¿ÜÇÑ ¹ÙÀÌÆ® Å©±â. // parsing µÈ ÀÌÈÄ¿¡´Â º° ÀÇ¹Ì ¾øÀ¸¹Ç·Î Á¦°Å. UINT8 specifierType; // should be compatSpecifierType_IEEE_OUI UINT32 specifierData; // actually this is 24 bits OUI. UINT16 model; UINT16 version; // ¾Æ·¡ Á¤º¸´Â Á¦Á¶»ç ¸¶À½´ë·Î »ç¿ëÇÒ ¼ö ÀÖ´Â ºÎºÐÀÌ´Ù. // ÀÏ´Ü ÇÊ¿ä ÇÒ °ÍÀ¸·Î º¸À̹ǷΠparsingÀ» ÇØ ³õ¾Æ¾ß ÇÑ´Ù. // UINT8 subDescriptorCount; // ¾Æ·¡ subDescriptors °¹¼ö. sddsCompatSubDesc_t *subDescriptors; // subDescriptor array. } sddsCompatDescEntry_t; typedef struct { //UINT16 descriptorLength; // ÀÌ compat descriptor ÀÇ Àüü ¹ÙÀÌÆ® Å©±â. (ÀÚ½ÅÀº Á¦¿Ü) // parsing µÈ ÈÄ¿¡´Â ÀÌ Á¤º¸´Â º° ÀÇ¹Ì ¾øÀ¸¹Ç·Î »èÁ¦. UINT16 descriptorCount; // ¾Æ·¡ desc °¹¼ö. // sdds ±Ô°Ý¿¡ ÀÇÇØ ÃÖ´ë 2°³¸¸ Áö¿øÇÑ´Ù. ÃÖ´ë°ª:2 sddsCompatDescEntry_t desc[2]; // ÃÖ´ë 2°³ ¸¸ Áö¿øÇϹǷΠ2·Î Á¦ÇÑ. // sdds ±Ô°Ý¿¡ ÀÇÇϸé desc[0]Àº HW Á¤º¸, desc[1]Àº SW Á¤º¸ÀÌ´Ù. } sddsCompatDesc_t; #if COMMENT ____Types_Desc____(){} #endif /** @name SDDS descriptor types @{ */ #define SDDS_module_info_tag 0xB7 #define SDDS_schedule_tag 0xBA // ¾Æ·¡´Â SDDS´Â ¾Æ´ÏÁö¸¸, A/90 ¿¡¼­ Á¤ÀÇµÈ descriptor µéÀÌ´Ù. #define A90_module_link_tag 0xB4 #define A90_CRC32_tag 0xB5 #define A90_group_link_tag 0xB8 #define A90_download_tag 0xA6 #define A90_multiprotocol_encapsulation_tag 0xA7 #define A90_data_service_tag 0xA4 #define A90_PID_count_tag 0xA5 #define A90_association_tag 0x14 #if SUPPORT_SDDS_DST_EXTENSION // 100809, module info descÀÇ private data ºÎºÐÀ» descriptors list·Î ±¸¼ºÇÔ. // ÇöÀç´Â ¾Æ·¡ descriptor Çϳª¸¸ Á¸Àç. #define SDDS_DST_module_info_tag 0xC0 #endif /** @} */ #define ModuleType_BootLoader 0x01 #define ModuleType_Application 0x08 #if SUPPORT_SDDS_DST_EXTENSION /* ÀÌ ¸ðµâ(firmware)ÀÇ Å¸ÀÔ ¹× µ¿ÀÛ °¡´ÉÇÑ Hardware º¸µå ¹öÀü ¸®½ºÆ®¸¦ ³ª¿­ÇÑ´Ù. ÀÌ Å¸ÀÔÀÇ ÇʵåµéÀº ¸ðµÎ UINT8 ŸÀÔÀ̹ǷÎ, ÀÓÀÇ Æ÷ÀÎÅÍ¿¡ casting ÇØ¼­ »ç¿ë °¡´ÉÇÏ´Ù. */ typedef struct { // descriptor tag: SDDS_DST_module_info_tag (0xc0) // Æß¿þ¾î ŸÀÔ. // one of ModuleType_XXXX above.. UINT8 moduleType; UINT8 moduleName[16+1]; // parser¿¡¼­ null-term Ãß°¡ ÇÔ. UINT8 moduleVer[8+1]; // parser¿¡¼­ null-term Ãß°¡ ÇÔ. // ÀÌ Æß¿þ¾î°¡ µ¿ÀÛ °¡´ÉÇÑ Çϵå¿þ¾î ¹öÀü (¸®ºñÀü) ¸®½ºÆ®. UINT8 numSupportedHwVersions; UINT8 *supportedHwVersions; // ÇÑ ÇÁ·ÎÁ§Æ®¿¡¼­ º¸µå 20°³ Á¤µµ¸é ÃæºÐÇÒ µí.. // // HW ¹öÀü ÇÒ´çÀº º¸Åë ³ª¿Â ¼ø¼­´ë·Î ¸í·ÉÀ» ÇÑ´Ù. // º¸ÅëÀº 00 prototype, 01:ES 02:DS 03:PP 04:MP ¼ø¼­°¡ µÈ´Ù. // ÆÄ»ý ¸ðµ¨ÀÌ ¸¹Àºµ¥ (¿¹: tuner dual vendor, flash size variation..) // ¸ðµ¨ ºÐ±â¸¦ ÇÏÁö ¾Ê°í HW ¹öÀü ¸¸À¸·Î ¼­·Î °øÀ¯ÇÒ ¼ö ÀÖ´Ù. UINT32 fileCRC32; } sddsDstModuleInfoDesc_t; #endif // SUPPORT_SDDS_DST_EXTENSION /** ¸ðµâ Á¤º¸ µð½ºÅ©¸³ÅÍ sdds¿¡¼­´Â DIIÀÇ moduleInfoLength ´ÙÀ½ÀÇ µð½ºÅ©¸³ÅÍ ¸®½ºÆ®¿¡ Æ÷ÇԵȴÙ. ¸ðµâ »ó¼¼ Á¤º¸¸¦ Ç¥ÇöÇÒ ¼ö ÀÖ´Ù. */ typedef struct { // tag: SDDS_module_info_tag 0xB7 UINT8 encoding; UINT8 nameLength; UINT8 *nameBytes; // UTF-8 format. // parser¿¡¼­´Â null-terminateµÉ ¼ö ÀÖµµ·Ï Ãß°¡ °ø°£ È®º¸ÇØ µÐ´Ù. UINT8 signatureType; UINT8 signatureLength; UINT8 *signatureBytes; // parser¿¡¼­´Â null-terminateµÉ ¼ö ÀÖµµ·Ï Ãß°¡ °ø°£ È®º¸ÇØ µÐ´Ù. UINT8 privateModuleLength; UINT8 *privateModuleBytes; #if SUPPORT_SDDS_DST_EXTENSION // dst Á¦Ç°¿¡¼­´Â privateModuleBytes ´Â °¢ firmwareÀÇ »ó¼¼ Á¤º¸Àε¥, // sddsDstModuleInfoDesc_t ŸÀÔÀ» Ȱ¿ëÇÑ´Ù. // privateModule Á¤º¸ Áß¿¡¼­ ¾Æ·¡ Á¤º¸´Â º°µµ·Î ÃßÃâÇØ ³õµµ·Ï ÇÑ´Ù. // Âü°í·Î ÀÌ ¾ÈÀÇ Æ÷ÀÎÅÍ´Â malloc µÈ °ÍÀº ¾Æ´Ï°í privateModuleBytes ³»ÀÇ À§Ä¡ Æ÷ÀÎÅÍÀÓ. // ¾îÂ÷ÇÇ memChainÀ¸·Î °ü¸®ÇÒ °ÍÀ̹ǷΠÇԺηΠfree ÇÏÁö¸¸ ¾Ê´Â´Ù¸é ¹®Á¦µÇÁö´Â ¾ÊÀ½. // sddsDstModuleInfoDesc_t dstinfo; #endif } sddsModuleInfoDesc_t; /** ½ºÄÉÁÙ µð½ºÅ©¸³ÅÍ */ typedef struct { UINT32 startTime; // ´Ù¿î·Îµå °¡´ÉÇÑ window ½ÃÀÛ ½Ã°£. UINT32 lengthInSeconds; // 20 bit ±æÀÌ´Ù. ÃÖ´ë Ç¥Çö °¡´É ½Ã°£Àº ~291 hour = ~12 days } sddsScheduleEntry_t; typedef struct { // tag: SDDS_schedule_tag 0xBA // ½ºÄÉÁÙ Á¤º¸´Â Çϳª ÀÌ»óÀ» Àü´Þ ÇÒ ¼ö ÀÖÀ½. UINT8 numSchedules; sddsScheduleEntry_t *schedules; } sddsScheduleDesc_t; #if COMMENT ____Types_DSI____(){} #endif /** dsi ¸Þ½ÃÁöÀÇ groupInfoIndication ¿¡ ÇØ´çµÇ´Â ºÎºÐ */ typedef struct { UINT32 groupId; // ÀÌ id´Â dii ¸Þ½ÃÁöÀÇ transactionId¿Í ÀÏÄ¡ÇÑ´Ù. UINT32 groupSize; // ÀÌ ±×·ì¿¡ ¼ÓÇÏ´Â ¸ðµç ¸ðµâµéÀÇ Å©±â ÃÑ ÇÕ. sddsCompatDesc_t compat; // ÀÌ ±×·ìÀÇ compatibility. // sdds ±Ô°Ý¿¡ ÀÇÇϸé ÃÖ¼ÒÇÑ ÇѰ³ÀÇ compat Á¤º¸¸¦ Æ÷ÇÔÇØ¾ß ÇÑ´Ù. UINT16 groupInfoLength; UINT8 *groupDescriptors; // ÀÌ ±×·ì¿¡ ÇØ´çµÇ´Â Á¤º¸¸¦ Àü´ÞÇϴµ¥, // sdds¿¡¼­´Â ¿©±â¿¡ schedule descriptor°¡ Àü´Þ µÈ´Ù. sddsScheduleDesc_t scheduleDescriptor; // Ưº°È÷ schedule descriptor¿¡ ÇÑÁ¤ÇÏ¿©, µû·Î parsingÀ» ÇØ ³õ´Â´Ù. // ÀÏ¹Ý ´Ù¸¥ descriptor´Â ÇÊ¿äÇÑ °æ¿ì¿¡ ÇÑÇÏ¿© client°¡ parsing. // schedule descriptor°¡ Á¸ÀçÇÏÁö ¾Ê´Â °æ¿ì´Â ³»ºÎÀÇ numSchedule ÀÌ 0ÀÌ´Ù.. } sddsDsiGroup_t; /** download server initiate */ typedef struct { BOOL section_syntax_indicator; // TRUE if CRC32 used, FALSE if checksum used. UINT32 transactionId; //UINT16 messageLength; // client will not want this info // server id ºÎÅÍ crc Á÷Àü±îÁöÀÇ ±æÀÌ. //UINT8 serverId[20]; // fixed value. don't keep here. // Ç×»ó °íÁ¤µÈ 0xff ÆÐÅÏÀ» °¡Áö¹Ç·Î, ÀúÀåÇÒ Çʿ䰡 ¾ø´Ù. »èÁ¦. sddsCompatDesc_t compat; // A/91 ±Ô°Ý¿¡ ÀÇÇϸé dsiÀÇ top-level compatÀº ¾ø´Ù°í ÇÔ. // compat.descriptorCount °¡ 0ÀÏ °ÍÀÓ. // UINT16 privateDataLength; // ¾Æ·¡ group info indication Á¤º¸ÀÇ ¹ÙÀÌÆ® ±æÀ̸¦ ÀǹÌ. // checksum Á÷ Àü±îÁöÀÇ ±æÀÌ´Ù. // ÆÄ½Ì µÈ ÀÌÈÄ¿¡´Â ÀÇ¹Ì ¾øÀ¸¹Ç·Î »èÁ¦ÇÔ. UINT16 numberOfGroups; // ¾Æ·¡ groups ¹è¿­ÀÇ ¿ä¼Ò °¹¼ö. sddsDsiGroup_t *groups; // group ¹è¿­ Æ÷ÀÎÅÍ. UINT16 groupInfoPrivateDataLength; // ¾Æ·¡ groupInfoPrivateDataBytesÀÇ ±æÀÌ. UINT8 *groupInfoPrivateDataBytes; UINT32 checksum_CRC32; } sddsDsi_t, *sddsDsiPtr_t; #if COMMENT ____Types_DII____(){} #endif typedef struct { UINT16 moduleId; // 0x0000 ºÎÅÍ 0xFFEF »çÀÌÀÇ unique id °ª. UINT32 moduleSize; // ¸ðµâÀÇ ¹ÙÀÌÆ® ´ÜÀ§ Å©±â. // ÀÌ ¸ðµâ¿¡ ¼ÓÇÏ´Â ¸ðµç DDB ¸Þ½ÃÁöÀÇ payload ÇÕÀÌ´Ù. (Çì´õ, crc µîÀÇ Á¤º¸ Á¦¿Ü) // 0ÀÌ¸é ¸ðµâ Å©±â°¡ ¹Ì¸® Á¤ÇØÁöÁö ¾Ê¾Ò´Ù´Â ÀǹÌÀ̸ç, streaming¿¡ »ç¿ëµÈ´Ù. UINT8 moduleVersion; // ½ÇÁ¦ ÆÄÀÏÀÇ ¹öÀü Á¤º¸¸¦ Ç¥½ÃÇϱ⿡´Â ÃæºÐÄ¡ ¾ÊÀ¸¹Ç·Î »ç¿ëÇÏÁö ¾Ê´Â´Ù. UINT8 moduleInfoLength; // ¾Æ·¡ descriptor listÀÇ ¹ÙÀÌÆ® Å©±â. UINT8 *moduleDescriptors; // A/91¿¡ µû¸£¸é moduleId°¡ 0x0000~0xFFEF ÀÎ °æ¿ì¿¡´Â // ´ÙÀ½ µð½ºÅ©¸³Å͵éÀÌ ¿Ã ¼ö ÀÖ´Ù. // module_link_desc, CRC32_desc, .. // A/97 ¿¡¼­´Â Ãß°¡·Î sddsModuleInfoDesc_t ¸¦ Á¤ÀÇÇϰí ÀÖ´Ù. sddsModuleInfoDesc_t *moduleInfoDesc; // ÆíÀǸ¦ À§Çؼ­ À§ÀÇ moduleDescriptors Áß¿¡¼­ // moduleInfoDescriptor ÇϳªÀÇ Á¤º¸¸¦ parsing ÇØ¼­ º°µµÀÇ Æ÷ÀÎÅÍ·Î ÁغñÇØ ³õ´Â´Ù. // // !!!! ÁÖÀÇ !!!! // ÀÌ Æ÷ÀÎÅÍ ¿ª½Ã sddsDiiModule_tÀÇ memChain¿¡ ¿¬°áµÇ¾î ÀÖ´Ù. // ÇԺηΠpointer¸¦ ¶¼¾î¼­ °¡Á®°¡°Å³ª free ½ÃŰ¸é ¾ÈµÈ´Ù. } sddsDiiModule_t; /** download info indication */ typedef struct { /* table ID is 0x3B fixed. do not keep here. */ BOOL section_syntax_indicator; // TRUE if CRC32 used, FALSE if checksum used. UINT32 transactionId; // dsi ¸Þ½ÃÁöÀÇ groupId¿Í ÀÏÄ¡ÇÑ´Ù. //UINT16 messageLength; // ÆÄ½Ì µÈ ÀÌÈÄ¿¡´Â ÀÌ Á¤º¸´Â º°·Î ÇÊ¿ä ¾ø´Ù. »èÁ¦. UINT32 downloadId; // == carousel_id UINT16 blockSize; // typical value: 4066 sddsCompatDesc_t compat; // A/91 ¿¡¼­´Â ÀÌ descriptor´Â »ç¿ëÇÏÁö ¾Ê´Â´Ù°í ÇÑ´Ù. UINT16 numberOfModules; sddsDiiModule_t *modules; UINT16 privateDataLength; UINT8 *privateDataBytes; // »ç¿ëÀÚ private data. UINT32 checksum_CRC32; } sddsDii_t, *sddsDiiPtr_t; #if COMMENT ____Types_DDB____(){} #endif /** ÁÖÀÇ »çÇ×. DDB´Â section size°¡ °ÅÀÇ ÃÖ´ë Å©±âÀε¥ (~4096) ÀÌ payload¸¦ À§ÇÑ ¸Þ¸ð¸® mallocÀº ÇÏÁö ¾Ê°í, parser´Â ±×³É psi section buffer ³»ÀÇ Æ÷ÀÎÅ͸¸ keepÇØ ³õ´Â´Ù. client´Â parsing ÈÄ¿¡ tDHL_PSI_DataArray¸¦ Free Çϱâ Àü¿¡ ÇÊ¿äÇÑ Á¤º¸¸¦ ó¸® ÇØ¾ß ÇÑ´Ù. */ /** data download block */ typedef struct { /* table ID is 0x3B fixed. do not keep here. */ BOOL section_syntax_indicator; // TRUE if CRC32 used, FALSE if checksum used. // table_id_extension // ¼½¼Ç Çì´õÀÇ table_id_extensionÀº ÀϹÝÀûÀÎ °æ¿ì¿Í ´Ù¸£°Ô, downloadId°¡ ¾Æ´Ñ, moduleId °ªÀ» °®´Â´Ù. // ¼½¼Ç Çì´õÀÇ versionÀº moduleVersionÀÇ LSB 5 ºñÆ® °ªÀ» °®´Â´Ù. // ¼½¼Ç Çì´õÀÇ section_number´Â blockNumberÀÇ ÇÏÀ§ 1¹ÙÀÌÆ® ÀÌ´Ù. // ÀÌ °ªµéÀº ´Ù¸¥ Çʵå·ÎºÎÅÍ ÃßÃâÀÌ °¡´ÉÇϹǷΠº°µµ·Î keep ÇÏÁö´Â ¾Ê´Â´Ù. // version_number // moduleVersion ÀÇ ÇÏÀ§ 5ºñÆ®¿Í °ªÀÌ µ¿ÀÏÇÏ´Ù. // section_number // section_number´Â blockNumberÀÇ LSB 8-bits¿Í µ¿ÀÏÇÏ´Ù. UINT32 downloadId; // sddsÀÇ °æ¿ì carousel id ¿Í µ¿ÀÏÇÏ´Ù. //UINT8 adaptationLength; // PTS°¡ Æ÷ÇÔµÈ µ¥ÀÌÅÍ ºí·°ÀÌ ±Ô°Ý »ó °¡´ÉÇѰ¡?? // ÀÏ´Ü °í·ÁÇÏÁö ¾Ê´Â´Ù. // ÇÏÁö¸¸ parser´Â adaptionLength°¡ ÀÖÀ» °æ¿ì ÀûÀýÇÏ°Ô skipÇϵµ·Ï ÇØ¾ß ÇÔ. //UINT16 messageLength; // ÆÄ½Ì µÈ ÀÌÈÄ¿¡´Â ÀÌ Á¤º¸´Â º°·Î ÇÊ¿ä ¾ø´Ù. »èÁ¦. UINT16 moduleId; // ÀÌ ºí·°ÀÌ ¼ÓÇÑ ¸ðµâ id. UINT8 moduleVersion; UINT16 blockNumber; // 0 ºÎÅÍ ½ÃÀÛÇÏ´Â block index. UINT8 *blockDataBytePtr; // ÀÌ Æ÷ÀÎÅÍ´Â mallocÀ¸·Î ÇÒ´ç ¹ÞÀº °ÍÀÌ ¾Æ´Ô. UINT16 blockDataLength; // ÀÌ °ªÀº messageLength °ªÀ¸·ÎºÎÅÍ °è»ê µÈ °ªÀÌ´Ù. UINT32 checksum_CRC32; } sddsDdb_t, *sddsDdbPtr_t; #ifdef __cplusplus } /* extern "C" */ #endif #endif /* __DLIB_SDDS_H__ */