From 22cbced03734cfb51142c62031a1c31e9937c8f9 Mon Sep 17 00:00:00 2001 From: Simon Duquennoy Date: Thu, 4 Oct 2018 10:38:18 +0200 Subject: [PATCH] TSCH: timeslot timing templates as const --- arch/cpu/cc2538/dev/cc2538-rf.c | 2 +- arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c | 2 +- arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c | 2 +- arch/dev/cc1200/cc1200-rf-cfg.h | 2 +- arch/dev/cc1200/cc1200.c | 2 +- arch/dev/cc2420/cc2420-tsch-15ms.c | 2 +- arch/platform/sky/contiki-conf.h | 2 +- os/net/mac/tsch/tsch-timeslot-timing.c | 2 +- os/net/mac/tsch/tsch.h | 2 +- 9 files changed, 9 insertions(+), 9 deletions(-) diff --git a/arch/cpu/cc2538/dev/cc2538-rf.c b/arch/cpu/cc2538/dev/cc2538-rf.c index fdda8ccf9..5a8bb8d6f 100644 --- a/arch/cpu/cc2538/dev/cc2538-rf.c +++ b/arch/cpu/cc2538/dev/cc2538-rf.c @@ -977,7 +977,7 @@ get_object(radio_param_t param, void *dest, size_t size) if(size != sizeof(uint16_t *) || !dest) { return RADIO_RESULT_INVALID_VALUE; } - *(uint16_t **)dest = tsch_timeslot_timing_us_10000; + *(const uint16_t **)dest = tsch_timeslot_timing_us_10000; return RADIO_RESULT_OK; } #endif /* MAC_CONF_WITH_TSCH */ diff --git a/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c b/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c index b1d4b2064..ad19b5769 100644 --- a/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c +++ b/arch/dev/cc1200/cc1200-802154g-863-870-fsk-50kbps.c @@ -94,7 +94,7 @@ static const char rf_cfg_descriptor[] = "802.15.4g 863-870MHz MR-FSK mode #1"; ) /* TSCH timeslot timing (mircoseconds) */ -static uint16_t cc1200_50kbps_tsch_timing[tsch_ts_elements_count] = { +static const uint16_t cc1200_50kbps_tsch_timing[tsch_ts_elements_count] = { CC1200_TSCH_DEFAULT_TS_CCA_OFFSET, CC1200_TSCH_DEFAULT_TS_CCA, CC1200_TSCH_DEFAULT_TS_TX_OFFSET, diff --git a/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c b/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c index 506fad801..29beef6c0 100644 --- a/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c +++ b/arch/dev/cc1200/cc1200-868-4gfsk-1000kbps.c @@ -86,7 +86,7 @@ static const char rf_cfg_descriptor[] = "868MHz 2-GFSK 1000 kbps"; ) /* TSCH timeslot timing (in rtimer ticks) */ -static uint16_t cc1200_1000kbps_tsch_timing[tsch_ts_elements_count] = { +static const uint16_t cc1200_1000kbps_tsch_timing[tsch_ts_elements_count] = { CC1200_TSCH_DEFAULT_TS_CCA_OFFSET, CC1200_TSCH_DEFAULT_TS_CCA, CC1200_TSCH_DEFAULT_TS_TX_OFFSET, diff --git a/arch/dev/cc1200/cc1200-rf-cfg.h b/arch/dev/cc1200/cc1200-rf-cfg.h index d047f772e..3042ffdd5 100644 --- a/arch/dev/cc1200/cc1200-rf-cfg.h +++ b/arch/dev/cc1200/cc1200-rf-cfg.h @@ -97,7 +97,7 @@ typedef struct cc1200_rf_cfg { /* The bitrate in bps */ uint32_t bitrate; /* TSCH timeslot timing */ - uint16_t *tsch_timing; + const uint16_t *tsch_timing; } cc1200_rf_cfg_t; /*---------------------------------------------------------------------------*/ #endif /* CC1200_RF_CFG_H */ diff --git a/arch/dev/cc1200/cc1200.c b/arch/dev/cc1200/cc1200.c index a44454564..5f76e4817 100644 --- a/arch/dev/cc1200/cc1200.c +++ b/arch/dev/cc1200/cc1200.c @@ -1477,7 +1477,7 @@ get_object(radio_param_t param, void *dest, size_t size) if(size != sizeof(uint16_t *) || !dest) { return RADIO_RESULT_INVALID_VALUE; } - *(uint16_t **)dest = CC1200_RF_CFG.tsch_timing; + *(const uint16_t **)dest = CC1200_RF_CFG.tsch_timing; return RADIO_RESULT_OK; } #endif /* MAC_CONF_WITH_TSCH */ diff --git a/arch/dev/cc2420/cc2420-tsch-15ms.c b/arch/dev/cc2420/cc2420-tsch-15ms.c index 6f79bff91..b3b825584 100644 --- a/arch/dev/cc2420/cc2420-tsch-15ms.c +++ b/arch/dev/cc2420/cc2420-tsch-15ms.c @@ -45,7 +45,7 @@ * \brief 15ms TSCH timeslot timings, required for cc2420 platforms as * they are unable to keep up with the defulat 10ms timeslots. */ -uint16_t tsch_timeslot_timing_us_15000[tsch_ts_elements_count] = { +const uint16_t tsch_timeslot_timing_us_15000[tsch_ts_elements_count] = { 1800, /* CCAOffset */ 128, /* CCA */ 4000, /* TxOffset */ diff --git a/arch/platform/sky/contiki-conf.h b/arch/platform/sky/contiki-conf.h index 634b77ca9..82e391164 100644 --- a/arch/platform/sky/contiki-conf.h +++ b/arch/platform/sky/contiki-conf.h @@ -18,7 +18,7 @@ #endif /* NETSTACK_CONF_RADIO */ /* TSCH 15ms timeslot timing template, required for cc2420 */ -extern uint16_t tsch_timeslot_timing_us_15000[]; +extern const uint16_t tsch_timeslot_timing_us_15000[]; /* The TSCH default slot length of 10ms is a bit too short for this platform, * use 15ms instead. */ diff --git a/os/net/mac/tsch/tsch-timeslot-timing.c b/os/net/mac/tsch/tsch-timeslot-timing.c index 13b05851b..a75676101 100644 --- a/os/net/mac/tsch/tsch-timeslot-timing.c +++ b/os/net/mac/tsch/tsch-timeslot-timing.c @@ -61,7 +61,7 @@ * (TxOffset - (RxWait / 2)) instead */ -uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count] = { +const uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count] = { 1800, /* CCAOffset */ 128, /* CCA */ 2120, /* TxOffset */ diff --git a/os/net/mac/tsch/tsch.h b/os/net/mac/tsch/tsch.h index 3cda54d96..5eed691cd 100644 --- a/os/net/mac/tsch/tsch.h +++ b/os/net/mac/tsch/tsch.h @@ -181,7 +181,7 @@ extern unsigned long sync_count; extern int32_t min_drift_seen; extern int32_t max_drift_seen; /* The TSCH standard 10ms timeslot timing */ -extern uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count]; +extern const uint16_t tsch_timeslot_timing_us_10000[tsch_ts_elements_count]; /* TSCH processes */ PROCESS_NAME(tsch_process);