diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index 7f31cf1..53f7ef2 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -120,8 +120,9 @@ $(FLASH_EXEC): MACHINE=MACHINE_M5484LITE $(FLASH_EXEC): LDCFILE=bas.lk $(FLASH_EXEC): MAPFILE=bas.map -$(RAM_EXEC): TARGET_ADDRESS=0x1ff00000 +$(RAM_EXEC): TARGET_ADDRESS=0x00100000 $(RAM_EXEC): MACHINE=MACHINE_M5484LITE +$(RAM_EXEC): CFLAGS += -D$(MACHINE) $(RAM_EXEC): LDCFILE=ram.lk $(RAM_EXEC): MAPFILE=ram.map diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index d4c8f9f..3c726ff 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -225,8 +225,10 @@ void BaS(void) uint8_t *dst = (uint8_t *)TOS; uint32_t *adr; +#ifdef MACHINE_FIREBEE /* LITE board has no pic and (currently) no nvram */ pic_init(); nvram_init(); +#endif /* MACHINE_FIREBEE */ xprintf("copy EmuTOS: "); @@ -243,12 +245,16 @@ void BaS(void) vec_init(); xprintf("finished\r\n"); - xprintf("flush caches and enable MMU: "); + xprintf("flush caches: "); flush_and_invalidate_caches(); - MCF_MMU_MMUCR = MCF_MMU_MMUCR_EN; /* MMU on */ - NOP(); /* force pipeline sync */ xprintf("finished\r\n"); + xprintf("enable MMU: "); + MCF_MMU_MMUCR = MCF_MMU_MMUCR_EN; /* MMU on */ + NOP(); /* force pipeline sync */ + xprintf("finished\r\n"); + +#ifdef MACHINE_FIREBEE xprintf("IDE reset: "); /* IDE reset */ * (volatile uint8_t *) (0xffff8802 - 2) = 14; @@ -279,6 +285,7 @@ void BaS(void) * (volatile uint32_t *) (0xf0000410 - 0x20) = 0x01070002; xprintf("finished\r\n"); +#endif /* MACHINE_FIREBEE */ sd_card_init(); diff --git a/BaS_gcc/sources/mmu.S b/BaS_gcc/sources/mmu.S index 2757c4e..0887d10 100644 --- a/BaS_gcc/sources/mmu.S +++ b/BaS_gcc/sources/mmu.S @@ -3,6 +3,12 @@ */ #include "startcf.h" +#ifdef MACHINE_FIREBEE +#include "firebee.h" +#endif /* MACHINE_FIREBEE */ +#ifdef MACHINE_M5484LITE +#include "m5484l.h" +#endif /* MACHINE_M5484LITE */ .extern _rt_vbr .extern _rt_cacr @@ -132,6 +138,7 @@ _mmu_init: // 00D0'0000 - 0x00DF'FFFF (last megabyte of ST RAM = Falcon video memory) locked ID=6 // mapped to physical address 60D0'0000 (FPGA video memory) // video ram: read write execute normal write true +#ifdef MACHINE_FIREBEE move.l #0x00d00000|MCF_MMU_MMUTR_ID(sca_page_ID)|std_mmutr,d0 move.l #0x60d00000|writethrough_mmudr|MCF_MMU_MMUDR_LK,d1 move.l d0,MCF_MMU_MMUTR @@ -143,6 +150,7 @@ _mmu_init: move.l #0x2000,d0 move.l d0,_video_tlb // set page as video page clr.l _video_sbt // clear time +#endif /* MACHINE_FIREBEE */ // Make the TOS (in SDRAM) read-only @@ -157,13 +165,16 @@ _mmu_init: // 00f0'0000 locked // this maps virtual 0x00F0'0000 - 0x00FF'FFFF to physical 0xFFF0'0000 - 0xFFFF'FFFF effectively making I/O area // accesses ST-compatible (just the same what Atari made for TT and Falcon) +#ifdef MACHINE_FIREBEE move.l #0x00f00000|std_mmutr,d0 move.l #0xfff00000|nocache_precise_mmudr|MCF_MMU_MMUDR_LK,d1 move.l d0,MCF_MMU_MMUTR move.l d1,MCF_MMU_MMUDR move.l d2,MCF_MMU_MMUOR // mapped to ffffxxx, precise, move.l d3,MCF_MMU_MMUOR // mapped to ffffxxx, precise, +#endif /* MACHINE_FIREBEE */ +#ifdef MACHINE_FIREBEE // 1ff0'0000 locked // maps virtual 0x1FF0'0000 - 0x1FFF'FFFF to the same physical address move.l #0x1FF00000|std_mmutr,d0 // last megabyte of physical RAM. Reserved for BaS @@ -172,6 +183,7 @@ _mmu_init: move.l d1,MCF_MMU_MMUDR move.l d2,MCF_MMU_MMUOR // setzen data move.l d3,MCF_MMU_MMUOR // setzen instr +#endif /* MACHINE_FIREBEE */ move.l (sp)+,d2 // Restore registers move.l (sp)+,d3 diff --git a/BaS_gcc/sources/sysinit.c b/BaS_gcc/sources/sysinit.c index cfad54e..3cbab5f 100644 --- a/BaS_gcc/sources/sysinit.c +++ b/BaS_gcc/sources/sysinit.c @@ -27,7 +27,6 @@ #include #include "MCF5475.h" -#include "firebee.h" #include "startcf.h" #include "cache.h" #include "sysinit.h" @@ -37,6 +36,13 @@ #include "bas_types.h" #include "wait.h" #include "version.h" +#ifdef MACHINE_FIREBEE +#include "firebee.h" +#endif /* MACHINE_FIREBEE */ + +#ifdef MACHINE_M5484LITE +#include "m5484l.h" +#endif /* MACHINE_M5484LITE */ #define UNUSED(x) (void)(x) /* Unused variable */ @@ -202,7 +208,12 @@ void init_serial(void) MCF_PSC0_PSCSICR = 0; /* PSC control register: select UART mode */ MCF_PSC0_PSCCSR = 0xDD; /* use TX and RX baud rate from PSC timer */ MCF_PSC0_PSCCTUR = 0x00; /* =\ */ +#ifdef MACHINE_FIREBEE MCF_PSC0_PSCCTLR = 36; /* divide sys_clk by 36 => BAUD RATE = 115200 bps */ +#endif +#ifdef MACHINE_M5484LITE + MCF_PSC0_PSCCTLR = 27; /* LITE board has 100 MHz sys_clk only */ +#endif MCF_PSC0_PSCCR = 0x20; /* reset receiver and RxFIFO */ MCF_PSC0_PSCCR = 0x30; /* reset transmitter and TxFIFO */ MCF_PSC0_PSCCR = 0x40; /* reset all error status */ @@ -221,6 +232,7 @@ void init_serial(void) MCF_PSC0_PSCOPSET = 0x01; MCF_PSC0_PSCCR = 0x05; +#ifdef MACHINE_FIREBEE /* PSC3 is not connected to anything on the LITE board */ /* PSC3: PIC */ MCF_PSC3_PSCSICR = 0; // UART MCF_PSC3_PSCCSR = 0xDD; @@ -241,6 +253,8 @@ void init_serial(void) MCF_PSC3_PSCTFAR = 0x00F0; MCF_PSC3_PSCOPSET = 0x01; MCF_PSC3_PSCCR = 0x05; +#endif /* MACHINE_FIREBEE */ + MCF_INTC_ICR32 = 0x3F; //MAXIMALE PRIORITY/**********/ xprintf("\r\nserial interfaces initialization: finished\r\n"); @@ -944,13 +958,15 @@ void initialize_hardware(void) { init_pci(); #ifdef MACHINE_FIREBEE init_fpga(); -#endif /* MACHINE_FIREBEE */ init_pll(); init_video_ddr(); dvi_on(); +#endif /* MACHINE_FIREBEE */ test_upd720101(); //video_1280_1024(); +#ifdef MACHINE_FIREBEE init_ac97(); +#endif /* MACHINE_FIREBEE */ if (BAS_LMA != BAS_IN_RAM) {