kb_porting.c
上传用户:fy98168
上传日期:2015-06-26
资源大小:13771k
文件大小:10k
- /******************************************************************************
- *
- * FileName :kb_porting.c
- * FileDesc :
- *
- ******************************************************************************/
- //-----------------------------------------------------------------------------
- // Standard include files:
- //-----------------------------------------------------------------------------
- //
- #include <stdio.h>
- #include <stdarg.h>
- #include <string.h>
- //-----------------------------------------------------------------------------
- // Project include files:
- //-----------------------------------------------------------------------------
- //
- #include <stdlib.h>
- #include <stdio.h>
- #include "Gendef.h"
- #include "appltype.h"
- #include "osp.h"
- #include "sti5105.h"
- #include "Dmd.h"
- #include "Dmx.h"
- #include "Timer.h"
- #include "Avplay.h"
- #include "db.h"
- #include "Timer.h"
- #include "Pub_st.h"
- #include "Cas21.h"
- #include "kb_ota.h"
- #include "Osd.h"
- #include "kb_machblue_client.h"
- #include "kb_machblue_client_task.h"
- #include "kb_porting.h"
-
- /***************************************************
- 函数名:unsigned int BCDtoINT(unsigned char BCD)
- 功 能:转换一个字节BCD码到int
- 入 口:BCD码
- 出 口:
- ***************************************************/
- unsigned int BCDtoINT(unsigned char BCD)
- {
- //旧代码:return ((BCD>>4)&0x0f*10+BCD&0x0f);
- //修改后代码:---HsuJijun 1999/7/9
- return (((int)((BCD>>4)&0x0f))*10)+(int)(BCD&0x0f);
- }
- /******************************************************************************
- Function name: SetReceive
- Description: 关闭/打开遥控器接收功能
- Input: flag: 0,close ir;
- 1,open ir
- Output: None
- Return: None
- ******************************************************************************/
- void KB_KEY_SetReceive (int flag)
- {
- if(flag == 0 )
- KB_IR_SetKeyLock(True);
- else if(flag == 1 )
- KB_IR_SetKeyLock(False);
- }
- /******************************************************************************
- Function name: KB_AV_PlayStart
- Description: 打开当前AV
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void KB_AV_PlayStart (void)
- {
- KB_DTVRun();
- }
- /******************************************************************************
- Function name: KB_AV_PlayStop
- Description: 关闭当前AV
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void KB_AV_PlayStop (void)
- {
- KB_DTVStop();
- }
- /******************************************************************************
- Function name: DTV_EPG_SetToLastProg
- Description: 切到当前正在播出的节目中
- Input: None
- Output: None
- Return: 0: error
- 1: ok
- ******************************************************************************/
- int DTV_EPG_SetToLastProg (void)
- {
- KB_DTVPlayCurPrg();
- return 1;
- }
- /******************************************************************************
- Function name: DTV_EPG_StopLastProg
- Description: 停止当前节目播放
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void DTV_EPG_StopLastProg (void)
- {
- KB_DTVStopAV();
- }
- /******************************************************************************
- Function name: KB_Timer_Start
- Description: 启动定时器
- Input: timerId
- ms
- Output: None
- Return: 0: error
- 1: ok
- ******************************************************************************/
- INT32 KB_Timer_Start(UINT32 timerId, UINT32 ms)
- {
- return KB_TimerEnable( timerId, ms);
-
- }
- /******************************************************************************
- Function name: KB_Timer_Stop
- Description: 停止定时器
- Input: timerId
- ms
- Output: None
- Return: 0: error
- 1: ok
- ******************************************************************************/
- INT32 KB_Timer_Stop(UINT32 timerId)
- {
- return KB_TimerDisable( timerId);
- }
- /******************************************************************************
- Function name: KB_OSA_Free
- Description: free memeory
- Input: pFree: memory to free
- Output: None
- Return: Ret_Fail: error
- Ret_OK: ok
- ******************************************************************************/
- KB_OSPRet KB_OSA_Free(void *pFree)
- {
- return KB_OSPFree(pFree);
- }
- /******************************************************************************
- Function name: KB_CHN_SetQam
- Description: 通过频道参数锁定频道
- Input: lfrequency
- i_lsymbol_rate
- i_nModulateMode
- Output: None
- Return: 成功--SOD_OK;失败--SOD_ERROR
- ******************************************************************************/
- int KB_CHN_SetQam(unsigned long i_lfrequency, unsigned long i_lsymbol_rate, unsigned char i_nModulateMode)
- {
- KB_DMDTunerParameters tTs;
- tTs.type = DMD_TYPE_QAM;
- tTs.inversion = INVERSION_AUTO;
- tTs.frequency = i_lfrequency / 1000;
- tTs.details.qam.symbolRatekSs = i_lsymbol_rate / 1000;
- tTs.details.qam.modulation = i_nModulateMode;
-
- KB_DMDDropSignal();
- KB_DMDConnectSignal(&tTs);
- KB_OSPTaskDelay(1000);
- if(KB_DMDQuerySignalStatus())
- return 0;
- else
- return -1;
- }
- /******************************************************************************
- Function name: KB_QAM_Stop()
- Description: stop current Qam
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void KB_QAM_Stop (void)
- {
- KB_DMDDropSignal();
- }
- /******************************************************************************
- Function name: GetCurCHNTsID
- Description: 取得当前TSID
- Input: flag: 0,close ir;
- 1,open ir
- Output: None
- Return: 当前tsid
- ******************************************************************************/
- UINT16 KB_GetCurCHNTsID(void)
- {
- UINT16 pTsID,pServID;
-
- if(KB_DTVGetCurPrgInfo(&pTsID, &pServID)==TRUE)
- {
- printf("n KB_GetCurCHNTsID=%x", pTsID);
- return (UINT16)pTsID;
- }
- return 0xffff;
- }
- /******************************************************************************
- Function name: KB_GetDTVCHN_Freq
- Description: 返回当前频点
- Input: tsid -输入ts_id
- Basefre -基本频道分组
- Output: None
- Return: 当前频点
- ******************************************************************************/
- unsigned long KB_GetDTVCHN_Freq (unsigned short tsid)
- {
- unsigned short pFreq;
- unsigned short pSymbl;
- unsigned char pQam;
-
- if(KB_DBGetChnlInfoByTsID( tsid, &pFreq, &pSymbl, &pQam)==RET_OK)
- {
- printf("rn KB_GetDTVCHN_Info:tsid = %x, pFreq=%x ,pSymbl=%x , pQam =%x ", tsid, pFreq, pSymbl, pQam);
- return (unsigned long)pFreq;
- }
- return 0;
- }
- /******************************************************************************
- Function name: KB_OSD_ClearAll
- Description: 清除整个屏幕
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- int KB_OSD_ClearAll(UINT nColor)
- {
- return 0;
- }
- /******************************************************************************
- Function name: KB_PF_Clear
- Description: 清除当前后续界面
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- int KB_PF_DispClear(void)
- {
- return 0;
- }
- /******************************************************************************
- Function name: KB_PgList_DispClear
- Description: 清除频道列表界面
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- int KB_PgList_DispClear(void)
- {
- return 0;
- }
- /******************************************************************************
- Function name: KB_CurMovie_DispClear
- Description: 清除当前界面
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void KB_CurMovie_DispClear(void)
- {
- kb_machblue_movie_close(TRUE);
- }
- /******************************************************************************
- Function name: KB_GetRegion_Code
- Description: 取得智能卡中的区域号
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- unsigned long KB_GetRegion_Code(void)
- {
- WORD wTVSID;
- int index,i,j;
- WORD status;
- WORD g_tvsid[TFCA_MAXLEN_OPERATOR] = {1};
- ULONG pACArray[TFCA_MAXLEN_ACLIST];
- OSA_wait(3000);
- //得到运营商id列表
- status = TFCASTB_GetOperatorIds(g_tvsid);
- for(index=0; index<4; index++)
- {
-
- wTVSID = g_tvsid[0];
- status = TFCASTB_GetACList(wTVSID, pACArray);
- printf("rn 1BQ_CA_SetACInfo(): status = %ld, pACArray: %ld %ld %ld rn", status, pACArray[0], pACArray[1], pACArray[2]);
- if(pACArray[0]!=0)
- break;
-
- }
-
- return pACArray[0];
- }
- /******************************************************************************
- Function name: KB_FakeIr_MSGBox
- Description:
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- int KB_FakeIr_MSGBox(char *str)
- {
- rc_navKeyStroke_t key;
- int ret;
-
- printf("rn-KB_FakeIr_MSGBox show: %s", str);
- while(1)
- {
- key = KB_IR_GetCurKeyCode();
-
- if(key ==rc_KeyMute)
- {
- ret = IDOK;
- break;
- }
- else if(key ==rc_KeyReturn)
- {
- ret = IDNO;
- break;
- }
- }
- return ret;
-
- }
- /******************************************************************************
- Function name: KB_OTA_NewChannel
- Description:
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- void KB_OTA_NewChannel(void)
- {
- KB_OSPMsgNode MsgOTAClient;
-
- MsgOTAClient.Word1 = E_NEW_TS_ASSOCIATED;
-
- printf("rnnn -------------KB_OTA_NewChannel --------------nn");
- OTA_CLIENT_Service (&MsgOTAClient);
- return;
- }
- /******************************************************************************
- Function name: KB_OTA_IsPermit
- Description:
- Input: None
- Output: None
- Return: None
- ******************************************************************************/
- BOOL KB_OTA_IsPermit(void)
- {
- if(KB_UpdatePreventGet())
- return FALSE;
-
- if(kb_movie_playStatusGet()==kb_movie_closed)
- return TRUE;
- else
- return FALSE;
- }