avoid FireTOS hang on boot

This commit is contained in:
Markus Fröschle
2016-01-30 16:00:02 +00:00
parent 640126b42e
commit 7d59124531
9 changed files with 61 additions and 19 deletions

View File

@@ -423,16 +423,17 @@ void BaS(void)
xprintf("finished\r\n");
xprintf("enable video: ");
/*
* video setup (25MHz)
*/
* (volatile uint32_t *) (0xf0000410 + 0) = 0x032002ba; /* horizontal 640x480 */
* (volatile uint32_t *) (0xf0000410 + 4) = 0x020c020a; /* vertical 640x480 */
* (volatile uint32_t *) (0xf0000410 + 8) = 0x0190015d; /* horizontal 320x240 */
* (volatile uint32_t *) (0xf0000410 + 12) = 0x020C020A; /* vertical 320x230 */
* (volatile uint32_t *) 0xf0000410 = 0x032002ba; /* horizontal 640x480 */
* (volatile uint32_t *) 0xf0000414 = 0x020c020a; /* vertical 640x480 */
* (volatile uint32_t *) 0xf0000418 = 0x0190015d; /* horizontal 320x240 */
* (volatile uint32_t *) 0xf000041c = 0x020c020a; /* vertical 320x230 */
/* fifo on, refresh on, ddrcs and cke on, video dac on */
* (volatile uint32_t *) (0xf0000410 - 0x20) = 0x01070002;
* (volatile uint32_t *) 0xf0000400 = 0x01070082;
xprintf("finished\r\n");
#endif /* MACHINE_FIREBEE */
@@ -442,7 +443,7 @@ void BaS(void)
/*
* memory setup
*/
memset((void *) 0x400, 0, 0x400);
memset((void *) 0x200, 0, 0x400);
#if defined(MACHINE_FIREBEE)
/* set Falcon bus control register */
@@ -483,6 +484,7 @@ void BaS(void)
enable_coldfire_interrupts();
MCF_INTC_IMRH = 0;
MCF_INTC_IMRL = 0;
dma_irq_enable();
fec_irq_enable(0, 5, 1);
@@ -495,6 +497,37 @@ void BaS(void)
set_ipl(7); /* disable interrupts */
/*
* start FireTOS if DIP switch is set accordingly
*/
if (!(DIP_SWITCH & (1 << 6)))
{
extern uint8_t _FIRETOS[];
#define FIRETOS ((uint32_t)_FIRETOS) /* where FireTOS is stored in flash */
/* make sure MMU is disabled */
MCF_MMU_MMUCR = 0; /* MMU off */
NOP(); /* force pipeline sync */
/* ST RAM */
* (uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
* (uint32_t *) 0x420 = 0x752019f3; /* memvalid TOS system variable */
* (uint32_t *) 0x43a = 0x237698aa; /* memval2 TOS system variable */
* (uint32_t *) 0x51a = 0x5555aaaa; /* memval3 TOS system variable */
/* TT-RAM */
* (uint32_t *) 0x5a4 = FASTRAM_END; /* ramtop TOS system variable */
* (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */
xprintf("call FireTOS\r\n");
/* Jump into FireTOS */
typedef void void_func(void);
void_func* FireTOS = (void_func*) FIRETOS;
FireTOS(); // Should never return
}
xprintf("call EmuTOS\r\n");
struct rom_header *os_header = (struct rom_header *) TOS;
os_header->initial_pc();

View File

@@ -144,7 +144,7 @@
subq.l #8,sp
movem.l d0/a5,(sp) // save registers
lea MCF_EPORT_EPFR,a5
lea MCF_EPORT_EPFR,a5
move.b #\clr_int,(a5) // clear int pending
movem.l (sp),d0/a5 // restore registers

View File

@@ -561,8 +561,7 @@ static void init_video_ddr(void) {
_VRAM = 0000070022; /* load MR dll on */
NOP();
* (uint32_t *) 0xf0000400 = 0x01070002; /* fifo on, refresh on, ddrcs und cke on, video dac on */
// * (uint32_t *) 0xf0000400 = 0x0107820b; /* fifo on, refresh on, ddrcs und cke on, video dac on */
* (uint32_t *) 0xf0000400 = 0x01070082; /* fifo on, refresh on, ddrcs und cke on, video dac on, Falcon shift mode on */
xprintf("finished\r\n");
}
@@ -940,7 +939,7 @@ static void clear_bss_segment(void)
void initialize_hardware(void)
{
/* Test for FireTOS switch: DIP switch #5 up */
#if defined(MACHINE_FIREBEE)
#ifdef _NOT_USED_ // #if defined(MACHINE_FIREBEE)
if (!(DIP_SWITCH & (1 << 6))) {
/* Minimal hardware initialization */
init_gpio();
@@ -958,6 +957,7 @@ void initialize_hardware(void)
/* TT-RAM */
xprintf("FASTRAM_END = %p\r\n", FASTRAM_END);
* (uint32_t *) 0x5a4 = FASTRAM_END; /* ramtop TOS system variable */
* (uint32_t *) 0x5a8 = 0x1357bd13; /* ramvalid TOS system variable */