GFX Develop Branch
This commit is contained in:
@ -33,10 +33,12 @@
|
||||
(##) SPDIFRX pins configuration:
|
||||
(+++) Enable the clock for the SPDIFRX GPIOs.
|
||||
(+++) Configure these SPDIFRX pins as alternate function pull-up.
|
||||
(##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveCtrlFlow_IT() and HAL_SPDIFRX_ReceiveDataFlow_IT() API's).
|
||||
(##) NVIC configuration if you need to use interrupt process (HAL_SPDIFRX_ReceiveCtrlFlow_IT() and
|
||||
HAL_SPDIFRX_ReceiveDataFlow_IT() API's).
|
||||
(+++) Configure the SPDIFRX interrupt priority.
|
||||
(+++) Enable the NVIC SPDIFRX IRQ handle.
|
||||
(##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and HAL_SPDIFRX_ReceiveCtrlFlow_DMA() API's).
|
||||
(##) DMA Configuration if you need to use DMA process (HAL_SPDIFRX_ReceiveDataFlow_DMA() and
|
||||
HAL_SPDIFRX_ReceiveCtrlFlow_DMA() API's).
|
||||
(+++) Declare a DMA handle structure for the reception of the Data Flow channel.
|
||||
(+++) Declare a DMA handle structure for the reception of the Control Flow channel.
|
||||
(+++) Enable the DMAx interface clock.
|
||||
@ -46,8 +48,8 @@
|
||||
(+++) Configure the priority and enable the NVIC for the transfer complete interrupt on the
|
||||
DMA CtrlRx/DataRx channel.
|
||||
|
||||
(#) Program the input selection, re-tries number, wait for activity, channel status selection, data format, stereo mode and masking of user bits
|
||||
using HAL_SPDIFRX_Init() function.
|
||||
(#) Program the input selection, re-tries number, wait for activity, channel status selection, data format,
|
||||
stereo mode and masking of user bits using HAL_SPDIFRX_Init() function.
|
||||
|
||||
-@- The specific SPDIFRX interrupts (RXNE/CSRNE and Error Interrupts) will be managed using the macros
|
||||
__SPDIFRX_ENABLE_IT() and __SPDIFRX_DISABLE_IT() inside the receive process.
|
||||
@ -90,7 +92,7 @@
|
||||
=============================================
|
||||
[..]
|
||||
Below the list of most used macros in SPDIFRX HAL driver.
|
||||
(+) __HAL_SPDIFRX_IDLE: Disable the specified SPDIFRX peripheral (IDEL State)
|
||||
(+) __HAL_SPDIFRX_IDLE: Disable the specified SPDIFRX peripheral (IDLE State)
|
||||
(+) __HAL_SPDIFRX_SYNC: Enable the synchronization state of the specified SPDIFRX peripheral (SYNC State)
|
||||
(+) __HAL_SPDIFRX_RCV: Enable the receive state of the specified SPDIFRX peripheral (RCV State)
|
||||
(+) __HAL_SPDIFRX_ENABLE_IT : Enable the specified SPDIFRX interrupts
|
||||
@ -173,8 +175,13 @@
|
||||
|
||||
/* Private typedef -----------------------------------------------------------*/
|
||||
/* Private define ------------------------------------------------------------*/
|
||||
#define SPDIFRX_TIMEOUT_VALUE 0xFFFFU
|
||||
|
||||
/** @defgroup SPDIFRX_Private_Defines SPDIFRX Private Defines
|
||||
* @{
|
||||
*/
|
||||
#define SPDIFRX_TIMEOUT_VALUE 10U
|
||||
/**
|
||||
* @}
|
||||
*/
|
||||
/* Private macro -------------------------------------------------------------*/
|
||||
/* Private variables ---------------------------------------------------------*/
|
||||
/* Private function prototypes -----------------------------------------------*/
|
||||
@ -900,7 +907,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_IT(SPDIFRX_HandleTypeDef *hspdif,
|
||||
{
|
||||
if (count == 0U)
|
||||
{
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt
|
||||
process */
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE);
|
||||
@ -985,7 +993,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveCtrlFlow_IT(SPDIFRX_HandleTypeDef *hspdif,
|
||||
{
|
||||
if (count == 0U)
|
||||
{
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt
|
||||
process */
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE);
|
||||
@ -1059,7 +1068,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef *hspdif,
|
||||
hspdif->hdmaDrRx->XferErrorCallback = SPDIFRX_DMAError;
|
||||
|
||||
/* Enable the DMA request */
|
||||
if (HAL_DMA_Start_IT(hspdif->hdmaDrRx, (uint32_t)&hspdif->Instance->DR, (uint32_t)hspdif->pRxBuffPtr, Size) != HAL_OK)
|
||||
if (HAL_DMA_Start_IT(hspdif->hdmaDrRx, (uint32_t)&hspdif->Instance->DR, (uint32_t)hspdif->pRxBuffPtr, Size) !=
|
||||
HAL_OK)
|
||||
{
|
||||
/* Set SPDIFRX error */
|
||||
hspdif->ErrorCode = HAL_SPDIFRX_ERROR_DMA;
|
||||
@ -1086,7 +1096,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveDataFlow_DMA(SPDIFRX_HandleTypeDef *hspdif,
|
||||
{
|
||||
if (count == 0U)
|
||||
{
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt
|
||||
process */
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE);
|
||||
@ -1160,7 +1171,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveCtrlFlow_DMA(SPDIFRX_HandleTypeDef *hspdif,
|
||||
hspdif->hdmaCsRx->XferErrorCallback = SPDIFRX_DMAError;
|
||||
|
||||
/* Enable the DMA request */
|
||||
if (HAL_DMA_Start_IT(hspdif->hdmaCsRx, (uint32_t)&hspdif->Instance->CSR, (uint32_t)hspdif->pCsBuffPtr, Size) != HAL_OK)
|
||||
if (HAL_DMA_Start_IT(hspdif->hdmaCsRx, (uint32_t)&hspdif->Instance->CSR, (uint32_t)hspdif->pCsBuffPtr, Size) !=
|
||||
HAL_OK)
|
||||
{
|
||||
/* Set SPDIFRX error */
|
||||
hspdif->ErrorCode = HAL_SPDIFRX_ERROR_DMA;
|
||||
@ -1187,7 +1199,8 @@ HAL_StatusTypeDef HAL_SPDIFRX_ReceiveCtrlFlow_DMA(SPDIFRX_HandleTypeDef *hspdif,
|
||||
{
|
||||
if (count == 0U)
|
||||
{
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt
|
||||
process */
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE);
|
||||
@ -1236,8 +1249,14 @@ HAL_StatusTypeDef HAL_SPDIFRX_DMAStop(SPDIFRX_HandleTypeDef *hspdif)
|
||||
hspdif->Instance->CR &= (uint16_t)(~SPDIFRX_CR_CBDMAEN);
|
||||
|
||||
/* Disable the SPDIFRX DMA channel */
|
||||
__HAL_DMA_DISABLE(hspdif->hdmaDrRx);
|
||||
__HAL_DMA_DISABLE(hspdif->hdmaCsRx);
|
||||
if (hspdif->hdmaDrRx != NULL)
|
||||
{
|
||||
__HAL_DMA_DISABLE(hspdif->hdmaDrRx);
|
||||
}
|
||||
if (hspdif->hdmaCsRx != NULL)
|
||||
{
|
||||
__HAL_DMA_DISABLE(hspdif->hdmaCsRx);
|
||||
}
|
||||
|
||||
/* Disable SPDIFRX peripheral */
|
||||
__HAL_SPDIFRX_IDLE(hspdif);
|
||||
@ -1590,8 +1609,8 @@ static void SPDIFRX_ReceiveControlFlow_IT(SPDIFRX_HandleTypeDef *hspdif)
|
||||
* @param tickstart Tick start value
|
||||
* @retval HAL status
|
||||
*/
|
||||
static HAL_StatusTypeDef SPDIFRX_WaitOnFlagUntilTimeout(SPDIFRX_HandleTypeDef *hspdif, uint32_t Flag, FlagStatus Status,
|
||||
uint32_t Timeout, uint32_t tickstart)
|
||||
static HAL_StatusTypeDef SPDIFRX_WaitOnFlagUntilTimeout(SPDIFRX_HandleTypeDef *hspdif, uint32_t Flag,
|
||||
FlagStatus Status, uint32_t Timeout, uint32_t tickstart)
|
||||
{
|
||||
/* Wait until flag is set */
|
||||
while (__HAL_SPDIFRX_GET_FLAG(hspdif, Flag) == Status)
|
||||
@ -1601,7 +1620,8 @@ static HAL_StatusTypeDef SPDIFRX_WaitOnFlagUntilTimeout(SPDIFRX_HandleTypeDef *h
|
||||
{
|
||||
if (((HAL_GetTick() - tickstart) > Timeout) || (Timeout == 0U))
|
||||
{
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt process */
|
||||
/* Disable TXE, RXNE, PE and ERR (Frame error, noise error, overrun error) interrupts for the interrupt
|
||||
process */
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_RXNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_CSRNE);
|
||||
__HAL_SPDIFRX_DISABLE_IT(hspdif, SPDIFRX_IT_PERRIE);
|
||||
|
||||
Reference in New Issue
Block a user