diff options
author | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-08 14:42:32 +0000 |
---|---|---|
committer | gdisirio <gdisirio@35acf78f-673a-0410-8e92-d51de3d6d3f4> | 2009-12-08 14:42:32 +0000 |
commit | cbbacdb239211fc33b0423b1213d2e58ac1692da (patch) | |
tree | 87b6a0de2bfe60c72113b3d9c6efb199aabb198b | |
parent | e3538a6583b6a269bfabb7b27166dc5296a61879 (diff) | |
download | ChibiOS-cbbacdb239211fc33b0423b1213d2e58ac1692da.tar.gz ChibiOS-cbbacdb239211fc33b0423b1213d2e58ac1692da.tar.bz2 ChibiOS-cbbacdb239211fc33b0423b1213d2e58ac1692da.zip |
HAL support for AVR.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@1394 35acf78f-673a-0410-8e92-d51de3d6d3f4
-rw-r--r-- | demos/AVR-AT90CANx-GCC/Makefile | 10 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/board.c | 22 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/board.h | 8 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/halconf.h | 96 | ||||
-rw-r--r-- | demos/AVR-AT90CANx-GCC/main.c | 12 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/Makefile | 10 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/board.c | 22 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/board.h | 8 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/halconf.h | 96 | ||||
-rw-r--r-- | demos/AVR-ATmega128-GCC/main.c | 11 | ||||
-rw-r--r-- | os/hal/platforms/AVR/hal_lld.c | 57 | ||||
-rw-r--r-- | os/hal/platforms/AVR/hal_lld.h | 60 | ||||
-rw-r--r-- | os/hal/platforms/AVR/platform.dox | 7 | ||||
-rw-r--r-- | os/hal/platforms/AVR/platform.mk | 6 | ||||
-rw-r--r-- | os/hal/platforms/AVR/serial_lld.c | 10 | ||||
-rw-r--r-- | os/hal/platforms/AVR/serial_lld.h | 6 | ||||
-rw-r--r-- | os/hal/templates/hal_lld.h | 2 |
17 files changed, 386 insertions, 57 deletions
diff --git a/demos/AVR-AT90CANx-GCC/Makefile b/demos/AVR-AT90CANx-GCC/Makefile index 5754a6371..0b6943cab 100644 --- a/demos/AVR-AT90CANx-GCC/Makefile +++ b/demos/AVR-AT90CANx-GCC/Makefile @@ -81,6 +81,8 @@ OBJDIR = . # Imported source files
CHIBIOS = ../..
+include ${CHIBIOS}/os/hal/hal.mk
+include ${CHIBIOS}/os/hal/platforms/AVR/platform.mk
include ${CHIBIOS}/os/ports/GCC/AVR/port.mk
include ${CHIBIOS}/os/kernel/kernel.mk
include ${CHIBIOS}/test/test.mk
@@ -90,8 +92,8 @@ include ${CHIBIOS}/test/test.mk SRC = ${PORTSRC} \
${KERNSRC} \
${TESTSRC} \
- ${CHIBIOS}/os/io/serial.c \
- ${CHIBIOS}/os/io/platforms/AVR/serial_lld.c \
+ ${HALSRC} \
+ ${PLATFORMSRC} \
${CHIBIOS}/os/various/evtimer.c \
board.c main.c
@@ -127,9 +129,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(PORTINC) $(KERNINC) $(TESTINC) \
- ${CHIBIOS}/os/io \
- ${CHIBIOS}/os/io/platforms/AVR \
+EXTRAINCDIRS = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \
${CHIBIOS}/os/various
diff --git a/demos/AVR-AT90CANx-GCC/board.c b/demos/AVR-AT90CANx-GCC/board.c index 2fdf128a1..b97bd94b5 100644 --- a/demos/AVR-AT90CANx-GCC/board.c +++ b/demos/AVR-AT90CANx-GCC/board.c @@ -17,10 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <serial.h>
-
-#include "board.h"
+#include "ch.h"
+#include "hal.h"
CH_IRQ_HANDLER(TIMER0_COMP_vect) {
@@ -71,16 +69,16 @@ void hwinit(void) { /*
* Timer 0 setup.
*/
- TCCR0A = (1 << WGM01) | (0 << WGM00) | // CTC mode.
- (0 << COM0A1) | (0 << COM0A0) | // OC0A disabled (normal I/O).
- (0 << CS02) | (1 << CS01) | (1 << CS00); // CLK/64 clock source.
+ TCCR0A = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
+ (0 << COM0A1) | (0 << COM0A0) | /* OC0A disabled. */
+ (0 << CS02) | (1 << CS01) | (1 << CS00); /* CLK/64 clock. */
OCR0A = F_CPU / 64 / CH_FREQUENCY - 1;
- TCNT0 = 0; // Reset counter.
- TIFR0 = (1 << OCF0A); // Reset pending (if any).
- TIMSK0 = (1 << OCIE0A); // Interrupt on compare.
+ TCNT0 = 0; /* Reset counter. */
+ TIFR0 = (1 << OCF0A); /* Reset pending. */
+ TIMSK0 = (1 << OCIE0A); /* IRQ on compare. */
/*
- * Other initializations.
+ * HAL initialization.
*/
- sdInit();
+ halInit();
}
diff --git a/demos/AVR-AT90CANx-GCC/board.h b/demos/AVR-AT90CANx-GCC/board.h index fefd6a39c..0abe920eb 100644 --- a/demos/AVR-AT90CANx-GCC/board.h +++ b/demos/AVR-AT90CANx-GCC/board.h @@ -81,6 +81,12 @@ #define PORTE_LED (1 << 4)
#define PORTE_BUTTON (1 << 5)
-void hwinit(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void hwinit(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* _BOARD_H_ */
diff --git a/demos/AVR-AT90CANx-GCC/halconf.h b/demos/AVR-AT90CANx-GCC/halconf.h new file mode 100644 index 000000000..a3d17a3c9 --- /dev/null +++ b/demos/AVR-AT90CANx-GCC/halconf.h @@ -0,0 +1,96 @@ +/*
+ 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_CONF
+ * @{
+ */
+
+/*
+ * HAL configuration file, this file allows to enable or disable the various
+ * device drivers from your application. You may also use this file in order
+ * to change the device drivers settings found in the low level drivers
+ * headers, just define here the new settings and those will override the
+ * defaults defined in the LLD headers. + */
+
+#ifndef _HALCONF_H_
+#define _HALCONF_H_
+
+/**
+ * @brief Enables the PAL subsystem. + */
+#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PAL FALSE
+#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 FALSE
+#endif
+
+/**
+ * @brief Enables the PWM subsystem.
+ */
+#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PWM FALSE
+#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/AVR-AT90CANx-GCC/main.c b/demos/AVR-AT90CANx-GCC/main.c index a19b1e9c5..61df6a3ed 100644 --- a/demos/AVR-AT90CANx-GCC/main.c +++ b/demos/AVR-AT90CANx-GCC/main.c @@ -17,15 +17,9 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <serial.h>
-#include <evtimer.h>
-
-#include <avr/io.h>
-
-#include "board.h"
-
-void hwinit(void);
+#include "ch.h"
+#include "hal.h"
+#include "evtimer.h"
static WORKING_AREA(waThread1, 32);
static msg_t Thread1(void *arg) {
diff --git a/demos/AVR-ATmega128-GCC/Makefile b/demos/AVR-ATmega128-GCC/Makefile index dcc7f7beb..1ae0a672a 100644 --- a/demos/AVR-ATmega128-GCC/Makefile +++ b/demos/AVR-ATmega128-GCC/Makefile @@ -81,6 +81,8 @@ OBJDIR = . # Imported source files
CHIBIOS = ../..
+include ${CHIBIOS}/os/hal/hal.mk
+include ${CHIBIOS}/os/hal/platforms/AVR/platform.mk
include ${CHIBIOS}/os/ports/GCC/AVR/port.mk
include ${CHIBIOS}/os/kernel/kernel.mk
include ${CHIBIOS}/test/test.mk
@@ -90,8 +92,8 @@ include ${CHIBIOS}/test/test.mk SRC = ${PORTSRC} \
${KERNSRC} \
${TESTSRC} \
- ${CHIBIOS}/os/io/serial.c \
- ${CHIBIOS}/os/io/platforms/AVR/serial_lld.c \
+ ${HALSRC} \
+ ${PLATFORMSRC} \
${CHIBIOS}/os/various/evtimer.c \
lcd.c board.c main.c
@@ -127,9 +129,7 @@ DEBUG = dwarf-2 # Each directory must be seperated by a space.
# Use forward slashes for directory separators.
# For a directory that has spaces, enclose it in quotes.
-EXTRAINCDIRS = $(PORTINC) $(KERNINC) $(TESTINC) \
- ${CHIBIOS}/os/io \
- ${CHIBIOS}/os/io/platforms/AVR \
+EXTRAINCDIRS = $(PORTINC) $(KERNINC) $(TESTINC) $(HALINC) $(PLATFORMINC) \
${CHIBIOS}/os/various
diff --git a/demos/AVR-ATmega128-GCC/board.c b/demos/AVR-ATmega128-GCC/board.c index 84e1565cb..8a9a69309 100644 --- a/demos/AVR-ATmega128-GCC/board.c +++ b/demos/AVR-ATmega128-GCC/board.c @@ -17,10 +17,8 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <serial.h>
-
-#include "board.h"
+#include "ch.h"
+#include "hal.h"
CH_IRQ_HANDLER(TIMER0_COMP_vect) {
@@ -71,16 +69,16 @@ void hwinit(void) { /*
* Timer 0 setup.
*/
- TCCR0 = (1 << WGM01) | (0 << WGM00) | // CTC mode.
- (0 << COM01) | (0 << COM00) | // OC0A disabled (normal I/O).
- (1 << CS02) | (0 << CS01) | (0 << CS00); // CLK/64 clock source.
+ TCCR0 = (1 << WGM01) | (0 << WGM00) | /* CTC mode. */
+ (0 << COM01) | (0 << COM00) | /* OC0A disabled. */
+ (1 << CS02) | (0 << CS01) | (0 << CS00); /* CLK/64 clock. */
OCR0 = F_CPU / 64 / CH_FREQUENCY - 1;
- TCNT0 = 0; // Reset counter.
- TIFR = (1 << OCF0); // Reset pending (if any).
- TIMSK = (1 << OCIE0); // Interrupt on compare.
+ TCNT0 = 0; /* Reset counter. */
+ TIFR = (1 << OCF0); /* Reset pending. */
+ TIMSK = (1 << OCIE0); /* IRQ on compare. */
/*
- * Other initializations.
+ * HAL initialization.
*/
- sdInit();
+ halInit();
}
diff --git a/demos/AVR-ATmega128-GCC/board.h b/demos/AVR-ATmega128-GCC/board.h index 97b9c684d..97da17097 100644 --- a/demos/AVR-ATmega128-GCC/board.h +++ b/demos/AVR-ATmega128-GCC/board.h @@ -105,6 +105,12 @@ #define PORTE_BUZZ1 (1 << 4)
#define PORTE_BUZZ2 (1 << 5)
-void hwinit(void);
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void hwinit(void);
+#ifdef __cplusplus
+}
+#endif
#endif /* _BOARD_H_ */
diff --git a/demos/AVR-ATmega128-GCC/halconf.h b/demos/AVR-ATmega128-GCC/halconf.h new file mode 100644 index 000000000..a3d17a3c9 --- /dev/null +++ b/demos/AVR-ATmega128-GCC/halconf.h @@ -0,0 +1,96 @@ +/*
+ 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_CONF
+ * @{
+ */
+
+/*
+ * HAL configuration file, this file allows to enable or disable the various
+ * device drivers from your application. You may also use this file in order
+ * to change the device drivers settings found in the low level drivers
+ * headers, just define here the new settings and those will override the
+ * defaults defined in the LLD headers. + */
+
+#ifndef _HALCONF_H_
+#define _HALCONF_H_
+
+/**
+ * @brief Enables the PAL subsystem. + */
+#if !defined(CH_HAL_USE_PAL) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PAL FALSE
+#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 FALSE
+#endif
+
+/**
+ * @brief Enables the PWM subsystem.
+ */
+#if !defined(CH_HAL_USE_PWM) || defined(__DOXYGEN__)
+#define CH_HAL_USE_PWM FALSE
+#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/AVR-ATmega128-GCC/main.c b/demos/AVR-ATmega128-GCC/main.c index dc3fd33c3..28d3f1cef 100644 --- a/demos/AVR-ATmega128-GCC/main.c +++ b/demos/AVR-ATmega128-GCC/main.c @@ -17,17 +17,12 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
-#include <ch.h>
-#include <serial.h>
-#include <evtimer.h>
+#include "ch.h"
+#include "hal.h"
+#include "evtimer.h"
-#include <avr/io.h>
-
-#include "board.h"
#include "lcd.h"
-void hwinit(void);
-
static WORKING_AREA(waThread1, 32);
static msg_t Thread1(void *arg) {
diff --git a/os/hal/platforms/AVR/hal_lld.c b/os/hal/platforms/AVR/hal_lld.c new file mode 100644 index 000000000..954b6f48a --- /dev/null +++ b/os/hal/platforms/AVR/hal_lld.c @@ -0,0 +1,57 @@ +/*
+ 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 AVR/hal_lld.c
+ * @brief AVR HAL subsystem low level driver code.
+ * @addtogroup AVR_HAL
+ * @{
+ */
+
+#include "ch.h"
+#include "hal.h"
+
+/*===========================================================================*/
+/* Low Level Driver exported variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Low Level Driver local variables. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Low Level Driver local functions. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Low Level Driver interrupt handlers. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Low Level Driver exported functions. */
+/*===========================================================================*/
+
+/**
+ * @brief Low level HAL driver initialization.
+ */
+void hal_lld_init(void) {
+
+}
+
+/** @} */
diff --git a/os/hal/platforms/AVR/hal_lld.h b/os/hal/platforms/AVR/hal_lld.h new file mode 100644 index 000000000..b0698e993 --- /dev/null +++ b/os/hal/platforms/AVR/hal_lld.h @@ -0,0 +1,60 @@ +/*
+ 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 AVR/hal_lld.h
+ * @brief AVR HAL subsystem low level driver header.
+ * @addtogroup AVR_HAL
+ * @{
+ */
+
+#ifndef _HAL_LLD_H_
+#define _HAL_LLD_H_
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void hal_lld_init(void);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _HAL_LLD_H_ */
+
+/** @} */
diff --git a/os/hal/platforms/AVR/platform.dox b/os/hal/platforms/AVR/platform.dox index 05eb4d76e..0302b83bb 100644 --- a/os/hal/platforms/AVR/platform.dox +++ b/os/hal/platforms/AVR/platform.dox @@ -25,6 +25,13 @@ */
/**
+ * @defgroup AVR_HAL AVR HAL Support
+ * @brief HAL support.
+ *
+ * @ingroup AVR_DRIVERS
+ */
+
+/**
* @defgroup AVR_SERIAL AVR USART Support
* @brief USART support.
* @details The serial driver supports both the AVR USARTs in asynchronous
diff --git a/os/hal/platforms/AVR/platform.mk b/os/hal/platforms/AVR/platform.mk new file mode 100644 index 000000000..fdc5390bb --- /dev/null +++ b/os/hal/platforms/AVR/platform.mk @@ -0,0 +1,6 @@ +# List of all the AVR platform files.
+PLATFORMSRC = ${CHIBIOS}/os/hal/platforms/AVR/hal_lld.c \
+ ${CHIBIOS}/os/hal/platforms/AVR/serial_lld.c
+
+# Required include directories
+PLATFORMINC = ${CHIBIOS}/os/hal/platforms/AVR
diff --git a/os/hal/platforms/AVR/serial_lld.c b/os/hal/platforms/AVR/serial_lld.c index 0acf15700..1f1bef013 100644 --- a/os/hal/platforms/AVR/serial_lld.c +++ b/os/hal/platforms/AVR/serial_lld.c @@ -19,13 +19,15 @@ /**
* @file AVR/serial_lld.c
- * @brief AVR low level serial driver code
+ * @brief AVR low level serial driver code.
* @addtogroup AVR_SERIAL
* @{
*/
-#include <ch.h>
-#include <serial.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
#if USE_AVR_USART0 || defined(__DOXYGEN__)
/**
@@ -253,4 +255,6 @@ void sd_lld_stop(SerialDriver *sdp) { #endif
}
+#endif /* CH_HAL_USE_SERIAL */
+
/** @} */
diff --git a/os/hal/platforms/AVR/serial_lld.h b/os/hal/platforms/AVR/serial_lld.h index c1889f8b5..266bf2a32 100644 --- a/os/hal/platforms/AVR/serial_lld.h +++ b/os/hal/platforms/AVR/serial_lld.h @@ -19,7 +19,7 @@ /**
* @file AVR/serial_lld.h
- * @brief AVR low level serial driver header
+ * @brief AVR low level serial driver header.
* @addtogroup AVR_SERIAL
* @{
*/
@@ -27,6 +27,8 @@ #ifndef _SERIAL_LLD_H_
#define _SERIAL_LLD_H_
+#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -156,6 +158,8 @@ extern "C" { #endif
/** @endcond*/
+#endif /* CH_HAL_USE_SERIAL */
+
#endif /* _SERIAL_LLD_H_ */
/** @} */
diff --git a/os/hal/templates/hal_lld.h b/os/hal/templates/hal_lld.h index c6dd6e6f7..e8ab84e0a 100644 --- a/os/hal/templates/hal_lld.h +++ b/os/hal/templates/hal_lld.h @@ -27,6 +27,8 @@ #ifndef _HAL_LLD_H_
#define _HAL_LLD_H_
+#include "avr/io.h"
+
/*===========================================================================*/
/* Driver constants. */
/*===========================================================================*/
|