Browse Source

Fixed a lot of comments by removing tabs and correcting format.

dev/timer
Hauke Petersen 9 years ago
parent
commit
edcabf7cb6
  1. 5
      core/bitarithm.c
  2. 2
      core/include/config.h
  3. 5
      core/include/hwtimer.h
  4. 2
      core/include/io.h
  5. 2
      core/include/irq.h
  6. 1
      core/include/lifo.h
  7. 2
      core/include/msg.h
  8. 2
      core/include/queue.h
  9. 3
      core/lifo.c
  10. 4
      core/sched.c
  11. 5
      cpu/arm_common/arm_cpu.c
  12. 6
      cpu/cc430/doc.txt
  13. 64
      cpu/lpc2387/gpioint/lpc2387-gpioint.c
  14. 8
      cpu/lpc2387/include/cpu.h
  15. 6
      cpu/lpc_common/doc.txt
  16. 8
      cpu/mc1322x/include/cpu.h
  17. 11
      cpu/msp430-common/include/cpu.h
  18. 4
      cpu/native/include/cpu.h
  19. 4
      cpu/native/include/nativenet.h
  20. 209
      drivers/cc110x/cc1100.h
  21. 48
      drivers/cc110x_ng/cc110x-defaultSettings.c
  22. 24
      drivers/cc110x_ng/cc110x-rx.c
  23. 9
      drivers/cc110x_ng/cc110x-tx.c
  24. 26
      drivers/cc110x_ng/cc110x.c
  25. 16
      drivers/cc110x_ng/include/cc110x-arch.h
  26. 76
      drivers/cc110x_ng/include/cc110x-config.h
  27. 53
      drivers/cc110x_ng/include/cc110x-defaultSettings.h
  28. 109
      drivers/cc110x_ng/include/cc110x-internal.h
  29. 11
      drivers/cc110x_ng/include/cc110x-reg.h
  30. 100
      drivers/cc110x_ng/include/cc110x_ng.h
  31. 15
      drivers/cc110x_ng/include/cc110x_spi.h
  32. 26
      drivers/cc110x_ng/spi/cc110x_spi.c
  33. 4
      drivers/doc.txt
  34. 23
      drivers/include/adc.h
  35. 82
      drivers/include/diskio.h
  36. 22
      drivers/include/flashrom.h
  37. 49
      drivers/include/gpioint.h
  38. 22
      drivers/include/lm75a-temp-sensor.h
  39. 11
      drivers/include/ltc4150_arch.h
  40. 22
      drivers/include/rtc.h
  41. 43
      drivers/include/sht11.h
  42. 27
      drivers/include/srf02-ultrasonic-sensor.h
  43. 23
      drivers/include/srf08-ultrasonic-sensor.h
  44. 4
      sys/doc.txt
  45. 12
      sys/include/auto_init.h
  46. 21
      sys/include/bloom.h
  47. 11
      sys/include/board_uart0.h
  48. 6
      sys/include/chardev_thread.h
  49. 25
      sys/include/hashes.h
  50. 6
      sys/include/ping.h
  51. 6
      sys/include/posix_io.h
  52. 6
      sys/include/ps.h
  53. 6
      sys/include/random.h
  54. 6
      sys/include/sha256.h
  55. 6
      sys/include/shell.h
  56. 6
      sys/include/timex.h
  57. 6
      sys/include/transceiver.h
  58. 18
      sys/include/vtimer.h
  59. 6
      sys/net/doc.txt
  60. 19
      sys/net/include/ieee802154_frame.h
  61. 24
      sys/net/include/net_help.h
  62. 42
      sys/net/include/protocol-multiplex.h
  63. 29
      sys/net/rpl/rpl.h
  64. 30
      sys/net/sixlowpan/lowpan.h

5
core/bitarithm.c

@ -9,10 +9,15 @@
/**
* @ingroup core_util
* @{
<<<<<<< HEAD
*
* @file bitarithm.c
* @brief Bit arithmetic helper functions implementation
*
=======
* @file bitarithm.c
* @brief Bit arithmetic helper functions implementation
>>>>>>> 94fedda... Fixed a lot of comments by removing tabs and correcting format.
* @author Kaspar Schleiser <kaspar.schleiser@fu-berlin.de>
* @author Martin Lenders <mlenders@inf.fu-berlin.de>
*

2
core/include/config.h

@ -13,9 +13,9 @@
* @file config.h
* @brief Kernel configuration interface
*
* @author unknown
*/
#ifndef CONFIG_H
#define CONFIG_H

5
core/include/hwtimer.h

@ -122,12 +122,9 @@ void hwtimer_spin(unsigned long ticks);
int hwtimer_active(void);
/**
* @}
*/
/** @} */
/* internal */
/**
* @brief TODO
* @internal

2
core/include/io.h

@ -24,5 +24,5 @@
int fw_puts(char *data, int count);
/** @} */
/** @} */
#endif /* IO_H */

2
core/include/irq.h

@ -57,5 +57,5 @@ void restoreIRQ(unsigned state);
*/
int inISR(void);
/** @} */
/** @} */
#endif /* IRQ_H_ */

1
core/include/lifo.h

@ -13,6 +13,7 @@
* @file lifo.h
* @brief LIFO buffer API
*
* @author unknwon
*/
#ifndef __LIFO_H

2
core/include/msg.h

@ -19,7 +19,7 @@
* queue are never dropped and the sending never blocks. Threads with a full message queue behaves
* like in synchronous mode.
*
* @{
* @{
*
* @file msg.h
* @brief Messaging API for inter process communication

2
core/include/queue.h

@ -13,8 +13,6 @@
* @file queue.h
* @brief A simple queue implementation
*
* TODO document functions and datastructures
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author Kaspar Schleiser <kaspar@schleiser.de>
*/

3
core/lifo.c

@ -13,6 +13,9 @@
* @file lifo.c
* @brief LIFO buffer implementation
*
* @file lifo.c
* @brief LIFO buffer implementation
* @author unknown
* @}
*/

4
core/sched.c

@ -17,10 +17,10 @@
* @author Kaspar Schleiser <kaspar.schleiser@fu-berlin.de>
*
* @}
*
* TODO: setup dependency from SCHEDSTATISTICS to MODULE_HWTIMER
*/
/* TODO: setup dependency from SCHEDSTATISTICS to MODULE_HWTIMER */
#include <stdint.h>
#include <sched.h>
#include <kernel.h>

5
cpu/arm_common/arm_cpu.c

@ -15,11 +15,6 @@
* @author Heiko Will <heiko.will@fu-berlin.de>
* @}
*/
/**
*
*
*
*/
#include <stdio.h>
#include "arm_cpu.h"

6
cpu/cc430/doc.txt

@ -7,7 +7,7 @@
*/
/**
* @defgroup cc430 TI CC430
* @brief Texas Instruments CC430 specific code
* @ingroup cpu
* @defgroup cc430 TI CC430
* @brief Texas Instruments CC430 specific code
* @ingroup cpu
*/

64
cpu/lpc2387/gpioint/lpc2387-gpioint.c

@ -11,20 +11,20 @@ See the file LICENSE in the top level directory for more details.
*******************************************************************************/
/**
* @ingroup lpc2387
* @ingroup lpc2387
* @{
*/
/**
* @file
* @brief LPC2387 GPIO Interrupt Multiplexer implementation
* @brief LPC2387 GPIO Interrupt Multiplexer implementation
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author Michael Baar <michael.baar@fu-berlin.de>
* @author Michael Baar <michael.baar@fu-berlin.de>
* @version $Revision: 1508 $
*
* @note $Id: lpc2387-gpioint.c 1508 2009-10-26 15:10:02Z baar $
* @see dev_gpioint
* @note $Id: lpc2387-gpioint.c 1508 2009-10-26 15:10:02Z baar $
* @see dev_gpioint
*/
#include <stdio.h>
@ -34,7 +34,7 @@ See the file LICENSE in the top level directory for more details.
#include <irq.h>
struct irq_callback_t {
fp_irqcb callback;
fp_irqcb callback;
};
static struct irq_callback_t gpioint0[32];
@ -54,50 +54,50 @@ void gpioint_init(void)
bool
gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
{
struct irq_callback_t *cbdata;
struct irq_callback_t *cbdata;
unsigned long bit;
volatile unsigned long *en_f;
volatile unsigned long *en_r;
volatile unsigned long *en_clr;
/* lookup registers */
bit = number_of_highest_bit(bitmask); /* get irq mapping table index */
bit = number_of_highest_bit(bitmask); /* get irq mapping table index */
switch(port) {
case 0: /* PORT0 */
case 0: /* PORT0 */
cbdata = gpioint0;
en_f = &IO0_INT_EN_F;
en_r = &IO0_INT_EN_R;
en_clr = &IO0_INT_CLR;
break;
case 2: /* PORT2 */
case 2: /* PORT2 */
cbdata = gpioint2;
en_f = &IO2_INT_EN_F;
en_r = &IO2_INT_EN_R;
en_clr = &IO2_INT_CLR;
break;
default: /* unsupported */
return false; /* fail */
default: /* unsupported */
return false; /* fail */
}
/* reconfigure irq */
unsigned long cpsr = disableIRQ();
*en_clr |= bitmask; /* clear interrupt */
*en_clr |= bitmask; /* clear interrupt */
if ((flags & GPIOINT_FALLING_EDGE) != 0) {
*en_f |= bitmask; /* enable falling edge */
*en_f |= bitmask; /* enable falling edge */
}
else {
*en_f &= ~bitmask; /* disable falling edge */
*en_f &= ~bitmask; /* disable falling edge */
}
if ((flags & GPIOINT_RISING_EDGE) != 0) {
*en_r |= bitmask; /* enable rising edge */
*en_r |= bitmask; /* enable rising edge */
}
else {
*en_r &= ~bitmask; /* disable rising edge */
*en_r &= ~bitmask; /* disable rising edge */
}
if (((flags & (GPIOINT_FALLING_EDGE | GPIOINT_RISING_EDGE)) != 0)) {
@ -105,12 +105,12 @@ gpioint_set(int port, uint32_t bitmask, int flags, fp_irqcb callback)
}
else {
cbdata[bit].callback = NULL; /* remove from interrupt mapping table */
cbdata[bit].callback = NULL; /* remove from interrupt mapping table */
}
restoreIRQ(cpsr);
return true; /* success */
return true; /* success */
}
/*---------------------------------------------------------------------------*/
static void __attribute__((__no_instrument_function__)) test_irq(int port, unsigned long f_mask, unsigned long r_mask, struct irq_callback_t *pcb)
@ -122,7 +122,7 @@ static void __attribute__((__no_instrument_function__)) test_irq(int port, unsig
do {
if ((pcb->callback != NULL)) {
if ((r_mask & 1) | (f_mask & 1)) {
pcb->callback(); /* pass to handler */
pcb->callback(); /* pass to handler */
}
}
@ -135,7 +135,7 @@ static void __attribute__((__no_instrument_function__)) test_irq(int port, unsig
/*---------------------------------------------------------------------------*/
void GPIO_IRQHandler(void) __attribute__((interrupt("IRQ")));
/**
* @brief GPIO Interrupt handler function
* @brief GPIO Interrupt handler function
* @internal
*
* Invoked whenever an activated gpio interrupt is triggered by a rising
@ -143,27 +143,27 @@ void GPIO_IRQHandler(void) __attribute__((interrupt("IRQ")));
*/
void __attribute__((__no_instrument_function__)) GPIO_IRQHandler(void)
{
if (IO_INT_STAT & BIT0) { /* interrupt(s) on PORT0 pending */
unsigned long int_stat_f = IO0_INT_STAT_F; /* save content */
unsigned long int_stat_r = IO0_INT_STAT_R; /* save content */
if (IO_INT_STAT & BIT0) { /* interrupt(s) on PORT0 pending */
unsigned long int_stat_f = IO0_INT_STAT_F; /* save content */
unsigned long int_stat_r = IO0_INT_STAT_R; /* save content */
IO0_INT_CLR = int_stat_f; /* clear flags of fallen pins */
IO0_INT_CLR = int_stat_r; /* clear flags of risen pins */
IO0_INT_CLR = int_stat_f; /* clear flags of fallen pins */
IO0_INT_CLR = int_stat_r; /* clear flags of risen pins */
test_irq(0, int_stat_f, int_stat_r, gpioint0);
}
if (IO_INT_STAT & BIT2) { /* interrupt(s) on PORT2 pending */
unsigned long int_stat_f = IO2_INT_STAT_F; /* save content */
unsigned long int_stat_r = IO2_INT_STAT_R; /* save content */
if (IO_INT_STAT & BIT2) { /* interrupt(s) on PORT2 pending */
unsigned long int_stat_f = IO2_INT_STAT_F; /* save content */
unsigned long int_stat_r = IO2_INT_STAT_R; /* save content */
IO2_INT_CLR = int_stat_f; /* clear flags of fallen pins */
IO2_INT_CLR = int_stat_r; /* clear flags of risen pins */
IO2_INT_CLR = int_stat_f; /* clear flags of fallen pins */
IO2_INT_CLR = int_stat_r; /* clear flags of risen pins */
test_irq(2, int_stat_f, int_stat_r, gpioint2);
}
VICVectAddr = 0; /* Acknowledge Interrupt */
VICVectAddr = 0; /* Acknowledge Interrupt */
}
/*---------------------------------------------------------------------------*/
/** @} */

8
cpu/lpc2387/include/cpu.h

@ -14,9 +14,9 @@ See the file LICENSE in the top level directory for more details.
#define __CPU_H
/**
* @defgroup lpc2387 NXP LPC2387
* @ingroup cpu
* @brief NXP LPC2387 specific code
* @defgroup lpc2387 NXP LPC2387
* @ingroup cpu
* @brief NXP LPC2387 specific code
* @{
*/
@ -24,7 +24,7 @@ See the file LICENSE in the top level directory for more details.
#include "lpc2387.h"
#include "arm_cpu.h"
extern uintptr_t __stack_start; ///< end of user stack memory space
extern uintptr_t __stack_start; ///< end of user stack memory space
void lpc2387_pclk_scale(uint32_t source, uint32_t target, uint32_t *pclksel, uint32_t *prescale);
bool install_irq(int IntNumber, void (*HandlerAddr)(void), int Priority);

6
cpu/lpc_common/doc.txt

@ -7,7 +7,7 @@
*/
/**
* @defgroup lpc_common LPC common
* @brief Common code for all arm-based LPC controllers
* @ingroup cpu
* @defgroup lpc_common LPC common
* @brief Common code for all arm-based LPC controllers
* @ingroup cpu
*/

8
cpu/mc1322x/include/cpu.h

@ -7,9 +7,9 @@
*/
/**
* @defgroup mc1322x Freescale MC1322x
* @ingroup cpu
* @brief Freescale MC1322x specific code
* @defgroup mc1322x Freescale MC1322x
* @ingroup cpu
* @brief Freescale MC1322x specific code
*/
#ifndef CPU_H
@ -19,6 +19,6 @@
#include "arm_cpu.h"
#include "mc1322x.h"
extern uintptr_t __stack_start; ///< end of user stack memory space
extern uintptr_t __stack_start; ///< end of user stack memory space
#endif /* CPU_H */

11
cpu/msp430-common/include/cpu.h

@ -14,12 +14,12 @@ See the file LICENSE in the top level directory for more details.
#define _CPU_H
/**
* @defgroup msp430 TI MSP430
* @ingroup cpu
* @brief Texas Instruments MSP430 specific code
* @defgroup msp430 TI MSP430
* @ingroup cpu
* @brief Texas Instruments MSP430 specific code
<h2>First steps</h2>
\li See the <a href="../manual/index.html">manual</a> for toolchain and ide setup
\li See the <a href="../manual/index.html">manual</a> for toolchain and ide setup
* @{
*/
@ -34,7 +34,7 @@ See the file LICENSE in the top level directory for more details.
/* CPU speed */
#define F_CPU (2457600ul)
#define F_RC_OSCILLATOR (32768) ///< Frequency of internal RC oscillator
#define F_RC_OSCILLATOR (32768) ///< Frequency of internal RC oscillator
extern volatile int __inISR;
extern char __isr_stack[MSP430_ISR_STACK_SIZE];
@ -132,4 +132,3 @@ void msp430_cpu_init(void);
/** @} */
#endif // _CPU_H

4
cpu/native/include/cpu.h

@ -13,8 +13,8 @@
/**
* @ingroup arch
* @defgroup native_cpu Native CPU
* @ingroup cpu
* @brief CPU abstraction for the native port
* @ingroup cpu
* @brief CPU abstraction for the native port
* @{
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
*/

4
cpu/native/include/nativenet.h

@ -16,8 +16,8 @@
*/
/**
* @defgroup native_net
* @ingroup native_cpu
* @defgroup native_net
* @ingroup native_cpu
* @{
* @author Ludwig Ortmann <ludwig.ortmann@fu-berlin.de>
*/

209
drivers/cc110x/cc1100.h

@ -1,8 +1,8 @@
/******************************************************************************
/*
* Copyright 2008, Freie Universitaet Berlin (FUB). All rights reserved.
*
* These sources were developed at the Freie Universitaet Berlin, Computer Systems
and Telematics group (http://cst.mi.fu-berlin.de).
* and Telematics group (http://cst.mi.fu-berlin.de).
* ----------------------------------------------------------------------------
* This file is part of RIOT.
*
@ -13,27 +13,21 @@ and Telematics group (http://cst.mi.fu-berlin.de).
*******************************************************************************/
/**
* @defgroup drivers_cc110x CC110x
* @ingroup drivers
* @brief Texas Instruments CC110x driver
* @defgroup drivers_cc110x CC110x
* @ingroup drivers
* @brief Texas Instruments CC110x driver
*
* <h3>Quick links</h3>
* \li \ref cc1100_packet_layer0_t MAC packet format
* \li \ref cc1100_packet_layer0_t MAC packet format
*
* <hr>
* @{
*/
/**
*
* @file
* @brief TI Chipcon CC110x radio driver
* @brief TI Chipcon CC110x radio driver
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @version $Revision: 2128 $
*
* @note $Id: cc1100.h 2128 2010-05-12 12:07:59Z hillebra $
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @author Heiko Will <hwill@inf.fu-berlin.de>
*/
#ifndef CC1100_H
@ -43,17 +37,17 @@ and Telematics group (http://cst.mi.fu-berlin.de).
#include "cc1100-interface.h"
/**
* @name Defines used as state values for state machine
* @name Defines used as state values for state machine
* @{
*/
#define RADIO_UNKNOWN (0)
#define RADIO_AIR_FREE_WAITING (1)
#define RADIO_WOR (2)
#define RADIO_IDLE (3)
#define RADIO_SEND_BURST (4)
#define RADIO_RX (5)
#define RADIO_SEND_ACK (6)
#define RADIO_PWD (7)
#define RADIO_UNKNOWN (0)
#define RADIO_AIR_FREE_WAITING (1)
#define RADIO_WOR (2)
#define RADIO_IDLE (3)
#define RADIO_SEND_BURST (4)
#define RADIO_RX (5)
#define RADIO_SEND_ACK (6)
#define RADIO_PWD (7)
/** @} */
@ -102,73 +96,73 @@ typedef struct cc1100_reg {
/** CC1100 radio configuration */
typedef struct cc1100_cfg_t {
cc1100_reg_t reg_cfg; ///< CC1100 register configuration
uint8_t pa_power; ///< Output power setting
cc1100_reg_t reg_cfg; ///< CC1100 register configuration
uint8_t pa_power; ///< Output power setting
} cc1100_cfg_t;
/**
* @brief Radio Control Flags
* @brief Radio Control Flags
*/
typedef struct cc1100_flags {
uint32_t TOF; ///< Time of flight of the last packet and last ACK
uint32_t TCP; ///< Time to compute packet
unsigned RPS : 16; ///< Raw packets sent to transmit last packet
unsigned RETC : 8; ///< Retransmission count of last send packet
unsigned RSSI : 8; ///< The RSSI value of last received packet
unsigned RSSI_SEND : 8; ///< The RSSI value of the last send unicast packet of this node
unsigned LQI : 8; ///< The LQI value of the last received packet
unsigned LL_ACK : 1; ///< Is set if Link-Level ACK is received, otherwise 0 (reset on new burst)
unsigned CAA : 1; ///< The status of the air (1 = air free, 0 = air not free)
unsigned CRC_STATE : 1; ///< The CRC status of last received packet (1 = OK, 0 = not OK)
unsigned SEQ : 1; ///< Sequence number (toggles between 0 and 1)
unsigned MAN_WOR : 1; ///< Manual WOR set (for randomized WOR times => no synch)
unsigned KT_RES_ERR : 1; ///< A hwtimer resource error has occurred (no free timers available)
unsigned TX : 1; ///< State machine TX lock, only ACKs will be received
unsigned WOR_RST : 1; ///< Reset CC1100 real time clock (WOR) on next WOR strobe
uint32_t TOF; ///< Time of flight of the last packet and last ACK
uint32_t TCP; ///< Time to compute packet
unsigned RPS : 16; ///< Raw packets sent to transmit last packet
unsigned RETC : 8; ///< Retransmission count of last send packet
unsigned RSSI : 8; ///< The RSSI value of last received packet
unsigned RSSI_SEND : 8; ///< The RSSI value of the last send unicast packet of this node
unsigned LQI : 8; ///< The LQI value of the last received packet
unsigned LL_ACK : 1; ///< Is set if Link-Level ACK is received, otherwise 0 (reset on new burst)
unsigned CAA : 1; ///< The status of the air (1 = air free, 0 = air not free)
unsigned CRC_STATE : 1; ///< The CRC status of last received packet (1 = OK, 0 = not OK)
unsigned SEQ : 1; ///< Sequence number (toggles between 0 and 1)
unsigned MAN_WOR : 1; ///< Manual WOR set (for randomized WOR times => no synch)
unsigned KT_RES_ERR : 1; ///< A hwtimer resource error has occurred (no free timers available)
unsigned TX : 1; ///< State machine TX lock, only ACKs will be received
unsigned WOR_RST : 1; ///< Reset CC1100 real time clock (WOR) on next WOR strobe
} cc1100_flags;
/**
* @brief Statistic interface for debugging
* @brief Statistic interface for debugging
*/
typedef struct cc1100_statistic {
uint32_t packets_in;
uint32_t packets_in_crc_fail;
uint32_t packets_in_while_tx;
uint32_t packets_in_dups;
uint32_t packets_in_up;
uint32_t packets_out;
uint32_t packets_out_acked;
uint32_t packets_out_broadcast;
uint32_t raw_packets_out;
uint32_t raw_packets_out_acked;
uint32_t acks_send;
uint32_t rx_buffer_max;
uint32_t watch_dog_resets;
uint32_t packets_in;
uint32_t packets_in_crc_fail;
uint32_t packets_in_while_tx;
uint32_t packets_in_dups;
uint32_t packets_in_up;
uint32_t packets_out;
uint32_t packets_out_acked;
uint32_t packets_out_broadcast;
uint32_t raw_packets_out;
uint32_t raw_packets_out_acked;
uint32_t acks_send;
uint32_t rx_buffer_max;
uint32_t watch_dog_resets;
} cc1100_statistic_t;
enum radio_mode {
RADIO_MODE_GET = -1, ///< leave mode unchanged
RADIO_MODE_OFF = 0, ///< turn radio off
RADIO_MODE_ON = 1 ///< turn radio on
RADIO_MODE_GET = -1, ///< leave mode unchanged
RADIO_MODE_OFF = 0, ///< turn radio off
RADIO_MODE_ON = 1 ///< turn radio on
};
enum radio_result {
RADIO_PAYLOAD_TOO_LONG = -1, ///< payload too long
RADIO_WRONG_MODE = -2, ///< operation not supported in current mode
RADIO_ADDR_OUT_OF_RANGE = -3, ///< address out of range
RADIO_OP_FAILED = -4, ///< operation failed
RADIO_CS_TIMEOUT = -5, ///< Carrier Sense timeout: air was never free
RADIO_INVALID_PARAM = -6 ///< Invalid parameters passed to radio
RADIO_PAYLOAD_TOO_LONG = -1, ///< payload too long
RADIO_WRONG_MODE = -2, ///< operation not supported in current mode
RADIO_ADDR_OUT_OF_RANGE = -3, ///< address out of range
RADIO_OP_FAILED = -4, ///< operation failed
RADIO_CS_TIMEOUT = -5, ///< Carrier Sense timeout: air was never free
RADIO_INVALID_PARAM = -6 ///< Invalid parameters passed to radio
};
/* ------------------------------------------------------------------------- */
// Variable declarations (also used in other files)
// Variable declarations (also used in other files)
/* ------------------------------------------------------------------------- */
extern volatile cc1100_flags rflags; ///< Radio flags
extern volatile cc1100_flags rflags; ///< Radio flags
extern volatile uint8_t radio_mode; ///< Radio mode
extern volatile uint8_t radio_state; ///< Radio state
extern volatile uint8_t radio_mode; ///< Radio mode
extern volatile uint8_t radio_state; ///< Radio state
/** Mode callback functions */
typedef void (*cc1100_mode_callback_t)(void);
@ -177,85 +171,85 @@ extern volatile cc1100_mode_callback_t cc1100_go_receive;
extern volatile cc1100_mode_callback_t cc1100_go_after_tx;
extern volatile cc1100_mode_callback_t cc1100_setup_mode;
extern volatile int wor_hwtimer_id; ///< WOR hwtimer identifier
extern volatile int wor_hwtimer_id; ///< WOR hwtimer identifier
/* ------------------------------------------------------------------------- */
// CC1100 radio driver API
// CC1100 radio driver API
/* ------------------------------------------------------------------------- */
/**
* @brief Set chip and state machine to IDLE mode.
* @brief Set chip and state machine to IDLE mode.
*/
void cc1100_set_idle(void);
/**
* @brief Convert radio mode to textual representation.
* @brief Convert radio mode to textual representation.
*
* @param mode The radio mode to convert.
* @param mode The radio mode to convert.
*
* @return Textual representation of radio mode.
* @return Textual representation of radio mode.
*/
char *cc1100_mode_to_text(uint8_t mode);
/**
* @brief Convert radio state to textual representation.
* @brief Convert radio state to textual representation.
*
* @param mode The radio state to convert.
* @param mode The radio state to convert.
*
* @return Textual representation of radio state.
* @return Textual representation of radio state.
*/
char *cc1100_state_to_text(uint8_t state);
/**
* @brief Convert current output power to textual representation.
* @brief Convert current output power to textual representation.
*
* @return Textual representation of current output power in dBm.
* @return Textual representation of current output power in dBm.
*/
char *cc1100_get_output_power(char *buf);
/**
* @brief Read out main radio control FSM state.
* @brief Read out main radio control FSM state.
*
* @return Textual representation of current main radio control FSM state.
* @return Textual representation of current main radio control FSM state.
*/
char *cc1100_get_marc_state(void);
/**
* @brief hwtimer wrapper function.
* @brief hwtimer wrapper function.
*
* This wrapper function puts the radio to receive mode.
*
* @param ptr Optional data (only to match hwtimer interface).
* @param ptr Optional data (only to match hwtimer interface).
*/
void cc1100_hwtimer_go_receive_wrapper(void *ptr);
/**
* @brief GDO0 interrupt handler.
* @brief GDO0 interrupt handler.
*/
void cc1100_gdo0_irq(void);
/**
* @brief GDO2 interrupt handler.
* @brief GDO2 interrupt handler.
*
* @note Wakes up MCU on packet reception.
* @note Wakes up MCU on packet reception.
*/
void cc1100_gdo2_irq(void);
/**
* @brief Transfer packet from CC1100 RX FIFO.
* @brief Transfer packet from CC1100 RX FIFO.
*
* Transfers a packet from CC1100 RX FIFO into a buffer.
*
* @param rxBuffer The buffer in which to transfer the packet.
* @param length The size of the buffer in which to transfer the packet.
* @param rxBuffer The buffer in which to transfer the packet.
* @param length The size of the buffer in which to transfer the packet.
*
* @return true if operation succeeded; false otherwise (e.g. no data
* @return true if operation succeeded; false otherwise (e.g. no data
* available, buffer to small or CRC check failed).
*/
bool cc1100_spi_receive_packet(uint8_t *rxBuffer, uint8_t length);
/**
* @brief Sends raw data.
* @brief Sends raw data.
*
* Sends the data of the given buffer. The first two bytes of the
* buffer must match the CC1100 packet format (so address interpretation
@ -264,8 +258,8 @@ bool cc1100_spi_receive_packet(uint8_t *rxBuffer, uint8_t length);
* This function is not mode safe!The radio must be woke up before
* sending and has to be put back manually to receive mode.
*
* @param tx_buffer Data source buffer.
* @param size The size of the data source buffer (maximum: 62 bytes).
* @param tx_buffer Data source buffer.
* @param size The size of the data source buffer (maximum: 62 bytes).
*/
void cc1100_send_raw(uint8_t *tx_buffer, uint8_t size);
@ -275,62 +269,61 @@ void cc1100_send_raw(uint8_t *tx_buffer, uint8_t size);
*/
/**
* @brief Initialize radio for carrier sense detection.
* @brief Initialize radio for carrier sense detection.
*/
void cc1100_cs_init(void);
/**
* @brief Enable or disable carrier sense detections.
* @brief Enable or disable carrier sense detections.
*
* Turns interrupts for carrier sense on or off.
*
* @param enabled true if carrier sense detection should
* @param enabled true if carrier sense detection should
* be enabled; false otherwise.
*/
void cc1100_cs_set_enabled(bool enabled);
/**
* @brief Read carrier sense signal.
* @brief Read carrier sense signal.
*
* @return High (1) if air is not free; low (0) if air is
* @return High (1) if air is not free; low (0) if air is
* currently free.
*/
int cc1100_cs_read(void);
/**
* @brief Reads the CCA (Clear Channel Assessment) flag.
* @brief Reads the CCA (Clear Channel Assessment) flag.
*
* The CCA flag is set by an interrupt service routine, after
* carrier sense detection is enabled. So the status of the
* carrier sense signal can be evaluated in a non blocking
* manner.
*
* @return The current value of the CCA flag (High: air is free,
* low: air is not free).
* @return The current value of the CCA flag (High: air is free,
* low: air is not free).
*/
int cc1100_cs_read_cca(void);
/**
* @brief Sets the CCA flag.
* @brief Sets the CCA flag.
*
* @param cca The new value for the CCA flag.
* @param cca The new value for the CCA flag.
*/
void cc1100_cs_write_cca(const int cca);
/** @} */
/**
* @name Statistic interface
* @name Statistic interface
* @{
*/
/**
* @brief Reset radio statistics.
* @brief Reset radio statistics.
*/
void cc1100_reset_statistic(void);
/** @} */
/** @} */
#endif

48
drivers/cc110x_ng/cc110x-defaultSettings.c

@ -1,6 +1,4 @@
/**
* Default configuration for the cc110x chip
*
/*
* Copyright (C) 2013 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser General
@ -9,19 +7,17 @@
*/
/**
* @ingroup drivers_cc110x_ng
* @ingroup drivers_cc110x_ng
* @{
*
* @file
* @brief TI Chipcon CC110x default settings
* @brief TI Chipcon CC110x default settings
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author INRIA
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @author Thomas Hillebrandt <hillebra@inf.fu-berlin.de>
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @author Oliver Hahm <oliver.hahm@inria.fr>
*
* @note $Id: cc110x-defaultSettings.c 2058 2010-03-31 08:59:31Z hillebra $
* @}
*/
@ -35,7 +31,7 @@
* -----------------------------------------
* 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
@ -68,9 +64,9 @@ char cc110x_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
@ -105,18 +101,18 @@ char cc110x_conf[] = {
0x00 // padding to 4 bytes
};
uint8_t pa_table_index = PATABLE; ///< Current PATABLE Index
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
uint8_t pa_table_index = PATABLE; ///< Current PATABLE Index
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!

24
drivers/cc110x_ng/cc110x-rx.c

@ -8,13 +8,15 @@
*/
/**
* @ingroup drivers_cc110x_ng
* @ingroup drivers_cc110x_ng
* @{
* @file cc110x-rx.c
* @brief Functions for packet reception on cc110x
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @file cc110x-rx.c
* @brief Functions for packet reception on cc110x
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @}
*/
#include <cc110x_ng.h>
#include <cc110x-internal.h>
#include <cc110x-config.h>
@ -41,8 +43,8 @@ static uint8_t is_ignored(radio_address_t addr);
static uint8_t receive_packet_variable(uint8_t *rxBuffer, uint8_t length);
static uint8_t receive_packet(uint8_t *rxBuffer, uint8_t length);
rx_buffer_t cc110x_rx_buffer[RX_BUF_SIZE]; ///< RX buffer
volatile uint8_t rx_buffer_next; ///< Next packet in RX queue
rx_buffer_t cc110x_rx_buffer[RX_BUF_SIZE]; ///< RX buffer
volatile uint8_t rx_buffer_next; ///< Next packet in RX queue
void cc110x_rx_handler(void)
{
@ -66,13 +68,13 @@ void cc110x_rx_handler(void)
cc110x_rx_buffer[rx_buffer_next].rssi = rflags._RSSI;
cc110x_rx_buffer[rx_buffer_next].lqi = rflags._LQI;
cc110x_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */
cc110x_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */
/* 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). */
//cc110x_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */
cc110x_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME (until end of packet) */
//cc110x_spi_write_reg(CC1100_MCSM0, 0x08); /* Turn off FS-Autocal */
cc110x_write_reg(CC1100_MCSM2, 0x07); /* Configure RX_TIME (until end of packet) */
cc110x_strobe(CC1100_SRX);
hwtimer_wait(IDLE_TO_RX_TIME);
radio_state = RADIO_RX;
@ -106,8 +108,8 @@ void cc110x_rx_handler(void)
rflags.TOF = 0;
/* CRC false or RX buffer full -> clear RX FIFO in both cases */
cc110x_strobe(CC1100_SIDLE); /* Switch to IDLE (should already be)... */
cc110x_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */
cc110x_strobe(CC1100_SIDLE); /* Switch to IDLE (should already be)... */
cc110x_strobe(CC1100_SFRX); /* ...for flushing the RX FIFO */
/* If packet interrupted this nodes send call,
* don't change anything after this point. */

9
drivers/cc110x_ng/cc110x-tx.c

@ -8,11 +8,12 @@
*/
/**
* @ingroup drivers_cc110x_ng
* @ingroup drivers_cc110x_ng
* @{
* @file cc110x-tx.c
* @brief Functions for packet transmission on cc110x
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @file cc110x-tx.c
* @brief Functions for packet transmission on cc110x
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @}
*/
#include <stdio.h>

26
drivers/cc110x_ng/cc110x.c

@ -8,12 +8,12 @@
*/
/**
* @ingroup drivers_cc110x_ng
* @ingroup drivers_cc110x_ng
* @{
* @file cc110x.c
* @brief Basic functionality of cc110x driver
*
* @file cc110x.c
* @brief Basic functionality of cc110x driver
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @}
*/
#include <cc110x_ng.h>
@ -32,15 +32,15 @@
#include <debug.h>
/* some externals */
extern uint8_t pa_table[]; ///< PATABLE with available output powers
extern uint8_t pa_table[]; ///< PATABLE with available output powers
extern uint8_t pa_table_index; ///< Current PATABLE Index
/* global variables */
cc110x_statistic_t cc110x_statistic;
volatile cc110x_flags rflags; ///< Radio control flags
volatile uint8_t radio_state = RADIO_UNKNOWN; ///< Radio state
volatile cc110x_flags rflags; ///< Radio control flags
volatile uint8_t radio_state = RADIO_UNKNOWN; ///< Radio state
static radio_address_t radio_address; ///< Radio address
static uint8_t radio_channel; ///< Radio channel
@ -54,7 +54,7 @@ static void power_up_reset(void);
static void write_register(uint8_t r, uint8_t value);
/*---------------------------------------------------------------------------*
* Radio Driver API *
* Radio Driver API *
*---------------------------------------------------------------------------*/
void cc110x_init(int tpid)
{
@ -353,7 +353,7 @@ int16_t cc110x_get_channel(void)
/*---------------------------------------------------------------------------
* CC1100 reset functionality
* CC1100 reset functionality
*---------------------------------------------------------------------------*/
static void reset(void)
@ -409,13 +409,13 @@ static int rd_set_mode(int mode)
switch(mode) {
case RADIO_MODE_ON:
DEBUG("Enabling rx mode\n");
cc110x_init_interrupts(); /* Enable interrupts */
cc110x_setup_rx_mode(); /* Set chip to desired mode */
cc110x_init_interrupts(); /* Enable interrupts */
cc110x_setup_rx_mode(); /* Set chip to desired mode */
break;
case RADIO_MODE_OFF:
cc110x_disable_interrupts(); /* Disable interrupts */
cc110x_switch_to_pwd(); /* Set chip to power down mode */
cc110x_disable_interrupts(); /* Disable interrupts */
cc110x_switch_to_pwd(); /* Set chip to power down mode */
break;
case RADIO_MODE_GET:

16
drivers/cc110x_ng/include/cc110x-arch.h

@ -1,8 +1,8 @@
/******************************************************************************
/*
* Copyright 2008, Freie Universitaet Berlin (FUB). All rights reserved.
*
* These sources were developed at the Freie Universitaet Berlin, Computer Systems
and Telematics group (http://cst.mi.fu-berlin.de).
* and Telematics group (http://cst.mi.fu-berlin.de).
* ----------------------------------------------------------------------------
* This file is part of RIOT.
*
@ -13,18 +13,16 @@ and Telematics group (http://cst.mi.fu-berlin.de).
*******************************************************************************/
/**
* @ingroup drivers_cc110x_ng
* @ingroup drivers_cc110x_ng
* @{
*
* @file cc110x-arch.h
* @brief CC1100 architecture dependent functions
* @file cc110x-arch.h
* @brief CC1100 architecture dependent functions
*
* @author Freie Universität Berlin, Computer Systems & Telematics
* @author Heiko Will <hwill@inf.fu-berlin.de>
* @version $Revision: 1775 $
*
* @note $Id: arch_cc110x.h 1775 2010-01-26 09:37:03Z hillebra $
* @author Heiko Will <hwill@inf.fu-berlin.de>
*/
#ifndef __CC1100_ARCH_H
#define __CC1100_ARCH_H

76
drivers/cc110x_ng/include/cc110x-config.h

@ -1,18 +1,20 @@
/**
* Configuration parameters for the cc110x radio chip
*
/*
* Copyright (C) 2009 Freie Universität Berlin
* Copyright (C) 2013 INRIA
*
* This file is subject to the terms and conditions of the GNU Lesser General
* Public License. See the file LICENSE in the top level directory for more
* details.
*
* @ingroup drivers_cc110x_ng
*/
/**
* @ingroup drivers_cc110x_ng
* @{
*
* @file cc110x-config.h
* @author Oliver Hahm <oliver.hahm@inria.fr>
* @file cc110x-config.h
* @brief Configuration parameters for the cc110x radio chip
*
* @author Oliver Hahm <oliver.hahm@inria.fr>
*/
#ifndef CC1100_CONFIG_H
#define CC1100_CONFIG_H
@ -65,47 +67,47 @@ typedef struct {
/** CC1100 radio configuration */
typedef struct {
cc110x_reg_t reg_cfg; ///< CC1100 register configuration
uint8_t pa_power; ///< Output power setting
cc110x_reg_t reg_cfg; ///< CC1100 register configuration
uint8_t pa_power; ///< Output power setting
} cc110x_cfg_t;
/**
* @brief Radio Control Flags
* @brief Radio Control Flags
*/
typedef struct {
uint32_t TOF; ///< Time of flight of the last packet and last ACK
uint32_t TOF; ///< Time of flight of the last packet and last ACK
timex_t TOA; ///< Time of packet arriveal
uint32_t TCP; ///< Time to compute packet
unsigned RPS : 16; ///< Raw packets sent to transmit last packet
unsigned RETC : 8; ///< Retransmission count of last send packet
unsigned _RSSI : 8; ///< The RSSI value of last received packet
unsigned RSSI_SEND : 8; ///< The RSSI value of the last send unicast packet of this node
unsigned _LQI : 8; ///< The LQI value of the last received packet
unsigned LL_ACK : 1; ///< Is set if Link-Level ACK is received, otherwise 0 (reset on new burst)
unsigned CAA : 1; ///< The status of the air (1 = air free, 0 = air not free)
unsigned CRC_STATE : 1; ///< The CRC status of last received packet (1 = OK, 0 = not OK)
unsigned SEQ : 1; ///< Sequence number (toggles between 0 and 1)
unsigned MAN_WOR : 1; ///< Manual WOR set (for randomized WOR times => no synch)
unsigned KT_RES_ERR : 1; ///< A hwtimer resource error has occurred (no free timers available)
unsigned TX : 1; ///< State machine TX lock, only ACKs will be received
unsigned WOR_RST : 1; ///< Reset CC1100 real time clock (WOR) on next WOR strobe
uint32_t TCP; ///< Time to compute packet
unsigned RPS : 16; ///< Raw packets sent to transmit last packet
unsigned RETC : 8; ///< Retransmission count of last send packet
unsigned _RSSI : 8; ///< The RSSI value of last received packet
unsigned RSSI_SEND : 8; ///< The RSSI value of the last send unicast packet of this node
unsigned _LQI : 8; ///< The LQI value of the last received packet
unsigned LL_ACK : 1; ///< Is set if Link-Level ACK is received, otherwise 0 (reset on new burst)
unsigned CAA : 1; ///< The status of the air (1 = air free, 0 = air not free)
unsigned CRC_STATE : 1; ///< The CRC status of last received packet (1 = OK, 0 = not OK)
unsigned SEQ : 1; ///< Sequence number (toggles between 0 and 1)
unsigned MAN_WOR : 1; ///< Manual WOR set (for randomized WOR times => no synch)
unsigned KT_RES_ERR : 1; ///< A hwtimer resource error has occurred (no free timers available)
unsigned TX : 1; ///< State machine TX lock, only ACKs will be received
unsigned WOR_RST : 1; ///< Reset CC1100 real time clock (WOR) on next WOR strobe
} cc110x_flags;
/**
* @brief Statistic interface for debugging
* @brief Statistic interface for debugging
*/
typedef struct cc110x_statistic {
uint32_t packets_in;
uint32_t packets_in_crc_fail;
uint32_t packets_in_while_tx;
uint32_t packets_in_dups;
uint32_t packets_in_up;
uint32_t packets_out;
uint32_t packets_out_broadcast;
uint32_t raw_packets_out;
uint32_t acks_send;
uint32_t rx_buffer_max;
uint32_t watch_dog_resets;
uint32_t packets_in;
uint32_t packets_in_crc_fail;
uint32_t packets_in_while_tx;
uint32_t packets_in_dups;
uint32_t packets_in_up;
uint32_t packets_out;
uint32_t packets_out_broadcast;
uint32_t raw_packets_out;
uint32_t acks_send;
uint32_t rx_buffer_max;
uint32_t watch_dog_resets;
} cc110x_statistic_t;
/** @} */