aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/ports/STM32/LLD/DACv1
diff options
context:
space:
mode:
authorGiovanni Di Sirio <gdisirio@gmail.com>2018-12-09 09:11:21 +0000
committerGiovanni Di Sirio <gdisirio@gmail.com>2018-12-09 09:11:21 +0000
commit964ca6029035706e5ba5be7a8304eba67920386d (patch)
tree33dd1e258a78ff1c40f10bfdcb7c394678f0d84e /os/hal/ports/STM32/LLD/DACv1
parent584f19dbe94ea1ad9585ce04c5f1d5b424ebaa09 (diff)
downloadChibiOS-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/ports/STM32/LLD/DACv1')
-rw-r--r--os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.h142
1 files changed, 27 insertions, 115 deletions
diff --git a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.h b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.h
index a3d29956a..d66a8b0e7 100644
--- a/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.h
+++ b/os/hal/ports/STM32/LLD/DACv1/hal_dac_lld.h
@@ -287,6 +287,11 @@
typedef uint32_t dacchannel_t;
/**
+ * @brief Type representing a DAC sample.
+ */
+typedef uint16_t dacsample_t;
+
+/**
* @brief DAC channel parameters type.
*/
typedef struct {
@@ -327,16 +332,6 @@ typedef struct {
} dacparams_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;
-
-/**
* @brief Possible DAC failure causes.
* @note Error codes are architecture dependent and should not relied
* upon.
@@ -347,25 +342,6 @@ typedef enum {
} 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);
-
-/**
* @brief Samples alignment and size mode.
*/
typedef enum {
@@ -379,100 +355,36 @@ typedef enum {
#endif
} dacdhrmode_t;
+/*===========================================================================*/
+/* 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.*/
- /**
- * @brief DAC initialization data.
- * @note This field contains the (not shifted) value to be put into the
- * TSEL field of the DAC CR register during initialization. All
- * other fields are handled internally.
- */
- uint32_t trigger;
-} DACConversionGroup;
+#define dac_lld_driver_fields \
+ /* DAC channel parameters.*/ \
+ const dacparams_t *params
/**
- * @brief Driver configuration structure.
+ * @brief Low level fields of the DAC configuration structure.
*/
-typedef struct {
- /* End of the mandatory fields.*/
- /**
- * @brief Initial output on DAC channels.
- */
- dacsample_t init;
- /**
- * @brief DAC data holding register mode.
- */
- dacdhrmode_t datamode;
- /**
- * @brief DAC control register.
- */
- uint16_t cr;
-} DACConfig;
+#define dac_lld_config_fields \
+ /* Initial output on DAC channels.*/ \
+ dacsample_t init; \
+ /* DAC data holding register mode.*/ \
+ dacdhrmode_t datamode; \
+ /* DAC control register.*/ \
+ uint16_t cr
/**
- * @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.*/
- /**
- * @brief DAC channel parameters.
- */
- const dacparams_t *params;
-};
-
-/*===========================================================================*/
-/* Driver macros. */
-/*===========================================================================*/
+#define dac_lld_conversion_group_fields \
+ /* DAC initialization data. This field contains the (not shifted) value \
+ to be put into the TSEL field of the DAC CR register during \
+ initialization. All other fields are handled internally.*/ \
+ uint32_t trigger
/*===========================================================================*/
/* External declarations. */