unsigned long
CheckForceUpdate(void)
{
//unsigned long *pulApp;
#ifdef ENABLE_UPDATE_CHECK//定义过
//
// Enable the required GPIO module.
//
HWREG(SYSCTL_RCGC2) = SYSCTL_RCGC2_GPIOF;//FORCED_UPDATE_PERIPH; //使能端口F时钟
#endif
//
// See if the first location is 0xffffffff or something that does not
// look like a stack pointer, or if the second location is 0xffffffff or
// something that does not look like a reset vector.
//
/*pulApp = (unsigned long *)APP_START_ADDRESS;
if((pulApp[0] == 0xffffffff) || ((pulApp[0]& 0xfff00000) != 0x20000000) ||
(pulApp[1] == 0xffffffff) || ((pulApp[1]& 0xfff00001) != 0x00000001))
{
return(1);
}
*/
#ifdef ENABLE_UPDATE_CHECK//定义过
//
// Enable the pin used to see if an update is being requested.
//
HWREG(GPIO_PORTF_BASE+GPIO_O_DIR)|=0<<1; //方向,这句是我自己加的,例程中没有设置引脚方向
HWREG(GPIO_PORTF_BASE + GPIO_O_DEN) |= 1 << 1;//设置为数字使能
//
// Wait a while before reading the pin.
//
Delay(1000);
//
// Check the pin to see if an update is being requested.
//
/*if(HWREG(FORCED_UPDATE_PORT + (1 << (FORCED_UPDATE_PIN + 2))) ==//这是它原始的读引脚数据,看不懂,我自己写了一个
(FORCED_UPDATE_POLARITY << FORCED_UPDATE_PIN))
{
return(1);
}*/
if(HWREG(GPIO_PORTF_BASE )&0x00000002 ==0x00000000)//判断引脚值,为0则进入串口更新程序
{
return(1);
}
#endif
//
// No update was needed or requested.
//
return(0);
}