stm32469i_discovery_audio.c
Go to the documentation of this file.
1 
38 /*==============================================================================
39  User NOTES
40 
41 How To use this driver:
42 -----------------------
43  + This driver supports STM32F4xx devices on STM32469I-Discovery (MB1189) Discovery boards.
44  + Call the function BSP_AUDIO_OUT_Init(
45  OutputDevice: physical output mode (OUTPUT_DEVICE_HEADPHONE1,
46  OUTPUT_DEVICE_HEADPHONE2 or OUTPUT_DEVICE_BOTH)
47  Volume : Initial volume to be set (0 is min (mute), 100 is max (100%)
48  AudioFreq : Audio frequency in Hz (8000, 16000, 22500, 32000...)
49  this parameter is relative to the audio file/stream type.
50  )
51  This function configures all the hardware required for the audio application (codec, I2C, SAI,
52  GPIOs, DMA and interrupt if needed). This function returns AUDIO_OK if configuration is OK.
53  If the returned value is different from AUDIO_OK or the function is stuck then the communication with
54  the codec or the MFX has failed (try to un-plug the power or reset device in this case).
55  - OUTPUT_DEVICE_HEADPHONE1 : only headphones 1 will be set as output for the audio stream.
56  - OUTPUT_DEVICE_HEADPHONE2 : only headphones 2 will be set as output for the audio stream.
57  - OUTPUT_DEVICE_BOTH : both Headphones are used as outputs for the audio stream
58  at the same time.
59  Note. On STM32469I-Discovery SAI_DMA is configured in CIRCULAR mode. Due to this the application
60  does NOT need to call BSP_AUDIO_OUT_ChangeBuffer() to assure straming.
61  + Call the function BSP_Discovery_AUDIO_OUT_Play(
62  pBuffer: pointer to the audio data file address
63  Size : size of the buffer to be sent in Bytes
64  )
65  to start playing (for the first time) from the audio file/stream.
66  + Call the function BSP_AUDIO_OUT_Pause() to pause playing
67  + Call the function BSP_AUDIO_OUT_Resume() to resume playing.
68  Note. After calling BSP_AUDIO_OUT_Pause() function for pause, only BSP_AUDIO_OUT_Resume() should be called
69  for resume (it is not allowed to call BSP_AUDIO_OUT_Play() in this case).
70  Note. This function should be called only when the audio file is played or paused (not stopped).
71  + For each mode, you may need to implement the relative callback functions into your code.
72  The Callback functions are named AUDIO_OUT_XXX_CallBack() and only their prototypes are declared in
73  the stm32469i_discovery_audio.h file. (refer to the example for more details on the callbacks implementations)
74  + To Stop playing, to modify the volume level, the frequency, the audio frame slot,
75  the device output mode the mute or the stop, use the functions: BSP_AUDIO_OUT_SetVolume(),
76  AUDIO_OUT_SetFrequency(), BSP_AUDIO_OUT_SetAudioFrameSlot(), BSP_AUDIO_OUT_SetOutputMode(),
77  BSP_AUDIO_OUT_SetMute() and BSP_AUDIO_OUT_Stop().
78  + The driver API and the callback functions are at the end of the stm32469i_discovery_audio.h file.
79 
80 Driver architecture:
81 --------------------
82  + This driver provide the High Audio Layer: consists of the function API exported in the stm32469i_discovery_audio.h file
83  (BSP_AUDIO_OUT_Init(), BSP_AUDIO_OUT_Play() ...)
84  + This driver provide also the Media Access Layer (MAL): which consists of functions allowing to access the media containing/
85  providing the audio file/stream. These functions are also included as local functions into
86  the stm32469i_discovery_audio_codec.c file (I2Sx_Init(), I2Sx_DeInit(), SAIx_Init() and SAIx_DeInit())
87 
88 Known Limitations:
89 ------------------
90  1- If the TDM Format used to paly in parallel 2 audio Stream (the first Stream is configured in codec SLOT0 and second
91  Stream in SLOT1) the Pause/Resume, volume and mute feature will control the both streams.
92  2- Parsing of audio file is not implemented (in order to determine audio file properties: Mono/Stereo, Data size,
93  File size, Audio Frequency, Audio Data header size ...). The configuration is fixed for the given audio file.
94  3- Supports only Stereo audio streaming.
95  4- Supports only 16-bits audio data size.
96 ==============================================================================*/
97 
98 /* Includes ------------------------------------------------------------------*/
99 #include <string.h>
101 
130 #define OUTPUT_DEVICE_HEADPHONE1 OUTPUT_DEVICE_HEADPHONE
131 
132 /* Headphone2 is connected to Speaker output of the CS43L22 codec */
133 #define OUTPUT_DEVICE_HEADPHONE2 OUTPUT_DEVICE_SPEAKER
134 
142 /*### PLAY ###*/
143 /* SCK(kHz) = SAI_CK_x/(SAIClockDivider*2*256) */
144 #define SAIClockDivider(__FREQUENCY__) \
145  (__FREQUENCY__ == AUDIO_FREQUENCY_8K) ? 12 \
146  : (__FREQUENCY__ == AUDIO_FREQUENCY_11K) ? 2 \
147  : (__FREQUENCY__ == AUDIO_FREQUENCY_16K) ? 6 \
148  : (__FREQUENCY__ == AUDIO_FREQUENCY_22K) ? 1 \
149  : (__FREQUENCY__ == AUDIO_FREQUENCY_32K) ? 3 \
150  : (__FREQUENCY__ == AUDIO_FREQUENCY_44K) ? 0 \
151  : (__FREQUENCY__ == AUDIO_FREQUENCY_48K) ? 2 : 1 \
152 
153 
161 /*
162 Note:
163  these global variables are not compliant to naming rules (upper case without "_" ),
164  but we keep this naming for compatibility, in fact these variables (not static)
165  could have been used by the application, example the stm32f4xx_it.c:
166  void DMA2_Stream6_IRQHandler(void)
167  { HAL_DMA_IRQHandler(haudio_out_sai.hdmatx); }
168 */
173 
174 /* PDM filters params */
175 PDM_Filter_Handler_t PDM_FilterHandler[2];
176 PDM_Filter_Config_t PDM_FilterConfig[2];
177 
178 uint8_t Channel_Demux[128] = {
179  0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
180  0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
181  0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
182  0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
183  0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
184  0x00, 0x01, 0x00, 0x01, 0x02, 0x03, 0x02, 0x03,
185  0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
186  0x04, 0x05, 0x04, 0x05, 0x06, 0x07, 0x06, 0x07,
187  0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
188  0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
189  0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
190  0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
191  0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
192  0x08, 0x09, 0x08, 0x09, 0x0a, 0x0b, 0x0a, 0x0b,
193  0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f,
194  0x0c, 0x0d, 0x0c, 0x0d, 0x0e, 0x0f, 0x0e, 0x0f
195 };
196 
198 
206 static uint8_t SAIx_Init(uint32_t AudioFreq);
207 static void SAIx_DeInit(void);
208 static void I2Sx_Init(uint32_t AudioFreq);
209 static void I2Sx_DeInit(void);
210 static void TIMx_IC_MspInit(TIM_HandleTypeDef *htim);
211 static void TIMx_IC_MspDeInit(TIM_HandleTypeDef *htim);
212 static void TIMx_Init(void);
213 static void TIMx_DeInit(void);
214 static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut);
215 
216 void BSP_AUDIO_OUT_ChangeAudioConfig(uint32_t AudioOutOption);
217 
235 uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice,
236  uint8_t Volume,
237  uint32_t AudioFreq)
238 {
239  uint8_t ret = AUDIO_OK;
240 
241  SAIx_DeInit();
242 
243  /* PLL clock is set depending by the AudioFreq (44.1khz vs 48khz groups) */
245 
246  /* SAI data transfer preparation:
247  Prepare the Media to be used for the audio transfer from memory to SAI peripheral */
250  {
251  /* Init the SAI MSP: this __weak function can be redefined by the application*/
253  }
254 
255  if (SAIx_Init(AudioFreq) != AUDIO_OK)
256  {
257  ret = AUDIO_ERROR;
258  }
259 
260  if(ret == AUDIO_OK)
261  {
262  /* Retieve audio codec identifier */
264  {
265  /* Initialize the audio driver structure */
267  }
268  else
269  {
270  ret = AUDIO_ERROR;
271  }
272  }
273 
274  if(ret == AUDIO_OK)
275  {
276  /* Initialize the audio codec internal registers */
278  OutputDevice,
279  Volume,
280  AudioFreq) != AUDIO_OK)
281  {
282  ret = AUDIO_ERROR;
283  }
284  }
285 
286  return ret;
287 }
288 
295 uint8_t BSP_AUDIO_OUT_Play(uint16_t* pBuffer, uint32_t Size)
296 {
297  uint8_t ret = AUDIO_OK;
298 
299  /* Call the audio Codec Play function */
300  if(audio_drv->Play(AUDIO_I2C_ADDRESS, pBuffer, Size) != 0)
301  {
302  ret = AUDIO_ERROR;
303  }
304 
305  /* Initiate a DMA transfer of PCM samples towards the serial audio interface */
306  if(ret == AUDIO_OK)
307  {
308  if (HAL_SAI_Transmit_DMA(&haudio_out_sai, (uint8_t*) pBuffer, DMA_MAX(Size / AUDIODATA_SIZE))!= HAL_OK)
309  {
310  ret = AUDIO_ERROR;
311  }
312  }
313 
314  return ret;
315 }
316 
322 void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size)
323 {
324  HAL_SAI_Transmit_DMA(&haudio_out_sai, (uint8_t*) pData, Size);
325 }
326 
335 uint8_t BSP_AUDIO_OUT_Pause(void)
336 {
337  uint8_t ret = AUDIO_OK;
338 
339  /* Call the Audio Codec Pause/Resume function */
341  {
342  ret = AUDIO_ERROR;
343  }
344 
345  /* Pause DMA transfer of PCM samples towards the serial audio interface */
346  if(ret == AUDIO_OK)
347  {
349  {
350  ret = AUDIO_ERROR;
351  }
352  }
353 
354  /* Return AUDIO_OK when all operations are correctly done */
355  return ret;
356 }
357 
366 uint8_t BSP_AUDIO_OUT_Resume(void)
367 {
368  uint8_t ret = AUDIO_OK;
369 
370  /* Call the Audio Codec Pause/Resume function */
372  {
373  ret = AUDIO_ERROR;
374  }
375 
376  /* Resume DMA transfer of PCM samples towards the serial audio interface */
377  if(ret == AUDIO_OK)
378  {
380  {
381  ret = AUDIO_ERROR;
382  }
383  }
384 
385  /* Return AUDIO_OK when all operations are correctly done */
386  return ret;
387 }
388 
398 uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option)
399 {
400  uint8_t ret = AUDIO_OK;
401 
402  /* Call Audio Codec Stop function */
403  if(audio_drv->Stop(AUDIO_I2C_ADDRESS, Option) != 0)
404  {
405  ret = AUDIO_ERROR;
406  }
407 
408  if(ret == AUDIO_OK)
409  {
410  if(Option == CODEC_PDWN_HW)
411  {
412  /* Wait at least 100us */
413  HAL_Delay(2);
414  }
415 
416  /* Stop DMA transfer of PCM samples towards the serial audio interface */
418  {
419  ret = AUDIO_ERROR;
420  }
421  }
422  /* Return AUDIO_OK when all operations are correctly done */
423  return ret;
424 }
425 
432 uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume)
433 {
434  uint8_t ret = AUDIO_OK;
435 
436  /* Call the codec volume control function with converted volume value */
437  if(audio_drv->SetVolume(AUDIO_I2C_ADDRESS, Volume) != 0)
438  {
439  ret = AUDIO_ERROR;
440  }
441 
442  /* Return AUDIO_OK when all operations are correctly done */
443  return ret;
444 }
445 
452 uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd)
453 {
454  uint8_t ret = AUDIO_OK;
455 
456  /* Call the Codec Mute function */
457  if(audio_drv->SetMute(AUDIO_I2C_ADDRESS, Cmd) != 0)
458  {
459  ret = AUDIO_ERROR;
460  }
461 
462  /* Return AUDIO_OK when all operations are correctly done */
463  return ret;
464 }
465 
473 uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output)
474 {
475  uint8_t ret = AUDIO_OK;
476 
477  /* Call the Codec output device function */
479  {
480  ret = AUDIO_ERROR;
481  }
482 
483  /* Return AUDIO_OK when all operations are correctly done */
484  return ret;
485 }
486 
493 void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq)
494 {
495  /* PLL clock is set depending by the AudioFreq (44.1khz vs 48khz groups) */
497 
498  /* Disable SAI peripheral to allow access to SAI internal registers */
500 
501  /* Update the SAI audio frequency configuration */
502  haudio_out_sai.Init.AudioFrequency = AudioFreq;
504 
505  /* Enable SAI peripheral to generate MCLK */
507 }
508 
516 void BSP_AUDIO_OUT_ChangeAudioConfig(uint32_t AudioOutOption)
517 {
518  /********** Playback Buffer circular/normal mode **********/
519  if(AudioOutOption & BSP_AUDIO_OUT_CIRCULARMODE)
520  {
521  /* Deinitialize the Stream to update DMA mode */
523 
524  /* Update the SAI audio Transfer DMA mode */
526 
527  /* Configure the DMA Stream with new Transfer DMA mode */
529  }
530  else /* BSP_AUDIO_OUT_NORMALMODE */
531  {
532  /* Deinitialize the Stream to update DMA mode */
534 
535  /* Update the SAI audio Transfer DMA mode */
537 
538  /* Configure the DMA Stream with new Transfer DMA mode */
540  }
541 
542  /********** Playback Buffer stereo/mono mode **********/
543  if(AudioOutOption & BSP_AUDIO_OUT_STEREOMODE)
544  {
545  /* Disable SAI peripheral to allow access to SAI internal registers */
547 
548  /* Update the SAI audio frame slot configuration */
551 
552  /* Enable SAI peripheral to generate MCLK */
554  }
555  else /* BSP_AUDIO_OUT_MONOMODE */
556  {
557  /* Disable SAI peripheral to allow access to SAI internal registers */
559 
560  /* Update the SAI audio frame slot configuration */
563 
564  /* Enable SAI peripheral to generate MCLK */
566  }
567 }
568 
576 void BSP_AUDIO_OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot)
577 {
578  /* Disable SAI peripheral to allow access to SAI internal registers */
580 
581  /* Update the SAI audio frame slot configuration */
582  haudio_out_sai.SlotInit.SlotActive = AudioFrameSlot;
584 
585  /* Enable SAI peripheral to generate MCLK */
587 }
588 
593 {
594  SAIx_DeInit();
595  /* DeInit the SAI MSP : this __weak function can be rewritten by the applic */
597 
598  /* Reset the audio output context */
599  memset(&audio_drv, 0, sizeof(audio_drv));
600 }
601 
607 {
608  /* Manage the remaining file size and new address offset: This function
609  should be coded by user (its prototype is already declared in stm32469i_discovery_audio.h) */
611 }
612 
618 {
619  /* Manage the remaining file size and new address offset: This function
620  should be coded by user (its prototype is already declared in stm32469i_discovery_audio.h) */
622 }
623 
629 {
631 }
632 
637 {
638 }
639 
644 {
645 }
646 
651 {
652 }
653 
659 __weak void BSP_AUDIO_OUT_MspInit(SAI_HandleTypeDef *hsai, void *Params)
660 {
661  static DMA_HandleTypeDef hdma_sai_tx;
662  GPIO_InitTypeDef gpio_init_structure;
663 
664  /* Put CS43L2 codec reset high -----------------------------------*/
666  gpio_init_structure.Pin = AUDIO_RESET_PIN;
667  gpio_init_structure.Mode = GPIO_MODE_OUTPUT_PP;
668  gpio_init_structure.Pull = GPIO_NOPULL;
669  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
670  HAL_GPIO_Init(AUDIO_RESET_GPIO_PORT, &gpio_init_structure);
672 
673  /* Enable SAI clock */
675 
676  /* Enable GPIO clock */
679 
680  /* CODEC_SAI pins configuration: MCK pin -----------------------------------*/
681  gpio_init_structure.Pin = AUDIO_SAIx_MCK_PIN;
682  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
683  gpio_init_structure.Pull = GPIO_NOPULL;
684  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
685  gpio_init_structure.Alternate = AUDIO_SAIx_MCLK_SCK_SD_FS_AF;
686  HAL_GPIO_Init(AUDIO_SAIx_MCLK_GPIO_PORT, &gpio_init_structure);
687 
688  /* CODEC_SAI pins configuration: FS, SCK, MCK and SD pins ------------------*/
689  gpio_init_structure.Pin = AUDIO_SAIx_FS_PIN | AUDIO_SAIx_SCK_PIN | AUDIO_SAIx_SD_PIN;
690  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
691  gpio_init_structure.Pull = GPIO_NOPULL;
692  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
693  gpio_init_structure.Alternate = AUDIO_SAIx_MCLK_SCK_SD_FS_AF;
694  HAL_GPIO_Init(AUDIO_SAIx_SCK_SD_FS_GPIO_PORT, &gpio_init_structure);
695 
696  /* Enable the DMA clock */
698 
699  if(hsai->Instance == AUDIO_SAIx)
700  {
701  /* Configure the hdma_saiTx handle parameters */
702  hdma_sai_tx.Init.Channel = AUDIO_SAIx_DMAx_CHANNEL;
703  hdma_sai_tx.Init.Direction = DMA_MEMORY_TO_PERIPH;
704  hdma_sai_tx.Init.PeriphInc = DMA_PINC_DISABLE;
705  hdma_sai_tx.Init.MemInc = DMA_MINC_ENABLE;
708  hdma_sai_tx.Init.Mode = DMA_CIRCULAR;
709  hdma_sai_tx.Init.Priority = DMA_PRIORITY_HIGH;
710  hdma_sai_tx.Init.FIFOMode = DMA_FIFOMODE_ENABLE;
712  hdma_sai_tx.Init.MemBurst = DMA_MBURST_SINGLE;
713  hdma_sai_tx.Init.PeriphBurst = DMA_PBURST_SINGLE;
714 
715  hdma_sai_tx.Instance = AUDIO_SAIx_DMAx_STREAM;
716 
717  /* Associate the DMA handle */
718  __HAL_LINKDMA(hsai, hdmatx, hdma_sai_tx);
719 
720  /* Deinitialize the Stream for new transfer */
721  HAL_DMA_DeInit(&hdma_sai_tx);
722 
723  /* Configure the DMA Stream */
724  HAL_DMA_Init(&hdma_sai_tx);
725  }
726 
727  /* SAI DMA IRQ Channel configuration */
730 
731 }
737 __weak void BSP_AUDIO_OUT_MspDeInit(SAI_HandleTypeDef *hsai, void *Params)
738 {
739  GPIO_InitTypeDef gpio_init_structure;
740 
741  /* SAI DMA IRQ Channel deactivation */
743 
744  if(hsai->Instance == AUDIO_SAIx)
745  {
746  /* Deinitialize the DMA stream */
747  HAL_DMA_DeInit(hsai->hdmatx);
748  }
749 
750  /* Disable SAI peripheral */
751  __HAL_SAI_DISABLE(hsai);
752 
753  /* Put CS43L2 codec reset low -----------------------------------*/
755 
756  /* Deactives CODEC_SAI pins FS, SCK, MCK and SD by putting them in input mode */
757  gpio_init_structure.Pin = AUDIO_SAIx_MCK_PIN;
758  HAL_GPIO_DeInit(AUDIO_SAIx_MCLK_GPIO_PORT, gpio_init_structure.Pin);
759 
760  gpio_init_structure.Pin = AUDIO_SAIx_FS_PIN | AUDIO_SAIx_SCK_PIN | AUDIO_SAIx_SD_PIN;
761  HAL_GPIO_DeInit(AUDIO_SAIx_SCK_SD_FS_GPIO_PORT, gpio_init_structure.Pin);
762 
763  gpio_init_structure.Pin = AUDIO_RESET_PIN;
764  HAL_GPIO_DeInit(AUDIO_RESET_GPIO_PORT, gpio_init_structure.Pin);
765 
766 
767  /* Disable SAI clock */
769 
770 
771  /* GPIO pins clock and DMA clock can be shut down in the applic
772  by surcgarging this __weak function */
773 }
774 
783 __weak void BSP_AUDIO_OUT_ClockConfig(SAI_HandleTypeDef *hsai, uint32_t AudioFreq, void *Params)
784 {
785  RCC_PeriphCLKInitTypeDef rcc_ex_clk_init_struct;
786 
787  HAL_RCCEx_GetPeriphCLKConfig(&rcc_ex_clk_init_struct);
788 
789  /* Set the PLL configuration according to the audio frequency */
790  if((AudioFreq == AUDIO_FREQUENCY_11K) || (AudioFreq == AUDIO_FREQUENCY_22K) || (AudioFreq == AUDIO_FREQUENCY_44K))
791  {
792  /* Configure PLLI2S prescalers */
793  /* PLLI2S_VCO: VCO_429M
794  I2S_CLK(first level) = PLLI2S_VCO/PLLI2SQ = 429/2 = 214.5 Mhz
795  I2S_CLK_x = I2S_CLK(first level)/PLLI2SDIVQ = 214.5/19 = 11.289 Mhz */
796  rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI_PLLI2S;
797  rcc_ex_clk_init_struct.PLLI2S.PLLI2SN = 429;
798  rcc_ex_clk_init_struct.PLLI2S.PLLI2SQ = 2;
799  rcc_ex_clk_init_struct.PLLI2SDivQ = 19;
800 
801  HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
802 
803  }
804  else /* AUDIO_FREQUENCY_8K, AUDIO_FREQUENCY_16K, AUDIO_FREQUENCY_48K), AUDIO_FREQUENCY_96K */
805  {
806  /* SAI clock config
807  PLLSAI_VCO: VCO_344M
808  I2S_CLK(first level) = PLLI2S_VCO/PLLI2SQ = 344/7 = 49.142 Mhz
809  I2S_CLK_x = SAI_CLK(first level)/PLLI2SDIVQ = 49.142/1 = 49.142 Mhz */
810  rcc_ex_clk_init_struct.PeriphClockSelection = RCC_PERIPHCLK_SAI_PLLI2S;
811  rcc_ex_clk_init_struct.PLLI2S.PLLI2SN = 344;
812  rcc_ex_clk_init_struct.PLLI2S.PLLI2SQ = 7;
813  rcc_ex_clk_init_struct.PLLI2SDivQ = 1;
814 
815  HAL_RCCEx_PeriphCLKConfig(&rcc_ex_clk_init_struct);
816  }
817 }
818 
819 /*******************************************************************************
820  Static Functions
821 *******************************************************************************/
828 static uint8_t SAIx_Init(uint32_t AudioFreq)
829 {
830  uint8_t ret = AUDIO_OK;
831 
832  /* Initialize the haudio_out_sai Instance parameter */
834 
835  /* Disable SAI peripheral to allow access to SAI internal registers */
837 
838  /* Configure SAI_Block_x
839  LSBFirst: Disabled
840  DataSize: 16 */
841  haudio_out_sai.Init.AudioFrequency = AudioFreq;
842  haudio_out_sai.Init.ClockSource = SAI_CLKSOURCE_PLLI2S;
852 /*
853  haudio_out_sai.Init.AudioFrequency = SAI_AUDIO_FREQUENCY_MCKDIV;
854  haudio_out_sai.Init.SynchroExt = SAI_SYNCEXT_DISABLE;
855  haudio_out_sai.Init.Mckdiv = SAIClockDivider(AudioFreq);
856  haudio_out_sai.Init.MonoStereoMode = SAI_STEREOMODE;
857  haudio_out_sai.Init.CompandingMode = SAI_NOCOMPANDING;
858  haudio_out_sai.Init.TriState = SAI_OUTPUT_NOTRELEASED;
859 */
860 
861  /* Configure SAI_Block_x Frame
862  Frame Length: 64
863  Frame active Length: 32
864  FS Definition: Start frame + Channel Side identification
865  FS Polarity: FS active Low
866  FS Offset: FS asserted one bit before the first bit of slot 0 */
872 
873  /* Configure SAI Block_x Slot
874  Slot First Bit Offset: 0
875  Slot Size : 16
876  Slot Number: 4
877  Slot Active: All slot actives */
882 
883  /* Initializes the SAI peripheral*/
885  {
886  ret = AUDIO_ERROR;
887  }
888 
889  /* Enable SAI peripheral to generate MCLK */
891 
892  return ret;
893 
894 }
895 
899 static void SAIx_DeInit(void)
900 {
901  /* Initialize the hAudioOutSai Instance parameter */
903 
904  /* Disable SAI peripheral */
906 
908 }
909 
928 uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
929 {
930  /* DeInit the I2S */
931  I2Sx_DeInit();
932 
933  /* Configure PLL clock */
935 
936  /* Configure the PDM library */
937  PDMDecoder_Init(AudioFreq, ChnlNbr, ChnlNbr);
938 
939  /* Configure the I2S peripheral */
942  {
943  /* Initialize the I2S Msp: this __weak function can be rewritten by the application */
945  }
946 
947  I2Sx_Init(AudioFreq);
948 
949  /* Return AUDIO_OK when all operations are correctly done */
950  return AUDIO_OK;
951 }
952 
959 uint8_t BSP_AUDIO_IN_Record(uint16_t* pbuf, uint32_t size)
960 {
961  uint32_t ret = AUDIO_ERROR;
962 
963  /* Start the process receive DMA */
964  HAL_I2S_Receive_DMA(&haudio_in_i2s, pbuf, size);
965 
966  /* Return AUDIO_OK when all operations are correctly done */
967  ret = AUDIO_OK;
968 
969  return ret;
970 }
971 
976 uint8_t BSP_AUDIO_IN_Stop(void)
977 {
978  uint32_t ret = AUDIO_ERROR;
979 
980  /* Call the Media layer pause function */
982 
983  /* TIMx Peripheral clock disable */
985 
986  /* Return AUDIO_OK when all operations are correctly done */
987  ret = AUDIO_OK;
988 
989  return ret;
990 }
991 
996 uint8_t BSP_AUDIO_IN_Pause(void)
997 {
998  /* Call the Media layer pause function */
1000 
1001  /* Return AUDIO_OK when all operations are correctly done */
1002  return AUDIO_OK;
1003 }
1004 
1009 uint8_t BSP_AUDIO_IN_Resume(void)
1010 {
1011  /* Call the Media layer pause/resume function */
1013 
1014  /* Return AUDIO_OK when all operations are correctly done */
1015  return AUDIO_OK;
1016 }
1017 
1024 uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume)
1025 {
1026  /* Set the Global variable AudioInVolume */
1027  AudioInVolume = Volume;
1028 
1029  /* Return AUDIO_OK when all operations are correctly done */
1030  return AUDIO_OK;
1031 }
1032 
1037 {
1038  I2Sx_DeInit();
1039  /* DeInit the I2S MSP : this __weak function can be rewritten by the applic */
1041  TIMx_DeInit();
1042 }
1043 
1050 uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t* PDMBuf, uint16_t* PCMBuf)
1051 {
1052  uint8_t app_pdm[INTERNAL_BUFF_SIZE*2];
1053  uint8_t byte1 = 0, byte2 = 0;
1054  uint32_t index = 0;
1055 
1056  /* PDM Demux */
1057  for(index = 0; index<INTERNAL_BUFF_SIZE/2; index++)
1058  {
1059  byte2 = (PDMBuf[index] >> 8)& 0xFF;
1060  byte1 = (PDMBuf[index] & 0xFF);
1061  app_pdm[(index*2)+1] = Channel_Demux[byte1 & CHANNEL_DEMUX_MASK] | Channel_Demux[byte2 & CHANNEL_DEMUX_MASK] << 4;
1062  app_pdm[(index*2)] = Channel_Demux[(byte1 >> 1) & CHANNEL_DEMUX_MASK] | Channel_Demux[(byte2 >> 1) & CHANNEL_DEMUX_MASK] << 4;
1063  }
1064 
1065  for(index = 0; index < DEFAULT_AUDIO_IN_CHANNEL_NBR; index++)
1066  {
1067  /* PDM to PCM filter */
1068  PDM_Filter((uint8_t*)&app_pdm[index], (uint16_t*)&(PCMBuf[index]), &PDM_FilterHandler[index]);
1069  }
1070 
1071  /* Return AUDIO_OK when all operations are correctly done */
1072  return AUDIO_OK;
1073 }
1074 
1080 {
1081  /* Call the record update function to get the next buffer to fill and its size (size is ignored) */
1083 }
1084 
1090 {
1091  /* Manage the remaining file size and new address offset: This function
1092  should be coded by user (its prototype is already declared in stm32469i_discovery_audio.h) */
1094 }
1095 
1101 {
1102  /* Manage the error generated on DMA FIFO: This function
1103  should be coded by user (its prototype is already declared in stm32469i_discovery_audio.h) */
1105 }
1106 
1114 __weak void BSP_AUDIO_IN_ClockConfig(I2S_HandleTypeDef *hi2s, void *Params)
1115 {
1116  RCC_PeriphCLKInitTypeDef RCC_ExCLKInitStruct;
1117 
1118  HAL_RCCEx_GetPeriphCLKConfig(&RCC_ExCLKInitStruct);
1119  RCC_ExCLKInitStruct.PeriphClockSelection = RCC_PERIPHCLK_I2S;
1120  RCC_ExCLKInitStruct.PLLI2S.PLLI2SN = 384;
1121  RCC_ExCLKInitStruct.PLLI2S.PLLI2SR = 2;
1122  HAL_RCCEx_PeriphCLKConfig(&RCC_ExCLKInitStruct);
1123 }
1124 
1129 {
1130  /* This function should be implemented by the user application.
1131  It is called into this driver when the current buffer is filled
1132  to prepare the next buffer pointer and its size. */
1133 }
1134 
1139 {
1140  /* This function should be implemented by the user application.
1141  It is called into this driver when the current buffer is filled
1142  to prepare the next buffer pointer and its size. */
1143 }
1144 
1149 {
1150  /* This function is called when an Interrupt due to transfer error on or peripheral
1151  error occurs. */
1152 }
1153 
1159 __weak void BSP_AUDIO_IN_MspInit(I2S_HandleTypeDef *hi2s, void *Params)
1160 {
1161  static DMA_HandleTypeDef hdma_i2s_rx;
1162  GPIO_InitTypeDef gpio_init_structure;
1163 
1164  /* Configure the Timer which clocks the MEMS */
1165  /* Moved inside MSP to allow applic to redefine the TIMx_MspInit */
1166  TIMx_Init();
1167 
1168  /* Enable I2S clock */
1170 
1171  /* Enable SCK and SD GPIO clock */
1174  /* CODEC_I2S pins configuration: SCK and SD pins */
1175  gpio_init_structure.Pin = AUDIO_I2Sx_SCK_PIN;
1176  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
1177  gpio_init_structure.Pull = GPIO_NOPULL;
1178  gpio_init_structure.Speed = GPIO_SPEED_FAST;
1179  gpio_init_structure.Alternate = AUDIO_I2Sx_SCK_AF;
1180  HAL_GPIO_Init(AUDIO_I2Sx_SCK_GPIO_PORT, &gpio_init_structure);
1181 
1182  gpio_init_structure.Pin = AUDIO_I2Sx_SD_PIN;
1183  gpio_init_structure.Alternate = AUDIO_I2Sx_SD_AF;
1184  HAL_GPIO_Init(AUDIO_I2Sx_SD_GPIO_PORT, &gpio_init_structure);
1185 
1186  /* Enable PD12 (I2S3_CLK) connected to PB3 via jamper JP4 */
1187  /* on Eval this was provided by PC6 (initialized in TIMx section) */
1188 /*
1189  gpio_init_structure.Pin = GPIO_PIN_12;
1190  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
1191  gpio_init_structure.Pull = GPIO_NOPULL;
1192  gpio_init_structure.Speed = GPIO_SPEED_FAST;
1193  gpio_init_structure.Alternate = AUDIO_I2Sx_SCK_AF;
1194  HAL_GPIO_Init(GPIOD, &gpio_init_structure); */
1195 
1196 
1197  /* Enable the DMA clock */
1199 
1200  if(hi2s->Instance == AUDIO_I2Sx)
1201  {
1202  /* Configure the hdma_i2sRx handle parameters */
1203  hdma_i2s_rx.Init.Channel = AUDIO_I2Sx_DMAx_CHANNEL;
1204  hdma_i2s_rx.Init.Direction = DMA_PERIPH_TO_MEMORY;
1205  hdma_i2s_rx.Init.PeriphInc = DMA_PINC_DISABLE;
1206  hdma_i2s_rx.Init.MemInc = DMA_MINC_ENABLE;
1209  hdma_i2s_rx.Init.Mode = DMA_CIRCULAR;
1210  hdma_i2s_rx.Init.Priority = DMA_PRIORITY_HIGH;
1211  hdma_i2s_rx.Init.FIFOMode = DMA_FIFOMODE_DISABLE;
1213  hdma_i2s_rx.Init.MemBurst = DMA_MBURST_SINGLE;
1214  hdma_i2s_rx.Init.PeriphBurst = DMA_MBURST_SINGLE;
1215 
1216  hdma_i2s_rx.Instance = AUDIO_I2Sx_DMAx_STREAM;
1217 
1218  /* Associate the DMA handle */
1219  __HAL_LINKDMA(hi2s, hdmarx, hdma_i2s_rx);
1220 
1221  /* Deinitialize the Stream for new transfer */
1222  HAL_DMA_DeInit(&hdma_i2s_rx);
1223 
1224  /* Configure the DMA Stream */
1225  HAL_DMA_Init(&hdma_i2s_rx);
1226  }
1227 
1228  /* I2S DMA IRQ Channel configuration */
1231 }
1232 
1238 __weak void BSP_AUDIO_IN_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params)
1239 {
1240  GPIO_InitTypeDef gpio_init_structure;
1241 
1242  /* I2S DMA IRQ Channel deactivation */
1244 
1245  if(hi2s->Instance == AUDIO_I2Sx)
1246  {
1247  /* Deinitialize the Stream for new transfer */
1248  HAL_DMA_DeInit(hi2s->hdmarx);
1249  }
1250 
1251  /* Disable I2S block */
1252  __HAL_I2S_DISABLE(hi2s);
1253 
1254  /* Disable pins: SCK and SD pins */
1255  gpio_init_structure.Pin = AUDIO_I2Sx_SCK_PIN;
1256  HAL_GPIO_DeInit(AUDIO_I2Sx_SCK_GPIO_PORT, gpio_init_structure.Pin);
1257  gpio_init_structure.Pin = AUDIO_I2Sx_SD_PIN;
1258  HAL_GPIO_DeInit(AUDIO_I2Sx_SD_GPIO_PORT, gpio_init_structure.Pin);
1259 
1260  /* Disable I2S clock */
1262 
1263  /* GPIO pins clock and DMA clock can be shut down in the applic
1264  by surcgarging this __weak function */
1265 }
1266 
1267 /*******************************************************************************
1268  Static Functions
1269 *******************************************************************************/
1270 
1278 static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut)
1279 {
1280  uint32_t index = 0;
1281 
1282  /* Enable CRC peripheral to unlock the PDM library */
1284 
1285  for(index = 0; index < ChnlNbrIn; index++)
1286  {
1287  /* Init PDM filters */
1288  PDM_FilterHandler[index].bit_order = PDM_FILTER_BIT_ORDER_LSB;
1289  PDM_FilterHandler[index].endianness = PDM_FILTER_ENDIANNESS_LE;
1290  PDM_FilterHandler[index].high_pass_tap = 2122358088;
1291  PDM_FilterHandler[index].out_ptr_channels = ChnlNbrOut;
1292  PDM_FilterHandler[index].in_ptr_channels = ChnlNbrIn;
1293  PDM_Filter_Init((PDM_Filter_Handler_t *)(&PDM_FilterHandler[index]));
1294 
1295  /* PDM lib config phase */
1296  PDM_FilterConfig[index].output_samples_number = AudioFreq/1000;
1297  PDM_FilterConfig[index].mic_gain = 24;
1298  PDM_FilterConfig[index].decimation_factor = PDM_FILTER_DEC_FACTOR_64;
1299  PDM_Filter_setConfig((PDM_Filter_Handler_t *)&PDM_FilterHandler[index], &PDM_FilterConfig[index]);
1300  }
1301 }
1302 
1309 static void I2Sx_Init(uint32_t AudioFreq)
1310 {
1311  /* Initialize the haudio_in_i2s Instance parameter */
1313 
1314  /* Disable I2S block */
1316 
1317  /* I2S2 peripheral configuration */
1318  haudio_in_i2s.Init.AudioFreq = 4 * AudioFreq;
1325 
1326  /* Init the I2S */
1328 
1329  /* Disable I2S block */
1331 
1332 }
1333 
1337 static void I2Sx_DeInit(void)
1338 {
1339  /* Initialize the hAudioInI2s Instance parameter */
1341 
1342  /* Disable I2S block */
1344 
1345  /* DeInit the I2S */
1347 }
1348 
1349 
1355 {
1356  GPIO_InitTypeDef gpio_init_structure;
1357 
1358  /* Enable peripherals and GPIO Clocks --------------------------------------*/
1359  /* TIMx Peripheral clock enable */
1361 
1362  /* Enable GPIO Channels Clock */
1364 
1365  /* Configure I/Os ----------------------------------------------------------*/
1366  /* Common configuration for all channels */
1367  gpio_init_structure.Mode = GPIO_MODE_AF_PP;
1368  gpio_init_structure.Pull = GPIO_NOPULL;
1369  gpio_init_structure.Speed = GPIO_SPEED_HIGH;
1370  gpio_init_structure.Alternate = AUDIO_TIMx_AF;
1371 
1372  /* Configure TIM input channel */
1373  gpio_init_structure.Pin = AUDIO_TIMx_IN_GPIO_PIN;
1374  HAL_GPIO_Init(AUDIO_TIMx_GPIO_PORT, &gpio_init_structure);
1375 
1376  /* Configure TIM output channel */
1377  gpio_init_structure.Pin = AUDIO_TIMx_OUT_GPIO_PIN;
1378  HAL_GPIO_Init(AUDIO_TIMx_GPIO_PORT, &gpio_init_structure);
1379 }
1380 
1386 {
1387  /* Disable TIMx Peripheral clock */
1389 
1390  /* GPIO pins clock and DMA clock can be shut down in the applic
1391  by surcgarging this __weak function */
1392 }
1393 
1398 static void TIMx_Init(void)
1399 {
1400  TIM_IC_InitTypeDef s_ic_config;
1401  TIM_OC_InitTypeDef s_oc_config;
1402  TIM_ClockConfigTypeDef s_clk_source_config;
1403  TIM_SlaveConfigTypeDef s_slave_config;
1404 
1405  /* Configure the TIM peripheral --------------------------------------------*/
1406  /* Set TIMx instance */
1408  /* Timer Input Capture Configuration Structure declaration */
1409  /* Initialize TIMx peripheral as follow:
1410  + Period = 0xFFFF
1411  + Prescaler = 0
1412  + ClockDivision = 0
1413  + Counter direction = Up
1414  */
1415  haudio_tim.Init.Period = 1;
1419 
1420  /* Initialize the TIMx peripheral with the structure above */
1423 
1424  /* Configure the Input Capture channel -------------------------------------*/
1425  /* Configure the Input Capture of channel 2 */
1426  s_ic_config.ICPolarity = TIM_ICPOLARITY_FALLING;
1427  s_ic_config.ICSelection = TIM_ICSELECTION_DIRECTTI;
1428  s_ic_config.ICPrescaler = TIM_ICPSC_DIV1;
1429  s_ic_config.ICFilter = 0;
1431 
1432  /* Select external clock mode 1 */
1433  s_clk_source_config.ClockSource = TIM_CLOCKSOURCE_ETRMODE1;
1434  s_clk_source_config.ClockPolarity = TIM_CLOCKPOLARITY_NONINVERTED;
1435  s_clk_source_config.ClockPrescaler = TIM_CLOCKPRESCALER_DIV1;
1436  s_clk_source_config.ClockFilter = 0;
1437  HAL_TIM_ConfigClockSource(&haudio_tim, &s_clk_source_config);
1438 
1439  /* Select Input Channel as input trigger */
1440  s_slave_config.InputTrigger = TIM_TS_TI1FP1;
1441  s_slave_config.SlaveMode = TIM_SLAVEMODE_EXTERNAL1;
1443  s_slave_config.TriggerPrescaler = TIM_CLOCKPRESCALER_DIV1;
1444  s_slave_config.TriggerFilter = 0;
1445  HAL_TIM_SlaveConfigSynchronization(&haudio_tim, &s_slave_config);
1446 
1447  /* Output Compare PWM Mode configuration: Channel2 */
1448  s_oc_config.OCMode = TIM_OCMODE_PWM1;
1449  s_oc_config.OCIdleState = TIM_OCIDLESTATE_SET;
1450  s_oc_config.Pulse = 1;
1451  s_oc_config.OCPolarity = TIM_OCPOLARITY_HIGH;
1452  s_oc_config.OCNPolarity = TIM_OCNPOLARITY_HIGH;
1453  s_oc_config.OCFastMode = TIM_OCFAST_DISABLE;
1454  s_oc_config.OCNIdleState = TIM_OCNIDLESTATE_SET;
1455 
1456  /* Initialize the TIM3 Channel2 with the structure above */
1458 
1459  /* Start the TIM3 Channel2 */
1461 
1462  /* Start the TIM3 Channel1 */
1464 }
1465 
1470 static void TIMx_DeInit(void)
1471 {
1473 
1474  /* Stop the TIM3 Channel2 */
1476  /* Stop the TIM3 Channel1 */
1478 
1480 
1481  /* Initialize the TIMx peripheral with the structure above */
1483 }
1484 
1501 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
SAI_InitTypeDef::MonoStereoMode
uint32_t MonoStereoMode
Definition: stm32f7xx_hal_sai.h:105
TIM_SlaveConfigTypeDef::SlaveMode
uint32_t SlaveMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:247
AUDIO_SAIx_DMAx_MEM_DATA_SIZE
#define AUDIO_SAIx_DMAx_MEM_DATA_SIZE
Definition: stm32469i_discovery_audio.h:145
I2S_STANDARD_LSB
#define I2S_STANDARD_LSB
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:205
TIM_IC_InitTypeDef::ICPrescaler
uint32_t ICPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:154
TIM_OC_InitTypeDef::Pulse
uint32_t Pulse
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:83
TIM_OC_InitTypeDef::OCFastMode
uint32_t OCFastMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:93
DMA_InitTypeDef::Channel
uint32_t Channel
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:51
RCC_PeriphCLKInitTypeDef::PLLI2SDivQ
uint32_t PLLI2SDivQ
Definition: stm32f7xx_hal_rcc_ex.h:137
TIM_OCPOLARITY_HIGH
#define TIM_OCPOLARITY_HIGH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:553
TIM_OC_InitTypeDef::OCMode
uint32_t OCMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:80
__HAL_LINKDMA
#define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__)
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:66
__IO
#define __IO
Definition: imxrt1050/imxrt1050-evkb/CMSIS/core_cm7.h:237
GPIO_MODE_AF_PP
#define GPIO_MODE_AF_PP
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:122
AUDIO_TIMx_CLK_DISABLE
#define AUDIO_TIMx_CLK_DISABLE()
Definition: stm32469i_discovery_audio.h:195
AUDIO_I2Sx_SD_GPIO_PORT
#define AUDIO_I2Sx_SD_GPIO_PORT
Definition: stm32469i_discovery_audio.h:169
BSP_AUDIO_OUT_ChangeBuffer
void BSP_AUDIO_OUT_ChangeBuffer(uint16_t *pData, uint16_t Size)
Sends n-Bytes on the SAI interface.
Definition: stm32469i_discovery_audio.c:322
SAI_FREE_PROTOCOL
#define SAI_FREE_PROTOCOL
Definition: stm32f7xx_hal_sai.h:350
stm32469i_discovery_audio.h
This file contains the common defines and functions prototypes for the stm32469i_discovery_audio....
AUDIO_FREQUENCY_11K
#define AUDIO_FREQUENCY_11K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:100
TIM_OCNIDLESTATE_SET
#define TIM_OCNIDLESTATE_SET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:580
SAI_InitTypeDef::ClockStrobing
uint32_t ClockStrobing
Definition: stm32f7xx_hal_sai.h:126
SAI_FIFOTHRESHOLD_1QF
#define SAI_FIFOTHRESHOLD_1QF
Definition: stm32f7xx_hal_sai.h:501
DMA_PINC_DISABLE
#define DMA_PINC_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:240
__HAL_I2S_ENABLE
#define __HAL_I2S_ENABLE(__HANDLE__)
Enable the specified SPI peripheral (in I2S mode).
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:348
TIMx_Init
static void TIMx_Init(void)
Configure TIM as a clock divider by 2. I2S_SCK is externally connected to TIMx input channel.
Definition: stm32469i_discovery_audio.c:1398
BSP_AUDIO_OUT_SetMute
uint8_t BSP_AUDIO_OUT_SetMute(uint32_t Cmd)
Enables or disables the MUTE mode by software.
Definition: stm32469i_discovery_audio.c:452
TIM_SlaveConfigTypeDef::TriggerPrescaler
uint32_t TriggerPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:253
HAL_NVIC_EnableIRQ
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
BSP_AUDIO_IN_Stop
uint8_t BSP_AUDIO_IN_Stop(void)
Stops audio recording.
Definition: stm32469i_discovery_audio.c:976
HAL_SAI_DMAStop
HAL_StatusTypeDef HAL_SAI_DMAStop(SAI_HandleTypeDef *hsai)
SAI_CLOCKSTROBING_FALLINGEDGE
#define SAI_CLOCKSTROBING_FALLINGEDGE
Definition: stm32f7xx_hal_sai.h:382
HAL_I2S_RxHalfCpltCallback
void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
Rx Half Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:1089
SAI_FrameInitTypeDef::ActiveFrameLength
uint32_t ActiveFrameLength
Definition: stm32f7xx_hal_sai.h:146
AUDIO_TIMx_AF
#define AUDIO_TIMx_AF
Definition: stm32469i_discovery_audio.h:204
__DMA_HandleTypeDef
DMA handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:139
NULL
#define NULL
Definition: porcupine/demo/c/dr_libs/tests/external/miniaudio/extras/speex_resampler/thirdparty/resample.c:92
DEFAULT_AUDIO_IN_CHANNEL_NBR
#define DEFAULT_AUDIO_IN_CHANNEL_NBR
Definition: stm32f4_discovery_audio.h:156
AUDIO_TIMx_OUT_GPIO_PIN
#define AUDIO_TIMx_OUT_GPIO_PIN
Definition: stm32469i_discovery_audio.h:203
TIMx_DeInit
static void TIMx_DeInit(void)
Configure TIM as a clock divider by 2. I2S_SCK is externally connected to TIMx input channel.
Definition: stm32469i_discovery_audio.c:1470
AUDIO_DrvTypeDef::Play
uint32_t(* Play)(uint16_t, uint16_t *, uint16_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:86
GPIO_InitTypeDef
GPIO Init structure definition
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:47
BSP_AUDIO_OUT_ClockConfig
__weak void BSP_AUDIO_OUT_ClockConfig(SAI_HandleTypeDef *hsai, uint32_t AudioFreq, void *Params)
Clock Config.
Definition: stm32469i_discovery_audio.c:783
CODEC_PDWN_HW
#define CODEC_PDWN_HW
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:85
AUDIO_TIMx_GPIO_PORT
#define AUDIO_TIMx_GPIO_PORT
Definition: stm32469i_discovery_audio.h:201
I2S_InitTypeDef::CPOL
uint32_t CPOL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:64
__SAI_HandleTypeDef::hdmatx
DMA_HandleTypeDef * hdmatx
Definition: stm32f7xx_hal_sai.h:207
HAL_SAI_DMAPause
HAL_StatusTypeDef HAL_SAI_DMAPause(SAI_HandleTypeDef *hsai)
TIM_COUNTERMODE_UP
#define TIM_COUNTERMODE_UP
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:494
AUDIO_TIMx_IN_GPIO_PIN
#define AUDIO_TIMx_IN_GPIO_PIN
Definition: stm32469i_discovery_audio.h:202
AUDIO_IN_IRQ_PREPRIO
#define AUDIO_IN_IRQ_PREPRIO
Definition: stm32f4_discovery_audio.h:140
HAL_TIM_PWM_ConfigChannel
HAL_StatusTypeDef HAL_TIM_PWM_ConfigChannel(TIM_HandleTypeDef *htim, TIM_OC_InitTypeDef *sConfig, uint32_t Channel)
TIM_IC_InitTypeDef::ICPolarity
uint32_t ICPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:148
DMA_InitTypeDef::Priority
uint32_t Priority
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:75
DMA_InitTypeDef::PeriphInc
uint32_t PeriphInc
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:58
SAI_InitTypeDef::AudioFrequency
uint32_t AudioFrequency
Definition: stm32f7xx_hal_sai.h:97
SAI_FrameInitTypeDef::FSDefinition
uint32_t FSDefinition
Definition: stm32f7xx_hal_sai.h:151
SAI_SLOTSIZE_DATASIZE
#define SAI_SLOTSIZE_DATASIZE
Definition: stm32f7xx_hal_sai.h:447
I2S_InitTypeDef::MCLKOutput
uint32_t MCLKOutput
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:58
BSP_AUDIO_OUT_SetAudioFrameSlot
void BSP_AUDIO_OUT_SetAudioFrameSlot(uint32_t AudioFrameSlot)
Updates the Audio frame slot configuration.
Definition: stm32469i_discovery_audio.c:576
TIM_CLOCKPOLARITY_NONINVERTED
#define TIM_CLOCKPOLARITY_NONINVERTED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:737
BSP_AUDIO_IN_DeInit
void BSP_AUDIO_IN_DeInit(void)
Deinit the audio IN peripherals.
Definition: stm32469i_discovery_audio.c:1036
TIM_OCIDLESTATE_SET
#define TIM_OCIDLESTATE_SET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:571
GPIO_InitTypeDef::Alternate
uint32_t Alternate
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:61
AUDIO_ERROR
#define AUDIO_ERROR
Definition: stm32f4_discovery_audio.h:150
HAL_SAI_DeInit
HAL_StatusTypeDef HAL_SAI_DeInit(SAI_HandleTypeDef *hsai)
I2S_HandleTypeDef
I2S handle Structure definition.
Definition: stm32f7xx_hal_i2s.h:91
TIM_Base_InitTypeDef::CounterMode
uint32_t CounterMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:52
AUDIO_I2Sx_SD_AF
#define AUDIO_I2Sx_SD_AF
Definition: stm32469i_discovery_audio.h:172
TIM_IC_InitTypeDef::ICFilter
uint32_t ICFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:157
__HAL_RCC_CRC_CLK_ENABLE
#define __HAL_RCC_CRC_CLK_ENABLE()
Definition: stm32f7xx_hal_rcc.h:409
haudio_out_sai
SAI_HandleTypeDef haudio_out_sai
Definition: stm32469i_discovery_audio.c:170
HAL_NVIC_DisableIRQ
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
TIM_OCNPOLARITY_HIGH
#define TIM_OCNPOLARITY_HIGH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:562
RCC_PeriphCLKInitTypeDef::PeriphClockSelection
uint32_t PeriphClockSelection
Definition: stm32f7xx_hal_rcc_ex.h:128
I2S_InitTypeDef::Standard
uint32_t Standard
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:52
BSP_AUDIO_OUT_MspInit
__weak void BSP_AUDIO_OUT_MspInit(SAI_HandleTypeDef *hsai, void *Params)
Initializes BSP_AUDIO_OUT MSP.
Definition: stm32469i_discovery_audio.c:659
TIM_OC_InitTypeDef::OCNPolarity
uint32_t OCNPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:89
TIM_CLOCKPRESCALER_DIV1
#define TIM_CLOCKPRESCALER_DIV1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:748
BSP_AUDIO_OUT_SetFrequency
void BSP_AUDIO_OUT_SetFrequency(uint32_t AudioFreq)
Updates the audio frequency.
Definition: stm32469i_discovery_audio.c:493
GPIO_PIN_SET
@ GPIO_PIN_SET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:71
HAL_SAI_GetState
HAL_SAI_StateTypeDef HAL_SAI_GetState(SAI_HandleTypeDef *hsai)
SAI_FS_CHANNEL_IDENTIFICATION
#define SAI_FS_CHANNEL_IDENTIFICATION
Definition: stm32f7xx_hal_sai.h:421
SAI_InitTypeDef::Protocol
uint32_t Protocol
Definition: stm32f7xx_hal_sai.h:117
AUDIO_RESET_ENABLE
#define AUDIO_RESET_ENABLE()
Definition: stm32469i_discovery_audio.h:133
AUDIO_I2C_ADDRESS
#define AUDIO_I2C_ADDRESS
AUDIO I2C Interface pins.
Definition: stm32f4_discovery.h:247
__DMA_HandleTypeDef::Init
DMA_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:143
RCC_PERIPHCLK_I2S
#define RCC_PERIPHCLK_I2S
Definition: stm32f7xx_hal_rcc_ex.h:237
BSP_AUDIO_OUT_STEREOMODE
#define BSP_AUDIO_OUT_STEREOMODE
Definition: stm32469i_discovery_audio.h:87
TIM_OC_InitTypeDef::OCIdleState
uint32_t OCIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:98
DMA_InitTypeDef::FIFOThreshold
uint32_t FIFOThreshold
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:83
DMA_CIRCULAR
#define DMA_CIRCULAR
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:282
SAI_SlotInitTypeDef::SlotNumber
uint32_t SlotNumber
Definition: stm32f7xx_hal_sai.h:177
DMA_InitTypeDef::PeriphDataAlignment
uint32_t PeriphDataAlignment
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:64
RCC_PeriphCLKInitTypeDef::PLLI2S
RCC_PLLI2SInitTypeDef PLLI2S
Definition: stm32f7xx_hal_rcc_ex.h:131
HAL_I2S_DMAPause
HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s)
AUDIODATA_SIZE
#define AUDIODATA_SIZE
Definition: stm32f4_discovery_audio.h:146
TIM_Base_InitTypeDef::ClockDivision
uint32_t ClockDivision
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:59
INTERNAL_BUFF_SIZE
#define INTERNAL_BUFF_SIZE
Definition: stm32f4_discovery_audio.h:160
AUDIO_OUT_IRQ_PREPRIO
#define AUDIO_OUT_IRQ_PREPRIO
Definition: stm32f4_discovery_audio.h:109
__SAI_HandleTypeDef::Instance
SAI_Block_TypeDef * Instance
Definition: stm32f7xx_hal_sai.h:193
HAL_Delay
void HAL_Delay(uint32_t Delay)
This function provides minimum delay (in milliseconds) based on variable incremented.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c:389
SAI_InitTypeDef::FIFOThreshold
uint32_t FIFOThreshold
Definition: stm32f7xx_hal_sai.h:94
TIM_ClockConfigTypeDef::ClockPolarity
uint32_t ClockPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:201
AudioInVolume
uint16_t __IO AudioInVolume
Definition: stm32469i_discovery_audio.c:197
DMA_MBURST_SINGLE
#define DMA_MBURST_SINGLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:326
AUDIO_RESET_PIN
#define AUDIO_RESET_PIN
Definition: stm32f4_discovery.h:251
AUDIO_SAIx_SD_PIN
#define AUDIO_SAIx_SD_PIN
Definition: stm32469i_discovery_audio.h:130
I2S_HandleTypeDef::Instance
SPI_TypeDef * Instance
Definition: stm32f7xx_hal_i2s.h:94
TIM_Base_InitTypeDef::Period
uint32_t Period
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:55
HAL_OK
@ HAL_OK
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:42
AUDIO_TIMx_GPIO_CLK_ENABLE
#define AUDIO_TIMx_GPIO_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:199
TIM_ClockConfigTypeDef::ClockPrescaler
uint32_t ClockPrescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:203
AUDIO_I2Sx_CLK_DISABLE
#define AUDIO_I2Sx_CLK_DISABLE()
Definition: stm32469i_discovery_audio.h:161
DMA_PERIPH_TO_MEMORY
#define DMA_PERIPH_TO_MEMORY
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:228
SAI_FrameInitTypeDef::FSOffset
uint32_t FSOffset
Definition: stm32f7xx_hal_sai.h:157
HAL_I2S_Receive_DMA
HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
SAI_InitTypeDef::Synchro
uint32_t Synchro
Definition: stm32f7xx_hal_sai.h:71
BSP_AUDIO_IN_Record
uint8_t BSP_AUDIO_IN_Record(uint16_t *pbuf, uint32_t size)
Starts audio recording.
Definition: stm32469i_discovery_audio.c:959
BSP_AUDIO_IN_MspDeInit
__weak void BSP_AUDIO_IN_MspDeInit(I2S_HandleTypeDef *hi2s, void *Params)
DeInitializes BSP_AUDIO_IN MSP.
Definition: stm32469i_discovery_audio.c:1238
AUDIO_SAIx_CLK_DISABLE
#define AUDIO_SAIx_CLK_DISABLE()
Definition: stm32469i_discovery_audio.h:117
audio_drv
AUDIO_DrvTypeDef * audio_drv
Definition: stm32469i_discovery_audio.c:169
BSP_AUDIO_IN_Init
uint8_t BSP_AUDIO_IN_Init(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr)
Initializes wave recording.
Definition: stm32469i_discovery_audio.c:928
HAL_GPIO_Init
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
BSP_AUDIO_OUT_Stop
uint8_t BSP_AUDIO_OUT_Stop(uint32_t Option)
Stops audio playing and Power down the Audio Codec.
Definition: stm32469i_discovery_audio.c:398
TIM_IC_InitTypeDef::ICSelection
uint32_t ICSelection
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:151
AUDIO_SAIx_DMAx_STREAM
#define AUDIO_SAIx_DMAx_STREAM
Definition: stm32469i_discovery_audio.h:141
TIM_IC_InitTypeDef
TIM Input Capture Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:146
BSP_AUDIO_OUT_Pause
uint8_t BSP_AUDIO_OUT_Pause(void)
This function Pauses the audio file stream. In case of using DMA, the DMA Pause feature is used.
Definition: stm32469i_discovery_audio.c:335
AUDIO_RESET_GPIO_PORT
#define AUDIO_RESET_GPIO_PORT
Definition: stm32469i_discovery_audio.h:136
TIM_OCFAST_DISABLE
#define TIM_OCFAST_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:535
HAL_I2S_ErrorCallback
void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s)
I2S error callbacks.
Definition: stm32469i_discovery_audio.c:1100
GPIO_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:52
HAL_I2S_DMAResume
HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s)
AUDIO_FREQUENCY_22K
#define AUDIO_FREQUENCY_22K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:98
DMA_InitTypeDef::MemInc
uint32_t MemInc
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:61
AUDIO_SAIx_DMAx_CHANNEL
#define AUDIO_SAIx_DMAx_CHANNEL
Definition: stm32469i_discovery_audio.h:142
HAL_I2S_GetState
HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s)
TIM_HandleTypeDef::Instance
TIM_TypeDef * Instance
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:318
HAL_TIM_IC_Init
HAL_StatusTypeDef HAL_TIM_IC_Init(TIM_HandleTypeDef *htim)
__SAI_HandleTypeDef::Init
SAI_InitTypeDef Init
Definition: stm32f7xx_hal_sai.h:195
AUDIO_TIMx
#define AUDIO_TIMx
Definition: stm32469i_discovery_audio.h:196
AUDIO_DrvTypeDef::SetMute
uint32_t(* SetMute)(uint16_t, uint32_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:92
TIM_OCMODE_PWM1
#define TIM_OCMODE_PWM1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:875
I2S_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:49
GPIO_InitTypeDef::Pull
uint32_t Pull
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:55
SAI_MONOMODE
#define SAI_MONOMODE
Definition: stm32f7xx_hal_sai.h:483
GPIO_NOPULL
#define GPIO_NOPULL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:154
__SAI_HandleTypeDef
Definition: stm32f7xx_hal_sai.h:191
TIM_SlaveConfigTypeDef::TriggerFilter
uint32_t TriggerFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:255
SAI_InitTypeDef::OutputDrive
uint32_t OutputDrive
Definition: stm32f7xx_hal_sai.h:80
BSP_AUDIO_OUT_TransferComplete_CallBack
__weak void BSP_AUDIO_OUT_TransferComplete_CallBack(void)
Manages the DMA full Transfer complete event.
Definition: stm32469i_discovery_audio.c:636
AUDIO_DrvTypeDef::Init
uint32_t(* Init)(uint16_t, uint16_t, uint8_t, uint32_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:83
AUDIO_I2Sx_SD_PIN
#define AUDIO_I2Sx_SD_PIN
Definition: stm32469i_discovery_audio.h:168
BSP_AUDIO_OUT_SetOutputMode
uint8_t BSP_AUDIO_OUT_SetOutputMode(uint8_t Output)
Switch dynamically (while audio file is being played) the output target (speaker or headphone).
Definition: stm32469i_discovery_audio.c:473
HAL_TIM_PWM_Start
HAL_StatusTypeDef HAL_TIM_PWM_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
DMA_InitTypeDef::PeriphBurst
uint32_t PeriphBurst
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:92
CHANNEL_DEMUX_MASK
#define CHANNEL_DEMUX_MASK
Definition: stm32f4_discovery_audio.h:163
TIM_ClockConfigTypeDef::ClockSource
uint32_t ClockSource
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:199
HAL_I2S_Init
HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s)
AUDIO_SAIx_DMAx_IRQ
#define AUDIO_SAIx_DMAx_IRQ
Definition: stm32469i_discovery_audio.h:143
AUDIO_FREQUENCY_44K
#define AUDIO_FREQUENCY_44K
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:96
BSP_AUDIO_IN_MspInit
__weak void BSP_AUDIO_IN_MspInit(I2S_HandleTypeDef *hi2s, void *Params)
BSP AUDIO IN MSP Init.
Definition: stm32469i_discovery_audio.c:1159
TIM_ICPOLARITY_FALLING
#define TIM_ICPOLARITY_FALLING
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:590
SAI_InitTypeDef::NoDivider
uint32_t NoDivider
Definition: stm32f7xx_hal_sai.h:85
AUDIO_SAIx_MCK_PIN
#define AUDIO_SAIx_MCK_PIN
Definition: stm32469i_discovery_audio.h:123
AUDIO_SAIx_SCK_SD_FS_GPIO_PORT
#define AUDIO_SAIx_SCK_SD_FS_GPIO_PORT
Definition: stm32469i_discovery_audio.h:131
DMA_PRIORITY_HIGH
#define DMA_PRIORITY_HIGH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:294
BSP_AUDIO_OUT_DeInit
void BSP_AUDIO_OUT_DeInit(void)
Deinit the audio peripherals.
Definition: stm32469i_discovery_audio.c:592
TIM_CLOCKSOURCE_ETRMODE1
#define TIM_CLOCKSOURCE_ETRMODE1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:728
__DMA_HandleTypeDef::Instance
DMA_Stream_TypeDef * Instance
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:141
PDM_FilterConfig
PDM_Filter_Config_t PDM_FilterConfig[2]
Definition: stm32469i_discovery_audio.c:176
HAL_SAI_DMAResume
HAL_StatusTypeDef HAL_SAI_DMAResume(SAI_HandleTypeDef *hsai)
AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE
#define AUDIO_SAIx_DMAx_PERIPH_DATA_SIZE
Definition: stm32469i_discovery_audio.h:144
RCC_PLLI2SInitTypeDef::PLLI2SN
uint32_t PLLI2SN
Definition: stm32f7xx_hal_rcc_ex.h:78
TIM_OC_InitTypeDef
TIM Output Compare Configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:78
DMA_InitTypeDef::MemDataAlignment
uint32_t MemDataAlignment
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:67
AUDIO_SAIx_MCLK_SCK_SD_FS_AF
#define AUDIO_SAIx_MCLK_SCK_SD_FS_AF
Definition: stm32469i_discovery_audio.h:118
TIM_HandleTypeDef
TIM Time Base Handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:315
HAL_GPIO_DeInit
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
AUDIO_DrvTypeDef::Stop
uint32_t(* Stop)(uint16_t, uint32_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:89
AUDIO_TIMx_OUT_CHANNEL
#define AUDIO_TIMx_OUT_CHANNEL
Definition: stm32469i_discovery_audio.h:198
HAL_SAI_ErrorCallback
void HAL_SAI_ErrorCallback(SAI_HandleTypeDef *hsai)
SAI error callbacks.
Definition: stm32469i_discovery_audio.c:628
BSP_AUDIO_OUT_SetVolume
uint8_t BSP_AUDIO_OUT_SetVolume(uint8_t Volume)
Controls the current audio volume level.
Definition: stm32469i_discovery_audio.c:432
SAI_OUTPUTDRIVE_ENABLE
#define SAI_OUTPUTDRIVE_ENABLE
Definition: stm32f7xx_hal_sai.h:403
AUDIO_I2Sx_SD_GPIO_CLK_ENABLE
#define AUDIO_I2Sx_SD_GPIO_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:170
AUDIO_I2Sx_SCK_GPIO_PORT
#define AUDIO_I2Sx_SCK_GPIO_PORT
Definition: stm32469i_discovery_audio.h:163
TIM_ClockConfigTypeDef
Clock Configuration Handle Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:197
GPIO_InitTypeDef::Speed
uint32_t Speed
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:58
HAL_SAI_TxHalfCpltCallback
void HAL_SAI_TxHalfCpltCallback(SAI_HandleTypeDef *hsai)
Tx Half Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:617
AUDIO_SAIx_DMAx_CLK_ENABLE
#define AUDIO_SAIx_DMAx_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:139
TIMx_IC_MspDeInit
static void TIMx_IC_MspDeInit(TIM_HandleTypeDef *htim)
Initializes the TIM INput Capture MSP.
Definition: stm32469i_discovery_audio.c:1385
BSP_AUDIO_OUT_CIRCULARMODE
#define BSP_AUDIO_OUT_CIRCULARMODE
Definition: stm32469i_discovery_audio.h:85
DMA_PBURST_SINGLE
#define DMA_PBURST_SINGLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:338
RCC_PLLI2SInitTypeDef::PLLI2SR
uint32_t PLLI2SR
Definition: stm32f7xx_hal_rcc_ex.h:82
AUDIO_I2Sx_DMAx_CHANNEL
#define AUDIO_I2Sx_DMAx_CHANNEL
Definition: stm32469i_discovery_audio.h:178
GPIO_PIN_RESET
@ GPIO_PIN_RESET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:70
__HAL_SAI_DISABLE
#define __HAL_SAI_DISABLE(__HANDLE__)
Definition: stm32f7xx_hal_sai.h:658
I2Sx_DeInit
static void I2Sx_DeInit(void)
Deinitializes the Audio Codec audio interface (I2S).
Definition: stm32469i_discovery_audio.c:1337
BSP_AUDIO_OUT_ChangeAudioConfig
void BSP_AUDIO_OUT_ChangeAudioConfig(uint32_t AudioOutOption)
Changes the Audio Out Configuration.
Definition: stm32469i_discovery_audio.c:516
SAI_MODEMASTER_TX
#define SAI_MODEMASTER_TX
Definition: stm32f7xx_hal_sai.h:338
HAL_TIM_ConfigClockSource
HAL_StatusTypeDef HAL_TIM_ConfigClockSource(TIM_HandleTypeDef *htim, TIM_ClockConfigTypeDef *sClockSourceConfig)
TIM_SlaveConfigTypeDef::InputTrigger
uint32_t InputTrigger
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:249
SAI_InitTypeDef::DataSize
uint32_t DataSize
Definition: stm32f7xx_hal_sai.h:120
BSP_AUDIO_OUT_Error_CallBack
__weak void BSP_AUDIO_OUT_Error_CallBack(void)
Manages the DMA FIFO error event.
Definition: stm32469i_discovery_audio.c:650
AUDIO_I2Sx_SCK_AF
#define AUDIO_I2Sx_SCK_AF
Definition: stm32469i_discovery_audio.h:166
AUDIO_DrvTypeDef
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:81
TIM_Base_InitTypeDef::Prescaler
uint32_t Prescaler
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:49
SAI_SlotInitTypeDef::SlotSize
uint32_t SlotSize
Definition: stm32f7xx_hal_sai.h:174
Channel_Demux
uint8_t Channel_Demux[128]
Definition: stm32469i_discovery_audio.c:178
DMA_MINC_ENABLE
#define DMA_MINC_ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:249
DEFAULT_AUDIO_IN_VOLUME
#define DEFAULT_AUDIO_IN_VOLUME
Definition: stm32f4_discovery_audio.h:157
SAI_SlotInitTypeDef::SlotActive
uint32_t SlotActive
Definition: stm32f7xx_hal_sai.h:180
HAL_TIM_IC_Stop
HAL_StatusTypeDef HAL_TIM_IC_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
haudio_tim
TIM_HandleTypeDef haudio_tim
Definition: stm32469i_discovery_audio.c:172
HAL_TIM_IC_DeInit
HAL_StatusTypeDef HAL_TIM_IC_DeInit(TIM_HandleTypeDef *htim)
AUDIO_DrvTypeDef::Resume
uint32_t(* Resume)(uint16_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:88
HAL_TIM_IC_ConfigChannel
HAL_StatusTypeDef HAL_TIM_IC_ConfigChannel(TIM_HandleTypeDef *htim, TIM_IC_InitTypeDef *sConfig, uint32_t Channel)
HAL_SAI_TxCpltCallback
void HAL_SAI_TxCpltCallback(SAI_HandleTypeDef *hsai)
Tx Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:606
__HAL_SAI_ENABLE
#define __HAL_SAI_ENABLE(__HANDLE__)
Definition: stm32f7xx_hal_sai.h:657
SAI_FIRSTBIT_MSB
#define SAI_FIRSTBIT_MSB
Definition: stm32f7xx_hal_sai.h:373
SAI_SlotInitTypeDef::FirstBitOffset
uint32_t FirstBitOffset
Definition: stm32f7xx_hal_sai.h:171
I2S_HandleTypeDef::hdmarx
DMA_HandleTypeDef * hdmarx
Definition: stm32f7xx_hal_i2s.h:116
PDM_FilterHandler
PDM_Filter_Handler_t PDM_FilterHandler[2]
Definition: stm32469i_discovery_audio.c:175
DMA_InitTypeDef::MemBurst
uint32_t MemBurst
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:86
AUDIO_I2Sx_DMAx_STREAM
#define AUDIO_I2Sx_DMAx_STREAM
Definition: stm32469i_discovery_audio.h:177
I2S_HandleTypeDef::Init
I2S_InitTypeDef Init
Definition: stm32f7xx_hal_i2s.h:96
I2S_InitTypeDef::DataFormat
uint32_t DataFormat
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:55
AUDIO_I2Sx_CLK_ENABLE
#define AUDIO_I2Sx_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:160
BSP_AUDIO_IN_SetVolume
uint8_t BSP_AUDIO_IN_SetVolume(uint8_t Volume)
Controls the audio in volume level.
Definition: stm32469i_discovery_audio.c:1024
CS43L22_ID
#define CS43L22_ID
CS43L22 ID
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.h:149
TIM_SlaveConfigTypeDef::TriggerPolarity
uint32_t TriggerPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:251
DMA_FIFOMODE_ENABLE
#define DMA_FIFOMODE_ENABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:305
TIM_SLAVEMODE_EXTERNAL1
#define TIM_SLAVEMODE_EXTERNAL1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:863
DMA_NORMAL
#define DMA_NORMAL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:281
HAL_TIM_PWM_Stop
HAL_StatusTypeDef HAL_TIM_PWM_Stop(TIM_HandleTypeDef *htim, uint32_t Channel)
SAI_MASTERDIVIDER_ENABLE
#define SAI_MASTERDIVIDER_ENABLE
Definition: stm32f7xx_hal_sai.h:411
SAI_DATASIZE_16
#define SAI_DATASIZE_16
Definition: stm32f7xx_hal_sai.h:362
DMA_InitTypeDef::FIFOMode
uint32_t FIFOMode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:78
haudio_in_i2s
I2S_HandleTypeDef haudio_in_i2s
Definition: stm32469i_discovery_audio.c:171
PDMDecoder_Init
static void PDMDecoder_Init(uint32_t AudioFreq, uint32_t ChnlNbrIn, uint32_t ChnlNbrOut)
Initializes the PDM library.
Definition: stm32469i_discovery_audio.c:1278
I2S_CPOL_LOW
#define I2S_CPOL_LOW
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:261
BSP_AUDIO_OUT_Resume
uint8_t BSP_AUDIO_OUT_Resume(void)
This function Resumes the audio file stream. WARNING: When calling BSP_AUDIO_OUT_Pause() function for...
Definition: stm32469i_discovery_audio.c:366
DMA_FIFOMODE_DISABLE
#define DMA_FIFOMODE_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:304
AUDIO_DrvTypeDef::ReadID
uint32_t(* ReadID)(uint16_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:85
TIM_ICSELECTION_DIRECTTI
#define TIM_ICSELECTION_DIRECTTI
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:608
SAI_FrameInitTypeDef::FSPolarity
uint32_t FSPolarity
Definition: stm32f7xx_hal_sai.h:154
SAIx_Init
static uint8_t SAIx_Init(uint32_t AudioFreq)
Initializes the Audio Codec audio interface (SAI).
Definition: stm32469i_discovery_audio.c:828
AUDIO_SAIx_MCLK_ENABLE
#define AUDIO_SAIx_MCLK_ENABLE()
Definition: stm32469i_discovery_audio.h:120
BSP_AUDIO_OUT_HalfTransfer_CallBack
__weak void BSP_AUDIO_OUT_HalfTransfer_CallBack(void)
Manages the DMA Half Transfer complete event.
Definition: stm32469i_discovery_audio.c:643
DMA_MEMORY_TO_PERIPH
#define DMA_MEMORY_TO_PERIPH
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:229
HAL_RCCEx_PeriphCLKConfig
HAL_StatusTypeDef HAL_RCCEx_PeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
HAL_DMA_Init
HAL_StatusTypeDef HAL_DMA_Init(DMA_HandleTypeDef *hdma)
HAL_I2S_STATE_RESET
@ HAL_I2S_STATE_RESET
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:78
AUDIO_I2Sx_DMAx_IRQ
#define AUDIO_I2Sx_DMAx_IRQ
Definition: stm32469i_discovery_audio.h:179
BSP_AUDIO_OUT_MspDeInit
__weak void BSP_AUDIO_OUT_MspDeInit(SAI_HandleTypeDef *hsai, void *Params)
Deinitializes BSP_AUDIO_OUT MSP.
Definition: stm32469i_discovery_audio.c:737
TIM_ClockConfigTypeDef::ClockFilter
uint32_t ClockFilter
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:205
AUDIO_SAIx_SCK_PIN
#define AUDIO_SAIx_SCK_PIN
Definition: stm32469i_discovery_audio.h:129
DMA_InitTypeDef::Direction
uint32_t Direction
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:54
HAL_TIM_IC_Start
HAL_StatusTypeDef HAL_TIM_IC_Start(TIM_HandleTypeDef *htim, uint32_t Channel)
HAL_DMA_DeInit
HAL_StatusTypeDef HAL_DMA_DeInit(DMA_HandleTypeDef *hdma)
AUDIO_SAIx_CLK_ENABLE
#define AUDIO_SAIx_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:116
I2S_CLOCK_PLL
#define I2S_CLOCK_PLL
Definition: stm32f7xx_hal_i2s.h:284
BSP_AUDIO_OUT_Play
uint8_t BSP_AUDIO_OUT_Play(uint16_t *pBuffer, uint32_t Size)
Starts playing audio stream from a data buffer for a determined size.
Definition: stm32469i_discovery_audio.c:295
TIM_HandleTypeDef::Init
TIM_Base_InitTypeDef Init
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:319
SAI_FS_ACTIVE_LOW
#define SAI_FS_ACTIVE_LOW
Definition: stm32f7xx_hal_sai.h:429
I2Sx_Init
static void I2Sx_Init(uint32_t AudioFreq)
Initializes the Audio Codec audio interface (I2S)
Definition: stm32469i_discovery_audio.c:1309
CODEC_AUDIOFRAME_SLOT_0123
#define CODEC_AUDIOFRAME_SLOT_0123
Definition: stm32469i_discovery_audio.h:105
Output
Output
SAI_ASYNCHRONOUS
#define SAI_ASYNCHRONOUS
Definition: stm32f7xx_hal_sai.h:391
TIM_TRIGGERPOLARITY_NONINVERTED
#define TIM_TRIGGERPOLARITY_NONINVERTED
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:903
HAL_SAI_Init
HAL_StatusTypeDef HAL_SAI_Init(SAI_HandleTypeDef *hsai)
AUDIO_I2Sx_DMAx_CLK_ENABLE
#define AUDIO_I2Sx_DMAx_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:175
AUDIO_DrvTypeDef::Pause
uint32_t(* Pause)(uint16_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:87
AUDIO_I2Sx_SCK_PIN
#define AUDIO_I2Sx_SCK_PIN
Definition: stm32469i_discovery_audio.h:162
TIM_TS_TI1FP1
#define TIM_TS_TI1FP1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:891
AUDIO_DrvTypeDef::SetOutputMode
uint32_t(* SetOutputMode)(uint16_t, uint8_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:93
RCC_PLLI2SInitTypeDef::PLLI2SQ
uint32_t PLLI2SQ
Definition: stm32f7xx_hal_rcc_ex.h:86
AUDIO_I2Sx_DMAx_MEM_DATA_SIZE
#define AUDIO_I2Sx_DMAx_MEM_DATA_SIZE
Definition: stm32469i_discovery_audio.h:181
BSP_AUDIO_IN_Pause
uint8_t BSP_AUDIO_IN_Pause(void)
Pauses the audio file stream.
Definition: stm32469i_discovery_audio.c:996
HAL_NVIC_SetPriority
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
AUDIO_OK
#define AUDIO_OK
Definition: stm32f4_discovery_audio.h:149
BSP_AUDIO_IN_ClockConfig
__weak void BSP_AUDIO_IN_ClockConfig(I2S_HandleTypeDef *hi2s, void *Params)
Clock Config.
Definition: stm32469i_discovery_audio.c:1114
AUDIO_SAIx_MCLK_GPIO_PORT
#define AUDIO_SAIx_MCLK_GPIO_PORT
Definition: stm32469i_discovery_audio.h:124
I2S_InitTypeDef::ClockSource
uint32_t ClockSource
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:67
RCC_PeriphCLKInitTypeDef
RCC extended clocks structure definition.
Definition: stm32f7xx_hal_rcc_ex.h:126
I2S_MCLKOUTPUT_DISABLE
#define I2S_MCLKOUTPUT_DISABLE
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:227
BSP_AUDIO_OUT_Init
uint8_t BSP_AUDIO_OUT_Init(uint16_t OutputDevice, uint8_t Volume, uint32_t AudioFreq)
Configures the audio peripherals.
Definition: stm32469i_discovery_audio.c:235
GPIO_MODE_OUTPUT_PP
#define GPIO_MODE_OUTPUT_PP
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:120
SAI_InitTypeDef::AudioMode
uint32_t AudioMode
Definition: stm32f7xx_hal_sai.h:68
DMA_InitTypeDef::Mode
uint32_t Mode
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:70
AUDIO_I2Sx_DMAx_PERIPH_DATA_SIZE
#define AUDIO_I2Sx_DMAx_PERIPH_DATA_SIZE
Definition: stm32469i_discovery_audio.h:180
TIM_ICPSC_DIV1
#define TIM_ICPSC_DIV1
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:620
TIM_OC_InitTypeDef::OCNIdleState
uint32_t OCNIdleState
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:102
SAI_STEREOMODE
#define SAI_STEREOMODE
Definition: stm32f7xx_hal_sai.h:482
AUDIO_TIMx_IN_CHANNEL
#define AUDIO_TIMx_IN_CHANNEL
Definition: stm32469i_discovery_audio.h:197
AUDIO_I2Sx
#define AUDIO_I2Sx
Definition: stm32469i_discovery_audio.h:159
SAI_FrameInitTypeDef::FrameLength
uint32_t FrameLength
Definition: stm32f7xx_hal_sai.h:140
HAL_SAI_STATE_RESET
@ HAL_SAI_STATE_RESET
Definition: stm32f7xx_hal_sai.h:50
__HAL_I2S_DISABLE
#define __HAL_I2S_DISABLE(__HANDLE__)
Disable the specified SPI peripheral (in I2S mode).
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:354
AUDIO_DrvTypeDef::SetVolume
uint32_t(* SetVolume)(uint16_t, uint8_t)
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/Common/audio.h:91
HAL_I2S_DeInit
HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
DMA_FIFO_THRESHOLD_FULL
#define DMA_FIFO_THRESHOLD_FULL
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h:317
SAIx_DeInit
static void SAIx_DeInit(void)
Deinitializes the Audio Codec audio interface (SAI).
Definition: stm32469i_discovery_audio.c:899
AUDIO_SAIx_SCK_SD_FS_ENABLE
#define AUDIO_SAIx_SCK_SD_FS_ENABLE()
Definition: stm32469i_discovery_audio.h:126
AUDIO_TIMx_CLK_ENABLE
#define AUDIO_TIMx_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:194
BSP_AUDIO_IN_PDMToPCM
uint8_t BSP_AUDIO_IN_PDMToPCM(uint16_t *PDMBuf, uint16_t *PCMBuf)
Converts audio format from PDM to PCM.
Definition: stm32469i_discovery_audio.c:1050
BSP_AUDIO_IN_HalfTransfer_CallBack
__weak void BSP_AUDIO_IN_HalfTransfer_CallBack(void)
Manages the DMA Half Transfer complete event.
Definition: stm32469i_discovery_audio.c:1138
__SAI_HandleTypeDef::SlotInit
SAI_SlotInitTypeDef SlotInit
Definition: stm32f7xx_hal_sai.h:199
BSP_AUDIO_IN_Resume
uint8_t BSP_AUDIO_IN_Resume(void)
Resumes the audio file stream.
Definition: stm32469i_discovery_audio.c:1009
__SAI_HandleTypeDef::FrameInit
SAI_FrameInitTypeDef FrameInit
Definition: stm32f7xx_hal_sai.h:197
I2S_DATAFORMAT_16B
#define I2S_DATAFORMAT_16B
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:215
cs43l22_drv
AUDIO_DrvTypeDef cs43l22_drv
Definition: stm32f407/stm32f407g-disc1/Drivers/BSP/Components/cs43l22/cs43l22.c:87
AUDIO_I2Sx_SCK_GPIO_CLK_ENABLE
#define AUDIO_I2Sx_SCK_GPIO_CLK_ENABLE()
Definition: stm32469i_discovery_audio.h:164
TIM_OC_InitTypeDef::OCPolarity
uint32_t OCPolarity
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:86
DMA_MAX
#define DMA_MAX(_X_)
Definition: stm32f4_discovery_audio.h:184
SAI_FS_BEFOREFIRSTBIT
#define SAI_FS_BEFOREFIRSTBIT
Definition: stm32f7xx_hal_sai.h:439
AUDIO_SAIx_FS_PIN
#define AUDIO_SAIx_FS_PIN
Definition: stm32469i_discovery_audio.h:128
BSP_AUDIO_IN_TransferComplete_CallBack
__weak void BSP_AUDIO_IN_TransferComplete_CallBack(void)
User callback when record buffer is filled.
Definition: stm32469i_discovery_audio.c:1128
SAI_InitTypeDef::FirstBit
uint32_t FirstBit
Definition: stm32f7xx_hal_sai.h:123
AUDIO_SAIx
#define AUDIO_SAIx
Definition: stm32469i_discovery_audio.h:115
HAL_RCCEx_GetPeriphCLKConfig
void HAL_RCCEx_GetPeriphCLKConfig(RCC_PeriphCLKInitTypeDef *PeriphClkInit)
BSP_AUDIO_IN_Error_Callback
__weak void BSP_AUDIO_IN_Error_Callback(void)
Audio IN Error callback function.
Definition: stm32469i_discovery_audio.c:1148
HAL_I2S_RxCpltCallback
void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s)
Rx Transfer completed callbacks.
Definition: stm32469i_discovery_audio.c:1079
HAL_SAI_Transmit_DMA
HAL_StatusTypeDef HAL_SAI_Transmit_DMA(SAI_HandleTypeDef *hsai, uint8_t *pData, uint16_t Size)
TIMx_IC_MspInit
static void TIMx_IC_MspInit(TIM_HandleTypeDef *htim)
Initializes the TIM INput Capture MSP.
Definition: stm32469i_discovery_audio.c:1354
I2S_InitTypeDef::AudioFreq
uint32_t AudioFreq
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:61
HAL_GPIO_WritePin
void HAL_GPIO_WritePin(GPIO_TypeDef *GPIOx, uint16_t GPIO_Pin, GPIO_PinState PinState)
I2S_MODE_MASTER_RX
#define I2S_MODE_MASTER_RX
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2s.h:195
TIM_SlaveConfigTypeDef
TIM Slave configuration Structure definition.
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h:245
GPIO_InitTypeDef::Pin
uint32_t Pin
Definition: stm32f407/stm32f407g-disc1/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h:49


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:51