diff options
| author | hathach <[email protected]> | 2013-09-25 16:20:38 +0700 |
|---|---|---|
| committer | hathach <[email protected]> | 2013-09-25 16:20:38 +0700 |
| commit | 1fee50b9fe64c32f62baa8f96e1fa3687fa7da5d (patch) | |
| tree | def8c534d35e86c914da89517d6ecd3334a51716 /demos | |
| parent | cf65f859be27d71fb64c1c0bca07585f4df37f75 (diff) | |
add tusbh_msc_status
reanme PRINTF_TARGET_DEBUG_CONSOLE to PRINTF_TARGET_SEMIHOST
add read10 implementation
able to read fat root sector
Diffstat (limited to 'demos')
| -rw-r--r-- | demos/bsp/boards/board.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/embedded_artists/board_ea4357.h | 1 | ||||
| -rw-r--r-- | demos/bsp/boards/hitex/board_hitex4350.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/keil/board_mcb4300.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/microbuilder/board_rf1ghznode.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/ngx/board_ngx4330.h | 2 | ||||
| -rw-r--r-- | demos/bsp/boards/printf_retarget.c | 4 | ||||
| -rw-r--r-- | demos/host/host_os_none/host_os_none.uvopt | 40 | ||||
| -rw-r--r-- | demos/host/src/msc_app.c | 27 |
11 files changed, 55 insertions, 31 deletions
diff --git a/demos/bsp/boards/board.h b/demos/bsp/boards/board.h index aaa8074e5..7bbd96acb 100644 --- a/demos/bsp/boards/board.h +++ b/demos/bsp/boards/board.h @@ -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 diff --git a/demos/bsp/boards/embedded_artists/board_ea4357.h b/demos/bsp/boards/embedded_artists/board_ea4357.h index 2a6ef8490..5858b0496 100644 --- a/demos/bsp/boards/embedded_artists/board_ea4357.h +++ b/demos/bsp/boards/embedded_artists/board_ea4357.h @@ -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) diff --git a/demos/bsp/boards/hitex/board_hitex4350.h b/demos/bsp/boards/hitex/board_hitex4350.h index d1db09220..0d7a53666 100644 --- a/demos/bsp/boards/hitex/board_hitex4350.h +++ b/demos/bsp/boards/hitex/board_hitex4350.h @@ -56,7 +56,7 @@ extern "C" { #endif -#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE +#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST #ifdef __cplusplus } diff --git a/demos/bsp/boards/keil/board_mcb4300.h b/demos/bsp/boards/keil/board_mcb4300.h index a33878366..e0c5526af 100644 --- a/demos/bsp/boards/keil/board_mcb4300.h +++ b/demos/bsp/boards/keil/board_mcb4300.h @@ -56,7 +56,7 @@ extern "C" { #endif -#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE +#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST #ifdef __cplusplus diff --git a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.h b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.h index bca6e9ab0..5f65cc761 100644 --- a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.h +++ b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1347.h @@ -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 } diff --git a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.h b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.h index 8e2212cc5..cfb01c3ec 100644 --- a/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.h +++ b/demos/bsp/boards/lpcxpresso/board_lpcxpresso1769.h @@ -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 } diff --git a/demos/bsp/boards/microbuilder/board_rf1ghznode.h b/demos/bsp/boards/microbuilder/board_rf1ghznode.h index 1f8d15fd7..565983d86 100644 --- a/demos/bsp/boards/microbuilder/board_rf1ghznode.h +++ b/demos/bsp/boards/microbuilder/board_rf1ghznode.h @@ -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) diff --git a/demos/bsp/boards/ngx/board_ngx4330.h b/demos/bsp/boards/ngx/board_ngx4330.h index d3d740e14..09581bcef 100644 --- a/demos/bsp/boards/ngx/board_ngx4330.h +++ b/demos/bsp/boards/ngx/board_ngx4330.h @@ -56,7 +56,7 @@ extern "C" { #endif -#define CFG_PRINTF_TARGET PRINTF_TARGET_DEBUG_CONSOLE +#define CFG_PRINTF_TARGET PRINTF_TARGET_SEMIHOST #ifdef __cplusplus } diff --git a/demos/bsp/boards/printf_retarget.c b/demos/bsp/boards/printf_retarget.c index f940836fd..6dfc711a2 100644 --- a/demos/bsp/boards/printf_retarget.c +++ b/demos/bsp/boards/printf_retarget.c @@ -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 diff --git a/demos/host/host_os_none/host_os_none.uvopt b/demos/host/host_os_none/host_os_none.uvopt index f6140d21f..19453212b 100644 --- a/demos/host/host_os_none/host_os_none.uvopt +++ b/demos/host/host_os_none/host_os_none.uvopt @@ -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> diff --git a/demos/host/src/msc_app.c b/demos/host/src/msc_app.c index 1006ad168..a6a3583d7 100644 --- a/demos/host/src/msc_app.c +++ b/demos/host/src/msc_app.c @@ -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 //--------------------------------------------------------------------+ |
