📄 power.c
字号:
#endif
pIOPort->GPFDAT &=~ (0xff<<0);
pIOPort->GPFDAT |= ((0x0<<7)|(0x0<<6)|(0x0<<5)|(0x0<<4)|(0x0<<3)|(0x0<<2)|(0x0<<1)|(0x0<<0));
//GPG
pIOPort->GPGCON &=~(0xffff<<0);
pIOPort->GPGCON |= ((0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x2<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
pIOPort->GPGUDP &=~(0xffff<<0);
#ifdef EVT1
pIOPort->EXTINT1 = (READEXTINT1(pIOPort->EXTINT1) | (0<<31) | (0<<27) | (0<<23) | (0<<19) | (1<<15) | (0<<11) | (0<<7)| (0<<0) );
#else
pIOPort->GPGUDP |= ((0x2<<14)|(0x2<<12)|(0x1<<10)|(0x1<<8)|(0x1<<6)|(0x1<<4)|(0x1<<2)|(0x1<<0));
#endif
pIOPort->GPGDAT &=~ (0xff<<0);
pIOPort->GPGDAT |= ((0x1<<7)|(0x0<<6)|(0x1<<5)|(0x1<<4)|(0x0<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
//GPA
#ifdef EVT1
pIOPort->GPACDH = (READGPACDH(pIOPort->GPACDL,pIOPort->GPACDH) | (1<<16) | (1<<5)); //GPACDH[16] is exclusive use of nRSTOUT and '1' is PRESET
#else
pIOPort->GPACON &=~(0x1<<21);
pIOPort->GPACON |= ((0x0<<21));//Set GPA21 as Output(default : nRSTOUT)
pIOPort->GPADAT &=~ (0x7<<21);//Clear GPA21~23
pIOPort->GPADAT |= ((0x1<<21));//Set GPA21(DAT) as '1'
#endif
// DP0 / DN0
pIOPort->MISCCR |= (1<<12); //Set USB port as suspend mode
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_OP2 IO
// GPB[10:0], GPH[12:0], GPE[15:14], GPE[4:0]
//GPB
pIOPort->GPBCON &=~(0x3fffff<<0);
#ifdef EVT1
pIOPort->GPBCON |= ((0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x3<<0));
#else
pIOPort->GPBCON |= ((0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x1<<6)|(0x1<<4)|(0x0<<2)|(0x1<<0));
#endif
pIOPort->GPBUDP = (pIOPort->GPBUDP &=~(0x3fffff<<0));
#ifdef EVT1
pIOPort->GPBUDP |= ((0x3<<20)|(0x2<<18)|(0x2<<16)|(0x2<<14)|(0x2<<12)|(0x2<<10)|(0x3<<8)|(0x3<<6)|(0x3<<4)|(0x0<<2)|(0x3<<0));
#else
pIOPort->GPBUDP |= ((0x1<<20)|(0x1<<18)|(0x1<<16)|(0x1<<14)|(0x1<<12)|(0x1<<10)|(0x0<<8)|(0x2<<6)|(0x2<<4)|(0x1<<2)|(0x2<<0));
#endif
//GPE
pIOPort->GPECON &=~((0xf<<28)|(0x3ff<<0));
#ifdef EVT1
pIOPort->GPECON |= ((0x0<<30)|(0x0<<28)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#else
pIOPort->GPECON |= ((0x0<<30)|(0x0<<28)|(0x1<<8)|(0x0<<6)|(0x1<<4)|(0x0<<2)|(0x0<<0));
#endif
pIOPort->GPEUDP &=~((0xf<<28)|(0x3ff<<0));
#ifdef EVT1
pIOPort->GPEUDP |= ((0x0<<30)|(0x0<<28)|(0x0<<8)|(0x3<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#else
pIOPort->GPEUDP |= ((0x2<<30)|(0x2<<28)|(0x2<<8)|(0x1<<6)|(0x2<<4)|(0x1<<2)|(0x1<<0));
#endif
pIOPort->GPEDAT &=~ (0xffff<<0);
pIOPort->GPEDAT |= ((0x1<<15)|(0x1<<14)|(0x1<<4)|(0x1<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
#ifdef EVT1
#else
pIOPort->GPEDAT = 0;
//printf("rgPEcon=%08x, rgPEUDP=%08x, rGPeDAT=%08x\n", rGPECON,rGPEUDP,rGPEDAT);
#endif
//GPG
pIOPort->GPGCON &=~(0xffff<<16);
pIOPort->GPGCON |= ((0x0<<30)|(0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16));
pIOPort->GPGUDP &=~(0xffff<<16);
#ifdef EVT1
pIOPort->GPGUDP |= ((0x2<<30)|(0x0<<28)|(0x3<<26)|(0x3<<24)|(0x0<<22)|(0x3<<20)|(0x3<<18)|(0x3<<16));
#else
pIOPort->GPGUDP |= ((0x0<<30)|(0x1<<28)|(0x1<<26)|(0x1<<24)|(0x1<<22)|(0x2<<20)|(0x2<<18)|(0x1<<16));
#endif
pIOPort->GPGDAT &=~ (0xff<<8);
pIOPort->GPGDAT |= ((0x0<<15)|(0x0<<14)|(0x0<<13)|(0x0<<12)|(0x0<<11)|(0x0<<10)|(0x0<<9)|(0x0<<8));
//GPH
pIOPort->GPHCON &=~(0x3fffffff<<0);
#ifdef EVT1
pIOPort->GPHCON |= ((0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#else
pIOPort->GPHCON |= ((0x1<<28)|(0x0<<26)|(0x0<<24)|(0x1<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#endif
pIOPort->GPHUDP &=~(0x3fffffff<<0);
#ifdef EVT1
pIOPort->GPHUDP |= ((0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x3<<20)|(0x0<<18)|(0x3<<16)|(0x3<<6)|(0x0<<4)|(0x3<<2)|(0x0<<0));
#else
pIOPort->GPHUDP |= ((0x2<<28)|(0x1<<26)|(0x1<<24)|(0x2<<22)|(0x1<<20)|(0x2<<18)|(0x1<<16)|(0x1<<6)|(0x2<<4)|(0x1<<2)|(0x2<<0));
#endif
pIOPort->GPHDAT &=~ (0x7fff<<0);
pIOPort->GPHDAT |= ((0x0<<14)|(0x1<<13)|(0x0<<12)|(0x1<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)|(0x0<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_SD IO
// GPE[13:5], GPL[14:0], GPJ[15:13]
//GPE
pIOPort->GPECON &=~(0x3ffff<<10);
pIOPort->GPECON |= ((0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<14)|(0x0<<12)|(0x0<<10));//Set Input All
pIOPort->GPEUDP &=~(0x3ffff<<10);
#ifdef EVT1
pIOPort->GPEUDP |= ((0x0<<26)|(0x0<<24)|(0x0<<22)|(0x3<<20)|(0x3<<18)|(0x3<<16)|(0x3<<14)|(0x3<<12)|(0x0<<10));
#else
pIOPort->GPEUDP |= ((0x1<<26)|(0x1<<24)|(0x1<<22)|(0x2<<20)|(0x2<<18)|(0x2<<16)\
|(0x2<<14)|(0x2<<12)|(0x1<<10));
#endif
pIOPort->GPEDAT &=~ (0x1ff<<5);
pIOPort->GPEDAT |= ((0x0<<13)|(0x0<<12)|(0x0<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)|(0x0<<7)|(0x1<<6)|(0x1<<5));
//GPL
pIOPort->GPLCON &=~(0x3fffffff<<0);
pIOPort->GPLCON |= ((0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
pIOPort->GPLUDP &=~(0x3fffffff<<0);
#ifdef EVT1
pIOPort->GPLUDP |= ((0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x3<<16)|(0x3<<14)|(0x3<<12)|(0x3<<10)|(0x3<<8)|(0x3<<6)|(0x3<<4)|(0x3<<2)|(0x3<<0));
#else
pIOPort->GPLUDP |= ((0x1<<28)|(0x1<<26)|(0x1<<24)|(0x1<<22)|(0x1<<20)|(0x1<<18)|(0x2<<16)|(0x2<<14)|(0x2<<12)|(0x2<<10)|(0x2<<8)|(0x1<<6)|(0x2<<4)|(0x2<<2)|(0x2<<0));
#endif
pIOPort->GPLDAT &=~ (0x1fff<<0);
pIOPort->GPLDAT |= ((0x0<<14)|(0x0<<13)|(0x0<<12)|(0x0<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)|(0x1<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
//GPJ
pIOPort->GPJCON &=~(0x3f<<26);
pIOPort->GPJCON |= ((0x0<<30)|(0x0<<28)|(0x0<<26));
pIOPort->GPJUDP &=~(0x3f<<26);
#ifdef EVT1
pIOPort->GPJUDP |= ((0x0<<30)|(0x0<<28)|(0x0<<26));
#else
pIOPort->GPJUDP |= ((0x2<<30)|(0x2<<28)|(0x2<<26));
#endif
pIOPort->GPJDAT &=~ (0x7<<13);
pIOPort->GPJDAT |= ((0x1<<15)|(0x1<<14)|(0x1<<13));
#ifdef EVT1
//GPH - This configuration is setting for CFG3(UART) set as [off:off:off:off]
pIOPort->GPHCON &= ~((0x3<<14)|(0x3<<12)|(0x3<<10)|(0x3<<8));
pIOPort->GPHUDP &= ~((0x3<<14)|(0x3<<12)|(0x3<<10)|(0x3<<8));
#endif
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_LCD IO
// GPC[15:0], GPD[15:0]
//GPC
pIOPort->GPCCON &=~(0xffffffff<<0);
pIOPort->GPCCON |= ((0x0<<30)|(0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)\
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
pIOPort->GPCUDP &=~(0xffffffff<<0);
#ifdef EVT1
pIOPort->GPCUDP |= ((0x2<<30)|(0x2<<28)|(0x2<<26)|(0x2<<24)|(0x2<<22)|(0x2<<20)|(0x2<<18)|(0x2<<16)
|(0x2<<14)|(0x2<<12)|(0x2<<10)|(0x2<<8)|(0x2<<6)|(0x2<<4)|(0x2<<2)|(0x2<<0));
#else
pIOPort->GPCUDP |= ((0x0<<30)|(0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#endif
pIOPort->GPCDAT &=~ (0x1fff<<0);
pIOPort->GPCDAT |= ((0x0<<14)|(0x1<<13)|(0x0<<12)|(0x1<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)|(0x0<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
//GPD
pIOPort->GPDCON &=~(0xffffffff<<0);
pIOPort->GPDCON |= ((0x0<<30)|(0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)\
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
pIOPort->GPDUDP &=~(0xffffffff<<0);
#ifdef EVT1
pIOPort->GPDUDP |= ((0x2<<30)|(0x2<<28)|(0x2<<26)|(0x2<<24)|(0x2<<22)|(0x2<<20)|(0x2<<18)|(0x2<<16)\
|(0x2<<14)|(0x2<<12)|(0x2<<10)|(0x2<<8)|(0x2<<6)|(0x2<<4)|(0x2<<2)|(0x2<<0));
#else
pIOPort->GPDUDP |= ((0x0<<30)|(0x0<<28)|(0x0<<26)|(0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)\
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#endif
pIOPort->GPDDAT &=~ (0xffff<<0);
pIOPort->GPDDAT |= ((0x0<<14)|(0x1<<13)|(0x0<<12)|(0x1<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)|(0x0<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_CAM IO
// GPJ[15:0],
//GPJ
pIOPort->GPJCON &=~(0x3ffffff<<0);
pIOPort->GPJCON |= ((0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)\
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
pIOPort->GPJUDP &=~(0x3ffffff<<0);
#ifdef EVT1
pIOPort->GPJUDP |= ((0x2<<24)|(0x2<<22)|(0x2<<20)|(0x2<<18)|(0x2<<16)\
|(0x2<<14)|(0x2<<12)|(0x2<<10)|(0x2<<8)|(0x2<<6)|(0x2<<4)|(0x2<<2)|(0x2<<0));
#else
pIOPort->GPJUDP |= ((0x0<<24)|(0x0<<22)|(0x0<<20)|(0x0<<18)|(0x0<<16)\
|(0x0<<14)|(0x0<<12)|(0x0<<10)|(0x0<<8)|(0x0<<6)|(0x0<<4)|(0x0<<2)|(0x0<<0));
#endif
pIOPort->GPJDAT &=~ (0x1fff<<0);
pIOPort->GPJDAT |= ((0x0<<12)|(0x1<<11)|(0x0<<10)|(0x1<<9)|(0x1<<8)\
|(0x0<<7)|(0x1<<6)|(0x1<<5)|(0x1<<4)|(0x0<<3)|(0x1<<2)|(0x1<<1)|(0x1<<0));
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_RMOP
pIOPort->MSLCON = 0x0;
#ifdef EVT1
pIOPort->GPMCON &=~((0x3<<2) | (0x3<<0));
pIOPort->GPMUDP &=~((0x3<<4) |(0x3<<2) | (0x3<<0));
pIOPort->GPMUDP |= ((0x3<<4) | (0x3<<2) | (0x3<<0));
#endif
///////////////////////////////////////////////////////////////////////////////////////////
// VDD_SMOP : sleep wakeup iteration fail or not?
pIOPort->MSLCON = 0x0;
#ifdef EVT1
pIOPort->DATAPDEN &=~((0x1<<0)|(0x1<<1)|(0x1<<2)|(0x1<<3)|(0x1<<4)|(0x1<<5)); // reset value = 0x3f; --> 0x30 = 2uA
pIOPort->DATAPDEN = (0x3<<4);
#else
pIOPort->GPKUDP &=~((0x1<<0)|(0x1<<1)|(0x1<<2)|(0x1<<3)|(0x1<<4)|(0x1<<5)); // reset value = 0x3f; --> 0x30 = 2uA
pIOPort->GPKUDP |= (0x3<<4);
#endif
#endif
OALMSG(OAL_FUNC, (TEXT("--BSPConfigGPIOforPowerOff()\n")));
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -