enhacne msc demo, update IAR project file

This commit is contained in:
hathach
2013-10-02 13:32:39 +07:00
parent 5c8389b9ae
commit 1263dbb122
10 changed files with 62 additions and 24 deletions
+16
View File
@@ -300,6 +300,7 @@
<state>$PROJ_DIR$\..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\inc</state>
<state>$PROJ_DIR$\..\..\bsp</state>
<state>$PROJ_DIR$\..\..\..\tinyusb</state>
<state>$PROJ_DIR$\..\..\..\vendor\fatfs</state>
</option>
<option>
<name>CCStdIncCheck</name>
@@ -929,6 +930,9 @@
<file>
<name>$PROJ_DIR$\..\src\cdc_serial_app.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\cli.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\src\keyboard_app.c</name>
</file>
@@ -993,6 +997,18 @@
</file>
</group>
</group>
<group>
<name>fatfs</name>
<file>
<name>$PROJ_DIR$\..\..\..\vendor\fatfs\ccsbcs.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\vendor\fatfs\diskio.c</name>
</file>
<file>
<name>$PROJ_DIR$\..\..\..\vendor\fatfs\ff.c</name>
</file>
</group>
<group>
<name>tinyusb</name>
<group>
+2
View File
@@ -296,6 +296,8 @@ cli_error_t cli_cmd_list(char * p_para)
putchar('\n');
}
}
// (void) f_closedir(&target_dir);
}
else
{
+15 -5
View File
@@ -84,10 +84,8 @@ void tusbh_msc_mounted_cb(uint8_t dev_addr)
printf("LBA 0-0x%X Block Size: %d\n", last_lba, block_size);
//------------- file system (only 1 LUN support) -------------//
// TODO MSC refractor this hack
// DSTATUS stat = disk_initialize(0);
uint8_t phy_disk = dev_addr-1;
disk_state[phy_disk] = 0;
disk_initialize(phy_disk);
if ( disk_is_ready(phy_disk) )
{
@@ -118,7 +116,19 @@ void tusbh_msc_unmounted_cb(uint8_t dev_addr)
uint8_t phy_disk = dev_addr-1;
f_mount(phy_disk, NULL); // unmount disk
disk_state[phy_disk] = STA_NOINIT;
disk_deinitialize(phy_disk);
if ( phy_disk == f_get_current_drive() )
{ // active drive is unplugged --> change to other drive
for(uint8_t i=0; i<TUSB_CFG_HOST_DEVICE_MAX; i++)
{
if ( disk_is_ready(i) )
{
f_chdrive(i);
cli_init(); // refractor, rename
}
}
}
}
void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes)
@@ -131,7 +141,7 @@ void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes)
//--------------------------------------------------------------------+
void msc_app_init(void)
{
diskio_init();
}
//------------- main task -------------//