/***************************************************************
	CPU固有レジスタ定義 ヘッダ (SH7262/7264用)
***************************************************************/

#ifndef __CPU__
#define __CPU__

#define	CPU_NAME	"SH-2A(SH7262)"	/* SH-2A(SH762) */

#define	LITTLE_ENDIAN		0		/* SH-2Aシリーズ：ビッグエンディアン */


void CPU_EnableInterrupt(void);		/* 割り込み許可(cpu_init.c内に関数を記述) */
int  CPU_DisableInterrupt(void);	/* 割り込み禁止(cpu_init.c内に関数を記述) */


/* クロックパルス発振器制御レジスタ */
#define FRQCR	((volatile unsigned short int *)(0xFFFE0010))


/* 割り込みコントローラ制御レジスタ */
#define ICR0	((volatile unsigned short int *)(0xFFFE0800))
#define ICR1	((volatile unsigned short int *)(0xFFFE0802))
#define ICR2	((volatile unsigned short int *)(0xFFFE0804))
#define IRQRR	((volatile unsigned short int *)(0xFFFE0806))
#define PINTER	((volatile unsigned short int *)(0xFFFE0808))
#define PIRR	((volatile unsigned short int *)(0xFFFE080A))
#define IBCR	((volatile unsigned short int *)(0xFFFE080C))
#define IBNR	((volatile unsigned short int *)(0xFFFE080E))
#define IPR01	((volatile unsigned short int *)(0xFFFE0818))
#define IPR02	((volatile unsigned short int *)(0xFFFE081A))
#define IPR05	((volatile unsigned short int *)(0xFFFE0820))
#define IPR06	((volatile unsigned short int *)(0xFFFE0C00))
#define IPR07	((volatile unsigned short int *)(0xFFFE0C02))
#define IPR08	((volatile unsigned short int *)(0xFFFE0C04))
#define IPR09	((volatile unsigned short int *)(0xFFFE0C06))
#define IPR10	((volatile unsigned short int *)(0xFFFE0C08))
#define IPR11	((volatile unsigned short int *)(0xFFFE0C0A))
#define IPR12	((volatile unsigned short int *)(0xFFFE0C0C))
#define IPR13	((volatile unsigned short int *)(0xFFFE0C0E))
#define IPR14	((volatile unsigned short int *)(0xFFFE0C10))
#define IPR15	((volatile unsigned short int *)(0xFFFE0C12))
#define IPR16	((volatile unsigned short int *)(0xFFFE0C14))
#define IPR17	((volatile unsigned short int *)(0xFFFE0C16))
#define IPR18	((volatile unsigned short int *)(0xFFFE0C18))
#define IPR19	((volatile unsigned short int *)(0xFFFE0C1A))
#define IPR20	((volatile unsigned short int *)(0xFFFE0C1C))
#define IPR21	((volatile unsigned short int *)(0xFFFE0C1E))
#define IPR22	((volatile unsigned short int *)(0xFFFE0C20))


/* キャッシュ制御レジスタ */
#define CCR1	((volatile unsigned int       *)(0xFFFC1000))
#define CCR2	((volatile unsigned int       *)(0xFFFC1004))


/* バスステートコントローラ制御レジスタ */
#define CMNCR	((volatile unsigned int       *)(0xFFFC0000))
#define CS0BCR	((volatile unsigned int       *)(0xFFFC0004))
#define CS1BCR	((volatile unsigned int       *)(0xFFFC0008))
#define CS2BCR	((volatile unsigned int       *)(0xFFFC000C))
#define CS3BCR	((volatile unsigned int       *)(0xFFFC0010))
#define CS4BCR	((volatile unsigned int       *)(0xFFFC0014))
#define CS5BCR	((volatile unsigned int       *)(0xFFFC0018))
#define CS6BCR	((volatile unsigned int       *)(0xFFFC001C))
#define CS0WCR	((volatile unsigned int       *)(0xFFFC0028))
#define CS1WCR	((volatile unsigned int       *)(0xFFFC002C))
#define CS2WCR	((volatile unsigned int       *)(0xFFFC0030))
#define CS3WCR	((volatile unsigned int       *)(0xFFFC0034))
#define CS4WCR	((volatile unsigned int       *)(0xFFFC0038))
#define CS5WCR	((volatile unsigned int       *)(0xFFFC003C))
#define CS6WCR	((volatile unsigned int       *)(0xFFFC0040))
#define SDCR	((volatile unsigned int       *)(0xFFFC004C))
#define RTCSR	((volatile unsigned short int *)(0xFFFC0050))
#define RTCNT	((volatile unsigned short int *)(0xFFFC0054))
#define RTCOR	((volatile unsigned short int *)(0xFFFC0058))
#define ACSWR	((volatile unsigned int       *)(0xFFFC180C))
#define ACKEYR	((volatile unsigned char      *)(0xFFFC1BFC))


/* IICバスインタフェース3制御レジスタ */
#define ICCR1_0  ((volatile unsigned char *)(0xFFFEE000))
#define ICCR2_0  ((volatile unsigned char *)(0xFFFEE001))
#define ICMR_0   ((volatile unsigned char *)(0xFFFEE002))
#define ICIER_0  ((volatile unsigned char *)(0xFFFEE003))
#define ICSR_0   ((volatile unsigned char *)(0xFFFEE004))
#define SAR_0    ((volatile unsigned char *)(0xFFFEE005))
#define ICDRT_0  ((volatile unsigned char *)(0xFFFEE006))
#define ICDRR_0  ((volatile unsigned char *)(0xFFFEE007))
#define NF2CYC_0 ((volatile unsigned char *)(0xFFFEE008))
#define ICCR1_1  ((volatile unsigned char *)(0xFFFEE400))
#define ICCR2_1  ((volatile unsigned char *)(0xFFFEE401))
#define ICMR_1   ((volatile unsigned char *)(0xFFFEE402))
#define ICIER_1  ((volatile unsigned char *)(0xFFFEE403))
#define ICSR_1   ((volatile unsigned char *)(0xFFFEE404))
#define SAR_1    ((volatile unsigned char *)(0xFFFEE405))
#define ICDRT_1  ((volatile unsigned char *)(0xFFFEE406))
#define ICDRR_1  ((volatile unsigned char *)(0xFFFEE407))
#define NF2CYC_1 ((volatile unsigned char *)(0xFFFEE408))


/* ビデオディスプレイコントローラ3制御レジスタ */
#define VIDEO_MODE         ((volatile unsigned int *)(0xFFFF2000))
#define VIDEO_INT_CNT      ((volatile unsigned int *)(0xFFFF2004))
#define VIDEO_TIM_CNT      ((volatile unsigned int *)(0xFFFF2008))
#define VIDEO_SIZE         ((volatile unsigned int *)(0xFFFF2100))
#define VIDEO_VSTART       ((volatile unsigned int *)(0xFFFF2104))
#define VIDEO_HSTART       ((volatile unsigned int *)(0xFFFF2108))
#define VIDEO_VSYNC_TIM1   ((volatile unsigned int *)(0xFFFF210C))
#define VIDEO_SAVE_NUM     ((volatile unsigned int *)(0xFFFF2110))
#define VIDEO_IMAGE_CNT    ((volatile unsigned int *)(0xFFFF2114))
#define VIDEO_BASEADR      ((volatile unsigned int *)(0xFFFF2118))
#define VIDEO_LINE_OFFSET  ((volatile unsigned int *)(0xFFFF211C))
#define VIDEO_FIELD_OFFSET ((volatile unsigned int *)(0xFFFF2120))
#define VIDEO_LINEBUFF_NUM ((volatile unsigned int *)(0xFFFF2124))
#define VIDEO_DISP_SIZE    ((volatile unsigned int *)(0xFFFF2128))
#define VIDEO_DISP_HSTART  ((volatile unsigned int *)(0xFFFF212C))
#define GRCMEN1            ((volatile unsigned int *)(0xFFFF2800))
#define GRCBUSCNT1         ((volatile unsigned int *)(0xFFFF2804))
#define GRCINTCNT1         ((volatile unsigned int *)(0xFFFF2808))
#define GROPSADR1          ((volatile unsigned int *)(0xFFFF2B08))
#define GROPSWH1           ((volatile unsigned int *)(0xFFFF2B0C))
#define GROPSOFST1         ((volatile unsigned int *)(0xFFFF2B10))
#define GROPDPHV1          ((volatile unsigned int *)(0xFFFF2B14))
#define GROPEWH1           ((volatile unsigned int *)(0xFFFF2B18))
#define GROPEDPHV1         ((volatile unsigned int *)(0xFFFF2B1C))
#define GROPEDPA1          ((volatile unsigned int *)(0xFFFF2B20))
#define GROPCRKY0_1        ((volatile unsigned int *)(0xFFFF2B24))
#define GROPCRKY1_1        ((volatile unsigned int *)(0xFFFF2B28))
#define GROPBASERGB1       ((volatile unsigned int *)(0xFFFF2B2C))
#define GRCMEN2            ((volatile unsigned int *)(0xFFFF3000))
#define GRCBUSCNT2         ((volatile unsigned int *)(0xFFFF3004))
#define GRCINTCNT2         ((volatile unsigned int *)(0xFFFF3008))
#define GROPSADR2          ((volatile unsigned int *)(0xFFFF3308))
#define GROPSWH2           ((volatile unsigned int *)(0xFFFF330C))
#define GROPSOFST2         ((volatile unsigned int *)(0xFFFF3310))
#define GROPDPHV2          ((volatile unsigned int *)(0xFFFF3314))
#define GROPEWH2           ((volatile unsigned int *)(0xFFFF3318))
#define GROPEDPHV2         ((volatile unsigned int *)(0xFFFF331C))
#define GROPEDPA2          ((volatile unsigned int *)(0xFFFF3320))
#define GROPCRKY0_2        ((volatile unsigned int *)(0xFFFF3324))
#define GROPCRKY1_2        ((volatile unsigned int *)(0xFFFF3328))
#define GROPBASERGB2       ((volatile unsigned int *)(0xFFFF332C))
#define SGMODE             ((volatile unsigned int *)(0xFFFF3800))
#define SGINTCNT           ((volatile unsigned int *)(0xFFFF3804))
#define SYNCNT             ((volatile unsigned int *)(0xFFFF3808))
#define PANEL_CLKSEL       ((volatile unsigned int *)(0xFFFF380C))
#define SYN_SIZE           ((volatile unsigned int *)(0xFFFF3900))
#define PANEL_VSYNC_TIM    ((volatile unsigned int *)(0xFFFF3904))
#define PANEL_HSYNC_TIM    ((volatile unsigned int *)(0xFFFF3908))
#define VIDEO_VSYNC_TIM2   ((volatile unsigned int *)(0xFFFF390C))
#define GRA_VSYNC_TIM      ((volatile unsigned int *)(0xFFFF3910))
#define AC_LINE_NUM        ((volatile unsigned int *)(0xFFFF3914))
#define DE_SIZE            ((volatile unsigned int *)(0xFFFF3920))
#define DE_START           ((volatile unsigned int *)(0xFFFF3924))


/* コンペアマッチタイマ */
#define CMSTR	((volatile unsigned short int *)(0xFFFEC000))
#define CMCSR0	((volatile unsigned short int *)(0xFFFEC002))
#define CMCNT0	((volatile unsigned short int *)(0xFFFEC004))
#define CMCOR0	((volatile unsigned short int *)(0xFFFEC006))
#define CMCSR1	((volatile unsigned short int *)(0xFFFEC008))
#define CMCNT1	((volatile unsigned short int *)(0xFFFEC00A))
#define CMCOR1	((volatile unsigned short int *)(0xFFFEC00C))


/* A-Dコンバータ制御レジスタ */
#define ADDRA	((volatile unsigned short int *)(0xFFFF9800))
#define ADDRB	((volatile unsigned short int *)(0xFFFF9802))
#define ADDRC	((volatile unsigned short int *)(0xFFFF9804))
#define ADDRD	((volatile unsigned short int *)(0xFFFF9806))
#define ADDRE	((volatile unsigned short int *)(0xFFFF9808))
#define ADDRF	((volatile unsigned short int *)(0xFFFF980A))
#define ADDRG	((volatile unsigned short int *)(0xFFFF980C))
#define ADDRH	((volatile unsigned short int *)(0xFFFF980E))
#define ADCSR	((volatile unsigned short int *)(0xFFFF9820))


/* 汎用入出力ポート制御レジスタ */
#define PAIOR0	((volatile unsigned short int *)(0xFFFE3812))
#define PADR1	((volatile unsigned short int *)(0xFFFE3814))
#define PADR0	((volatile unsigned short int *)(0xFFFE3816))
#define PAPR0	((volatile unsigned short int *)(0xFFFE381A))
#define PBCR5	((volatile unsigned short int *)(0xFFFE3824))
#define PBCR4	((volatile unsigned short int *)(0xFFFE3826))
#define PBCR3	((volatile unsigned short int *)(0xFFFE3828))
#define PBCR2	((volatile unsigned short int *)(0xFFFE382A))
#define PBCR1	((volatile unsigned short int *)(0xFFFE382C))
#define PBCR0	((volatile unsigned short int *)(0xFFFE382E))
#define PBIOR1	((volatile unsigned short int *)(0xFFFE3830))
#define PBIOR0	((volatile unsigned short int *)(0xFFFE3832))
#define PBDR1	((volatile unsigned short int *)(0xFFFE3834))
#define PBDR0	((volatile unsigned short int *)(0xFFFE3836))
#define PBPR1	((volatile unsigned short int *)(0xFFFE3838))
#define PBPR0	((volatile unsigned short int *)(0xFFFE383A))
#define PCCR2	((volatile unsigned short int *)(0xFFFE384A))
#define PCCR1	((volatile unsigned short int *)(0xFFFE384C))
#define PCCR0	((volatile unsigned short int *)(0xFFFE384E))
#define PCIOR0	((volatile unsigned short int *)(0xFFFE3852))
#define PCDR0	((volatile unsigned short int *)(0xFFFE3856))
#define PCPR0	((volatile unsigned short int *)(0xFFFE385A))
#define PDCR3	((volatile unsigned short int *)(0xFFFE3868))
#define PDCR2	((volatile unsigned short int *)(0xFFFE386A))
#define PDCR1	((volatile unsigned short int *)(0xFFFE386C))
#define PDCR0	((volatile unsigned short int *)(0xFFFE386E))
#define PDIOR0	((volatile unsigned short int *)(0xFFFE3872))
#define PDDR0	((volatile unsigned short int *)(0xFFFE3876))
#define PDPR0	((volatile unsigned short int *)(0xFFFE387A))
#define PECR1	((volatile unsigned short int *)(0xFFFE388C))
#define PECR0	((volatile unsigned short int *)(0xFFFE388E))
#define PEIOR0	((volatile unsigned short int *)(0xFFFE3892))
#define PEDR0	((volatile unsigned short int *)(0xFFFE3896))
#define PEPR0	((volatile unsigned short int *)(0xFFFE389A))
#define PFCR3	((volatile unsigned short int *)(0xFFFE38A8))
#define PFCR2	((volatile unsigned short int *)(0xFFFE38AA))
#define PFCR1	((volatile unsigned short int *)(0xFFFE38AC))
#define PFCR0	((volatile unsigned short int *)(0xFFFE38AE))
#define PFIOR0	((volatile unsigned short int *)(0xFFFE38B2))
#define PFDR0	((volatile unsigned short int *)(0xFFFE38B6))
#define PFPR0	((volatile unsigned short int *)(0xFFFE38BA))
#define PGCR7	((volatile unsigned short int *)(0xFFFE38C0))
#define PGCR6	((volatile unsigned short int *)(0xFFFE38C2))
#define PGCR5	((volatile unsigned short int *)(0xFFFE38C4))
#define PGCR4	((volatile unsigned short int *)(0xFFFE38C6))
#define PGCR3	((volatile unsigned short int *)(0xFFFE38C8))
#define PGCR2	((volatile unsigned short int *)(0xFFFE38CA))
#define PGCR1	((volatile unsigned short int *)(0xFFFE38CC))
#define PGCR0	((volatile unsigned short int *)(0xFFFE38CE))
#define PGIOR1	((volatile unsigned short int *)(0xFFFE38D0))
#define PGDR1	((volatile unsigned short int *)(0xFFFE38D4))
#define PHCR1	((volatile unsigned short int *)(0xFFFE38EC))
#define PHCR0	((volatile unsigned short int *)(0xFFFE38EE))
#define PHPR0	((volatile unsigned short int *)(0xFFFE38FA))
#define PJCR2	((volatile unsigned short int *)(0xFFFE390A))
#define PJCR1	((volatile unsigned short int *)(0xFFFE390C))
#define PJCR0	((volatile unsigned short int *)(0xFFFE390E))
#define PJIOR0	((volatile unsigned short int *)(0xFFFE3912))
#define PJPR0	((volatile unsigned short int *)(0xFFFE391A))
#define PKCR2	((volatile unsigned short int *)(0xFFFE392A))
#define PKCR1	((volatile unsigned short int *)(0xFFFE392C))
#define PKCR0	((volatile unsigned short int *)(0xFFFE392E))


/* USBコントローラ制御レジスタ */
#define USB_SYSCFG ((volatile unsigned short int *)(0xFFFFC000))


/* 低消費電力モード制御レジスタ */
#define STBCR1	((volatile unsigned char      *)(0xFFFE0014))
#define STBCR2	((volatile unsigned char      *)(0xFFFE0018))
#define STBCR3	((volatile unsigned char      *)(0xFFFE0408))
#define STBCR4	((volatile unsigned char      *)(0xFFFE040C))
#define STBCR5	((volatile unsigned char      *)(0xFFFE0410))
#define STBCR6	((volatile unsigned char      *)(0xFFFE0414))
#define STBCR7	((volatile unsigned char      *)(0xFFFE0418))
#define STBCR8	((volatile unsigned char      *)(0xFFFE041C))
#define SWRSTCR	((volatile unsigned char      *)(0xFFFE0430))
#define SYSCR1	((volatile unsigned char      *)(0xFFFE0400))
#define SYSCR2	((volatile unsigned char      *)(0xFFFE0404))
#define SYSCR3	((volatile unsigned char      *)(0xFFFE0420))
#define SYSCR4	((volatile unsigned char      *)(0xFFFE0424))
#define SYSCR5	((volatile unsigned char      *)(0xFFFE0428))
#define RRAMKP	((volatile unsigned char      *)(0xFFFE6800))
#define DSCTR	((volatile unsigned char      *)(0xFFFE6802))
#define DSSSR	((volatile unsigned char      *)(0xFFFE6804))
#define DSESR	((volatile unsigned char      *)(0xFFFE6806))
#define DSFR	((volatile unsigned char      *)(0xFFFE6808))
#define XTALCTR	((volatile unsigned char      *)(0xFFFE6810))


/* DMAコントローラ(ch15) */
#define DMA_DMAOR	((volatile unsigned short int *)(0xFFFE1200))
#define DMA_SAR		((volatile unsigned int *)(0xFFFE10F0))
#define DMA_DAR		((volatile unsigned int *)(0xFFFE10F4))
#define DMA_TCR		((volatile unsigned int *)(0xFFFE10F8))
#define DMA_CHCR	((volatile unsigned int *)(0xFFFE10FC))
#define DMA_RSAR	((volatile unsigned int *)(0xFFFE11F0))
#define DMA_RDAR	((volatile unsigned int *)(0xFFFE11F4))
#define DMA_RTCR	((volatile unsigned int *)(0xFFFE11F8))

#define SCSMR2		((volatile unsigned short*)(0xFFFE9000))
#define SCBRR2		((volatile unsigned char*)(0xFFFE9004))
#define SCSCR2		((volatile unsigned short*)(0xFFFE9008))
#define SCFTDR2		((volatile unsigned char*)(0xFFFE900C))
#define SCFSR2		((volatile unsigned short*)(0xFFFE9010))
#define SCFRDR2		((volatile unsigned char*)(0xFFFE9014))
#define SCFCR2		((volatile unsigned short*)(0xFFFE9018))
#define SCFDR2		((volatile unsigned short*)(0xFFFE901C))
#define SCSPTR2		((volatile unsigned short*)(0xFFFE9020))
#define SCEMR2		((volatile unsigned short*)(0xFFFE9028))

#define SPCR0		((volatile unsigned char*)(0xFFFF8000))
#define SSLP0		((volatile unsigned char*)(0xFFFF8001))
#define SPPCR0		((volatile unsigned char*)(0xFFFF8002))
#define SPSR0		((volatile unsigned char*)(0xFFFF8003))
#define SPDR0		((volatile unsigned long*)(0xFFFF8004))
#define SPSCR0		((volatile unsigned char*)(0xFFFF8008))
#define SPSSR0		((volatile unsigned char*)(0xFFFF8009))
#define SPBR0		((volatile unsigned char*)(0xFFFF800A))
#define SPDCR0		((volatile unsigned char*)(0xFFFF800B))
#define SPCKD0		((volatile unsigned char*)(0xFFFF800C))
#define SSLND0		((volatile unsigned char*)(0xFFFF800D))
#define SPND0		((volatile unsigned char*)(0xFFFF800E))
#define SPCMD00		((volatile unsigned short*)(0xFFFF8010))
#define SPCMD01		((volatile unsigned short*)(0xFFFF8012))
#define SPCMD02		((volatile unsigned short*)(0xFFFF8014))
#define SPCMD03		((volatile unsigned short*)(0xFFFF8016))
#define SPBFCR0		((volatile unsigned char*)(0xFFFF8020))
#endif
