55 #include <sys/clock.h>
60 static volatile clock_time_t ticks;
61 static volatile unsigned long seconds;
73 #if (CLOCK_CONF_SECOND & (CLOCK_CONF_SECOND - 1)) != 0
74 #error CLOCK_CONF_SECOND must be a power of two (i.e., 1, 2, 4, 8, 16, 32, 64, ...).
75 #error Change CLOCK_CONF_SECOND in contiki-conf.h.
101 #define CLOCK_INIT(XX) \
107 pic32_timer##XX##_init(CLOCK_SECOND);\
108 pic32_timer##XX##_enable_irq(); \
109 pic32_timer##XX##_start(); \
112 #if PIC32_TIMER_CLOCK == 1
114 #elif PIC32_TIMER_CLOCK == 2
116 #elif PIC32_TIMER_CLOCK == 3
118 #elif PIC32_TIMER_CLOCK == 4
120 #elif PIC32_TIMER_CLOCK == 5
131 asm volatile(
"mfc0 %0, $9" :
"=r"(now));
138 asm volatile(
"mfc0 %0, $9" :
"=r"(now));
139 if((int32_t)(now - stop) >= 0) {
156 #if PIC32_TIMER_CLOCK == 1
157 TIMER_INTERRUPT(1, clock_callback);
158 #elif PIC32_TIMER_CLOCK == 2
159 TIMER_INTERRUPT(2, clock_callback);
160 #elif PIC32_TIMER_CLOCK == 3
161 TIMER_INTERRUPT(3, clock_callback);
162 #elif PIC32_TIMER_CLOCK == 4
163 TIMER_INTERRUPT(4, clock_callback);
164 #elif PIC32_TIMER_CLOCK == 5
165 TIMER_INTERRUPT(5, clock_callback);
void clock_delay_usec(uint16_t dt)
Delay a given number of microseconds.
INTERRUPT interface for PIC32MX (pic32mx795f512l)
uint32_t pic32_clock_get_system_clock(void)
Calculate the system clock.
CLOCK interface for PIC32MX (pic32mx795f512l)
CCIF clock_time_t clock_time(void)
Get the current clock time.
TIMER interface for PIC32MX (pic32mx795f512l)
void etimer_request_poll(void)
Make the event timer aware that the clock has changed.
void clock_set_seconds(unsigned long sec)
Set the value of the platform seconds.
CCIF unsigned long clock_seconds(void)
Get the current value of the platform seconds.
int etimer_pending(void)
Check if there are any non-expired event timers.
void clock_delay(unsigned int delay)
Obsolete delay function but we implement it here since some code still uses it.
#define CLOCK_SECOND
A second, measured in system clock time.