working on fatfs integration

fix retarget input for lpcxpresso
This commit is contained in:
hathach
2013-09-25 11:23:53 +07:00
parent f820fc5b86
commit cf65f859be
11 changed files with 308 additions and 65 deletions

View File

@@ -47,6 +47,9 @@
#if TUSB_CFG_HOST_MSC
#include "ff.h"
#include "diskio.h"
//--------------------------------------------------------------------+
// MACRO CONSTANT TYPEDEF
//--------------------------------------------------------------------+
@@ -54,6 +57,7 @@
//--------------------------------------------------------------------+
// INTERNAL OBJECT & FUNCTION DECLARATION
//--------------------------------------------------------------------+
static FATFS fatfs[TUSB_CFG_HOST_DEVICE_MAX] TUSB_CFG_ATTR_USBRAM;
//--------------------------------------------------------------------+
// tinyusb callback (ISR context)
@@ -62,6 +66,7 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr)
{
printf("an msc device is mounted\n");
//------------- Disk Information -------------//
// SCSI VendorID[8] & ProductID[16] from Inquiry Command
uint8_t const* p_vendor = tusbh_msc_get_vendor_name(dev_addr);
uint8_t const* p_product = tusbh_msc_get_product_name(dev_addr);
@@ -77,6 +82,14 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr)
tusbh_msc_get_capacity(dev_addr, &last_lba, &block_size);
printf("Disk Size: %d MB\n", (last_lba+1)/ ((1024*1024)/block_size) );
printf("LBA 0-0x%X Block Size: %d\n", last_lba, block_size);
//------------- file system (only 1 LUN support) -------------//
DSTATUS stat = disk_initialize(0);
if ( disk_is_ready(0) )
{
f_mount(0, &fatfs[dev_addr-1]);
}
}
//--------------------------------------------------------------------+