/* * ======== USBMSCHFatFsTiva_diskRead ======== * This function reads sector(s) from the disk drive * * @param drv Drive Number * * @param buf Pointer to a buffer to which data is written * * @param sector Sector number to read from * * @param count Number of sectors to be read */ DRESULT USBMSCHFatFsTiva_diskRead(BYTE drv, BYTE *buf, DWORD sector, BYTE count) { unsigned int key; uint32_t driveRead; USBMSCHFatFsTiva_Object *object = USBMSCHFatFs_config->object; Log_print2(Diags_USER1, "USBMSCHFatFs: diskRead: Sector %d, Count %d", sector, count); if (object->state != USBMSCHFatFsTiva_CONNECTED) { Log_print0(Diags_USER1, "USBMSCHFatFs: diskRead: not initialized"); return (RES_NOTRDY); } /* READ BLOCK */ key = GateMutex_enter(GateMutex_handle(&(object->gateUSBLibAccess))); driveRead = USBHMSCBlockRead(object->MSCInstance, sector, buf, count); GateMutex_leave(GateMutex_handle(&(object->gateUSBLibAccess)), key); if (driveRead == 0) { Log_print0(Diags_USER2, "USBMSCHFatFs: diskRead: OK"); return (RES_OK); } else { Log_print0(Diags_USER2, "USBMSCHFatFs: diskRead: ERROR"); return (RES_ERROR); } }
//***************************************************************************** // // Read a sector from the USB mass storage device. // // \param ui32Sector is the sector to read from the connected USB mass storage // device (memory stick) // \param pui8Buf is a pointer to the buffer where the sector data should be // stored // // This is the application-specific implementation of a function to read // sectors from a storage device, in this case a USB mass storage device. // This function is called from the \e simple_fs.c file when it needs to read // data from the storage device. // // \return Non-zero if data was read from the device, 0 if no data was read. // //***************************************************************************** uint32_t SimpleFsReadMediaSector(uint_fast32_t ui32Sector, uint8_t *pui8Buf) { // // Return the requested sector from the connected USB mass storage // device. // return(USBHMSCBlockRead(g_psMSCInstance, ui32Sector, pui8Buf, 1)); }
//***************************************************************************** // // Read a sector from the USB mass storage device. // // \param ulSector is the sector to read from the connected USB mass storage // device (memory stick) // \param pucBuf is a pointer to the buffer where the sector data should be // stored // // This is the application-specific implementation of a function to read // sectors from a storage device, in this case a USB mass storage device. // This function is called from the \e simple_fs.c file when it needs to read // data from the storage device. // // \return Non-zero if data was read from the device, 0 if no data was read. // //***************************************************************************** unsigned long SimpleFsReadMediaSector(unsigned long ulSector, unsigned char *pucBuf) { // // Return the requested sector from the connected USB mass storage // device. // return(USBHMSCBlockRead(g_ulMSCInstance, ulSector, pucBuf, 1)); }