aboutsummaryrefslogtreecommitdiffstats
path: root/testhal
diff options
context:
space:
mode:
authorDiego Ismirlian <dismirlian (at) google's mail.com>2017-08-08 14:19:35 -0300
committerDiego Ismirlian <dismirlian (at) google's mail.com>2017-08-08 14:19:35 -0300
commitc466db250c1f2254c44e1ca067a93f489dabf931 (patch)
tree285832dd80bd6663acbc6f825cc893cc58b97a71 /testhal
parentc0205baf7d49b76e512dbae2537c062ac8efefc1 (diff)
downloadChibiOS-Contrib-c466db250c1f2254c44e1ca067a93f489dabf931.tar.gz
ChibiOS-Contrib-c466db250c1f2254c44e1ca067a93f489dabf931.tar.bz2
ChibiOS-Contrib-c466db250c1f2254c44e1ca067a93f489dabf931.zip
USBH: testhal example: improve support for multiple FAT devices
Diffstat (limited to 'testhal')
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/halconf.h2
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/main.c11
2 files changed, 7 insertions, 6 deletions
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
index 1511a42..9ddbb1b 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
+++ b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
@@ -125,7 +125,7 @@
* @brief Enables the SDC subsystem.
*/
#if !defined(HAL_USE_SDC) || defined(__DOXYGEN__)
-#define HAL_USE_SDC TRUE
+#define HAL_USE_SDC FALSE
#endif
/**
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/main.c b/testhal/STM32/STM32F4xx/USB_HOST/main.c
index c540233..a93a59e 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/main.c
+++ b/testhal/STM32/STM32F4xx/USB_HOST/main.c
@@ -297,6 +297,7 @@ start:
#if HAL_USBH_USE_MSD
#include "usbh/dev/msd.h"
#include "ff.h"
+#include "fatfs_devices.h"
static FATFS MSDLUN0FS;
@@ -388,14 +389,14 @@ start:
usbDbgPuts("FS: Block driver ready, try mount...");
- res = f_mount(&MSDLUN0FS, "0:", 1);
+ res = f_mount(&MSDLUN0FS, FATFSDEV_MSDLUN0_DRIVE, 1);
if (res != FR_OK) {
usbDbgPuts("FS: Can't mount. Check file system.");
continue;
}
usbDbgPuts("FS: Mounted.");
- res = f_getfree("0:", &clusters, &fsp);
+ res = f_getfree(FATFSDEV_MSDLUN0_DRIVE, &clusters, &fsp);
if (res != FR_OK) {
usbDbgPuts("FS: f_getfree() failed");
continue;
@@ -419,7 +420,7 @@ start:
//write test
if (1) {
usbDbgPuts("FS: Write test (create file /test.dat, 1MB)");
- f_open(&file, "/test.dat", FA_CREATE_ALWAYS | FA_WRITE);
+ f_open(&file, FATFSDEV_MSDLUN0_DRIVE "/test.dat", FA_CREATE_ALWAYS | FA_WRITE);
src = start;
st = chVTGetSystemTime();
for (j = 0; j < 2048; j++) {
@@ -439,7 +440,7 @@ start:
//read test
if (1) {
usbDbgPuts("FS: Read test (read file /test.dat, 1MB, compare)");
- f_open(&file, "/test.dat", FA_READ);
+ f_open(&file, FATFSDEV_MSDLUN0_DRIVE "/test.dat", FA_READ);
src = start;
st = chVTGetSystemTime();
for (j = 0; j < 2048; j++) {
@@ -463,7 +464,7 @@ start:
//scan files test
if (1) {
usbDbgPuts("FS: Scan files test");
- fbuff[0] = 0;
+ strcpy(fbuff, FATFSDEV_MSDLUN0_DRIVE);
scan_files(chp, (char *)fbuff);
}
}