Channel check interval is clock_time_t

Fix channel_check_interval routine in struct rdc_driver to be of type
clock_time_t -- otherwise this may overflow on some architectures.
This commit is contained in:
Ralf Schlatterbeck 2016-05-07 11:46:27 +02:00
parent 0232e6c9dc
commit d7e6935ec2
11 changed files with 13 additions and 11 deletions

View file

@ -544,7 +544,9 @@ send_packet(mac_callback_t mac_callback, void *mac_callback_ptr,
int strobes; int strobes;
uint8_t got_strobe_ack = 0; uint8_t got_strobe_ack = 0;
uint8_t is_broadcast = 0; uint8_t is_broadcast = 0;
#if WITH_PHASE_OPTIMIZATION
uint8_t is_known_receiver = 0; uint8_t is_known_receiver = 0;
#endif
uint8_t collisions; uint8_t collisions;
int transmit_len; int transmit_len;
int ret; int ret;
@ -1067,7 +1069,7 @@ turn_off(int keep_radio_on)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
duty_cycle(void) duty_cycle(void)
{ {
return (1ul * CLOCK_SECOND * CYCLE_TIME) / RTIMER_ARCH_SECOND; return (1ul * CLOCK_SECOND * CYCLE_TIME) / RTIMER_ARCH_SECOND;

View file

@ -918,7 +918,7 @@ turn_off(int keep_radio_on)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return (1ul * CLOCK_SECOND * DEFAULT_PERIOD) / RTIMER_ARCH_SECOND; return (1ul * CLOCK_SECOND * DEFAULT_PERIOD) / RTIMER_ARCH_SECOND;

View file

@ -70,7 +70,7 @@ off(int keep_radio_on)
return 0; return 0;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;

View file

@ -87,7 +87,7 @@ off(int keep_radio_on)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;

View file

@ -343,7 +343,7 @@ off(int keep_radio_on)
} }
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;

View file

@ -86,7 +86,7 @@ struct rdc_driver {
int (* off)(int keep_radio_on); int (* off)(int keep_radio_on);
/** Returns the channel check interval, expressed in clock_time_t ticks. */ /** Returns the channel check interval, expressed in clock_time_t ticks. */
unsigned short (* channel_check_interval)(void); clock_time_t (* channel_check_interval)(void);
}; };
#endif /* RDC_H_ */ #endif /* RDC_H_ */

View file

@ -251,7 +251,7 @@ init(void)
NETSTACK_RADIO.on(); NETSTACK_RADIO.on();
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;

View file

@ -76,7 +76,7 @@ off(int keep_radio_on)
return keep_radio_on; return keep_radio_on;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
cca(void) cca(void)
{ {
return 0; return 0;

View file

@ -72,7 +72,7 @@ off(int keep_radio_on)
return keep_radio_on; return keep_radio_on;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
cca(void) cca(void)
{ {
return 0; return 0;

View file

@ -170,7 +170,7 @@ off(int keep_radio_on)
return 1; return 1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;

View file

@ -170,7 +170,7 @@ off(int keep_radio_on)
return 1; return 1;
} }
/*---------------------------------------------------------------------------*/ /*---------------------------------------------------------------------------*/
static unsigned short static clock_time_t
channel_check_interval(void) channel_check_interval(void)
{ {
return 0; return 0;