forked from xuos/xiuos
Format rtc and watchdog driver for hc32
This commit is contained in:
parent
e6fa8a2603
commit
bfe1e72378
|
@ -42,10 +42,22 @@ static uint32 WdtConfigure(void *drv, struct BusConfigureInfo *args)
|
|||
NULL_PARAM_CHECK(args);
|
||||
|
||||
stc_wdt_init_t stcWdtInit;
|
||||
|
||||
int period_option = *((int*)args->private_data);
|
||||
if(period_option<=256){
|
||||
period_option = WDT_CNT_PERIOD256;
|
||||
}else if(period_option<=4096){
|
||||
period_option = WDT_CNT_PERIOD4096;
|
||||
}else if(period_option<=16384){
|
||||
period_option = WDT_CNT_PERIOD16384;
|
||||
}else{
|
||||
period_option = WDT_CNT_PERIOD65536;
|
||||
}
|
||||
|
||||
switch (args->configure_cmd)
|
||||
{
|
||||
case OPER_WDT_SET_TIMEOUT:
|
||||
stcWdtInit.u32CountPeriod = WDT_CNT_PERIOD65536;
|
||||
stcWdtInit.u32CountPeriod = period_option;
|
||||
stcWdtInit.u32ClockDiv = WDT_CLK_DIV1024;
|
||||
stcWdtInit.u32RefreshRange = WDT_RANGE_0TO25PCT;
|
||||
stcWdtInit.u32LPMCount = WDT_LPM_CNT_STOP;
|
||||
|
|
Loading…
Reference in New Issue