Contiki 2.5
cc2430_rf.h
Go to the documentation of this file.
1 /**
2  * \file
3  * CC2430 RF driver header file
4  * \author
5  * Zach Shelby <zach@sensinode.com>
6  */
7 
8 #ifndef __CC2430_RF_H__
9 #define __CC2430_RF_H__
10 
11 #include "banked.h"
12 #include "contiki.h"
13 #include "dev/radio.h"
14 #include "cc2430_sfr.h"
15 #include "dev/dma.h"
16 
17 /* Constants */
18 typedef enum rf_address_mode_t
19 {
20  RF_DECODER_NONE = 0,
21  RF_DECODER_COORDINATOR,
22  RF_SOFTACK_MONITOR,
23  RF_MONITOR,
24  RF_SOFTACK_CLIENT,
25  RF_DECODER_ON
26 }rf_address_mode_t;
27 
28 /*CSP command set*/
29 #define SSTOP 0xDF
30 /*this is not a real command but a way of having rf_command
31  wait until the script is done*/
32 #define SSTART 0xDE
33 
34 #define SNOP 0xC0
35 #define STXCALN 0xC1
36 #define SRXON 0xC2
37 #define STXON 0xC3
38 #define STXONCCA 0xC4
39 #define SRFOFF 0xC5
40 #define SFLUSHRX 0xC6
41 #define SFLUSHTX 0xC7
42 #define SACK 0xC8
43 #define SACKPEND 0xC9
44 
45 #define ISTXCALN 0xE1
46 #define ISRXON 0xE2
47 #define ISTXON 0xE3
48 #define ISTXONCCA 0xE4
49 #define ISRFOFF 0xE5
50 #define ISFLUSHRX 0xE6
51 #define ISFLUSHTX 0xE7
52 #define ISACK 0xE8
53 #define ISACKPEND 0xE9
54 
55 #define ISSTOP 0xFF
56 #define ISSTART 0xFE
57 
58 #define MAC_IFS (1200/128)
59 
60 #define CC2430_MAX_PACKET_LEN 127
61 #define CC2430_MIN_PACKET_LEN 4
62 
63 extern const struct radio_driver cc2430_rf_driver;
64 
65 /* radio_driver functions */
66 void cc2430_rf_set_receiver(void (* recv)(const struct radio_driver *));
67 int cc2430_rf_on(void);
68 int cc2430_rf_off(void);
69 int cc2430_rf_read(void *buf, unsigned short bufsize);
70 int cc2430_rf_read_banked (void *buf, unsigned short bufsize) __banked;
71 int cc2430_rf_send(void *data, unsigned short len);
72 int cc2430_rf_send_b (void *data, unsigned short len) __banked;
73 extern unsigned short cc2430_rf_payload_len;
74 extern void *cc2430_rf_payload;
75 
76 /* RF driver functions */
77 void cc2430_rf_init(void) __banked;
78 void cc2430_rf_command(uint8_t command) __banked;
79 int8_t cc2430_rf_channel_set(uint8_t channel);
80 int8_t cc2430_rf_power_set(uint8_t new_power);
81 int8_t cc2430_rf_rx_enable(void) __banked;
82 int8_t cc2430_rf_rx_disable(void) __banked;
83 int8_t cc2430_rf_tx_enable(void);
84 int8_t cc2430_rf_address_decoder_mode(rf_address_mode_t mode);
85 int8_t cc2430_rf_analyze_rssi(void);
86 int8_t cc2430_rf_cca_check(uint8_t backoff_count, uint8_t slotted);
87 void cc2430_rf_send_ack(uint8_t pending);
88 void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr);
89 
90 extern void cc2430_rf_ISR( void ) __interrupt (RF_VECTOR);
91 extern void cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR);
92 
93 #ifdef HAVE_RF_DMA
94 void rf_dma_callback_isr(void);
95 #endif
96 
97 
98 #endif /* __CC2430_RF_H__ */