Skip to content

Commit

Permalink
Remove built-in sniffer support: CC1200
Browse files Browse the repository at this point in the history
  • Loading branch information
g-oikonomou committed Aug 12, 2016
1 parent dbd4f63 commit a52d50f
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 77 deletions.
10 changes: 0 additions & 10 deletions dev/cc1200/cc1200-conf.h
Expand Up @@ -222,15 +222,5 @@
#define CC1200_RX_LEDS CC1200_CONF_RX_LEDS
#endif
/*---------------------------------------------------------------------------*/
/*
* If set, enable sniff mode: turn radio on (and keep it on), disable
* address filter and auto ack
*/
#ifdef CC1200_CONF_SNIFFER
#define CC1200_SNIFFER CC1200_CONF_SNIFFER
#else
#define CC1200_SNIFFER 0
#endif
/*---------------------------------------------------------------------------*/

#endif /* CC1200_H_ */
68 changes: 1 addition & 67 deletions dev/cc1200/cc1200.c
Expand Up @@ -374,17 +374,6 @@ extern const cc1200_rf_cfg_t CC1200_RF_CFG;
} while(0)
#endif
/*---------------------------------------------------------------------------*/
/* Sniffer configuration */
#if CC1200_SNIFFER
static const uint8_t magic[] = { 0x53, 0x6E, 0x69, 0x66 };
#include "dev/uart.h"
#define write_byte(b) uart_write_byte(CC1200_RF_CONF_SNIFFER_UART, b)
#define flush()
#else /* CC1200_SNIFFER */
#define write_byte(b)
#define flush()
#endif /* CC1200_SNIFFER */
/*---------------------------------------------------------------------------*/
/* Variables */
/*---------------------------------------------------------------------------*/
/* Flag indicating whether non-interrupt routines are using SPI */
Expand Down Expand Up @@ -553,11 +542,6 @@ calculate_freq(uint8_t channel);
/* Update rf channel if possible, else postpone it (-> pollhandler). */
static int
set_channel(uint8_t channel);
#if !CC1200_SNIFFER
/* Check broadcast address. */
static int
is_broadcast_addr(uint8_t mode, uint8_t *addr);
#endif /* CC1200_SNIFFER */
/* Validate address and send ACK if requested. */
static int
addr_check_auto_ack(uint8_t *frame, uint16_t frame_len);
Expand All @@ -574,8 +558,7 @@ PROCESS_THREAD(cc1200_process, ev, data)

PROCESS_BEGIN();

#if CC1200_USE_RX_WATCHDOG && !CC1200_SNIFFER
/* RX watchdog interferes with sniffer. Reason unknown... */
#if CC1200_USE_RX_WATCHDOG
while(1) {

if((rf_flags & (RF_ON | RF_TX_ACTIVE)) == RF_ON) {
Expand Down Expand Up @@ -716,11 +699,6 @@ init(void)
* configuration of the GPIO0 pin
*/
off();

/* #if CC1200_SNIFFER */
/* on(); */
/* #endif */

}

return 1;
Expand Down Expand Up @@ -881,10 +859,6 @@ read(void *buf, unsigned short buf_len)

int len = 0;

#if CC1200_SNIFFER
uint8_t i;
#endif

if(rx_pkt_len > 0) {

int8_t rssi = rx_pkt[rx_pkt_len - 2];
Expand All @@ -911,21 +885,6 @@ read(void *buf, unsigned short buf_len)
packetbuf_set_attr(PACKETBUF_ATTR_LINK_QUALITY,
crc_lqi & ~(1 << 7));


#if CC1200_SNIFFER
write_byte(magic[0]);
write_byte(magic[1]);
write_byte(magic[2]);
write_byte(magic[3]);
write_byte(len + 2);
for(i = 0; i < len; ++i) {
write_byte(((unsigned char *)(buf))[i]);
}
write_byte(rssi);
write_byte(crc_lqi);
flush();
#endif

RIMESTATS_ADD(llrx);
}

Expand Down Expand Up @@ -2137,7 +2096,6 @@ set_channel(uint8_t channel)
}
/*---------------------------------------------------------------------------*/
/* Check broadcast address. */
#if !CC1200_SNIFFER
static int
is_broadcast_addr(uint8_t mode, uint8_t *addr)
{
Expand All @@ -2153,30 +2111,7 @@ is_broadcast_addr(uint8_t mode, uint8_t *addr)
return 1;

}
#endif /* CC12100_SNIFFER */
/*---------------------------------------------------------------------------*/
/* Validate address and send ACK if requested. */
#if CC1200_SNIFFER
static int
addr_check_auto_ack(uint8_t *frame, uint16_t frame_len)
{

frame802154_t info154;

if(frame802154_parse(frame, frame_len, &info154) != 0) {

/* We accept all 802.15.4 frames ... */
return ADDR_CHECK_OK;

} else {

/* .. and discard others. */
return INVALID_FRAME;

}

}
#else /* CC1200_SNIFFER */
static int
addr_check_auto_ack(uint8_t *frame, uint16_t frame_len)
{
Expand Down Expand Up @@ -2245,7 +2180,6 @@ addr_check_auto_ack(uint8_t *frame, uint16_t frame_len)
return INVALID_FRAME;

}
#endif /* CC1200_SNIFFER */
/*---------------------------------------------------------------------------*/
/*
* The CC1200 interrupt handler: called by the hardware interrupt
Expand Down

0 comments on commit a52d50f

Please sign in to comment.