From 703df3199e88f041abefd47cc8271ceaeb294f2f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Mon, 10 Dec 2012 09:30:27 +0000 Subject: [PATCH] cleaned up project: -moved all includes into "include" directory -extracted "wait...()"-routines into separate files --- BaS_gcc/.project | 14 ++---- BaS_gcc/Makefile | 3 +- BaS_gcc/bas.lk.in | 1 + BaS_gcc/{sources => include}/cache.h | 0 BaS_gcc/{sources => include}/ii_add.h | 0 BaS_gcc/{sources => include}/ii_and.h | 0 BaS_gcc/{sources => include}/ii_dbcc.h | 0 BaS_gcc/{sources => include}/ii_ewf.h | 0 BaS_gcc/{sources => include}/ii_exg.h | 0 BaS_gcc/{sources => include}/ii_func.h | 0 BaS_gcc/{sources => include}/ii_jmp.h | 0 BaS_gcc/{sources => include}/ii_lea.h | 0 BaS_gcc/{sources => include}/ii_macro.h | 0 BaS_gcc/{sources => include}/ii_move.h | 0 BaS_gcc/{sources => include}/ii_movem.h | 0 BaS_gcc/{sources => include}/ii_movep.h | 0 BaS_gcc/{sources => include}/ii_op.h | 0 BaS_gcc/{sources => include}/ii_opc.h | 0 BaS_gcc/{sources => include}/ii_or.h | 0 BaS_gcc/{sources => include}/ii_pea.h | 0 BaS_gcc/{sources => include}/ii_shd.h | 0 BaS_gcc/{sources => include}/ii_shift.h | 0 BaS_gcc/{sources => include}/ii_sub.h | 0 BaS_gcc/{sources => include}/macro.h | 0 BaS_gcc/{sources => include}/startcf.h | 0 BaS_gcc/{sources => include}/sysinit.h | 0 BaS_gcc/include/wait.h | 36 +++++++++++++++ BaS_gcc/sources/BaS.c | 5 +-- BaS_gcc/sources/sd_card.c | 8 ++-- BaS_gcc/sources/sysinit.c | 26 +---------- BaS_gcc/sources/wait.c | 58 +++++++++++++++++++++++++ 31 files changed, 105 insertions(+), 46 deletions(-) rename BaS_gcc/{sources => include}/cache.h (100%) rename BaS_gcc/{sources => include}/ii_add.h (100%) rename BaS_gcc/{sources => include}/ii_and.h (100%) rename BaS_gcc/{sources => include}/ii_dbcc.h (100%) rename BaS_gcc/{sources => include}/ii_ewf.h (100%) rename BaS_gcc/{sources => include}/ii_exg.h (100%) rename BaS_gcc/{sources => include}/ii_func.h (100%) rename BaS_gcc/{sources => include}/ii_jmp.h (100%) rename BaS_gcc/{sources => include}/ii_lea.h (100%) rename BaS_gcc/{sources => include}/ii_macro.h (100%) rename BaS_gcc/{sources => include}/ii_move.h (100%) rename BaS_gcc/{sources => include}/ii_movem.h (100%) rename BaS_gcc/{sources => include}/ii_movep.h (100%) rename BaS_gcc/{sources => include}/ii_op.h (100%) rename BaS_gcc/{sources => include}/ii_opc.h (100%) rename BaS_gcc/{sources => include}/ii_or.h (100%) rename BaS_gcc/{sources => include}/ii_pea.h (100%) rename BaS_gcc/{sources => include}/ii_shd.h (100%) rename BaS_gcc/{sources => include}/ii_shift.h (100%) rename BaS_gcc/{sources => include}/ii_sub.h (100%) rename BaS_gcc/{sources => include}/macro.h (100%) rename BaS_gcc/{sources => include}/startcf.h (100%) rename BaS_gcc/{sources => include}/sysinit.h (100%) create mode 100644 BaS_gcc/include/wait.h create mode 100644 BaS_gcc/sources/wait.c diff --git a/BaS_gcc/.project b/BaS_gcc/.project index 377e4df..18fee7e 100644 --- a/BaS_gcc/.project +++ b/BaS_gcc/.project @@ -9,10 +9,6 @@ org.eclipse.cdt.managedbuilder.core.genmakebuilder clean,full,incremental, - - ?children? - ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\|| - ?name? @@ -27,16 +23,12 @@ org.eclipse.cdt.make.core.buildArguments - -j + org.eclipse.cdt.make.core.buildCommand make - - org.eclipse.cdt.make.core.buildLocation - ${workspace_loc:/BaS_GNU} - org.eclipse.cdt.make.core.cleanBuildTarget clean @@ -47,7 +39,7 @@ org.eclipse.cdt.make.core.enableAutoBuild - true + false org.eclipse.cdt.make.core.enableCleanBuild @@ -67,7 +59,7 @@ org.eclipse.cdt.make.core.useDefaultBuildCmd - false + true diff --git a/BaS_gcc/Makefile b/BaS_gcc/Makefile index 676e5c9..326f7c9 100644 --- a/BaS_gcc/Makefile +++ b/BaS_gcc/Makefile @@ -59,7 +59,8 @@ CSRCS= \ $(SRCDIR)/bas_printf.c \ $(SRCDIR)/BaS.c \ $(SRCDIR)/cache.c \ - $(SRCDIR)/sd_card.c + $(SRCDIR)/sd_card.c \ + $(SRCDIR)/wait.c ASRCS= \ $(SRCDIR)/startcf.S \ diff --git a/BaS_gcc/bas.lk.in b/BaS_gcc/bas.lk.in index e69f739..80a631c 100644 --- a/BaS_gcc/bas.lk.in +++ b/BaS_gcc/bas.lk.in @@ -27,6 +27,7 @@ SECTIONS AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4)) { objs/BaS.o(.text) + objs/wait.o(.text) /* put other routines into the same segment (RAM) as BaS.o */ objs/sd_card_asm.o(.text) objs/bas_printf.o(.text) diff --git a/BaS_gcc/sources/cache.h b/BaS_gcc/include/cache.h similarity index 100% rename from BaS_gcc/sources/cache.h rename to BaS_gcc/include/cache.h diff --git a/BaS_gcc/sources/ii_add.h b/BaS_gcc/include/ii_add.h similarity index 100% rename from BaS_gcc/sources/ii_add.h rename to BaS_gcc/include/ii_add.h diff --git a/BaS_gcc/sources/ii_and.h b/BaS_gcc/include/ii_and.h similarity index 100% rename from BaS_gcc/sources/ii_and.h rename to BaS_gcc/include/ii_and.h diff --git a/BaS_gcc/sources/ii_dbcc.h b/BaS_gcc/include/ii_dbcc.h similarity index 100% rename from BaS_gcc/sources/ii_dbcc.h rename to BaS_gcc/include/ii_dbcc.h diff --git a/BaS_gcc/sources/ii_ewf.h b/BaS_gcc/include/ii_ewf.h similarity index 100% rename from BaS_gcc/sources/ii_ewf.h rename to BaS_gcc/include/ii_ewf.h diff --git a/BaS_gcc/sources/ii_exg.h b/BaS_gcc/include/ii_exg.h similarity index 100% rename from BaS_gcc/sources/ii_exg.h rename to BaS_gcc/include/ii_exg.h diff --git a/BaS_gcc/sources/ii_func.h b/BaS_gcc/include/ii_func.h similarity index 100% rename from BaS_gcc/sources/ii_func.h rename to BaS_gcc/include/ii_func.h diff --git a/BaS_gcc/sources/ii_jmp.h b/BaS_gcc/include/ii_jmp.h similarity index 100% rename from BaS_gcc/sources/ii_jmp.h rename to BaS_gcc/include/ii_jmp.h diff --git a/BaS_gcc/sources/ii_lea.h b/BaS_gcc/include/ii_lea.h similarity index 100% rename from BaS_gcc/sources/ii_lea.h rename to BaS_gcc/include/ii_lea.h diff --git a/BaS_gcc/sources/ii_macro.h b/BaS_gcc/include/ii_macro.h similarity index 100% rename from BaS_gcc/sources/ii_macro.h rename to BaS_gcc/include/ii_macro.h diff --git a/BaS_gcc/sources/ii_move.h b/BaS_gcc/include/ii_move.h similarity index 100% rename from BaS_gcc/sources/ii_move.h rename to BaS_gcc/include/ii_move.h diff --git a/BaS_gcc/sources/ii_movem.h b/BaS_gcc/include/ii_movem.h similarity index 100% rename from BaS_gcc/sources/ii_movem.h rename to BaS_gcc/include/ii_movem.h diff --git a/BaS_gcc/sources/ii_movep.h b/BaS_gcc/include/ii_movep.h similarity index 100% rename from BaS_gcc/sources/ii_movep.h rename to BaS_gcc/include/ii_movep.h diff --git a/BaS_gcc/sources/ii_op.h b/BaS_gcc/include/ii_op.h similarity index 100% rename from BaS_gcc/sources/ii_op.h rename to BaS_gcc/include/ii_op.h diff --git a/BaS_gcc/sources/ii_opc.h b/BaS_gcc/include/ii_opc.h similarity index 100% rename from BaS_gcc/sources/ii_opc.h rename to BaS_gcc/include/ii_opc.h diff --git a/BaS_gcc/sources/ii_or.h b/BaS_gcc/include/ii_or.h similarity index 100% rename from BaS_gcc/sources/ii_or.h rename to BaS_gcc/include/ii_or.h diff --git a/BaS_gcc/sources/ii_pea.h b/BaS_gcc/include/ii_pea.h similarity index 100% rename from BaS_gcc/sources/ii_pea.h rename to BaS_gcc/include/ii_pea.h diff --git a/BaS_gcc/sources/ii_shd.h b/BaS_gcc/include/ii_shd.h similarity index 100% rename from BaS_gcc/sources/ii_shd.h rename to BaS_gcc/include/ii_shd.h diff --git a/BaS_gcc/sources/ii_shift.h b/BaS_gcc/include/ii_shift.h similarity index 100% rename from BaS_gcc/sources/ii_shift.h rename to BaS_gcc/include/ii_shift.h diff --git a/BaS_gcc/sources/ii_sub.h b/BaS_gcc/include/ii_sub.h similarity index 100% rename from BaS_gcc/sources/ii_sub.h rename to BaS_gcc/include/ii_sub.h diff --git a/BaS_gcc/sources/macro.h b/BaS_gcc/include/macro.h similarity index 100% rename from BaS_gcc/sources/macro.h rename to BaS_gcc/include/macro.h diff --git a/BaS_gcc/sources/startcf.h b/BaS_gcc/include/startcf.h similarity index 100% rename from BaS_gcc/sources/startcf.h rename to BaS_gcc/include/startcf.h diff --git a/BaS_gcc/sources/sysinit.h b/BaS_gcc/include/sysinit.h similarity index 100% rename from BaS_gcc/sources/sysinit.h rename to BaS_gcc/include/sysinit.h diff --git a/BaS_gcc/include/wait.h b/BaS_gcc/include/wait.h new file mode 100644 index 0000000..44141f6 --- /dev/null +++ b/BaS_gcc/include/wait.h @@ -0,0 +1,36 @@ +/* + * wait.h + * + * Author: mfro + * + * This file is part of BaS_gcc. + * + * BaS_gcc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BaS_gcc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with BaS_gcc. If not, see . + * + * Copyright 2010 - 2012 F. Aschwanden + * Copyright 2011 - 2012 V. Riviere + * Copyright 2012 M. Froeschle + * + */ + +#ifndef _WAIT_H_ +#define _WAIT_H_ + +#include + +extern inline void wait(uint32_t us); +extern inline bool waitfor(uint32_t us, int (*condition)(void)); + + +#endif /* _WAIT_H_ */ diff --git a/BaS_gcc/sources/BaS.c b/BaS_gcc/sources/BaS.c index 713a830..7e87c42 100644 --- a/BaS_gcc/sources/BaS.c +++ b/BaS_gcc/sources/BaS.c @@ -30,16 +30,13 @@ #include "bas_printf.h" #include "bas_types.h" #include "sd_card.h" +#include /* imported routines */ extern int mmu_init(); extern int vec_init(); extern int illegal_table_make(); -/* wait...() routines moved to sysinit.c */ -extern inline void wait(volatile uint32_t us); -extern inline volatile bool waitfor(volatile uint32_t us, int (*condition)(void)); - /* Symbols from the linker script */ extern uint8_t _STRAM_END[]; #define STRAM_END ((uint32_t)_STRAM_END) diff --git a/BaS_gcc/sources/sd_card.c b/BaS_gcc/sources/sd_card.c index 9cda4b5..0eed931 100644 --- a/BaS_gcc/sources/sd_card.c +++ b/BaS_gcc/sources/sd_card.c @@ -24,9 +24,9 @@ #include #include -#include "bas_printf.h" -#include "sd_card.h" - +#include +#include +#include /* * "standard value" for DSPI module configuration register MCF_DSPC_DMCR @@ -40,8 +40,6 @@ const uint32_t DSPI_DMCR_CONF = MCF_DSPI_DMCR_MSTR | /* FireBee is DSPI master*/ MCF_DSPI_DMCR_CRXF; /* clear receive FIFO */ /* 0x800d3c00 */ -extern void wait(volatile uint32_t value); - #ifdef _NOT_USED_ /* disabled assembler routines */ void sd_card_idle(void) diff --git a/BaS_gcc/sources/sysinit.c b/BaS_gcc/sources/sysinit.c index 98433ab..af6d316 100644 --- a/BaS_gcc/sources/sysinit.c +++ b/BaS_gcc/sources/sysinit.c @@ -31,6 +31,7 @@ #include "sysinit.h" #include "bas_printf.h" #include "bas_types.h" +#include extern void xprintf_before_copy(const char *fmt, ...); #define xprintf xprintf_before_copy @@ -44,32 +45,7 @@ extern volatile long _VRAM; /* start address of video ram from linker script */ static const int MAJOR_VERSION = 0; static const int MINOR_VERSION = 1; -/* - * 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; -} /* * init SLICE TIMER 0 * all = 32.538 sec = 30.736mHz diff --git a/BaS_gcc/sources/wait.c b/BaS_gcc/sources/wait.c new file mode 100644 index 0000000..97fb530 --- /dev/null +++ b/BaS_gcc/sources/wait.c @@ -0,0 +1,58 @@ +/* + * wait.c + * + * Created on: 10.12.2012 + * Author: mfro + * + * This file is part of BaS_gcc. + * + * BaS_gcc is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * BaS_gcc is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with BaS_gcc. If not, see . + * + * Copyright 2010 - 2012 F. Aschwanden + * Copyright 2011 - 2012 V. Riviere + * Copyright 2012 M. Froeschle + * + */ + +#include +#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; +}