/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read.  */
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
/* param base SPDIF base pointer. param buffer Pointer to the data to be read. param size Bytes to be read.  */
void SPDIF_ReadBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
{
    assert(buffer);
    assert(size % 6U == 0U);
    uint32_t i = 0, j = 0, data = 0;
    while (i < size)
    {
        while ((SPDIF_GetStatusFlag(base) & kSPDIF_RxFIFOFull) == 0U)
        {
        }
        data = SPDIF_ReadLeftData(base);
        for (j = 0; j < 3U; j++)
        {
            *buffer = ((data >> (j * 8U)) & 0xFFU);
            buffer++;
        }
        data = SPDIF_ReadRightData(base);
        for (j = 0; j < 3U; j++)
        {
            *buffer = ((data >> (j * 8U)) & 0xFFU);
            buffer++;
        }
        i += 6U;
    }
}