#ifndef __XINC_HW_H #define __XINC_HW_H #include "xinc_map.h" #define __RAM_CODE __attribute__((section("ram_code"))) typedef short int16_t; typedef int int32_t; typedef long long int64_t; typedef unsigned char uint8_t; typedef unsigned short uint16_t; typedef unsigned int uint32_t; typedef unsigned long long uint64_t; //- DMAS #define DMAS_CHx_SAR(a) ((volatile unsigned *)(DMAS_BASE + 0x40 + (a * 0x20))) #define DMAS_CHx_DAR(a) ((volatile unsigned *)(DMAS_BASE + 0x44 + (a * 0x20))) #define DMAS_CHx_CTL0(a) ((volatile unsigned *)(DMAS_BASE + 0x48 + (a * 0x20))) #define DMAS_CHx_CTL1(a) ((volatile unsigned *)(DMAS_BASE + 0x4C + (a * 0x20))) #define DMAS_CHx_CA(a) ((volatile unsigned *)(DMAS_BASE + 0x50 + (a * 0x20))) //- TIMER #define CPR_TIMER_CLK_CTL(a) ((volatile unsigned *)(CPR_BASE + 0x58 + (a * 0x04))) #define TIMERx_TLC(a) ((volatile unsigned *)(TIMER_BASE + 0x00 + (a * 0x14))) #define TIMERx_TCV(a) ((volatile unsigned *)(TIMER_BASE + 0x04 + (a * 0x14))) #define TIMERx_TCR(a) ((volatile unsigned *)(TIMER_BASE + 0x08 + (a * 0x14))) #define TIMERx_TIC(a) ((volatile unsigned *)(TIMER_BASE + 0x0C + (a * 0x14))) #define TIMERx_TIS(a) ((volatile unsigned *)(TIMER_BASE + 0x10 + (a * 0x14))) //- UART #define CPR_UARTx_CLK_GRCTL(a) ((volatile unsigned *)(CPR_BASE + 0x30 + (a * 0x08))) #define CPR_UARTx_CLK_CTL(a) ((volatile unsigned *)(CPR_BASE + 0x34 + (a * 0x08))) #define UARTx_RBR(a) ((volatile unsigned *)(UART0_BASE + 0x00 + (a * 0x1000))) #define UARTx_THR(a) ((volatile unsigned *)(UART0_BASE + 0x00 + (a * 0x1000))) #define UARTx_DLL(a) ((volatile unsigned *)(UART0_BASE + 0x00 + (a * 0x1000))) #define UARTx_IER(a) ((volatile unsigned *)(UART0_BASE + 0x04 + (a * 0x1000))) #define UARTx_DLH(a) ((volatile unsigned *)(UART0_BASE + 0x04 + (a * 0x1000))) #define UARTx_IIR(a) ((volatile unsigned *)(UART0_BASE + 0x08 + (a * 0x1000))) #define UARTx_FCR(a) ((volatile unsigned *)(UART0_BASE + 0x08 + (a * 0x1000))) #define UARTx_TCR(a) ((volatile unsigned *)(UART0_BASE + 0x0c + (a * 0x1000))) #define UARTx_MCR(a) ((volatile unsigned *)(UART0_BASE + 0x10 + (a * 0x1000))) #define UARTx_TSR(a) ((volatile unsigned *)(UART0_BASE + 0x14 + (a * 0x1000))) #define UARTx_MSR(a) ((volatile unsigned *)(UART0_BASE + 0x18 + (a * 0x1000))) #define UARTx_USR(a) ((volatile unsigned *)(UART0_BASE + 0x7c + (a * 0x1000))) //- SPI #define CPR_SPIx_MCLK_CTL(a) ((volatile unsigned *)(CPR_BASE + 0x050 + (a*0x04))) #define SSIx_CTRL0(a) ((volatile unsigned *)(SPI0_BASE + 0x00 + (a * 0x1000))) #define SSIx_EN(a) ((volatile unsigned *)(SPI0_BASE + 0x08 + (a * 0x1000))) #define SSIx_SE(a) ((volatile unsigned *)(SPI0_BASE + 0x10 + (a * 0x1000))) #define SSIx_BAUD(a) ((volatile unsigned *)(SPI0_BASE + 0x14 + (a * 0x1000))) #define SSIx_TXFTL(a) ((volatile unsigned *)(SPI0_BASE + 0x18 + (a * 0x1000))) #define SSIx_RXFTL(a) ((volatile unsigned *)(SPI0_BASE + 0x1c + (a * 0x1000))) #define SSIx_TXFL(a) ((volatile unsigned *)(SPI0_BASE + 0x20 + (a * 0x1000))) #define SSIx_RXFL(a) ((volatile unsigned *)(SPI0_BASE + 0x24 + (a * 0x1000))) #define SSIx_STS(a) ((volatile unsigned *)(SPI0_BASE + 0x28 + (a * 0x1000))) #define SSIx_IE(a) ((volatile unsigned *)(SPI0_BASE + 0x2c + (a * 0x1000))) #define SSIx_IS(a) ((volatile unsigned *)(SPI0_BASE + 0x30 + (a * 0x1000))) #define SSIx_RIS(a) ((volatile unsigned *)(SPI0_BASE + 0x34 + (a * 0x1000))) #define SSIx_TXOIC(a) ((volatile unsigned *)(SPI0_BASE + 0x38 + (a * 0x1000))) #define SSIx_RXOIC(a) ((volatile unsigned *)(SPI0_BASE + 0x3c + (a * 0x1000))) #define SSIx_RXUIC(a) ((volatile unsigned *)(SPI0_BASE + 0x40 + (a * 0x1000))) #define SSIx_IC(a) ((volatile unsigned *)(SPI0_BASE + 0x48 + (a * 0x1000))) #define SSIx_DMAS(a) ((volatile unsigned *)(SPI0_BASE + 0x4c + (a * 0x1000))) #define SSIx_DMATDL(a) ((volatile unsigned *)(SPI0_BASE + 0x50 + (a * 0x1000))) #define SSIx_DMARDL(a) ((volatile unsigned *)(SPI0_BASE + 0x54 + (a * 0x1000))) #define SSIx_DATA(a) ((volatile unsigned *)(SPI0_BASE + 0x60 + (a * 0x1000))) #define SSI2_CTRL0 ((volatile unsigned *)(SPI2_BASE + 0x00)) #define SSI2_EN ((volatile unsigned *)(SPI2_BASE + 0x08)) #define SSI2_SE ((volatile unsigned *)(SPI2_BASE + 0x10)) #define SSI2_BAUD ((volatile unsigned *)(SPI2_BASE + 0x14)) #define SSI2_TXFTL ((volatile unsigned *)(SPI2_BASE + 0x18)) #define SSI2_RXFTL ((volatile unsigned *)(SPI2_BASE + 0x1c)) #define SSI2_TXFL ((volatile unsigned *)(SPI2_BASE + 0x20)) #define SSI2_RXFL ((volatile unsigned *)(SPI2_BASE + 0x24)) #define SSI2_STS ((volatile unsigned *)(SPI2_BASE + 0x28)) #define SSI2_IE ((volatile unsigned *)(SPI2_BASE + 0x2c)) #define SSI2_IS ((volatile unsigned *)(SPI2_BASE + 0x30)) #define SSI2_RIS ((volatile unsigned *)(SPI2_BASE + 0x34)) #define SSI2_TXOIC ((volatile unsigned *)(SPI2_BASE + 0x38)) #define SSI2_RXOIC ((volatile unsigned *)(SPI2_BASE + 0x3c)) #define SSI2_RXUIC ((volatile unsigned *)(SPI2_BASE + 0x40)) #define SSI2_IC ((volatile unsigned *)(SPI2_BASE + 0x48)) #define SSI2_DMAS ((volatile unsigned *)(SPI2_BASE + 0x4c)) #define SSI2_DMATDL ((volatile unsigned *)(SPI2_BASE + 0x50)) #define SSI2_DMARDL ((volatile unsigned *)(SPI2_BASE + 0x54)) #define SSI2_DATA ((volatile unsigned *)(SPI2_BASE + 0x60)) //- RTC #define RTC_CMR_X(a) ((volatile unsigned *)(RTC_BASE + 0x08 + (a * 0x4))) ////48PIN- PWM //#define PWMx_EN(a) ((volatile unsigned *)(PWM_BASE + 0x0000 + (a*0x40))) //#define PWMx_UP(a) ((volatile unsigned *)(PWM_BASE + 0x0004 + (a*0x40))) //#define PWMx_RST(a) ((volatile unsigned *)(PWM_BASE + 0x0008 + (a*0x40))) //#define PWMx_P(a) ((volatile unsigned *)(PWM_BASE + 0x000c + (a*0x40))) //#define PWMx_OCPY(a) ((volatile unsigned *)(PWM_BASE + 0x0010 + (a*0x40))) //32/16PIN- PWM #define PWMx_EN(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0000 + ((a%2)*0x40))) #define PWMx_UP(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0004 + ((a%2)*0x40))) #define PWMx_RST(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0008 + ((a%2)*0x40))) #define PWMx_P(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x000c + ((a%2)*0x40))) #define PWMx_OCPY(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0010 + ((a%2)*0x40))) //pwm0 pwm1 effective #define PWMCOMPEN(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0014 + ((a%2)*0x40))) #define PWMCOMPTIME(a) ((volatile unsigned *)((PWM_BASE +((a/2)*0x400)) + 0x0018 + ((a%2)*0x40))) #define PWM_BREAK_CTL ((volatile unsigned *)((PWM_BASE +0x20))) #define __write_hw_reg32(reg,val) ((*reg) = (val)) #define __read_hw_reg32(reg, val) ((val) = (*reg)) #define setbit(x,y) ((x) |= (1<<(y))) #define clrbit(x,y) ((x) &= ~(1<<(y))) #endif