changed hardcoded, but SYSCLK dependend values to evaluate correctly for the different platforms
This commit is contained in:
@@ -27,6 +27,8 @@
|
|||||||
* Author: Markus Fröschle
|
* Author: Markus Fröschle
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#define SYSCLK 132000
|
||||||
|
|
||||||
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
||||||
#define BOOTFLASH_SIZE 0x800000
|
#define BOOTFLASH_SIZE 0x800000
|
||||||
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
||||||
|
|||||||
@@ -1,12 +1,14 @@
|
|||||||
#ifndef _M5484L_H_
|
#ifndef _M5484L_H_
|
||||||
#define _M5484L_H_
|
#define _M5484L_H_
|
||||||
|
|
||||||
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
#define SYSCLK 100000
|
||||||
#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */
|
|
||||||
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
|
||||||
|
|
||||||
#define SDRAM_START 0x00000000 /* start at address 0 */
|
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
||||||
#define SDRAM_SIZE 0x4000000 /* 64 MB on the LITEKIT */
|
#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */
|
||||||
|
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
||||||
|
|
||||||
|
#define SDRAM_START 0x00000000 /* start at address 0 */
|
||||||
|
#define SDRAM_SIZE 0x4000000 /* 64 MB on the LITEKIT */
|
||||||
|
|
||||||
#ifdef COMPILE_RAM
|
#ifdef COMPILE_RAM
|
||||||
#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x100000)
|
#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x100000)
|
||||||
|
|||||||
@@ -28,6 +28,13 @@
|
|||||||
#define _WAIT_H_
|
#define _WAIT_H_
|
||||||
|
|
||||||
#include <bas_types.h>
|
#include <bas_types.h>
|
||||||
|
#if MACHINE_FIREBEE
|
||||||
|
#include "firebee.h"
|
||||||
|
#elif MACHINE_M5484LITE
|
||||||
|
#include "m5484l.h"
|
||||||
|
#else
|
||||||
|
//#error unknown machine
|
||||||
|
#endif /* MACHINE_FIREBEE */
|
||||||
|
|
||||||
typedef bool (*checker_func)(void);
|
typedef bool (*checker_func)(void);
|
||||||
|
|
||||||
@@ -39,7 +46,7 @@ extern __inline__ bool waitfor(uint32_t us, checker_func condition) __attribute_
|
|||||||
*/
|
*/
|
||||||
extern __inline__ void wait(uint32_t us)
|
extern __inline__ void wait(uint32_t us)
|
||||||
{
|
{
|
||||||
int32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000));
|
||||||
|
|
||||||
while (MCF_SLT_SCNT(0) - target > 0);
|
while (MCF_SLT_SCNT(0) - target > 0);
|
||||||
}
|
}
|
||||||
@@ -50,7 +57,7 @@ extern __inline__ void wait(uint32_t us)
|
|||||||
*/
|
*/
|
||||||
extern __inline__ bool waitfor(uint32_t us, checker_func condition)
|
extern __inline__ bool waitfor(uint32_t us, checker_func condition)
|
||||||
{
|
{
|
||||||
int32_t target = MCF_SLT_SCNT(0) - (us * 132);
|
int32_t target = MCF_SLT_SCNT(0) - (us * (SYSCLK / 1000));
|
||||||
uint32_t res;
|
uint32_t res;
|
||||||
|
|
||||||
do
|
do
|
||||||
|
|||||||
@@ -28,6 +28,12 @@
|
|||||||
#include "bas_string.h"
|
#include "bas_string.h"
|
||||||
#include "cache.h"
|
#include "cache.h"
|
||||||
|
|
||||||
|
#if MACHINE_FIREBEE
|
||||||
|
#include "firebee.h"
|
||||||
|
#elif MACHINE_M5484LITE
|
||||||
|
#include "m5484l.h"
|
||||||
|
#endif /* MACHINE_FIREBEE */
|
||||||
|
|
||||||
extern char _SYS_SRAM[];
|
extern char _SYS_SRAM[];
|
||||||
#define SYS_SRAM &_SYS_SRAM[0]
|
#define SYS_SRAM &_SYS_SRAM[0]
|
||||||
|
|
||||||
@@ -59,7 +65,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
|||||||
|
|
||||||
end = MCF_SLT0_SCNT;
|
end = MCF_SLT0_SCNT;
|
||||||
|
|
||||||
time = (start - end) / 132 / 1000;
|
time = (start - end) / (SYSCLK / 1000) / 1000;
|
||||||
xprintf("memcpy() took %d ms (%f Mbytes/second)\r\n",
|
xprintf("memcpy() took %d ms (%f Mbytes/second)\r\n",
|
||||||
time, n / (float) time / 1000.0);
|
time, n / (float) time / 1000.0);
|
||||||
flush_and_invalidate_caches();
|
flush_and_invalidate_caches();
|
||||||
@@ -68,7 +74,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
|||||||
start = MCF_SLT0_SCNT;
|
start = MCF_SLT0_SCNT;
|
||||||
bzero(dst, n);
|
bzero(dst, n);
|
||||||
end = MCF_SLT0_SCNT;
|
end = MCF_SLT0_SCNT;
|
||||||
time = (start - end) / 132;
|
time = (start - end) / (SYSCLK / 1000);
|
||||||
xprintf("bzero() took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
xprintf("bzero() took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
||||||
|
|
||||||
xprintf(" finished, flush caches: ");
|
xprintf(" finished, flush caches: ");
|
||||||
@@ -120,7 +126,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
|||||||
} while (ret != MCD_DONE);
|
} while (ret != MCD_DONE);
|
||||||
|
|
||||||
end = MCF_SLT0_SCNT;
|
end = MCF_SLT0_SCNT;
|
||||||
time = (start - end) / 132 / 1000;
|
time = (start - end) / (SYSCLK / 1000) / 1000;
|
||||||
//xprintf("start = %d, end = %d, time = %d\r\n", start, end, time);
|
//xprintf("start = %d, end = %d, time = %d\r\n", start, end, time);
|
||||||
xprintf("took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
xprintf("took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
||||||
|
|
||||||
@@ -151,7 +157,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
|||||||
xprintf("DMA copy verification successful!\r\n");
|
xprintf("DMA copy verification successful!\r\n");
|
||||||
end = MCF_SLT0_SCNT;
|
end = MCF_SLT0_SCNT;
|
||||||
|
|
||||||
time = (start - end) / 132 / 1000;
|
time = (start - end) / (SYSCLK / 1000) / 1000;
|
||||||
xprintf("took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
xprintf("took %d ms (%f Mbytes/second)\r\n", time, n / (float) time / 1000.0);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -351,6 +351,7 @@ void init_fbcs()
|
|||||||
MCF_FBCS_CSMR_V; /* 8 MByte on */
|
MCF_FBCS_CSMR_V; /* 8 MByte on */
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef MACHINE_FIREBEE /* FBC setup for FireBee */
|
||||||
MCF_FBCS1_CSAR = 0xFFF00000; /* ATARI I/O ADRESS */
|
MCF_FBCS1_CSAR = 0xFFF00000; /* ATARI I/O ADRESS */
|
||||||
MCF_FBCS1_CSCR = MCF_FBCS_CSCR_PS_16 /* 16BIT PORT */
|
MCF_FBCS1_CSCR = MCF_FBCS_CSCR_PS_16 /* 16BIT PORT */
|
||||||
| MCF_FBCS_CSCR_WS(8) /* DEFAULT 8WS */
|
| MCF_FBCS_CSCR_WS(8) /* DEFAULT 8WS */
|
||||||
@@ -376,6 +377,8 @@ void init_fbcs()
|
|||||||
| MCF_FBCS_CSCR_BSTW; // BURST WRITE ENABLE
|
| MCF_FBCS_CSCR_BSTW; // BURST WRITE ENABLE
|
||||||
MCF_FBCS4_CSMR = MCF_FBCS_CSMR_BAM_1G // 4000'0000-7FFF'FFFF
|
MCF_FBCS4_CSMR = MCF_FBCS_CSMR_BAM_1G // 4000'0000-7FFF'FFFF
|
||||||
| MCF_FBCS_CSMR_V;
|
| MCF_FBCS_CSMR_V;
|
||||||
|
#endif /* MACHINE_FIREBEE */
|
||||||
|
|
||||||
|
|
||||||
MCF_FBCS5_CSAR = 0x0;
|
MCF_FBCS5_CSAR = 0x0;
|
||||||
MCF_FBCS5_CSCR = MCF_FBCS_CSCR_PS_8
|
MCF_FBCS5_CSCR = MCF_FBCS_CSCR_PS_8
|
||||||
@@ -810,8 +813,10 @@ void clear_datasegment(void)
|
|||||||
bzero(BAS_DATA_START, BAS_DATA_END - BAS_DATA_START);
|
bzero(BAS_DATA_START, BAS_DATA_END - BAS_DATA_START);
|
||||||
}
|
}
|
||||||
|
|
||||||
void initialize_hardware(void) {
|
void initialize_hardware(void)
|
||||||
|
{
|
||||||
/* Test for FireTOS switch: DIP switch #5 up */
|
/* Test for FireTOS switch: DIP switch #5 up */
|
||||||
|
#ifdef MACHINE_FIREBEE
|
||||||
if (!(DIP_SWITCH & (1 << 6))) {
|
if (!(DIP_SWITCH & (1 << 6))) {
|
||||||
/* Minimal hardware initialization */
|
/* Minimal hardware initialization */
|
||||||
init_gpio();
|
init_gpio();
|
||||||
@@ -819,9 +824,7 @@ void initialize_hardware(void) {
|
|||||||
init_slt();
|
init_slt();
|
||||||
init_fbcs();
|
init_fbcs();
|
||||||
init_ddram();
|
init_ddram();
|
||||||
#ifdef MACHINE_FIREBEE
|
|
||||||
init_fpga();
|
init_fpga();
|
||||||
#endif /* MACHINE_FIREBEE */
|
|
||||||
|
|
||||||
/* Validate ST RAM */
|
/* Validate ST RAM */
|
||||||
* (volatile uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
|
* (volatile uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
|
||||||
@@ -840,6 +843,7 @@ void initialize_hardware(void) {
|
|||||||
FireTOS(); // Should never return
|
FireTOS(); // Should never return
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
#endif /* MACHINE_FIREBEE */
|
||||||
|
|
||||||
if (BAS_LMA != BAS_IN_RAM)
|
if (BAS_LMA != BAS_IN_RAM)
|
||||||
{
|
{
|
||||||
@@ -850,7 +854,17 @@ void initialize_hardware(void) {
|
|||||||
init_serial();
|
init_serial();
|
||||||
|
|
||||||
xprintf("\n\n");
|
xprintf("\n\n");
|
||||||
xprintf("Firebee BASIS system (BaS) v %d.%d (%s, %s)\r\n\r\n", MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__);
|
//#ifdef _NOT_USED_
|
||||||
|
xprintf("%s BASIS system (BaS) v %d.%d (%s, %s)\r\n\r\n",
|
||||||
|
#if MACHINE_FIREBEE
|
||||||
|
"Firebee"
|
||||||
|
#elif MACHINE_M5484LITE
|
||||||
|
"m5484 LITEKIT"
|
||||||
|
#else
|
||||||
|
"unknown platform"
|
||||||
|
#endif
|
||||||
|
, MAJOR_VERSION, MINOR_VERSION, __DATE__, __TIME__);
|
||||||
|
//#endif /* _NOT_USED_ */
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Determine cause(s) of Reset
|
* Determine cause(s) of Reset
|
||||||
|
|||||||
Reference in New Issue
Block a user