100 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
		
		
			
		
	
	
			100 lines
		
	
	
		
			2.5 KiB
		
	
	
	
		
			C
		
	
	
	
	
	
| 
								 | 
							
								#include "os_types.h"
							 | 
						||
| 
								 | 
							
								#include "dbg_io.h"
							 | 
						||
| 
								 | 
							
								#include "iot_diag.h"
							 | 
						||
| 
								 | 
							
								#include "iot_io.h"
							 | 
						||
| 
								 | 
							
								#include "rtc_hw.h"
							 | 
						||
| 
								 | 
							
								#include "gp_timer.h"
							 | 
						||
| 
								 | 
							
								#include "iot_clock.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#include "pmm_hw.h"
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#define PMM_EN       1
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								int IRAM_ATTR main(void)
							 | 
						||
| 
								 | 
							
								{
							 | 
						||
| 
								 | 
							
								    gp_timer_init();
							 | 
						||
| 
								 | 
							
								    gp_timer_set(0, 1*10000000, 1);
							 | 
						||
| 
								 | 
							
								    gp_timer_start(0);
							 | 
						||
| 
								 | 
							
								    dbg_uart_init();
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(0, 0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(1, 0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(2, 0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(3, 0);
							 | 
						||
| 
								 | 
							
								#if PMM_EN
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(4, 0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(5, 0);
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(2);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(3);
							 | 
						||
| 
								 | 
							
								#if PMM_EN
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(4);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_cnt_clr(5);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    pmm_lp_ctrl_en(LP_DIG_RTC_WAKEUP, 1);
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								    iot_printf("--------TEST-----------\r\n");
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(0, 0xfffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(0,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(0, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(0);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(0, 1);
							 | 
						||
| 
								 | 
							
								    iot_delay_us(1000000);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(1, 0xeffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(1,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(1, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(1, 1);
							 | 
						||
| 
								 | 
							
								    iot_delay_us(1000000);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(2, 0xdffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(2,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(2, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(2);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(2, 1);
							 | 
						||
| 
								 | 
							
								    iot_delay_us(1000000);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(3, 0xcffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(3,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(3, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(3);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(3, 1);
							 | 
						||
| 
								 | 
							
								    iot_delay_us(1000000);
							 | 
						||
| 
								 | 
							
								#if PMM_EN
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(4, 0xbffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(4,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(4, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(4);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(4, 1);
							 | 
						||
| 
								 | 
							
								    iot_delay_us(1000000);
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    rtc_tmr_set_value(5, 0xaffff);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_mode_set(5,1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_en(5, 1);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_init(5);
							 | 
						||
| 
								 | 
							
								    rtc_tmr_int_en(5, 1);
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    while(1) {
							 | 
						||
| 
								 | 
							
								        iot_delay_us(10000000);
							 | 
						||
| 
								 | 
							
								#if PMM_EN
							 | 
						||
| 
								 | 
							
								        iot_printf("TMR:: 0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \r\n status:  0x%x, 0x%x, 0x%x, 0x%x, 0x%x, 0x%x \n",rtc_tmr_get_curr_value(0),rtc_tmr_get_curr_value(1), \
							 | 
						||
| 
								 | 
							
								          rtc_tmr_get_curr_value(2),rtc_tmr_get_curr_value(3),rtc_tmr_get_curr_value(4),rtc_tmr_get_curr_value(5),rtc_tmr_get_int_status(0),rtc_tmr_get_int_status(1), \
							 | 
						||
| 
								 | 
							
								          rtc_tmr_get_int_status(2),rtc_tmr_get_int_status(3),rtc_tmr_get_int_status(4),rtc_tmr_get_int_status(5));
							 | 
						||
| 
								 | 
							
								#else
							 | 
						||
| 
								 | 
							
								        iot_printf("TMR:: 0x%x, 0x%x, 0x%x, 0x%x \r\n status:  0x%x, 0x%x, 0x%x, 0x%x \n",rtc_tmr_get_curr_value(0),rtc_tmr_get_curr_value(1), \
							 | 
						||
| 
								 | 
							
								          rtc_tmr_get_curr_value(2),rtc_tmr_get_curr_value(3),rtc_tmr_get_int_status(0),rtc_tmr_get_int_status(1), \
							 | 
						||
| 
								 | 
							
								          rtc_tmr_get_int_status(2),rtc_tmr_get_int_status(3));
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								#endif
							 | 
						||
| 
								 | 
							
								    }
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								    return 0;
							 | 
						||
| 
								 | 
							
								}
							 | 
						||
| 
								 | 
							
								
							 |