Fixed naming of CC2420 macros
This commit is contained in:
parent
fb3c2e75cf
commit
49a2ca6b1e
2 changed files with 27 additions and 27 deletions
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* @(#)$Id: cc2420.c,v 1.56 2010/06/23 10:15:28 joxe Exp $
|
||||
* @(#)$Id: cc2420.c,v 1.57 2010/06/24 09:28:38 nifi Exp $
|
||||
*/
|
||||
/*
|
||||
* This code is almost device independent and should be easy to port.
|
||||
|
@ -154,34 +154,34 @@ static int channel;
|
|||
static void
|
||||
getrxdata(void *buf, int len)
|
||||
{
|
||||
SPI_READ_FIFO_BUF(buf, len);
|
||||
CC2420_READ_FIFO_BUF(buf, len);
|
||||
}
|
||||
static void
|
||||
getrxbyte(uint8_t *byte)
|
||||
{
|
||||
SPI_READ_FIFO_BYTE(*byte);
|
||||
CC2420_READ_FIFO_BYTE(*byte);
|
||||
}
|
||||
static void
|
||||
flushrx(void)
|
||||
{
|
||||
uint8_t dummy;
|
||||
|
||||
SPI_READ_FIFO_BYTE(dummy);
|
||||
SPI_STROBE(CC2420_SFLUSHRX);
|
||||
SPI_STROBE(CC2420_SFLUSHRX);
|
||||
CC2420_READ_FIFO_BYTE(dummy);
|
||||
CC2420_STROBE(CC2420_SFLUSHRX);
|
||||
CC2420_STROBE(CC2420_SFLUSHRX);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
strobe(enum cc2420_register regname)
|
||||
{
|
||||
SPI_STROBE(regname);
|
||||
CC2420_STROBE(regname);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static unsigned int
|
||||
status(void)
|
||||
{
|
||||
uint8_t status;
|
||||
SPI_GET_STATUS(status);
|
||||
CC2420_GET_STATUS(status);
|
||||
return status;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
|
@ -238,14 +238,14 @@ static unsigned
|
|||
getreg(enum cc2420_register regname)
|
||||
{
|
||||
unsigned reg;
|
||||
SPI_READ_REG(regname, reg);
|
||||
CC2420_READ_REG(regname, reg);
|
||||
return reg;
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
setreg(enum cc2420_register regname, unsigned value)
|
||||
{
|
||||
SPI_WRITE_REG(regname, value);
|
||||
CC2420_WRITE_REG(regname, value);
|
||||
}
|
||||
/*---------------------------------------------------------------------------*/
|
||||
static void
|
||||
|
@ -450,10 +450,10 @@ cc2420_prepare(const void *payload, unsigned short payload_len)
|
|||
checksum = crc16_data(payload, payload_len, 0);
|
||||
#endif /* CC2420_CONF_CHECKSUM */
|
||||
total_len = payload_len + AUX_LEN;
|
||||
SPI_WRITE_FIFO_BUF(&total_len, 1);
|
||||
SPI_WRITE_FIFO_BUF(payload, payload_len);
|
||||
CC2420_WRITE_FIFO_BUF(&total_len, 1);
|
||||
CC2420_WRITE_FIFO_BUF(payload, payload_len);
|
||||
#if CC2420_CONF_CHECKSUM
|
||||
SPI_WRITE_FIFO_BUF(&checksum, CHECKSUM_LEN);
|
||||
CC2420_WRITE_FIFO_BUF(&checksum, CHECKSUM_LEN);
|
||||
#endif /* CC2420_CONF_CHECKSUM */
|
||||
|
||||
RELEASE_LOCK();
|
||||
|
@ -571,18 +571,18 @@ cc2420_set_pan_addr(unsigned pan,
|
|||
|
||||
tmp[0] = pan & 0xff;
|
||||
tmp[1] = pan >> 8;
|
||||
SPI_WRITE_RAM(&tmp, CC2420RAM_PANID, 2);
|
||||
CC2420_WRITE_RAM(&tmp, CC2420RAM_PANID, 2);
|
||||
|
||||
tmp[0] = addr & 0xff;
|
||||
tmp[1] = addr >> 8;
|
||||
SPI_WRITE_RAM(&tmp, CC2420RAM_SHORTADDR, 2);
|
||||
CC2420_WRITE_RAM(&tmp, CC2420RAM_SHORTADDR, 2);
|
||||
if(ieee_addr != NULL) {
|
||||
uint8_t tmp_addr[8];
|
||||
/* LSB first, MSB last for 802.15.4 addresses in CC2420 */
|
||||
for (f = 0; f < 8; f++) {
|
||||
tmp_addr[7 - f] = ieee_addr[f];
|
||||
}
|
||||
SPI_WRITE_RAM(tmp_addr, CC2420RAM_IEEEADDR, 8);
|
||||
CC2420_WRITE_RAM(tmp_addr, CC2420RAM_IEEEADDR, 8);
|
||||
}
|
||||
RELEASE_LOCK();
|
||||
}
|
||||
|
|
|
@ -28,7 +28,7 @@
|
|||
*
|
||||
* This file is part of the Contiki operating system.
|
||||
*
|
||||
* $Id: cc2420.h,v 1.10 2010/06/23 10:15:28 joxe Exp $
|
||||
* $Id: cc2420.h,v 1.11 2010/06/24 09:28:39 nifi Exp $
|
||||
*/
|
||||
|
||||
/**
|
||||
|
@ -43,9 +43,9 @@
|
|||
#define __CC2420_H__
|
||||
|
||||
#include "contiki.h"
|
||||
#include "spi.h"
|
||||
#include "dev/spi.h"
|
||||
#include "dev/radio.h"
|
||||
#include "cc2420_const.h"
|
||||
#include "dev/cc2420_const.h"
|
||||
|
||||
int cc2420_init(void);
|
||||
|
||||
|
@ -93,7 +93,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
/* Additional SPI Macros for the CC2420 */
|
||||
/************************************************************************/
|
||||
/* Send a strobe to the CC2420 */
|
||||
#define SPI_STROBE(s) \
|
||||
#define CC2420_STROBE(s) \
|
||||
do { \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
SPI_WRITE(s); \
|
||||
|
@ -103,7 +103,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
/* Write to a register in the CC2420 */
|
||||
/* Note: the SPI_WRITE(0) seems to be needed for getting the */
|
||||
/* write reg working on the Z1 / MSP430X platform */
|
||||
#define SPI_WRITE_REG(adr,data) \
|
||||
#define CC2420_WRITE_REG(adr,data) \
|
||||
do { \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
SPI_WRITE_FAST(adr); \
|
||||
|
@ -115,7 +115,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
} while(0)
|
||||
|
||||
/* Read a register in the CC2420 */
|
||||
#define SPI_READ_REG(adr,data) \
|
||||
#define CC2420_READ_REG(adr,data) \
|
||||
do { \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
SPI_WRITE(adr | 0x40); \
|
||||
|
@ -129,7 +129,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
CC2420_SPI_DISABLE(); \
|
||||
} while(0)
|
||||
|
||||
#define SPI_READ_FIFO_BYTE(data) \
|
||||
#define CC2420_READ_FIFO_BYTE(data) \
|
||||
do { \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
SPI_WRITE(CC2420_RXFIFO | 0x40); \
|
||||
|
@ -139,7 +139,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
CC2420_SPI_DISABLE(); \
|
||||
} while(0)
|
||||
|
||||
#define SPI_READ_FIFO_BUF(buffer,count) \
|
||||
#define CC2420_READ_FIFO_BUF(buffer,count) \
|
||||
do { \
|
||||
uint8_t i; \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
|
@ -152,7 +152,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
CC2420_SPI_DISABLE(); \
|
||||
} while(0)
|
||||
|
||||
#define SPI_WRITE_FIFO_BUF(buffer,count) \
|
||||
#define CC2420_WRITE_FIFO_BUF(buffer,count) \
|
||||
do { \
|
||||
uint8_t i; \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
|
@ -165,7 +165,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
} while(0)
|
||||
|
||||
/* Write to RAM in the CC2420 */
|
||||
#define SPI_WRITE_RAM(buffer,adr,count) \
|
||||
#define CC2420_WRITE_RAM(buffer,adr,count) \
|
||||
do { \
|
||||
uint8_t i; \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
|
@ -179,7 +179,7 @@ void cc2420_set_cca_threshold(int value);
|
|||
} while(0)
|
||||
|
||||
/* Read status of the CC2420 */
|
||||
#define SPI_GET_STATUS(s) \
|
||||
#define CC2420_GET_STATUS(s) \
|
||||
do { \
|
||||
CC2420_SPI_ENABLE(); \
|
||||
SPI_WRITE(CC2420_SNOP); \
|
||||
|
|
Loading…
Reference in a new issue