📄 gpio_api_5009.c
字号:
#else
rPCON1 = ((0<<28)|(2<<24)|(2<<20)|(2<<16)|(2<<12)|(0<<8)|(0<<4)|(1<<0));
#endif
// rPDAT1 |= 0x00;
rP1PUR |= 0x06;
/*
P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0
MC ML MD x I2SDAT0 I2CDAT I2CCK VRDVD
O O O I x x x O
PDDVS
*/
/*
Zhan 20050819
P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0
SpD_sense DR_MUTE I2SDO2 ISDO1 I2SDAT0 I2CDAT I2CCK SMONITOR0
0 1 2 2 2 2 2 5
PDDVS
*/
/*XU051125 FOR 5009
P2.7 P2.6 P2.5 P2.4 P2.3 P2.2 P2.1 P2.0
HDMI_INT SERVOMON1 IISD2 IISD1 IISD0 IISSWO IISMCKO IISBCKO
0 6 2 2 2 2 2 2
*/
//rPCON2 = ((5<<28)|(5<<24)|(5<<20)|(1<<16)|(2<<12)|(2<<8)|(2<<4)|(1<<0)); //Old Board
rPCON2 = ((0<<28)|(6<<24)|(2<<20)|(2<<16)|(2<<12)|(2<<8)|(2<<4)|(2<<0)); //p2.0 output open xu0901
// rPDAT2 |= 0x10;
// rP2PUR |= 0x08;
/*
P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0
- RRQ_L SPDIFO OPEN_SW CLOSE_SW I2SBCKO I2SWSO I2SMCK0
x O x I I x x x
*/
/*
Zhan 20050819
P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0
- Close_SW SPDIFO OPEN_SW CD/DVD I2SBCKO I2SWSO I2SMCK0
x I 2 I O 2 2 2
*/
/*XU051125 FOR 5009
P3.7 P3.6 P3.5 P3.4 P3.3 P3.2 P3.1 P3.0
nSWAIT nSCS1 CLOSE OPEN BTCLK SPD_SENSE CD/DVD
2 2 1 1 2 0 1
*/
rPCON3 = ((2<<24)|(2<<20)|(1<<16)|(1<<12)|(2<<8)|(0<<4)|(1<<0));
rPDAT3 |= 0x01; //xu0901
// rP3PUR |= 0x50; //xu0901
/*
P4.7 ~ P4.0 : FDA9 ~ FDA0 (Flash memory)
P5.7 ~ P5.0 : FDA17 ~ FAD10
P6.7 ~ P6.0 : FDB5 ~ FDA18
P7.1 ~ P7.0 : FDB7 ~ FDB6 (P7.7 ~ P7.2 : No_Pin)
*/
rPCON4 = ((2<<28)|(2<<24)|(2<<20)|(2<<16)|(2<<12)|(2<<8)|(2<<4)|(2<<0));
rPCON5 = ((2<<28)|(2<<24)|(2<<20)|(2<<16)|(2<<12)|(2<<8)|(2<<4)|(2<<0));
rPCON6 = ((2<<28)|(2<<24)|(2<<20)|(2<<16)|(2<<12)|(2<<8)|(2<<4)|(2<<0));
rPCON7 = ((2<<28)|(2<<24)|(2<<20)|(2<<16)|(2<<12)|(2<<8)|(2<<4)|(2<<0));
#endif
#endif
#endif
}
VOID GPIO_SetInterProgMode( BOOL interlace )
{
}
// SSCR yyd 060601 for PWM zero detect
VOID GPIO_SetAudioMuteState( BOOL mute )
{
#if _COP_ROCO_BOARD
if(! mute )
{
REG_SET_HIGH(rPDAT0, 0x20);
}
else
{
REG_SET_LOW(rPDAT0, 0x20);
}
#else
if(! mute )
{
REG_SET_LOW(rPDAT0, 0x02);
}
else
{
REG_SET_HIGH(rPDAT0, 0x02);
}
#endif
}
// SSCR yyd 060608 for PWM test
/*
VOID GPIO_SetPWMINPUT( void)
{
// yyd set PWM1,PWM2 input (p2.7,2.6,2.5,1.7)
rPCON2 = (rPCON2 & 0x000fffff);
rPCON1 = (rPCON2 & 0x0fffffff);
}
*/
VOID GPIO_SetPowerState( BOOL power_on )
{
}
/*
SSCR Engineer WangLin 060518
For USB Plug and Play
*/
#if _APP_CAP_NAV_USB_DISC
SysTimer_t gTimer_USBMonitor;
BOOL gTimer_USB_start = FALSE;
BOOL USBIsAttached(VOID)
{
if((rUSBPSR & 0x01) && !gUSB_Device_Bad)
return TRUE;
else if(!(rUSBPSR & 0x01))
{
gUSB_Device_Bad = FALSE;
gEmpty_Disc = FALSE;
}
return FALSE;
}
VOID USBDetectTimerExpired(UNSIGNED id )
{
if(USBIsAttached() && !gEmpty_Disc)
{
//SysPrintf("\n[USB] USB Attached!!");
myKeyMsgSender(RC_KEY_USB_ATTACH);
}
}
VOID USBDetectTimerPreInit(VOID)
{
SysSetTimer( &gTimer_USBMonitor, "USB_T", USBDetectTimerExpired,
0, 2000, 2000, TIMER_DISABLE, NULL );
}
VOID USBDetectTimerEnable(BOOL USB)
{
gTimer_USB_start = USB;
//SysPrintf("\n[USB] Timer Enable!!");
SysControlTimer(&gTimer_USBMonitor, TIMER_DISABLE, NULL);
SysControlTimer(&gTimer_USBMonitor, TIMER_ENABLE, NULL);
}
VOID USBDetectTimerDisable(VOID)
{
//SysPrintf("\n[USB] Timer Disable!!");
SysControlTimer(&gTimer_USBMonitor, TIMER_DISABLE, NULL);
}
#endif
#if _APP_CAP_NAV_FX_DATA
#define _VCC_ON_OFF_TEST 0 // temporary test routine for just test. 2006.1.10. by CKLee.
SysTimer_t gTimer_McardMonitor;
BOOL gConnected_CF, gConnected_MS_SD_SM;
void KeyMsgSender( UINT data, void *param );
VOID CardVccOn(VOID)
{
/*
P1.0 used to control power, WangLin
*/
rPCON1 = (rPCON1 & 0xFFFFFFFE) | 0x01;
rPDAT1 |= 0x01;
}
VOID CardVccOff(VOID)
{
rPCON1 = (rPCON1 & 0xFFFFFFFE) | 0x01;
rPDAT1 &= 0xFFFFFFFE;
}
BOOL CardDetectCF(VOID)
{
#if 1
/*
if connected, port 1.2 become 0,WangLin.
*/
rPCON1 = rPCON1&0xfffff0ff;
if( rPDAT1 & 0x04 )
return FALSE;
else
return TRUE;
#else
return TRUE;
#endif
}
BOOL CardDetectMS_SD_SM(VOID)
{
#if 1
/*
if connected, port 3.5 become 0,WangLin.
*/
rPCON3 = rPCON3&0xff0fffff;
if( rPDAT3 & 0x20 )
{
gMemory_Card_Bad = FALSE;
return FALSE;
}
else
if(!gMemory_Card_Bad)
return TRUE;
else
return FALSE;
#else
return TRUE;
#endif
}
VOID CardDetectTimerExpired(UNSIGNED id )
{
BOOL bCF, bMS;
#if _VCC_ON_OFF_TEST
static BOOL bVcc;
if(bVcc)
CardVccOff();
else
CardVccOn();
bVcc = !bVcc;
#endif
/*
check CF card connect pin...
*/
bCF = CardDetectCF();
bMS = CardDetectMS_SD_SM();
if(GetMainMode() == MODE_NORMAL_MCARD1 && bCF != gConnected_CF )
{
gConnected_CF = bCF;
if(bCF)
{
SysPrintf("\n[MCARD] CF inserted!!");
myKeyMsgSender(RC_KEY_MCARD_INSERT);
}
else
{
SysPrintf("\n[MCARD] CF removed!!");
myKeyMsgSender(RC_KEY_MCARD_REMOVE);
}
}
/*
check MS_SD_SM card connect pin...
*/
if(GetMainMode() == MODE_NORMAL_MCARD2 && bMS != gConnected_MS_SD_SM )
{
gConnected_MS_SD_SM = bMS;
if(bMS)
{
SysPrintf("\n[MCARD] MS/SD/SM inserted!!");
myKeyMsgSender(RC_KEY_MCARD_INSERT);
}
else
{
SysPrintf("\n[MCARD] MS/SD/SM removed!!");
myKeyMsgSender(RC_KEY_MCARD_REMOVE);
}
}
}
VOID CardDetectTimerPreInit(VOID)
{
SysSetTimer( &gTimer_McardMonitor, "MCARD_T", CardDetectTimerExpired,
0, 2000, 2000, TIMER_DISABLE, NULL );
}
VOID CardDetectTimerEnable(BOOL cf, BOOL ms)
{
gConnected_CF = cf;
gConnected_MS_SD_SM = ms;
SysPrintf("\n[MCARD] Timer Enable!!");
SysControlTimer(&gTimer_McardMonitor, TIMER_DISABLE, NULL);
SysControlTimer(&gTimer_McardMonitor, TIMER_ENABLE, NULL);
}
VOID CardDetectTimerDisable(VOID)
{
SysPrintf("\n[MCARD] Timer Disable!!");
SysControlTimer(&gTimer_McardMonitor, TIMER_DISABLE, NULL);
}
#endif
#if _APP_CAP_FUNC_SCART
#if 1 // zb 060429
void SetScartVol(S5H_ScartOutMode_t mode, S5H_ScartOutRatio_t ratio)
{
#ifdef _RELEASE
#if _COP_ROCO_BOARD
switch (mode)
{
case SCART_OUT_CVBS:
ClrP02();
break;
case SCART_OUT_RGB:
SetP02();
break;
}
switch (ratio)
{
case SCART_OUT_TV:
SetP01();
break;
case SCART_OUT_16_9:
ClrP01();
SetP00();
break;
case SCART_OUT_4_3:
ClrP01();
ClrP00();
break;
}
#else
switch (mode)
{
case SCART_OUT_CVBS:
ClrP02();
break;
case SCART_OUT_RGB:
SetP02();
break;
}
switch (ratio)
{
case SCART_OUT_TV:
SetP03();
break;
case SCART_OUT_16_9:
ClrP03();
SetP04();
break;
case SCART_OUT_4_3:
ClrP03();
ClrP04();
break;
}
#endif
#endif
}
#else
void SetScartVol(S5H_VideoMode_t mode,unsigned char tvtype)
{
if(mode == 0xFF){
RelPrintf("mode1 = 1 mode2 = 1 GRB sw = 1\n");
SysPrintf("mode1 = 1 mode2 = 1 GRB sw = 1\n");
SET_MODE1();
SET_MODE2();
SET_RGB_SW();
}
//CVBS/SCART select by P03
else{
switch(tvtype){
case SET_TV_TYPE_WIDE:
RelPrintf("mode1 = 0 mode2 = 1 ");
SysPrintf("mode1 = 0 mode2 = 1 ");
CLR_MODE1();
SET_MODE2();
break;
default:
RelPrintf("mode1 = 0 mode2 = 0");
SysPrintf("mode1 = 0 mode2 = 0");
CLR_MODE1();
CLR_MODE2();
break;
}
if(mode==VIDEO_OUT_SCART){
SET_RGB_SW();
RelPrintf("RGB_SW = 1\n");
SysPrintf("RGB_SW = 1\n");
}
else{
CLR_RGB_SW();
RelPrintf("RGB_SW = 0\n");
SysPrintf("RGB_SW = 0\n");
}
}
}
#endif
#endif
#endif /* _GPIO_API_C_ */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -