mirror of
https://github.com/hoglet67/AtomBusMon.git
synced 2024-12-22 16:30:06 +00:00
Firmware: remove superfluous delays
Change-Id: I5c8c5ba9ea87458c05a229973672503bd1aa6100
This commit is contained in:
parent
86b8e219eb
commit
dd8116b364
@ -456,7 +456,7 @@ void hwCmd(unsigned int cmd, unsigned int param) {
|
|||||||
unsigned int hwRead8(unsigned int offset) {
|
unsigned int hwRead8(unsigned int offset) {
|
||||||
MUXSEL_PORT &= ~MUXSEL_MASK;
|
MUXSEL_PORT &= ~MUXSEL_MASK;
|
||||||
MUXSEL_PORT |= offset << MUXSEL_BIT;
|
MUXSEL_PORT |= offset << MUXSEL_BIT;
|
||||||
Delay_us(1);
|
Delay_us(1); // fixed 1us delay is needed here
|
||||||
return MUX_DIN;
|
return MUX_DIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -465,10 +465,10 @@ unsigned int hwRead16(unsigned int offset) {
|
|||||||
unsigned int lsb;
|
unsigned int lsb;
|
||||||
MUXSEL_PORT &= ~MUXSEL_MASK;
|
MUXSEL_PORT &= ~MUXSEL_MASK;
|
||||||
MUXSEL_PORT |= offset << MUXSEL_BIT;
|
MUXSEL_PORT |= offset << MUXSEL_BIT;
|
||||||
Delay_us(1);
|
Delay_us(1); // fixed 1us delay is needed here
|
||||||
lsb = MUX_DIN;
|
lsb = MUX_DIN;
|
||||||
MUXSEL_PORT |= 1 << MUXSEL_BIT;
|
MUXSEL_PORT |= 1 << MUXSEL_BIT;
|
||||||
Delay_us(1);
|
Delay_us(1); // fixed 1us delay is needed here
|
||||||
return (MUX_DIN << 8) | lsb;
|
return (MUX_DIN << 8) | lsb;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -522,13 +522,11 @@ void loadAddr(unsigned int addr) {
|
|||||||
|
|
||||||
unsigned int readMemByte() {
|
unsigned int readMemByte() {
|
||||||
hwCmd(CMD_RD_MEM, 0);
|
hwCmd(CMD_RD_MEM, 0);
|
||||||
Delay_us(10);
|
|
||||||
return hwRead8(OFFSET_DATA);
|
return hwRead8(OFFSET_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int readMemByteInc() {
|
unsigned int readMemByteInc() {
|
||||||
hwCmd(CMD_RD_MEM_INC, 0);
|
hwCmd(CMD_RD_MEM_INC, 0);
|
||||||
Delay_us(10);
|
|
||||||
return hwRead8(OFFSET_DATA);
|
return hwRead8(OFFSET_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -542,13 +540,11 @@ void writeMemByteInc() {
|
|||||||
|
|
||||||
unsigned int readIOByte() {
|
unsigned int readIOByte() {
|
||||||
hwCmd(CMD_RD_IO, 0);
|
hwCmd(CMD_RD_IO, 0);
|
||||||
Delay_us(10);
|
|
||||||
return hwRead8(OFFSET_DATA);
|
return hwRead8(OFFSET_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
unsigned int readIOByteInc() {
|
unsigned int readIOByteInc() {
|
||||||
hwCmd(CMD_RD_IO_INC, 0);
|
hwCmd(CMD_RD_IO_INC, 0);
|
||||||
Delay_us(10);
|
|
||||||
return hwRead8(OFFSET_DATA);
|
return hwRead8(OFFSET_DATA);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -932,7 +928,6 @@ int pollForEvents() {
|
|||||||
if (STATUS_DIN & BW_ACTIVE_MASK) {
|
if (STATUS_DIN & BW_ACTIVE_MASK) {
|
||||||
cont = logDetails();
|
cont = logDetails();
|
||||||
hwCmd(CMD_WATCH_READ, 0);
|
hwCmd(CMD_WATCH_READ, 0);
|
||||||
Delay_us(10);
|
|
||||||
}
|
}
|
||||||
if (Serial_ByteRecieved0()) {
|
if (Serial_ByteRecieved0()) {
|
||||||
// Interrupt on a return, ignore other characters
|
// Interrupt on a return, ignore other characters
|
||||||
@ -943,6 +938,15 @@ int pollForEvents() {
|
|||||||
return cont;
|
return cont;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Applies a fixed 1ms long reset pulse to the CPU
|
||||||
|
// This should be good for clock rates down to ~10KHz
|
||||||
|
void resetCpu() {
|
||||||
|
log0("Resetting CPU\n");
|
||||||
|
hwCmd(CMD_RESET, 1);
|
||||||
|
Delay_us(1000);
|
||||||
|
hwCmd(CMD_RESET, 0);
|
||||||
|
}
|
||||||
|
|
||||||
/*******************************************
|
/*******************************************
|
||||||
* User Commands
|
* User Commands
|
||||||
*******************************************/
|
*******************************************/
|
||||||
@ -978,7 +982,6 @@ void doCmdStep(char *params) {
|
|||||||
i = instructions;
|
i = instructions;
|
||||||
}
|
}
|
||||||
if (i == instructions || (trace && (--j == 0))) {
|
if (i == instructions || (trace && (--j == 0))) {
|
||||||
Delay_us(10);
|
|
||||||
logAddr();
|
logAddr();
|
||||||
j = trace;
|
j = trace;
|
||||||
}
|
}
|
||||||
@ -986,24 +989,7 @@ void doCmdStep(char *params) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void doCmdReset(char *params) {
|
void doCmdReset(char *params) {
|
||||||
log0("Resetting CPU\n");
|
resetCpu();
|
||||||
#if defined(CPU_6502) || defined(CPU_65C02)
|
|
||||||
// For the 6502 cores, to get the single stepping to stop correctly
|
|
||||||
// on the first instruction after reset, it helps to assert reset twice.
|
|
||||||
// I haven't looked into why this is, as it doesn't seem very important.
|
|
||||||
// It's mostly cosmetic, but nice on the Atom to consisently show FF3F.
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < 2; i++) {
|
|
||||||
#endif
|
|
||||||
hwCmd(CMD_RESET, 1);
|
|
||||||
Delay_us(50);
|
|
||||||
hwCmd(CMD_STEP, 0);
|
|
||||||
Delay_us(50);
|
|
||||||
hwCmd(CMD_RESET, 0);
|
|
||||||
Delay_us(50);
|
|
||||||
#if defined(CPU_6502) || defined(CPU_65C02)
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
logAddr();
|
logAddr();
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1347,10 +1333,7 @@ void doCmdContinue(char *params) {
|
|||||||
|
|
||||||
// Reset if required
|
// Reset if required
|
||||||
if (reset) {
|
if (reset) {
|
||||||
log0("Resetting CPU\n");
|
resetCpu();
|
||||||
hwCmd(CMD_RESET, 1);
|
|
||||||
Delay_us(100);
|
|
||||||
hwCmd(CMD_RESET, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Wait for breakpoint to become active
|
// Wait for breakpoint to become active
|
||||||
|
Loading…
Reference in New Issue
Block a user