cleaned up project:
-moved all includes into "include" directory -extracted "wait...()"-routines into separate files
This commit is contained in:
@@ -9,10 +9,6 @@
|
|||||||
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
<name>org.eclipse.cdt.managedbuilder.core.genmakebuilder</name>
|
||||||
<triggers>clean,full,incremental,</triggers>
|
<triggers>clean,full,incremental,</triggers>
|
||||||
<arguments>
|
<arguments>
|
||||||
<dictionary>
|
|
||||||
<key>?children?</key>
|
|
||||||
<value>?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>?name?</key>
|
<key>?name?</key>
|
||||||
<value></value>
|
<value></value>
|
||||||
@@ -27,16 +23,12 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
<key>org.eclipse.cdt.make.core.buildArguments</key>
|
||||||
<value>-j</value>
|
<value></value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
<key>org.eclipse.cdt.make.core.buildCommand</key>
|
||||||
<value>make</value>
|
<value>make</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
|
||||||
<key>org.eclipse.cdt.make.core.buildLocation</key>
|
|
||||||
<value>${workspace_loc:/BaS_GNU}</value>
|
|
||||||
</dictionary>
|
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
<key>org.eclipse.cdt.make.core.cleanBuildTarget</key>
|
||||||
<value>clean</value>
|
<value>clean</value>
|
||||||
@@ -47,7 +39,7 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
<key>org.eclipse.cdt.make.core.enableAutoBuild</key>
|
||||||
<value>true</value>
|
<value>false</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
<key>org.eclipse.cdt.make.core.enableCleanBuild</key>
|
||||||
@@ -67,7 +59,7 @@
|
|||||||
</dictionary>
|
</dictionary>
|
||||||
<dictionary>
|
<dictionary>
|
||||||
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
<key>org.eclipse.cdt.make.core.useDefaultBuildCmd</key>
|
||||||
<value>false</value>
|
<value>true</value>
|
||||||
</dictionary>
|
</dictionary>
|
||||||
</arguments>
|
</arguments>
|
||||||
</buildCommand>
|
</buildCommand>
|
||||||
|
|||||||
@@ -59,7 +59,8 @@ CSRCS= \
|
|||||||
$(SRCDIR)/bas_printf.c \
|
$(SRCDIR)/bas_printf.c \
|
||||||
$(SRCDIR)/BaS.c \
|
$(SRCDIR)/BaS.c \
|
||||||
$(SRCDIR)/cache.c \
|
$(SRCDIR)/cache.c \
|
||||||
$(SRCDIR)/sd_card.c
|
$(SRCDIR)/sd_card.c \
|
||||||
|
$(SRCDIR)/wait.c
|
||||||
|
|
||||||
ASRCS= \
|
ASRCS= \
|
||||||
$(SRCDIR)/startcf.S \
|
$(SRCDIR)/startcf.S \
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ SECTIONS
|
|||||||
AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4))
|
AT (ALIGN(ADDR(.text) + SIZEOF(.text), 4))
|
||||||
{
|
{
|
||||||
objs/BaS.o(.text)
|
objs/BaS.o(.text)
|
||||||
|
objs/wait.o(.text)
|
||||||
/* put other routines into the same segment (RAM) as BaS.o */
|
/* put other routines into the same segment (RAM) as BaS.o */
|
||||||
objs/sd_card_asm.o(.text)
|
objs/sd_card_asm.o(.text)
|
||||||
objs/bas_printf.o(.text)
|
objs/bas_printf.o(.text)
|
||||||
|
|||||||
36
BaS_gcc/include/wait.h
Normal file
36
BaS_gcc/include/wait.h
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Copyright 2010 - 2012 F. Aschwanden
|
||||||
|
* Copyright 2011 - 2012 V. Riviere
|
||||||
|
* Copyright 2012 M. Froeschle
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _WAIT_H_
|
||||||
|
#define _WAIT_H_
|
||||||
|
|
||||||
|
#include <bas_types.h>
|
||||||
|
|
||||||
|
extern inline void wait(uint32_t us);
|
||||||
|
extern inline bool waitfor(uint32_t us, int (*condition)(void));
|
||||||
|
|
||||||
|
|
||||||
|
#endif /* _WAIT_H_ */
|
||||||
@@ -30,16 +30,13 @@
|
|||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include "bas_types.h"
|
#include "bas_types.h"
|
||||||
#include "sd_card.h"
|
#include "sd_card.h"
|
||||||
|
#include <wait.h>
|
||||||
|
|
||||||
/* imported routines */
|
/* imported routines */
|
||||||
extern int mmu_init();
|
extern int mmu_init();
|
||||||
extern int vec_init();
|
extern int vec_init();
|
||||||
extern int illegal_table_make();
|
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 */
|
/* Symbols from the linker script */
|
||||||
extern uint8_t _STRAM_END[];
|
extern uint8_t _STRAM_END[];
|
||||||
#define STRAM_END ((uint32_t)_STRAM_END)
|
#define STRAM_END ((uint32_t)_STRAM_END)
|
||||||
|
|||||||
@@ -24,9 +24,9 @@
|
|||||||
|
|
||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
#include <MCF5475.h>
|
#include <MCF5475.h>
|
||||||
#include "bas_printf.h"
|
#include <bas_printf.h>
|
||||||
#include "sd_card.h"
|
#include <sd_card.h>
|
||||||
|
#include <wait.h>
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* "standard value" for DSPI module configuration register MCF_DSPC_DMCR
|
* "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 */
|
MCF_DSPI_DMCR_CRXF; /* clear receive FIFO */
|
||||||
/* 0x800d3c00 */
|
/* 0x800d3c00 */
|
||||||
|
|
||||||
extern void wait(volatile uint32_t value);
|
|
||||||
|
|
||||||
#ifdef _NOT_USED_ /* disabled assembler routines */
|
#ifdef _NOT_USED_ /* disabled assembler routines */
|
||||||
|
|
||||||
void sd_card_idle(void)
|
void sd_card_idle(void)
|
||||||
|
|||||||
@@ -31,6 +31,7 @@
|
|||||||
#include "sysinit.h"
|
#include "sysinit.h"
|
||||||
#include "bas_printf.h"
|
#include "bas_printf.h"
|
||||||
#include "bas_types.h"
|
#include "bas_types.h"
|
||||||
|
#include <wait.h>
|
||||||
|
|
||||||
extern void xprintf_before_copy(const char *fmt, ...);
|
extern void xprintf_before_copy(const char *fmt, ...);
|
||||||
#define xprintf xprintf_before_copy
|
#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 MAJOR_VERSION = 0;
|
||||||
static const int MINOR_VERSION = 1;
|
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
|
* init SLICE TIMER 0
|
||||||
* all = 32.538 sec = 30.736mHz
|
* all = 32.538 sec = 30.736mHz
|
||||||
|
|||||||
58
BaS_gcc/sources/wait.c
Normal file
58
BaS_gcc/sources/wait.c
Normal file
@@ -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 <http://www.gnu.org/licenses/>.
|
||||||
|
*
|
||||||
|
* Copyright 2010 - 2012 F. Aschwanden
|
||||||
|
* Copyright 2011 - 2012 V. Riviere
|
||||||
|
* Copyright 2012 M. Froeschle
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <stdint.h>
|
||||||
|
#include <MCF5475.h>
|
||||||
|
|
||||||
|
#include <wait.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* 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;
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user