

/* Registers declarations for the STR75x devices */

/* The addresses are fixed in the linker script */



/*------------------------ Analog to Digital Converter -----------------------*/
typedef struct
{
  volatile unsigned short CLR0;
  unsigned short  EMPTY1;
  volatile unsigned short CLR1;
  unsigned short  EMPTY2;
  volatile unsigned short CLR2;
  unsigned short  EMPTY3;
  volatile unsigned short CLR3;
  unsigned short  EMPTY4;
  volatile unsigned short CLR4;
  unsigned short  EMPTY5;
  volatile unsigned short TRA0;
  unsigned short  EMPTY6;
  volatile unsigned short TRA1;
  unsigned short  EMPTY7;
  volatile unsigned short TRA2;
  unsigned short  EMPTY8;
  volatile unsigned short TRA3;
  unsigned short  EMPTY9;
  volatile unsigned short TRB0;
  unsigned short  EMPTY10;
  volatile unsigned short TRB1;
  unsigned short  EMPTY11;
  volatile unsigned short TRB2;
  unsigned short  EMPTY12;
  volatile unsigned short TRB3;
  unsigned short  EMPTY13;
  volatile unsigned short DMAR;
  unsigned short  EMPTY14[7];
  volatile unsigned short DMAE;
  unsigned short  EMPTY15 ;
  volatile unsigned short PBR;
  unsigned short  EMPTY16;
  volatile unsigned short IMR;
  unsigned short  EMPTY17;
  volatile unsigned short D0;
  unsigned short  EMPTY18;
  volatile unsigned short D1;
  unsigned short  EMPTY19;
  volatile unsigned short D2;
  unsigned short  EMPTY20;
  volatile unsigned short D3;
  unsigned short  EMPTY21;
  volatile unsigned short D4;
  unsigned short  EMPTY22;
  volatile unsigned short D5;
  unsigned short  EMPTY23;
  volatile unsigned short D6;
  unsigned short  EMPTY24;
  volatile unsigned short D7;
  unsigned short  EMPTY25;
  volatile unsigned short D8;
  unsigned short  EMPTY26;
  volatile unsigned short D9;
  unsigned short  EMPTY27;
  volatile unsigned short D10;
  unsigned short  EMPTY28;
  volatile unsigned short D11;
  unsigned short  EMPTY29;
  volatile unsigned short D12;
  unsigned short  EMPTY30;
  volatile unsigned short D13;
  unsigned short  EMPTY31;
  volatile unsigned short D14;
  unsigned short  EMPTY32;
  volatile unsigned short D15;
  unsigned short  EMPTY33;
} ADC_TypeDef;

/*------------------------ Controller Area Network ---------------------------*/
typedef struct
{
  volatile unsigned short CRR;			
  unsigned short  EMPTY1;
  volatile unsigned short CMR;			
  unsigned short  EMPTY2;
  volatile unsigned short M1R;			
  unsigned short  EMPTY3;
  volatile unsigned short M2R;			
  unsigned short  EMPTY4;
  volatile unsigned short A1R;			
  unsigned short  EMPTY5;
  volatile unsigned short A2R;			
  unsigned short  EMPTY6;
  volatile unsigned short MCR;			
  unsigned short  EMPTY7;
  volatile unsigned short DA1R;		
  unsigned short  EMPTY8;
  volatile unsigned short DA2R;		
  unsigned short  EMPTY9;
  volatile unsigned short DB1R;		
  unsigned short  EMPTY10;
  volatile unsigned short DB2R;		
  unsigned short  EMPTY11[27];
} CAN_MsgObj_TypeDef;

typedef struct
{
  volatile unsigned short CR;			
  unsigned short  EMPTY1;
  volatile unsigned short SR;			
  unsigned short  EMPTY2;
  volatile unsigned short ERR;			
  unsigned short  EMPTY3;
  volatile unsigned short BTR;			
  unsigned short  EMPTY4;
  volatile unsigned short IDR;			
  unsigned short  EMPTY5;
  volatile unsigned short TESTR;		
  unsigned short  EMPTY6;
  volatile unsigned short BRPR;		
  unsigned short  EMPTY7[3];
  CAN_MsgObj_TypeDef sMsgObj[2];
  unsigned short  EMPTY8[16];
  volatile unsigned short TXR1R;		
  unsigned short  EMPTY9;
  volatile unsigned short TXR2R;		
  unsigned short  EMPTY10[13];
  volatile unsigned short ND1R;		
  unsigned short  EMPTY11;
  volatile unsigned short ND2R;		
  unsigned short  EMPTY12[13];
  volatile unsigned short IP1R;		
  unsigned short  EMPTY13;
  volatile unsigned short IP2R;		
  unsigned short  EMPTY14[13];
  volatile unsigned short MV1R;		
  unsigned short  EMPTY15;
  volatile unsigned short MV2R;		
  unsigned short  EMPTY16;
} CAN_TypeDef;

/*--------------------------- Configuration Register -------------------------*/
typedef struct
{
  volatile unsigned long GLCONF;
} CFG_TypeDef;

/*-------------------------------- DMA Controller ----------------------------*/
typedef struct
{
  volatile unsigned short  SOURCEL;
  unsigned short   EMPTY1;
  volatile unsigned short  SOURCEH;
  unsigned short   EMPTY2;
  volatile unsigned short  DESTL;
  unsigned short   EMPTY3;
  volatile unsigned short  DESTH;
  unsigned short   EMPTY4;
  volatile unsigned short  MAX;
  unsigned short   EMPTY5;
  volatile unsigned short  CTRL;
  unsigned short   EMPTY6;
  volatile unsigned short const SOCURRH;
  unsigned short   EMPTY7;
  volatile unsigned short const SOCURRL;
  unsigned short   EMPTY8;
  volatile unsigned short const DECURRH;
  unsigned short   EMPTY9;
  volatile unsigned short const DECURRL;
  unsigned short   EMPTY10;
  volatile unsigned short const TCNT;
  unsigned short   EMPTY11;
  volatile unsigned short  LUBUFF;
  unsigned short   EMPTY12;
} DMA_Stream_TypeDef;

typedef struct
{
  volatile unsigned short MASK;
  unsigned short  EMPTY4;
  volatile unsigned short CLR;
  unsigned short  EMPTY5;
  volatile unsigned short const STATUS;
  unsigned short  EMPTY6;
  volatile unsigned short LAST;       
  unsigned short  EMPTY7;
} DMA_TypeDef;

/*----------------------- Enhanced Interrupt Controller ----------------------*/
typedef struct
{
  volatile unsigned long ICR; 
  volatile unsigned long  const CICR;   
  volatile unsigned long CIPR;
  unsigned long  EMPTY1;
  volatile unsigned long FIER;
  volatile unsigned long FIPR;
  volatile unsigned long IVR;
  volatile unsigned long FIR;
  volatile unsigned long IER;
  unsigned long  EMPTY2[7];
  volatile unsigned long IPR;
  unsigned long  EMPTY3[7];
  volatile unsigned long SIRn[32];
} EIC_TypeDef;

/*------------------------- External Interrupt Controller --------------------*/
typedef struct
{
  volatile unsigned long MR;
  volatile unsigned long TSR;
  volatile unsigned long SWIR;
  volatile unsigned long PR;
} EXTIT_TypeDef;

/*-------------------------- General Purpose IO ports ------------------------*/
typedef struct
{
  volatile unsigned long PC0;
  volatile unsigned long PC1;
  volatile unsigned long PC2;
  volatile unsigned long PD;
  volatile unsigned long PM;
} GPIO_TypeDef;

typedef struct
{
  volatile unsigned long REMAP0R;
  volatile unsigned long REMAP1R;
} GPIOREMAP_TypeDef;

/*--------------------------------- I2C interface ----------------------------*/
typedef struct
{
  volatile unsigned char CR; 
  unsigned char  EMPTY1[3];
  volatile unsigned char SR1;
  unsigned char  EMPTY2[3];
  volatile unsigned char SR2;
  unsigned char  EMPTY3[3];
  volatile unsigned char CCR;
  unsigned char  EMPTY4[3];
  volatile unsigned char OAR1;
  unsigned char  EMPTY5[3];
  volatile unsigned char OAR2;
  unsigned char  EMPTY6[3];
  volatile unsigned char DR;
  unsigned char  EMPTY7[3];
  volatile unsigned char ECCR;
  unsigned char  EMPTY8[3];
} I2C_TypeDef;

/*---------------------------- Power, Reset and Clocks -----------------------*/
typedef  struct
{
  volatile unsigned long CLKCTL;
  volatile unsigned long RFSR;
  volatile unsigned long PWRCTRL;
  unsigned long  EMPTY1;
  volatile unsigned long PCLKEN;
  volatile unsigned long PSWRES;
  unsigned long  EMPTY2[2];
  volatile unsigned long BKP0;
  volatile unsigned long BKP1;
} MRCC_TypeDef;

/*-------------------------------- Real Time Clock ---------------------------*/
typedef struct
{
  volatile unsigned short CRH;
  unsigned short  EMPTY;
  volatile unsigned short CRL;
  unsigned short  EMPTY1;
  volatile unsigned short PRLH;
  unsigned short  EMPTY2;
  volatile unsigned short PRLL;
  unsigned short  EMPTY3;
  volatile unsigned short DIVH;
  unsigned short  EMPTY4;
  volatile unsigned short DIVL;
  unsigned short  EMPTY5;
  volatile unsigned short CNTH;
  unsigned short  EMPTY6;
  volatile unsigned short CNTL;
  unsigned short  EMPTY7;
  volatile unsigned short ALRH;
  unsigned short  EMPTY8;
  volatile unsigned short ALRL;
  unsigned short  EMPTY9;
} RTC_TypeDef;

/*---------------------------- Serial Memory Interface -----------------------*/
typedef struct
{
  volatile unsigned long CR1;
  volatile unsigned long CR2;
  volatile unsigned long SR;
  volatile unsigned long TR;
  volatile unsigned long  const RR;
} SMI_TypeDef;

/*--------------------------------- Timer Base -------------------------------*/
typedef struct
{
  volatile unsigned short CR;
  unsigned short  EMPTY1;
  volatile unsigned short SCR;
  unsigned short  EMPTY2;
  volatile unsigned short IMCR;
  unsigned short  EMPTY3[7];
  volatile unsigned short RSR;
  unsigned short  EMPTY4;
  volatile unsigned short RER;
  unsigned short  EMPTY5;
  volatile unsigned short ISR;
  unsigned short  EMPTY6;
  volatile unsigned short CNT;
  unsigned short  EMPTY7;
  volatile unsigned short PSC;
  unsigned short  EMPTY8[3];
  volatile unsigned short ARR;
  unsigned short  EMPTY9[13];
  volatile unsigned short ICR1;
  unsigned short  EMPTY10;
} TB_TypeDef;

/*------------------------------------ TIM -----------------------------------*/
typedef struct
{
  volatile unsigned short CR;
  unsigned short  EMPTY1;
  volatile unsigned short SCR;
  unsigned short  EMPTY2;
  volatile unsigned short IMCR;
  unsigned short  EMPTY3;
  volatile unsigned short OMR1;
  unsigned short  EMPTY4[5];
  volatile unsigned short RSR;
  unsigned short  EMPTY5;
  volatile unsigned short RER;
  unsigned short  EMPTY6;
  volatile unsigned short ISR;
  unsigned short  EMPTY7;
  volatile unsigned short CNT;
  unsigned short  EMPTY8;
  volatile unsigned short PSC;
  unsigned short  EMPTY9[3];
  volatile unsigned short ARR;
  unsigned short  EMPTY10;
  volatile unsigned short OCR1;
  unsigned short  EMPTY11;
  volatile unsigned short OCR2;
  unsigned short  EMPTY12[9];
  volatile unsigned short ICR1;
  unsigned short  EMPTY13;
  volatile unsigned short ICR2;
  unsigned short  EMPTY14[9];
  volatile unsigned short DMAB;
  unsigned short  EMPTY15;
} TIM_TypeDef;

/*------------------------------------ PWM -----------------------------------*/
typedef struct
{
  volatile unsigned short CR;
  unsigned short  EMPTY1;
  volatile unsigned short SCR;
  unsigned short  EMPTY2[3];
  volatile unsigned short OMR1;
  unsigned short  EMPTY3;
  volatile unsigned short OMR2;
  unsigned short  EMPTY4[3];
  volatile unsigned short RSR;
  unsigned short  EMPTY5;
  volatile unsigned short RER;
  unsigned short  EMPTY6;
  volatile unsigned short ISR;
  unsigned short  EMPTY7;
  volatile unsigned short CNT;
  unsigned short  EMPTY8;
  volatile unsigned short PSC;
  unsigned short  EMPTY9;
  volatile unsigned short RCR;
  unsigned short  EMPTY10;
  volatile unsigned short ARR;
  unsigned short  EMPTY11;
  volatile unsigned short OCR1;
  unsigned short  EMPTY12;
  volatile unsigned short OCR2;
  unsigned short  EMPTY13;
  volatile unsigned short OCR3;
  unsigned short  EMPTY14[15];
  volatile unsigned short DTR;
  unsigned short  EMPTY15;
  volatile unsigned short DMAB;
  unsigned short  EMPTY16;
} PWM_TypeDef;

/*----------------------- Synchronous Serial Peripheral ----------------------*/
typedef struct
{
  volatile unsigned long CR0;
  volatile unsigned long CR1;
  volatile unsigned long DR;
  volatile unsigned long SR;
  volatile unsigned long PR;
  volatile unsigned long IMSCR;
  volatile unsigned long RISR;
  volatile unsigned long MISR;
  volatile unsigned long ICR;
  volatile unsigned long DMACR;
} SSP_TypeDef;

/*---------------- Universal Asynchronous Receiver Transmitter ---------------*/
typedef struct
{
  volatile unsigned short DR;
  unsigned short  EMPTY;
  volatile unsigned short RSR;
  unsigned short  EMPTY1[9];
  volatile unsigned short FR;
  unsigned short  EMPTY2;
  volatile unsigned short BKR;
  unsigned short  EMPTY3[3];
  volatile unsigned short IBRD;
  unsigned short  EMPTY4;
  volatile unsigned short FBRD;
  unsigned short  EMPTY5;
  volatile unsigned short LCR;
  unsigned short  EMPTY6;
  volatile unsigned short CR;
  unsigned short  EMPTY7;
  volatile unsigned short IFLS;
  unsigned short  EMPTY8;
  volatile unsigned short IMSC;
  unsigned short  EMPTY9;
  volatile unsigned short RIS;
  unsigned short  EMPTY10;
  volatile unsigned short MIS;
  unsigned short  EMPTY11;
  volatile unsigned short ICR;
  unsigned short  EMPTY12;
  volatile unsigned short DMACR;
  unsigned short  EMPTY13;
} UART_TypeDef;

/*---------------------------------- WATCHDOG --------------------------------*/
typedef struct
{
  volatile unsigned short CR;
  unsigned short  EMPTY1;
  volatile unsigned short PR;
  unsigned short EMPTY2;
  volatile unsigned short VR;
  unsigned short  EMPTY3;
  volatile unsigned short CNT;
  unsigned short  EMPTY4;
  volatile unsigned short SR;
  unsigned short  EMPTY5;
  volatile unsigned short MR;
  unsigned short  EMPTY6;
  volatile unsigned short KR;
  unsigned short  EMPTY7;
} WDG_TypeDef;

/*******************************************************************************
*                      Peripherals' Declaration
*******************************************************************************/

extern  SMI_TypeDef  _SMIR;
extern  CFG_TypeDef  _CFG;
extern  MRCC_TypeDef _MRCC;
extern  ADC_TypeDef  _ADC;
extern  TB_TypeDef   _TB;
extern  TIM_TypeDef  _TIM0;
extern  TIM_TypeDef  _TIM1;
extern  TIM_TypeDef  _TIM2;
extern  PWM_TypeDef  _PWM;
extern  WDG_TypeDef  _WDG;
extern  SSP_TypeDef  _SSP0;
extern  SSP_TypeDef  _SSP1;
extern  CAN_TypeDef  _CAN;
extern  I2C_TypeDef  _I2C;
extern  UART_TypeDef _UART0;
extern  UART_TypeDef _UART1;
extern  UART_TypeDef _UART2;
extern  GPIO_TypeDef _GPIO0;
extern  GPIOREMAP_TypeDef _GPIOREMAP;
extern  GPIO_TypeDef _GPIO1;
extern  GPIO_TypeDef _GPIO2;
extern  DMA_TypeDef  _DMA;
extern  DMA_Stream_TypeDef _DMA_Stream0;
extern  DMA_Stream_TypeDef _DMA_Stream1;
extern  DMA_Stream_TypeDef _DMA_Stream2;
extern  DMA_Stream_TypeDef _DMA_Stream3;
extern  RTC_TypeDef  _RTC;
extern  EXTIT_TypeDef _EXTIT;
extern  EIC_TypeDef  _EIC;


#define  SMI  (&_SMIR)
#define  CFG  (&_CFG)
#define  MRCC (&_MRCC)
#define  ADC  (&_ADC)
#define  TB   (&_TB)
#define  TIM0  (&_TIM0)
#define  TIM1  (&_TIM1)
#define  TIM2  (&_TIM2)
#define  PWM  (&_PWM)
#define  WDG  (&_WDG)
#define  SSP0  (&_SSP0)
#define  SSP1  (&_SSP1)
#define  CAN  (&_CAN)
#define  I2C  (&_I2C)
#define  UART0 (&_UART0)
#define  UART1 (&_UART1)
#define  UART2 (&_UART2)
#define  GPIO0 (&_GPIO0)
#define  GPIOREMAP (&_GPIOREMAP)
#define  GPIO1 (&_GPIO1)
#define  GPIO2 (&_GPIO2)
#define  DMA  (&_DMA)
#define  DMA_Stream0 (&_DMA_Stream0)
#define  DMA_Stream1 (&_DMA_Stream1)
#define  DMA_Stream2 (&_DMA_Stream2)
#define  DMA_Stream3 (&_DMA_Stream3)
#define  RTC  (&_RTC)
#define  EXTIT (&_EXTIT)
#define  EIC  (&_EIC)





