cc2430_rf.h

Go to the documentation of this file.
00001 /**
00002  * \file
00003  *         CC2430 RF driver header file
00004  * \author
00005  *         Zach Shelby <zach@sensinode.com>
00006  */
00007 
00008 #ifndef __CC2430_RF_H__
00009 #define __CC2430_RF_H__
00010 
00011 #include "banked.h"
00012 #include "contiki.h"
00013 #include "dev/radio.h"
00014 #include "cc2430_sfr.h"
00015 #include "dev/dma.h"
00016 
00017 /* Constants */
00018 typedef enum rf_address_mode_t
00019 {
00020         RF_DECODER_NONE = 0,
00021         RF_DECODER_COORDINATOR,
00022         RF_SOFTACK_MONITOR,
00023         RF_MONITOR,
00024         RF_SOFTACK_CLIENT,
00025         RF_DECODER_ON
00026 }rf_address_mode_t;
00027 
00028 /*CSP command set*/
00029 #define SSTOP           0xDF
00030 /*this is not a real command but a way of having rf_command
00031   wait until the script is done*/
00032 #define SSTART          0xDE
00033 
00034 #define SNOP            0xC0
00035 #define STXCALN         0xC1
00036 #define SRXON           0xC2
00037 #define STXON           0xC3
00038 #define STXONCCA        0xC4
00039 #define SRFOFF          0xC5
00040 #define SFLUSHRX        0xC6
00041 #define SFLUSHTX        0xC7
00042 #define SACK            0xC8
00043 #define SACKPEND        0xC9
00044 
00045 #define ISTXCALN        0xE1
00046 #define ISRXON          0xE2
00047 #define ISTXON          0xE3
00048 #define ISTXONCCA       0xE4
00049 #define ISRFOFF         0xE5
00050 #define ISFLUSHRX       0xE6
00051 #define ISFLUSHTX       0xE7
00052 #define ISACK           0xE8
00053 #define ISACKPEND       0xE9
00054 
00055 #define ISSTOP          0xFF
00056 #define ISSTART         0xFE
00057 
00058 #define MAC_IFS (1200/128)
00059 
00060 #define CC2430_MAX_PACKET_LEN      127
00061 #define CC2430_MIN_PACKET_LEN      4
00062 
00063 extern const struct radio_driver cc2430_rf_driver;
00064 
00065 /* radio_driver functions */
00066 void cc2430_rf_set_receiver(void (* recv)(const struct radio_driver *));
00067 int cc2430_rf_on(void);
00068 int cc2430_rf_off(void);
00069 int cc2430_rf_read(void *buf, unsigned short bufsize);
00070 int cc2430_rf_read_banked (void *buf, unsigned short bufsize) __banked;
00071 int cc2430_rf_send(void *data, unsigned short len);
00072 int cc2430_rf_send_b (void *data, unsigned short len) __banked;
00073 extern unsigned short cc2430_rf_payload_len;
00074 extern void *cc2430_rf_payload;
00075 
00076 /* RF driver functions */
00077 void cc2430_rf_init(void) __banked;
00078 void cc2430_rf_command(uint8_t command) __banked;
00079 int8_t cc2430_rf_channel_set(uint8_t channel);
00080 int8_t cc2430_rf_power_set(uint8_t new_power);
00081 int8_t cc2430_rf_rx_enable(void) __banked;
00082 int8_t cc2430_rf_rx_disable(void) __banked;
00083 int8_t cc2430_rf_tx_enable(void);
00084 int8_t cc2430_rf_address_decoder_mode(rf_address_mode_t mode);
00085 int8_t cc2430_rf_analyze_rssi(void);
00086 int8_t cc2430_rf_cca_check(uint8_t backoff_count, uint8_t slotted);
00087 void cc2430_rf_send_ack(uint8_t pending);
00088 void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr);
00089 
00090 extern void cc2430_rf_ISR( void ) __interrupt (RF_VECTOR);
00091 extern void cc2430_rf_error_ISR( void ) __interrupt (RFERR_VECTOR);
00092 
00093 #ifdef HAVE_RF_DMA
00094 void rf_dma_callback_isr(void);
00095 #endif
00096 
00097 
00098 #endif /* __CC2430_RF_H__ */

Generated on Mon Apr 11 14:23:38 2011 for Contiki 2.5 by  doxygen 1.6.1