AnsweredAssumed Answered

K70 SAI driver missing read and write functions

Question asked by pbanta on Jun 11, 2014
Latest reply on Sep 5, 2014 by pbanta

I am trying to use the i2s_demo code on a K70 board and MQX 4.1.  It's all going well until the first write() to the sai1: device.  In the "play" shell command there is this loop:


    /* Play a file */
    printf("  Playing a file...");

    while (!feof(file_ptr))

        requested = fread(data, 1, block_size, file_ptr);
        if (ferror(file_ptr) && !(feof(file_ptr)))
            printf("\n  Error reading from a file %s.\n", argv[2]);
        write(device_ptr, data, requested);


Line 13 above is going to end up calling _io_sai_int_write() below:


_mqx_int _io_sai_int_write
    /* [IN] the handle returned from _fopen */
    MQX_FILE_PTR    fd_ptr,

    /* [IN] where the data are to be stored */
    char        *data_ptr,

    /* [IN] the number of bytes to read */
    _mqx_int        n
{  /* Body */
    IO_DEVICE_STRUCT_PTR         io_dev_ptr;
    IO_SAI_DEVICE_STRUCT_PTR io_sai_dev_ptr;
    uint32_t result;

    io_dev_ptr     = (IO_DEVICE_STRUCT_PTR)fd_ptr->DEV_PTR;
    io_sai_dev_ptr = (void *)io_dev_ptr->DRIVER_INIT_PTR;

    result = (*io_sai_dev_ptr->DEV_WRITE)(io_sai_dev_ptr, data_ptr, n);
    return result;

}  /* Endbody */


In line 22 in _io_sai_int_write() above, (*io_sai_dev_ptr->DEV_WRITE) is 0x00000000 !!


That's because in init_sai.c in the BSP the read and write function pointers are set to NULL:


const SAI_INIT_STRUCT _bsp_sai_init = 


What's going on with this demo?