2009-09-08 20:07:35 +00:00
|
|
|
/**
|
|
|
|
* \file
|
|
|
|
* CC2430 RF driver header file
|
|
|
|
* \author
|
|
|
|
* Zach Shelby <zach@sensinode.com>
|
|
|
|
*/
|
|
|
|
|
2013-11-24 15:57:08 +00:00
|
|
|
#ifndef CC2430_RF_H_
|
|
|
|
#define CC2430_RF_H_
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
#include "contiki.h"
|
|
|
|
#include "dev/radio.h"
|
|
|
|
#include "cc2430_sfr.h"
|
2012-03-05 16:28:06 +00:00
|
|
|
#if HAVE_RF_DMA
|
2009-09-08 20:07:35 +00:00
|
|
|
#include "dev/dma.h"
|
2012-03-05 16:28:06 +00:00
|
|
|
#endif
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
/* Constants */
|
2012-12-16 12:44:44 +00:00
|
|
|
typedef enum rf_address_mode_t {
|
|
|
|
RF_DECODER_NONE = 0,
|
|
|
|
RF_DECODER_COORDINATOR,
|
|
|
|
RF_SOFTACK_MONITOR,
|
|
|
|
RF_MONITOR,
|
|
|
|
RF_SOFTACK_CLIENT,
|
|
|
|
RF_DECODER_ON
|
|
|
|
} rf_address_mode_t;
|
2009-09-11 08:07:12 +00:00
|
|
|
|
2009-09-08 20:07:35 +00:00
|
|
|
/*CSP command set*/
|
2012-03-05 16:28:06 +00:00
|
|
|
#define SSTOP 0xDF
|
2009-09-08 20:07:35 +00:00
|
|
|
/*this is not a real command but a way of having rf_command
|
|
|
|
wait until the script is done*/
|
|
|
|
#define SSTART 0xDE
|
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
#define SNOP 0xC0
|
2009-09-11 08:07:12 +00:00
|
|
|
#define STXCALN 0xC1
|
2012-03-05 16:28:06 +00:00
|
|
|
#define SRXON 0xC2
|
|
|
|
#define STXON 0xC3
|
2009-09-08 20:07:35 +00:00
|
|
|
#define STXONCCA 0xC4
|
|
|
|
#define SRFOFF 0xC5
|
|
|
|
#define SFLUSHRX 0xC6
|
|
|
|
#define SFLUSHTX 0xC7
|
2012-03-05 16:28:06 +00:00
|
|
|
#define SACK 0xC8
|
2009-09-08 20:07:35 +00:00
|
|
|
#define SACKPEND 0xC9
|
|
|
|
|
|
|
|
#define ISTXCALN 0xE1
|
|
|
|
#define ISRXON 0xE2
|
|
|
|
#define ISTXON 0xE3
|
|
|
|
#define ISTXONCCA 0xE4
|
|
|
|
#define ISRFOFF 0xE5
|
|
|
|
#define ISFLUSHRX 0xE6
|
|
|
|
#define ISFLUSHTX 0xE7
|
2012-03-05 16:28:06 +00:00
|
|
|
#define ISACK 0xE8
|
2009-09-08 20:07:35 +00:00
|
|
|
#define ISACKPEND 0xE9
|
|
|
|
|
|
|
|
#define ISSTOP 0xFF
|
|
|
|
#define ISSTART 0xFE
|
|
|
|
|
|
|
|
#define MAC_IFS (1200/128)
|
|
|
|
|
|
|
|
#define CC2430_MAX_PACKET_LEN 127
|
|
|
|
#define CC2430_MIN_PACKET_LEN 4
|
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
#define CC2430_CCA_CLEAR 1
|
|
|
|
#define CC2430_CCA_BUSY 0
|
|
|
|
|
|
|
|
#ifdef CC2430_CONF_RFERR_INTERRUPT
|
|
|
|
#define CC2430_RFERR_INTERRUPT CC2430_CONF_RFERR_INTERRUPT
|
|
|
|
#else
|
|
|
|
#define CC2430_RFERR_INTERRUPT 0
|
|
|
|
#endif
|
|
|
|
|
2009-09-08 20:07:35 +00:00
|
|
|
extern const struct radio_driver cc2430_rf_driver;
|
|
|
|
|
2012-03-05 16:28:06 +00:00
|
|
|
void cc2430_rf_command(uint8_t command);
|
2009-09-08 20:07:35 +00:00
|
|
|
int8_t cc2430_rf_channel_set(uint8_t channel);
|
2012-04-30 16:04:55 +00:00
|
|
|
uint8_t cc2430_rf_channel_get();
|
2012-03-05 16:28:06 +00:00
|
|
|
uint8_t cc2430_rf_power_set(uint8_t new_power);
|
2009-09-11 08:07:12 +00:00
|
|
|
void cc2430_rf_set_addr(unsigned pan, unsigned addr, const uint8_t *ieee_addr);
|
2009-09-08 20:07:35 +00:00
|
|
|
|
2012-04-01 20:43:22 +00:00
|
|
|
#if !NETSTACK_CONF_SHORTCUTS
|
2012-12-16 12:44:44 +00:00
|
|
|
extern void cc2430_rf_ISR(void) __interrupt(RF_VECTOR);
|
2012-03-05 16:28:06 +00:00
|
|
|
#endif
|
|
|
|
#if CC2430_RFERR_INTERRUPT
|
2012-12-16 12:44:44 +00:00
|
|
|
extern void cc2430_rf_error_ISR(void) __interrupt(RFERR_VECTOR);
|
2012-03-05 16:28:06 +00:00
|
|
|
#endif
|
2009-09-08 20:07:35 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_RF_DMA
|
|
|
|
void rf_dma_callback_isr(void);
|
|
|
|
#endif
|
|
|
|
|
2013-11-24 15:57:08 +00:00
|
|
|
#endif /* CC2430_RF_H_ */
|