Go to the documentation of this file.
179 #ifdef HAL_I2S_MODULE_ENABLED
257 uint32_t packetlength;
282 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
290 if (hi2s->MspInitCallback ==
NULL)
296 hi2s->MspInitCallback(hi2s);
332 packetlength = packetlength * 2U;
345 i2sclk = I2S_GetClockFreq(hi2s);
354 tmp = (uint32_t)(((((i2sclk / (packetlength * 4U)) * 10U) / hi2s->
Init.
AudioFreq)) + 5U);
358 tmp = (uint32_t)(((((i2sclk / (packetlength * 8U)) * 10U) / hi2s->
Init.
AudioFreq)) + 5U);
364 tmp = (uint32_t)(((((i2sclk / packetlength) * 10U) / hi2s->
Init.
AudioFreq)) + 5U);
371 i2sodd = (uint32_t)(tmp & (uint32_t)1U);
374 i2sdiv = (uint32_t)((tmp - i2sodd) / 2U);
377 i2sodd = (uint32_t)(i2sodd << 8U);
387 if ((i2sdiv < 2U) || (i2sdiv > 0xFFU))
409 #if defined(SPI_I2SCFGR_ASTRTEN)
445 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
446 if (hi2s->MspDeInitCallback ==
NULL)
452 hi2s->MspDeInitCallback(hi2s);
499 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
513 if (pCallback ==
NULL)
516 hi2s->
ErrorCode |= HAL_I2S_ERROR_INVALID_CALLBACK;
527 case HAL_I2S_TX_COMPLETE_CB_ID :
528 hi2s->TxCpltCallback = pCallback;
531 case HAL_I2S_RX_COMPLETE_CB_ID :
532 hi2s->RxCpltCallback = pCallback;
535 case HAL_I2S_TX_HALF_COMPLETE_CB_ID :
536 hi2s->TxHalfCpltCallback = pCallback;
539 case HAL_I2S_RX_HALF_COMPLETE_CB_ID :
540 hi2s->RxHalfCpltCallback = pCallback;
543 case HAL_I2S_ERROR_CB_ID :
544 hi2s->ErrorCallback = pCallback;
547 case HAL_I2S_MSPINIT_CB_ID :
548 hi2s->MspInitCallback = pCallback;
551 case HAL_I2S_MSPDEINIT_CB_ID :
552 hi2s->MspDeInitCallback = pCallback;
568 case HAL_I2S_MSPINIT_CB_ID :
569 hi2s->MspInitCallback = pCallback;
572 case HAL_I2S_MSPDEINIT_CB_ID :
573 hi2s->MspDeInitCallback = pCallback;
618 case HAL_I2S_TX_COMPLETE_CB_ID :
622 case HAL_I2S_RX_COMPLETE_CB_ID :
626 case HAL_I2S_TX_HALF_COMPLETE_CB_ID :
630 case HAL_I2S_RX_HALF_COMPLETE_CB_ID :
634 case HAL_I2S_ERROR_CB_ID :
638 case HAL_I2S_MSPINIT_CB_ID :
642 case HAL_I2S_MSPDEINIT_CB_ID :
659 case HAL_I2S_MSPINIT_CB_ID :
663 case HAL_I2S_MSPDEINIT_CB_ID :
753 uint32_t tmpreg_cfgr;
755 if ((pData ==
NULL) || (Size == 0U))
871 uint32_t tmpreg_cfgr;
873 if ((pData ==
NULL) || (Size == 0U))
969 uint32_t tmpreg_cfgr;
971 if ((pData ==
NULL) || (Size == 0U))
1035 uint32_t tmpreg_cfgr;
1037 if ((pData ==
NULL) || (Size == 0U))
1099 uint32_t tmpreg_cfgr;
1101 if ((pData ==
NULL) || (Size == 0U))
1187 uint32_t tmpreg_cfgr;
1189 if ((pData ==
NULL) || (Size == 0U))
1402 I2S_Receive_IT(hi2s);
1409 I2S_Transmit_IT(hi2s);
1440 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1441 hi2s->ErrorCallback(hi2s);
1591 uint32_t i2sclocksource;
1627 i2sclocksource = 0U;
1633 return i2sclocksource;
1656 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1657 hi2s->TxCpltCallback(hi2s);
1674 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1675 hi2s->TxHalfCpltCallback(hi2s);
1700 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1701 hi2s->RxCpltCallback(hi2s);
1718 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1719 hi2s->RxHalfCpltCallback(hi2s);
1745 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1746 hi2s->ErrorCallback(hi2s);
1772 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1773 hi2s->TxCpltCallback(hi2s);
1800 #if (USE_HAL_I2S_REGISTER_CALLBACKS == 1U)
1801 hi2s->RxCpltCallback(hi2s);
1829 if (((
HAL_GetTick() - tickstart) >= Timeout) || (Timeout == 0U))
#define __HAL_I2S_DISABLE_IT(__HANDLE__, __INTERRUPT__)
Disable the specified I2S interrupts.
#define HAL_I2S_ERROR_TIMEOUT
#define assert_param(expr)
Include module's header file.
#define SPI_I2SCFGR_CHLEN
#define RCC_PLLI2SCFGR_PLLI2SN
void HAL_I2S_MspDeInit(I2S_HandleTypeDef *hi2s)
#define __HAL_I2S_CLEAR_OVRFLAG(__HANDLE__)
Clears the I2S OVR pending flag.
void HAL_I2S_TxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
Tx Half Transfer completed callbacks.
HAL_StatusTypeDef
HAL Status structures definition
#define RCC_PLLSOURCE_HSI
#define __HAL_I2S_ENABLE(__HANDLE__)
Enable the specified SPI peripheral (in I2S mode).
#define HAL_IS_BIT_CLR(REG, BIT)
#define SPI_I2SCFGR_ASTRTEN
void(* XferHalfCpltCallback)(struct __DMA_HandleTypeDef *hdma)
DMA handle Structure definition.
#define SPI_I2SCFGR_CKPOL
#define __HAL_I2S_GET_FLAG(__HANDLE__, __FLAG__)
Checks whether the specified I2S flag is set or not.
HAL_StatusTypeDef HAL_I2S_Receive(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
void HAL_I2S_TxCpltCallback(I2S_HandleTypeDef *hi2s)
Tx Transfer completed callbacks.
#define I2S_MODE_SLAVE_TX
#define IS_I2S_ALL_INSTANCE(INSTANCE)
void HAL_I2S_RxCpltCallback(I2S_HandleTypeDef *hi2s)
Rx Transfer completed callbacks.
I2S handle Structure definition.
DMA_HandleTypeDef * hdmatx
#define I2S_CHECK_FLAG(__SR__, __FLAG__)
Check whether the specified SPI flag is set or not.
#define IS_I2S_AUDIO_FREQ(__FREQ__)
#define CLEAR_BIT(REG, BIT)
uint32_t HAL_GetTick(void)
Provides a tick value in millisecond.
#define IS_I2S_STANDARD(__STANDARD__)
HAL_StatusTypeDef HAL_I2S_Transmit(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size, uint32_t Timeout)
HAL_StatusTypeDef HAL_I2S_DMAPause(I2S_HandleTypeDef *hi2s)
uint32_t HAL_I2S_GetError(I2S_HandleTypeDef *hi2s)
#define RCC_PLLCFGR_PLLSRC
#define I2S_STANDARD_PCM_SHORT
HAL_StatusTypeDef HAL_I2S_Receive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
#define HAL_I2S_ERROR_DMA
void HAL_I2S_RxHalfCpltCallback(I2S_HandleTypeDef *hi2s)
Rx Half Transfer completed callbacks.
HAL_StatusTypeDef HAL_I2S_DMAResume(I2S_HandleTypeDef *hi2s)
HAL_I2S_StateTypeDef HAL_I2S_GetState(I2S_HandleTypeDef *hi2s)
#define HSI_VALUE
Internal High Speed oscillator (HSI) value. This value is used by the RCC HAL module to compute the s...
HAL_StatusTypeDef HAL_I2S_Transmit_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
HAL_StatusTypeDef HAL_I2S_Init(I2S_HandleTypeDef *hi2s)
#define __HAL_LOCK(__HANDLE__)
#define IS_I2S_DATA_FORMAT(__FORMAT__)
#define MODIFY_REG(REG, CLEARMASK, SETMASK)
#define HAL_I2S_ERROR_NONE
#define EXTERNAL_CLOCK_VALUE
External clock source for I2S peripheral This value is used by the I2S HAL module to compute the I2S ...
void HAL_I2S_ErrorCallback(I2S_HandleTypeDef *hi2s)
I2S error callbacks.
void HAL_I2S_IRQHandler(I2S_HandleTypeDef *hi2s)
HAL_StatusTypeDef HAL_DMA_Start_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
#define SPI_I2SCFGR_DATLEN
#define I2S_MCLKOUTPUT_ENABLE
#define __HAL_I2S_CLEAR_UDRFLAG(__HANDLE__)
Clears the I2S UDR pending flag.
#define __HAL_UNLOCK(__HANDLE__)
#define HAL_I2S_ERROR_UDR
HAL_StatusTypeDef HAL_DMA_Abort(DMA_HandleTypeDef *hdma)
#define IS_I2S_MCLK_OUTPUT(__OUTPUT__)
#define IS_I2S_CPOL(__CPOL__)
Checks if I2S Serial clock steady state parameter is in allowed range.
#define SPI_I2SCFGR_I2SMOD
__IO HAL_I2S_StateTypeDef State
DMA_HandleTypeDef * hdmarx
__IO HAL_I2C_StateTypeDef State
#define RCC_PLLI2SCFGR_PLLI2SR
#define SPI_I2SCFGR_PCMSYNC
void(* XferCpltCallback)(struct __DMA_HandleTypeDef *hdma)
#define __HAL_I2S_ENABLE_IT(__HANDLE__, __INTERRUPT__)
Enable the specified I2S interrupts.
__IO uint16_t RxXferCount
#define HAL_I2S_ERROR_PRESCALER
__IO uint16_t TxXferCount
HAL_StatusTypeDef HAL_I2S_DMAStop(I2S_HandleTypeDef *hi2s)
#define HSE_VALUE
Adjust the value of External High Speed oscillator (HSE) used in your application....
#define IS_I2S_CLOCKSOURCE(CLOCK)
#define I2S_AUDIOFREQ_DEFAULT
HAL_I2S_StateTypeDef
HAL State structures definition.
void HAL_I2S_MspInit(I2S_HandleTypeDef *hi2s)
#define SPI_I2SCFGR_I2SCFG
#define I2S_MODE_SLAVE_RX
#define SET_BIT(REG, BIT)
#define HAL_I2S_ERROR_OVR
#define __HAL_I2S_DISABLE(__HANDLE__)
Disable the specified SPI peripheral (in I2S mode).
HAL_StatusTypeDef HAL_I2S_DeInit(I2S_HandleTypeDef *hi2s)
__IO HAL_LockTypeDef Lock
#define I2S_STANDARD_PCM_LONG
HAL_StatusTypeDef HAL_I2S_Transmit_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
#define I2S_CLOCK_EXTERNAL
This file contains all the functions prototypes for the HAL module driver.
#define IS_I2S_MODE(__MODE__)
Checks if I2S Mode parameter is in allowed range.
#define I2S_CHECK_IT_SOURCE(__CR2__, __INTERRUPT__)
Check whether the specified SPI Interrupt is set or not.
HAL_StatusTypeDef HAL_I2S_Receive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pData, uint16_t Size)
void(* XferErrorCallback)(struct __DMA_HandleTypeDef *hdma)
#define I2S_MODE_MASTER_RX
#define SPI_I2SCFGR_I2SSTD