📄 msapi_cc_parser.h
字号:
#ifndef MSAPI_CC_PARSER_H
#define MSAPI_CC_PARSER_H
#include "DataType.h"
#include "drvge.h"
#include "msAPI_CC_Disp.h"
#ifdef MSAPI_CC_PARSER_C
#define INTERFACE
#else
#define INTERFACE extern
#endif
#ifdef MSAPI_CC_PARSER_608_C
#define INTERFACE6
#else
#define INTERFACE6 extern
#endif
#ifdef MSAPI_CC_PARSER_708_C
#define INTERFACE7
#else
#define INTERFACE7 extern
#endif
/************************************************************************/
/* Control Area */
/************************************************************************/
/* CC608 Define */
#define _CC608_REDRAW_BGCOLOR_ 0 // for Re-Draw Background Color
/* CC708 FONT Define */
#define _CC708_NON_DYNAMIC_RELOADFONT_ 0 // Do not dynamic relaod different Font table
#define _CC708_RELOADFONT_STYLE_ 1 // Relaod different Font table in the same SDRAM, for saving SDRAM
#define _CC708_8FONT_TABLE_ 2 // All 8 FONT table in SDRAM, for speed up
#define _CC708_FONT_STYLE_MODE_ _CC708_RELOADFONT_STYLE_
/* CC708 RESERVED BLOCK Define */
#define RSVBLK_ROWMAX 16
/* CC Debug Define */
#define _CC_DEBUG_LEVEL2_ 0 // For more detail,
#define _CC_DEBUG_EXHANDLE_ 0 // For Exception Handle
#define _CC_DEBUG_TEMP_ 0 // For Temp Debug
#define _CC_DEBUG_CMD_ 0 // For Temp Debug
#define _CC_DEBUG_CMD608_ 0 // For Temp Debug
// Ata Temp Debug label
#define _CC_DEBUG_708Step_ 0 // For 708 Servive Step Debug
#define _CC_DEBUG_CtrlBuf_ 0 // For Control Buffer
#define _CC_DEBUG_CCColor_ 0 // For CC color
#define _CC_DEBUG_FieldTry1_ 0 // For Field Try use, solve CC.trp bug
#define _CC_DEBUG_FieldTry2_ 0 // For Field Try use, solve 5.trp bug
// Self-Test item
#define _CC_DEBUG_CCPKT_ 0 // For Specific CC708 Packet test
#define _CC_DEBUG_GETONE_708_ 0 // For getting one ringbuffer data of 708.
// Dump item
#define _CC_PACKET_DUMP_ 0 // For Dump DTVCC 708 Packet data
#define _CC_SERVICE_DUMP_ 0 // For Dump DTVCC 708 Service data
#define _CC_708_CMD_DUMP_ 0 // For 708 CMD Debug
#if (_CC_DEBUG_LEVEL2_)
#define CC_DBINFO_L2(y) y
#else
#define CC_DBINFO_L2(y)
#endif
#if (_CC_DEBUG_EXHANDLE_)
#define CC_DBINFO_EX(y) y
#else
#define CC_DBINFO_EX(y)
#endif
#if (_CC_DEBUG_TEMP_)
#define CC_DBINFO_TEMP(y) y
#else
#define CC_DBINFO_TEMP(y)
#endif
#if (_CC_DEBUG_CtrlBuf_)
#define CC_DBINFO_CtrlBuf(y) y
#else
#define CC_DBINFO_CtrlBuf(y)
#endif
#if (_CC_DEBUG_CCColor_)
#define CC_DBINFO_Color(y) y
#else
#define CC_DBINFO_Color(y)
#endif
#if (_CC_DEBUG_708Step_)
#define CC_DBINFO_STEP(y) y
#else
#define CC_DBINFO_STEP(y)
#endif
#if (_CC_DEBUG_FieldTry1_)
#define CC_DBINFO_FIELDTRY1(y) y
#else
#define CC_DBINFO_FIELDTRY1(y)
#endif
#if (_CC_DEBUG_FieldTry2_)
#define CC_DBINFO_FIELDTRY2(y) y
#else
#define CC_DBINFO_FIELDTRY2(y)
#endif
#if (_CC_DEBUG_CMD_)
#define CC_DBINFO_CMD(y) y
#else
#define CC_DBINFO_CMD(y)
#endif
#if (_CC_DEBUG_CMD608_)
#define CC_DBINFO_CMD608(y) y
#else
#define CC_DBINFO_CMD608(y)
#endif
/***************************************************************************************/
/* */
/* COMMON */
/* */
/***************************************************************************************/
typedef enum
{
CC_SIGNAL_ANALOG,
CC_SIGNAL_DIGITAL,
} EN_CC_SIGNAL;
/***************************************************************************************/
/* */
/* CC608 */
/* */
/***************************************************************************************/
#define CC608_NULLDATA 0x80
#define VBIDATAMASK 0x7F
#define CC608_PACKET_SIZE 8
#define CODE_XDS_MAXBOUND 0x0F
#define CODE_CCCOMMAND_MAXBOUND 0x1F
#define CODE_CCDATA_MAXBOUND 0x7F
#define CC608_RDNO 2
#define CC608_RDINTERVAL 4
#define CC608_FRAMEBUFFER_SIZE 6
/* Min Color Plate */
#define CC_COLOR_WHITE 0x00FFFFFF
#define CC_COLOR_GREEN 0x0000FF00
#define CC_COLOR_BLUE 0x000000FF
#define CC_COLOR_CYAN 0x0000FFFF
#define CC_COLOR_RED 0x00FF0000
#define CC_COLOR_YELLOW 0x00FFFF00
#define CC_COLOR_MAGENTA 0x00FF00FF
#define CC_COLOR_BLACK 0x000F0F0F
#define CC_COLOR_TRANSPARENT 0x00000000
#define CC_COLOR_IDX_WHITE 0
#define CC_COLOR_IDX_GREEN 1
#define CC_COLOR_IDX_BLUE 2
#define CC_COLOR_IDX_CYAN 3
#define CC_COLOR_IDX_RED 4
#define CC_COLOR_IDX_YELLOW 5
#define CC_COLOR_IDX_MAGENTA 6
#define CC_COLOR_IDX_BLACK 7
#define CC_COLOR_IDX_TRANSPARENT 24
/* CC708 Pallete */
#define CC708_COLOR_IDX_BLACK 0
#define CC708_COLOR_IDX_RED 1
#define CC708_COLOR_IDX_GREEN 2
#define CC708_COLOR_IDX_YELLOW 3
#define CC708_COLOR_IDX_BLUE 4
#define CC708_COLOR_IDX_MAGENTA 5
#define CC708_COLOR_IDX_CYAN 6
#define CC708_COLOR_IDX_WHITE 7
#define CC708_COLOR_IDX_TRANSPARENT 24
// Extra Color
#define CC_COLOR_DKBLUE 0x000060C0
#define CC_COLOR_LTGRAY 0x00DFDFDF
#define CC_COLOR_GRAY 0x00A0A0A0
#define CC_COLOR_DKGRAY 0x00808080
#define CC_COLOR_BRBLUE 0x0000FFFF
// Special font index
#define CC_FONT_IDX_UNDERLINE 0x9A
#define CC_FONT_IDX_TRANSPARENT 0xA0
/*************************************************************************************************/
#define CC_608_157_AUTO_SWITCH_TIME 100
typedef struct _CC608_CodeSyntax_CntlAttr
{
/* Whole System */
U16 u16SysSettingFlag; // System Attr
U8 u8WinText_CurRowNo;
U8 u8WinText_CurColNo;
U8 u8WinText_RowTotalNo;
U8 u8WinText_BakRowNo;
U8 u8WinText_RowRUxNo;
U8 u8WinText_LastRowRUxNo;
U8 u8WinText_WinLocY;
U8 u8ScrollingNo; //scroll record
U8 u8TextStartScroll; // indicate if the text mode should start the scrolling
/* Text Part */
U16 u16TextAttrFlag; // Text Attr
U8 u8FontTypeFlag;
/* FB & GOP Control */
U16 u16WinAttr_ClipHeight;
U16 u16WinAttr_ClipWidth;
U16 u16WinAttr_Loc_SX;
U16 u16WinAttr_Loc_SY;
/* */
#if (_CC608_REDRAW_BGCOLOR_)
U8 u8TextBakBGColor;
#endif
} CC608_CodeSyntax_CntlAttr;
INTERFACE CC608_CodeSyntax_CntlAttr * pstCC608_Cntl;
// error CC display stop high/low threshold
INTERFACE6 U8 g_u8ErrorStopHigh, g_u8ErrorStopLow;
// added by Andy, to control the display buffer and attribute
#define CC608_TEXT_ATTRIBUTE 0x8000U
#define CC608_TEXT_BLANK 0x4000U // indicate must draw a blank (not space)
#define CC608_ALPHA_COEF 0
#define CC608_ROW_BUFF_SIZE (CC_MAX_COL_NUMBER+2)
typedef struct _CC608_Display_Buffer
{
U8 RollUpBaseRow;
U16 RollUpTextAttr;
U16 *RowDisplayBuffer;
U16 DisplayBuffer0[CC_MAX_ROW_NUMBER][CC608_ROW_BUFF_SIZE]; // last word of each row indicate the lastest draw time
U16 DisplayBuffer1[CC_MAX_ROW_NUMBER][CC608_ROW_BUFF_SIZE];
U8 DisplayedRowNum;
U8 NonDisplayedRowNum;
U16 *NonDisplayedBuffer;
U8 NonDisplayedGwin;
U8 NonDisplayedFB;
U16 *DisplayedBuffer;
U8 DisplayedGwin;
U8 DisplayedFB;
U8 WinMode;
} CC608_Display_Buffer;
INTERFACE6 CC608_Display_Buffer * cc608DispBuff;
#define GET_CC608_DISPLAY_BUFFER(col) cc608DispBuff->RowDisplayBuffer[col]
#define SET_CC608_DISPLAY_BUFFER(row, col, c) cc608DispBuff->RowDisplayBuffer[col] = (U16) c;
// get/set the data of current position
#define GET_CC608_DISPLAY_BUFFER_CURRENT() cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo]
#define SET_CC608_DISPLAY_BUFFER_CURRENT(c) cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo] = (U16) c;
// get/set the data of previous position
#define GET_CC608_DISPLAY_BUFFER_PREV() cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo-1]
#define SET_CC608_DISPLAY_BUFFER_PREV(c) cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo-1] = (U16) c;
#define SET_CC608_ROW_ATTR(attr) cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo] = (attr | CC608_TEXT_ATTRIBUTE)
#define SET_CC608_ROW_ATTR_AT_PREV_COL(attr) cc608DispBuff->RowDisplayBuffer[pstCC608_Cntl->u8WinText_CurColNo-1] = (attr | CC608_TEXT_ATTRIBUTE)
#define SET_CC608_ROW_HEAR_ATTR(attr) cc608DispBuff->RowDisplayBuffer[0] = (attr | CC608_TEXT_ATTRIBUTE)
#define SET_CC608_ROLLUP_ATTR(attr) cc608DispBuff->RollUpTextAttr = (attr | CC608_TEXT_ATTRIBUTE);
#define GET_CC608_ROLLUP_ATTR() (U16) (cc608DispBuff->RollUpTextAttr & (~CC608_TEXT_ATTRIBUTE));
#define CLEAR_CC608_DISPLAY_BUFFER() memset(cc608DispBuff, 0, sizeof(CC608_Display_Buffer))
#define ERASE_CC608_DISPLAY_BUFFER_COL_BLOCK(row, cstart, cend) \
memset(&cc608DispBuff->RowDisplayBuffer[cstart], 0, (cend-cstart) * 2)
/*************************************************************************************************/
/* Macro for the whole system */
#define SET_CC608_WIN_MODE(_mode) do { cc608DispBuff->WinMode = _mode; } while (0)
#define GET_CC608_WIN_MODE() cc608DispBuff->WinMode
#define bSystemUserTextModeBit _BIT0 //user select text_mode or not
#define bSystemUserChannel2Bit _BIT1 //user select channel_2 or not
#define bSystemUserField2Bit _BIT2 //user select field_2 or not
#define bSystemDataParsingOnBit _BIT3 //data should parsing or not
#define bSystemDataTextModeBit _BIT4 //data is text_mode or not
#define bSystemDataChannel2Bit _BIT5 //data is channel_2 or not
#define bSystemDataField2Bit _BIT6 //data is field_2 or not
#define bSystemDataDoubleControlBit _BIT7 //data is double_control or not
#define bSystemProgSendTwiceBit _BIT8 //data is sent twice or not
#define bSystemProgPaintWinBit _BIT9 //Create Paint on Window or not
#define bSystemProgRUWinBit _BIT10 //Create Rollup Window or not
#define bSystemProgPopWinBit _BIT11 //Create Pop on Window or not
#define bSystemProgTextWinBit _BIT12 //Create Text Window or not
#define bSystemProgRUWinChgBit _BIT13 //Update RUx Window or not
#define bSystemProgMRCColorBit _BIT14 //Enable MRC Color or not
#define SystemUserTextModeFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemUserTextModeBit) )
#define SystemUserChannel2Flag ((pstCC608_Cntl->u16SysSettingFlag & bSystemUserChannel2Bit) >> 1 )
#define SystemUserField2Flag ((pstCC608_Cntl->u16SysSettingFlag & bSystemUserField2Bit) >> 2 )
#define SystemDataParsingOnFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemDataParsingOnBit) >> 3 )
#define SystemDataTextModeFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemDataTextModeBit) >> 4 )
#define SystemDataChannel2Flag ((pstCC608_Cntl->u16SysSettingFlag & bSystemDataChannel2Bit) >> 5 )
#define SystemDataField2Flag ((pstCC608_Cntl->u16SysSettingFlag & bSystemDataField2Bit) >> 6 )
#define SystemDataDoubleControlFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemDataDoubleControlBit) >> 7 )
#define SystemProgSendTwiceFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgSendTwiceBit) >> 8 )
#define SystemProgPaintWinFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgPaintWinBit) >> 9 )
#define SystemProgRUWinFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgRUWinBit) >> 10 )
#define SystemProgPopWinFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgPopWinBit) >> 11 )
#define SystemProgTextWinFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgTextWinBit) >> 12 )
#define SystemProgRUWinChgFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgRUWinChgBit) >> 13 )
#define SystemProgMRCColorFlag ((pstCC608_Cntl->u16SysSettingFlag & bSystemProgMRCColorBit) >> 14 )
#define Set_SystemUserTextModeFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemUserTextModeBit )
#define Clr_SystemUserTextModeFlag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemUserTextModeBit )
#define Set_SystemUserChannel2Flag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemUserChannel2Bit )
#define Clr_SystemUserChannel2Flag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemUserChannel2Bit )
#define Set_SystemUserField2Flag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemUserField2Bit )
#define Clr_SystemUserField2Flag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemUserField2Bit )
#define Set_SystemDataParsingOnFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemDataParsingOnBit )
#define Clr_SystemDataParsingOnFlag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemDataParsingOnBit )
#define Set_SystemDataTextModeFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemDataTextModeBit )
#define Clr_SystemDataTextModeFlag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemDataTextModeBit )
#define Set_SystemDataChannel2Flag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemDataChannel2Bit )
#define Clr_SystemDataChannel2Flag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemDataChannel2Bit )
#define Set_SystemDataField2Flag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemDataField2Bit )
#define Clr_SystemDataField2Flag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemDataField2Bit )
#define Set_SystemDataDoubleControlFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemDataDoubleControlBit )
#define Clr_SystemDataDoubleControlFlag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemDataDoubleControlBit )
#define Set_SystemProgSendTwiceFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemProgSendTwiceBit )
#define Clr_SystemProgSendTwiceFlag() (pstCC608_Cntl->u16SysSettingFlag &=~bSystemProgSendTwiceBit )
#define Set_SystemProgPaintWinFlag() (pstCC608_Cntl->u16SysSettingFlag |= bSystemProgPaintWinBit )
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -