changed hardcoded, but SYSCLK dependend values to evaluate correctly for the different platforms

This commit is contained in:
Markus Fröschle
2013-11-01 11:23:52 +00:00
parent 8ae034edd2
commit e27a45520f
5 changed files with 46 additions and 15 deletions

View File

@@ -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)

View File

@@ -1,12 +1,14 @@
#ifndef _M5484L_H_
#define _M5484L_H_
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
#define BOOTFLASH_SIZE 0x400000 /* LITEKIT has 4MB flash */
#define BOOTFLASH_BAM (BOOTFLASH_SIZE - 1)
#define SYSCLK 100000
#define SDRAM_START 0x00000000 /* start at address 0 */
#define SDRAM_SIZE 0x4000000 /* 64 MB on the LITEKIT */
#define BOOTFLASH_BASE_ADDRESS 0xE0000000
#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
#define TARGET_ADDRESS (SDRAM_START + SDRAM_SIZE - 0x100000)

View File

@@ -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