📄 cc2400.h
字号:
/******************************************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** +++ *** *
* *** + + *** *
* *** + CC2400 include file *
* *** + + *** *
* *** +++ *** *
* *** *** *
* ************ *
* ********** *
* *
*******************************************************************************************************
* CC2400 related definitions and macros. *
* Time critical FIFO I/O is provided py FIFO.asm *
*******************************************************************************************************
* Compiler: Keil C51 *
* Target platform: 8051F005 *
*******************************************************************************************************
* Revision history: *
* Initial release, MBR *
* Modified for 8051, HKI, 01.08.2004 *
******************************************************************************************************/
#include <Cinclude.h>
#ifndef CC2400_H
#define CC2400_H
/*****************************************************************************************************/
// Global SPI status byte
extern BYTE data CC2400status;
//----------------------------------------------------------------------------
// RF_SETTINGS is a data structure which contains all the settings
// required for a given pair of RX/TX channels.
// These values should be passed to the configuration function rfInit(...)
// before the RX/TX channel pair can be used. The configuration function writes
// the setup to the register in CC2400.
// The RX/TX channel pair is later used by passing the correpsonding
// RF_SETTINGS data structures to the function
// rfInit().
//------------------------------------------------------------------------------
typedef struct {
WORD FSCTRL; // Frequency synthesiser main control and status
WORD FSDIV; // Frequency synthesiser frequency division control
WORD MDMCTRL; // Modem main control and status
WORD FREND; // Analog Front-End Control
WORD RSSI; // RSSI information
WORD IOCFG; // I/O configuration register
WORD FSMTC; // Finite State Machine time constants
WORD MANAND; // Manual signal AND-override register
WORD PAMTST; // PA and transmit mixers test register
WORD LMTST; // LNA and receive mixers test register
WORD MDMTST0; // Modem test register 0
WORD MDMTST1; // Modem test register 1
WORD DACTST; // DAC Test register
WORD FSTST0; // Test register: VCO array results and override
WORD FSTST1; // Test register: VC DAC manual control VCO current constant
WORD GRMDM; // Generic radio modem control
WORD GRDEC; // Generic radio decimation control and status
WORD INT;
} RF_SETTINGS;
/***************************************************************************************************
* CC2400 STROBE, CONTROL AND STATUS REGSITER *
**************************************************************************************************/
#define CC2400_MAIN 0x00 // Main control register
#define CC2400_FSCTRL 0x01 // Frequency synthesiser main control and status
#define CC2400_FSDIV 0x02 // Frequency synthesiser frequency division control
#define CC2400_MDMCTRL 0x03 // Modem main control and status
#define CC2400_AGCCTRL 0x04 // AGC main control and status
#define CC2400_FREND 0x05 // Analog front-end control
#define CC2400_RSSI 0x06 // RSSI information
#define CC2400_FREQEST 0x07 // Received signal frequency offset estimation
#define CC2400_IOCFG 0x08 // I/O configuration register
#define CC2400_FSMTC 0x0B // Finite state machine time constants
#define CC2400_MANAND 0x0D // Manual signal AND-override register
#define CC2400_FSMSTATE 0x0E // Finite state machine information and breakpoint
#define CC2400_ADCTST 0x0F // ADC test register
#define CC2400_RXBPFTST 0x10 // Receiver bandpass filters test register
#define CC2400_PAMTST 0x11 // PA and transmit mixers test register
#define CC2400_LMTST 0x12 // LNA and receive mixers test register
#define CC2400_MANOR 0x13 // Manual signal OR-override register
#define CC2400_MDMTST0 0x14 // Modem test register 0
#define CC2400_MDMTST1 0x15 // Modem test register 1
#define CC2400_DACTST 0x16 // DAC test register
#define CC2400_AGCTST0 0x17 // AGC test register: various control and status
#define CC2400_AGCTST1 0x18 // AGC test register: AGC timeout
#define CC2400_AGCTST2 0x19 // AGC test register: AGC various parameters
#define CC2400_FSTST0 0x1A // Test register: VCO array results and override
#define CC2400_FSTST1 0x1B // Test register: VC DAC manual control VCO current constant
#define CC2400_FSTST2 0x1C // Test register:VCO current result and override
#define CC2400_FSTST3 0x1D // Test register: Charge pump current etc
#define CC2400_MANFIDL 0x1E // Manufacturer ID, lower 16 bit
#define CC2400_MANFIDH 0x1F // Manufacturer ID, upper 16 bit
#define CC2400_GRMDM 0x20 // Generic radio modem control
#define CC2400_GRDEC 0x21 // Generic radio decimation control and status
#define CC2400_PKTSTATUS 0x22 // Packet mode status
#define CC2400_INT 0x23 // Interrupt register
#define CC2400_SYNCL 0x2C // Synchronisation word, lower 16 bit
#define CC2400_SYNCH 0x2D // Synchronisation word, upper 16 bit
#define CC2400_SXOSCON 0x60 // Command strobe register: Turn on XOSC
#define CC2400_SFSON 0x61 // Command strobe register: Start and calibrate FS and
#define CC2400_SRX 0x62 // Command strobe register: Start RX
#define CC2400_STX 0x63 // Command strobe register: Start TX (turn on PA)
#define CC2400_SRFOFF 0x64 // Command strobe register: Turn off RX/TX and FS
#define CC2400_SXOSCOFF 0x65 // Command strobe register: Turn off XOSC
#define CC2400_FIFOREG 0x70 // Write and read data to and from the 32 byte FIFO
/*******************************************************************************************************
* Bit definitions *
* The Register Bit names are represented by their bit number (0-15) *
*******************************************************************************************************/
// The status byte of CC2400
#define XOSC16M_STABLE 0x40 // Indicates whether the 16MHz oscillator is running ('1') or not
#define CS_ABOVE_THRESHOLD_N 0x20 // Carrier sense flag.
#define SYNC_RECEIVED 0x10 // Indicates whether a sync word has been received or not
#define FS_LOCK 0x04 // Indicates whether the freq. synth. is in lock('1') or not
// Main control register
#define RESET 15
#define FS_FORCE_EN 9
#define RXN_TX 8
#define XOSC32K_BYPASS 3
#define XOSC32K_EN 2
#define XOSC16M_BYPASS 1
#define XOSC16M_FORCE_EN 0
// FSCTRL (0x01) - Frequency Synthesiser Control and Status
#define LOCK_THRESHOLD 4 // Number of consecutive reference clock periods with successful sync windows required to indicate lock
#define CAL_DONE 3 // Calibration has been performed since the last time the FS was turned on.
#define CAL_RUNNING 2 // Calibration status, '1' when calibration in progress.
#define LOCK_LENGTH 1 // LOCK_WINDOW pulse width:0: 2 CLK_PRE periods1: 4 CLK_PRE periods
#define PLL_LOCK_STATUS 0 // '1' when PLL is in lock, otherwise '0'.
// FSDIV (0x02) - Frequency Synthesiser Frequency Division Control
#define FREQ_R 10 // Read only. Directly gives the right frequency when reading.
#define FREQ 0 // Frequency control word used in Bluetooth mode and in GR mode with manual frequency-hopping enabled.
// MDMCTRL (0x03) - Modem Control and Status
#define MOD_OFFSET 7 // Modulator centre frequency in 15.625 kHz steps relative to 1 MHz. Two's complement signed value. I.e MOD_OFFSET=0x3F
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -