Merge branch 'driver_merge_tmp/merge_timer' into 'master'

driver: timer

1. add timer driver code
2. add timer example code
3. replace api for enable interrupt in task_wdt.c

See merge request !237
This commit is contained in:
Wang Jia Lin
2016-11-25 10:52:40 +08:00
9 changed files with 927 additions and 9 deletions

View File

@@ -28,6 +28,7 @@
#include "esp_freertos_hooks.h"
#include "soc/timer_group_struct.h"
#include "soc/timer_group_reg.h"
#include "driver/timer.h"
#include "esp_int_wdt.h"
@@ -85,7 +86,7 @@ void esp_int_wdt_init() {
TIMERG1.wdt_feed=1;
TIMERG1.wdt_wprotect=0;
TIMERG1.int_clr_timers.wdt=1;
TIMERG1.int_ena.wdt=1;
timer_group_intr_enable(TIMER_GROUP_1, TIMG_WDT_INT_ENA_M);
esp_register_freertos_tick_hook(tick_hook);
ESP_INTR_DISABLE(WDT_INT_NUM);
intr_matrix_set(xPortGetCoreID(), ETS_TG1_WDT_LEVEL_INTR_SOURCE, WDT_INT_NUM);
@@ -97,4 +98,4 @@ void esp_int_wdt_init() {
#endif
#endif

View File

@@ -32,6 +32,7 @@
#include "soc/timer_group_struct.h"
#include "soc/timer_group_reg.h"
#include "esp_log.h"
#include "driver/timer.h"
#include "esp_task_wdt.h"
@@ -204,9 +205,9 @@ void esp_task_wdt_init() {
intr_matrix_set(xPortGetCoreID(), ETS_TG0_WDT_LEVEL_INTR_SOURCE, ETS_T0_WDT_INUM);
xt_set_interrupt_handler(ETS_T0_WDT_INUM, task_wdt_isr, NULL);
TIMERG0.int_clr_timers.wdt=1;
TIMERG0.int_ena.wdt=1;
timer_group_intr_enable(TIMER_GROUP_0, TIMG_WDT_INT_ENA_M);
ESP_INTR_ENABLE(ETS_T0_WDT_INUM);
}
#endif
#endif