Table of Contents Previous topic Next topic
Virtual Workshop Interface->General Purpose Interface Calls->IncMachineCycles()
extern "C" LONG IncMachineCycles(LONG nExtensionState, LONG nCycles, LONG nStatusRegister)
The primary purpose of this call is to pass the machine cycle increment to the extension.
The extension should increment it's own count of the microcontrollers execution cycles by the value nCycles. It should also increment anything else associated with the execution cycle count such as a watchdog timer or a peripheral that is linked to the cycle count.
The ARM simulator takes advantage of this regular call by passing the CPU status register value in nStatusRegister. The extension can use this to determine what interrupts are enabled, what mode the CPU is in, etc.
The ARM simulator also receives a return value. Extensions should return zero unless they want to trigger a CPU interrupt. To trigger a FIQ interrupt the extension should set bit 7 of the return value. To trigger an IRQ interrupt the extension should set bit 6 of the return value.
Note that this call differs from the 8051 Virtual Workshop Interface for which the nStatusRegister parameter is absent and there is no return value.