예제 #1
0
파일: diskio.c 프로젝트: liuning587/usb_mp3
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) */
)
{
	DRESULT res;
	int result;

	switch (drv) {
	case ATA :
		result = ATA_disk_read(buff, sector, count);
		// translate the reslut code here

		return res;

	case MMC :
		result = MMC_disk_read(buff, sector, count);
		// translate the reslut code here

		return res;

	case USB :
		result = USB_disk_read(buff, sector, count);
		// translate the reslut code here

		return res;
	}
	return RES_PARERR;
}
예제 #2
0
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..128) */
)
{
	DRESULT res;
	int result;

	switch (drv) {
	#ifdef PAKAI_ATA
	case ATA :
		// translate the arguments here

		result = ATA_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;
	#endif
	#ifdef PAKAI_MMC
	case MMC :
		// translate the arguments here

		result = MMC_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;
	#endif
	#ifdef PAKAI_USB_STORAGE
	case USB :
		// translate the arguments here

		result = USB_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;
	#endif
	case SDC : 
	
		return res;
	
	case ROM :
	
		return res;
	}
	return RES_PARERR;
}
예제 #3
0
파일: diskio.c 프로젝트: b-/gnuboy64
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) */
)
{
	if (drv == RAM)
		return RAM_disk_read(buff, sector, count);

	if (drv == MMC)
		return MMC_disk_read(buff, sector, count);

	return RES_PARERR;
}
예제 #4
0
DRESULT disk_read (
		   BYTE drv,		/* Physical drive number (0..) */
		   BYTE *buff,		/* Data buffer to store read data */
		   DWORD sector,	/* Sector number (LBA) */
		   BYTE count		/* Sector count (1..255) */
		   )
{
	DRESULT res = 0;
	int result;

	result = MMC_disk_read(buff, sector, count);
	// translate the reslut code here
	
	return RES_OK; 


}
예제 #5
0
파일: diskio.c 프로젝트: djyos/djyos
DRESULT disk_read (
    BYTE pdrv,      /* Physical drive nmuber to identify the drive */
    BYTE *buff,     /* Data buffer to store read data */
    DWORD sector,   /* Sector address in LBA */
    UINT count      /* Number of sectors to read */
)
{
    DRESULT res = RES_OK;
    int result;
#if 0
    switch (pdrv) {
    case ATA :
        // translate the arguments here

		result = ATA_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_read(buff, sector, count);

		// translate the reslut code here

			return res;
    }
#else
    result = (g_tFatDrvs[pdrv].DrvRead)(buff, sector, count);
	if(0 == result)
		return res; // 成功
#endif
    return RES_PARERR;
}
예제 #6
0
DRESULT disk_read(BYTE drv, /* Physical drive number (0..) */
		BYTE *buff, /* Data buffer to store read data */
		DWORD sector, /* Sector address (LBA) */
		BYTE count /* Number of sectors to read (1..255) */
)
{
	DRESULT res;
	int result;

	(void) result;

	switch (drv)
	{
	case ATA:
		// result = ATA_disk_read(buff, sector, count);
		res = RES_PARERR;
		// translate the result code here
		return res;

	case MMC:
		res = MMC_disk_read(buff, sector, count);
		return res;

	case USB:
#if ( WITH_USB_MS == 1 )
		if (usb_status & STA_NOINIT) {
			res =RES_NOTRDY;
		} else {
			if ( MS_BulkRecv( sector, count, buff ) == OK ) {
				res = RES_OK;
			} else {
				res = RES_ERROR;
			}
		}
#else
		res = RES_PARERR;
#endif
		return res;
	}

	return RES_PARERR;
}
예제 #7
0
DRESULT disk_read (
	BYTE pdrv,		/* Physical drive nmuber to identify the drive */
	BYTE *buff,		/* Data buffer to store read data */
	DWORD sector,	/* Sector address in LBA */
	UINT count		/* Number of sectors to read */
)
{
	DRESULT res;
	int result;

	switch (pdrv) {
	case ATA :
		// translate the arguments here

		result = ATA_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;
	}

	return RES_PARERR;
}
예제 #8
0
파일: diskio.c 프로젝트: nsaspook/cpanel
DRESULT disk_read(
	BYTE pdrv, /* Physical drive nmuber (0..) */
	BYTE *buff, /* Data buffer to store read data */
	DWORD sector, /* Sector address (LBA) */
	UINT count /* Number of sectors to read (1..128) */
	)
{
	int result;


	// translate the arguments here

	result = MMC_disk_read(buff, sector, count);
//	sprintf(error_string, "\r\n disk_read error %i ", result);
//	if (result) SpiStringWrite(error_string);
	// translate the reslut code here

	return result;


}
예제 #9
0
파일: diskio.c 프로젝트: Aorjoa/bootloader
DRESULT disk_read_fs (
	BYTE pdrv,		/* Physical drive nmuber (0..) */
	BYTE *buff,		/* Data buffer to store read data */
	DWORD sector,	/* Sector address (LBA) */
	DWORD count		/* Number of sectors to read (1..128) */
)
{
#ifndef CONFIG_ALLWINNER
	DRESULT res;
#endif
	int result;
	unsigned int start_block;
#ifndef CONFIG_ALLWINNER
	switch (pdrv) {
	case ATA :
		// translate the arguments here

		result = ATA_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_read(buff, sector, count);

		// translate the reslut code here

		return res;
	}
	return RES_PARERR;
#else
//	result = sunxi_test_mmc_read(sector+0x12000, count, buff);
	start_block = sunxi_partition_get_offset_byname(PART_NAME[pdrv]);
	if (!start_block)
	{
		printf("[disk_read_fs] no the partition\n");
		return RES_ERROR;
	}
//	printf("read part %s\n", PART_NAME[pdrv]);
//	result = sunxi_test_nand_read((unsigned int)(sector+start_block),(unsigned int)count,buff);
	result = sunxi_flash_read(sector+start_block,count, buff);
	if(!result)
	{
		printf("read all error: start=%lx, addr=0x%x count=0x%x\n", sector, (unsigned int)buff,(unsigned int)count);

		return 1;
	}
	return RES_OK;
#endif
}