Updates to tzreset and reset mechanism

This commit is contained in:
Philip Smart
2020-11-10 22:40:33 +00:00
parent 6bf804771b
commit 83866fced3
10 changed files with 32 additions and 23 deletions

View File

@@ -87,6 +87,7 @@ void usage(void)
printf(" -h | --help This help text.\n");
printf(" -r | --reset Perform a hardware reset.\n");
printf(" -l | --load Reload the default ROMS.\n");
printf(" -m | --memorymode <val> Set the startup memory mode.\n");
printf("\nOptions:-\n");
printf(" -v | --verbose Output more messages.\n");
@@ -111,6 +112,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
int verbose_flag = 0;
int opt;
int option_index = 0;
uint8_t memoryMode = TZMM_ORIG;
long val = 0;
char *argv[20];
char *ptr = strtok((char *)param1, " ");
@@ -137,6 +139,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
{
{"help", no_argument, 0, 'h'},
{"load", no_argument, 0, 'l'},
{"memorymode", required_argument, 0, 'm'},
{"reset", no_argument, 0, 'r'},
{"verbose", no_argument, 0, 'v'},
{0, 0, 0, 0}
@@ -144,7 +147,7 @@ uint32_t app(uint32_t param1, uint32_t param2)
// Parse the command line options.
//
while((opt = getopt_long(argc, argv, ":hlrv", long_options, &option_index)) != -1)
while((opt = getopt_long(argc, argv, ":hlm:rv", long_options, &option_index)) != -1)
{
switch(opt)
{
@@ -156,6 +159,15 @@ uint32_t app(uint32_t param1, uint32_t param2)
load_flag = 1;
break;
case 'm':
if(xatoi(&argv[optind-1], &val) == 0 || val >= 0x20)
{
printf("Illegal numeric:%s\n", argv[optind-1]);
return(1);
}
memoryMode = (uint8_t)val;
break;
case 'r':
reset_flag = 1;
break;
@@ -180,17 +192,16 @@ uint32_t app(uint32_t param1, uint32_t param2)
return(0);
}
// Initialise the IO.
//setupZ80Pins(1, G->millis);
// Call the reset method to do the hard work.
// Reload the memory on the tranZPUter to boot default if load flag set.
//
resetZ80();
// Reload the memory on the tranZPUter to boot default.
if(load_flag)
{
loadTranZPUterDefaultROMS();
} else
{
// Call the reset method to do the hard work.
//
resetZ80(memoryMode);
}
return(0);

View File

@@ -532,7 +532,7 @@ void setupZ80Pins(uint8_t initK64F, volatile uint32_t *millisecondTick)
// Method to reset the Z80 CPU.
//
void resetZ80(void)
void resetZ80(uint8_t memoryMode)
{
// Locals.
//
@@ -548,6 +548,13 @@ void resetZ80(void)
pinInput(Z80_RESET);
__enable_irq();
// Set the memory mode to the one provided.
//
if(memoryMode != TZMM_ORIG)
{
setCtrlLatch(memoryMode);
}
// Wait a futher settling period before reinstating the interrupt.
//
while((*ms - startTime) < 400);
@@ -2083,14 +2090,11 @@ void loadTranZPUterDefaultROMS(void)
//
if(!result)
{
// Set the memory model to BOOT so we can bootstrap TZFS.
setCtrlLatch(TZMM_BOOT);
// If autoboot flag set, force a restart to the ROM which will call User ROM startup code.
if(osControl.tzAutoBoot)
{
delay(100);
fillZ80Memory(MZ_MROM_STACK_ADDR, MZ_MROM_STACK_SIZE, 0x00, 1);
// Set the memory model to BOOT so we can bootstrap TZFS.
resetZ80(TZMM_BOOT);
}
// No longer need refresh on the mainboard as all operations are in static RAM.
@@ -3722,7 +3726,7 @@ void processServiceRequest(void)
z80Control.disableRefresh = 0;
// Now reset the machine so everything starts as power on.
resetZ80();
resetZ80(TZMM_ORIG);
// Disable the interrupts so no further service processing.
disableIRQ();
@@ -3855,9 +3859,6 @@ void setupTranZPUter(void)
// Check to see if autoboot is needed.
osControl.tzAutoBoot = testTZFSAutoBoot();
// Ensure the machine is ready by performing a RESET.
resetZ80();
}
//////////////////////////////////////////////////////////////

View File

@@ -41,7 +41,7 @@
#define RFSH_BYTE_CNT 256 // Number of bytes we can write before needing a full refresh for the DRAM.
#define HOST_MON_TEST_VECTOR 0x4 // Address in the host monitor to test to identify host type.
#define DEFAULT_BUSREQ_TIMEOUT 5000 // Timeout for a Z80 Bus request operation in milliseconds.
#define DEFAULT_RESET_PULSE_WIDTH 1000 // Pulse width of a reset signal in |K4F clock ticks.
#define DEFAULT_RESET_PULSE_WIDTH 80000 // Pulse width of a reset signal in K64F clock ticks.
// tranZPUter Memory Modes - select one of the 32 possible memory models using these constants.
//
@@ -642,7 +642,7 @@ extern uint8_t pinMap[MAX_TRANZPUTER_PINS];
void yield(void);
#endif
void setupZ80Pins(uint8_t, volatile uint32_t *);
void resetZ80(void);
void resetZ80(uint8_t);
uint8_t reqZ80Bus(uint32_t);
uint8_t reqMainboardBus(uint32_t);
uint8_t reqTranZPUterBus(uint32_t);

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -253,9 +253,6 @@ void tranZPUterControl(void)
//
if(isZ80Reset())
{
// Reset Z80 - This is to extend the reset signal to allow all the CPLD's/FPGA's to sync.
resetZ80();
// Reload the memory on the tranZPUter to boot default.
loadTranZPUterDefaultROMS();