📄 dspctrl.c.bak
字号:
void I2Cm_Ack (void)
{
SDA = 0;
D_LCDDAT = 0;/*pull up*/
I2CDelay();
/*I2Cm_Clock();*/
SCL = 1;
I2CDelay();
SCL = 0;
}
USHORT x_position=0,y_position=0;
void Set_Measurement(void)
{
StartCondition();
Send_Byte(0x90);
Send_Byte(0x10);
StopCondition();
}
void X_Position_Measurement(void)
{
StartCondition();
Send_Byte(0x90);
Send_Byte(0xcc);
StopCondition();
DelayTIME(30);
StartCondition();
Send_Byte(0x91);
x_position=Read_Byte(1);
x_position<<=4;
I2Cm_Ack();
x_position+=Read_Byte(1)>>4;
I2Cm_nAck();
StopCondition();
/*;
DelayTIME(10);
StartCondition();
Send_Byte(0x90);
Send_Byte(0x10);
StopCondition(); */
}
void Y_Position_Measurement(void)
{
StartCondition();
Send_Byte(0x90);
Send_Byte(0xdc);
StopCondition();
DelayTIME(30);
StartCondition();
Send_Byte(0x91);
y_position=Read_Byte(1);
y_position<<=4;
I2Cm_Ack();
y_position+=Read_Byte(1)>>4;
I2Cm_nAck();
StopCondition();
DelayTIME(30);
StartCondition();
Send_Byte(0x90);
Send_Byte(0x10);
StopCondition();
}
void TSC_Reaed(void)
{
X_Position_Measurement();
DelayTIME(30);
Y_Position_Measurement();
}
#endif
/************************************************************************/
/*!
@fn void vDSP_main(VP_INT exinf)
@brief 昞帵惂屼僞僗僋
@param VP_INT exinf
@return 側偟
@date 2007/XX/XX
*/
/************************************************************************/
ULONG DSPLYDelay=5;
#if ((T0UCHPANEL_THOOSE==THOOSE)||(ANALG_PANEL_THOOSE==THOOSE))
ui8_t REGET,DESPLAYFG;
extern UB tscbeginfg;
extern USHORT KEY_NEMBER;
#endif
const UCHAR pty_name1[] = "News";
const UCHAR pty_name2[] = "Current Affairs ";
const UCHAR pty_name3[] = "Information";
const UCHAR pty_name4[] = "Sport";
const UCHAR pty_name5[] = "Education";
const UCHAR pty_name6[] = "Drama";
const UCHAR pty_name7[] = "Culture";
const UCHAR pty_name8[] = "Science";
const UCHAR pty_name9[] = "Varied";
const UCHAR pty_name10[] = "Pop Music";
const UCHAR pty_name11[] = "Rock Music";
const UCHAR pty_name12[] = "M.O.R. Music";
const UCHAR pty_name13[] = "Light classical";
const UCHAR pty_name14[] = "Serious classical ";
const UCHAR pty_name15[] = "Other Music";
const UCHAR pty_name16[] = "Weather";
const UCHAR pty_name17[] = "Finance";
const UCHAR pty_name18[] = "Children's programs";
const UCHAR pty_name19[] = "Social Affairs";
const UCHAR pty_name20[] = "Religion";
const UCHAR pty_name21[] = "Phone In";
const UCHAR pty_name22[] = "Travel ";
const UCHAR pty_name23[] = "Leisure";
const UCHAR pty_name24[] = "Jazz Music";
const UCHAR pty_name25[] = "Country Music";
const UCHAR pty_name26[] = "National Music ";
const UCHAR pty_name27[] = "Oldies Music ";
const UCHAR pty_name28[] = "Folk Music";
const UCHAR pty_name29[] = "Documentary";
const UCHAR pty_name30[] = "Alarm Test";
const UCHAR pty_name31[] = "Alarm";
UCHAR PS_string_content1[8] ;
UCHAR PS_string_content2[8] ;
UCHAR PS_string_content3[8] ;
UCHAR PS_string_content4[8] ;
UCHAR PS_string_content5[8] ;
UCHAR PS_string_content6[8] ;
UCHAR PS_string_content7[8] ;
UCHAR PS_string_content8[8] ;
UCHAR MAINHST_d_sts_buf[1000];
//3.1: Display Radio
#define Band MAINHST_d_sts_buf[3]
#define Area MAINHST_d_sts_buf[0]
#define Tuner_mode MAINHST_d_sts_buf[1]
#define Preset_num MAINHST_d_sts_buf[2]
#define PTY_type MAINHST_d_sts_buf[3]
#define Current_Frequency_Hi MAINHST_d_sts_buf[3]
#define Current_Frequency_Lo MAINHST_d_sts_buf[3]
#define P1_Hi MAINHST_d_sts_buf[3]
#define P1_Lo MAINHST_d_sts_buf[3]
#define P2_Hi MAINHST_d_sts_buf[3]
#define P2_Lo MAINHST_d_sts_buf[3]
#define P3_Hi MAINHST_d_sts_buf[3]
#define P3_Lo MAINHST_d_sts_buf[3]
#define P4_Hi MAINHST_d_sts_buf[3]
#define P4_Lo MAINHST_d_sts_buf[3]
#define P5_Hi MAINHST_d_sts_buf[3]
#define P5_Lo MAINHST_d_sts_buf[3]
#define P6_Hi MAINHST_d_sts_buf[3]
#define P6_Lo MAINHST_d_sts_buf[3]
//3.2 Update PS string
#define PS_available MAINHST_d_sts_buf[3]
//3.3: Update tuner special flags
#define Tuner_icon_update MAINHST_d_sts_buf[3]
//3.4: Display PTY select
#define PTY_Highlight_Position MAINHST_d_sts_buf[3]
#define PTY1 MAINHST_d_sts_buf[3]
#define PTY2 MAINHST_d_sts_buf[3]
#define PTY3 MAINHST_d_sts_buf[3]
#define PTY4 MAINHST_d_sts_buf[3]
#define PTY5 MAINHST_d_sts_buf[3]
#define PTY6 MAINHST_d_sts_buf[3]
//3.5: Update common status
#define hour MAINHST_d_sts_buf[0]
#define minutt MAINHST_d_sts_buf[1]
#define second MAINHST_d_sts_buf[2]
#define timemode MAINHST_d_sts_buf[3]
//3.6: Display Main Menu
#define Current_play_mode MAINHST_d_sts_buf[3]
//3.7: Update audio status
#define Mute_Flag MAINHST_d_sts_buf[3]
#define Volume_value MAINHST_d_sts_buf[3]
#define EQ_mode MAINHST_d_sts_buf[3]
#define LOUD MAINHST_d_sts_buf[3]
//3.8: Display Servo
#define Current_mode MAINHST_d_sts_buf[3]
#define Disc_type MAINHST_d_sts_buf[3]
void vDSP_main(VP_INT exinf)
{
ULONG i=0;
T_MSG_DATA *dsp_mbx;
ER ercd;
touch(exinf);
/********************************/
/* 奺庬曄悢弶婜壔 */
/********************************/
vDSP_raminitial();
/********************************/
/* 僼儗乕儉愝掕丄昞帵弶婜壔 */
/********************************/
#if 0 /* @003s4[08/01/13] */
// define_frame(ID_DRW0_0, (void *)DRW0_0_ADR,640,GD_FMT_ARGB1555);
// define_frame(ID_DRW0_1, (void *)DRW0_1_ADR,640,GD_FMT_ARGB1555);
// define_frame(ID_DRW1_0, (void *)DRW1_0_ADR,640,GD_FMT_ARGB1555);
// define_frame(ID_DRW1_1, (void *)DRW1_1_ADR,640,GD_FMT_ARGB1555);
#else /* @003s4[08/01/13] */
define_frame(ID_DRW0_0, (void *)DRW0_0_ADR,800,GD_FMT_RGB565);
define_frame(ID_DRW0_1, (void *)DRW0_1_ADR,800,GD_FMT_RGB565);
define_frame(ID_DRW1_0, (void *)DRW1_0_ADR,800,GD_FMT_RGB565);
define_frame(ID_DRW1_1, (void *)DRW1_1_ADR,800,GD_FMT_RGB565);
#endif /* @003s4[08/01/13] */
define_frame(ID_VIDEO, (void *)VIDEO_ADR,768,GD_FMT_YUV16);
/********************************/
/* 昞帵乛昤夋弶婜壔 */
/********************************/
#if (ANALG_PANEL_THOOSE==THOOSE)
InitT10x();
I2CWriteByte(0x50,0xe2,0x11);
#endif
vDSP_dspinitial();
for (i=0;i<1000;i++){ /* 憲庴怣僶僢僼傽弶婜壔 */
MAINHST_d_sts_buf[i] = 0x0F;
}
/********************************/
/* 婲摦夋柺昞帵張棟 */
/********************************/
vDSP_initdsp();
/********************************/
/* 俽俢俼俙俵傊偺僥僋僗僠儍揥奐*/
/********************************/
vDSP_set_texture();
//REGET=I2CReadByte(0x50,0xB0);
/********************************/
/* 僒僽僞僗僋婲摦 */
/********************************/
#if (MXMODE == MXRON)
ercd = act_tsk(TASK3);
if( ercd != E_OK ){
ercd = ter_tsk(TASK3);
if( ercd != E_OK ){
return;
}
}
#elif (MXMODE == MXROFF)
ercd = act_tsk(TASK2);
if( ercd != E_OK ){
ercd = ter_tsk(TASK2);
if( ercd != E_OK ){
return;
}
}
while(tm_wait);
#if (SSPFMODE == SSPF_V2)
vDSP_drw_haikei();
#endif /* SSPFMODE */
#endif /* MXMODE */
#if (T0UCHPANEL_THOOSE==THOOSE)
Set_Measurement();
#endif
while(1){
/********************************/
/* 捠怣僞僗僋偐傜僐儅儞僪庴棟 */
/********************************/
if( (rcv_mbx(MBX1,(T_MSG **)&dsp_mbx)) == E_OK ){
cmdID = dsp_mbx->cmdID_mbx;
for(i=2;i<dsp_mbx->cmd_mbx[0]+1;i++)
cmd[i-1]= dsp_mbx->cmd_mbx[i];
}
/********************************/
/* 昞帵儌乕僪仌僷儔儊乕僞愝掕 */
/********************************/
vDSP_set_mode();
}
}
/************************************************************************/
/*!
@fn void vDSP_raminitial(void)
@brief 曄悢弶婜壔張棟
@param 側偟
@return 側偟
@date 2007/XX/XX
*/
/************************************************************************/
void vDSP_raminitial(void)
{
#if (MXMODE == MXRON)
ucDSP_mode = DISP_CD; /* 俠俢昞帵儌乕僪 */
ucDSP_submode = SUB_NONE; /* 僒僽昞帵側偟 */
/* 弶婜抣妋曐 */
disp_sharp = VI_INIT_SHP_USR;
disp_color = VI_INIT_COLOR;
disp_tint = VI_INIT_TINT;
disp_contrast = VI_INIT_CONTRAST/4;
disp_bright = DSP_INIT_BRIGHTNESS<<2;
#elif (MXMODE == MXROFF)
#if (SSPFMODE == SSPF_V1)
UCHAR i;
dsp_src = SRC_NOP; /* 尰嵼昞帵亖俶俷俹 */
ucDSP_mode = DISP_NOP; /* 昞帵側偟 */
ucDSP_initmode = INI_ZERO; /* 弶婜壔枹 */
tm_framein = 0;
tm_button = 0;
tm_video = 0;
blink_button = 0;
tm_wait = TM_WAIT;
#elif (SSPFMODE == SSPF_V2)
dsp_src = SRC_CD; /* 尰嵼昞帵亖俠俢 */
ucDSP_mode = DISP_CD; /* 俠俢昞帵儌乕僪 */
ucDSP_submode = SUB_NONE; /* 僒僽昞帵側偟 */
tm_framein = 0;
tm_button = 0;
tm_video = 0;
blink_button = 0;
tm_wait = TM_WAIT;
/* 弶婜抣妋曐 */
disp_sharp = VI_INIT_SHP_USR;
disp_color = VI_INIT_COLOR;
disp_tint = VI_INIT_TINT;
disp_contrast = VI_INIT_CONTRAST/4;
disp_bright = DSP_INIT_BRIGHTNESS<<2;
#endif /* SSPFMODE */
#endif /* MXMODE */
}
#if (DISPLAY_MODE_B_THOOSE==THOOSE)
#define asm_wt(s,t) ((s)=(t))
#define asm_rd(s) ((s))
#define LCU_RevPp LCU_RevTp
//
void dsp_set_modeB()
{
USHORT spsofs, spssp, spsep;
USHORT lppep,lppsp;
USHORT clsep,clssp;
USHORT sprep,sprsp;
USHORT revv0tp,revtp;//gpio04
USHORT mdvterm,mt;//gpio05
spsofs=0;spssp=32;spsep=33;
sprsp=215;sprep=sprsp+2; //LCDHSY STH
lppsp=1015;lppep=lppsp+3; //ENABLE LOAD
clssp=915;clsep=clssp+300; //LCDCSY CPV
revv0tp=300;revtp=100;
mdvterm=300;mt=1;
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)|0x0001);//SHDC ZHONGJUN 080407 set LCU_MoDe bit0==1; into display mode B
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)&~0x0100);//LCDCE singal set
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)|0x0080);//LCDVSY set high active
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)|0x0040);//LCDEN set high active
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)|0x0020);//LCDCSY set high active
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)|0x0010);//LCDHSY set high active
//Mode B related register setting
asm_wt(LCU_SpsPp, (spsofs<<23)+(spssp<<12)+spsep);// LCU_SpsPp LCDVSY
asm_wt(LCU_SprPp, (sprep<<16)+sprsp);// LCU_SprPp Horizontal sync signal 0 LCDHSY assert period STH
asm_wt(LCU_LpPp, (lppep<<16)+lppsp);// LCU_LpPp Horizontal sync signal 1 ENABLE assert period LOAD
asm_wt(LCU_ClsPp, (clsep<<16)+clssp);// LCU_CisPp Horizontal sync signal 2 LCDCSY assert period CPV
asm_wt(LCU_RevPp, (revv0tp<<16)+revtp);// LCU_RevPp Horizontal toggle signal position toggle 0 & 1
asm_wt(LCU_MDType, (mdvterm<<8)+mt);// GPIO 05
}
void dsp_set_clk_mode_B(ULONG s, USHORT vsw, USHORT vc, USHORT hsw, USHORT hc, USHORT vds, USHORT vde, USHORT hds, USHORT hde)
{
ULONG *reg,cnt;
if(asm_rd(VU_bootmd)) {
asm_wt(VOBMOD,1);
asm_wt(VOCMOD,1); //Register VSYNC reflash mode change
}
s=(s&1)*4;
reg=(ULONG*)&LCU_ExtVP;
asm_wt(reg[s],(vsw<<16)+vc);
asm_wt(reg[s+1],(hsw<<16)+hc);
asm_wt(reg[s+2],(vds<<16)+vde);
asm_wt(reg[s+3],(hds<<16)+hde);
gdd_info.dsp.vsize=vde-vds;
cnt=gdd_info.dsp.vsync;
dsp_wait_vblank(0);
dsp_wait_vblank(1);// waiting for register reflash
gdd_info.dsp.vsync=cnt;
dsp_set_modeB();
asm_wt(VOCMOD,0); //Register VSYNC reflash mode change
asm_wt(LCU_MoDe,asm_rd(LCU_MoDe)&~4+(s^4));//set syncmode internal mode
}
#endif
/************************************************************************/
/*!
@fn void vDSP_dspinitial(void)
@brief 昞帵乛昤夋弶婜壔張棟
@param 側偟
@return 側偟
@date 2007/XX/XX
*/
/************************************************************************/
void vDSP_dspinitial(void)
{
/* 昞帵宯 */
dsp_display(FALSE); /* 昞帵俷俥俥 */
#if (DISPLAY_MODE_B_THOOSE==ABANDON)
#if ( DRGBMODE == DRGBON )
//dsp_set_clk(1,3,525,58,858,28,262,60,630);
dsp_set_clk(1,3,263,58,632,28,262,60,630);
#endif
#endif
#if 0 /* @003s4[08/01/13] */
// dsp_set_bgcolor(BLACK); /* 攚宨怓愝掕 */
#else /* @003s4[08/01/13] */
dsp_set_bgcolor(BLACK16); /* 攚宨怓愝掕 */
#endif /* @003s4[08/01/13] */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -