📄 mpc8xx_hi.c
字号:
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_portio
static void
irmd_portio (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(portio, PADIR, 16)
IRMD(portio, PAPAR, 16)
IRMD(portio, PAODR, 16)
IRMD(portio, PADAT, 16)
IRMD(portio, PCDIR, 16)
IRMD(portio, PCPAR, 16)
IRMD(portio, PCSO, 16)
IRMD(portio, PCDAT, 16)
IRMD(portio, PCINT, 16)
IRMD(portio, PDDIR, 16)
IRMD(portio, PDPAR, 16)
IRMD(portio, PDDAT, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_cpmtimer
static void
irmd_cpmtimer (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(cpmtimer, TGCR, 16)
IRMD(cpmtimer, TMR1, 16)
IRMD(cpmtimer, TRR1, 16)
IRMD(cpmtimer, TCR1, 16)
IRMD(cpmtimer, TCN1, 16)
IRMD(cpmtimer, TMR2, 16)
IRMD(cpmtimer, TRR2, 16)
IRMD(cpmtimer, TCR2, 16)
IRMD(cpmtimer, TCN2, 16)
IRMD(cpmtimer, TMR3, 16)
IRMD(cpmtimer, TRR3, 16)
IRMD(cpmtimer, TCR3, 16)
IRMD(cpmtimer, TCN3, 16)
IRMD(cpmtimer, TMR4, 16)
IRMD(cpmtimer, TRR4, 16)
IRMD(cpmtimer, TCR4, 16)
IRMD(cpmtimer, TCN4, 16)
IRMD(cpmtimer, TER1, 16)
IRMD(cpmtimer, TER2, 16)
IRMD(cpmtimer, TER3, 16)
IRMD(cpmtimer, TER4, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_cp
static void
irmd_cp (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(cp, CPCR, 16)
IRMD(cp, RCCR, 16)
IRMD(cp, CPMCR1, 16)
IRMD(cp, CPMCR2, 16)
IRMD(cp, CPMCR3, 16)
IRMD(cp, CPMCR4, 16)
IRMD(cp, RTER, 16)
IRMD(cp, RTMR, 16)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_brgs
static void
irmd_brgs (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(brgs, BRGC1, 32)
IRMD(brgs, BRGC2, 32)
#ifndef BRGC3
IRMD(brgs, BRGC3, 32)
#endif
#ifndef BRGC4
IRMD(brgs, BRGC4, 32)
#endif
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc1
static void
irmd_scc1 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc1, GSMR_L, 32)
IRMD(scc1, GSMR_H, 32)
IRMD(scc1, PSMR, 16)
IRMD(scc1, TODR, 16)
IRMD(scc1, DSR, 16)
IRMD(scc1, SCCE, 16)
IRMD(scc1, SCCM, 16)
IRMD(scc1, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc2
static void
irmd_scc2 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc2, GSMR_L, 32)
IRMD(scc2, GSMR_H, 32)
IRMD(scc2, PSMR, 16)
IRMD(scc2, TODR, 16)
IRMD(scc2, DSR, 16)
IRMD(scc2, SCCE, 16)
IRMD(scc2, SCCM, 16)
IRMD(scc2, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc3
static void
irmd_scc3 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc3, GSMR_L, 32)
IRMD(scc3, GSMR_H, 32)
IRMD(scc3, PSMR, 16)
IRMD(scc3, TODR, 16)
IRMD(scc3, DSR, 16)
IRMD(scc3, SCCE, 16)
IRMD(scc3, SCCM, 16)
IRMD(scc3, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_scc4
static void
irmd_scc4 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(scc4, GSMR_L, 32)
IRMD(scc4, GSMR_H, 32)
IRMD(scc4, PSMR, 16)
IRMD(scc4, TODR, 16)
IRMD(scc4, DSR, 16)
IRMD(scc4, SCCE, 16)
IRMD(scc4, SCCM, 16)
IRMD(scc4, SCCS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_smc1
static void
irmd_smc1 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(smc1, SMCMR, 32)
IRMD(smc1, SMCE, 32)
IRMD(smc1, SMCM, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_smc2
static void
irmd_smc2 (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(smc2, SMCMR, 32)
IRMD(smc2, SMCE, 32)
IRMD(smc2, SMCM, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_spi
static void
irmd_spi (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(spi, SPMODE, 16)
IRMD(spi, SPIE, 8)
IRMD(spi, SPIM, 8)
IRMD(spi, SPCOM, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_pip
static void
irmd_pip (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(pip, PIPC, 16)
IRMD(pip, PTPR, 16)
IRMD(pip, PBDIR, 32)
IRMD(pip, PBPAR, 32)
IRMD(pip, PBODR, 32)
IRMD(pip, PBDAT, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_si
static void
irmd_si (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(si, SIMODE, 32)
IRMD(si, SIGMR, 8)
IRMD(si, SISTR, 8)
IRMD(si, SICMR, 8)
IRMD(si, SICR, 32)
IRMD(si, SIRP, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_usb
static void
irmd_usb (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(usb, USMOD, 8)
IRMD(usb, USADR, 8)
IRMD(usb, USCOM, 8)
IRMD(usb, USEP0, 16)
IRMD(usb, USEP1, 16)
IRMD(usb, USEP2, 16)
IRMD(usb, USEP3, 16)
IRMD(usb, USBER, 16)
IRMD(usb, USBMR, 16)
IRMD(usb, USBS, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_video
static void
irmd_video (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(video, VCCR, 16)
IRMD(video, VSR, 8)
IRMD(video, VCMR, 8)
IRMD(video, VBCB, 32)
IRMD(video, VFCR0, 32)
IRMD(video, VFAA0, 32)
IRMD(video, VFBA0, 32)
IRMD(video, VFCR1, 32)
IRMD(video, VFAA1, 32)
IRMD(video, VFBA1, 32)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
#ifdef Mpc8xx_lcd
static void
irmd_lcd (MPC8XX_IMM *imm, char *reg, int regread, uint32 value)
{
IRMD(lcd, LCCR, 32)
IRMD(lcd, LCHCR, 32)
IRMD(lcd, LCVCR, 32)
IRMD(lcd, LCFAA, 32)
IRMD(lcd, LCFBA, 32)
IRMD(lcd, LCSR, 8)
if (!display_all)
printf(INVREG,reg);
}
#endif
/*********************************************************************/
static const struct module_t
{
char *module;
void (*func)(MPC8XX_IMM *, char *, int, uint32);
} MODULE[] =
{
#ifdef Mpc8xx_brgs
{"BRGS", irmd_brgs},
#endif
#ifdef Mpc8xx_clock
{"CLOCK", irmd_clock},
#endif
#ifdef Mpc8xx_clockey
{"CLOCKEY", irmd_clockey},
#endif
#ifdef Mpc8xx_cp
{"CP", irmd_cp},
#endif
#ifdef Mpc8xx_cpic
{"CPIC", irmd_cpic},
#endif
#ifdef Mpc8xx_cpmtimer
{"CPMTIMER", irmd_cpmtimer},
#endif
#ifdef Mpc8xx_dma
{"DMA", irmd_dma},
#endif
#ifdef Mpc8xx_i2c
{"I2C", irmd_i2c},
#endif
#ifdef Mpc8xx_lcd
{"LCD", irmd_lcd},
#endif
#ifdef Mpc8xx_memc
{"MEMC", irmd_memc},
#endif
#ifdef Mpc8xx_pcmcia
{"PCMCIA", irmd_pcmcia},
#endif
#ifdef Mpc8xx_pip
{"PIP", irmd_pip},
#endif
#ifdef Mpc8xx_portio
{"PORTIO", irmd_portio},
#endif
#ifdef Mpc8xx_scc1
{"SCC1", irmd_scc1},
#endif
#ifdef Mpc8xx_scc2
{"SCC2", irmd_scc2},
#endif
#ifdef Mpc8xx_scc3
{"SCC3", irmd_scc3},
#endif
#ifdef Mpc8xx_scc4
{"SCC4", irmd_scc4},
#endif
#ifdef Mpc8xx_si
{"SI", irmd_si},
#endif
#ifdef Mpc8xx_sit
{"SIT", irmd_sit},
#endif
#ifdef Mpc8xx_sitkey
{"SITKEY", irmd_sitkey},
#endif
#ifdef Mpc8xx_siu
{"SIU", irmd_siu},
#endif
#ifdef Mpc8xx_smc1
{"SMC1", irmd_smc1},
#endif
#ifdef Mpc8xx_smc2
{"SMC2", irmd_smc2},
#endif
#ifdef Mpc8xx_spi
{"SPI", irmd_spi},
#endif
#ifdef Mpc8xx_usb
{"USB", irmd_usb},
#endif
#ifdef Mpc8xx_video
{"VIDEO", irmd_video},
#endif
} ;
#define MODULE_SIZE (int)(sizeof(MODULE)/sizeof(struct module_t))
#if 0
/*************************************************/
void
mpc8xx_ird (int argc, char **argv)
{
/*
* Display Internal Memory Module contents.
*/
MPC8XX_IMM *imm = mpc8xx_get_immp();
char *rstr;
char mstr[20];
int mi;
(void)argc;
display_all = FALSE;
displayed = 0;
if (argv[1] == NULL)
{
printf("Internal Memory at %#08X", imm);
for (mi = 0; mi < MODULE_SIZE; ++mi)
{
if ((mi % 8) == 0)
{
printf("\nModules: ");
}
printf("%s ",MODULE[mi].module);
}
printf("\n");
return;
};
/*
* Pick out module name and Point to register name
*/
mi = 0;
rstr = argv[1];
while (*rstr != '.')
{
mstr[mi++] = *rstr;
if (*++rstr == '\0')
{
rstr = NULL;
break;
}
}
mstr[mi] = '\0';
if (*rstr == '.')
++rstr;
/*
* Display the module contents
*/
for (mi = 0; mi < MODULE_SIZE; ++mi)
{
if (strcasecmp(MODULE[mi].module,mstr) == 0)
{
if (rstr == NULL)
{
display_all = TRUE;
printf("Module: %s\n",MODULE[mi].module);
}
MODULE[mi].func(imm, rstr, REGREAD, 0);
return;
}
}
printf(INVMOD,argv[1]);
}
#endif
/*********************************************************************/
void
mpc8xx_irm (int argc, char **argv)
{
MPC8XX_IMM *imm = mpc8xx_get_immp();
uint32 value;
char *rstr;
char mstr[20];
int mi, success;
display_all = FALSE;
displayed = 0;
if (argc == 1)
{
printf("Internal Memory at %#08X", imm);
for (mi = 0; mi < MODULE_SIZE; ++mi)
{
if ((mi % 8) == 0)
{
printf("\nModules: ");
}
printf("%s ",MODULE[mi].module);
}
printf("\n");
return;
};
/*
* Pick out module name and Point to register name
*/
mi = 0;
rstr = argv[1];
while (*rstr != '.')
{
mstr[mi++] = *rstr;
if (*++rstr == '\0')
{
rstr = NULL;
break;
}
}
mstr[mi] = '\0';
if (rstr != NULL)
{
if (*rstr == '.')
++rstr;
}
/*
* Get the new value
*/
if (argc == 3)
{
if (rstr == NULL)
{
printf("Error: Invalid Register: %s\n",argv[1]);
return;
}
value = get_value(argv[2],&success,16);
if (success == 0)
{
printf(INVALUE,argv[2]);
return;
}
}
else
value = 0;
/*
* Determine which module
*/
for (mi = 0; mi < MODULE_SIZE; ++mi)
{
if (strcasecmp(MODULE[mi].module,mstr) == 0)
{
if (argc == 3) /* modify operation */
{
MODULE[mi].func(imm, rstr, REGWRITE, value);
}
else
{
/* display operation */
if (rstr == NULL)
{
display_all = TRUE;
printf("Module: %s\n",MODULE[mi].module);
}
MODULE[mi].func(imm, rstr, REGREAD, 0);
}
return;
}
}
printf(INVMOD,argv[1]);
}
/*********************************************************************/
void
mpc8xx_call (int argc, char **argv)
{
/*
* This routine calls a subroutine from the command line
* and returns control to dBUG upon return.
*/
uint32 param;
int index, success;
param = get_value(argv[1],&success,BASE);
if (success == 0)
{
printf(INVALUE,argv[1]);
return;
}
CPU_REG_SRR0 = param;
CPU_REG_LR = (uint32)&asm_return_from_call;
for (index = 2; index < argc; ++index)
{
param = get_value(argv[index],&success,BASE);
if (success == 0)
{
printf(INVALUE,argv[index]);
return;
}
switch (index)
{
case 2:
CPU_REG_R3 = param;
break;
case 3:
CPU_REG_R4 = param;
break;
case 4:
CPU_REG_R5 = param;
break;
case 5:
CPU_REG_R6 = param;
break;
case 6:
CPU_REG_R7 = param;
break;
case 7:
CPU_REG_R8 = param;
break;
case 8:
CPU_REG_R9 = param;
break;
case 9:
CPU_REG_R10 = param;
break;
case 10:
CPU_REG_R11 = param;
break;
default:
break;
}
}
cpu_switch_context(FALSE);
}
/*********************************************************************/
void
mpc8xx_rsr_display (void)
{
MPC8XX_IMM *imm = mpc8xx_get_immp();
uint32 rsr;
rsr = imm->clock.RSR;
if (rsr & (MPC8XX_CLOCK_RSR_EHRS | MPC8XX_CLOCK_RSR_ESRS))
{
printf("Power-on Reset ");
rsr &= ~(MPC8XX_CLOCK_RSR_EHRS | MPC8XX_CLOCK_RSR_ESRS);
}
if (rsr & MPC8XX_CLOCK_RSR_EHRS)
printf("Hard ");
if (rsr & MPC8XX_CLOCK_RSR_ESRS)
printf("Soft ");
if (rsr & MPC8XX_CLOCK_RSR_LLRS)
printf("Loss of Lock ");
if (rsr & MPC8XX_CLOCK_RSR_SWRS)
printf("Software Watchdog ");
if (rsr & MPC8XX_CLOCK_RSR_SCRS)
printf("Check Stop ");
if (rsr & MPC8XX_CLOCK_RSR_DBSRS)
printf("Debug Hard ");
if (rsr & MPC8XX_CLOCK_RSR_JTRS)
printf("Debug Soft ");
printf("\n");
}
/*********************************************************************/
char *
cpu_get_spr_name (int spr)
{
int index;
if ((index = find_spr(spr)) != -1)
{
return registers[index].reg_name;
}
return NULL;
}
/*********************************************************************/
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -