diff options
author | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-12-09 09:11:21 +0000 |
---|---|---|
committer | Giovanni Di Sirio <gdisirio@gmail.com> | 2018-12-09 09:11:21 +0000 |
commit | 964ca6029035706e5ba5be7a8304eba67920386d (patch) | |
tree | 33dd1e258a78ff1c40f10bfdcb7c394678f0d84e /os/hal/templates | |
parent | 584f19dbe94ea1ad9585ce04c5f1d5b424ebaa09 (diff) | |
download | ChibiOS-964ca6029035706e5ba5be7a8304eba67920386d.tar.gz ChibiOS-964ca6029035706e5ba5be7a8304eba67920386d.tar.bz2 ChibiOS-964ca6029035706e5ba5be7a8304eba67920386d.zip |
DAC reworked, fixed a problem in WSPI template.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12466 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/templates')
-rw-r--r-- | os/hal/templates/hal_dac_lld.h | 98 | ||||
-rw-r--r-- | os/hal/templates/hal_wspi_lld.h | 47 |
2 files changed, 19 insertions, 126 deletions
diff --git a/os/hal/templates/hal_dac_lld.h b/os/hal/templates/hal_dac_lld.h index 541ddc535..12f2760c4 100644 --- a/os/hal/templates/hal_dac_lld.h +++ b/os/hal/templates/hal_dac_lld.h @@ -68,11 +68,6 @@ typedef uint32_t dacchannel_t;
/**
- * @brief Type of a structure representing an DAC driver.
- */
-typedef struct DACDriver DACDriver;
-
-/**
* @brief Type representing a DAC sample.
*/
typedef uint16_t dacsample_t;
@@ -87,97 +82,26 @@ typedef enum { DAC_ERR_UNDERFLOW = 1 /**< DAC overflow condition. */
} dacerror_t;
-/**
- * @brief DAC notification callback type.
- *
- * @param[in] dacp pointer to the @p DACDriver object triggering the
- * @param[in] buffer pointer to the next semi-buffer to be filled
- * @param[in] n number of buffer rows available starting from @p buffer
- * callback
- */
-typedef void (*daccallback_t)(DACDriver *dacp, dacsample_t *buffer, size_t n);
-
-/**
- * @brief DAC error callback type.
- *
- * @param[in] dacp pointer to the @p DACDriver object triggering the
- * callback
- * @param[in] err DAC error code
- */
-typedef void (*dacerrorcallback_t)(DACDriver *dacp, dacerror_t err);
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
/**
- * @brief DAC Conversion group structure.
+ * @brief Low level fields of the DAC driver structure.
*/
-typedef struct {
- /**
- * @brief Number of DAC channels.
- */
- uint32_t num_channels;
- /**
- * @brief Operation complete callback or @p NULL.
- */
- daccallback_t end_cb;
- /**
- * @brief Error handling callback or @p NULL.
- */
- dacerrorcallback_t error_cb;
- /* End of the mandatory fields.*/
-} DACConversionGroup;
+#define dac_lld_driver_fields
/**
- * @brief Driver configuration structure.
+ * @brief Low level fields of the DAC configuration structure.
*/
-typedef struct {
- /* End of the mandatory fields.*/
- uint32_t dummy;
-} DACConfig;
+#define dac_lld_config_fields \
+ /* Dummy configuration, it is not needed.*/ \
+ uint32_t dummy
/**
- * @brief Structure representing a DAC driver.
+ * @brief Low level fields of the DAC group configuration structure.
*/
-struct DACDriver {
- /**
- * @brief Driver state.
- */
- dacstate_t state;
- /**
- * @brief Conversion group.
- */
- const DACConversionGroup *grpp;
- /**
- * @brief Samples buffer pointer.
- */
- dacsample_t *samples;
- /**
- * @brief Samples buffer size.
- */
- uint16_t depth;
- /**
- * @brief Current configuration data.
- */
- const DACConfig *config;
-#if DAC_USE_WAIT || defined(__DOXYGEN__)
- /**
- * @brief Waiting thread.
- */
- thread_reference_t thread;
-#endif /* DAC_USE_WAIT */
-#if DAC_USE_MUTUAL_EXCLUSION || defined(__DOXYGEN__)
- /**
- * @brief Mutex protecting the bus.
- */
- mutex_t mutex;
-#endif /* DAC_USE_MUTUAL_EXCLUSION */
-#if defined(DAC_DRIVER_EXT_FIELDS)
- DAC_DRIVER_EXT_FIELDS
-#endif
- /* End of the mandatory fields.*/
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+#define dac_lld_conversion_group_fields
/*===========================================================================*/
/* External declarations. */
diff --git a/os/hal/templates/hal_wspi_lld.h b/os/hal/templates/hal_wspi_lld.h index 6c54d43b7..4c006f296 100644 --- a/os/hal/templates/hal_wspi_lld.h +++ b/os/hal/templates/hal_wspi_lld.h @@ -65,50 +65,19 @@ /* Driver data structures and types. */
/*===========================================================================*/
+/*===========================================================================*/
+/* Driver macros. */
+/*===========================================================================*/
+
/**
- * @brief Driver configuration structure.
+ * @brief Low level fields of the WSPI configuration structure.
*/
-struct hal_wspi_config {
- /**
- * @brief Operation complete callback or @p NULL.
- */
- wspicallback_t end_cb;
- /* End of the mandatory fields.*/
-};
+#define wspi_lld_config_fields
/**
- * @brief Structure representing an WSPI driver.
+ * @brief Low level fields of the WSPI driver structure.
*/
-struct hal_wspi_driver {
- /**
- * @brief Driver state.
- */
- wspistate_t state;
- /**
- * @brief Current configuration data.
- */
- const WSPIConfig *config;
-#if (WSPI_USE_WAIT == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Waiting thread.
- */
- thread_reference_t thread;
-#endif /* WSPI_USE_WAIT */
-#if (WSPI_USE_MUTUAL_EXCLUSION == TRUE) || defined(__DOXYGEN__)
- /**
- * @brief Mutex protecting the peripheral.
- */
- mutex_t mutex;
-#endif /* WSPI_USE_MUTUAL_EXCLUSION */
-#if defined(WSPI_DRIVER_EXT_FIELDS)
- WSPI_DRIVER_EXT_FIELDS
-#endif
- /* End of the mandatory fields.*/
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+#define wspi_lld_driver_fields
/*===========================================================================*/
/* External declarations. */
|