mirror of
https://github.com/mist-devel/mist-firmware.git
synced 2026-04-30 21:59:28 +00:00
minimig: Improve stability of core startup when loading a new configuration
This commit is contained in:
82
config.c
82
config.c
@@ -34,6 +34,35 @@ RAFile romfile;
|
||||
"mov r0, r0\n\t" \
|
||||
"mov r0, r0")
|
||||
|
||||
void ClearKickstartMirrorE0(void)
|
||||
{
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, 0x00e00000);
|
||||
for (int i = 0; i < (0x80000 / 4); i++) {
|
||||
SPI(0x00);
|
||||
SPI(0x00);
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
SPI(0x00);
|
||||
SPI(0x00);
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
|
||||
void ClearVectorTable(void)
|
||||
{
|
||||
spi_osd_cmd32le_cont(OSD_CMD_WR, 0x00000000);
|
||||
for (int i = 0; i < 256; i++) {
|
||||
SPI(0x00);
|
||||
SPI(0x00);
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
SPI(0x00);
|
||||
SPI(0x00);
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
|
||||
//// UploadKickstart() ////
|
||||
char UploadKickstart(char *name)
|
||||
@@ -68,6 +97,7 @@ char UploadKickstart(char *name)
|
||||
BootPrint("Uploading 1MB Kickstart ...");
|
||||
SendFileV2(&romfile, NULL, 0, 0xe00000, romfile.size>>10);
|
||||
SendFileV2(&romfile, NULL, 0, 0xf80000, romfile.size>>10);
|
||||
ClearVectorTable();
|
||||
return(1);
|
||||
} else if(romfile.size == 0x80000) {
|
||||
// 512KB Kickstart ROM
|
||||
@@ -79,6 +109,7 @@ char UploadKickstart(char *name)
|
||||
SendFileV2(&romfile, NULL, 0, 0xf80000, romfile.size>>9);
|
||||
RAOpen(&romfile, filename);
|
||||
SendFileV2(&romfile, NULL, 0, 0xe00000, romfile.size>>9);
|
||||
ClearVectorTable();
|
||||
}
|
||||
return(1);
|
||||
} else if ((romfile.size == 0x8000b) && keysize) {
|
||||
@@ -91,6 +122,7 @@ char UploadKickstart(char *name)
|
||||
SendFileV2(&romfile, romkey, keysize, 0xf80000, romfile.size>>9);
|
||||
RAOpen(&romfile, filename);
|
||||
SendFileV2(&romfile, romkey, keysize, 0xe00000, romfile.size>>9);
|
||||
ClearVectorTable();
|
||||
}
|
||||
return(1);
|
||||
} else if (romfile.size == 0x40000) {
|
||||
@@ -101,8 +133,10 @@ char UploadKickstart(char *name)
|
||||
SendFile(&romfile);
|
||||
} else {
|
||||
SendFileV2(&romfile, NULL, 0, 0xf80000, romfile.size>>9);
|
||||
RAOpen(&romfile, filename); // TODO will this work
|
||||
RAOpen(&romfile, filename);
|
||||
SendFileV2(&romfile, NULL, 0, 0xfc0000, romfile.size>>9);
|
||||
ClearVectorTable();
|
||||
ClearKickstartMirrorE0();
|
||||
}
|
||||
return(1);
|
||||
} else if ((romfile.size == 0x4000b) && keysize) {
|
||||
@@ -113,8 +147,10 @@ char UploadKickstart(char *name)
|
||||
SendFileEncrypted(&romfile,romkey,keysize);
|
||||
} else {
|
||||
SendFileV2(&romfile, romkey, keysize, 0xf80000, romfile.size>>9);
|
||||
RAOpen(&romfile, filename); // TODO will this work
|
||||
RAOpen(&romfile, filename);
|
||||
SendFileV2(&romfile, romkey, keysize, 0xfc0000, romfile.size>>9);
|
||||
ClearVectorTable();
|
||||
ClearKickstartMirrorE0();
|
||||
}
|
||||
return(1);
|
||||
} else {
|
||||
@@ -504,8 +540,6 @@ void ApplyConfiguration(char reloadkickstart)
|
||||
ConfigFloppy(config.floppy.drives, config.floppy.speed);
|
||||
|
||||
if(reloadkickstart) {
|
||||
UploadActionReplay();
|
||||
|
||||
iprintf("Reloading kickstart ...\r");
|
||||
TIMER_wait(1000);
|
||||
EnableOsd();
|
||||
@@ -514,39 +548,27 @@ void ApplyConfiguration(char reloadkickstart)
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
UploadActionReplay();
|
||||
if (!UploadKickstart(config.kickstart.name)) {
|
||||
strcpy(config.kickstart.name, "KICK ");
|
||||
if (!UploadKickstart(config.kickstart.name)) {
|
||||
FatalError(6);
|
||||
}
|
||||
}
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval |= (SPI_RST_USR | SPI_RST_CPU);
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval = 0;
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
} else {
|
||||
iprintf("Resetting ...\r");
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval |= (SPI_RST_USR | SPI_RST_CPU);
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval = 0;
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
iprintf("Resetting ...\r");
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval |= (SPI_RST_USR | SPI_RST_CPU);
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
EnableOsd();
|
||||
SPI(OSD_CMD_RST);
|
||||
rstval = 0;
|
||||
SPI(rstval);
|
||||
DisableOsd();
|
||||
SPIN(); SPIN(); SPIN(); SPIN();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user