summaryrefslogtreecommitdiff
path: root/demos/host/src
diff options
context:
space:
mode:
authorhathach <[email protected]>2013-09-25 11:23:53 +0700
committerhathach <[email protected]>2013-09-25 11:23:53 +0700
commitcf65f859be27d71fb64c1c0bca07585f4df37f75 (patch)
tree128bc4d10b4234ead466047780f9ae6216bf2f90 /demos/host/src
parentf820fc5b86d93847560d04f45bbb53b6a29665d3 (diff)
working on fatfs integration
fix retarget input for lpcxpresso
Diffstat (limited to 'demos/host/src')
-rw-r--r--demos/host/src/msc_app.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/demos/host/src/msc_app.c b/demos/host/src/msc_app.c
index 76b53147f..1006ad168 100644
--- a/demos/host/src/msc_app.c
+++ b/demos/host/src/msc_app.c
@@ -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]);
+ }
}
//--------------------------------------------------------------------+