From 66a573cb320bbab582ec78e067ba50d8fd7941a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Sat, 15 Dec 2012 18:50:15 +0000 Subject: [PATCH] fixed a few compiler warnings --- BaS_gcc/include/wait.h | 31 ++++++++++++++- BaS_gcc/mcf5474.bdm | 89 ------------------------------------------ BaS_gcc/sources/mmc.c | 2 +- BaS_gcc/sources/wait.c | 27 ------------- 4 files changed, 30 insertions(+), 119 deletions(-) delete mode 100755 BaS_gcc/mcf5474.bdm diff --git a/BaS_gcc/include/wait.h b/BaS_gcc/include/wait.h index 44141f6..ca7ec9f 100644 --- a/BaS_gcc/include/wait.h +++ b/BaS_gcc/include/wait.h @@ -29,8 +29,35 @@ #include -extern inline void wait(uint32_t us); -extern inline bool waitfor(uint32_t us, int (*condition)(void)); +typedef uint32_t (*checker_func)(void); +extern __inline__ void wait(uint32_t) __attribute__((always_inline)); +extern __inline__ uint32_t waitfor(uint32_t us, checker_func condition) __attribute__((always_inline)); +/* + * wait for the specified number of us on slice timer 0. Replaces the original routines that had + * the number of useconds to wait for hardcoded in their name. + */ +extern __inline__ void wait(uint32_t us) +{ + uint32_t target = MCF_SLT_SCNT(0) - (us * 132); + while (MCF_SLT_SCNT(0) > target); +} + +/* + * the same as above, with a checker function which gets called while + * busy waiting and allows for an early return if it returns true + */ +extern __inline__ uint32_t waitfor(uint32_t us, checker_func condition) +{ + uint32_t target = MCF_SLT_SCNT(0) - (us * 132); + uint32_t res; + + do + { + if ((res = (*condition)())) + return res; + } while (MCF_SLT_SCNT(0) > target); + return 0; +} #endif /* _WAIT_H_ */ diff --git a/BaS_gcc/mcf5474.bdm b/BaS_gcc/mcf5474.bdm deleted file mode 100755 index fb8074c..0000000 --- a/BaS_gcc/mcf5474.bdm +++ /dev/null @@ -1,89 +0,0 @@ -#!/usr/local/bin/bdmctrl -D2 -# -# firebee board initialization for bdmctrl -# -open $1 -reset -sleep 10000 - -wait - -# set VBR -#write-ctrl 0x0801 0x00000000 -sleep 10 -# Turn on MBAR at 0xFF00_0000 -write-ctrl 0x0C0F 0xFF000000 - -# Turn on MMUBAR at 0xFF04_0000 -write-ctrl 0x0008 0xFF040001 - -# Turn on RAMBAR0 at address FF10_0000 -write-ctrl 0x0C04 0xFF100007 -sleep 10 -# Turn on RAMBAR1 at address FF10_1000 -write-ctrl 0x0C05 0xFF101001 -sleep 10 - -# Init CS0 (BootFLASH @ E000_0000 - E07F_FFFF 8Mbytes) -write 0xFF000500 0xE0000000 4 -write 0xFF000508 0x00001180 4 -write 0xFF000504 0x007F0001 4 -# Init CS1 (Atari I/O address range) -write 0xFF00050C 0xFFF00000 4 -write 0xFF000514 0x00002180 4 -write 0xFF000510 0x000F0001 4 -# Init CS2 (FireBee 32 bit I/O address range) -write 0xFF000518 0xF0000000 4 -write 0xFF000520 0x00002100 4 -write 0xFF00051C 0x07FF0001 4 -# Init CS3 (FireBee 16 bit I/O address range) -write 0xFF000524 0xF8000000 4 -write 0xFF00052C 0x00000180 4 -write 0xFF000528 0x03FF0001 4 -# Init CS4 (FireBee video address range) -write 0xFF000530 0x40000000 4 -write 0xFF000538 0x00000018 4 -write 0xFF000534 0x003F0001 4 - - -# SDRAM Initialization @ 0000_0000 - 1FFF_FFFF 512Mbytes -write 0xFF000004 0x000002AA 4 # SDRAMDS configuration -write 0xFF000020 0x0000001A 4 # SDRAM CS0 configuration (128Mbytes 0000_0000 - 07FF_FFFF) -write 0xFF000024 0x0800001A 4 # SDRAM CS1 configuration (128Mbytes 0800_0000 - 0FFF_FFFF) -write 0xFF000028 0x1000001A 4 # SDRAM CS2 configuration (128Mbytes 1000_0000 - 17FF_FFFF) -write 0xFF00002C 0x1800001A 4 # SDRAM CS3 configuration (128Mbytes 1800_0000 - 1FFF_FFFF) -write 0xFF000108 0x73622830 4 # SDCFG1 -write 0xFF00010C 0x46770000 4 # SDCFG2 - -write 0xFF000104 0xE10D0002 4 # SDCR + IPALL -write 0xFF000100 0x40010000 4 # SDMR (write to LEMR) -write 0xFF000100 0x048D0000 4 # SDMR (write to LMR) -write 0xFF000104 0xE10D0002 4 # SDCR + IPALL -write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh) -write 0xFF000104 0xE10D0004 4 # SDCR + IREF (first refresh) -write 0xFF000100 0x008D0000 4 # SDMR (write to LMR) -write 0xFF000104 0x710D0F00 4 # SDCR (lock SDMR and enable refresh) - -write 0xFF000240 0x80000000 4 # disable watchdog arbiter - -# notify flashlib that we have flash at address 0xE0000000, length 0x7FFFFF, plugin is flash29 -flash 0xE0000000 -# do not flash yet. First check if board can be initialized correctly - -#flash-plugin 0x10000000 0x4000 flash29.plugin - -# contrary to documentation, it seems we need to erase-wait after each sector -erase 0xE0000000 0 -erase-wait 0xE0000000 -erase 0xE0000000 0x1000 -erase-wait 0xE0000000 -erase 0xE0000000 0x2000 -erase-wait 0xE0000000 -erase 0xE0000000 0x3000 -erase-wait 0xE0000000 - -load -v bas.elf -#load -v ram.elf -wait -sleep 100 -execute diff --git a/BaS_gcc/sources/mmc.c b/BaS_gcc/sources/mmc.c index 76d59bc..074e740 100644 --- a/BaS_gcc/sources/mmc.c +++ b/BaS_gcc/sources/mmc.c @@ -3,6 +3,7 @@ #include #include #include +#include #include /* @@ -168,7 +169,6 @@ static void xmit_spi_multi(const uint8_t *buff, uint32_t btx) static uint32_t card_ready(void) { - static uint32_t counter = 0; uint8_t d; d = xchg_spi(0xff); diff --git a/BaS_gcc/sources/wait.c b/BaS_gcc/sources/wait.c index 97fb530..20985df 100644 --- a/BaS_gcc/sources/wait.c +++ b/BaS_gcc/sources/wait.c @@ -29,30 +29,3 @@ #include #include - -/* - * wait for the specified number of us on slice timer 0. Replaces the original routines that had - * the number of useconds to wait for hardcoded in their name. - */ -inline void wait(uint32_t us) -{ - uint32_t target = MCF_SLT_SCNT(0) - (us * 132); - - while (MCF_SLT_SCNT(0) > target); -} - -/* - * the same as above, with a checker function which gets called while - * busy waiting and allows for an early return if it returns true - */ -inline bool waitfor(uint32_t us, int (*condition)(void)) -{ - uint32_t target = MCF_SLT_SCNT(0) - (us * 132); - - do - { - if ((*condition)()) - return TRUE; - } while (MCF_SLT_SCNT(0) > target); - return FALSE; -}