1 2 3 #include <stdlib.h> 4 #include <string.h> 5 #include "MsCommon.h" 6 7 #include "nsk_dbg.h" 8 #include "nsk2hdi_header.h" 9 #include "apiDMX.h" 10 11 /*****************************************************************************\ 12 \Definitions 13 \*****************************************************************************/ 14 15 16 /*****************************************************************************\ 17 \ global variables 18 \*****************************************************************************/ 19 static P_NSK2_CbAllocateMemory _AllocateMemory = NULL; 20 static P_NSK2_CbFreeMemory _FreeMemory = NULL; 21 static P_NSK2_CbEcmGetType _EcmGetType = NULL; 22 static MS_BOOL _bRunHarmonizer = FALSE; 23 24 /*****************************************************************************\ 25 \ NSK2HDI general functions 26 \*****************************************************************************/ 27 MApi_NSK2HDI_Initial(HDIPara_Init_t * pInit)28MS_U32 MApi_NSK2HDI_Initial(HDIPara_Init_t *pInit) 29 { 30 _bRunHarmonizer = pInit->bHarmonizer; 31 _AllocateMemory = pInit->cbAllocMemory; 32 _EcmGetType = pInit->cbEcmGetType; 33 _FreeMemory = pInit->cbFreeMemory; 34 return TRUE; 35 } 36 37 MApi_NSK2_IsHarmonizer(void)38MS_BOOL MApi_NSK2_IsHarmonizer(void) 39 { 40 return _bRunHarmonizer; 41 } 42 MApi_NSK2_AllocateMemory(MS_U32 u32Size,MS_BOOL bCached)43void *MApi_NSK2_AllocateMemory(MS_U32 u32Size, MS_BOOL bCached) 44 { 45 if( _AllocateMemory != NULL) 46 { 47 void *pBuf = NULL; 48 pBuf = _AllocateMemory( u32Size, bCached); 49 50 if(pBuf == NULL) 51 { 52 printf("memory allocate fail\n"); 53 } 54 return pBuf; 55 } 56 else 57 { 58 return NULL; 59 } 60 61 } 62 MApi_NSK2_FreeMemory(void * pAddress,MS_BOOL bCached)63MS_BOOL MApi_NSK2_FreeMemory(void *pAddress, MS_BOOL bCached) 64 { 65 if( _FreeMemory != NULL) 66 { 67 return _FreeMemory(pAddress,bCached); 68 } 69 else 70 { 71 return FALSE; 72 } 73 } 74 MApi_NSK2_EcmGetFilterType(MS_U32 x_conn)75MS_U32 MApi_NSK2_EcmGetFilterType(MS_U32 x_conn) 76 { 77 return _EcmGetType(x_conn); 78 } 79 80 81 MApi_NSK2_DTV_ClosePidNo(MS_U8 PidNo)82MS_BOOL MApi_NSK2_DTV_ClosePidNo(MS_U8 PidNo) 83 { 84 if( MApi_DMX_Stop(PidNo) != DMX_FILTER_STATUS_OK) 85 { 86 NSK_ERROR(("DMX Stop error\n")); 87 } 88 89 if( MApi_DMX_Close(PidNo) != DMX_FILTER_STATUS_OK) 90 { 91 NSK_ERROR(("DMX Close error\n")); 92 } 93 return TRUE; 94 } 95 96