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
|
||||
*/
|
||||
|
||||
#define SYSCLK 132000
|
||||
|
||||
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
||||
#define BOOTFLASH_SIZE 0x800000
|
||||
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _M5484L_H_
|
||||
#define _M5484L_H_
|
||||
|
||||
#define SYSCLK 100000
|
||||
|
||||
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
|
||||
#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */
|
||||
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
|
||||
|
||||
@@ -28,6 +28,13 @@
|
||||
#define _WAIT_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);
|
||||
|
||||
@@ -39,7 +46,7 @@ extern __inline__ bool waitfor(uint32_t us, checker_func condition) __attribute_
|
||||
*/
|
||||
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);
|
||||
}
|
||||
@@ -50,7 +57,7 @@ extern __inline__ void wait(uint32_t us)
|
||||
*/
|
||||
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;
|
||||
|
||||
do
|
||||
|
||||
@@ -28,6 +28,12 @@
|
||||
#include "bas_string.h"
|
||||
#include "cache.h"
|
||||
|
||||
#if MACHINE_FIREBEE
|
||||
#include "firebee.h"
|
||||
#elif MACHINE_M5484LITE
|
||||
#include "m5484l.h"
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
|
||||
extern char _SYS_SRAM[];
|
||||
#define SYS_SRAM &_SYS_SRAM[0]
|
||||
|
||||
@@ -59,7 +65,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
|
||||
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",
|
||||
time, n / (float) time / 1000.0);
|
||||
flush_and_invalidate_caches();
|
||||
@@ -68,7 +74,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
start = MCF_SLT0_SCNT;
|
||||
bzero(dst, n);
|
||||
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(" finished, flush caches: ");
|
||||
@@ -120,7 +126,7 @@ void *dma_memcpy(void *dst, void *src, size_t n)
|
||||
} while (ret != MCD_DONE);
|
||||
|
||||
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("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");
|
||||
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);
|
||||
|
||||
}
|
||||
|
||||
@@ -351,6 +351,7 @@ void init_fbcs()
|
||||
MCF_FBCS_CSMR_V; /* 8 MByte on */
|
||||
|
||||
|
||||
#ifdef MACHINE_FIREBEE /* FBC setup for FireBee */
|
||||
MCF_FBCS1_CSAR = 0xFFF00000; /* ATARI I/O ADRESS */
|
||||
MCF_FBCS1_CSCR = MCF_FBCS_CSCR_PS_16 /* 16BIT PORT */
|
||||
| MCF_FBCS_CSCR_WS(8) /* DEFAULT 8WS */
|
||||
@@ -376,6 +377,8 @@ void init_fbcs()
|
||||
| MCF_FBCS_CSCR_BSTW; // BURST WRITE ENABLE
|
||||
MCF_FBCS4_CSMR = MCF_FBCS_CSMR_BAM_1G // 4000'0000-7FFF'FFFF
|
||||
| MCF_FBCS_CSMR_V;
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
|
||||
|
||||
MCF_FBCS5_CSAR = 0x0;
|
||||
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);
|
||||
}
|
||||
|
||||
void initialize_hardware(void) {
|
||||
void initialize_hardware(void)
|
||||
{
|
||||
/* Test for FireTOS switch: DIP switch #5 up */
|
||||
#ifdef MACHINE_FIREBEE
|
||||
if (!(DIP_SWITCH & (1 << 6))) {
|
||||
/* Minimal hardware initialization */
|
||||
init_gpio();
|
||||
@@ -819,9 +824,7 @@ void initialize_hardware(void) {
|
||||
init_slt();
|
||||
init_fbcs();
|
||||
init_ddram();
|
||||
#ifdef MACHINE_FIREBEE
|
||||
init_fpga();
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
|
||||
/* Validate ST RAM */
|
||||
* (volatile uint32_t *) 0x42e = STRAM_END; /* phystop TOS system variable */
|
||||
@@ -840,6 +843,7 @@ void initialize_hardware(void) {
|
||||
FireTOS(); // Should never return
|
||||
return;
|
||||
}
|
||||
#endif /* MACHINE_FIREBEE */
|
||||
|
||||
if (BAS_LMA != BAS_IN_RAM)
|
||||
{
|
||||
@@ -850,7 +854,17 @@ void initialize_hardware(void) {
|
||||
init_serial();
|
||||
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user