AnsweredAssumed Answered

Callback prototype in SPI driver DMA example BF706 is incorrect.

Question asked by oldfoxsoftware on Nov 7, 2016
Latest reply on Dec 7, 2016 by Kader.M

At least it does not reflect the newest ADI SPI library for the BF706. The callback function is shown as

void SpiCallback(void* pHandle, uint32_t u32Arg, void* pArg)
{
    ADI_SPI_HANDLE pDevice = (ADI_SPI_HANDLE *)pHandle;
    ADI_SPI_EVENT event = (ADI_SPI_EVENT)u32Arg;
    uint16_t *data = (uint16_t*)pArg;

    switch (event) {
        case ADI_SPI_TRANSCEIVER_PROCESSED:
            bComplete = true;
            break;
    default:
        break;
    }
}

but the parameters should be:

void SpiCallback(void* pArg, uint32_t u32Arg, void* pBuf)
{
// There is no handle among the parameters.
//    ADI_SPI_HANDLE pDevice = (ADI_SPI_HANDLE *)pHandle;
    ADI_SPI_EVENT event = (ADI_SPI_EVENT)u32Arg;
    uint16_t *data = (uint16_t*)pArg;

    switch (event) {
        case ADI_SPI_TRANSCEIVER_PROCESSED:
            bComplete = true;
            break;
    default:
        break;
    }
}

The compiler does not complain because the switched arguments are of the same type.

Outcomes