本帖最后由 forlinx2013 于 2014-1-24 09:18 编辑
欢迎大家来到飞凌爱板网专区,对嵌入式技术感兴趣的朋友不妨多多关注一下,我们提供了公司所有开发板的所有资料,也会更新大量技术文章,欢迎大家一块学习提高!!!
OK6410添加看门狗流驱动 硬件平台:飞凌OK6410-A 操作系统:飞凌光盘中的BSP,WINCE6.0 编译工具:VS2005 + WINCE6.0 + BSP
① 分别打开C:\WINCE600\PLATFORM\COMMON\SRC\SOC\S3C6410_SEC_V1\OAL\INC\S3C6410_BASE_REGS.H 和C:\WINCE600\PLATFORM\SMDK6410\SRC\INC\BSP_CFG.H 加入 #define ENABLE_WATCH_DOG 1 ② 打开C:\WINCE600\PLATFORM\SMDK6410\SRC\OAL\OALLIB的init.c,看门狗被系统屏蔽(MASK),对寄存器的设置使能,具体如下: 函数:InitializeCLKGating 语句: pSysConReg->PCLK_GATE = (0x7F<<25) // Reserved |(0<<24) // Security Key |(0<<23) // CHIP ID |(0<<22) // SPI1 |(0<<21) // SPI0 |(0<<20) // HSI Receiver |(0<<19) // HSI Transmitter |(1<<18) // GPIO <--- Always On |(0<<17) // IIC |(0<<16) // IIS1 |(0<<15) // IIS0 |(0<<14) // AC97 Interface |(0<<13) // TZPC |(1<<12) // Touch Screen & ADC <--- Always On |(0<<11) // Keypad |(0<<10) // IrDA |(0<<9) // PCM1 |(0<<8) // PCM0 |(1<<7) // PWM Timer <--- Always On |(1<<6) // RTC <--- Always On |(1<<5) // WatchDog Timer jyh 正常的为0<<5 mask WatchDog Timer 修改为1<<5 ③ 打开C:\WINCE600\PLATFORM\COMMON\SRC\SOC\S3C6410_SEC_V1\OAL\TIMER下的watchdog.c文件做如下操作: void RefreshWatchdogTimer (void) { /* static volatile S3C6410_WATCHDOG_REG *pWTDogReg = 0; // VA for Watchdog base
if (!pWTDogReg) { // called the 1st time, setup the watchdog timer pWTDogReg = (S3C6410_WATCHDOG_REG *)OALPAtoVA(S3C6410_BASE_REG_PA_WATCHDOG, FALSE); if (!pWTDogReg) { OALMSG (OAL_ERROR, (L"Address of Watch Dog Base Not Defined, WatchDog not enabled!\r\n")); } else { pWTDogReg->WTCNT = WTCNT_CNT(0xFFFF); pWTDogReg->WTCON = WTCON_PRESCALE(WD_PRESCALER) | WTCON_ENABLE | WTCON_CLK_DIV128 | WTCON_RESET; } } else { // subsequent refresh calls, just reset the counter register to max value pWTDogReg->WTCNT = WTCNT_CNT(0xFFFF); } */ }
④ 打开C:\WINCE600\PLATFORM\SMDK6410\FILES目录下的platform.bib和platform.reg,在platform.bib中加入下面代码:(添加wdg流驱动,驱动源码在下一章节下载) ;------------- wdg Driver ------------------------------------------------------------- IF BSP_NOLED ! wdg.dll $(_FLATRELEASEDIR)\wdg.dll NK SHK ;???? ENDIF BSP_NOLED ! ;---------------------------------------------------------------------------------------
在platform.reg中加入下面代码: ;================= wdg ================== [HKEY_LOCAL_MACHINE\Drivers\BuiltIn\wdg] "Prefix"="wdg" "Dll"="wdg.dll" "Order"=dword:30 "Index"=dword:1
⑤ 然后编译bsp。
|