
#ifndef	_HTC_H_
#warning Header file cc1010.h included directly. Use #include <htc.h> instead.
#endif


 /* header file for the Chipcon SMARTRF microcontrollers
	CC1010
 */

#ifndef	__CC1010_H

#define	__CC1010_H

typedef struct {
	unsigned B7:1; //This is the most signifigant bit
	unsigned B6:1;
	unsigned B5:1;
	unsigned B4:1;
	unsigned B3:1;
	unsigned B2:1;
	unsigned B1:1;
	unsigned B0:1;
}	SFR_BITS;

//Special Function Registers
static volatile unsigned char P0	@ 0x80;
static volatile unsigned char SP	@ 0x81;
static volatile unsigned char DPL0	@ 0x82;
static volatile unsigned char DPH0	@ 0x83;
// 16 bit definition
// Alternate definition
static volatile unsigned char DPL1	@ 0x84;
static volatile unsigned char DPH1	@ 0x85;
// 16 bit definition
static          unsigned char DPS	@ 0x86;
static volatile unsigned char PCON	@ 0x87;
static volatile unsigned char TCON	@ 0x88;
static          unsigned char TMOD	@ 0x89;
static volatile unsigned char TL0	@ 0x8A;
static volatile unsigned char TL1	@ 0x8B;
static volatile unsigned char TH0	@ 0x8C;
static volatile unsigned char TH1	@ 0x8D;
static          unsigned char CKCON	@ 0x8E;
static volatile unsigned char P1	@ 0x90;
static volatile unsigned char EXIF	@ 0x91;
static		unsigned char MPAGE	@ 0x92;
static volatile unsigned char ADCON	@ 0x93;
static volatile unsigned char ADDATL	@ 0x94;
static volatile unsigned char ADDATH	@ 0x95;
static volatile unsigned char ADCON2	@ 0x96;
static		unsigned char ADTRH	@ 0x97;
static volatile unsigned char SCON0	@ 0x98;
static volatile unsigned char SBUF0	@ 0x99;
static		unsigned char CHVER	@ 0x9F;
static volatile unsigned char P2	@ 0xA0;
static		unsigned char SPCR	@ 0xA1;
static volatile unsigned char SPDR	@ 0xA2;
static volatile unsigned char SPSR	@ 0xA3;
static          unsigned char P0DIR	@ 0xA4;
static          unsigned char P1DIR	@ 0xA5;
static          unsigned char P2DIR	@ 0xA6;
static          unsigned char P3DIR	@ 0xA7;
static          unsigned char IE	@ 0xA8;
static		unsigned char TCON2	@ 0xA9;
static		unsigned char T2PRE	@ 0xAA;
static		unsigned char T3PRE	@ 0xAB;
static volatile unsigned char T2	@ 0xAC;
static volatile unsigned char T3	@ 0xAD;
static		unsigned char FLADR	@ 0xAE;
static volatile unsigned char FLCON	@ 0xAF;
static volatile unsigned char P3	@ 0xB0;
static		unsigned char CRPINI0	@ 0xB4;
static		unsigned char CRPINI1	@ 0xB5;
static		unsigned char CRPINI2	@ 0xB6;
static		unsigned char CRPINI3	@ 0xB7;
static          unsigned char IP	@ 0xB8;
static volatile unsigned char RDATA	@ 0xB9;
static volatile unsigned char RADRL	@ 0xBA;
static volatile unsigned char RADRH	@ 0xBB;
static		unsigned char CRPINI4	@ 0xBC;
static		unsigned char CRPINI5	@ 0xBD;
static		unsigned char CRPINI6	@ 0xBE;
static		unsigned char CRPINI7	@ 0xBF;
static volatile unsigned char SCON1	@ 0xC0;
static volatile unsigned char SBUF1	@ 0xC1;
static volatile unsigned char RFCON	@ 0xC2;
static volatile unsigned char CRPCON	@ 0xC3;
static		unsigned char CRPKEY	@ 0xC4;
static		unsigned char CRPDAT	@ 0xC5;
static		unsigned char CRPCNT	@ 0xC6;
static volatile unsigned char RANCON	@ 0xC7;
static		unsigned char RFMAIN	@ 0xC8;
static volatile unsigned char RFBUF	@ 0xC9;
static		unsigned char FREQ_0A	@ 0xCA;
static		unsigned char FREQ_1A	@ 0xCB;
static		unsigned char FREQ_2A	@ 0xCC;
static		unsigned char FREQ_0B	@ 0xCD;
static		unsigned char FREQ_1B	@ 0xCE;
static		unsigned char FREQ_2B	@ 0xCF;
static volatile unsigned char PSW	@ 0xD0;
static		unsigned char X32CON	@ 0xD1;
static volatile unsigned char WDT	@ 0xD2;
static		unsigned char PDET	@ 0xD3;
static		unsigned char BSYNC	@ 0xD4;
static volatile unsigned char EICON	@ 0xD8;
static		unsigned char MODEM2	@ 0xD9;
static volatile unsigned char MODEM1	@ 0xDA;
static		unsigned char MODEM0	@ 0xDB;
static		unsigned char MATCH	@ 0xDC;
static		unsigned char FLTIM	@ 0xDD;
static volatile unsigned char ACC	@ 0xE0;
static		unsigned char CURRENT	@ 0xE1;
static		unsigned char PA_POW	@ 0xE2;
static volatile unsigned char PLL	@ 0xE3;
static volatile unsigned char LOCK	@ 0xE4;
static volatile unsigned char CAL	@ 0xE5;
static		unsigned char PRESCALER	@ 0xE6;
static		unsigned char RESERVED	@ 0xE7;
static          unsigned char EIE	@ 0xE8;
static volatile unsigned char FSDELAY	@ 0xE9;
static		unsigned char FSEP0	@ 0xEA;
static		unsigned char FSEP1	@ 0xEB;
static		unsigned char FSCTRL	@ 0xEC;
static		unsigned char RTCON	@ 0xED;
static		unsigned char FREND	@ 0xEE;
static volatile unsigned char TESTMUX	@ 0xEF;
static volatile unsigned char B		@ 0xF0;
static volatile unsigned char FSHAPE7	@ 0xF1;
static volatile unsigned char FSHAPE6	@ 0xF2;
static volatile unsigned char FSHAPE5	@ 0xF3;
static volatile unsigned char FSHAPE4	@ 0xF4;
static volatile unsigned char FSHAPE3	@ 0xF5;
static volatile unsigned char FSHAPE2	@ 0xF6;
static volatile unsigned char FSHAPE1	@ 0xF7;
static          unsigned char EIP	@ 0xF8;
static		unsigned char TEST0	@ 0xF9;
static		unsigned char TEST1	@ 0xFA;
static		unsigned char TEST2	@ 0xFB;
static		unsigned char TEST3	@ 0xFC;
static		unsigned char TEST4	@ 0xFD;
static		unsigned char TEST5	@ 0xFE;
static volatile unsigned char TEST6	@ 0xFF;

static volatile SFR_BITS	 P0_BITS	@ 0x80;
static          SFR_BITS	 DPS_BITS	@ 0x86;
static volatile SFR_BITS	 PCON_BITS	@ 0x87;
static volatile SFR_BITS	 TCON_BITS	@ 0x88;
static          SFR_BITS	 TMOD_BITS	@ 0x89;
static          SFR_BITS	 CKCON_BITS	@ 0x8E;
static volatile SFR_BITS	 P1_BITS	@ 0x90;
static volatile SFR_BITS	 EXIF_BITS	@ 0x91;
static		SFR_BITS	 MPAGE_BITS	@ 0x92;
static volatile SFR_BITS	 ADCON_BITS	@ 0x93;
static volatile SFR_BITS	 ADCON2_BITS	@ 0x96;
static volatile SFR_BITS	 SCON0_BITS	@ 0x98;
static volatile SFR_BITS	 P2_BITS	@ 0xA0;
static		SFR_BITS	 SPCR_BITS	@ 0xA1;
static volatile SFR_BITS	 SPSR_BITS	@ 0xA3;
static          SFR_BITS	 P0DIR_BITS	@ 0xA4;
static          SFR_BITS	 P1DIR_BITS	@ 0xA5;
static          SFR_BITS	 P2DIR_BITS	@ 0xA6;
static          SFR_BITS	 P3DIR_BITS	@ 0xA7;
static          SFR_BITS	 IE_BITS	@ 0xA8;
static volatile SFR_BITS	 TCON2_BITS	@ 0xA9;
static		SFR_BITS	 FLCON_BITS	@ 0xAF;
static volatile SFR_BITS	 P3_BITS	@ 0xB0;
static          SFR_BITS	 IP_BITS	@ 0xB8;
static volatile SFR_BITS	 SCON1_BITS	@ 0xC0;
static volatile SFR_BITS	 RFCON_BITS	@ 0xC2;
static volatile SFR_BITS	 CRPCON_BITS	@ 0xC3;
static volatile SFR_BITS	 RANCON_BITS	@ 0xC7;
static		SFR_BITS	 RFMAIN_BITS	@ 0xC8;
static volatile SFR_BITS	 PSW_BITS	@ 0xD0;
static		SFR_BITS	 X32CON_BITS	@ 0xD1;
static		SFR_BITS	 PDET_BITS	@ 0xD3;
static volatile SFR_BITS	 EICON_BITS	@ 0xD8;
static		SFR_BITS	 MODEM2_BITS	@ 0xD9;
static volatile SFR_BITS	 MODEM1_BITS	@ 0xDA;
static		SFR_BITS	 MODEM0_BITS	@ 0xDB;
static		SFR_BITS	 MATCH_BITS	@ 0xDC;
static volatile SFR_BITS	 ACC_BITS	@ 0xE0;
static		SFR_BITS	 CURRENT_BITS	@ 0xE1;
static		SFR_BITS	 PA_POW_BITS	@ 0xE2;
static volatile SFR_BITS	 PLL_BITS	@ 0xE3;
static volatile SFR_BITS	 LOCK_BITS	@ 0xE4;
static volatile SFR_BITS	 CAL_BITS	@ 0xE5;
static		SFR_BITS	 PRESCALER_BITS	@ 0xE6;
static		SFR_BITS	 RESERVED_BITS	@ 0xE7;
static          SFR_BITS	 EIE_BITS	@ 0xE8;
static		SFR_BITS	 FSCTRL_BITS	@ 0xEC;
static		SFR_BITS	 RTCON_BITS	@ 0xED;
static		SFR_BITS	 FREND_BITS	@ 0xEE;
static volatile SFR_BITS	 TESTMUX_BITS	@ 0xEF;
static volatile SFR_BITS	 B_BITS		@ 0xF0;
static          SFR_BITS	 EIP_BITS	@ 0xF8;
static		SFR_BITS	 TEST0_BITS	@ 0xF9;
static		SFR_BITS	 TEST1_BITS	@ 0xFA;
static		SFR_BITS	 TEST2_BITS	@ 0xFB;
static		SFR_BITS	 TEST3_BITS	@ 0xFC;
static		SFR_BITS	 TEST4_BITS	@ 0xFD;
static		SFR_BITS	 TEST5_BITS	@ 0xFE;
static volatile SFR_BITS	 TEST6_BITS	@ 0xFF;


// Bit Addressable Locations
// Port 0 P0
static volatile bit	P00	@ 0x80;
static volatile bit	P01	@ 0x81;
static volatile bit	P02	@ 0x82;
static volatile bit	P03	@ 0x83;
// Alternate Functions
static volatile bit	SCK	@ 0x80;
static volatile bit	MO	@ 0x81;
static volatile bit	MI	@ 0x82;

// Timer Control TCON
static 		bit	IT0	@ 0x88;
static volatile bit	IE0	@ 0x89;
static 		bit	IT1	@ 0x8A;
static volatile bit	IE1	@ 0x8B;
static 		bit	TR0	@ 0x8C;
static volatile bit	TF0	@ 0x8D;
static 		bit	TR1	@ 0x8E;
static volatile bit	TF1	@ 0x8F;

// Port 1 P1
static volatile bit	P10	@ 0x90;
static volatile bit	P11	@ 0x91;
static volatile bit	P12	@ 0x92;
static volatile bit	P13	@ 0x93;
static volatile bit	P14	@ 0x94;
static volatile bit	P15	@ 0x95;
static volatile bit	P16	@ 0x96;
static volatile bit	P17	@ 0x97;

// Serial Control Register 0 SCON0
static volatile bit	RI_0	@ 0x98;
static volatile bit	TI_0	@ 0x99;
static volatile bit	RB8_0	@ 0x9A;
static 		bit	TB8_0	@ 0x9B;
static 		bit	REN_0	@ 0x9C;
static 		bit	SM2_0	@ 0x9D;
static 		bit	SM1_0	@ 0x9E;
static 		bit	SM0_0	@ 0x9F;

// Port 2 P2
static volatile bit	P20	@ 0xA0;
static volatile bit	P21	@ 0xA1;
static volatile bit	P22	@ 0xA2;
static volatile bit	P23	@ 0xA3;
static volatile bit	P24	@ 0xA4;
static volatile bit	P25	@ 0xA5;
static volatile bit	P26	@ 0xA6;
static volatile bit	P27	@ 0xA7;
// Alternate Functions
static volatile bit	RXD1	@ 0xA0;
static volatile bit	TXD1	@ 0xA1;

// Interrupt Enable IE
static		bit	EX0	@ 0xA8;
static		bit	ET0	@ 0xA9;
static		bit	EX1	@ 0xAA;
static		bit	ET1	@ 0xAB;
static 		bit	ES0	@ 0xAC;
static 		bit	EA	@ 0xAF;

// Port 3 P3
static volatile bit	P30	@ 0xB0;
static volatile bit	P31	@ 0xB1;
static volatile bit	P32	@ 0xB2;
static volatile bit	P33	@ 0xB3;
static volatile bit	P34	@ 0xB4;
static volatile bit	P35	@ 0xB5;
// Alternate Functions
static volatile bit	RXD0	@ 0xB0;
static volatile bit	TXD0	@ 0xB1;
static volatile bit	INT0	@ 0xB2;
static volatile bit	INT1	@ 0xB3;
static volatile bit	T0	@ 0xB4;
static volatile bit	T1	@ 0xB5;

// Interrupt Priority
static 		bit	PX0	@ 0xB8;
static 		bit	PT0	@ 0xB9;
static 		bit	PX1	@ 0xBA;
static 		bit	PT1	@ 0xBB;
static 		bit	PS0	@ 0xBC;

// Serial Control 1 SCON1
static volatile	bit	RI_1	@ 0xC0;
static volatile	bit	TI_1	@ 0xC1;
static volatile	bit	RB8_1	@ 0xC2;
static 		bit	TB8_1	@ 0xC3;
static 		bit	REN_1	@ 0xC4;
static 		bit	SM2_1	@ 0xC5;
static 		bit	SM1_1	@ 0xC6;
static volatile	bit	SM0_1	@ 0xC7;

// definitions for register RFMAIN
static		bit	BIAS_PD	@ 0xC9;
static		bit	CORE_PD	@ 0xCA;
static		bit	FS_PD	@ 0xCB;
static		bit	TX_PD	@ 0xCC;
static		bit	RX_PD	@ 0xCD;
static		bit	F_PD	@ 0xCE;
static		bit	RXTX	@ 0xCF;

// Program Status Word PSW
static volatile bit	P	@ 0xD0;
static volatile bit	F1	@ 0xD1;
static volatile bit	OV	@ 0xD2;
static 		bit	RS0	@ 0xD3;
static 		bit	RS1	@ 0xD4;
static volatile bit	F0	@ 0xD5;
static volatile bit	AC	@ 0xD6;
static volatile bit	CY	@ 0xD7;

// Extended Interrupt Control EICON
static volatile bit	RTCIF	@ 0xDB;
static volatile bit	FDIF	@ 0xDC;
static volatile bit	FDIE	@ 0xDD;

// Accumulator ACC
static volatile bit	ACC0	@ 0xE0;
static volatile bit	ACC1	@ 0xE1;
static volatile bit	ACC2	@ 0xE2;
static volatile bit	ACC3	@ 0xE3;
static volatile bit	ACC4	@ 0xE4;
static volatile bit	ACC5	@ 0xE5;
static volatile bit	ACC6	@ 0xE6;
static volatile bit	ACC7	@ 0xE7;

// Extended Interrupt Enable EIE
static		bit	RFIE	@ 0xE8;
static		bit	ET2	@ 0xE9;
static		bit	ADIE	@ 0xEA;
static		bit	ET3	@ 0xEB;
static		bit	RTCIE	@ 0xEC;

// B register
static volatile bit	B0	@ 0xF0;
static volatile bit	B1	@ 0xF1;
static volatile bit	B2	@ 0xF2;
static volatile bit	B3	@ 0xF3;
static volatile bit	B4	@ 0xF4;
static volatile bit	B5	@ 0xF5;
static volatile bit	B6	@ 0xF6;
static volatile bit	B7	@ 0xF7;

// Extended Interrupt Priority EIP
static		bit	PRF	@ 0xF8;
static		bit	PT2	@ 0xF9;
static		bit	PAD	@ 0xFA;
static		bit	PT3	@ 0xFB;
static		bit	PRTC	@ 0xFC;


// Interrupt Vectors
#define	RESET	0
#define	EXTINT0	0x03
#define TIMER0	0x0B
#define	EXTINT1	0x13
#define	TIMER1	0x1B
#define	SERIAL	0x23
#define	FLASH	0x33
#define	SERIAL1	0x3B
#define	RF	0x43
#define	TIMER2	0x4B
#define	ADC	0x53
#define	TIMER3	0x5B
#define	RTCLOCK	0x63

#endif
