Пример #1
0
/******************************************************************************
 * Function:        DRESULT USB_disk_read(BYTE *buff,
 *									  DWORD sector,
 *									  BYTE count)
 *
 * PreCondition:    None
 *
 * Input:           buff - pointer to the data buffer to store read data
 *					sector - start sector number (LBA)
 *					count - sector count (1..255)
 *
 * Output:          Status of read
 *
 * Side Effects:    None
 *
 * Overview:        Function to read a specific sector on the media.
 *
 * Note:            None
 *****************************************************************************/
DRESULT disk_read (
	BYTE drv,		/* Physical drive nmuber (0..) */
	BYTE *buff,		/* Data buffer to store read data */
	DWORD sector,	/* Sector address (LBA) */
	BYTE count		/* Number of sectors to read (1..255) */
)
{   int nSector;
    for(nSector = 0; nSector < count; nSector++)
    {
        if (!USBHostMSDSCSISectorRead(sector, buff))
        {
            return RES_NOTRDY;
        }
        sector++;
        buff += 512;
    }
    return RES_OK;
 }
Пример #2
0
uint8_t ChipKITUSBMSDHost::SCSISectorRead(DWORD sectorAddress, uint8_t * dataBuffer)
{
    return(USBHostMSDSCSISectorRead(sectorAddress, dataBuffer));
}