aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/include
diff options
context:
space:
mode:
Diffstat (limited to 'os/hal/include')
-rw-r--r--os/hal/include/adc.h24
-rw-r--r--os/hal/include/can.h30
-rw-r--r--os/hal/include/mac.h24
-rw-r--r--os/hal/include/mmc_spi.h44
-rw-r--r--os/hal/include/pal.h64
-rw-r--r--os/hal/include/pwm.h24
-rw-r--r--os/hal/include/serial.h54
-rw-r--r--os/hal/include/spi.h24
8 files changed, 232 insertions, 56 deletions
diff --git a/os/hal/include/adc.h b/os/hal/include/adc.h
index 685c4049f..2aa0c41c5 100644
--- a/os/hal/include/adc.h
+++ b/os/hal/include/adc.h
@@ -29,10 +29,26 @@
#if CH_HAL_USE_ADC || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
#if !CH_USE_SEMAPHORES
#error "ADC driver requires CH_USE_SEMAPHORES"
#endif
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Driver state machine possible states.
*/
@@ -46,6 +62,14 @@ typedef enum {
#include "adc_lld.h"
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/can.h b/os/hal/include/can.h
index 8f2a7572d..2a0d1e4df 100644
--- a/os/hal/include/can.h
+++ b/os/hal/include/can.h
@@ -29,9 +29,9 @@
#if CH_HAL_USE_CAN || defined(__DOXYGEN__)
-#if !CH_USE_SEMAPHORES
-#error "CAN driver requires CH_USE_SEMAPHORES"
-#endif
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
/**
* @brief Errors rate warning.
@@ -54,6 +54,22 @@
*/
#define CAN_OVERFLOW_ERROR 16
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+#if !CH_USE_SEMAPHORES
+#error "CAN driver requires CH_USE_SEMAPHORES"
+#endif
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Driver state machine possible states.
*/
@@ -67,6 +83,10 @@ typedef enum {
#include "can_lld.h"
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
/**
* @brief Adds some flags to the CAN status mask.
*
@@ -75,6 +95,10 @@ typedef enum {
*/
#define canAddFlagsI(canp, mask) ((canp)->cd_status |= (mask))
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/mac.h b/os/hal/include/mac.h
index c07d6029d..0d7a3d76e 100644
--- a/os/hal/include/mac.h
+++ b/os/hal/include/mac.h
@@ -29,8 +29,28 @@
#if CH_HAL_USE_MAC || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
#include "mac_lld.h"
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
/**
* @brief Returns the received frames event source.
*
@@ -67,6 +87,10 @@
#define macReadReceiveDescriptor(rdp, buf, size) \
mac_lld_read_receive_descriptor(rdp, buf, size)
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/mmc_spi.h b/os/hal/include/mmc_spi.h
index 2a9fd0c53..da2ed573c 100644
--- a/os/hal/include/mmc_spi.h
+++ b/os/hal/include/mmc_spi.h
@@ -29,9 +29,23 @@
#if CH_HAL_USE_MMC_SPI || defined(__DOXYGEN__)
-#if !CH_USE_EVENTS
-#error "MMC_SPI driver requires CH_USE_EVENTS"
-#endif
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+#define MMC_CMD0_RETRY 10
+#define MMC_CMD1_RETRY 100
+#define MMC_WAIT_DATA 10000
+
+#define MMC_CMDGOIDLE 0
+#define MMC_CMDINIT 1
+#define MMC_CMDREADCSD 9
+#define MMC_CMDSTOP 12
+#define MMC_CMDSETBLOCKLEN 16
+#define MMC_CMDREAD 17
+#define MMC_CMDREADMULTIPLE 18
+#define MMC_CMDWRITE 24
+#define MMC_CMDWRITEMULTIPLE 25
/*===========================================================================*/
/* Driver pre-compile time settings. */
@@ -72,22 +86,12 @@
#endif
/*===========================================================================*/
-/* Driver constants. */
+/* Derived constants and error checks. */
/*===========================================================================*/
-#define MMC_CMD0_RETRY 10
-#define MMC_CMD1_RETRY 100
-#define MMC_WAIT_DATA 10000
-
-#define MMC_CMDGOIDLE 0
-#define MMC_CMDINIT 1
-#define MMC_CMDREADCSD 9
-#define MMC_CMDSTOP 12
-#define MMC_CMDSETBLOCKLEN 16
-#define MMC_CMDREAD 17
-#define MMC_CMDREADMULTIPLE 18
-#define MMC_CMDWRITE 24
-#define MMC_CMDWRITEMULTIPLE 25
+#if !CH_USE_EVENTS
+#error "MMC_SPI driver requires CH_USE_EVENTS"
+#endif
/*===========================================================================*/
/* Driver data structures and types. */
@@ -171,7 +175,7 @@ typedef struct {
} MMCDriver;
/*===========================================================================*/
-/* External declarations. */
+/* Driver macros. */
/*===========================================================================*/
/**
@@ -184,6 +188,10 @@ typedef struct {
*/
#define mmcIsWriteProtected(mmcp) ((mmcp)->mmc_is_protected())
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/pal.h b/os/hal/include/pal.h
index 5b3e01214..ead0a4c33 100644
--- a/os/hal/include/pal.h
+++ b/os/hal/include/pal.h
@@ -29,6 +29,10 @@
#if CH_HAL_USE_PAL || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
/**
* @brief Bits in a mode word dedicated as mode selector.
* @details The other bits are not defined and may be used as device-specific
@@ -83,10 +87,8 @@
*/
#define PAL_MODE_OUTPUT_OPENDRAIN 7
-#include "pal_lld.h"
-
/**
- * @brief Logical low state.
+ * @brief Logical low state.
*/
#define PAL_LOW 0
@@ -95,6 +97,41 @@
*/
#define PAL_HIGH 1
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
+#include "pal_lld.h"
+
+/**
+ * @brief I/O bus descriptor.
+ * @details This structure describes a group of contiguous digital I/O lines
+ * that have to be handled as bus.
+ * @note I/O operations on a bus do not affect I/O lines on the same port but
+ * not belonging to the bus.
+ */
+typedef struct {
+ /** Port identifier.*/
+ ioportid_t bus_portid;
+ /** Bus mask aligned to port bit 0. The bus mask implicitly define the bus
+ width. A logical AND is performed on the bus data.*/
+ ioportmask_t bus_mask;
+ /** Offset, within the port, of the least significant bit of the bus.*/
+ uint_fast8_t bus_offset;
+} IOBus;
+
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
/**
* @brief Port bit helper macro.
* @details This macro calculates the mask of a bit within a port.
@@ -139,23 +176,6 @@
IOBus name = _IOBUS_DATA(name, port, width, offset)
/**
- * @brief I/O bus descriptor.
- * @details This structure describes a group of contiguous digital I/O lines
- * that have to be handled as bus.
- * @note I/O operations on a bus do not affect I/O lines on the same port but
- * not belonging to the bus.
- */
-typedef struct {
- /** Port identifier.*/
- ioportid_t bus_portid;
- /** Bus mask aligned to port bit 0. The bus mask implicitly define the bus
- width. A logical AND is performed on the bus data.*/
- ioportmask_t bus_mask;
- /** Offset, within the port, of the least significant bit of the bus.*/
- uint_fast8_t bus_offset;
-} IOBus;
-
-/**
* @brief PAL subsystem initialization.
*
* @param[in] config pointer to an architecture specific configuration
@@ -452,6 +472,10 @@ typedef struct {
#define palSetPadMode(port, pad, mode) pal_lld_setpadmode(port, pad, mode)
#endif
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/pwm.h b/os/hal/include/pwm.h
index 9cb6ce4c4..64b563164 100644
--- a/os/hal/include/pwm.h
+++ b/os/hal/include/pwm.h
@@ -29,6 +29,22 @@
#if CH_HAL_USE_PWM || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Driver state machine possible states.
*/
@@ -57,6 +73,14 @@ typedef void (*pwmcallback_t)(void);
#include "pwm_lld.h"
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif
diff --git a/os/hal/include/serial.h b/os/hal/include/serial.h
index 3623fa7e5..6f80985ab 100644
--- a/os/hal/include/serial.h
+++ b/os/hal/include/serial.h
@@ -29,6 +29,10 @@
#if CH_HAL_USE_SERIAL || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
/** No pending conditions.*/
#define SD_NO_ERROR 0
/** Connection happened.*/
@@ -44,6 +48,18 @@
/** Break detected.*/
#define SD_BREAK_DETECTED 32
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Structure representing a serial driver.
*/
@@ -101,23 +117,12 @@ struct _SerialDriver {
struct _serial_driver_data d2;
};
-#ifdef __cplusplus
-extern "C" {
-#endif
- void sdInit(void);
- void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify);
- void sdStart(SerialDriver *sdp, const SerialDriverConfig *config);
- void sdStop(SerialDriver *sdp);
- void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
- msg_t sdRequestDataI(SerialDriver *sdp);
- void sdAddFlagsI(SerialDriver *sdp, sdflags_t mask);
- sdflags_t sdGetAndClearFlags(SerialDriver *sdp);
-#ifdef __cplusplus
-}
-#endif
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
/**
- * @brief Direct output check on a @p SerialDriver.
+ * @brief Direct output check on a @p SerialDriver.
* @details This function bypasses the indirect access to the channel and
* checks directly the output queue. This is faster but cannot
* be used to check different channels implementations.
@@ -190,6 +195,25 @@ extern "C" {
*/
#define sdRead(sdp, b, n) chIQRead(&(sdp)->d2.iqueue, b, n)
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+ void sdInit(void);
+ void sdObjectInit(SerialDriver *sdp, qnotify_t inotify, qnotify_t onotify);
+ void sdStart(SerialDriver *sdp, const SerialDriverConfig *config);
+ void sdStop(SerialDriver *sdp);
+ void sdIncomingDataI(SerialDriver *sdp, uint8_t b);
+ msg_t sdRequestDataI(SerialDriver *sdp);
+ void sdAddFlagsI(SerialDriver *sdp, sdflags_t mask);
+ sdflags_t sdGetAndClearFlags(SerialDriver *sdp);
+#ifdef __cplusplus
+}
+#endif
+
#endif /* CH_HAL_USE_SERIAL */
#endif /* _SERIAL_H_ */
diff --git a/os/hal/include/spi.h b/os/hal/include/spi.h
index 5d1355106..6e1df95bd 100644
--- a/os/hal/include/spi.h
+++ b/os/hal/include/spi.h
@@ -29,6 +29,14 @@
#if CH_HAL_USE_SPI || defined(__DOXYGEN__)
+/*===========================================================================*/
+/* Driver constants. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* Driver pre-compile time settings. */
+/*===========================================================================*/
+
/**
* @brief Enables the mutual exclusion APIs on the SPI bus.
*/
@@ -36,10 +44,18 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif
+/*===========================================================================*/
+/* Derived constants and error checks. */
+/*===========================================================================*/
+
#if SPI_USE_MUTUAL_EXCLUSION && !CH_USE_MUTEXES && !CH_USE_SEMAPHORES
#error "SPI_USE_MUTUAL_EXCLUSION requires CH_USE_MUTEXES and/or CH_USE_SEMAPHORES"
#endif
+/*===========================================================================*/
+/* Driver data structures and types. */
+/*===========================================================================*/
+
/**
* @brief Driver state machine possible states.
*/
@@ -52,6 +68,14 @@ typedef enum {
#include "spi_lld.h"
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
+/*===========================================================================*/
+/* External declarations. */
+/*===========================================================================*/
+
#ifdef __cplusplus
extern "C" {
#endif