cflash: add firmware version check

This commit is contained in:
Matt Harlum 2023-04-18 07:51:38 +00:00 committed by Matt Harlum
parent f8e2f3787c
commit a3d3809753
2 changed files with 15 additions and 0 deletions

Binary file not shown.

View File

@ -38,6 +38,8 @@
#define IDE_PROD_ID 6
#define IDE_ROM_OFFSET 0x0
#define CFLASH_VER 0
struct Library *DosBase;
struct ExecBase *SysBase;
struct ExpansionBase *ExpansionBase = NULL;
@ -50,6 +52,7 @@ int main(int argc, char *argv[])
{
SysBase = *((struct ExecBase **)4UL);
DosBase = OpenLibrary("dos.library",0);
ULONG hw_ver;
int rc = 0;
@ -67,6 +70,18 @@ int main(int argc, char *argv[])
if ((cd = (struct ConfigDev*)FindConfigDev(NULL,MANUF_ID,PROD_ID))) {
hw_ver = cd->cd_Rom.er_SerialNumber;
if (hw_ver > CFLASH_VER) {
printf("A newer version of cflash is needed for this CIDER firmware version.\n");
rc = 0;
goto exit;
} else if (hw_ver < CFLASH_VER) {
printf("The CIDER firmware must be upgraded to be compatible with this version of cflash\n");
rc = 5;
goto exit;
}
controlRegister = cd->cd_BoardAddr;