Disable interrupts before jumping to scratch ROM
This commit is contained in:
parent
c50632c1bf
commit
81084066df
@ -46,16 +46,10 @@ void scratch_trampoline(void) {
|
|||||||
// Uses SCAR0, 1, 2, 3, and 4 which are mapped at 0x0000 in data space and are
|
// Uses SCAR0, 1, 2, 3, and 4 which are mapped at 0x0000 in data space and are
|
||||||
// 4096 bytes in size.
|
// 4096 bytes in size.
|
||||||
|
|
||||||
//TODO: ensure pdata is not used!
|
// Disable interrupts
|
||||||
|
EA = 0;
|
||||||
|
|
||||||
if ((SCAR0H == 0x00) || (SCAR1H == 0x00) || (SCAR2H == 0x00) || (SCAR3H == 0x00) || (SCAR4H == 0x00)) {
|
// Ensure pdata is not used!
|
||||||
// Disable scratch RAM mapping
|
|
||||||
SCAR0H = 0b11;
|
|
||||||
SCAR1H = 0b11;
|
|
||||||
SCAR2H = 0b11;
|
|
||||||
SCAR3H = 0b11;
|
|
||||||
SCAR4H = 0b11;
|
|
||||||
} else {
|
|
||||||
int __data i;
|
int __data i;
|
||||||
// Copy scratch ROM
|
// Copy scratch ROM
|
||||||
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
||||||
@ -87,7 +81,6 @@ void scratch_trampoline(void) {
|
|||||||
SCAR4L = 0x00;
|
SCAR4L = 0x00;
|
||||||
SCAR4M = 0x0F;
|
SCAR4M = 0x0F;
|
||||||
SCAR4H = 0x00;
|
SCAR4H = 0x00;
|
||||||
}
|
|
||||||
|
|
||||||
// Jump to reset function
|
// Jump to reset function
|
||||||
__asm__("ljmp 0");
|
__asm__("ljmp 0");
|
||||||
|
@ -46,16 +46,10 @@ void scratch_trampoline(void) {
|
|||||||
// Uses SCAR0, 1, 2, 3, and 4 which are mapped at 0x0000 in data space and are
|
// Uses SCAR0, 1, 2, 3, and 4 which are mapped at 0x0000 in data space and are
|
||||||
// 4096 bytes in size.
|
// 4096 bytes in size.
|
||||||
|
|
||||||
//TODO: ensure pdata is not used!
|
// Disable interrupts
|
||||||
|
EA = 0;
|
||||||
|
|
||||||
if ((SCAR0H == 0x00) || (SCAR1H == 0x00) || (SCAR2H == 0x00) || (SCAR3H == 0x00) || (SCAR4H == 0x00)) {
|
// Ensure pdata is not used!
|
||||||
// Disable scratch RAM mapping
|
|
||||||
SCAR0H = 0b11;
|
|
||||||
SCAR1H = 0b11;
|
|
||||||
SCAR2H = 0b11;
|
|
||||||
SCAR3H = 0b11;
|
|
||||||
SCAR4H = 0b11;
|
|
||||||
} else {
|
|
||||||
int __data i;
|
int __data i;
|
||||||
// Copy scratch ROM
|
// Copy scratch ROM
|
||||||
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
||||||
@ -87,7 +81,6 @@ void scratch_trampoline(void) {
|
|||||||
SCAR4L = 0x00;
|
SCAR4L = 0x00;
|
||||||
SCAR4M = 0x0F;
|
SCAR4M = 0x0F;
|
||||||
SCAR4H = 0x00;
|
SCAR4H = 0x00;
|
||||||
}
|
|
||||||
|
|
||||||
// Jump to reset function
|
// Jump to reset function
|
||||||
__asm__("ljmp 0");
|
__asm__("ljmp 0");
|
||||||
|
@ -30,12 +30,10 @@ void scratch_trampoline(void) {
|
|||||||
// Uses SCAR0 which is mapped at 0x0000 in data space and are
|
// Uses SCAR0 which is mapped at 0x0000 in data space and are
|
||||||
// 4096 bytes in size.
|
// 4096 bytes in size.
|
||||||
|
|
||||||
//TODO: ensure pdata is not used!
|
// Disable interrupts
|
||||||
|
EA = 0;
|
||||||
|
|
||||||
if (SCAR0H == 0x00) {
|
// Ensure pdata is not used!
|
||||||
// Disable scratch RAM mapping
|
|
||||||
SCAR0H = 0b11;
|
|
||||||
} else {
|
|
||||||
int __data i;
|
int __data i;
|
||||||
// Copy scratch ROM
|
// Copy scratch ROM
|
||||||
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
for (i = 0; i < ARRAY_SIZE(scratch_rom) && i < ARRAY_SIZE(scratch_ram); i++) {
|
||||||
@ -51,7 +49,6 @@ void scratch_trampoline(void) {
|
|||||||
SCAR0L = 0x00;
|
SCAR0L = 0x00;
|
||||||
SCAR0M = 0x00;
|
SCAR0M = 0x00;
|
||||||
SCAR0H = 0x00;
|
SCAR0H = 0x00;
|
||||||
}
|
|
||||||
|
|
||||||
// Jump to reset function
|
// Jump to reset function
|
||||||
__asm__("ljmp 0");
|
__asm__("ljmp 0");
|
||||||
|
Loading…
x
Reference in New Issue
Block a user