Hi Jun,
Thank you.
I found a USB demo code msd_usb under /freescale/Freescale_MQX_4_0/usb/example/. But this example is a USB Mass Storage based on RAM.
case USB_MSC_DEVICE_READ_REQUEST :
/* copy data from storage device before sending it on USB Bus
(Called before calling send_data on BULK IN endpoints)*/
lba_data_ptr = (PTR_LBA_APP_STRUCT)val;
/* read data from mass storage device to driver buffer */
#if RAM_DISK_APP
USB_mem_copy(g_disk.storage_disk + lba_data_ptr->offset,lba_data_ptr->buff_ptr, lba_data_ptr->size);
#endif
break;
case USB_MSC_DEVICE_WRITE_REQUEST :
/* copy data from USb buffer to Storage device
(Called before after recv_data on BULK OUT endpoints)*/
lba_data_ptr = (PTR_LBA_APP_STRUCT)val;
/* read data from driver buffer to mass storage device */
#if RAM_DISK_APP
USB_mem_copy(lba_data_ptr->buff_ptr,g_disk.storage_disk + lba_data_ptr->offset,lba_data_ptr->size);
#endif
break;
I want to implement it msd on a SD card. I read SD Card Driver has _io_read() and _io_write() function. My question is how could I use these functions here to implement msd on SD card rather than RAM? Or do I need call the low level driver function to achieve this?
Thank you.
-Daniel