/* param base SPDIF base pointer. param buffer Pointer to the data to be written. param size Bytes to be written.  */
void SPDIF_WriteBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
/* param base SPDIF base pointer. param buffer Pointer to the data to be written. param size Bytes to be written.  */
void SPDIF_WriteBlocking(SPDIF_Type *base, uint8_t *buffer, uint32_t size)
{
    assert(buffer != NULL);
    assert((size % 6U) == 0U);
    uint32_t i = 0, j = 0, data = 0;
    while (i < size)
    {
        while ((SPDIF_GetStatusFlag(base) & (uint32_t)kSPDIF_TxFIFOEmpty) == 0x00U)
        {
        }
        for (j = 0; j < 3U; j++)
        {
            data |= ((uint32_t)(*buffer) << (j * 8U));
            buffer++;
        }
        SPDIF_WriteLeftData(base, data);
        data = 0;
        for (j = 0; j < 3U; j++)
        {
            data |= ((uint32_t)(*buffer) << (j * 8U));
            buffer++;
        }
        SPDIF_WriteRightData(base, data);
        i += 6U;
    }
}