53 #define RTC_SUBSEC_FRAC ((uint64_t)1 << 32) 58 ti_lib_prcm_power_domain_on(PRCM_DOMAIN_PERIPH);
59 while(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) !=
60 PRCM_DOMAIN_POWER_ON);
75 if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) !=
76 PRCM_DOMAIN_POWER_ON) {
80 ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0);
81 ti_lib_prcm_load_set();
82 while(!ti_lib_prcm_load_get());
85 HWREG(GPT0_BASE + GPT_O_CTL) &= ~(GPT_CTL_TAEN | GPT_CTL_TBEN);
91 ti_lib_timer_configure(GPT0_BASE,
92 TIMER_CFG_SPLIT_PAIR | TIMER_CFG_B_ONE_SHOT);
95 HWREG(GPT0_BASE + GPT_O_CFG) = TIMER_CFG_SPLIT_PAIR >> 24;
103 ti_lib_timer_prescale_set(GPT0_BASE, TIMER_B, 49);
106 HWREG(GPT0_BASE + GPT_O_TBMR) =
107 ((TIMER_CFG_B_ONE_SHOT >> 8) & 0xFF) | GPT_TBMR_TBPWMIE;
110 HWREGBITW(AON_RTC_BASE + AON_RTC_O_CTL, AON_RTC_CTL_RTC_UPD_EN_BITN) = 1;
114 update_clock_variable(
void)
120 uint64_t now = ti_lib_aon_rtc_current_64_bit_value_get();
127 update_clock_variable();
129 return (clock_time_t)(
count & 0xFFFFFFFF);
135 update_clock_variable();
145 return (
unsigned long)ti_lib_aon_rtc_sec_get();
154 while(
clock_time() - start < (clock_time_t)i);
160 uint32_t clock_status;
162 if(ti_lib_prcm_power_domain_status(PRCM_DOMAIN_PERIPH) !=
163 PRCM_DOMAIN_POWER_ON) {
167 clock_status = HWREG(PRCM_BASE + PRCM_O_GPTCLKGR) & PRCM_GPIOCLKGR_CLK_EN;
169 ti_lib_prcm_peripheral_run_enable(PRCM_PERIPH_TIMER0);
170 ti_lib_prcm_load_set();
171 while(!ti_lib_prcm_load_get());
173 ti_lib_timer_load_set(GPT0_BASE, TIMER_B, len);
174 ti_lib_timer_enable(GPT0_BASE, TIMER_B);
180 while(HWREG(GPT0_BASE + GPT_O_CTL) & GPT_CTL_TBEN);
182 if(clock_status == 0) {
183 ti_lib_prcm_peripheral_run_disable(PRCM_PERIPH_TIMER0);
184 ti_lib_prcm_load_set();
185 while(!ti_lib_prcm_load_get());
static volatile uint64_t count
Num.
Header file with macros which rename TI CC26xxware functions.
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
void clock_wait(clock_time_t i)
Wait for a given number of ticks.
unsigned long clock_seconds(void)
Get the current value of the platform seconds.
static void start(void)
Start measurement.
#define CLOCK_SECOND
A second, measured in system clock time.
int etimer_pending(void)
Check if there are any non-expired event timers.
void clock_delay(unsigned int i)
Obsolete delay function but we implement it here since some code still uses it.
clock_time_t clock_time(void)
Get the current clock time.
void clock_init(void)
Arch-specific implementation of clock_init for the cc2538.