예제 #1
0
파일: diskio.c 프로젝트: liuning587/usb_mp3
DRESULT disk_write (
	BYTE drv,			/* Physical drive nmuber (0..) */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector address (LBA) */
	BYTE count			/* Number of sectors to write (1..255) */
)
{
	DRESULT res;
	int result;

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

		return res;

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

		return res;

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

		return res;
	}
	return RES_PARERR;
}
예제 #2
0
파일: diskio.c 프로젝트: Aorjoa/bootloader
DRESULT disk_write (
	BYTE pdrv,			/* Physical drive nmuber (0..) */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector address (LBA) */
	DWORD count			/* Number of sectors to write (1..128) */
)
{
//	DRESULT res;
	int result;
	int start_block;
#ifndef CONFIG_ALLWINNER
	switch (pdrv) {
	case ATA :
		// translate the arguments here

		result = ATA_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;
	}
	return RES_PARERR;
#else
	start_block = sunxi_partition_get_offset_byname(PART_NAME[pdrv]);

	if (!start_block)
	{
		printf("[disk_write] no the partition\n");
		return RES_ERROR;
	}
//	printf("write part %s\n", PART_NAME[pdrv]);
//	result = sunxi_test_nand_write(sector+start_block,count,buff);
	result = sunxi_flash_write(sector+start_block,count,(void *)buff);
	if(!result){
		printf("[%s] err in sector %lx count %x buff %x\n",__func__,sector,(unsigned int)count,(unsigned int)buff);
		return RES_ERROR;
	}
	return RES_OK;
#endif
}
예제 #3
0
DRESULT disk_write (
	BYTE pdrv,			/* Physical drive nmuber (0..) */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector address (LBA) */
	BYTE count			/* Number of sectors to write (1..128) */
)
{
	DRESULT res;
	int result;

	result = MMC_disk_write(buff, sector, count);
        return res;

}
예제 #4
0
파일: diskio.c 프로젝트: b-/gnuboy64
DRESULT disk_write (
	BYTE drv,			/* Physical drive nmuber (0..) */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector address (LBA) */
	BYTE count			/* Number of sectors to write (1..255) */
)
{
	if (drv == RAM)
		return RAM_disk_write(buff, sector, count);

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

	return RES_PARERR;
}
예제 #5
0
DRESULT disk_write (
	BYTE drv,			/* Physical drive nmuber (0..) */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector number (LBA) */
	BYTE count			/* Sector count (1..255) */
)
{
	DRESULT res = 0;
	int result;

	result = MMC_disk_write(buff, sector, count);
	// translate the reslut code here
	
	return res;
	
	//return RES_PARERR;
}
예제 #6
0
파일: diskio.c 프로젝트: djyos/djyos
DRESULT disk_write (
    BYTE pdrv,          /* Physical drive nmuber to identify the drive */
    const BYTE *buff,   /* Data to be written */
    DWORD sector,       /* Sector address in LBA */
    UINT count          /* Number of sectors to write */
)
{
    DRESULT res = RES_OK;
    int result;
#if 0
    switch (pdrv) {
    case ATA :
        // translate the arguments here

		result = ATA_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;
    }
#else
    result = (g_tFatDrvs[pdrv].DrvWrite)((BYTE*)buff, sector, count);
	if(0 == result)
		return res; // 成功
#endif
    return RES_PARERR;
}
예제 #7
0
파일: diskio.c 프로젝트: nsaspook/cpanel
DRESULT disk_write(
	BYTE pdrv, /* Physical drive nmuber (0..) */
	const BYTE *buff, /* Data to be written */
	DWORD sector, /* Sector address (LBA) */
	UINT count /* Number of sectors to write (1..128) */
	)
{
	int result;


	// translate the arguments here

	result = MMC_disk_write(buff, sector, count);
//	if (result) SpiStringWrite("\r\n Disk_write ");
	// translate the reslut code here

	return result;


}
예제 #8
0
DRESULT disk_write (
	BYTE pdrv,			/* Physical drive nmuber to identify the drive */
	const BYTE *buff,	/* Data to be written */
	DWORD sector,		/* Sector address in LBA */
	UINT count			/* Number of sectors to write */
)
{
	DRESULT res;
	int result;

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

		result = ATA_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case MMC :
		// translate the arguments here

		result = MMC_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;

	case USB :
		// translate the arguments here

		result = USB_disk_write(buff, sector, count);

		// translate the reslut code here

		return res;
	}

	return RES_PARERR;
}
예제 #9
0
DRESULT disk_write(BYTE drv, /* Physical drive number (0..) */
	const BYTE *buff, /* Data to be written */
	DWORD sector, /* Sector address (LBA) */
	BYTE count /* Number of sectors to write (1..255) */
)
{
	DRESULT res;
	int result;

	(void) result;

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

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

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

	return RES_PARERR;
}