diff options
Diffstat (limited to 'os/hal/templates/hal_spi_lld.h')
-rw-r--r-- | os/hal/templates/hal_spi_lld.h | 94 |
1 files changed, 7 insertions, 87 deletions
diff --git a/os/hal/templates/hal_spi_lld.h b/os/hal/templates/hal_spi_lld.h index e939c3955..ad3939c9b 100644 --- a/os/hal/templates/hal_spi_lld.h +++ b/os/hal/templates/hal_spi_lld.h @@ -62,99 +62,19 @@ /* Driver data structures and types. */
/*===========================================================================*/
-/**
- * @brief Type of a structure representing an SPI driver.
- */
-typedef struct SPIDriver SPIDriver;
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
/**
- * @brief SPI notification callback type.
- *
- * @param[in] spip pointer to the @p SPIDriver object triggering the
- * callback
+ * @brief Low level fields of the SPI driver structure.
*/
-typedef void (*spicallback_t)(SPIDriver *spip);
+#define spi_lld_driver_fields
/**
- * @brief Driver configuration structure.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
+ * @brief Low level fields of the SPI configuration structure.
*/
-typedef struct {
-#if (SPI_SUPPORTS_CIRCULAR == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Enables the circular buffer mode.
- */
- bool circular;
-#endif
- /**
- * @brief Operation complete callback or @p NULL.
- */
- spicallback_t end_cb;
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_LINE) || defined(__DOXYGEN__)
- /**
- * @brief The chip select line.
- */
- ioline_t ssline;
-#endif
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PORT) || defined(__DOXYGEN__)
- /**
- * @brief The chip select port.
- */
- ioportid_t ssport;
- /**
- * @brief The chip select port mask.
- */
- ioportmask_t ssmask;
-#endif
-#if (SPI_SELECT_MODE == SPI_SELECT_MODE_PAD) || defined(__DOXYGEN__)
- /**
- * @brief The chip select port.
- */
- ioportid_t ssport;
- /**
- * @brief The chip select pad number.
- */
- uint_fast8_t sspad;
-#endif
- /* End of the mandatory fields.*/
-} SPIConfig;
-
-/**
- * @brief Structure representing an SPI driver.
- * @note Implementations may extend this structure to contain more,
- * architecture dependent, fields.
- */
-struct SPIDriver {
- /**
- * @brief Driver state.
- */
- spistate_t state;
- /**
- * @brief Current configuration data.
- */
- const SPIConfig *config;
-#if (SPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Waiting thread.
- */
- thread_reference_t thread;
-#endif
-#if (SPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Mutex protecting the peripheral.
- */
- mutex_t mutex;
-#endif
-#if defined(SPI_DRIVER_EXT_FIELDS)
- SPI_DRIVER_EXT_FIELDS
-#endif
- /* End of the mandatory fields.*/
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+#define spi_lld_config_fields
/*===========================================================================*/
/* External declarations. */
|