diff --git a/drivers/cc110x/arch_cc1100.h b/drivers/cc110x/arch_cc1100.h index 461ae74f6b..f9ce5e87f2 100644 --- a/drivers/cc110x/arch_cc1100.h +++ b/drivers/cc110x/arch_cc1100.h @@ -14,13 +14,13 @@ /** * @file - * @ingroup LPC2387 - * @brief CC1100 LPC2387 dependend functions + * @ingroup LPC2387 + * @brief CC1100 LPC2387 dependend functions * - * @author Heiko Will + * @author Heiko Will * @version $Revision: 1775 $ * - * @note $Id: arch_cc1100.h 1775 2010-01-26 09:37:03Z hillebra $ + * @note $Id: arch_cc1100.h 1775 2010-01-26 09:37:03Z hillebra $ */ #include diff --git a/drivers/cc110x/cc1100-csmaca-mac.c b/drivers/cc110x/cc1100-csmaca-mac.c index 4af3dd94cb..ec3bb7308e 100644 --- a/drivers/cc110x/cc1100-csmaca-mac.c +++ b/drivers/cc110x/cc1100-csmaca-mac.c @@ -14,14 +14,14 @@ and Telematics group (http://cst.mi.fu-berlin.de). /** * @file - * @ingroup dev_cc110x - * @brief ScatterWeb MSB-A2 mac-layer + * @ingroup dev_cc110x + * @brief ScatterWeb MSB-A2 mac-layer * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 2128 $ * - * @note $Id: cc1100-csmaca-mac.c 2128 2010-05-12 12:07:59Z hillebra $ + * @note $Id: cc1100-csmaca-mac.c 2128 2010-05-12 12:07:59Z hillebra $ */ #include @@ -139,16 +139,16 @@ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priorit min_window_size *= 4; } - uint16_t windowSize = min_window_size; /* Start with window size of PRIO_XXX_MIN_WINDOW_SIZE */ - uint16_t backoff = 0; /* Backoff between 1 and windowSize */ - uint32_t total; /* Holds the total wait time before send try */ - uint32_t cs_timeout; /* Current carrier sense timeout value */ + uint16_t windowSize = min_window_size; /* Start with window size of PRIO_XXX_MIN_WINDOW_SIZE */ + uint16_t backoff = 0; /* Backoff between 1 and windowSize */ + uint32_t total; /* Holds the total wait time before send try */ + uint32_t cs_timeout; /* Current carrier sense timeout value */ if (protocol == 0) { - return RADIO_INVALID_PARAM; /* Not allowed, protocol id must be greater zero */ + return RADIO_INVALID_PARAM; /* Not allowed, protocol id must be greater zero */ } - cc1100_phy_mutex_lock(); /* Lock radio for exclusive access */ + cc1100_phy_mutex_lock(); /* Lock radio for exclusive access */ /* Get carrier sense timeout based on overall error rate till now */ send_csmaca_calls++; @@ -164,7 +164,7 @@ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priorit cs_timeout = CARRIER_SENSE_TIMEOUT_MIN; } - cc1100_cs_init(); /* Initialize carrier sensing */ + cc1100_cs_init(); /* Initialize carrier sensing */ window: @@ -172,36 +172,36 @@ window: goto cycle; /* If backoff was 0 */ } - windowSize *= 2; /* ...double the current window size */ + windowSize *= 2; /* ...double the current window size */ if (windowSize > max_window_size) { - windowSize = max_window_size; /* This is the maximum size allowed */ + windowSize = max_window_size; /* This is the maximum size allowed */ } - backoff = rand() % windowSize; /* ...and choose new backoff */ + backoff = rand() % windowSize; /* ...and choose new backoff */ backoff += (uint16_t) 1; cycle: - cs_timeout_flag = 0; /* Carrier sense timeout flag */ - cs_hwtimer_id = hwtimer_set(cs_timeout, /* Set hwtimer to set CS timeout flag */ + cs_timeout_flag = 0; /* Carrier sense timeout flag */ + cs_hwtimer_id = hwtimer_set(cs_timeout, /* Set hwtimer to set CS timeout flag */ cs_timeout_cb, NULL); - while (cc1100_cs_read()) { /* Wait until air is free */ + while (cc1100_cs_read()) { /* Wait until air is free */ if (cs_timeout_flag) { send_csmaca_calls_cs_timeout++; #ifndef CSMACA_MAC_AGGRESSIVE_MODE cc1100_phy_mutex_unlock(); - cc1100_go_after_tx(); /* Go from RX to default mode */ - return RADIO_CS_TIMEOUT; /* Return immediately */ + cc1100_go_after_tx(); /* Go from RX to default mode */ + return RADIO_CS_TIMEOUT; /* Return immediately */ #endif #ifdef CSMACA_MAC_AGGRESSIVE_MODE - goto send; /* Send anyway */ + goto send; /* Send anyway */ #endif } } - hwtimer_remove(cs_hwtimer_id); /* Remove hwtimer */ - cc1100_cs_write_cca(1); /* Air is free now */ + hwtimer_remove(cs_hwtimer_id); /* Remove hwtimer */ + cc1100_cs_write_cca(1); /* Air is free now */ cc1100_cs_set_enabled(true); if (cc1100_cs_read()) { @@ -213,18 +213,18 @@ cycle: backoff--; /* Decrement backoff counter */ } - total = slottime; /* Calculate total wait time */ - total *= (uint32_t)backoff; /* Slot vector set */ - total += difs; /* ...and standard DIFS wait time */ - cs_timeout_flag = 0; /* Carrier sense timeout flag */ - cs_hwtimer_id = hwtimer_set(total, /* Set hwtimer to set CS timeout flag */ + total = slottime; /* Calculate total wait time */ + total *= (uint32_t)backoff; /* Slot vector set */ + total += difs; /* ...and standard DIFS wait time */ + cs_timeout_flag = 0; /* Carrier sense timeout flag */ + cs_hwtimer_id = hwtimer_set(total, /* Set hwtimer to set CS timeout flag */ cs_timeout_cb, NULL); while (!cs_timeout_flag - || !cc1100_cs_read_cca()) { /* Wait until timeout is finished */ - if (cc1100_cs_read_cca() == 0) { /* Is the air still free? */ + || !cc1100_cs_read_cca()) { /* Wait until timeout is finished */ + if (cc1100_cs_read_cca() == 0) { /* Is the air still free? */ hwtimer_remove(cs_hwtimer_id); - goto window; /* No. Go back to new wait period. */ + goto window; /* No. Go back to new wait period. */ } } diff --git a/drivers/cc110x/cc1100-csmaca-mac.h b/drivers/cc110x/cc1100-csmaca-mac.h index 9cf0eee26b..ae5e43910e 100644 --- a/drivers/cc110x/cc1100-csmaca-mac.h +++ b/drivers/cc110x/cc1100-csmaca-mac.h @@ -14,14 +14,14 @@ and Telematics group (http://cst.mi.fu-berlin.de). /** * @file - * @ingroup dev_cc110x - * @brief ScatterWeb MSB-A2 mac-layer + * @ingroup dev_cc110x + * @brief ScatterWeb MSB-A2 mac-layer * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 1999 $ * - * @note $Id: cc1100-csmaca-mac.h 1999 2010-03-16 15:48:18Z hillebra $ + * @note $Id: cc1100-csmaca-mac.h 1999 2010-03-16 15:48:18Z hillebra $ */ #ifndef CC1100_CSMACA_MAC_ @@ -29,26 +29,26 @@ and Telematics group (http://cst.mi.fu-berlin.de). #include "cc1100-defaultSettings.h" -//#define CSMACA_MAC_AGGRESSIVE_MODE // MAC aggressive mode on/off switch +//#define CSMACA_MAC_AGGRESSIVE_MODE // MAC aggressive mode on/off switch -#define CARRIER_SENSE_TIMEOUT (200000) // Carrier Sense timeout ~ 2 seconds -#define CARRIER_SENSE_TIMEOUT_MIN (2000) // Minimum Carrier Sense timeout ~ 20 milliseconds -#define CS_TX_SWITCH_TIME (80) // Carrier Sense to TX switch time (measured ~ 350 us) +#define CARRIER_SENSE_TIMEOUT (200000) // Carrier Sense timeout ~ 2 seconds +#define CARRIER_SENSE_TIMEOUT_MIN (2000) // Minimum Carrier Sense timeout ~ 20 milliseconds +#define CS_TX_SWITCH_TIME (80) // Carrier Sense to TX switch time (measured ~ 350 us) /** All values are in ticks (x10 us) */ -#define PRIO_ALARM_DIFS (200) // DIFS for ALARM packets, the default wait time -#define PRIO_ALARM_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot -#define PRIO_ALARM_MIN_WINDOW_SIZE (2) // Minimum window size of backoff algorithm -#define PRIO_ALARM_MAX_WINDOW_SIZE (8) // Maximum window size of backoff algorithm +#define PRIO_ALARM_DIFS (200) // DIFS for ALARM packets, the default wait time +#define PRIO_ALARM_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot +#define PRIO_ALARM_MIN_WINDOW_SIZE (2) // Minimum window size of backoff algorithm +#define PRIO_ALARM_MAX_WINDOW_SIZE (8) // Maximum window size of backoff algorithm -#define PRIO_WARN_DIFS (1000) // DIFS for WARN packets, the default wait time -#define PRIO_WARN_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot -#define PRIO_WARN_MIN_WINDOW_SIZE (2) // Minimum window size of backoff algorithm -#define PRIO_WARN_MAX_WINDOW_SIZE (16) // Maximum window size of backoff algorithm +#define PRIO_WARN_DIFS (1000) // DIFS for WARN packets, the default wait time +#define PRIO_WARN_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot +#define PRIO_WARN_MIN_WINDOW_SIZE (2) // Minimum window size of backoff algorithm +#define PRIO_WARN_MAX_WINDOW_SIZE (16) // Maximum window size of backoff algorithm -#define PRIO_DATA_DIFS (2500) // DIFS for normal data packets, the default wait time -#define PRIO_DATA_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot -#define PRIO_DATA_MIN_WINDOW_SIZE (4) // Minimum window size of backoff algorithm -#define PRIO_DATA_MAX_WINDOW_SIZE (32) // Maximum window size of backoff algorithm +#define PRIO_DATA_DIFS (2500) // DIFS for normal data packets, the default wait time +#define PRIO_DATA_SLOTTIME (CS_TX_SWITCH_TIME) // Time of one additional wait slot +#define PRIO_DATA_MIN_WINDOW_SIZE (4) // Minimum window size of backoff algorithm +#define PRIO_DATA_MAX_WINDOW_SIZE (32) // Maximum window size of backoff algorithm #endif /*CC1100_CSMACA_MAC_*/ diff --git a/drivers/cc110x/cc1100-defaultSettings.c b/drivers/cc110x/cc1100-defaultSettings.c index 6d940ac45f..bb8f11a460 100644 --- a/drivers/cc110x/cc1100-defaultSettings.c +++ b/drivers/cc110x/cc1100-defaultSettings.c @@ -13,19 +13,19 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file - * @brief TI Chipcon CC110x default settings + * @brief TI Chipcon CC110x default settings * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 2058 $ * - * @note $Id: cc1100-defaultSettings.c 2058 2010-03-31 08:59:31Z hillebra $ + * @note $Id: cc1100-defaultSettings.c 2058 2010-03-31 08:59:31Z hillebra $ */ #include "cc1100-defaultSettings.h" @@ -38,7 +38,7 @@ and Telematics group (http://cst.mi.fu-berlin.de). * ----------------------------------------- * 0 | 0 | 869.525 * 1 | 10 | 871.61 - * 2 | 20 | 873.58 ~ seems to be bad (hang-ups with this channel) + * 2 | 20 | 873.58 ~ seems to be bad (hang-ups with this channel) * 3 | 30 | 875.61 * 4 | 40 | 877.58 * 5 | 50 | 879.61 @@ -71,9 +71,9 @@ char cc1100_conf[] = { 0x0F, /* FIFOTHR */ 0x9B, /* SYNC1 */ 0xAD, /* SYNC0 */ - 0x3D, /* PKTLEN (maximum value of packet length byte = 61) */ + 0x3D, /* PKTLEN (maximum value of packet length byte = 61) */ 0x06, /* PKTCTRL1 */ - 0x45, /* PKTCTRL0 (variable packet length) */ + 0x45, /* PKTCTRL0 (variable packet length) */ 0xFF, /* ADDR */ CC1100_DEFAULT_CHANNR * 10, /* CHANNR */ 0x0B, /* FSCTRL1 */ diff --git a/drivers/cc110x/cc1100-defaultSettings.h b/drivers/cc110x/cc1100-defaultSettings.h index c8f6a6d15b..8c6781867e 100644 --- a/drivers/cc110x/cc1100-defaultSettings.h +++ b/drivers/cc110x/cc1100-defaultSettings.h @@ -16,19 +16,19 @@ and Telematics group (http://cst.mi.fu-berlin.de). #define CC1100_DEFAULTSETTINGS_H /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file - * @brief TI Chipcon CC110x default settings + * @brief TI Chipcon CC110x default settings * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 2139 $ * - * @note $Id: cc1100-defaultSettings.h 2139 2010-05-26 08:04:04Z hillebra $ + * @note $Id: cc1100-defaultSettings.h 2139 2010-05-26 08:04:04Z hillebra $ */ #include "hwtimer.h" @@ -36,61 +36,61 @@ and Telematics group (http://cst.mi.fu-berlin.de). // returns hwtimer ticks per us #define RTIMER_TICKS(us) HWTIMER_TICKS(us) -#define TIMER_TICK_USEC_RES (122) +#define TIMER_TICK_USEC_RES (122) // Default PA table index (output power) -#define PATABLE (11) +#define PATABLE (11) // Watchdog cycle time in seconds, set 0 to disable watchdog -#define CC1100_WATCHDOG_PERIOD (5) +#define CC1100_WATCHDOG_PERIOD (5) // Number of transmission retries for unicast packets (constant RX mode) -#define TRANSMISSION_RETRIES_CRX_UC (5) +#define TRANSMISSION_RETRIES_CRX_UC (5) // Number of transmission retries for unicast packets (WOR mode) -#define TRANSMISSION_RETRIES_WOR_UC (1) +#define TRANSMISSION_RETRIES_WOR_UC (1) // Number of transmission retries for broadcast packets (constant RX mode) -#define TRANSMISSION_RETRIES_CRX_BC (0) +#define TRANSMISSION_RETRIES_CRX_BC (0) // Number of transmission retries for broadcast packets (WOR mode) -#define TRANSMISSION_RETRIES_WOR_BC (0) +#define TRANSMISSION_RETRIES_WOR_BC (0) // Time before chip goes back to RX (= stays in PWD after incoming packet) -#define WOR_TIMEOUT_1 (3200) // ~ 32 milliseconds +#define WOR_TIMEOUT_1 (3200) // ~ 32 milliseconds // Time before chip goes back to WOR (= stays in RX after elapsed WOR_TIMEOUT_1) -#define WOR_TIMEOUT_2 (800) // ~ 8 milliseconds +#define WOR_TIMEOUT_2 (800) // ~ 8 milliseconds // XOSC startup + FS calibration (300 + 809 us ~ 1.38 ms) -#define FS_CAL_TIME RTIMER_TICKS(12 * TIMER_TICK_USEC_RES) +#define FS_CAL_TIME RTIMER_TICKS(12 * TIMER_TICK_USEC_RES) // Manual FS calibration (721 us) -#define MANUAL_FS_CAL_TIME RTIMER_TICKS(7 * TIMER_TICK_USEC_RES) +#define MANUAL_FS_CAL_TIME RTIMER_TICKS(7 * TIMER_TICK_USEC_RES) // Reset wait time (in reset procedure) -#define RESET_WAIT_TIME RTIMER_TICKS(4 * TIMER_TICK_USEC_RES) +#define RESET_WAIT_TIME RTIMER_TICKS(4 * TIMER_TICK_USEC_RES) // Time chip needs to go to RX -#define IDLE_TO_RX_TIME RTIMER_TICKS(1 * TIMER_TICK_USEC_RES) +#define IDLE_TO_RX_TIME RTIMER_TICKS(1 * TIMER_TICK_USEC_RES) // Time chip needs to go to RX and CS signal is ready -#define CS_READY_TIME RTIMER_TICKS(3 * TIMER_TICK_USEC_RES) +#define CS_READY_TIME RTIMER_TICKS(3 * TIMER_TICK_USEC_RES) // Default RX interval for WOR in milliseconds -#define T_RX_INTERVAL (542) +#define T_RX_INTERVAL (542) // Time of packet interval in microseconds (at 400 kbps) -#define T_PACKET_INTERVAL (3800) +#define T_PACKET_INTERVAL (3800) // The size of the configuration array for CC1100 in bytes -#define CC1100_CONF_SIZE (39) +#define CC1100_CONF_SIZE (39) // The default channel number (0-24) for CC1100 -#define CC1100_DEFAULT_CHANNR (0) +#define CC1100_DEFAULT_CHANNR (0) // Burst retry to TX switch time (measured ~ 230 us) -#define BURST_RETRY_TX_SWITCH_TIME (23) +#define BURST_RETRY_TX_SWITCH_TIME (23) /** @} */ #endif diff --git a/drivers/cc110x/cc1100-internal.h b/drivers/cc110x/cc1100-internal.h index e263983e46..216baa12f8 100644 --- a/drivers/cc110x/cc1100-internal.h +++ b/drivers/cc110x/cc1100-internal.h @@ -16,33 +16,33 @@ and Telematics group (http://cst.mi.fu-berlin.de). #define CC1100_INTERNAL_H /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC110x internal hardware constants + * @brief TI Chipcon CC110x internal hardware constants * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 1231 $ * - * @note $Id: cc1100-internal.h 1231 2009-08-20 08:31:32Z baar $ + * @note $Id: cc1100-internal.h 1231 2009-08-20 08:31:32Z baar $ */ -#define FIXED_PKTLEN (0x00) ///< Fixed length packets, length configured in PKTLEN register. -#define VARIABLE_PKTLEN (0x01) ///< Variable length packets, packet length configured by the first - ///< byte after synch word. +#define FIXED_PKTLEN (0x00) ///< Fixed length packets, length configured in PKTLEN register. +#define VARIABLE_PKTLEN (0x01) ///< Variable length packets, packet length configured by the first + ///< byte after synch word. /** - * @name Bitmasks for reading out status register values + * @name Bitmasks for reading out status register values * @{ */ /** - * @brief Bitmask (=10000000) for reading CRC_OK. + * @brief Bitmask (=10000000) for reading CRC_OK. * * If CRC_OK == 1: CRC for received data OK (or CRC disabled). * If CRC_OK == 0: CRC error in received data. @@ -53,42 +53,42 @@ and Telematics group (http://cst.mi.fu-berlin.de). * * The Link Quality Indicator estimates how easily a received signal can be demodulated. */ -#define LQI_EST (0x7F) -#define I_RSSI (0x00) ///< Index 0 contains RSSI information (from optionally appended packet status bytes). -#define I_LQI (0x01) ///< Index 1 contains LQI & CRC_OK information (from optionally appended packet status bytes). -#define MARC_STATE (0x1F) ///< Bitmask (=00011111) for reading MARC_STATE in MARCSTATE status register. -#define CS (0x40) ///< Bitmask (=01000000) for reading CS (Carrier Sense) in PKTSTATUS status register. -#define PQT_REACHED (0x20) ///< Bitmask (=00100000) for reading PQT_REACHED (Preamble Quality reached) in PKTSTATUS status register. -#define CCA (0x10) ///< Bitmask (=00010000) for reading CCA (clear channel assessment) in PKTSTATUS status register. -#define SFD (0x08) ///< Bitmask (=00001000) for reading SFD (Sync word found) in PKTSTATUS status register. -#define GDO2 (0x04) ///< Bitmask (=00000100) for reading GDO2 (current value on GDO2 pin) in PKTSTATUS status register. -#define GDO1 (0x02) ///< Bitmask (=00000010) for reading GDO1 (current value on GDO1 pin) in PKTSTATUS status register. -#define GDO0 (0x01) ///< Bitmask (=00000001) for reading GDO0 (current value on GDO0 pin) in PKTSTATUS status register. -#define TXFIFO_UNDERFLOW (0x80) ///< Bitmask (=10000000) for reading TXFIFO_UNDERFLOW in TXBYTES status register. -#define BYTES_IN_TXFIFO (0x7F) ///< Bitmask (=01111111) for reading NUM_TXBYTES in TXBYTES status register. -#define RXFIFO_OVERFLOW (0x80) ///< Bitmask (=10000000) for reading RXFIFO_OVERFLOW in RXBYTES status register. -#define BYTES_IN_RXFIFO (0x7F) ///< Bitmask (=01111111) for reading NUM_RXBYTES in RXBYTES status register. +#define LQI_EST (0x7F) +#define I_RSSI (0x00) ///< Index 0 contains RSSI information (from optionally appended packet status bytes). +#define I_LQI (0x01) ///< Index 1 contains LQI & CRC_OK information (from optionally appended packet status bytes). +#define MARC_STATE (0x1F) ///< Bitmask (=00011111) for reading MARC_STATE in MARCSTATE status register. +#define CS (0x40) ///< Bitmask (=01000000) for reading CS (Carrier Sense) in PKTSTATUS status register. +#define PQT_REACHED (0x20) ///< Bitmask (=00100000) for reading PQT_REACHED (Preamble Quality reached) in PKTSTATUS status register. +#define CCA (0x10) ///< Bitmask (=00010000) for reading CCA (clear channel assessment) in PKTSTATUS status register. +#define SFD (0x08) ///< Bitmask (=00001000) for reading SFD (Sync word found) in PKTSTATUS status register. +#define GDO2 (0x04) ///< Bitmask (=00000100) for reading GDO2 (current value on GDO2 pin) in PKTSTATUS status register. +#define GDO1 (0x02) ///< Bitmask (=00000010) for reading GDO1 (current value on GDO1 pin) in PKTSTATUS status register. +#define GDO0 (0x01) ///< Bitmask (=00000001) for reading GDO0 (current value on GDO0 pin) in PKTSTATUS status register. +#define TXFIFO_UNDERFLOW (0x80) ///< Bitmask (=10000000) for reading TXFIFO_UNDERFLOW in TXBYTES status register. +#define BYTES_IN_TXFIFO (0x7F) ///< Bitmask (=01111111) for reading NUM_TXBYTES in TXBYTES status register. +#define RXFIFO_OVERFLOW (0x80) ///< Bitmask (=10000000) for reading RXFIFO_OVERFLOW in RXBYTES status register. +#define BYTES_IN_RXFIFO (0x7F) ///< Bitmask (=01111111) for reading NUM_RXBYTES in RXBYTES status register. /** @} */ /** - * @name Bitmasks for reading out configuration register values + * @name Bitmasks for reading out configuration register values * @{ */ -#define PKT_LENGTH_CONFIG (0x03) ///< Bitmask (=00000011) for reading LENGTH_CONFIG in PKTCTRL0 configuration register. +#define PKT_LENGTH_CONFIG (0x03) ///< Bitmask (=00000011) for reading LENGTH_CONFIG in PKTCTRL0 configuration register. /** @} */ /** - * @name Definitions to support burst/single access + * @name Definitions to support burst/single access * @{ */ -#define CC1100_WRITE_BURST (0x40) ///< Offset for burst write. -#define CC1100_READ_SINGLE (0x80) ///< Offset for read single byte. -#define CC1100_READ_BURST (0xC0) ///< Offset for read burst. -#define CC1100_NOBYTE (0x00) ///< No command (for reading). +#define CC1100_WRITE_BURST (0x40) ///< Offset for burst write. +#define CC1100_READ_SINGLE (0x80) ///< Offset for read single byte. +#define CC1100_READ_BURST (0xC0) ///< Offset for read burst. +#define CC1100_NOBYTE (0x00) ///< No command (for reading). /** @} */ /** - * @name Configuration Registers (47x) + * @name Configuration Registers (47x) * @{ */ #define CC1100_IOCFG2 (0x00) ///< GDO2 output pin configuration @@ -141,12 +141,12 @@ and Telematics group (http://cst.mi.fu-berlin.de). /** @} */ /** - * @name Strobe commands (14x) + * @name Strobe commands (14x) * @{ */ -#define CC1100_SRES (0x30) ///< Reset chip. +#define CC1100_SRES (0x30) ///< Reset chip. /** - * @brief Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1). + * @brief Enable and calibrate frequency synthesizer (if MCSM0.FS_AUTOCAL=1). * * If in RX/TX: Go to a wait state where only the synthesizer is running (for quick RX / TX turnaround). */ @@ -170,35 +170,35 @@ and Telematics group (http://cst.mi.fu-berlin.de). /** @} */ /** - * @name Status registers (12x) + * @name Status registers (12x) * @{ */ -#define CC1100_PARTNUM (0x30) ///< Part number of CC1100. -#define CC1100_VERSION (0x31) ///< Current version number. -#define CC1100_FREQEST (0x32) ///< Frequency Offset Estimate. -#define CC1100_LQI (0x33) ///< Demodulator estimate for Link Quality. -#define CC1100_RSSI (0x34) ///< Received signal strength indication. -#define CC1100_MARCSTATE (0x35) ///< Control state machine state. -#define CC1100_WORTIME1 (0x36) ///< High byte of WOR timer. -#define CC1100_WORTIME0 (0x37) ///< Low byte of WOR timer. -#define CC1100_PKTSTATUS (0x38) ///< Current GDOx status and packet status. -#define CC1100_VCO_VC_DAC (0x39) ///< Current setting from PLL calibration module. -#define CC1100_TXBYTES (0x3A) ///< Underflow and number of bytes in the TX FIFO. -#define CC1100_RXBYTES (0x3B) ///< Overflow and number of bytes in the RX FIFO. +#define CC1100_PARTNUM (0x30) ///< Part number of CC1100. +#define CC1100_VERSION (0x31) ///< Current version number. +#define CC1100_FREQEST (0x32) ///< Frequency Offset Estimate. +#define CC1100_LQI (0x33) ///< Demodulator estimate for Link Quality. +#define CC1100_RSSI (0x34) ///< Received signal strength indication. +#define CC1100_MARCSTATE (0x35) ///< Control state machine state. +#define CC1100_WORTIME1 (0x36) ///< High byte of WOR timer. +#define CC1100_WORTIME0 (0x37) ///< Low byte of WOR timer. +#define CC1100_PKTSTATUS (0x38) ///< Current GDOx status and packet status. +#define CC1100_VCO_VC_DAC (0x39) ///< Current setting from PLL calibration module. +#define CC1100_TXBYTES (0x3A) ///< Underflow and number of bytes in the TX FIFO. +#define CC1100_RXBYTES (0x3B) ///< Overflow and number of bytes in the RX FIFO. /** @} */ /** - * @name Multi byte registers + * @name Multi byte registers * @{ */ /** - * @brief Register for eight user selected output power settings. + * @brief Register for eight user selected output power settings. * * 3-bit FREND0.PA_POWER value selects the PATABLE entry to use. */ #define CC1100_PATABLE (0x3E) -#define CC1100_TXFIFO (0x3F) ///< TX FIFO: Write operations write to the TX FIFO (SB: +0x00; BURST: +0x40) -#define CC1100_RXFIFO (0x3F) ///< RX FIFO: Read operations read from the RX FIFO (SB: +0x80; BURST: +0xC0) +#define CC1100_TXFIFO (0x3F) ///< TX FIFO: Write operations write to the TX FIFO (SB: +0x00; BURST: +0x40) +#define CC1100_RXFIFO (0x3F) ///< RX FIFO: Read operations read from the RX FIFO (SB: +0x80; BURST: +0xC0) /** @} */ diff --git a/drivers/cc110x/cc1100.c b/drivers/cc110x/cc1100.c index a4a1b8ed0e..04801866b1 100644 --- a/drivers/cc110x/cc1100.c +++ b/drivers/cc110x/cc1100.c @@ -10,20 +10,20 @@ */ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC110x Radio driver + * @brief TI Chipcon CC110x Radio driver * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 2283 $ * - * @note $Id: cc1100.c 2283 2010-06-15 14:02:27Z hillebra $ + * @note $Id: cc1100.c 2283 2010-06-15 14:02:27Z hillebra $ */ #include @@ -53,12 +53,12 @@ #include "lpc2387.h" #endif -#define PACKET_LENGTH (0x3E) ///< Packet length = 62 Bytes. -#define CC1100_SYNC_WORD_TX_TIME (90000) /* loop count (max. timeout ~ 15 ms) to wait for */ - /* sync word to be transmitted (GDO2 from low to high) */ +#define PACKET_LENGTH (0x3E) ///< Packet length = 62 Bytes. +#define CC1100_SYNC_WORD_TX_TIME (90000) /* loop count (max. timeout ~ 15 ms) to wait for */ + /* sync word to be transmitted (GDO2 from low to high) */ /** - * @name Virtual Radio Device methods (see vdevice_radio_methods) + * @name Virtual Radio Device methods (see vdevice_radio_methods) * @{ */ static int rd_set_mode(int mode); @@ -67,49 +67,49 @@ static int rd_set_mode(int mode); static void switch_to_wor(void); /*---------------------------------------------------------------------------*/ -// Power control data structures +// Power control data structures /*---------------------------------------------------------------------------*/ -static uint8_t pa_table_index = PATABLE; ///< Current PATABLE Index -static uint8_t pa_table[] = { ///< PATABLE with available output powers - 0x00, ///< -52 dBm - 0x03, ///< -30 dBm - 0x0D, ///< -20 dBm - 0x1C, ///< -15 dBm - 0x34, ///< -10 dBm - 0x57, ///< - 5 dBm - 0x3F, ///< - 1 dBm - 0x8E, ///< 0 dBm - 0x85, ///< + 5 dBm - 0xCC, ///< + 7 dBm - 0xC6, ///< + 9 dBm - 0xC3 ///< +10 dBm +static uint8_t pa_table_index = PATABLE; ///< Current PATABLE Index +static uint8_t pa_table[] = { ///< PATABLE with available output powers + 0x00, ///< -52 dBm + 0x03, ///< -30 dBm + 0x0D, ///< -20 dBm + 0x1C, ///< -15 dBm + 0x34, ///< -10 dBm + 0x57, ///< - 5 dBm + 0x3F, ///< - 1 dBm + 0x8E, ///< 0 dBm + 0x85, ///< + 5 dBm + 0xCC, ///< + 7 dBm + 0xC6, ///< + 9 dBm + 0xC3 ///< +10 dBm }; /* If PATABLE is changed in size, adjust MAX_OUTPUT_POWER definition in CC1100 interface!*/ -static int8_t pa_table_dBm[] = { ///< Values of the PATABLE in dBm - -52, - -30, - -20, - -15, - -10, - -5, - -1, - 0, - 5, - 7, - 9, - 10 +static int8_t pa_table_dBm[] = { ///< Values of the PATABLE in dBm + -52, + -30, + -20, + -15, + -10, + -5, + -1, + 0, + 5, + 7, + 9, + 10 }; /*---------------------------------------------------------------------------*/ -// Main radio data structures +// Main radio data structures /*---------------------------------------------------------------------------*/ -volatile cc1100_flags rflags; ///< Radio control flags -static uint8_t radio_address; ///< Radio address -static uint8_t radio_channel; ///< Radio channel number +volatile cc1100_flags rflags; ///< Radio control flags +static uint8_t radio_address; ///< Radio address +static uint8_t radio_channel; ///< Radio channel number -const radio_t radio_cc1100 = { ///< Radio driver API +const radio_t radio_cc1100 = { ///< Radio driver API "CC1100", CC1100_BROADCAST_ADDRESS, MAX_OUTPUT_POWER, @@ -125,21 +125,21 @@ const radio_t radio_cc1100 = { ///< Radio driver API }; /*---------------------------------------------------------------------------*/ -// Data structures for mode control +// Data structures for mode control /*---------------------------------------------------------------------------*/ -volatile uint8_t radio_mode; ///< Radio mode -volatile uint8_t radio_state = RADIO_UNKNOWN; ///< Radio state +volatile uint8_t radio_mode; ///< Radio mode +volatile uint8_t radio_state = RADIO_UNKNOWN; ///< Radio state -volatile cc1100_mode_callback_t cc1100_go_idle; ///< Function for going IDLE -volatile cc1100_mode_callback_t cc1100_go_receive; ///< Function for going RX -volatile cc1100_mode_callback_t cc1100_go_after_tx; ///< Function to call after TX (burst send) -volatile cc1100_mode_callback_t cc1100_setup_mode; ///< Function to set up selected mode (RX or WOR) +volatile cc1100_mode_callback_t cc1100_go_idle; ///< Function for going IDLE +volatile cc1100_mode_callback_t cc1100_go_receive; ///< Function for going RX +volatile cc1100_mode_callback_t cc1100_go_after_tx; ///< Function to call after TX (burst send) +volatile cc1100_mode_callback_t cc1100_setup_mode; ///< Function to set up selected mode (RX or WOR) volatile int wor_hwtimer_id = -1; /*---------------------------------------------------------------------------*/ -/* Low-level hardware access */ +/* Low-level hardware access */ /*---------------------------------------------------------------------------*/ void cc1100_disable_interrupts(void) @@ -162,8 +162,8 @@ void cc110x_gdo2_irq(void) } /*---------------------------------------------------------------------------*/ -/* High level CC1100 SPI functions for transferring packet out */ -// of RX FIFO (don't call when in WOR mode) +/* High level CC1100 SPI functions for transferring packet out */ +// of RX FIFO (don't call when in WOR mode) /*---------------------------------------------------------------------------*/ static bool spi_receive_packet_variable(uint8_t *rxBuffer, uint8_t length) @@ -230,7 +230,7 @@ bool cc1100_spi_receive_packet(uint8_t *rxBuffer, uint8_t length) } /*---------------------------------------------------------------------------*/ -/* CC1100 mode functionality */ +/* CC1100 mode functionality */ /*---------------------------------------------------------------------------*/ void cc1100_set_idle(void) @@ -296,20 +296,20 @@ static void wakeup_from_wor(void) */ void switch_to_wor2(void) { - // if (cc110x_get_gdo2()) return; /* If incoming packet, then don't go to WOR now */ - cc1100_spi_strobe(CC1100_SIDLE); /* Put CC1100 to IDLE */ - radio_state = RADIO_IDLE; /* Radio state now IDLE */ + // if (cc110x_get_gdo2()) return; /* If incoming packet, then don't go to WOR now */ + cc1100_spi_strobe(CC1100_SIDLE); /* Put CC1100 to IDLE */ + radio_state = RADIO_IDLE; /* Radio state now IDLE */ cc1100_spi_write_reg(CC1100_MCSM2, - cc1100_wor_config.rx_time_reg); /* Configure RX_TIME (for use in WOR) */ - cc1100_spi_write_reg(CC1100_MCSM0, 0x18); /* Turn on FS-Autocal */ + cc1100_wor_config.rx_time_reg); /* Configure RX_TIME (for use in WOR) */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x18); /* Turn on FS-Autocal */ if (rflags.WOR_RST) { - cc1100_spi_strobe(CC1100_SWORRST); /* Resets the real time clock */ + cc1100_spi_strobe(CC1100_SWORRST); /* Resets the real time clock */ rflags.WOR_RST = false; } - cc1100_spi_strobe(CC1100_SWOR); /* Put radio back to sleep/WOR (must be in IDLE when this is done) */ - radio_state = RADIO_WOR; /* Radio state now WOR */ + cc1100_spi_strobe(CC1100_SWOR); /* Put radio back to sleep/WOR (must be in IDLE when this is done) */ + radio_state = RADIO_WOR; /* Radio state now WOR */ } /** @@ -318,7 +318,7 @@ void switch_to_wor2(void) static void hwtimer_switch_to_wor2_wrapper(void *ptr) { (void) ptr; - wor_hwtimer_id = -1; /* kernel timer handler function called, clear timer id */ + wor_hwtimer_id = -1; /* kernel timer handler function called, clear timer id */ if (rflags.TX) { return; /* Stability: don't allow WOR timers at this point */ @@ -401,8 +401,8 @@ static void setup_wor_mode(void) cc1100_spi_write_reg(CC1100_MCSM0, 0x18); /* Put the radio to SLEEP by starting Wake-on-Radio. */ - cc1100_spi_strobe(CC1100_SWORRST); /* Resets the real time clock */ - cc1100_spi_strobe(CC1100_SWOR); /* Starts Wake-on-Radio */ + cc1100_spi_strobe(CC1100_SWORRST); /* Resets the real time clock */ + cc1100_spi_strobe(CC1100_SWOR); /* Starts Wake-on-Radio */ radio_state = RADIO_WOR; } @@ -563,7 +563,7 @@ void cc1100_hwtimer_go_receive_wrapper(void *ptr) } /*---------------------------------------------------------------------------*/ -/* CC1100 reset functionality */ +/* CC1100 reset functionality */ /*---------------------------------------------------------------------------*/ static void reset(void) @@ -585,7 +585,7 @@ static void power_up_reset(void) } /*---------------------------------------------------------------------------*/ -/* CC1100 low level send function */ +/* CC1100 low level send function */ /*---------------------------------------------------------------------------*/ void cc1100_send_raw(uint8_t *tx_buffer, uint8_t size) @@ -636,7 +636,7 @@ void cc1100_send_raw(uint8_t *tx_buffer, uint8_t size) } /*---------------------------------------------------------------------------*/ -/* Various functions (mode safe - they can be called in any radio mode) */ +/* Various functions (mode safe - they can be called in any radio mode) */ /*---------------------------------------------------------------------------*/ uint8_t read_register(uint8_t r) @@ -789,14 +789,14 @@ char *cc1100_get_marc_state(void) static int8_t rssi_2_dbm(uint8_t rssi) { - if (rssi >= 128) rssi -= 256; - rssi /= 2; - rssi -= 78; - return rssi; + if (rssi >= 128) rssi -= 256; + rssi /= 2; + rssi -= 78; + return rssi; }*/ /*---------------------------------------------------------------------------*/ -/* Radio Driver API */ +/* Radio Driver API */ /*---------------------------------------------------------------------------*/ void cc1100_init(void) { @@ -890,13 +890,13 @@ rd_set_mode(int mode) switch(mode) { case RADIO_MODE_ON: - cc110x_init_interrupts(); /* Enable interrupts */ - cc1100_setup_mode(); /* Set chip to desired mode */ + cc110x_init_interrupts(); /* Enable interrupts */ + cc1100_setup_mode(); /* Set chip to desired mode */ break; case RADIO_MODE_OFF: - cc1100_disable_interrupts(); /* Disable interrupts */ - switch_to_pwd(); /* Set chip to power down mode */ + cc1100_disable_interrupts(); /* Disable interrupts */ + switch_to_pwd(); /* Set chip to power down mode */ break; case RADIO_MODE_GET: @@ -912,24 +912,24 @@ rd_set_mode(int mode) } /*---------------------------------------------------------------------------*/ -/* Carrier sense interface functions */ +/* Carrier sense interface functions */ /*---------------------------------------------------------------------------*/ void cc1100_cs_init(void) { - cc1100_go_idle(); /* Wake CC1100 up from Wake-On-Radio mode */ + cc1100_go_idle(); /* Wake CC1100 up from Wake-On-Radio mode */ - if (radio_state == RADIO_RX) { /* If radio in RX mode */ - cc1100_spi_strobe(CC1100_SIDLE); /* Go back to IDLE for calibration */ + if (radio_state == RADIO_RX) { /* If radio in RX mode */ + cc1100_spi_strobe(CC1100_SIDLE); /* Go back to IDLE for calibration */ } - cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ - cc1100_spi_strobe(CC1100_SCAL); /* Calibrate manually (721 us) */ - hwtimer_wait(MANUAL_FS_CAL_TIME); /* Wait for calibration to finish before packet burst can start */ - radio_state = RADIO_AIR_FREE_WAITING; /* Set status "waiting for air free" */ - cc1100_spi_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME = Until end of packet (no timeout) */ - cc1100_spi_strobe(CC1100_SRX); /* Switch to RX (88.4 us) (Carrier Sense) */ - hwtimer_wait(CS_READY_TIME); /* Wait until CC1100 is in RX + carrier sense ready (GDO0 ready for readout -> data rate dependent!!!) */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ + cc1100_spi_strobe(CC1100_SCAL); /* Calibrate manually (721 us) */ + hwtimer_wait(MANUAL_FS_CAL_TIME); /* Wait for calibration to finish before packet burst can start */ + radio_state = RADIO_AIR_FREE_WAITING; /* Set status "waiting for air free" */ + cc1100_spi_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME = Until end of packet (no timeout) */ + cc1100_spi_strobe(CC1100_SRX); /* Switch to RX (88.4 us) (Carrier Sense) */ + hwtimer_wait(CS_READY_TIME); /* Wait until CC1100 is in RX + carrier sense ready (GDO0 ready for readout -> data rate dependent!!!) */ } void cc1100_cs_set_enabled(bool enabled) diff --git a/drivers/cc110x/cc1100_phy.c b/drivers/cc110x/cc1100_phy.c index 82992342f2..779375613b 100644 --- a/drivers/cc110x/cc1100_phy.c +++ b/drivers/cc110x/cc1100_phy.c @@ -13,21 +13,21 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC110x physical radio driver + * @brief TI Chipcon CC110x physical radio driver * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @author Oliver Hahm * @version $Revision: 2130 $ * - * @note $Id: cc1100_phy.c 2130 2010-05-12 13:19:07Z hillebra $ + * @note $Id: cc1100_phy.c 2130 2010-05-12 13:19:07Z hillebra $ */ #include #include @@ -52,12 +52,12 @@ and Telematics group (http://cst.mi.fu-berlin.de). #define MSG_POLL 12346 -#define FLAGS_IDENTIFICATION (0x01) ///< Bit mask for reading the identification out of the flags field -#define R_FLAGS_PROTOCOL(x) ((x & 0x0E)>>1) ///< Macro for reading the protocol out of the flags field -#define W_FLAGS_PROTOCOL(x) ((x<<1) & 0x0E) ///< Macro for writing the protocol in the flags field +#define FLAGS_IDENTIFICATION (0x01) ///< Bit mask for reading the identification out of the flags field +#define R_FLAGS_PROTOCOL(x) ((x & 0x0E)>>1) ///< Macro for reading the protocol out of the flags field +#define W_FLAGS_PROTOCOL(x) ((x<<1) & 0x0E) ///< Macro for writing the protocol in the flags field /*---------------------------------------------------------------------------*/ -/* RX/TX buffer data structures */ +/* RX/TX buffer data structures */ /*---------------------------------------------------------------------------*/ typedef struct { @@ -65,18 +65,18 @@ typedef struct { packet_info_t info; } rx_buffer_t; -#define RX_BUFF_SIZE (10) ///< Size of RX queue -static volatile uint8_t rx_buffer_head; ///< RX queue head -static volatile uint8_t rx_buffer_tail; ///< RX queue tail -static volatile uint8_t rx_buffer_size; ///< RX queue size -static rx_buffer_t rx_buffer[RX_BUFF_SIZE]; ///< RX buffer -static cc1100_packet_layer0_t tx_buffer; ///< TX buffer (for one packet) +#define RX_BUFF_SIZE (10) ///< Size of RX queue +static volatile uint8_t rx_buffer_head; ///< RX queue head +static volatile uint8_t rx_buffer_tail; ///< RX queue tail +static volatile uint8_t rx_buffer_size; ///< RX queue size +static rx_buffer_t rx_buffer[RX_BUFF_SIZE]; ///< RX buffer +static cc1100_packet_layer0_t tx_buffer; ///< TX buffer (for one packet) /*---------------------------------------------------------------------------*/ -/* Process/Event management data structures */ +/* Process/Event management data structures */ /*---------------------------------------------------------------------------*/ -#define MAX_PACKET_HANDLERS (5) +#define MAX_PACKET_HANDLERS (5) static packet_monitor_t packet_monitor; static handler_entry_t handlers[MAX_PACKET_HANDLERS]; static const pm_table_t handler_table; @@ -92,19 +92,19 @@ static void *cc1100_event_handler_function(void *); static char event_handler_stack[KERNEL_CONF_STACKSIZE_MAIN]; /*---------------------------------------------------------------------------*/ -/* Sequence number buffer management data structures */ +/* Sequence number buffer management data structures */ /*---------------------------------------------------------------------------*/ /** * @name Sequence Buffer * @{ */ -#define MAX_SEQ_BUFFER_SIZE (20) ///< Maximum size of the sequence number buffer +#define MAX_SEQ_BUFFER_SIZE (20) ///< Maximum size of the sequence number buffer typedef struct { - uint64_t m_ticks; ///< 64-bit timestamp - uint8_t source; ///< Source address - uint8_t identification; ///< Identification (1-bit) + uint64_t m_ticks; ///< 64-bit timestamp + uint8_t source; ///< Source address + uint8_t identification; ///< Identification (1-bit) } seq_buffer_entry_t; //* Sequence number buffer for this layer */ @@ -114,42 +114,42 @@ static seq_buffer_entry_t seq_buffer[MAX_SEQ_BUFFER_SIZE]; static uint8_t seq_buffer_pos = 0; /** - * @brief Last sequence number this node has seen + * @brief Last sequence number this node has seen * - * @note (phySrc + flags.identification) - for speedup in ISR. + * @note (phySrc + flags.identification) - for speedup in ISR. */ static volatile uint16_t last_seq_num = 0; /** @} */ /*---------------------------------------------------------------------------*/ -// WOR configuration data structures +// WOR configuration data structures /*---------------------------------------------------------------------------*/ -#define EVENT0_MAX (60493) ///< Maximum RX polling interval in milliseconds -#define WOR_RES_SWITCH (1891) ///< Switching point value in milliseconds between - ///< WOR_RES = 0 and WOR_RES = 1 -#define DUTY_CYCLE_SIZE (7) ///< Length of duty cycle array +#define EVENT0_MAX (60493) ///< Maximum RX polling interval in milliseconds +#define WOR_RES_SWITCH (1891) ///< Switching point value in milliseconds between + ///< WOR_RES = 0 and WOR_RES = 1 +#define DUTY_CYCLE_SIZE (7) ///< Length of duty cycle array -cc1100_wor_config_t cc1100_wor_config; ///< CC1100 WOR configuration +cc1100_wor_config_t cc1100_wor_config; ///< CC1100 WOR configuration -uint16_t cc1100_burst_count; ///< Burst count, number of packets in a burst transfer -uint8_t cc1100_retransmission_count_uc; ///< Number of retransmissions for unicast -uint8_t cc1100_retransmission_count_bc; ///< Number of retransmissions for broadcast +uint16_t cc1100_burst_count; ///< Burst count, number of packets in a burst transfer +uint8_t cc1100_retransmission_count_uc; ///< Number of retransmissions for unicast +uint8_t cc1100_retransmission_count_bc; ///< Number of retransmissions for broadcast -static const double duty_cycle[2][DUTY_CYCLE_SIZE] = { ///< Duty cycle values from AN047 +static const double duty_cycle[2][DUTY_CYCLE_SIZE] = { ///< Duty cycle values from AN047 {12.5, 6.25, 3.125, 1.563, 0.781, 0.391, 0.195}, {1.95, 0.9765, 0.4883, 0.2441, 0.1221, 0.061035, 0.030518} }; /*---------------------------------------------------------------------------*/ -// Data structures for statistic +// Data structures for statistic /*---------------------------------------------------------------------------*/ cc1100_statistic_t cc1100_statistic; /*---------------------------------------------------------------------------*/ -// Initialization of physical layer +// Initialization of physical layer /*---------------------------------------------------------------------------*/ void cc1100_phy_init(void) @@ -190,7 +190,7 @@ void cc1100_phy_init(void) } /*---------------------------------------------------------------------------*/ -/* CC1100 mutual exclusion */ +/* CC1100 mutual exclusion */ /*---------------------------------------------------------------------------*/ void cc1100_phy_mutex_lock(void) @@ -208,7 +208,7 @@ void cc1100_phy_mutex_unlock(void) } /*---------------------------------------------------------------------------*/ -// Statistical functions +// Statistical functions /*---------------------------------------------------------------------------*/ void cc1100_reset_statistic(void) @@ -271,7 +271,7 @@ void cc1100_print_config(void) } /*---------------------------------------------------------------------------*/ -// Change of RX polling interval (T_EVENT0) +// Change of RX polling interval (T_EVENT0) /*---------------------------------------------------------------------------*/ inline uint16_t iround(double d) @@ -355,7 +355,7 @@ int cc1100_phy_calc_wor_settings(uint16_t millis) } /*---------------------------------------------------------------------------*/ -// Sequence number buffer management +// Sequence number buffer management /*---------------------------------------------------------------------------*/ static bool contains_seq_entry(uint8_t src, uint8_t id) @@ -415,26 +415,26 @@ static void add_seq_entry(uint8_t src, uint8_t id) } /*---------------------------------------------------------------------------*/ -/* CC1100 physical layer send functions */ +/* CC1100 physical layer send functions */ /*---------------------------------------------------------------------------*/ static void send_link_level_ack(uint8_t dest) { - uint8_t oldState = radio_state; /* Save old state */ - cc1100_packet_layer0_t ack; /* Local packet, don't overwrite */ + uint8_t oldState = radio_state; /* Save old state */ + cc1100_packet_layer0_t ack; /* Local packet, don't overwrite */ - radio_state = RADIO_SEND_ACK; /* Set state to "Sending ACK" */ - cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ - cc1100_spi_write_reg(CC1100_MCSM1, 0x00); /* TX_OFFMODE = IDLE */ - ack.length = 3; /* possible packet in txBuffer!*/ + radio_state = RADIO_SEND_ACK; /* Set state to "Sending ACK" */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ + cc1100_spi_write_reg(CC1100_MCSM1, 0x00); /* TX_OFFMODE = IDLE */ + ack.length = 3; /* possible packet in txBuffer!*/ ack.address = dest; ack.phy_src = rflags.RSSI; ack.flags = (LAYER_1_PROTOCOL_LL_ACK << 1); - cc1100_send_raw((uint8_t *)&ack, /* IDLE -> TX (88.4 us) */ + cc1100_send_raw((uint8_t *)&ack, /* IDLE -> TX (88.4 us) */ ack.length + 1); - cc1100_spi_write_reg(CC1100_MCSM0, 0x18); /* Turn on FS-Autocal */ - cc1100_spi_write_reg(CC1100_MCSM1, 0x03); /* TX_OFFMODE = RX */ - radio_state = oldState; /* Restore state */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x18); /* Turn on FS-Autocal */ + cc1100_spi_write_reg(CC1100_MCSM1, 0x03); /* TX_OFFMODE = RX */ + radio_state = oldState; /* Restore state */ cc1100_statistic.acks_send++; } @@ -452,7 +452,7 @@ static bool send_burst(cc1100_packet_layer0_t *packet, uint8_t retries, uint8_t */ extern unsigned long hwtimer_now(void); timer_tick_t t = hwtimer_now() + RTIMER_TICKS(T_PACKET_INTERVAL); - cc1100_send_raw((uint8_t *)packet, packet->length + 1); /* RX -> TX (9.6 us) */ + cc1100_send_raw((uint8_t *)packet, packet->length + 1); /* RX -> TX (9.6 us) */ cc1100_statistic.raw_packets_out++; @@ -555,25 +555,25 @@ int cc1100_send(radio_address_t addr, protocol_t protocol, int priority, char *p retries = (address == CC1100_BROADCAST_ADDRESS) ? cc1100_retransmission_count_bc : cc1100_retransmission_count_uc; - memset(tx_buffer.data, 0, MAX_DATA_LENGTH); /* Clean data */ + memset(tx_buffer.data, 0, MAX_DATA_LENGTH); /* Clean data */ /* TODO: If packets are shorter than max packet size, WOR interval is too long. * This must be solved in some way. */ - tx_buffer.length = 3 + payload_len; /* 3 bytes (A&PS&F) + data length */ - tx_buffer.address = address; /* Copy destination address */ - tx_buffer.flags = 0x00; /* Set clean state */ - tx_buffer.flags = W_FLAGS_PROTOCOL(protocol); /* Copy protocol identifier */ - tx_buffer.phy_src = (uint8_t) cc1100_get_address(); /* Copy sender address */ + tx_buffer.length = 3 + payload_len; /* 3 bytes (A&PS&F) + data length */ + tx_buffer.address = address; /* Copy destination address */ + tx_buffer.flags = 0x00; /* Set clean state */ + tx_buffer.flags = W_FLAGS_PROTOCOL(protocol); /* Copy protocol identifier */ + tx_buffer.phy_src = (uint8_t) cc1100_get_address(); /* Copy sender address */ /* Set identification number of packet */ - tx_buffer.flags |= rflags.SEQ; /* Set flags.identification (bit 0) */ - rflags.SEQ = !rflags.SEQ; /* Toggle value of layer 0 sequence number bit */ + tx_buffer.flags |= rflags.SEQ; /* Set flags.identification (bit 0) */ + rflags.SEQ = !rflags.SEQ; /* Toggle value of layer 0 sequence number bit */ - memcpy(tx_buffer.data, payload, payload_len); /* Copy data */ + memcpy(tx_buffer.data, payload, payload_len); /* Copy data */ /* Send the packet */ - cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ - result = send_burst(&tx_buffer, retries, 0); /* Send raw burst */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ + result = send_burst(&tx_buffer, retries, 0); /* Send raw burst */ return_code = result ? payload_len : RADIO_OP_FAILED; /* Collect statistics */ @@ -602,7 +602,7 @@ final: } /*---------------------------------------------------------------------------*/ -/* RX Event Handler */ +/* RX Event Handler */ /*---------------------------------------------------------------------------*/ bool cc1100_set_packet_monitor(packet_monitor_t monitor) @@ -698,7 +698,7 @@ static void *cc1100_event_handler_function(void *arg) } /*---------------------------------------------------------------------------*/ -/* CC1100 packet (RX) ISR */ +/* CC1100 packet (RX) ISR */ /*---------------------------------------------------------------------------*/ void cc1100_phy_rx_handler(void) @@ -835,8 +835,8 @@ void cc1100_phy_rx_handler(void) /* Valid packet. After a wake-up, the radio should be in IDLE. * So put CC1100 to RX for WOR_TIMEOUT (have to manually put * the radio back to sleep/WOR).*/ - cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ - cc1100_spi_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME (until end of packet) */ + cc1100_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */ + cc1100_spi_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME (until end of packet) */ if (radio_mode == CC1100_MODE_CONSTANT_RX) { cc1100_spi_strobe(CC1100_SRX); @@ -864,9 +864,9 @@ void cc1100_phy_rx_handler(void) rflags.TOF = 0; /* CRC false or RX buffer full -> clear RX FIFO in both cases */ - last_seq_num = 0; /* Reset for correct burst detection */ - cc1100_spi_strobe(CC1100_SIDLE); /* Switch to IDLE (should already be)... */ - cc1100_spi_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */ + last_seq_num = 0; /* Reset for correct burst detection */ + cc1100_spi_strobe(CC1100_SIDLE); /* Switch to IDLE (should already be)... */ + cc1100_spi_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */ /* If packet interrupted this nodes send call, * don't change anything after this point. */ diff --git a/drivers/cc110x/cc1100_phy.h b/drivers/cc110x/cc1100_phy.h index f39a16811d..1af7946cfc 100644 --- a/drivers/cc110x/cc1100_phy.h +++ b/drivers/cc110x/cc1100_phy.h @@ -13,20 +13,20 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC110x physical radio driver + * @brief TI Chipcon CC110x physical radio driver * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 1285 $ * - * @note $Id: cc1100_phy.h 1285 2009-08-27 13:22:42Z hillebra $ + * @note $Id: cc1100_phy.h 1285 2009-08-27 13:22:42Z hillebra $ */ #ifndef CC1100_PHY_H_ #define CC1100_PHY_H_ @@ -37,10 +37,10 @@ and Telematics group (http://cst.mi.fu-berlin.de). #include "cc1100-internal.h" #include "cc110x.h" -#define MAX_DATA_LENGTH (0x3A) ///< Maximum data length of layer 0 = 58 Bytes. +#define MAX_DATA_LENGTH (0x3A) ///< Maximum data length of layer 0 = 58 Bytes. /** - * @brief CC1100 layer 0 protocol + * @brief CC1100 layer 0 protocol * *
 ---------------------------------------------------
@@ -51,36 +51,36 @@ and Telematics group (http://cst.mi.fu-berlin.de).
   1 byte   1 byte    1 byte   1 byte   <= 58 bytes
 
 Flags:
-		Bit | Meaning
-		--------------------
-		7:4	| -
-		3:1 | Protocol
-		  0 | Identification
+        Bit | Meaning
+        --------------------
+        7:4 | -
+        3:1 | Protocol
+          0 | Identification
 
Notes: \li length & address are given by CC1100 \li Identification is increased is used to scan duplicates. It must be increased - for each new packet and kept for packet retransmissions. + for each new packet and kept for packet retransmissions. */ typedef struct __attribute__((packed)) cc1100_packet_layer0_t { - uint8_t length; ///< Length of the packet (without length byte) - uint8_t address; ///< Destination address - uint8_t phy_src; ///< Source address (physical source) - uint8_t flags; ///< Flags - uint8_t data[MAX_DATA_LENGTH]; ///< Data (high layer protocol) + uint8_t length; ///< Length of the packet (without length byte) + uint8_t address; ///< Destination address + uint8_t phy_src; ///< Source address (physical source) + uint8_t flags; ///< Flags + uint8_t data[MAX_DATA_LENGTH]; ///< Data (high layer protocol) } cc1100_packet_layer0_t; typedef struct cc1100_wor_config_t { - uint16_t rx_interval; ///< RX polling interval in milliseconds - float rx_time_ms; ///< WOR_RX_TIME in milliseconds - uint8_t rx_time_reg; ///< WOR_RX_TIME (CC1100 "MCSM2.RX_TIME" register value) - uint8_t wor_evt_0; ///< CC1100 WOREVT0 register value - uint8_t wor_evt_1; ///< CC1100 WOREVT1 register value - uint8_t wor_ctrl; ///< CC1100 WORCTRL register value + uint16_t rx_interval; ///< RX polling interval in milliseconds + float rx_time_ms; ///< WOR_RX_TIME in milliseconds + uint8_t rx_time_reg; ///< WOR_RX_TIME (CC1100 "MCSM2.RX_TIME" register value) + uint8_t wor_evt_0; ///< CC1100 WOREVT0 register value + uint8_t wor_evt_1; ///< CC1100 WOREVT1 register value + uint8_t wor_ctrl; ///< CC1100 WORCTRL register value } cc1100_wor_config_t; /*---------------------------------------------------------------------------*/ -// CC1100 Wake-On-Radio configuration +// CC1100 Wake-On-Radio configuration /*---------------------------------------------------------------------------*/ extern uint16_t cc1100_burst_count; @@ -89,11 +89,11 @@ extern uint8_t cc1100_retransmission_count_bc; extern cc1100_wor_config_t cc1100_wor_config; /*---------------------------------------------------------------------------*/ -// CC1100 physical radio driver API +// CC1100 physical radio driver API /*---------------------------------------------------------------------------*/ /** - * @brief Initialize the physical radio layer. + * @brief Initialize the physical radio layer. */ void cc1100_phy_init(void); @@ -114,22 +114,22 @@ void cc1100_phy_mutex_lock(void); void cc1100_phy_mutex_unlock(void); /** - * @brief Calculate and store Wake-On-Radio settings. + * @brief Calculate and store Wake-On-Radio settings. * * Calculates WOR settings for a given RX interval in * milliseconds and stores the values in global configuration. *

* Does not change settings if not applicable. * - * @param millis Desired RX interval in milliseconds [50..60000]. + * @param millis Desired RX interval in milliseconds [50..60000]. * - * @return The burst count (number of packets in a burst transfer) - * or -1 if an error occurred (e.g. RX interval invalid). + * @return The burst count (number of packets in a burst transfer) + * or -1 if an error occurred (e.g. RX interval invalid). */ int cc1100_phy_calc_wor_settings(uint16_t millis); /** - * @brief Handler function for incoming packets. + * @brief Handler function for incoming packets. * * This handler function must be called in the receive * interrupt service routine. diff --git a/drivers/cc110x/cc1100_spi.c b/drivers/cc110x/cc1100_spi.c index 85036aae01..a07cfedba7 100644 --- a/drivers/cc110x/cc1100_spi.c +++ b/drivers/cc110x/cc1100_spi.c @@ -13,20 +13,20 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC1100 SPI driver + * @brief TI Chipcon CC1100 SPI driver * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 1775 $ * - * @note $Id: cc1100_spi.c 1775 2010-01-26 09:37:03Z hillebra $ + * @note $Id: cc1100_spi.c 1775 2010-01-26 09:37:03Z hillebra $ */ #include @@ -38,7 +38,7 @@ and Telematics group (http://cst.mi.fu-berlin.de). #include "cc1100-internal.h" /*---------------------------------------------------------------------------*/ -// CC1100 SPI access +// CC1100 SPI access /*---------------------------------------------------------------------------*/ uint8_t diff --git a/drivers/cc110x/cc1100_spi.h b/drivers/cc110x/cc1100_spi.h index dd5f292922..4503cebc9e 100644 --- a/drivers/cc110x/cc1100_spi.h +++ b/drivers/cc110x/cc1100_spi.h @@ -13,20 +13,20 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file * @internal - * @brief TI Chipcon CC1100 SPI driver + * @brief TI Chipcon CC1100 SPI driver * - * @author Thomas Hillebrandt - * @author Heiko Will + * @author Thomas Hillebrandt + * @author Heiko Will * @version $Revision: 1775 $ * - * @note $Id: cc1100_spi.h 1775 2010-01-26 09:37:03Z hillebra $ + * @note $Id: cc1100_spi.h 1775 2010-01-26 09:37:03Z hillebra $ */ #ifndef CC1100_SPI_H_ diff --git a/drivers/cc2420/include/cc2420_arch.h b/drivers/cc2420/include/cc2420_arch.h index de96a2719b..6b83b2cf9a 100644 --- a/drivers/cc2420/include/cc2420_arch.h +++ b/drivers/cc2420/include/cc2420_arch.h @@ -14,10 +14,10 @@ and Telematics group (http://cst.mi.fu-berlin.de). /** * @file - * @ingroup CC2420 - * @brief CC2420 dependend functions + * @ingroup CC2420 + * @brief CC2420 dependend functions * - * @author Heiko Will + * @author Heiko Will * @author Milan Babel * @author Kévin Roussel */ diff --git a/drivers/include/at86rf231.h b/drivers/include/at86rf231.h index e80ad2e043..d3ee94d465 100644 --- a/drivers/include/at86rf231.h +++ b/drivers/include/at86rf231.h @@ -19,7 +19,7 @@ typedef struct __attribute__((packed)) { /* @{ */ - uint8_t length; /** < the length of the frame of the frame including fcs*/ + uint8_t length; /** < the length of the frame of the frame including fcs*/ ieee802154_frame_t frame; /** < the ieee802154 frame */ int8_t rssi; /** < the rssi value */ uint8_t crc; /** < 1 if crc was successfull, 0 otherwise */ diff --git a/drivers/include/cc110x/cc1100-interface.h b/drivers/include/cc110x/cc1100-interface.h index 802ae131d8..cc025d164a 100644 --- a/drivers/include/cc110x/cc1100-interface.h +++ b/drivers/include/cc110x/cc1100-interface.h @@ -13,18 +13,18 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @ingroup dev_cc110x + * @ingroup dev_cc110x * @{ */ /** * @file - * @brief TI Chipcon CC110x public interface + * @brief TI Chipcon CC110x public interface * - * @author Thomas Hillebrandt + * @author Thomas Hillebrandt * @version $Revision: 2283 $ * - * @note $Id: cc1100-interface.h 2283 2010-06-15 14:02:27Z hillebra $ + * @note $Id: cc1100-interface.h 2283 2010-06-15 14:02:27Z hillebra $ */ #ifndef CC1100INTERFACE_H_ @@ -33,19 +33,19 @@ and Telematics group (http://cst.mi.fu-berlin.de). #include #include "radio/radio.h" -#define CC1100_BROADCAST_ADDRESS (0x00) ///< CC1100 broadcast address +#define CC1100_BROADCAST_ADDRESS (0x00) ///< CC1100 broadcast address -#define MAX_UID (0xFF) ///< Maximum UID of a node is 255 -#define MIN_UID (0x01) ///< Minimum UID of a node is 1 +#define MAX_UID (0xFF) ///< Maximum UID of a node is 255 +#define MIN_UID (0x01) ///< Minimum UID of a node is 1 -#define MIN_CHANNR (0) ///< Minimum channel number -#define MAX_CHANNR (24) ///< Maximum channel number +#define MIN_CHANNR (0) ///< Minimum channel number +#define MAX_CHANNR (24) ///< Maximum channel number -#define MIN_OUTPUT_POWER (0) ///< Minimum output power value -#define MAX_OUTPUT_POWER (11) ///< Maximum output power value +#define MIN_OUTPUT_POWER (0) ///< Minimum output power value +#define MAX_OUTPUT_POWER (11) ///< Maximum output power value -#define CC1100_MODE_WOR (0) ///< Usable radio mode: Wake-On-Radio -#define CC1100_MODE_CONSTANT_RX (1) ///< Usable radio mode: Constant receive +#define CC1100_MODE_WOR (0) ///< Usable radio mode: Wake-On-Radio +#define CC1100_MODE_CONSTANT_RX (1) ///< Usable radio mode: Constant receive #define CC1100_MAX_DATA_LENGTH (58) @@ -62,21 +62,21 @@ and Telematics group (http://cst.mi.fu-berlin.de). extern const radio_t radio_cc1100; /** - * @brief Initialize radio layer. + * @brief Initialize radio layer. * * Initialize the radio layer, must be called before radio can be used. */ void cc1100_init(void); /** - * @brief Get the radio mode. + * @brief Get the radio mode. * - * @return Either CC1100_MODE_CONSTANT_RX or CC1100_MODE_WOR. + * @return Either CC1100_MODE_CONSTANT_RX or CC1100_MODE_WOR. */ uint8_t cc1100_get_mode(void); /** - * @brief Set the radio mode. + * @brief Set the radio mode. * * Sets the radio mode with optional mode data. If the radio mode is WOR, * the optional mode data is the RX interval in milliseconds. Must be called @@ -90,116 +90,116 @@ uint8_t cc1100_get_mode(void); bool cc1100_set_mode(uint8_t mode, uint16_t opt_mode_data); /** - * @brief Get the average transmission duration (till ACK received). + * @brief Get the average transmission duration (till ACK received). * - * @return The average transmission duration of one packet in milliseconds. + * @return The average transmission duration of one packet in milliseconds. */ int cc1100_get_avg_transmission_duration(void); /** - * @brief Get the radio address. + * @brief Get the radio address. * - * @return The current address of the radio. + * @return The current address of the radio. */ radio_address_t cc1100_get_address(void); /** - * @brief Set the radio address. + * @brief Set the radio address. * - * @param address The new radio address. + * @param address The new radio address. * - * @return true if address could be set; false otherwise. + * @return true if address could be set; false otherwise. */ bool cc1100_set_address(radio_address_t address); /** - * @brief Get the current channel number. + * @brief Get the current channel number. * - * @return The current channel number used. + * @return The current channel number used. */ uint8_t cc1100_get_channel(void); /** - * @brief Set the channel to use. + * @brief Set the channel to use. * - * @param channr The new channel number (between MIN_CHANNR and MAX_CHANNR) to use. + * @param channr The new channel number (between MIN_CHANNR and MAX_CHANNR) to use. * - * @return true if channel could be set; false otherwise. + * @return true if channel could be set; false otherwise. */ bool cc1100_set_channel(uint8_t channr); /** - * @brief Set current output power in dBm. + * @brief Set current output power in dBm. * - * @param pa_idx New output power setting, valid values + * @param pa_idx New output power setting, valid values * are from MIN_OUTPUT_POWER (lowest output power, -52 dBm) * to MAX_OUTPUT_POWER (highest output power, +10 dBm). * - * @return true if output power could be set; false otherwise. + * @return true if output power could be set; false otherwise. */ bool cc1100_set_output_power(uint8_t pa_idx); /** - * @brief Set a packet monitor at this layer. + * @brief Set a packet monitor at this layer. * * All incoming packets will be passed to this packet monitor before * packet gets processed by a specific handler. The work in the monitor * should take as less time as possible (no waiting or intense I/O). * - * @param monitor The packet monitor or NULL if the current packet + * @param monitor The packet monitor or NULL if the current packet * monitor should be removed. * - * @return true if this layer supports packet monitoring; false otherwise. + * @return true if this layer supports packet monitoring; false otherwise. */ bool cc1100_set_packet_monitor(packet_monitor_t monitor); /** - * @brief Set a packet handler for a given protocol. + * @brief Set a packet handler for a given protocol. * - * @param protocol The protocol identifier (3-bit value > 0, 1 reserved for LL-ACK). - * @param handler The packet handler called if a packet of given protocol is received. + * @param protocol The protocol identifier (3-bit value > 0, 1 reserved for LL-ACK). + * @param handler The packet handler called if a packet of given protocol is received. * - * @return -1 if an error occurs (e.g. handler table full) else >= 0. + * @return -1 if an error occurs (e.g. handler table full) else >= 0. */ int cc1100_set_packet_handler(protocol_t protocol, packet_handler_t handler); /** - * @brief Send data to given destination address with acknowledgment. + * @brief Send data to given destination address with acknowledgment. * * The maximum payload length are 58 bytes! * - * @param addr The destination address. - * @param protocol The protocol identifier of the transmitted data. - * @param priority Ignored (always highest). - * @param payload The data to be send. - * @param payload_len The length of the data in bytes. + * @param addr The destination address. + * @param protocol The protocol identifier of the transmitted data. + * @param priority Ignored (always highest). + * @param payload The data to be send. + * @param payload_len The length of the data in bytes. * - * @return A negative value if operation failed; if operation succeeded (ACK received) the number of transmitted bytes. + * @return A negative value if operation failed; if operation succeeded (ACK received) the number of transmitted bytes. */ int cc1100_send(radio_address_t addr, protocol_t protocol, int priority, char *payload, int payload_len); /** - * @brief Send data to given destination address with acknowledgment and CSMA/CA. + * @brief Send data to given destination address with acknowledgment and CSMA/CA. * * The maximum payload length are 58 bytes! * - * @param address The destination address. - * @param protocol The protocol identifier of the transmitted data. - * @param priority The MAC priority to send with. One of {PRIORITY_ALARM, PRIORITY_WARNING, PRIORITY_DATA}. - * @param payload The data to be send. - * @param payload_len The length of the data in bytes. + * @param address The destination address. + * @param protocol The protocol identifier of the transmitted data. + * @param priority The MAC priority to send with. One of {PRIORITY_ALARM, PRIORITY_WARNING, PRIORITY_DATA}. + * @param payload The data to be send. + * @param payload_len The length of the data in bytes. * - * @return A negative value if operation failed; if operation succeeded (ACK received) else the number of transmitted bytes. + * @return A negative value if operation failed; if operation succeeded (ACK received) else the number of transmitted bytes. */ int cc1100_send_csmaca(radio_address_t address, protocol_t protocol, int priority, char *payload, int payload_len); /** - * @brief Print current radio configuration. + * @brief Print current radio configuration. */ void cc1100_print_config(void); /** - * @brief Print radio statistics. + * @brief Print radio statistics. */ void cc1100_print_statistic(void); diff --git a/drivers/include/cc2420.h b/drivers/include/cc2420.h index 35c995aa10..77a75830fd 100644 --- a/drivers/include/cc2420.h +++ b/drivers/include/cc2420.h @@ -39,17 +39,17 @@ FCS contain a hardware generated CRC sum with the polynom x^16+x^12+x^5+1 When receiving a package FCS will be checked by hardware, the first FCS byte will be replaced by RSSI, followed by a CRC OK bit and the unsigned 7 bit correlation value. FCF: - Bit | Meaning - -------------------- - 0-2 | Frame Type - 3 | Security Enabled - 4 | Frame Pending - 5 | Acknowledge request - 6 | PAN ID Compression Field - 7-9 | Reserved - 10-11 | Destination addressing mode - 12-13 | Reserved - 14-15 | Source addressing mode + Bit | Meaning + -------------------- + 0-2 | Frame Type + 3 | Security Enabled + 4 | Frame Pending + 5 | Acknowledge request + 6 | PAN ID Compression Field + 7-9 | Reserved + 10-11 | Destination addressing mode + 12-13 | Reserved + 14-15 | Source addressing mode For the cc2420 bit 0 is the most right bit and bit 15 is the most left bit. But the 2 FCF bytes have to be transmitted littel endian (byte 15 to 8 first than 7 to 0) @@ -97,8 +97,8 @@ Frame type value: * Structure to represent a cc2420 packet. */ typedef struct __attribute__ ((packed)) { - /* @{ */ - uint8_t length; /** < the length of the frame of the frame including fcs*/ + /* @{ */ + uint8_t length; /** < the length of the frame of the frame including fcs*/ ieee802154_frame_t frame; /** < the ieee802154 frame */ int8_t rssi; /** < the rssi value */ uint8_t lqi; /** < the link quality indicator */ diff --git a/drivers/sht11/sht11.c b/drivers/sht11/sht11.c index 48d3209f6f..dc3969e66b 100644 --- a/drivers/sht11/sht11.c +++ b/drivers/sht11/sht11.c @@ -13,19 +13,19 @@ and Telematics group (http://cst.mi.fu-berlin.de). *******************************************************************************/ /** - * @defgroup sht11 SHT11 - * @ingroup drivers - * @brief Driver for the Sensirion SHT11 humidity and temperature sensor + * @defgroup sht11 SHT11 + * @ingroup drivers + * @brief Driver for the Sensirion SHT11 humidity and temperature sensor * @{ */ /** * @file - * @brief SHT11 Device Driver + * @brief SHT11 Device Driver * * @version $Revision: 2396 $ * - * @note $Id: sht11.c 2396 2010-07-06 15:12:35Z ziegert $ + * @note $Id: sht11.c 2396 2010-07-06 15:12:35Z ziegert $ */ #include