diff options
author | gdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01> | 2018-12-09 14:21:00 +0000 |
---|---|---|
committer | gdisirio <gdisirio@110e8d01-0319-4d1e-a829-52ad28d1bb01> | 2018-12-09 14:21:00 +0000 |
commit | 984f865b45b110915616c3c9629fe47b064bed99 (patch) | |
tree | 5c309c9eea9290c1de4fbfab0f2f0d32ad91f21d /os/hal/include | |
parent | b50ee022aa4fbc8d09b6a62308e99beb32bb722e (diff) | |
download | ChibiOS-984f865b45b110915616c3c9629fe47b064bed99.tar.gz ChibiOS-984f865b45b110915616c3c9629fe47b064bed99.tar.bz2 ChibiOS-984f865b45b110915616c3c9629fe47b064bed99.zip |
I2S updated.
git-svn-id: svn://svn.code.sf.net/p/chibios/svn/trunk@12469 110e8d01-0319-4d1e-a829-52ad28d1bb01
Diffstat (limited to 'os/hal/include')
-rw-r--r-- | os/hal/include/hal_i2s.h | 63 |
1 files changed, 63 insertions, 0 deletions
diff --git a/os/hal/include/hal_i2s.h b/os/hal/include/hal_i2s.h index 5d9e3cc57..9811423f5 100644 --- a/os/hal/include/hal_i2s.h +++ b/os/hal/include/hal_i2s.h @@ -62,8 +62,71 @@ typedef enum { I2S_COMPLETE = 4 /**< Transmission complete. */
} i2sstate_t;
+/**
+ * @brief Type of a structure representing an I2S driver.
+ */
+typedef struct hal_i2s_driver I2SDriver;
+
+/**
+ * @brief Type of a structure representing an I2S driver configuration.
+ */
+typedef struct hal_i2s_config I2SConfig;
+
+/**
+ * @brief I2S notification callback type.
+ *
+ * @param[in] i2sp pointer to the @p I2SDriver object
+ * @param[in] offset offset in buffers of the data to read/write
+ * @param[in] n number of samples to read/write
+ */
+typedef void (*i2scallback_t)(I2SDriver *i2sp, size_t offset, size_t n);
+
+/* Including the low level driver header, it exports information required
+ for completing types.*/
#include "hal_i2s_lld.h"
+/**
+ * @brief Structure representing an I2S driver.
+ */
+struct hal_i2s_driver {
+ /**
+ * @brief Driver state.
+ */
+ i2sstate_t state;
+ /**
+ * @brief Current configuration data.
+ */
+ const I2SConfig *config;
+ /* End of the mandatory fields.*/
+ i2s_lld_driver_fields;
+};
+
+/**
+ * @brief Driver configuration structure.
+ */
+struct hal_i2s_config {
+ /**
+ * @brief Transmission buffer pointer.
+ * @note Can be @p NULL if TX is not required.
+ */
+ const void *tx_buffer;
+ /**
+ * @brief Receive buffer pointer.
+ * @note Can be @p NULL if RX is not required.
+ */
+ void *rx_buffer;
+ /**
+ * @brief TX and RX buffers size as number of samples.
+ */
+ size_t size;
+ /**
+ * @brief Callback function called during streaming.
+ */
+ i2scallback_t end_cb;
+ /* End of the mandatory fields.*/
+ i2s_lld_config_fields;
+};
+
/*===========================================================================*/
/* Driver macros. */
/*===========================================================================*/
|