rtimer: homogenize clock size configuration
This commit is contained in:
parent
ff7c3ee042
commit
f339747218
@ -80,8 +80,7 @@ typedef long off_t;
|
||||
#define CLOCK_CONF_SECOND 128UL
|
||||
|
||||
/* Use 16-bit rtimer (default in Contiki-NG is 32) */
|
||||
typedef unsigned short rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a,b) ((signed short)((a)-(b)))
|
||||
#define RTIMER_CONF_CLOCK_SIZE 2
|
||||
|
||||
typedef int spl_t;
|
||||
spl_t splhigh_(void);
|
||||
|
@ -113,8 +113,9 @@ typedef unsigned short uip_stats_t;
|
||||
|
||||
#define CLOCK_CONF_SECOND 1000L
|
||||
typedef unsigned long clock_time_t;
|
||||
typedef uint64_t rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a,b) ((int64_t)((a)-(b)))
|
||||
|
||||
/* Use 64-bit rtimer (default in Contiki-NG is 32) */
|
||||
#define RTIMER_CONF_CLOCK_SIZE 8
|
||||
|
||||
#define RADIO_DELAY_BEFORE_TX 0
|
||||
#define RADIO_DELAY_BEFORE_RX 0
|
||||
|
@ -55,12 +55,34 @@
|
||||
|
||||
#include "contiki.h"
|
||||
|
||||
#ifndef RTIMER_CLOCK_DIFF
|
||||
/* By default: 32-bit rtimer. Set RTIMER_CLOCK_DIFF for custom rtimer width */
|
||||
typedef uint32_t rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b)))
|
||||
#endif /* RTIMER_CLOCK_DIFF */
|
||||
/** \brief The rtimer size (in bytes) */
|
||||
#ifdef RTIMER_CONF_CLOCK_SIZE
|
||||
#define RTIMER_CLOCK_SIZE RTIMER_CONF_CLOCK_SIZE
|
||||
#else /* RTIMER_CONF_CLOCK_SIZE */
|
||||
/* Default: 32bit rtimer*/
|
||||
#define RTIMER_CLOCK_SIZE 4
|
||||
#endif /* RTIMER_CONF_CLOCK_SIZE */
|
||||
|
||||
#if RTIMER_CLOCK_SIZE == 2
|
||||
/* 16-bit rtimer */
|
||||
typedef uint16_t rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a,b) ((int16_t)((a)-(b)))
|
||||
|
||||
#elif RTIMER_CLOCK_SIZE == 4
|
||||
/* 32-bit rtimer */
|
||||
typedef uint32_t rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a, b) ((int32_t)((a) - (b)))
|
||||
|
||||
#elif RTIMER_CLOCK_SIZE == 8
|
||||
/* 64-bit rtimer */
|
||||
typedef uint64_t rtimer_clock_t;
|
||||
#define RTIMER_CLOCK_DIFF(a,b) ((int64_t)((a)-(b)))
|
||||
|
||||
#else
|
||||
#error Unsupported rtimer size (check RTIMER_CLOCK_SIZE)
|
||||
#endif
|
||||
|
||||
#define RTIMER_CLOCK_MAX ((rtimer_clock_t)-1)
|
||||
#define RTIMER_CLOCK_LT(a, b) (RTIMER_CLOCK_DIFF((a),(b)) < 0)
|
||||
|
||||
#include "rtimer-arch.h"
|
||||
|
Loading…
Reference in New Issue
Block a user