# Reset (Overview)

## Introduction

A Reset System is included in the NitroSDK. This system loads the ROM data from the Game Card into main memory and moves the Program Counter register to the appropriate address so the program always starts at the beginning.

The `OS_InitReset()` function must be called before you can use this Reset System. However, this function is called internally by `OS_Init()`, there is no need to call `OS_InitReset()` if you've already called `OS_Init()`.

Only the ARM9 can issue a reset command, which will in turn call `OS_ResetSystem()`. The ARM7 continues to operate normally until the reset instruction comes from the ARM9. When this reset instruction comes via PXI (communicated as a PXI interrupt), the ARM7 performs the reset process.

### Internal Operations of the Reset Process

This section explains the operations of the two processors after the `OS_ResetSystem()` function is called.

The ARM9 waits for the card bus to unlock and immediately locks it. Next, all DMA tasks are ended. Then PXI-reception interrupts (and only these interrupts) are enabled in order to receive communications from the ARM7. Finally, a reset notification is posted to the ARM7.

On the ARM7 side, when the reset notification comes from the ARM9, all DMA tasks are ended and PXI-reception interrupts (and only these interrupts) are enabled in order to receive communications from the ARM9. Also, the stop command is communicated to the Sound library.

In the explanations of these subsequent steps, all operations take place in ITCM on the ARM9, and in WRAM on the ARM7.

All interrupts are prohibited in both the ARM7 and the ARM9.
The ARM9 then reads ROM data from the Game Card in accordance with the ROM header information stored in the shared area of main memory.

Once synchronized after the data have been read, the ARM7 and the ARM9 both act to clear memory and registers.

The starting address is set in the Program Counter (PC) according to the ROM header information.

### The Reset Parameters

The Reset System has a `u32` value, called the Reset Parameter, which can be used to determine if the current program is running because the power has been turned on or because the program was restarted.

This Reset Parameter is obtained by `OS_GetResetParameter()`. The value of the Reset Parameter is `0` after the power is turned on, but once the `OS_ResetSystem()` function is called, it takes the value of the function's argument. If resets are performed multiple times, the Reset Parameter holds the value of the argument from the most recent call of `OS_ResetSystem()`.

The Reset Parameter is stored in a part of the shared region of main memory. Since this part is not cleared during the reset process, the value of the Reset Parameter can be passed to programs after the process.

## See Also

`OS Function List (Reset)`

## Revision History

11/02/2004 Initial version