aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-29 16:16:38 +0000
committergdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4>2009-11-29 16:16:38 +0000
commit2e33e2772adefb783621f60f8cab452cf61abe29 (patch)
treeed20145e2e8cb0337db77a4d13fb75fdb4075595
parent937efbc9b64d9ac5c10136e8d1e4fb359a6bdda6 (diff)
downloadChibiOS-2e33e2772adefb783621f60f8cab452cf61abe29.tar.gz
ChibiOS-2e33e2772adefb783621f60f8cab452cf61abe29.tar.bz2
ChibiOS-2e33e2772adefb783621f60f8cab452cf61abe29.zip
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1358 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r--demos/ARM7-AT91SAM7X-GCC/board.h2
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile19
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/board.c92
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h88
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c6
-rw-r--r--demos/ARM7-AT91SAM7X-LWIP-GCC/main.c8
-rw-r--r--demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h88
7 files changed, 195 insertions, 108 deletions
diff --git a/demos/ARM7-AT91SAM7X-GCC/board.h b/demos/ARM7-AT91SAM7X-GCC/board.h
index 2cb285429..c0b428561 100644
--- a/demos/ARM7-AT91SAM7X-GCC/board.h
+++ b/demos/ARM7-AT91SAM7X-GCC/board.h
@@ -21,7 +21,7 @@
#define _BOARD_H_
/*
- * Select your platform by modifying the following line.
+ * Select your platform by modifying the following line.
*/
#if !defined(SAM7_PLATFORM)
#define SAM7_PLATFORM SAM7X256
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile b/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile
index 404fb07e0..7255f4f3e 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/Makefile
@@ -44,6 +44,8 @@ LDSCRIPT= ch.ld
# Imported source files
CHIBIOS = ../..
+include ${CHIBIOS}/os/hal/hal.mk
+include ${CHIBIOS}/os/hal/platforms/AT91SAM7/platform.mk
include ${CHIBIOS}/os/ports/GCC/ARM7/port.mk
include ${CHIBIOS}/os/kernel/kernel.mk
include ${CHIBIOS}/test/test.mk
@@ -54,20 +56,13 @@ include ./lwip/lwip.mk
CSRC = ${PORTSRC} \
${KERNSRC} \
${TESTSRC} \
- ${CHIBIOS}/os/io/pal.c \
- ${CHIBIOS}/os/io/serial.c \
- ${CHIBIOS}/os/io/mii.c \
- ${CHIBIOS}/os/io/mac.c \
- ${CHIBIOS}/os/io/platforms/AT91SAM7/pal_lld.c \
- ${CHIBIOS}/os/io/platforms/AT91SAM7/serial_lld.c \
- ${CHIBIOS}/os/io/platforms/AT91SAM7/mii_lld.c \
- ${CHIBIOS}/os/io/platforms/AT91SAM7/mac_lld.c \
- ${CHIBIOS}/os/io/platforms/AT91SAM7/at91lib/aic.c \
- ${CHIBIOS}/os/various/evtimer.c \
+ ${HALSRC} \
+ ${PLATFORMSRC} \
${LWNETIFSRC} \
${LWCORESRC} \
${LWIPV4SRC} \
${LWAPISRC} \
+ ${CHIBIOS}/os/various/evtimer.c \
./lwip/arch/sys_arch.c \
./lwip/lwipthread.c \
./web/web.c \
@@ -101,9 +96,7 @@ TCPPSRC =
ASMSRC = $(PORTASM) \
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7/vectors.s
-INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(LWINC) \
- ${CHIBIOS}/os/io \
- ${CHIBIOS}/os/io/platforms/AT91SAM7 \
+INCDIR = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) $(LWINC) \
${CHIBIOS}/os/various \
${CHIBIOS}/os/ports/GCC/ARM7/AT91SAM7 \
./lwip
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/board.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/board.c
index 7f129abaa..b9704971c 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/board.c
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/board.c
@@ -17,27 +17,8 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <pal.h>
-#include <serial.h>
-#include <mac.h>
-
-#include "board.h"
-#include "at91lib/aic.h"
-
-/*
- * FIQ Handler weak symbol defined in vectors.s.
- */
-void FiqHandler(void);
-
-static CH_IRQ_HANDLER(SpuriousHandler) {
-
- CH_IRQ_PROLOGUE();
-
- AT91C_BASE_AIC->AIC_EOICR = 0;
-
- CH_IRQ_EPILOGUE();
-}
+#include "ch.h"
+#include "hal.h"
/*
* SYS IRQ handling here.
@@ -58,60 +39,13 @@ static CH_IRQ_HANDLER(SYSIrqHandler) {
}
/*
- * Digital I/O ports static configuration as defined in @p board.h.
- */
-static const AT91SAM7PIOConfig config =
-{
- {VAL_PIOA_ODSR, VAL_PIOA_OSR, VAL_PIOA_PUSR},
-#if defined(SAM7X128) || defined(SAM7X256) || defined(SAM7X512)
- {VAL_PIOB_ODSR, VAL_PIOB_OSR, VAL_PIOB_PUSR}
-#endif
-};
-
-/*
* Early initialization code.
* This initialization is performed just after reset before BSS and DATA
* segments initialization.
*/
void hwinit0(void) {
- /*
- * Flash Memory: 1 wait state, about 50 cycles in a microsecond.
- */
- AT91C_BASE_MC->MC_FMR = (AT91C_MC_FMCN & (50 << 16)) | AT91C_MC_FWS_1FWS;
- /*
- * Watchdog disabled.
- */
- AT91C_BASE_WDTC->WDTC_WDMR = AT91C_WDTC_WDDIS;
-
- /*
- * Enables the main oscillator and waits 56 slow cycles as startup time.
- */
- AT91C_BASE_PMC->PMC_MOR = (AT91C_CKGR_OSCOUNT & (7 << 8)) | AT91C_CKGR_MOSCEN;
- while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MOSCS))
- ;
-
- /*
- * PLL setup: DIV = 14, MUL = 72, PLLCOUNT = 10
- * PLLfreq = 96109714 Hz (rounded)
- */
- AT91C_BASE_PMC->PMC_PLLR = (AT91C_CKGR_DIV & 14) |
- (AT91C_CKGR_PLLCOUNT & (10 << 8)) |
- (AT91C_CKGR_MUL & (72 << 16));
- while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_LOCK))
- ;
-
- /*
- * Master clock = PLLfreq / 2 = 48054858 Hz (rounded)
- */
- AT91C_BASE_PMC->PMC_MCKR = AT91C_PMC_CSS_PLL_CLK | AT91C_PMC_PRES_CLK_2;
- while (!(AT91C_BASE_PMC->PMC_SR & AT91C_PMC_MCKRDY))
- ;
-
- /*
- * PIO initialization.
- */
- palInit(&config);
+ at91sam7_clock_init();
}
/*
@@ -120,19 +54,11 @@ void hwinit0(void) {
* and before invoking the main() function.
*/
void hwinit1(void) {
- int i;
/*
- * Default AIC setup, the device drivers will modify it as needed.
+ * HAL initialization.
*/
- AT91C_BASE_AIC->AIC_ICCR = 0xFFFFFFFF;
- AT91C_BASE_AIC->AIC_IDCR = 0xFFFFFFFF;
- AT91C_BASE_AIC->AIC_SVR[0] = (AT91_REG)FiqHandler;
- for (i = 1; i < 31; i++) {
- AT91C_BASE_AIC->AIC_SVR[i] = (AT91_REG)NULL;
- AT91C_BASE_AIC->AIC_EOICR = (AT91_REG)i;
- }
- AT91C_BASE_AIC->AIC_SPU = (AT91_REG)SpuriousHandler;
+ halInit();
/*
* LCD pins setup.
@@ -170,19 +96,13 @@ void hwinit1(void) {
AT91C_BASE_PITC->PITC_PIMR |= AT91C_PITC_PITEN | AT91C_PITC_PITIEN;
/*
- * Serial driver initialization, RTS/CTS pins enabled for USART0 only.
+ * RTS/CTS pins enabled for USART0 only.
*/
- sdInit();
AT91C_BASE_PIOA->PIO_PDR = AT91C_PA3_RTS0 | AT91C_PA4_CTS0;
AT91C_BASE_PIOA->PIO_ASR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
AT91C_BASE_PIOA->PIO_PPUDR = AT91C_PIO_PA3 | AT91C_PIO_PA4;
/*
- * EMAC driver initialization.
- */
- macInit();
-
- /*
* ChibiOS/RT initialization.
*/
chSysInit();
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h b/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h
new file mode 100644
index 000000000..29fa51738
--- /dev/null
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/halconf.h
@@ -0,0 +1,88 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT 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.
+
+ ChibiOS/RT 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 this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file templates/halconf.h
+ * @brief HAL configuration header.
+ * @addtogroup HAL
+ * @{
+ */
+
+#ifndef _HALCONF_H_
+#define _HALCONF_H_
+
+/**
+ * @brief Enables the PAL subsystem.
+ */
+#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PAL TRUE
+#endif
+
+/**
+ * @brief Enables the ADC subsystem.
+ */
+#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__)
+#define CH_HAL_USE_ADC FALSE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__)
+#define CH_HAL_USE_CAN FALSE
+#endif
+
+/**
+ * @brief Enables the MAC subsystem.
+ */
+#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MAC TRUE
+#endif
+
+/**
+ * @brief Enables the MII subsystem.
+ */
+#if !defined(CH_HAL_USE_MII) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MII TRUE
+#endif
+
+/**
+ * @brief Enables the SERIAL subsystem.
+ */
+#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_SERIAL TRUE
+#endif
+
+/**
+ * @brief Enables the SPI subsystem.
+ */
+#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__)
+#define CH_HAL_USE_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MMC_SPI FALSE
+#endif
+
+#endif /* _HALCONF_H_ */
+
+/** @} */
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c
index 36ca3fd37..4400445ac 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/lwip/lwipthread.c
@@ -58,9 +58,9 @@
* @{
*/
-#include <ch.h>
-#include <evtimer.h>
-#include <mac.h>
+#include "ch.h"
+#include "hal.h"
+#include "evtimer.h"
#include "lwip/opt.h"
diff --git a/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c b/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c
index 14ac139d9..f097b059d 100644
--- a/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c
+++ b/demos/ARM7-AT91SAM7X-LWIP-GCC/main.c
@@ -17,12 +17,10 @@
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <pal.h>
-#include <serial.h>
-#include <test.h>
+#include "ch.h"
+#include "hal.h"
+#include "test.h"
-#include "board.h"
#include "lwip\lwipthread.h"
#include "web\web.h"
diff --git a/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h b/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h
new file mode 100644
index 000000000..29fa51738
--- /dev/null
+++ b/demos/ARM7-AT91SAM7X-UIP-GCC/halconf.h
@@ -0,0 +1,88 @@
+/*
+ ChibiOS/RT - Copyright (C) 2006-2007 Giovanni Di Sirio.
+
+ This file is part of ChibiOS/RT.
+
+ ChibiOS/RT 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.
+
+ ChibiOS/RT 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 this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+/**
+ * @file templates/halconf.h
+ * @brief HAL configuration header.
+ * @addtogroup HAL
+ * @{
+ */
+
+#ifndef _HALCONF_H_
+#define _HALCONF_H_
+
+/**
+ * @brief Enables the PAL subsystem.
+ */
+#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PAL TRUE
+#endif
+
+/**
+ * @brief Enables the ADC subsystem.
+ */
+#if !defined(CH_HAL_USE_ADC) || defined(__DOXYGEN__)
+#define CH_HAL_USE_ADC FALSE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__)
+#define CH_HAL_USE_CAN FALSE
+#endif
+
+/**
+ * @brief Enables the MAC subsystem.
+ */
+#if !defined(CH_HAL_USE_MAC) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MAC TRUE
+#endif
+
+/**
+ * @brief Enables the MII subsystem.
+ */
+#if !defined(CH_HAL_USE_MII) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MII TRUE
+#endif
+
+/**
+ * @brief Enables the SERIAL subsystem.
+ */
+#if !defined(CH_HAL_USE_SERIAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_SERIAL TRUE
+#endif
+
+/**
+ * @brief Enables the SPI subsystem.
+ */
+#if !defined(CH_HAL_USE_SPI) || defined(__DOXYGEN__)
+#define CH_HAL_USE_SPI FALSE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MMC_SPI FALSE
+#endif
+
+#endif /* _HALCONF_H_ */
+
+/** @} */