⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 cas_cch.h

📁 EMU_FTAbox_ref441328_code_source ali m3327
💻 H
字号:
/****************************************************************************
*
*  ALi 
*
*  File: cas_cch.h
*
*  Description: 
*     Cas Type Cas Bool Cas_false Cas_Null Cas_Byte OSD Operation in CAS Sys 
* this file was build by cch 2006-11-16
* the functions should compatible to the PC editor "CasEditor 1.0"
* change below config to compatible to your platform
*       
*  History:
*      Date        		Author         	Version   	Comment
*      ====        	      ======         	=======   	=======
*  	2006-11-16	              CCH
*
****************************************************************************/

#ifndef __CAS_CCH_H__
#define __CAS_CCH_H__



#include <types.h> // UINT16 UINT32 NULL INT8 INT16 INT32 
#include <osal/osal.h> // Osal Func
#include <api/libc/printf.h> // C Lib Printf
#include <api/libc/string.h> // C Lib string

#include <hld/sto/sto.h> // Func Storage Drive in Device
#include <hld/sto/sto_dev.h> // Func Storage Drive in Device
#include <api/libchunk/chunk.h> // Func like NO_CRC 0x4E435243


//change this value to adjust to your OSD(range : must not zero, and divide exactly by 8, such like  8/16/32.......)
#define CAS_KEY_OSD_PER_ROW_KEYS    8

/////////////////////////////////////////////////////////////////////


//don't change below code by yourself,  but by CCH anyway

#include "cas_api.h" // Cas_ECM and Cas_SC and Key Data

#define MAX_CAS_TYPE_NAME_LENGTH		32 // Size of Cas Type
#define MAX_PROVIDER_NAME_LENGTH		32 // Size of Provaider Name
#define MAX_CAS_ID_LENGTH				3//unchangeable with the same version
#define MAX_PROVIDER_ID_LENGTH		3//unchangeable with the same version

#define MAX_CAS_COUNT                                   30
#define MAX_KEY_COUNT_IN_ONE_PROVIDER   30
#define MAX_PROVIDER_COUNT_IN_ONE_CAS   100

/* Boolean type (values should be among TRUE and FALSE constants only) */
#ifndef CAS_BOOL
    typedef int CAS_BOOL;
#endif

/* CAS_BOOL type constant values */
#ifndef CAS_TRUE
    #define CAS_TRUE (1 == 1)
#endif
#ifndef CAS_FALSE
    #define CAS_FALSE (!CAS_TRUE)
#endif

#ifndef CAS_NULL
    #define CAS_NULL		(void *)0
#endif

#ifndef CAS_BYTE
    #define CAS_BYTE unsigned char
#endif

typedef struct
{
    unsigned char      key_id;
    char                    keys[16];
}cas_edit_key_db;


typedef struct
{
    unsigned long     provider_id;
    char                    provider_name[MAX_PROVIDER_NAME_LENGTH];

    unsigned char      key_count;
    cas_edit_key_db *pCasEditKeyDb[MAX_KEY_COUNT_IN_ONE_PROVIDER];
}cas_edit_provider_db;


typedef struct
{
    unsigned long     ca_id;
    unsigned char      key_type;
    char                    cas_name[MAX_CAS_TYPE_NAME_LENGTH];
    unsigned char      key_size;

    unsigned char      provider_count;    
    cas_edit_provider_db *pCasEditProviderDb[MAX_PROVIDER_COUNT_IN_ONE_CAS];
}cas_edit_cas_db;


typedef	struct{
    char nKeyIndex;
    char Keys[CAS_KEY_OSD_PER_ROW_KEYS];
    unsigned char nProviderIndex;
}cas_key_for_osd;


/////////////////////////////////

//functions 
//call this function to compute the data length when you want to send patch data from RS232 to PC
unsigned long int ComputeCASDataLengthToSendFromFlash(unsigned char *pFlash, unsigned long int nMaxFlashDataSizeForPatch);

//call this function when first time booting before patch running,, read the data from flash the CASEditDB
CAS_BOOL RearrangeCASEditDBFromFlash(unsigned char *pFlash, unsigned long int nMaxFlashDataSizeForPatch);

//call this function when you want to save the current CASEditDB data to flash
CAS_BOOL ConvertCASEditDBToFlash(unsigned char *pFlash, unsigned long int nMaxFlashDataSizeForPatch);


//functions for OSD operation

void CAS_OSD_ENTERED(void);//call this function when ENTERED the OSD of keys operation
void CAS_OSD_EXITED(void);//call this function when EXITED the OSD of keys operation
CAS_BOOL CAS_OSD_InitData(void);//call this function when enter one type of CAS, prepare the data for the current selected CAS system
int CAS_OSD_GetCASCount(void);//get all CAS system count
char* CAS_OSD_GetCASName(int nCASIndex);//get  CAS system name by cas index
char* CAS_OSD_GetCurrentCASName(void);//get  CAS system name by current
int CAS_OSD_GetCASId(int nCASIndex);//get  CAS system id by cas index
int CAS_OSD_GetCurrentCASId(void);//get  CAS system id by current
char *CAS_OSD_GetProviderName(int nCASIndex, int nProviderIndex);//get  CAS provider name by cas index, provider index
char *CAS_OSD_GetProviderNameByItemIndex(int nItemIndex);//get CAS provider name by the item index
int CAS_OSD_GetProviderId(int nCASIndex, int nProviderIndex);//get  CAS provider id by cas index, provider index
void CAS_OSD_SetCurrentCASIndex(int nCASIndex);//call this function when you move the focus to the position of the selected CAS system
int CAS_OSD_GetCurrentCASIndex(void);//get the current selected cas system index
int CAS_OSD_GetItemCount(void);//get all item count
void CAS_OSD_SetItemKeyOneChar(int nItemIndex, int nItemKeyIndex, char key);//call this function when you have changed one key
void CAS_OSD_SetItemKeys(int nItemIndex, char *keys);//call this function when you have changed one Items keys
char CAS_OSD_GetItemKeyOneChar(int nItemIndex, int nItemKeyIndex);
char CAS_OSD_GetItemKeyIndex(int nItemIndex);
char CAS_OSD_GetItemProviderId(int nItemIndex, int nProviderSubIndex);

CAS_BOOL CAS_OSD_IsNeedSave(void);//call this function to check if it's necessary to save the changed data to SDRAM/Flash when you exit from one CAS editing
CAS_BOOL CAS_OSD_SaveData(void);//Save the data to SDRAM/Flash


#endif

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -