add tusbh_msc_status

reanme PRINTF_TARGET_DEBUG_CONSOLE to PRINTF_TARGET_SEMIHOST
add read10 implementation
able to read fat root sector
This commit is contained in:
hathach
2013-09-25 16:20:38 +07:00
parent cf65f859be
commit 1fee50b9fe
18 changed files with 177 additions and 54 deletions
+1 -1
View File
@@ -78,7 +78,7 @@
//--------------------------------------------------------------------+
// PRINTF TARGET DEFINE
//--------------------------------------------------------------------+
#define PRINTF_TARGET_DEBUG_CONSOLE 1 // IDE semihosting console
#define PRINTF_TARGET_SEMIHOST 1
#define PRINTF_TARGET_UART 2
#define PRINTF_TARGET_SWO 3 // aka SWV, ITM
#define PRINTF_TARGET_NONE 4
@@ -66,6 +66,7 @@
#include "oem_base_board/pca9532.h" // LEDs
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART // FIXME keil's cmsis rtx does not work with UART (work with SWO)
+1 -1
View File
@@ -56,7 +56,7 @@
extern "C" {
#endif
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#ifdef __cplusplus
}
+1 -1
View File
@@ -56,7 +56,7 @@
extern "C" {
#endif
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#ifdef __cplusplus
@@ -65,7 +65,7 @@
#define CFG_LED_ON (1)
#define CFG_LED_OFF (0)
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#ifdef __cplusplus
}
@@ -57,7 +57,7 @@
#define CFG_LED_PORT (0)
#define CFG_LED_PIN (22)
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#ifdef __cplusplus
}
@@ -60,7 +60,7 @@
#include "lpc11uxx/gpio.h"
#include "lpc11uxx/uart.h"
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#define CFG_LED_PORT (1)
#define CFG_LED_PIN (31)
+1 -1
View File
@@ -56,7 +56,7 @@
extern "C" {
#endif
#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE
#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST
#ifdef __cplusplus
}
+2 -2
View File
@@ -38,7 +38,7 @@
#include "board.h"
#if CFG_PRINTF_TARGET != PRINTF_TARGET_DEBUG_CONSOLE
#if CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
#if CFG_PRINTF_TARGET == PRINTF_TARGET_UART
#define retarget_getchar() board_uart_getchar()
@@ -146,4 +146,4 @@ void _ttywrch(int ch)
#endif
#endif // CFG_PRINTF_TARGET != PRINTF_TARGET_DEBUG_CONSOLE
#endif // CFG_PRINTF_TARGET != PRINTF_TARGET_SEMIHOST
+20 -20
View File
@@ -480,7 +480,7 @@
<Focus>0</Focus>
<ColumnNumber>1</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>189</TopLine>
<TopLine>193</TopLine>
<CurrentLine>200</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\main.c</PathWithFileName>
@@ -496,7 +496,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>94</TopLine>
<TopLine>127</TopLine>
<CurrentLine>145</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\cdc_serial_app.c</PathWithFileName>
@@ -512,7 +512,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>136</TopLine>
<TopLine>169</TopLine>
<CurrentLine>180</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\keyboard_app.c</PathWithFileName>
@@ -528,7 +528,7 @@
<Focus>0</Focus>
<ColumnNumber>44</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>120</TopLine>
<TopLine>121</TopLine>
<CurrentLine>127</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\mouse_app.c</PathWithFileName>
@@ -576,7 +576,7 @@
<Focus>0</Focus>
<ColumnNumber>30</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>63</TopLine>
<TopLine>68</TopLine>
<CurrentLine>75</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\src\cli.c</PathWithFileName>
@@ -616,7 +616,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>136</TopLine>
<TopLine>137</TopLine>
<CurrentLine>142</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\embedded_artists\board_ea4357.c</PathWithFileName>
@@ -630,10 +630,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<ColumnNumber>25</ColumnNumber>
<ColumnNumber>6</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>100</TopLine>
<CurrentLine>132</CurrentLine>
<TopLine>128</TopLine>
<CurrentLine>135</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
<FilenameWithoutPath>printf_retarget.c</FilenameWithoutPath>
@@ -768,7 +768,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>25</TopLine>
<TopLine>58</TopLine>
<CurrentLine>76</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\tusb.c</PathWithFileName>
@@ -832,7 +832,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>483</TopLine>
<TopLine>494</TopLine>
<CurrentLine>501</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
@@ -848,7 +848,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>599</TopLine>
<TopLine>600</TopLine>
<CurrentLine>605</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\host\ehci\ehci.c</PathWithFileName>
@@ -1006,10 +1006,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<ColumnNumber>47</ColumnNumber>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>3</TopLine>
<CurrentLine>13</CurrentLine>
<TopLine>1</TopLine>
<CurrentLine>1</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\tinyusb\class\msc_host.c</PathWithFileName>
<FilenameWithoutPath>msc_host.c</FilenameWithoutPath>
@@ -1032,7 +1032,7 @@
<Focus>0</Focus>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>533</TopLine>
<TopLine>546</TopLine>
<CurrentLine>553</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\CMSIS_LPC43xx_DriverLib\src\lpc43xx_uart.c</PathWithFileName>
@@ -1136,7 +1136,7 @@
<Focus>0</Focus>
<ColumnNumber>26</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>145</TopLine>
<TopLine>147</TopLine>
<CurrentLine>154</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
@@ -1158,10 +1158,10 @@
<FileType>1</FileType>
<tvExp>0</tvExp>
<Focus>0</Focus>
<ColumnNumber>56</ColumnNumber>
<ColumnNumber>0</ColumnNumber>
<tvExpOptDlg>0</tvExpOptDlg>
<TopLine>1</TopLine>
<CurrentLine>20</CurrentLine>
<TopLine>13</TopLine>
<CurrentLine>23</CurrentLine>
<bDave2>0</bDave2>
<PathWithFileName>..\..\..\vendor\fatfs\diskio.c</PathWithFileName>
<FilenameWithoutPath>diskio.c</FilenameWithoutPath>
+25 -2
View File
@@ -84,14 +84,37 @@ 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) -------------//
DSTATUS stat = disk_initialize(0);
// DSTATUS stat = disk_initialize(0);
disk_state = 0;
if ( disk_is_ready(0) )
{
f_mount(0, &fatfs[dev_addr-1]);
if ( f_mount(0, &fatfs[dev_addr-1]) != FR_OK )
{
puts("mount failed");
return;
}
DIR root_dir;
if ( f_opendir(&root_dir, "/") != FR_OK )
{
puts("open root dir failed");
return;
}
}
}
void tusbh_msc_unmounted_isr(uint8_t dev_addr)
{
disk_state = STA_NOINIT;
puts("--");
}
void tusbh_msc_isr(uint8_t dev_addr, tusb_event_t event, uint32_t xferred_bytes)
{
putchar('x');
}
//--------------------------------------------------------------------+
// IMPLEMENTATION
//--------------------------------------------------------------------+