add a way to disable FCS checking.

This commit is contained in:
Mariano Alvira 2010-03-11 15:18:29 -05:00
parent da7898557d
commit a61deb78f4
2 changed files with 11 additions and 0 deletions

View file

@ -17,6 +17,10 @@
#define RTSO 15 /* reset slot counter */
#define ROLE 13 /* set if PAN coordinator */
#define NOFC 12 /* set to disable FCS */
enum {
USE_FCS = 0,
NO_FCS = 1,
};
#define PRM 11 /* set for promiscuous mode */
#define REL 10 /* 1 for relative, 0 for absolute */
#define ASAP 9 /* 1 start now, 0 timer start */
@ -124,6 +128,10 @@ volatile packet_t* get_free_packet(void);
void free_packet(volatile packet_t *p);
void free_all_packets(void);
/* set_fcs_mode(NO_FCS) to disable checksum filtering */
extern volatile uint8_t fcs_mode;
#define set_fcs_mode(x) fcs_mode = (x)
extern void maca_rx_callback(volatile packet_t *p) __attribute__((weak));
/******************************************************************************/

View file

@ -46,6 +46,8 @@ static volatile uint8_t last_post = NO_POST;
#define safe_irq_disable(x) volatile uint32_t saved_irq; saved_irq = *INTENABLE; disable_irq(x)
#define irq_restore() *INTENABLE = saved_irq
volatile uint8_t fcs_mode = USE_FCS;
void maca_init(void) {
reset_maca();
radio_init();
@ -157,6 +159,7 @@ void post_receive(void) {
enable_irq(MACA);
*MACA_CONTROL = ( (1 << maca_ctrl_asap) |
( 4 << PRECOUNT) |
( fcs_mode << NOFC ) |
(1 << maca_ctrl_auto) |
(1 << maca_ctrl_prm) |
(maca_ctrl_seq_rx));