aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gaudio
diff options
context:
space:
mode:
authorinmarket <andrewh@inmarket.com.au>2014-03-20 23:41:27 +1000
committerinmarket <andrewh@inmarket.com.au>2014-03-20 23:41:27 +1000
commit271f0c743f31d3ae21ede35909e1f14845c6d338 (patch)
tree03541486e35fd48b3dd76db6c0470a8d860cd964 /drivers/gaudio
parent712ff73f77763eeee798d6913f57e5577adcef3f (diff)
downloaduGFX-271f0c743f31d3ae21ede35909e1f14845c6d338.tar.gz
uGFX-271f0c743f31d3ae21ede35909e1f14845c6d338.tar.bz2
uGFX-271f0c743f31d3ae21ede35909e1f14845c6d338.zip
Updates to GADC to use new simpler gfx queued bufferring.
NOTE: code is still buggy (or the one and only driver is buggy).
Diffstat (limited to 'drivers/gaudio')
-rw-r--r--drivers/gaudio/gadc/gaudio_record_board_template.h8
-rw-r--r--drivers/gaudio/gadc/gaudio_record_config.h18
-rw-r--r--drivers/gaudio/gadc/gaudio_record_lld.c34
3 files changed, 30 insertions, 30 deletions
diff --git a/drivers/gaudio/gadc/gaudio_record_board_template.h b/drivers/gaudio/gadc/gaudio_record_board_template.h
index 26e87d88..59168be1 100644
--- a/drivers/gaudio/gadc/gaudio_record_board_template.h
+++ b/drivers/gaudio/gadc/gaudio_record_board_template.h
@@ -27,6 +27,12 @@
#define GAUDIO_RECORD_NUM_CHANNELS 1
/**
+ * @brief Whether each channel is mono or stereo
+ * @note This is an example
+ */
+#define GAUDIO_RECORD_CHANNEL0_IS_STEREO FALSE
+
+/**
* @brief The list of audio channels and their uses
* @note This is an example
* @{
@@ -40,7 +46,7 @@
* @{
*/
#ifdef GAUDIO_RECORD_LLD_IMPLEMENTATION
- static uint32_t gaudin_lld_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
+ static uint32_t gaudio_gadc_physdevs[GAUDIO_RECORD_NUM_CHANNELS] = {
GADC_PHYSDEV_MICROPHONE,
};
#endif
diff --git a/drivers/gaudio/gadc/gaudio_record_config.h b/drivers/gaudio/gadc/gaudio_record_config.h
index 22d8750f..88092a63 100644
--- a/drivers/gaudio/gadc/gaudio_record_config.h
+++ b/drivers/gaudio/gadc/gaudio_record_config.h
@@ -23,28 +23,20 @@
/*===========================================================================*/
/**
- * @brief The audio record sample type
- * @details For this driver it matches the cpu sample type
- */
-typedef adcsample_t audio_record_sample_t;
-
-/**
* @brief The maximum sample frequency supported by this audio device
* @details For this driver it matches the GADC maximum high speed sample rate
*/
-#define GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY GADC_MAX_HIGH_SPEED_SAMPLERATE
+#define GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY GADC_MAX_HIGH_SPEED_SAMPLERATE
/**
- * @brief The number of bits in a sample
- * @details For this driver it matches the cpu sample bits
+ * @brief The number of audio formats supported by this driver
*/
-#define GAUDIO_RECORD_BITS_PER_SAMPLE GADC_BITS_PER_SAMPLE
+#define GAUDIO_RECORD_NUM_FORMATS 1
/**
- * @brief The format of an audio sample
- * @details For this driver it matches the cpu sample format
+ * @brief The available audio sample formats in order of preference
*/
-#define GAUDIO_RECORD_SAMPLE_FORMAT GADC_SAMPLE_FORMAT
+#define GAUDIO_RECORD_FORMAT1 GADC_SAMPLE_FORMAT
/**
* For the GAUDIO driver that uses GADC - all the remaining config definitions are specific
diff --git a/drivers/gaudio/gadc/gaudio_record_lld.c b/drivers/gaudio/gadc/gaudio_record_lld.c
index ee994dc1..6f4cb2de 100644
--- a/drivers/gaudio/gadc/gaudio_record_lld.c
+++ b/drivers/gaudio/gadc/gaudio_record_lld.c
@@ -8,10 +8,6 @@
/**
* @file drivers/gaudio/gadc/gaudio_record_lld.c
* @brief GAUDIO - Record Driver file for using the cpu ADC (via GADC).
- *
- * @addtogroup GAUDIO
- *
- * @{
*/
/**
@@ -19,8 +15,6 @@
* from the board definitions.
*/
#define GAUDIO_RECORD_IMPLEMENTATION
-
-
#include "gfx.h"
#if GFX_USE_GAUDIO && GAUDIO_NEED_RECORD
@@ -33,30 +27,38 @@
/* Include the driver defines */
#include "src/gaudio/driver_record.h"
+static void gadcCallbackI(void) {
+ GDataBuffer *pd;
+
+ pd = gadcHighSpeedGetDataI();
+ if (pd)
+ gaudioRecordSaveDataBlockI(pd);
+}
+
/*===========================================================================*/
/* External declarations. */
/*===========================================================================*/
-void gaudin_lld_init(const gaudin_params *paud) {
+bool_t gaudio_record_lld_init(uint16_t channel, uint32_t frequency, ArrayDataFormat format) {
+ /* Check the parameters */
+ if (channel >= GAUDIO_RECORD_NUM_CHANNELS || frequency > GAUDIO_RECORD_MAX_SAMPLE_FREQUENCY || format != GAUDIO_RECORD_FORMAT1)
+ return FALSE;
+
/* Setup the high speed GADC */
- gadcHighSpeedInit(gaudin_lld_physdevs[paud->channel], paud->frequency, paud->buffer, paud->bufcount, paud->samplesPerEvent);
+ gadcHighSpeedInit(gaudio_gadc_physdevs[channel], frequency);
/* Register ourselves for ISR callbacks */
- gadcHighSpeedSetISRCallback(GAUDIN_ISR_CompleteI);
+ gadcHighSpeedSetISRCallback(gadcCallbackI);
- /**
- * The gadc driver handles any errors for us by restarting the transaction so there is
- * no need for us to setup anything for GAUDIN_ISR_ErrorI()
- */
+ return TRUE;
}
-void gaudin_lld_start(void) {
+void gaudio_record_lld_start(void) {
gadcHighSpeedStart();
}
-void gaudin_lld_stop(void) {
+void gaudio_record_lld_stop(void) {
gadcHighSpeedStop();
}
#endif /* GFX_USE_GAUDIO && GAUDIO_NEED_RECORD */
-/** @} */