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

/*header file for the TDK microcontrollers
	TSC73M2910
	TSC73M2910A
	TSC73M2910L
 */

#ifndef __T73M2910_H

#define __T73M2910_H
	
typedef struct {
	unsigned B7:1;	/* this is the most significant 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		USR3	@ 0x00;
static		unsigned char		DIR3	@ 0x01;
static		unsigned char		BNKSEL	@ 0x02;
static volatile unsigned char		USR4	@ 0x03;
static		unsigned char		DIR4	@ 0x04;
static		unsigned char		CSEN	@ 0x05;
static volatile unsigned char		USR5	@ 0x06;

static volatile unsigned char		P0	@ 0x80;
static volatile unsigned char		SP	@ 0x81;
static volatile unsigned char		DPL	@ 0x82;
static volatile unsigned char		DPH	@ 0x83;
// 16 bit definition
static 		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 volatile unsigned char		USR1	@ 0x90;
static		unsigned char		DIR1	@ 0x91;
static		unsigned char		IDIR	@ 0x92;
static 		unsigned char		SCON	@ 0x98;
static volatile unsigned char		SBUF	@ 0x99;
static volatile unsigned char		P2	@ 0xA0;
static 		unsigned char		IE	@ 0xA8;
static 		unsigned char		IP	@ 0xB8;
static volatile	unsigned char		HDLC0	@ 0xC0;
static 		unsigned char		HDLC1	@ 0xC1;
static volatile	unsigned char		TXC	@ 0xC2;
static volatile	unsigned char		HSTAT	@ 0xC3;
static 		unsigned char		HIE	@ 0xC4;
static volatile	unsigned char		HINT	@ 0xC5;
static volatile	unsigned char		HRXD	@ 0xC6;
static 		unsigned char		HTXD	@ 0xC7;
static volatile	unsigned char		T2CON	@ 0xC8;
static volatile unsigned char		RCAP2L	@ 0xCA;
static volatile unsigned char		RCAP2H	@ 0xCB;
static volatile unsigned char		TL2	@ 0xCC;
static volatile unsigned char		TH2	@ 0xCD;
static volatile unsigned char		PSW	@ 0xD0;
static volatile unsigned char		USR2	@ 0xD8;
static		unsigned char		DIR2	@ 0xD9;
static		unsigned char		CLKCTRL	@ 0xDA;
static volatile unsigned char		ACC	@ 0xE0;
static volatile unsigned char		B	@ 0xF0;

static volatile SFR_BITS	USR3_BITS	@ 0x00;
static		SFR_BITS	DIR3_BITS	@ 0x01;
static		SFR_BITS	BNKSEL_BITS	@ 0x02;
static volatile SFR_BITS	USR4_BITS	@ 0x03;
static		SFR_BITS	DIR4_BITS	@ 0x04;
static		SFR_BITS	CSEN_BITS	@ 0x05;
static volatile SFR_BITS	USR5_BITS	@ 0x06;

static volatile SFR_BITS	P0_BITS		@ 0x80;
static 		SFR_BITS	PCON_BITS	@ 0x87;
static volatile	SFR_BITS	TCON_BITS	@ 0x88;
static 		SFR_BITS	TMOD_BITS	@ 0x89;
static volatile SFR_BITS	USR1_BITS	@ 0x90;
static		SFR_BITS	DIR1_BITS	@ 0x91;
static		SFR_BITS	IDIR_BITS	@ 0x92;
static 		SFR_BITS	SCON_BITS	@ 0x98;
static volatile SFR_BITS	P2_BITS		@ 0xA0;
static 		SFR_BITS	IE_BITS		@ 0xA8;
static 		SFR_BITS	IP_BITS		@ 0xB8;
static volatile	SFR_BITS	HDLC0_BITS	@ 0xC0;
static 		SFR_BITS	HDLC1_BITS	@ 0xC1;
static volatile	SFR_BITS	TXC_BITS	@ 0xC2;
static volatile	SFR_BITS	HSTAT_BITS	@ 0xC3;
static 		SFR_BITS	HIE_BITS	@ 0xC4;
static volatile	SFR_BITS	HINT_BITS	@ 0xC5;
static volatile	SFR_BITS	HRXD_BITS	@ 0xC6;
static 		SFR_BITS	HTXD_BITS	@ 0xC7;
static volatile	SFR_BITS	T2CON_BITS	@ 0xC8;
static volatile SFR_BITS	PSW_BITS	@ 0xD0;
static volatile SFR_BITS	USR2_BITS	@ 0xD8;
static		SFR_BITS	DIR2_BITS	@ 0xD9;
static		SFR_BITS	CLKCTRL_BITS	@ 0xDA;
static volatile SFR_BITS	ACC_BITS	@ 0xE0;
static volatile SFR_BITS	B_BITS		@ 0xF0;

/*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;
static volatile bit	P04	@ 0x84;
static volatile bit	P05	@ 0x85;
static volatile bit	P06	@ 0x86;
static volatile bit	P07	@ 0x87;

//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;

//USR 1 Data Port USR1
static volatile bit	USR10	@ 0x90;
static volatile bit	USR11	@ 0x91;
static volatile bit	USR12	@ 0x92;
static volatile bit	USR13	@ 0x93;
static volatile bit	USR14	@ 0x94;
static volatile bit	USR15	@ 0x95;
static volatile bit	USR16	@ 0x96;
static volatile bit	USR18	@ 0x97;

//Serial Control SCON
static volatile bit	RI	@ 0x98;
static volatile bit	TI	@ 0x99;
static volatile bit	RB8	@ 0x9A;
static		bit	TB8	@ 0x9B;
static 		bit	REN	@ 0x9C;
static		bit	SM2	@ 0x9D;
static		bit	SM1	@ 0x9E;
static volatile bit	SM0	@ 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;

//Interrupt Enable IE
static		bit	EX0	@ 0xA8;
static		bit	ET0	@ 0xA9;
static		bit	EX1	@ 0xAA;
static		bit	ET1	@ 0xAB;
static 		bit	ES	@ 0xAC;
static 		bit	ET2	@ 0xAD;
static 		bit	EX2	@ 0xAE;
static 		bit	EA	@ 0xAF;

//Interrupt Priority
static 		bit	PX0	@ 0xB8;
static 		bit	PT0	@ 0xB9;
static 		bit	PX1	@ 0xBA;
static 		bit	PT1	@ 0xBB;
static 		bit	PS	@ 0xBC;
static 		bit	PT2	@ 0xBD;
static 		bit	PX2	@ 0xBE;
static 		bit	PHDLC	@ 0xBF;

//HDLC Control 0 HDLC0
static		bit	PTX0	@ 0xC0;
static		bit	PTX1	@ 0xC1;
static volatile bit	RXD0	@ 0xC2;
static volatile bit	RXD1	@ 0xC3;
static volatile bit	PRXD	@ 0xC4;
static volatile bit	TXD	@ 0xC5;
static		bit	WPTXD	@ 0xC6;
static		bit	WRXD	@ 0xC7;

//Timer 2 Control T2CON
static volatile	bit	T2CON0	@ 0xC8;
static volatile	bit	T2CON1	@ 0xC9;
static volatile	bit	T2CON2	@ 0xCA;
static volatile	bit	T2CON3	@ 0xCB;
static volatile	bit	T2CON4	@ 0xCC;
static volatile	bit	T2CON5	@ 0xCD;
static volatile	bit	T2CON6	@ 0xCE;
static volatile	bit	T2CON7	@ 0xCF;

//Program Status Word PSW
static volatile bit	P	@ 0xD0;
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;

//USR 2 Data Port USR2
static volatile bit	USR20	@ 0xD0;
static volatile bit	USR21	@ 0xD1;
static volatile bit	USR22	@ 0xD2;
static volatile bit	USR23	@ 0xD3;
static volatile bit	USR24	@ 0xD4;
static volatile bit	USR25	@ 0xD5;
static volatile bit	USR26	@ 0xD6;
static volatile bit	USR28	@ 0xD7;

//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;

//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;


/*	Interrupt vectors */
#define	RESET	0
#define	EXTINT0	0x03
#define TIMER0	0x0B
#define	EXTINT1	0x13
#define	TIMER1	0x1B
#define	SERIAL	0x23
#define	TIMER2	0x2B
#define	EXTINT2	0x33
#define	HDLC	0x3B

#endif	
