📄 mcf523x_hi.c
字号:
/*
* File: mcf523x_hi.c
* Purpose: Register display/modify routines for MCF523x modules.
*
* Notes:
*
*/
#include "src/include/dbug.h"
#include "src/uif/cpu.h"
/********************************************************************/
/*
* CPU name string and source code version for display at boot-up.
*/
const char CPU_STR[] = "ColdFire MCF5235";
const int CPU_VER_MAJOR = 1;
const char CPU_VER_MINOR = 'a';
/********************************************************************/
static const char FORMAT8[] = "%6s (%-6s): %02X\n";
static const char FORMAT16[] = "%6s (%-6s): %04X\n";
static const char FORMAT32[] = "%6s (%-6s): %08X\n";
static const char XFORMAT[] = "%6s (%-6s): %6s\n";
static const char INVMOD[] = "Error: Invalid Module: %s\n";
static const char NOREG[] = "XXXXXX";
#define IRMD(MOD,RDREG,WRREG,SIZE) \
if (regread) \
{ \
if ((strcasecmp(#RDREG,reg) == 0) || display_all) \
{ \
rdata = MCF_ ## MOD ## _ ## RDREG; \
printf(FORMAT ## SIZE, #RDREG, #WRREG, rdata); \
\
pause(&displayed); \
\
if (!display_all) return; \
} \
} \
else \
{ \
if (strcasecmp(#WRREG,reg) == 0) \
{ \
MCF_ ## MOD ## _ ## WRREG = (uint ## SIZE) value; \
return; \
} \
}
#define IRMD_SIZE(MOD,RDREG,WRREG,SIZE) \
if (regread) \
{ \
if ((strcasecmp(#RDREG,reg) == 0) || display_all) \
{ \
rdata = MCF_ ## MOD ## _ ## RDREG(SIZE); \
printf(FORMAT ## SIZE, #RDREG, #WRREG, rdata); \
\
pause(&displayed); \
\
if (!display_all) return; \
} \
} \
else \
{ \
if (strcasecmp(#WRREG,reg) == 0) \
{ \
MCF_ ## MOD ## _ ## WRREG(SIZE) = (uint ## SIZE) value; \
return; \
} \
}
#define IRMD_NOWR(MOD,RDREG,SIZE) \
if (regread) \
{ \
if ((strcasecmp(#RDREG,reg) == 0) || display_all) \
{ \
rdata = MCF_ ## MOD ## _ ## RDREG; \
printf(FORMAT ## SIZE, #RDREG, NOREG, rdata); \
\
pause(&displayed); \
\
if (!display_all) return; \
} \
}
#define IRMD_(MOD,WRREG,SIZE) \
if (regread && display_all) \
{ \
printf(XFORMAT, NOREG, #WRREG, NOREG); \
} \
else \
{ \
if (strcasecmp(#WRREG,reg) == 0) \
{ \
MCF_ ## MOD ## _ ## WRREG = (uint ## SIZE) value; \
return; \
} \
}
static int display_all;
static int displayed;
static uint32 rdata;
/********************************************************************/
static void
irmd_scm (char *reg, int regread, uint32 value)
{
IRMD(SCM, IPSBAR, IPSBAR, 32);
IRMD(SCM, RAMBAR, RAMBAR, 32);
IRMD(SCM, CRSR, CRSR, 8);
IRMD(SCM, CWCR, CWCR, 8);
IRMD(SCM, LPICR, LPICR, 8);
IRMD(SCM, CWSR, CWSR, 8);
IRMD(SCM, DMAREQC,DMAREQC,32);
IRMD(SCM, MPARK, MPARK, 32);
IRMD(SCM, MPR, MPR, 8);
IRMD(SCM, PACR0, PACR0, 8);
IRMD(SCM, PACR1, PACR1, 8);
IRMD(SCM, PACR2, PACR2, 8);
IRMD(SCM, PACR3, PACR3, 8);
IRMD(SCM, PACR4, PACR4, 8);
IRMD(SCM, PACR5, PACR5, 8);
IRMD(SCM, PACR6, PACR6, 8);
IRMD(SCM, PACR7, PACR7, 8);
IRMD(SCM, PACR8, PACR8, 8);
IRMD(SCM, GPACR0, GPACR0, 8);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs0 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR0, CSAR0, 16);
IRMD(CS, CSMR0, CSMR0, 32);
IRMD(CS, CSCR0, CSCR0, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs1 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR1, CSAR1, 16);
IRMD(CS, CSMR1, CSMR1, 32);
IRMD(CS, CSCR1, CSCR1, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs2 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR2, CSAR2, 16);
IRMD(CS, CSMR2, CSMR2, 32);
IRMD(CS, CSCR2, CSCR2, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs3 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR2, CSAR2, 16);
IRMD(CS, CSMR2, CSMR2, 32);
IRMD(CS, CSCR2, CSCR2, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs4 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR4, CSAR4, 16);
IRMD(CS, CSMR4, CSMR4, 32);
IRMD(CS, CSCR4, CSCR4, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs5 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR5, CSAR5, 16);
IRMD(CS, CSMR5, CSMR5, 32);
IRMD(CS, CSCR5, CSCR5, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_cs6 (char *reg, int regread, uint32 value)
{
IRMD(CS, CSAR6, CSAR6, 16);
IRMD(CS, CSMR6, CSMR6, 32);
IRMD(CS, CSCR6, CSCR6, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_gpio (char *reg, int regread, uint32 value)
{
IRMD(GPIO, PODR_ADDR, PODR_ADDR, 8);
IRMD(GPIO, PODR_DATAH, PODR_DATAH, 8);
IRMD(GPIO, PODR_DATAL, PODR_DATAL, 8);
IRMD(GPIO, PODR_BUSCTL, PODR_BUSCTL,8);
IRMD(GPIO, PODR_BS, PODR_BS, 8);
IRMD(GPIO, PODR_CS, PODR_CS, 8);
IRMD(GPIO, PODR_SDRAM, PODR_SDRAM, 8);
IRMD(GPIO, PODR_FECI2C, PODR_FECI2C,8);
IRMD(GPIO, PODR_UARTH, PODR_UARTH, 8);
IRMD(GPIO, PODR_UARTL, PODR_UARTL, 8);
IRMD(GPIO, PODR_QSPI, PODR_QSPI, 8);
IRMD(GPIO, PODR_TIMER, PODR_TIMER, 8);
IRMD(GPIO, PODR_ETPU, PODR_ETPU, 8);
IRMD(GPIO, PDDR_DATAH, PDDR_DATAH, 8);
IRMD(GPIO, PDDR_DATAL, PDDR_DATAL, 8);
IRMD(GPIO, PDDR_BUSCTL, PDDR_BUSCTL, 8);
IRMD(GPIO, PDDR_BS, PDDR_BS, 8);
IRMD(GPIO, PDDR_CS, PDDR_CS, 8);
IRMD(GPIO, PDDR_SDRAM, PDDR_SDRAM, 8);
IRMD(GPIO, PDDR_FECI2C, PDDR_FECI2C, 8);
IRMD(GPIO, PDDR_UARTH, PDDR_UARTH, 8);
IRMD(GPIO, PDDR_UARTL, PDDR_UARTL, 8);
IRMD(GPIO, PDDR_QSPI, PDDR_QSPI, 8);
IRMD(GPIO, PDDR_TIMER, PDDR_TIMER, 8);
IRMD(GPIO, PDDR_ETPU, PDDR_ETPU, 8);
IRMD(GPIO, PPDSDR_ADDR, PPDSDR_ADDR, 8);
IRMD(GPIO, PPDSDR_DATAH, PPDSDR_DATAH, 8);
IRMD(GPIO, PPDSDR_DATAL, PPDSDR_DATAL, 8);
IRMD(GPIO, PPDSDR_BUSCTL, PPDSDR_BUSCTL, 8);
IRMD(GPIO, PPDSDR_BS, PPDSDR_BS, 8);
IRMD(GPIO, PPDSDR_FECI2C, PPDSDR_FECI2C, 8);
IRMD(GPIO, PPDSDR_CS, PPDSDR_CS, 8);
IRMD(GPIO, PPDSDR_SDRAM, PPDSDR_SDRAM, 8);
IRMD(GPIO, PPDSDR_UARTH, PPDSDR_UARTH, 8);
IRMD(GPIO, PPDSDR_UARTL, PPDSDR_UARTL, 8);
IRMD(GPIO, PPDSDR_QSPI, PPDSDR_QSPI, 8);
IRMD(GPIO, PPDSDR_TIMER, PPDSDR_TIMER, 8);
IRMD(GPIO, PPDSDR_ETPU, PPDSDR_ETPU, 8);
IRMD(GPIO, PCLRR_ADDR, PCLRR_ADDR, 8);
IRMD(GPIO, PCLRR_DATAH, PCLRR_DATAH, 8);
IRMD(GPIO, PCLRR_DATAL, PCLRR_DATAL, 8);
IRMD(GPIO, PCLRR_BUSCTL, PCLRR_BUSCTL, 8);
IRMD(GPIO, PCLRR_BS, PCLRR_BS, 8);
IRMD(GPIO, PCLRR_CS, PCLRR_CS, 8);
IRMD(GPIO, PCLRR_SDRAM, PCLRR_SDRAM, 8);
IRMD(GPIO, PCLRR_FECI2C, PCLRR_FECI2C, 8);
IRMD(GPIO, PCLRR_UARTH, PCLRR_UARTH, 8);
IRMD(GPIO, PCLRR_UARTL, PCLRR_UARTL, 8);
IRMD(GPIO, PCLRR_QSPI, PCLRR_QSPI, 8);
IRMD(GPIO, PCLRR_TIMER, PCLRR_TIMER, 8);
IRMD(GPIO, PCLRR_ETPU, PCLRR_ETPU, 8);
IRMD(GPIO, PAR_AD, PAR_AD, 8);
IRMD(GPIO, PAR_BUSCTL, PAR_BUSCTL, 8);
IRMD(GPIO, PAR_BS, PAR_BS, 8);
IRMD(GPIO, PAR_CS, PAR_CS, 8);
IRMD(GPIO, PAR_SDRAM, PAR_SDRAM, 8);
IRMD(GPIO, PAR_FECI2C, PAR_FECI2C, 8);
IRMD(GPIO, PAR_UART, PAR_UART, 8);
IRMD(GPIO, PAR_QSPI, PAR_QSPI, 8);
IRMD(GPIO, PAR_TIMER, PAR_TIMER, 8);
IRMD(GPIO, PAR_ETPU, PAR_ETPU, 8);
IRMD(GPIO, DSCR_EIM, DSCR_EIM, 8);
IRMD(GPIO, DSCR_ETPU, DSCR_ETPU, 8);
IRMD(GPIO, DSCR_FECI2C, DSCR_FECI2C, 8);
IRMD(GPIO, DSCR_UART, DSCR_UART, 8);
IRMD(GPIO, DSCR_QSPI, DSCR_QSPI, 8);
IRMD(GPIO, DSCR_TIMER, DSCR_TIMER, 8);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_qspi (char *reg, int regread, uint32 value)
{
IRMD(QSPI, QMR, QMR, 16);
IRMD(QSPI, QDLYR, QDLYR, 16);
IRMD(QSPI, QWR, QWR, 16);
IRMD(QSPI, QIR, QIR, 16);
IRMD(QSPI, QAR, QAR, 16);
IRMD(QSPI, QDR, QDR, 16);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_dma0 (char *reg, int regread, uint32 value)
{
IRMD(TIMER, DTMR0, DTMR0, 16);
IRMD(TIMER, DTXMR0, DTXMR0, 8);
IRMD(TIMER, DTER0, DTER0, 8);
IRMD(TIMER, DTRR0, DTRR0, 32); /*User needs to determine if MPARK[BCR24Bit] = 1*/
IRMD(TIMER, DTCR0, DTCR0, 32);
IRMD(TIMER, DTCN0, DTCN0, 32);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_dma1 (char *reg, int regread, uint32 value)
{
IRMD(TIMER, DTMR1, DTMR1, 16);
IRMD(TIMER, DTXMR1, DTXMR1, 8);
IRMD(TIMER, DTER1, DTER1, 8);
IRMD(TIMER, DTRR1, DTRR1, 32); /*User needs to determine if MPARK[BCR24Bit] = 1*/
IRMD(TIMER, DTCR1, DTCR1, 32);
IRMD(TIMER, DTCN1, DTCN1, 32);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_dma2 (char *reg, int regread, uint32 value)
{
IRMD(TIMER, DTMR2, DTMR2, 16);
IRMD(TIMER, DTXMR2, DTXMR2, 8);
IRMD(TIMER, DTER2, DTER2, 8);
IRMD(TIMER, DTRR2, DTRR2, 32); /*User needs to determine if MPARK[BCR24Bit] = 1*/
IRMD(TIMER, DTCR2, DTCR2, 32);
IRMD(TIMER, DTCN2, DTCN2, 32);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_dma3 (char *reg, int regread, uint32 value)
{
IRMD(TIMER, DTMR3, DTMR3, 16);
IRMD(TIMER, DTXMR3, DTXMR3, 8);
IRMD(TIMER, DTER3, DTER3, 8);
IRMD(TIMER, DTRR3, DTRR3, 32); /*User needs to determine if MPARK[BCR24Bit] = 1*/
IRMD(TIMER, DTCR3, DTCR3, 32);
IRMD(TIMER, DTCN3, DTCN3, 32);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_uart0 (char *reg, int regread, uint32 value)
{
IRMD(UART, UMR0, UMR0, 8);
IRMD(UART, USR0, USR0, 8);
IRMD(UART, UCSR0, UCSR0, 8);
IRMD(UART, UCR0, UCR0, 8);
IRMD(UART, URB0, URB0, 8);
IRMD(UART, UTB0, UTB0, 8);
IRMD(UART, UIPCR0, UIPCR0, 8);
IRMD(UART, UACR0, UACR0, 8);
IRMD(UART, UISR0, UISR0, 8);
IRMD(UART, UIMR0, UIMR0, 8);
IRMD(UART, UBG10, UBG10, 8);
IRMD(UART, UBG20, UBG20, 8);
IRMD(UART, UIP0, UIP0, 8);
IRMD(UART, UOP10, UOP10, 8);
IRMD(UART, UOP00, UOP00, 8);
if (!display_all)
printf(INVREG,reg);
}
/********************************************************************/
static void
irmd_uart1 (char *reg, int regread, uint32 value)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -