diff options
Diffstat (limited to 'os')
-rw-r--r-- | os/io/templates/adc_lld.c | 8 | ||||
-rw-r--r-- | os/io/templates/adc_lld.h | 4 | ||||
-rw-r--r-- | os/io/templates/can_lld.c | 12 | ||||
-rw-r--r-- | os/io/templates/can_lld.h | 24 | ||||
-rw-r--r-- | os/io/templates/hal_lld.c | 57 | ||||
-rw-r--r-- | os/io/templates/hal_lld.h | 56 | ||||
-rw-r--r-- | os/io/templates/halconf.h | 88 | ||||
-rw-r--r-- | os/io/templates/mac_lld.c | 8 | ||||
-rw-r--r-- | os/io/templates/mac_lld.h | 4 | ||||
-rw-r--r-- | os/io/templates/meta/driver.c | 87 | ||||
-rw-r--r-- | os/io/templates/meta/driver.h | 54 | ||||
-rw-r--r-- | os/io/templates/meta/driver_lld.c | 79 | ||||
-rw-r--r-- | os/io/templates/meta/driver_lld.h | 81 | ||||
-rw-r--r-- | os/io/templates/mii_lld.c | 6 | ||||
-rw-r--r-- | os/io/templates/pal_lld.c | 28 | ||||
-rw-r--r-- | os/io/templates/pal_lld.h | 4 | ||||
-rw-r--r-- | os/io/templates/serial_lld.c | 8 | ||||
-rw-r--r-- | os/io/templates/serial_lld.h | 4 | ||||
-rw-r--r-- | os/io/templates/spi_lld.c | 8 | ||||
-rw-r--r-- | os/io/templates/spi_lld.h | 4 |
20 files changed, 605 insertions, 19 deletions
diff --git a/os/io/templates/adc_lld.c b/os/io/templates/adc_lld.c index 31fd64691..9aabc4bcd 100644 --- a/os/io/templates/adc_lld.c +++ b/os/io/templates/adc_lld.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <adc.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_ADC
/*===========================================================================*/
/* Low Level Driver exported variables. */
@@ -94,4 +96,6 @@ void adc_lld_stop_conversion(ADCDriver *adcp) { }
+#endif /* CH_HAL_USE_ADC */
+
/** @} */
diff --git a/os/io/templates/adc_lld.h b/os/io/templates/adc_lld.h index b229a5f2d..ca14577f0 100644 --- a/os/io/templates/adc_lld.h +++ b/os/io/templates/adc_lld.h @@ -27,6 +27,8 @@ #ifndef _ADC_LLD_H_
#define _ADC_LLD_H_
+#if CH_HAL_USE_ADC
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -132,6 +134,8 @@ extern "C" { }
#endif
+#endif /* CH_HAL_USE_ADC */
+
#endif /* _ADC_LLD_H_ */
/** @} */
diff --git a/os/io/templates/can_lld.c b/os/io/templates/can_lld.c index e1c4243b0..7c56acad1 100644 --- a/os/io/templates/can_lld.c +++ b/os/io/templates/can_lld.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <can.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_CAN
/*===========================================================================*/
/* Low Level Driver exported variables. */
@@ -87,7 +89,7 @@ void can_lld_stop(CANDriver *canp) { */
bool_t can_lld_can_transmit(CANDriver *canp) {
- return false;
+ return FALSE;
}
/**
@@ -115,7 +117,7 @@ msg_t can_lld_transmit(CANDriver *canp, const CANFrame *cfp) { */
bool_t can_lld_can_receive(CANDriver *canp) {
- return false;
+ return FALSE;
}
/**
@@ -152,4 +154,6 @@ void can_lld_wakeup(CANDriver *canp) { }
#endif /* CAN_USE_SLEEP_MODE */
+#endif /* CH_HAL_USE_CAN */
+
/** @} */
diff --git a/os/io/templates/can_lld.h b/os/io/templates/can_lld.h index fcd8631a9..c899055c6 100644 --- a/os/io/templates/can_lld.h +++ b/os/io/templates/can_lld.h @@ -27,6 +27,8 @@ #ifndef _CAN_LLD_H_
#define _CAN_LLD_H_
+#if CH_HAL_USE_CAN
+
/**
* @brief This switch defines whether the driver implementation supports
* a low power switch mode with automatic an wakeup feature. @@ -59,11 +61,27 @@ /*===========================================================================*/
/**
+ * @brief CAN frame.
+ * @note Accessing the frame data as word16 or word32 is not portable because
+ * machine data endianness, it can be still useful for a quick filling. + */
+typedef struct {
+ uint8_t cf_DLC:4; /**< @brief Data length. */
+ uint8_t cf_IDE:1; /**< @brief Identifier type. */
+ uint8_t cf_RTR:1; /**< @brief Frame type. */
+ uint32_t cf_id; /**< @brief Frame identifier. */
+ union {
+ uint8_t cf_data8[8]; /**< @brief Frame data. */
+ uint16_t cf_data16[4]; /**< @brief Frame data. */
+ uint32_t cf_data32[2]; /**< @brief Frame data. */
+ };
+} CANFrame;
+
+/**
* @brief Driver configuration structure.
* @note It could be empty on some architectures.
*/
typedef struct {
-
} CANConfig;
/**
@@ -94,7 +112,7 @@ typedef struct { * @brief One or more transmission slots become available. */
EventSource can_txempty_event;
-#if CAN_USE_SLEEP_MODE || defined __DOXYGEN__)
+#if CAN_USE_SLEEP_MODE || defined (__DOXYGEN__)
/**
* @brief Entering sleep state event. */
@@ -129,6 +147,8 @@ extern "C" { }
#endif
+#endif /* CH_HAL_USE_CAN */
+
#endif /* _CAN_LLD_H_ */
/** @} */
diff --git a/os/io/templates/hal_lld.c b/os/io/templates/hal_lld.c new file mode 100644 index 000000000..0d2d46dcc --- /dev/null +++ b/os/io/templates/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 templates/hal_lld.c
+ * @brief HAL Driver subsystem low level driver source template
+ * @addtogroup HAL_LLD
+ * @{
+ */
+
+#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/io/templates/hal_lld.h b/os/io/templates/hal_lld.h new file mode 100644 index 000000000..b401e4217 --- /dev/null +++ b/os/io/templates/hal_lld.h @@ -0,0 +1,56 @@ +/*
+ 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/hal_lld.h
+ * @brief HAL subsystem low level driver header template
+ * @addtogroup HAL_LLD
+ * @{
+ */
+
+#ifndef _HAL_LLD_H_
+#define _HAL_LLD_H_
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* 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/io/templates/halconf.h b/os/io/templates/halconf.h new file mode 100644 index 000000000..f08ffcda5 --- /dev/null +++ b/os/io/templates/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_CONF
+ * @{
+ */
+
+#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 TRUE
+#endif
+
+/**
+ * @brief Enables the CAN subsystem.
+ */
+#if !defined(CH_HAL_USE_CAN) || defined(__DOXYGEN__)
+#define CH_HAL_USE_CAN TRUE
+#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 TRUE
+#endif
+
+/**
+ * @brief Enables the MMC_SPI subsystem.
+ */
+#if !defined(CH_HAL_USE_MMC_SPI) || defined(__DOXYGEN__)
+#define CH_HAL_USE_MMC_SPI TRUE
+#endif
+
+#endif /* _HALCONF_H_ */
+
+/** @} */
diff --git a/os/io/templates/mac_lld.c b/os/io/templates/mac_lld.c index 08ffa8d79..fa6ef7a9e 100644 --- a/os/io/templates/mac_lld.c +++ b/os/io/templates/mac_lld.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <mac.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_MAC
/**
* @brief Low level MAC initialization. @@ -146,4 +148,6 @@ bool_t mac_lld_poll_link_status(MACDriver *macp) { return FALSE;
}
+#endif /* CH_HAL_USE_MAC */
+
/** @} */
diff --git a/os/io/templates/mac_lld.h b/os/io/templates/mac_lld.h index 2b6e19c26..07a199f7e 100644 --- a/os/io/templates/mac_lld.h +++ b/os/io/templates/mac_lld.h @@ -27,6 +27,8 @@ #ifndef _MAC_LLD_H_
#define _MAC_LLD_H_
+#if CH_HAL_USE_MAC
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -112,6 +114,8 @@ extern "C" { }
#endif
+#endif /* CH_HAL_USE_MAC */
+
#endif /* _MAC_LLD_H_ */
/** @} */
diff --git a/os/io/templates/meta/driver.c b/os/io/templates/meta/driver.c new file mode 100644 index 000000000..9bf785ed2 --- /dev/null +++ b/os/io/templates/meta/driver.c @@ -0,0 +1,87 @@ +/*
+ 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 XXX.c
+ * @brief XXX Driver code.
+ * @addtogroup XXX
+ * @{
+ */
+
+#include <ch.h>
+#include <xxx.h>
+
+/**
+ * @brief XXX Driver initialization.
+ */
+void xxxInit(void) {
+
+ xxx_lld_init();
+}
+
+/**
+ * @brief Initializes the standard part of a @p XXXDriver structure.
+ *
+ * @param[in] xxxp pointer to the @p XXXDriver object
+ */
+void xxxObjectInit(XXXDriver *xxxp) {
+
+ xxxp->xxx_state = XXX_STOP;
+ xxxp->xxx_config = NULL;
+}
+
+/**
+ * @brief Configures and activates the XXX peripheral.
+ *
+ * @param[in] xxxp pointer to the @p XXXDriver object
+ * @param[in] config pointer to the @p XXXConfig object
+ */
+void xxxStart(XXXDriver *xxxp, const XXXConfig *config) {
+
+ chDbgCheck((xxxp != NULL) && (config != NULL), "xxxStart");
+
+ chSysLock();
+ chDbgAssert((xxxp->xxx_state == XXX_STOP) || (xxxp->xxx_state == XXX_READY),
+ "xxxStart(), #1",
+ "invalid state");
+ xxxp->xxx_config = config;
+ xxx_lld_start(xxxp);
+ xxxp->xxx_state = XXX_READY;
+ chSysUnlock();
+}
+
+/**
+ * @brief Deactivates the XXX peripheral.
+ *
+ * @param[in] xxxp pointer to the @p XXXDriver object
+ */
+void xxxStop(XXXDriver *xxxp) {
+
+ chDbgCheck(xxxp != NULL, "xxxStop");
+
+ chSysLock();
+ chDbgAssert((xxxp->xxx_state == XXX_STOP) || (xxxp->xxx_state == XXX_READY),
+ "xxxStop(), #1",
+ "invalid state");
+ xxx_lld_stop(xxxp);
+ xxxp->xxx_state = XXX_STOP;
+ chSysUnlock();
+}
+
+/** @} */
diff --git a/os/io/templates/meta/driver.h b/os/io/templates/meta/driver.h new file mode 100644 index 000000000..675bc6689 --- /dev/null +++ b/os/io/templates/meta/driver.h @@ -0,0 +1,54 @@ +/*
+ 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 xxx.h
+ * @brief XXX Driver macros and structures.
+ * @addtogroup XXX
+ * @{
+ */
+
+#ifndef _XXX_H_
+#define _XXX_H_
+
+/**
+ * @brief Driver state machine possible states.
+ */
+typedef enum {
+ XXX_UNINIT = 0, /**< @brief Not initialized. */
+ XXX_STOP = 1, /**< @brief Stopped. */
+ XXX_READY = 2, /**< @brief Ready. */
+} xxxstate_t;
+
+#include "xxx_lld.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void xxxInit(void);
+ void xxxObjectInit(XXXDriver *xxxp);
+ void xxxStart(XXXDriver *xxxp, const XXXConfig *config);
+ void xxxStop(XXXDriver *xxxp);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XXX_H_ */
+
+/** @} */
diff --git a/os/io/templates/meta/driver_lld.c b/os/io/templates/meta/driver_lld.c new file mode 100644 index 000000000..df91ed21b --- /dev/null +++ b/os/io/templates/meta/driver_lld.c @@ -0,0 +1,79 @@ +/*
+ 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/xxx_lld.c
+ * @brief XXX Driver subsystem low level driver source template
+ * @addtogroup XXX_LLD
+ * @{
+ */
+
+#include <ch.h>
+#include <xxx.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 XXX driver initialization.
+ */
+void xxx_lld_init(void) {
+
+}
+
+/**
+ * @brief Configures and activates the XXX peripheral.
+ *
+ * @param[in] xxxp pointer to the @p XXXDriver object
+ */
+void xxx_lld_start(XXXDriver *xxxp) {
+
+ if (xxxp->xxx_state == XXX_STOP) {
+ /* Clock activation.*/
+ }
+ /* Configuration.*/
+}
+
+/**
+ * @brief Deactivates the XXX peripheral.
+ *
+ * @param[in] xxxp pointer to the @p XXXDriver object
+ */
+void xxx_lld_stop(XXXDriver *xxxp) {
+
+}
+
+/** @} */
diff --git a/os/io/templates/meta/driver_lld.h b/os/io/templates/meta/driver_lld.h new file mode 100644 index 000000000..92194664e --- /dev/null +++ b/os/io/templates/meta/driver_lld.h @@ -0,0 +1,81 @@ +/*
+ 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/xxx_lld.h
+ * @brief XXX Driver subsystem low level driver header template
+ * @addtogroup XXX_LLD
+ * @{
+ */
+
+#ifndef _XXX_LLD_H_
+#define _XXX_LLD_H_
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+/**
+ * @brief Driver configuration structure.
+ * @note It could be empty on some architectures.
+ */
+typedef struct {
+
+} XXXConfig;
+
+/**
+ * @brief Structure representing an XXX driver.
+ */
+typedef struct {
+ /**
+ * @brief Driver state.
+ */
+ xxxstate_t xxx_state;
+ /**
+ * @brief Current configuration data.
+ */
+ const XXXConfig *xxx_config;
+ /* End of the mandatory fields.*/
+} XXXDriver;
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void xxx_lld_init(void);
+ void xxx_lld_start(XXXDriver *xxxp);
+ void xxx_lld_stop(XXXDriver *xxxp);
+#ifdef __cplusplus
+}
+#endif
+
+#endif /* _XXX_LLD_H_ */
+
+/** @} */
diff --git a/os/io/templates/mii_lld.c b/os/io/templates/mii_lld.c index 2149ebec3..2381c4f1e 100644 --- a/os/io/templates/mii_lld.c +++ b/os/io/templates/mii_lld.c @@ -24,9 +24,9 @@ * @{
*/
-#include <ch.h>
-#include <mac.h>
-#include <mii.h>
+#include "ch.h"
+#include "mac.h"
+#include "mii.h"
/**
* @brief Low level MII driver initialization.
diff --git a/os/io/templates/pal_lld.c b/os/io/templates/pal_lld.c index 547db75b6..598832d09 100644 --- a/os/io/templates/pal_lld.c +++ b/os/io/templates/pal_lld.c @@ -24,7 +24,31 @@ * @{
*/
-#include <ch.h>
-#include <pal.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_PAL
+
+/*===========================================================================*/
+/* 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. */
+/*===========================================================================*/
+
+#endif /* CH_HAL_USE_PAL */
/** @} */
diff --git a/os/io/templates/pal_lld.h b/os/io/templates/pal_lld.h index 84e09a220..a8caf089b 100644 --- a/os/io/templates/pal_lld.h +++ b/os/io/templates/pal_lld.h @@ -27,6 +27,8 @@ #ifndef _PAL_LLD_H_
#define _PAL_LLD_H_
+#if CH_HAL_USE_PAL
+
/*===========================================================================*/
/* Unsupported modes and specific modes */
/*===========================================================================*/
@@ -317,6 +319,8 @@ typedef uint32_t ioportid_t; */
#define pal_lld_setpadmode(port, pad, mode)
+#endif /* CH_HAL_USE_PAL */
+
#endif /* _PAL_LLD_H_ */
/** @} */
diff --git a/os/io/templates/serial_lld.c b/os/io/templates/serial_lld.c index 8e2ba707e..c4d63ed76 100644 --- a/os/io/templates/serial_lld.c +++ b/os/io/templates/serial_lld.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <serial.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_SERIAL
/** @brief Driver default configuration.*/
static const SerialDriverConfig default_config = {
@@ -84,4 +86,6 @@ void sd_lld_stop(SerialDriver *sdp) { }
+#endif /* CH_HAL_USE_SERIAL */
+
/** @} */
diff --git a/os/io/templates/serial_lld.h b/os/io/templates/serial_lld.h index 098fc5403..53cf2ce25 100644 --- a/os/io/templates/serial_lld.h +++ b/os/io/templates/serial_lld.h @@ -27,6 +27,8 @@ #ifndef _SERIAL_LLD_H_
#define _SERIAL_LLD_H_
+#if CH_HAL_USE_SERIAL
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -104,6 +106,8 @@ extern "C" { }
#endif
+#endif /* CH_HAL_USE_SERIAL */
+
#endif /* _SERIAL_LLD_H_ */
/** @} */
diff --git a/os/io/templates/spi_lld.c b/os/io/templates/spi_lld.c index 8e9a14b6a..5fd6295d2 100644 --- a/os/io/templates/spi_lld.c +++ b/os/io/templates/spi_lld.c @@ -24,8 +24,10 @@ * @{
*/
-#include <ch.h>
-#include <spi.h>
+#include "ch.h"
+#include "hal.h"
+
+#if CH_HAL_USE_SPI
/*===========================================================================*/
/* Low Level Driver exported variables. */
@@ -153,4 +155,6 @@ void spi_lld_receive(SPIDriver *spip, size_t n, void *rxbuf) { }
+#endif /* CH_HAL_USE_SPI */
+
/** @} */
diff --git a/os/io/templates/spi_lld.h b/os/io/templates/spi_lld.h index 5246225d7..907bad859 100644 --- a/os/io/templates/spi_lld.h +++ b/os/io/templates/spi_lld.h @@ -27,6 +27,8 @@ #ifndef _SPI_LLD_H_
#define _SPI_LLD_H_
+#if CH_HAL_USE_SPI
+
/*===========================================================================*/
/* Driver pre-compile time settings. */
/*===========================================================================*/
@@ -99,6 +101,8 @@ extern "C" { }
#endif
+#endif /* CH_HAL_USE_SPI */
+
#endif /* _SPI_LLD_H_ */
/** @} */
|