mirror of
https://github.com/oliverschmidt/contiki.git
synced 2025-01-18 03:30:31 +00:00
do2unix conversion
This commit is contained in:
parent
30f5e29db7
commit
4003c3a8c9
@ -1,94 +1,94 @@
|
|||||||
#ifndef CONTIKI_CONF_H
|
#ifndef CONTIKI_CONF_H
|
||||||
#define CONTIKI_CONF_H
|
#define CONTIKI_CONF_H
|
||||||
|
|
||||||
#define HAVE_STDINT_H
|
#define HAVE_STDINT_H
|
||||||
#include "msp430def.h"
|
#include "msp430def.h"
|
||||||
|
|
||||||
#define WITH_SD 0
|
#define WITH_SD 0
|
||||||
|
|
||||||
#define NETSTACK_CONF_RADIO cc1020_driver
|
#define NETSTACK_CONF_RADIO cc1020_driver
|
||||||
#define NETSTACK_CONF_RDC lpp_driver
|
#define NETSTACK_CONF_RDC lpp_driver
|
||||||
#define NETSTACK_CONF_MAC csma_driver
|
#define NETSTACK_CONF_MAC csma_driver
|
||||||
#define NETSTACK_CONF_NETWORK rime_driver
|
#define NETSTACK_CONF_NETWORK rime_driver
|
||||||
#define NETSTACK_CONF_FRAMER framer_nullmac
|
#define NETSTACK_CONF_FRAMER framer_nullmac
|
||||||
|
|
||||||
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
#define MAC_CONF_CHANNEL_CHECK_RATE 8
|
||||||
|
|
||||||
#define ENERGEST_CONF_ON 1
|
#define ENERGEST_CONF_ON 1
|
||||||
|
|
||||||
#define IRQ_PORT1 0x01
|
#define IRQ_PORT1 0x01
|
||||||
#define IRQ_PORT2 0x02
|
#define IRQ_PORT2 0x02
|
||||||
#define IRQ_ADC 0x03
|
#define IRQ_ADC 0x03
|
||||||
|
|
||||||
/* MSP430 information memory */
|
/* MSP430 information memory */
|
||||||
#define INFOMEM_START 0x1000
|
#define INFOMEM_START 0x1000
|
||||||
#define INFOMEM_BLOCK_SIZE 128
|
#define INFOMEM_BLOCK_SIZE 128
|
||||||
#define INFOMEM_NODE_ID 0x0000 /* - 0x0004 */
|
#define INFOMEM_NODE_ID 0x0000 /* - 0x0004 */
|
||||||
|
|
||||||
#define CC_CONF_REGISTER_ARGS 1
|
#define CC_CONF_REGISTER_ARGS 1
|
||||||
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
#define CC_CONF_FUNCTION_POINTER_ARGS 1
|
||||||
#define CC_CONF_INLINE inline
|
#define CC_CONF_INLINE inline
|
||||||
#define CC_CONF_VA_ARGS 1
|
#define CC_CONF_VA_ARGS 1
|
||||||
|
|
||||||
#define LPP_CONF_LISTEN_TIME 2
|
#define LPP_CONF_LISTEN_TIME 2
|
||||||
#define LPP_CONF_OFF_TIME (CLOCK_SECOND - (LPP_CONF_LISTEN_TIME))
|
#define LPP_CONF_OFF_TIME (CLOCK_SECOND - (LPP_CONF_LISTEN_TIME))
|
||||||
#define QUEUEBUF_CONF_NUM 4
|
#define QUEUEBUF_CONF_NUM 4
|
||||||
|
|
||||||
|
|
||||||
#define CCIF
|
#define CCIF
|
||||||
#define CLIF
|
#define CLIF
|
||||||
|
|
||||||
/* Clear channel assessment timeout for sending with the CC1020 radio. (ms) */
|
/* Clear channel assessment timeout for sending with the CC1020 radio. (ms) */
|
||||||
#define CC1020_CONF_CCA_TIMEOUT 10
|
#define CC1020_CONF_CCA_TIMEOUT 10
|
||||||
|
|
||||||
/* Clock */
|
/* Clock */
|
||||||
typedef unsigned clock_time_t;
|
typedef unsigned clock_time_t;
|
||||||
#define CLOCK_CONF_SECOND 64
|
#define CLOCK_CONF_SECOND 64
|
||||||
#define F_CPU 2457600uL /* CPU target speed in Hz. */
|
#define F_CPU 2457600uL /* CPU target speed in Hz. */
|
||||||
|
|
||||||
#define BAUD2UBR(baud) (F_CPU/(baud))
|
#define BAUD2UBR(baud) (F_CPU/(baud))
|
||||||
|
|
||||||
#include "ctk/ctk-vncarch.h"
|
#include "ctk/ctk-vncarch.h"
|
||||||
|
|
||||||
#define LOG_CONF_ENABLED 0
|
#define LOG_CONF_ENABLED 0
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The statistics data type.
|
* The statistics data type.
|
||||||
*
|
*
|
||||||
* This datatype determines how high the statistics counters are able
|
* This datatype determines how high the statistics counters are able
|
||||||
* to count.
|
* to count.
|
||||||
*/
|
*/
|
||||||
typedef uint16_t uip_stats_t;
|
typedef uint16_t uip_stats_t;
|
||||||
|
|
||||||
typedef int bool;
|
typedef int bool;
|
||||||
#define TRUE 1
|
#define TRUE 1
|
||||||
#define FALSE 0
|
#define FALSE 0
|
||||||
|
|
||||||
#define UIP_CONF_ICMP_DEST_UNREACH 1
|
#define UIP_CONF_ICMP_DEST_UNREACH 1
|
||||||
#define UIP_CONF_DHCP_LIGHT
|
#define UIP_CONF_DHCP_LIGHT
|
||||||
#define UIP_CONF_LLH_LEN 0
|
#define UIP_CONF_LLH_LEN 0
|
||||||
#define UIP_CONF_BUFFER_SIZE 116
|
#define UIP_CONF_BUFFER_SIZE 116
|
||||||
#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40)
|
#define UIP_CONF_RECEIVE_WINDOW (UIP_CONF_BUFFER_SIZE - 40)
|
||||||
#define UIP_CONF_MAX_CONNECTIONS 4
|
#define UIP_CONF_MAX_CONNECTIONS 4
|
||||||
#define UIP_CONF_MAX_LISTENPORTS 8
|
#define UIP_CONF_MAX_LISTENPORTS 8
|
||||||
#define UIP_CONF_UDP_CONNS 8
|
#define UIP_CONF_UDP_CONNS 8
|
||||||
#define UIP_CONF_FWCACHE_SIZE 20
|
#define UIP_CONF_FWCACHE_SIZE 20
|
||||||
#define UIP_CONF_BROADCAST 1
|
#define UIP_CONF_BROADCAST 1
|
||||||
#define UIP_ARCH_IPCHKSUM 1
|
#define UIP_ARCH_IPCHKSUM 1
|
||||||
#define UIP_CONF_UDP_CHECKSUMS 1
|
#define UIP_CONF_UDP_CHECKSUMS 1
|
||||||
#define UIP_CONF_PINGADDRCONF 0
|
#define UIP_CONF_PINGADDRCONF 0
|
||||||
#define UIP_CONF_LOGGING 0
|
#define UIP_CONF_LOGGING 0
|
||||||
|
|
||||||
#define LOADER_CONF_ARCH "loader/loader-arch.h"
|
#define LOADER_CONF_ARCH "loader/loader-arch.h"
|
||||||
|
|
||||||
#define ELFLOADER_CONF_DATAMEMORY_SIZE 100
|
#define ELFLOADER_CONF_DATAMEMORY_SIZE 100
|
||||||
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000
|
#define ELFLOADER_CONF_TEXTMEMORY_SIZE 0x1000
|
||||||
|
|
||||||
/* LEDs ports MSB430 */
|
/* LEDs ports MSB430 */
|
||||||
#define LEDS_PxDIR P5DIR
|
#define LEDS_PxDIR P5DIR
|
||||||
#define LEDS_PxOUT P5OUT
|
#define LEDS_PxOUT P5OUT
|
||||||
#define LEDS_CONF_RED 0x80
|
#define LEDS_CONF_RED 0x80
|
||||||
#define LEDS_CONF_GREEN 0x00
|
#define LEDS_CONF_GREEN 0x00
|
||||||
#define LEDS_CONF_YELLOW 0x00
|
#define LEDS_CONF_YELLOW 0x00
|
||||||
|
|
||||||
#endif /* !CONTIKI_CONF_H */
|
#endif /* !CONTIKI_CONF_H */
|
||||||
|
@ -1,263 +1,263 @@
|
|||||||
#ifndef CC1020_INTERNAL_H
|
#ifndef CC1020_INTERNAL_H
|
||||||
#define CC1020_INTERNAL_H
|
#define CC1020_INTERNAL_H
|
||||||
|
|
||||||
#include <signal.h>
|
#include <signal.h>
|
||||||
|
|
||||||
#define CC1020_MAIN 0x00
|
#define CC1020_MAIN 0x00
|
||||||
#define CC1020_INTERFACE 0x01
|
#define CC1020_INTERFACE 0x01
|
||||||
#define CC1020_RESET 0x02
|
#define CC1020_RESET 0x02
|
||||||
#define CC1020_SEQUENCING 0x03
|
#define CC1020_SEQUENCING 0x03
|
||||||
#define CC1020_FREQ_2A 0x04
|
#define CC1020_FREQ_2A 0x04
|
||||||
#define CC1020_FREQ_1A 0x05
|
#define CC1020_FREQ_1A 0x05
|
||||||
#define CC1020_FREQ_0A 0x06
|
#define CC1020_FREQ_0A 0x06
|
||||||
#define CC1020_CLOCK_A 0x07
|
#define CC1020_CLOCK_A 0x07
|
||||||
#define CC1020_FREQ_2B 0x08
|
#define CC1020_FREQ_2B 0x08
|
||||||
#define CC1020_FREQ_1B 0x09
|
#define CC1020_FREQ_1B 0x09
|
||||||
#define CC1020_FREQ_0B 0x0A
|
#define CC1020_FREQ_0B 0x0A
|
||||||
#define CC1020_CLOCK_B 0x0B
|
#define CC1020_CLOCK_B 0x0B
|
||||||
#define CC1020_VCO 0x0C
|
#define CC1020_VCO 0x0C
|
||||||
#define CC1020_MODEM 0x0D
|
#define CC1020_MODEM 0x0D
|
||||||
#define CC1020_DEVIATION 0x0E
|
#define CC1020_DEVIATION 0x0E
|
||||||
#define CC1020_AFC_CONTROL 0x0F
|
#define CC1020_AFC_CONTROL 0x0F
|
||||||
#define CC1020_FILTER 0x10
|
#define CC1020_FILTER 0x10
|
||||||
#define CC1020_VGA1 0x11
|
#define CC1020_VGA1 0x11
|
||||||
#define CC1020_VGA2 0x12
|
#define CC1020_VGA2 0x12
|
||||||
#define CC1020_VGA3 0x13
|
#define CC1020_VGA3 0x13
|
||||||
#define CC1020_VGA4 0x14
|
#define CC1020_VGA4 0x14
|
||||||
#define CC1020_LOCK 0x15
|
#define CC1020_LOCK 0x15
|
||||||
#define CC1020_FRONTEND 0x16
|
#define CC1020_FRONTEND 0x16
|
||||||
#define CC1020_ANALOG 0x17
|
#define CC1020_ANALOG 0x17
|
||||||
#define CC1020_BUFF_SWING 0x18
|
#define CC1020_BUFF_SWING 0x18
|
||||||
#define CC1020_BUFF_CURRENT 0x19
|
#define CC1020_BUFF_CURRENT 0x19
|
||||||
#define CC1020_PLL_BW 0x1A
|
#define CC1020_PLL_BW 0x1A
|
||||||
#define CC1020_CALIBRATE 0x1B
|
#define CC1020_CALIBRATE 0x1B
|
||||||
#define CC1020_PA_POWER 0x1C
|
#define CC1020_PA_POWER 0x1C
|
||||||
#define CC1020_MATCH 0x1D
|
#define CC1020_MATCH 0x1D
|
||||||
#define CC1020_PHASE_COMP 0x1E
|
#define CC1020_PHASE_COMP 0x1E
|
||||||
#define CC1020_GAIN_COMP 0x1F
|
#define CC1020_GAIN_COMP 0x1F
|
||||||
#define CC1020_POWERDOWN 0x20
|
#define CC1020_POWERDOWN 0x20
|
||||||
#define CC1020_TEST1 0x21
|
#define CC1020_TEST1 0x21
|
||||||
#define CC1020_TEST2 0x22
|
#define CC1020_TEST2 0x22
|
||||||
#define CC1020_TEST3 0x23
|
#define CC1020_TEST3 0x23
|
||||||
#define CC1020_TEST4 0x24
|
#define CC1020_TEST4 0x24
|
||||||
#define CC1020_TEST5 0x25
|
#define CC1020_TEST5 0x25
|
||||||
#define CC1020_TEST6 0x26
|
#define CC1020_TEST6 0x26
|
||||||
#define CC1020_TEST7 0x27
|
#define CC1020_TEST7 0x27
|
||||||
#define CC1020_STATUS 0x40
|
#define CC1020_STATUS 0x40
|
||||||
#define CC1020_RESET_DONE 0x41
|
#define CC1020_RESET_DONE 0x41
|
||||||
#define CC1020_RSS 0x42
|
#define CC1020_RSS 0x42
|
||||||
#define CC1020_AFC 0x43
|
#define CC1020_AFC 0x43
|
||||||
#define CC1020_GAUSS_FILTER 0x44
|
#define CC1020_GAUSS_FILTER 0x44
|
||||||
#define CC1020_STATUS1 0x45
|
#define CC1020_STATUS1 0x45
|
||||||
#define CC1020_STATUS2 0x46
|
#define CC1020_STATUS2 0x46
|
||||||
#define CC1020_STATUS3 0x47
|
#define CC1020_STATUS3 0x47
|
||||||
#define CC1020_STATUS4 0x48
|
#define CC1020_STATUS4 0x48
|
||||||
#define CC1020_STATUS5 0x49
|
#define CC1020_STATUS5 0x49
|
||||||
#define CC1020_STATUS6 0x4A
|
#define CC1020_STATUS6 0x4A
|
||||||
#define CC1020_STATUS7 0x4B
|
#define CC1020_STATUS7 0x4B
|
||||||
|
|
||||||
/* Flags for the MAIN register. */
|
/* Flags for the MAIN register. */
|
||||||
#define RESET_N 1
|
#define RESET_N 1
|
||||||
#define BIAS_PD (1<<1)
|
#define BIAS_PD (1<<1)
|
||||||
#define XOSC_PD (1<<2)
|
#define XOSC_PD (1<<2)
|
||||||
#define FS_PD (1<<3)
|
#define FS_PD (1<<3)
|
||||||
#define PD_MODE_1 (1<<4)
|
#define PD_MODE_1 (1<<4)
|
||||||
#define PD_MODE_2 (1<<5)
|
#define PD_MODE_2 (1<<5)
|
||||||
#define F_REG (1<<6)
|
#define F_REG (1<<6)
|
||||||
#define RXTX (1<<7)
|
#define RXTX (1<<7)
|
||||||
|
|
||||||
/* In power up mode, the MAIN register modifies some flags to the following. */
|
/* In power up mode, the MAIN register modifies some flags to the following. */
|
||||||
#define SEQ_PD (1<<1)
|
#define SEQ_PD (1<<1)
|
||||||
#define SEQ_CAL_1 (1<<2)
|
#define SEQ_CAL_1 (1<<2)
|
||||||
#define SEQ_CAL_2 (1<<3)
|
#define SEQ_CAL_2 (1<<3)
|
||||||
|
|
||||||
// For CC1020_STATUS
|
// For CC1020_STATUS
|
||||||
#define CARRIER_SENSE 0x08
|
#define CARRIER_SENSE 0x08
|
||||||
#define LOCK_CONTINUOUS 0x10
|
#define LOCK_CONTINUOUS 0x10
|
||||||
#define LOCK_INSTANT 0x20
|
#define LOCK_INSTANT 0x20
|
||||||
#define SEQ_ERROR 0x40
|
#define SEQ_ERROR 0x40
|
||||||
#define CAL_COMPLETE 0x80
|
#define CAL_COMPLETE 0x80
|
||||||
|
|
||||||
#define PA_POWER 0x0F // initial default for output power
|
#define PA_POWER 0x0F // initial default for output power
|
||||||
#define LOCK_NOK 0x00
|
#define LOCK_NOK 0x00
|
||||||
#define LOCK_OK 0x01
|
#define LOCK_OK 0x01
|
||||||
#define LOCK_RECAL_OK 0x02
|
#define LOCK_RECAL_OK 0x02
|
||||||
#define CAL_TIMEOUT 0x7FFE
|
#define CAL_TIMEOUT 0x7FFE
|
||||||
#define LOCK_TIMEOUT 0x7FFE
|
#define LOCK_TIMEOUT 0x7FFE
|
||||||
#define RESET_TIMEOUT 0x7FFE
|
#define RESET_TIMEOUT 0x7FFE
|
||||||
#define TX_CURRENT 0x87
|
#define TX_CURRENT 0x87
|
||||||
#define RX_CURRENT 0x86
|
#define RX_CURRENT 0x86
|
||||||
|
|
||||||
// CC1020 driver configuration
|
// CC1020 driver configuration
|
||||||
|
|
||||||
// PDI (Data in) is on P21
|
// PDI (Data in) is on P21
|
||||||
#define PDO (P2IN & 0x01)
|
#define PDO (P2IN & 0x01)
|
||||||
|
|
||||||
// PSEL is on P30 and low active
|
// PSEL is on P30 and low active
|
||||||
#define PSEL_ON do { P3OUT &= ~0x01; } while(0)
|
#define PSEL_ON do { P3OUT &= ~0x01; } while(0)
|
||||||
#define PSEL_OFF do { P3OUT |= 0x01; } while(0)
|
#define PSEL_OFF do { P3OUT |= 0x01; } while(0)
|
||||||
#define PCLK_HIGH do { P2OUT |= 0x08; } while(0)
|
#define PCLK_HIGH do { P2OUT |= 0x08; } while(0)
|
||||||
#define PCLK_LOW do { P2OUT &= ~0x08; } while(0)
|
#define PCLK_LOW do { P2OUT &= ~0x08; } while(0)
|
||||||
|
|
||||||
// PDO (Data out) is on P22
|
// PDO (Data out) is on P22
|
||||||
#define PDI_HIGH do { P2OUT |= 0x02; } while(0)
|
#define PDI_HIGH do { P2OUT |= 0x02; } while(0)
|
||||||
|
|
||||||
#define PDI_LOW do { P2OUT &= ~0x02; } while(0)
|
#define PDI_LOW do { P2OUT &= ~0x02; } while(0)
|
||||||
|
|
||||||
// Enable power for LNA (P24, low-active)
|
// Enable power for LNA (P24, low-active)
|
||||||
#define LNA_POWER_ON() do { P2OUT &= ~0x10; } while(0)
|
#define LNA_POWER_ON() do { P2OUT &= ~0x10; } while(0)
|
||||||
|
|
||||||
#define LNA_POWER_OFF() do { P2OUT |= 0x10; } while(0)
|
#define LNA_POWER_OFF() do { P2OUT |= 0x10; } while(0)
|
||||||
|
|
||||||
#define CC_LOCK (P2IN & 0x04)
|
#define CC_LOCK (P2IN & 0x04)
|
||||||
|
|
||||||
#define DISABLE_RX_IRQ() \
|
#define DISABLE_RX_IRQ() \
|
||||||
do { IE1 &= ~(URXIE0); } while(0)
|
do { IE1 &= ~(URXIE0); } while(0)
|
||||||
|
|
||||||
#define ENABLE_RX_IRQ() \
|
#define ENABLE_RX_IRQ() \
|
||||||
do { IFG1 &= ~URXIFG0; IE1 |= URXIE0; } while(0)
|
do { IFG1 &= ~URXIFG0; IE1 |= URXIE0; } while(0)
|
||||||
|
|
||||||
#define ACK_TIMEOUT_115 4 // In RADIO_STROKE ticks
|
#define ACK_TIMEOUT_115 4 // In RADIO_STROKE ticks
|
||||||
#define ACK_TIMEOUT_19 16
|
#define ACK_TIMEOUT_19 16
|
||||||
|
|
||||||
#define MHZ_869525 1
|
#define MHZ_869525 1
|
||||||
|
|
||||||
const uint8_t cc1020_config_19200[41] = {
|
const uint8_t cc1020_config_19200[41] = {
|
||||||
0x01, // 0x00, MAIN
|
0x01, // 0x00, MAIN
|
||||||
0x0F, // 0x01, INTERFACE
|
0x0F, // 0x01, INTERFACE
|
||||||
0xFF, // 0x02, RESET
|
0xFF, // 0x02, RESET
|
||||||
0x8F, // 0x03, SEQUENCING
|
0x8F, // 0x03, SEQUENCING
|
||||||
// 869.525 at 50kHz
|
// 869.525 at 50kHz
|
||||||
0x3A, // 0x04, FREQ_2A
|
0x3A, // 0x04, FREQ_2A
|
||||||
0x32, // 0x05, FREQ_1A
|
0x32, // 0x05, FREQ_1A
|
||||||
0x97, // 0x06, FREQ_0A // 19200
|
0x97, // 0x06, FREQ_0A // 19200
|
||||||
0x38, // 0x07, CLOCK_A // 19200
|
0x38, // 0x07, CLOCK_A // 19200
|
||||||
0x3A, // 0x08, FREQ_2B
|
0x3A, // 0x08, FREQ_2B
|
||||||
0x37, // 0x09, FREQ_1B
|
0x37, // 0x09, FREQ_1B
|
||||||
0xEB, // 0x0A, FREQ_0B // 19200
|
0xEB, // 0x0A, FREQ_0B // 19200
|
||||||
0x38, // 0x0B, CLOCK_B // 19200
|
0x38, // 0x0B, CLOCK_B // 19200
|
||||||
0x44, // 0x0C, VCO 44
|
0x44, // 0x0C, VCO 44
|
||||||
0x51, // 0x0D, MODEM Manchester
|
0x51, // 0x0D, MODEM Manchester
|
||||||
0x2B, // 0x0E, DEVIATION // FSK
|
0x2B, // 0x0E, DEVIATION // FSK
|
||||||
0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC
|
0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC
|
||||||
0x25, // 0x10, FILTER Bandwith 51.2 kHz i.e. channel spacing 100kHz
|
0x25, // 0x10, FILTER Bandwith 51.2 kHz i.e. channel spacing 100kHz
|
||||||
0x61, // 0x11, VGA1
|
0x61, // 0x11, VGA1
|
||||||
0x55, // 0x12, VGA2
|
0x55, // 0x12, VGA2
|
||||||
0x2D, // 0x13, VGA3
|
0x2D, // 0x13, VGA3
|
||||||
0x37, // 0x14, VGA4 // 0x29, VGA4 ADJUSTED CS to 23!
|
0x37, // 0x14, VGA4 // 0x29, VGA4 ADJUSTED CS to 23!
|
||||||
0x40, // 0x15, LOCK is Carrier SENSE
|
0x40, // 0x15, LOCK is Carrier SENSE
|
||||||
0x76, // 0x16, FRONTEND
|
0x76, // 0x16, FRONTEND
|
||||||
0x87, // 0x17, ANALOG, RX=86/TX=87
|
0x87, // 0x17, ANALOG, RX=86/TX=87
|
||||||
0x10, // 0x18, BUFF_SWING
|
0x10, // 0x18, BUFF_SWING
|
||||||
0x25, // 0x19, BUFF_CURRENT
|
0x25, // 0x19, BUFF_CURRENT
|
||||||
0xAE, // 0x1A, PLL_BW
|
0xAE, // 0x1A, PLL_BW
|
||||||
0x34, // 0x1B, CALIBRATE
|
0x34, // 0x1B, CALIBRATE
|
||||||
PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0
|
PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0
|
||||||
0xF0, // 0x1D, MATCH
|
0xF0, // 0x1D, MATCH
|
||||||
0x00, // 0x1E, PHASE_COMP
|
0x00, // 0x1E, PHASE_COMP
|
||||||
0x00, // 0x1F, GAIN_COMP
|
0x00, // 0x1F, GAIN_COMP
|
||||||
0x00, // 0x20, POWERDOWN
|
0x00, // 0x20, POWERDOWN
|
||||||
0x4d, // 0x4d, // 0x21,
|
0x4d, // 0x4d, // 0x21,
|
||||||
0x10, // 0x10, // 0x22,
|
0x10, // 0x10, // 0x22,
|
||||||
0x06, // 0x06, // 0x23,
|
0x06, // 0x06, // 0x23,
|
||||||
0x00, // 0x00, // 0x24,
|
0x00, // 0x00, // 0x24,
|
||||||
0x40, // 0x40, // 0x25,
|
0x40, // 0x40, // 0x25,
|
||||||
0x00, // 0x00, // 0x26,
|
0x00, // 0x00, // 0x26,
|
||||||
0x00, // 0x00, // 0x27,
|
0x00, // 0x00, // 0x27,
|
||||||
// Not in real config of chipCon from here!!!
|
// Not in real config of chipCon from here!!!
|
||||||
ACK_TIMEOUT_19
|
ACK_TIMEOUT_19
|
||||||
};
|
};
|
||||||
|
|
||||||
const uint8_t cc1020_config_115200[41] = {
|
const uint8_t cc1020_config_115200[41] = {
|
||||||
0x01, // 0x00, MAIN
|
0x01, // 0x00, MAIN
|
||||||
0x0F, // 0x01, INTERFACE
|
0x0F, // 0x01, INTERFACE
|
||||||
0xFF, // 0x02, RESET
|
0xFF, // 0x02, RESET
|
||||||
0x8F, // 0x03, SEQUENCING
|
0x8F, // 0x03, SEQUENCING
|
||||||
// 869.525 at 200kHz
|
// 869.525 at 200kHz
|
||||||
0x3A, // 0x04, FREQ_2A
|
0x3A, // 0x04, FREQ_2A
|
||||||
0x32, // 0x05, FREQ_1A
|
0x32, // 0x05, FREQ_1A
|
||||||
0x97, // 0x06, FREQ_0A // 19200
|
0x97, // 0x06, FREQ_0A // 19200
|
||||||
0x29, // 0x07, CLOCK_A // 19200
|
0x29, // 0x07, CLOCK_A // 19200
|
||||||
0x3A, // 0x08, FREQ_2B
|
0x3A, // 0x08, FREQ_2B
|
||||||
0x37, // 0x09, FREQ_1B
|
0x37, // 0x09, FREQ_1B
|
||||||
0xEB, // 0x0A, FREQ_0B // 19200
|
0xEB, // 0x0A, FREQ_0B // 19200
|
||||||
0x29, // 0x0B, CLOCK_B // 19200
|
0x29, // 0x0B, CLOCK_B // 19200
|
||||||
0x44, // 0x0C, VCO 44
|
0x44, // 0x0C, VCO 44
|
||||||
0x51, // 0x0D, MODEM Manchester
|
0x51, // 0x0D, MODEM Manchester
|
||||||
0x58, // 0x0E, DEVIATION // FSK
|
0x58, // 0x0E, DEVIATION // FSK
|
||||||
0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC
|
0x4C, // 0x0F, AFC_CONTROL Ruetten 0xCC
|
||||||
0x80, // 0x10, FILTER Bandwith 307.2kHz, i.e. channel spacing 500 kHz
|
0x80, // 0x10, FILTER Bandwith 307.2kHz, i.e. channel spacing 500 kHz
|
||||||
0x61, // 0x11, VGA1
|
0x61, // 0x11, VGA1
|
||||||
0x57, // 0x12, VGA2
|
0x57, // 0x12, VGA2
|
||||||
0x30, // 0x13, VGA3
|
0x30, // 0x13, VGA3
|
||||||
0x35, // 0x14, VGA4
|
0x35, // 0x14, VGA4
|
||||||
0x20, // 0x15, LOCK is Carrier SENSE
|
0x20, // 0x15, LOCK is Carrier SENSE
|
||||||
0x76, // 0x16, FRONTEND
|
0x76, // 0x16, FRONTEND
|
||||||
0x87, // 0x17, ANALOG, RX=86/TX=87
|
0x87, // 0x17, ANALOG, RX=86/TX=87
|
||||||
0x10, // 0x18, BUFF_SWING
|
0x10, // 0x18, BUFF_SWING
|
||||||
0x25, // 0x19, BUFF_CURRENT
|
0x25, // 0x19, BUFF_CURRENT
|
||||||
0xAE, // 0x1A, PLL_BW
|
0xAE, // 0x1A, PLL_BW
|
||||||
0x34, // 0x1B, CALIBRATE
|
0x34, // 0x1B, CALIBRATE
|
||||||
PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0
|
PA_POWER, // 0x1C, PA_POWER AN025 = 0xA0
|
||||||
0xF0, // 0x1D, MATCH
|
0xF0, // 0x1D, MATCH
|
||||||
0x00, // 0x1E, PHASE_COMP
|
0x00, // 0x1E, PHASE_COMP
|
||||||
0x00, // 0x1F, GAIN_COMP
|
0x00, // 0x1F, GAIN_COMP
|
||||||
0x00, // 0x20, POWERDOWN
|
0x00, // 0x20, POWERDOWN
|
||||||
0x4d, // 0x21,
|
0x4d, // 0x21,
|
||||||
0x10, // 0x22,
|
0x10, // 0x22,
|
||||||
0x06, // 0x23,
|
0x06, // 0x23,
|
||||||
0x00, // 0x24,
|
0x00, // 0x24,
|
||||||
0x40, // 0x25,
|
0x40, // 0x25,
|
||||||
0x00, // 0x26,
|
0x00, // 0x26,
|
||||||
0x00, // 0x27,
|
0x00, // 0x27,
|
||||||
// Not in real config of chipCon from here!!!
|
// Not in real config of chipCon from here!!!
|
||||||
ACK_TIMEOUT_115
|
ACK_TIMEOUT_115
|
||||||
};
|
};
|
||||||
|
|
||||||
/// cc1020 state
|
/// cc1020 state
|
||||||
enum cc1020_state {
|
enum cc1020_state {
|
||||||
CC1020_OFF = 0,
|
CC1020_OFF = 0,
|
||||||
CC1020_RX = 0x01,
|
CC1020_RX = 0x01,
|
||||||
CC1020_TX = 0x02,
|
CC1020_TX = 0x02,
|
||||||
|
|
||||||
CC1020_RX_SEARCHING = 0x10, // searching for preamble + sync word
|
CC1020_RX_SEARCHING = 0x10, // searching for preamble + sync word
|
||||||
CC1020_RX_RECEIVING = 0x20, // receiving bytes
|
CC1020_RX_RECEIVING = 0x20, // receiving bytes
|
||||||
CC1020_RX_PROCESSING = 0x40, // processing data in buffer
|
CC1020_RX_PROCESSING = 0x40, // processing data in buffer
|
||||||
|
|
||||||
CC1020_OP_STATE = 0x73,
|
CC1020_OP_STATE = 0x73,
|
||||||
|
|
||||||
CC1020_TURN_OFF = 0x80,
|
CC1020_TURN_OFF = 0x80,
|
||||||
};
|
};
|
||||||
|
|
||||||
#define CC1020_SET_OPSTATE(opstate) cc1020_state = ((cc1020_state & ~CC1020_OP_STATE) | (opstate))
|
#define CC1020_SET_OPSTATE(opstate) cc1020_state = ((cc1020_state & ~CC1020_OP_STATE) | (opstate))
|
||||||
|
|
||||||
/******************************************************************************
|
/******************************************************************************
|
||||||
* @name Packet specification
|
* @name Packet specification
|
||||||
* @{
|
* @{
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// header: number of bytes in packet including header
|
// header: number of bytes in packet including header
|
||||||
struct cc1020_header {
|
struct cc1020_header {
|
||||||
uint8_t pad;
|
uint8_t pad;
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
} __attribute__((packed));
|
} __attribute__((packed));
|
||||||
|
|
||||||
|
|
||||||
#define CC1020_BUFFERSIZE 128
|
#define CC1020_BUFFERSIZE 128
|
||||||
|
|
||||||
|
|
||||||
#define PREAMBLE_SIZE 6
|
#define PREAMBLE_SIZE 6
|
||||||
#define PREAMBLE 0xAA
|
#define PREAMBLE 0xAA
|
||||||
|
|
||||||
#define SYNCWORD_SIZE 2
|
#define SYNCWORD_SIZE 2
|
||||||
#define HDR_SIZE (sizeof (struct cc1020_header))
|
#define HDR_SIZE (sizeof (struct cc1020_header))
|
||||||
|
|
||||||
#define CRC_SIZE 2
|
#define CRC_SIZE 2
|
||||||
|
|
||||||
#define TAIL_SIZE 2
|
#define TAIL_SIZE 2
|
||||||
#define TAIL 0xFA
|
#define TAIL 0xFA
|
||||||
|
|
||||||
|
|
||||||
///@}
|
///@}
|
||||||
|
|
||||||
#endif /* CC1020_INTERNAL_H */
|
#endif /* CC1020_INTERNAL_H */
|
||||||
|
@ -1,77 +1,77 @@
|
|||||||
/*
|
/*
|
||||||
Copyright 2006, Freie Universitaet Berlin. All rights reserved.
|
Copyright 2006, Freie Universitaet Berlin. All rights reserved.
|
||||||
|
|
||||||
These sources were developed at the Freie Universitaet Berlin, Computer
|
These sources were developed at the Freie Universitaet Berlin, Computer
|
||||||
Systems and Telematics group.
|
Systems and Telematics group.
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without
|
Redistribution and use in source and binary forms, with or without
|
||||||
modification, are permitted provided that the following conditions are
|
modification, are permitted provided that the following conditions are
|
||||||
met:
|
met:
|
||||||
|
|
||||||
- Redistributions of source code must retain the above copyright
|
- Redistributions of source code must retain the above copyright
|
||||||
notice, this list of conditions and the following disclaimer.
|
notice, this list of conditions and the following disclaimer.
|
||||||
|
|
||||||
- Redistributions in binary form must reproduce the above copyright
|
- Redistributions in binary form must reproduce the above copyright
|
||||||
notice, this list of conditions and the following disclaimer in the
|
notice, this list of conditions and the following disclaimer in the
|
||||||
documentation and/or other materials provided with the distribution.
|
documentation and/or other materials provided with the distribution.
|
||||||
|
|
||||||
- Neither the name of Freie Universitaet Berlin (FUB) nor the names of its
|
- Neither the name of Freie Universitaet Berlin (FUB) nor the names of its
|
||||||
contributors may be used to endorse or promote products derived from
|
contributors may be used to endorse or promote products derived from
|
||||||
this software without specific prior written permission.
|
this software without specific prior written permission.
|
||||||
|
|
||||||
This software is provided by FUB and the contributors on an "as is"
|
This software is provided by FUB and the contributors on an "as is"
|
||||||
basis, without any representations or warranties of any kind, express
|
basis, without any representations or warranties of any kind, express
|
||||||
or implied including, but not limited to, representations or
|
or implied including, but not limited to, representations or
|
||||||
warranties of non-infringement, merchantability or fitness for a
|
warranties of non-infringement, merchantability or fitness for a
|
||||||
particular purpose. In no event shall FUB or contributors be liable
|
particular purpose. In no event shall FUB or contributors be liable
|
||||||
for any direct, indirect, incidental, special, exemplary, or
|
for any direct, indirect, incidental, special, exemplary, or
|
||||||
consequential damages (including, but not limited to, procurement of
|
consequential damages (including, but not limited to, procurement of
|
||||||
substitute goods or services; loss of use, data, or profits; or
|
substitute goods or services; loss of use, data, or profits; or
|
||||||
business interruption) however caused and on any theory of liability,
|
business interruption) however caused and on any theory of liability,
|
||||||
whether in contract, strict liability, or tort (including negligence
|
whether in contract, strict liability, or tort (including negligence
|
||||||
or otherwise) arising in any way out of the use of this software, even
|
or otherwise) arising in any way out of the use of this software, even
|
||||||
if advised of the possibility of such damage.
|
if advised of the possibility of such damage.
|
||||||
|
|
||||||
This implementation was developed by the CST group at the FUB.
|
This implementation was developed by the CST group at the FUB.
|
||||||
|
|
||||||
For documentation and questions please use the web site
|
For documentation and questions please use the web site
|
||||||
http://scatterweb.mi.fu-berlin.de and the mailinglist
|
http://scatterweb.mi.fu-berlin.de and the mailinglist
|
||||||
scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
|
scatterweb@lists.spline.inf.fu-berlin.de (subscription via the Website).
|
||||||
Berlin, 2006
|
Berlin, 2006
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \file cc1020.h
|
* \file cc1020.h
|
||||||
* \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes
|
* \author FUB ScatterWeb Developers, Michael Baar, Nicolas Tsiftes
|
||||||
**/
|
**/
|
||||||
|
|
||||||
#ifndef CC1020_H
|
#ifndef CC1020_H
|
||||||
#define CC1020_H
|
#define CC1020_H
|
||||||
|
|
||||||
#include "dev/radio.h"
|
#include "dev/radio.h"
|
||||||
|
|
||||||
extern const uint8_t cc1020_config_19200[];
|
extern const uint8_t cc1020_config_19200[];
|
||||||
extern const uint8_t cc1020_config_115200[];
|
extern const uint8_t cc1020_config_115200[];
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
void cc1020_init(const uint8_t* config);
|
void cc1020_init(const uint8_t* config);
|
||||||
#endif
|
#endif
|
||||||
void cc1020_set_rx(void);
|
void cc1020_set_rx(void);
|
||||||
void cc1020_set_tx(void);
|
void cc1020_set_tx(void);
|
||||||
void cc1020_set_power(uint8_t pa_power);
|
void cc1020_set_power(uint8_t pa_power);
|
||||||
int cc1020_carrier_sense(void);
|
int cc1020_carrier_sense(void);
|
||||||
uint8_t cc1020_get_rssi(void);
|
uint8_t cc1020_get_rssi(void);
|
||||||
uint8_t cc1020_get_packet_rssi(void);
|
uint8_t cc1020_get_packet_rssi(void);
|
||||||
int cc1020_sending(void);
|
int cc1020_sending(void);
|
||||||
#if 0
|
#if 0
|
||||||
int cc1020_send(const void *buf, unsigned short size);
|
int cc1020_send(const void *buf, unsigned short size);
|
||||||
int cc1020_read(void *buf, unsigned short size);
|
int cc1020_read(void *buf, unsigned short size);
|
||||||
void cc1020_set_receiver(void (*recv)(const struct radio_driver *));
|
void cc1020_set_receiver(void (*recv)(const struct radio_driver *));
|
||||||
int cc1020_on(void);
|
int cc1020_on(void);
|
||||||
int cc1020_off(void);
|
int cc1020_off(void);
|
||||||
#endif
|
#endif
|
||||||
extern const struct radio_driver cc1020_driver;
|
extern const struct radio_driver cc1020_driver;
|
||||||
|
|
||||||
PROCESS_NAME(cc1020_sender_process);
|
PROCESS_NAME(cc1020_sender_process);
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user