aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--os/hal/include/hal_usbh.h15
-rw-r--r--os/hal/src/hal_usbh.c8
-rw-r--r--os/hal/src/usbh/hal_usbh_aoa.c31
-rw-r--r--os/hal/src/usbh/hal_usbh_debug.c23
-rw-r--r--os/hal/src/usbh/hal_usbh_ftdi.c1
-rw-r--r--os/various/fatfs_bindings/fatfs.mk2
-rw-r--r--os/various/fatfs_bindings/fatfs_devices.h41
-rw-r--r--os/various/fatfs_bindings/fatfs_diskio.c72
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/.cproject2
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/.project4
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/.settings/org.eclipse.cdt.core.prefs6
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/Makefile10
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/chconf.h30
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/ffconf.h89
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/halconf.h142
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/main.c11
-rw-r--r--testhal/STM32/STM32F4xx/USB_HOST/mcuconf.h28
17 files changed, 379 insertions, 136 deletions
diff --git a/os/hal/include/hal_usbh.h b/os/hal/include/hal_usbh.h
index 1ed6416..8d9a85b 100644
--- a/os/hal/include/hal_usbh.h
+++ b/os/hal/include/hal_usbh.h
@@ -52,7 +52,9 @@
#define HAL_USBH_USE_ADDITIONAL_CLASS_DRIVERS FALSE
#endif
+#ifndef HAL_USBH_USE_IAD
#define HAL_USBH_USE_IAD HAL_USBH_USE_UVC
+#endif
#if (HAL_USE_USBH == TRUE) || defined(__DOXYGEN__)
@@ -299,11 +301,22 @@ extern "C" {
}
/* Synchronous API */
- usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep,
+ usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep,
void *data,
uint32_t len,
uint32_t *actual_len,
systime_t timeout);
+
+ static inline usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep,
+ void *data,
+ uint32_t len,
+ uint32_t *actual_len,
+ systime_t timeout) {
+ osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep");
+
+ return usbhSynchronousTransfer(ep, data, len, actual_len, timeout);
+ }
+
usbh_urbstatus_t usbhControlRequest(usbh_device_t *dev,
uint8_t bmRequestType,
uint8_t bRequest,
diff --git a/os/hal/src/hal_usbh.c b/os/hal/src/hal_usbh.c
index 7dff98a..78ac837 100644
--- a/os/hal/src/hal_usbh.c
+++ b/os/hal/src/hal_usbh.c
@@ -302,6 +302,7 @@ msg_t usbhURBSubmitAndWaitS(usbh_urb_t *urb, systime_t timeout) {
_check_urb(urb);
usbhURBSubmitI(urb);
+ osalOsRescheduleS(); /* This call is necessary because usbhURBSubmitI may require a reschedule */
ret = usbhURBWaitTimeoutS(urb, timeout);
if (ret == MSG_TIMEOUT)
_usbh_urb_abort_and_waitS(urb, USBH_URBSTATUS_TIMEOUT);
@@ -330,7 +331,7 @@ void _usbh_urb_completeI(usbh_urb_t *urb, usbh_urbstatus_t status) {
/* Synchronous API. */
/*===========================================================================*/
-usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep,
+usbh_urbstatus_t usbhSynchronousTransfer(usbh_ep_t *ep,
void *data,
uint32_t len,
uint32_t *actual_len,
@@ -338,7 +339,6 @@ usbh_urbstatus_t usbhBulkTransfer(usbh_ep_t *ep,
osalDbgCheck(ep != NULL);
osalDbgCheck((data != NULL) || (len == 0));
- osalDbgAssert(ep->type == USBH_EPTYPE_BULK, "wrong ep");
usbh_urb_t urb;
usbhURBObjectInit(&urb, ep, 0, 0, data, len);
@@ -860,9 +860,7 @@ static void _port_process_status_change(usbh_port_t *port) {
usbhhubClearFeaturePort(port, USBH_PORT_FEAT_C_CONNECTION);
if (port->device.status != USBH_DEVSTATUS_DISCONNECTED) {
- if (!(port->status & USBH_PORTSTATUS_CONNECTION)) {
- _usbh_port_disconnected(port);
- }
+ _usbh_port_disconnected(port);
}
}
diff --git a/os/hal/src/usbh/hal_usbh_aoa.c b/os/hal/src/usbh/hal_usbh_aoa.c
index 1447bdb..4e1d65d 100644
--- a/os/hal/src/usbh/hal_usbh_aoa.c
+++ b/os/hal/src/usbh/hal_usbh_aoa.c
@@ -161,6 +161,11 @@ static usbh_baseclassdriver_t *_aoa_load(usbh_device_t *dev, const uint8_t *desc
}
};
+ if (descriptor[1] != USBH_DT_DEVICE) {
+ uinfo("AOA: Won't try to detect Android device at interface level");
+ return NULL;
+ }
+
uinfo("AOA: Unrecognized VID");
#if defined(HAL_USBHAOA_FILTER_CALLBACK)
@@ -171,6 +176,7 @@ static usbh_baseclassdriver_t *_aoa_load(usbh_device_t *dev, const uint8_t *desc
uinfo("AOA: Try if it's an Android device");
if (_get_protocol(dev, &protocol) != HAL_SUCCESS) {
+ uinfo("AOA: not an Android device");
return NULL;
}
uinfof("AOA: Possible Android device found (protocol=%d)", protocol);
@@ -196,6 +202,8 @@ static usbh_baseclassdriver_t *_aoa_load(usbh_device_t *dev, const uint8_t *desc
if (_accessory_start(dev) != HAL_SUCCESS) {
uerr("AOA: Can't start accessory; abort channel start");
+ } else {
+ uinfo("AOA: Accessory started");
}
return NULL;
@@ -320,7 +328,7 @@ static void _out_cb(usbh_urb_t *urb) {
return;
case USBH_URBSTATUS_DISCONNECTED:
uwarn("AOA: URB OUT disconnected");
- chThdDequeueNextI(&aoacp->oq_waiting, Q_RESET);
+ chThdDequeueAllI(&aoacp->oq_waiting, Q_RESET);
chnAddFlagsI(aoacp, CHN_OUTPUT_EMPTY);
return;
default:
@@ -419,7 +427,10 @@ static void _in_cb(usbh_urb_t *urb) {
break;
case USBH_URBSTATUS_DISCONNECTED:
uwarn("AOA: URB IN disconnected");
- chThdDequeueNextI(&aoacp->iq_waiting, Q_RESET);
+ chThdDequeueAllI(&aoacp->iq_waiting, Q_RESET);
+ chnAddFlagsI(aoacp, CHN_DISCONNECTED);
+ aoacp->state = USBHAOA_CHANNEL_STATE_ACTIVE;
+ container_of(aoacp, USBHAOADriver, channel)->state = USBHAOA_STATE_ACTIVE;
break;
default:
uerrf("AOA: URB IN status unexpected = %d", urb->status);
@@ -535,14 +546,16 @@ static void _stop_channelS(USBHAOAChannel *aoacp) {
static void _vt(void *p) {
USBHAOAChannel *const aoacp = (USBHAOAChannel *)p;
osalSysLockFromISR();
- uint32_t len = aoacp->oq_ptr - aoacp->oq_buff;
- if (len && !usbhURBIsBusy(&aoacp->oq_urb)) {
- _submitOutI(aoacp, len);
- }
- if ((aoacp->iq_counter == 0) && !usbhURBIsBusy(&aoacp->iq_urb)) {
- _submitInI(aoacp);
+ if (aoacp->state == USBHAOA_CHANNEL_STATE_READY) {
+ uint32_t len = aoacp->oq_ptr - aoacp->oq_buff;
+ if (len && !usbhURBIsBusy(&aoacp->oq_urb)) {
+ _submitOutI(aoacp, len);
+ }
+ if ((aoacp->iq_counter == 0) && !usbhURBIsBusy(&aoacp->iq_urb)) {
+ _submitInI(aoacp);
+ }
+ chVTSetI(&aoacp->vt, OSAL_MS2I(16), _vt, aoacp);
}
- chVTSetI(&aoacp->vt, OSAL_MS2I(16), _vt, aoacp);
osalSysUnlockFromISR();
}
diff --git a/os/hal/src/usbh/hal_usbh_debug.c b/os/hal/src/usbh/hal_usbh_debug.c
index d32f1c6..85c6640 100644
--- a/os/hal/src/usbh/hal_usbh_debug.c
+++ b/os/hal/src/usbh/hal_usbh_debug.c
@@ -22,7 +22,13 @@
#include "ch.h"
#include "usbh/debug.h"
#include <stdarg.h>
+#if 0
+#include "debug.h"
+#else
#include "chprintf.h"
+#define dbg_lock()
+#define dbg_unlock()
+#endif
#define MAX_FILLER 11
#define FLOAT_PRECISION 9
@@ -393,6 +399,9 @@ void usbDbgPrintf(const char *fmt, ...)
chThdDequeueNextI(&USBH_DEBUG_USBHD.iq.q_waiting, Q_OK);
}
chSysRestoreStatusX(sts);
+ if (!port_is_isr_context() && chSchIsPreemptionRequired()) {
+ chSchRescheduleS();
+ }
va_end(ap);
}
@@ -422,6 +431,9 @@ void usbDbgPuts(const char *s)
chThdDequeueNextI(&USBH_DEBUG_USBHD.iq.q_waiting, Q_OK);
}
chSysRestoreStatusX(sts);
+ if (!port_is_isr_context() && chSchIsPreemptionRequired()) {
+ chSchRescheduleS();
+ }
}
void usbDbgReset(void) {
@@ -435,6 +447,9 @@ void usbDbgReset(void) {
USBH_DEBUG_SD.oqueue.q_counter--;
}
chSysRestoreStatusX(sts);
+ if (!port_is_isr_context() && chSchIsPreemptionRequired()) {
+ chSchRescheduleS();
+ }
}
static int _get(void) {
@@ -527,6 +542,7 @@ static void usb_debug_thread(void *arg) {
uint32_t f = hfnum & 0xffff;
uint32_t p = 1000 - ((hfnum >> 16) / (hfir / 1000));
+ dbg_lock();
chprintf((BaseSequentialStream *)&USBH_DEBUG_SD, "%05d.%03d ", f, p);
state = 4;
} else if (state == 3) {
@@ -543,6 +559,7 @@ static void usb_debug_thread(void *arg) {
c = iqGet(&host->iq); if (c < 0) goto reset;
t |= c << 24;
+ dbg_lock();
chprintf((BaseSequentialStream *)&USBH_DEBUG_SD, "+%08d ", t);
state = 4;
} else {
@@ -550,8 +567,7 @@ static void usb_debug_thread(void *arg) {
if (!c) {
sdPut(&USBH_DEBUG_SD, '\r');
sdPut(&USBH_DEBUG_SD, '\n');
- state = 0;
- break;
+ goto reset;
}
sdPut(&USBH_DEBUG_SD, (uint8_t)c);
c = iqGet(&host->iq); if (c < 0) goto reset;
@@ -560,6 +576,9 @@ static void usb_debug_thread(void *arg) {
continue;
reset:
+ if (state == 4) {
+ dbg_unlock();
+ }
state = 0;
}
}
diff --git a/os/hal/src/usbh/hal_usbh_ftdi.c b/os/hal/src/usbh/hal_usbh_ftdi.c
index 7bd8f2d..b262256 100644
--- a/os/hal/src/usbh/hal_usbh_ftdi.c
+++ b/os/hal/src/usbh/hal_usbh_ftdi.c
@@ -150,6 +150,7 @@ alloc_ok:
case 0x900: //232H;
uinfo("FTDI: Type H chip");
ftdip->type = USBHFTDI_TYPE_H;
+ break;
default:
uerr("FTDI: Unrecognized chip type");
return NULL;
diff --git a/os/various/fatfs_bindings/fatfs.mk b/os/various/fatfs_bindings/fatfs.mk
index 2a3b4d6..7548acf 100644
--- a/os/various/fatfs_bindings/fatfs.mk
+++ b/os/various/fatfs_bindings/fatfs.mk
@@ -4,7 +4,7 @@ FATFSSRC = ${CHIBIOS_CONTRIB}/os/various/fatfs_bindings/fatfs_diskio.c \
${CHIBIOS}/ext/fatfs/src/ff.c \
$(CHIBIOS)/ext/fatfs/src/ffunicode.c
-FATFSINC = ${CHIBIOS}/ext/fatfs/src
+FATFSINC = ${CHIBIOS}/ext/fatfs/src ${CHIBIOS_CONTRIB}/os/various/fatfs_bindings
# Shared variables
ALLCSRC += $(FATFSSRC)
diff --git a/os/various/fatfs_bindings/fatfs_devices.h b/os/various/fatfs_bindings/fatfs_devices.h
new file mode 100644
index 0000000..fe28383
--- /dev/null
+++ b/os/various/fatfs_bindings/fatfs_devices.h
@@ -0,0 +1,41 @@
+/*
+ ChibiOS - Copyright (C) 2006..2017 Giovanni Di Sirio
+ Copyright (C) 2015..2017 Diego Ismirlian, (dismirlian (at) google's mail)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+*/
+
+#ifndef FATFS_DEVICES_H_
+#define FATFS_DEVICES_H_
+
+#include "hal.h"
+
+/*-----------------------------------------------------------------------*/
+/* Correspondence between physical drive number and physical drive. */
+#if HAL_USE_MMC_SPI || HAL_USE_SDC
+#define FATFSDEV_MMC 0
+#define FATFSDEV_MMC_DRIVE "0:"
+#endif
+
+
+#if HAL_USBH_USE_MSD
+#if defined(FATFSDEV_MMC)
+#define FATFSDEV_MSD 1
+#define FATFSDEV_MSD_DRIVE "1:"
+#else
+#define FATFSDEV_MSD 0
+#define FATFSDEV_MSD_DRIVE "0:"
+#endif
+#endif
+
+#endif /* FATFS_DEVICES_H_ */
diff --git a/os/various/fatfs_bindings/fatfs_diskio.c b/os/various/fatfs_bindings/fatfs_diskio.c
index 7f510a0..e3cfd53 100644
--- a/os/various/fatfs_bindings/fatfs_diskio.c
+++ b/os/various/fatfs_bindings/fatfs_diskio.c
@@ -7,17 +7,19 @@
#include "hal.h"
#include "ffconf.h"
+#include "ff.h"
#include "diskio.h"
#include "usbh/dev/msd.h"
+#include "fatfs_devices.h"
#if HAL_USE_MMC_SPI && HAL_USE_SDC
-#error "cannot specify both MMC_SPI and SDC drivers"
+#error "cannot specify both MMC_SPI and FATFSDEV_MMC drivers"
#endif
// sanity check for no FAT option selected
// why is the FAT sources being pulled into the build?
#if !HAL_USE_MMC_SPI && !HAL_USE_SDC & !HAL_USBH_USE_MSD
-#error "MMC_SPI, SDC or USBH_MSD driver must be specified. None was."
+#error "MMC_SPI, FATFSDEV_MMC or USBH_MSD driver must be specified. None was."
#endif
#if !defined(FATFS_HAL_DEVICE)
@@ -41,24 +43,6 @@ extern SDCDriver FATFS_HAL_DEVICE;
extern RTCDriver RTCD1;
#endif
-/*-----------------------------------------------------------------------*/
-/* Correspondence between physical drive number and physical drive. */
-#if HAL_USE_MMC_SPI
-#define MMC 0
-#endif
-
-#if HAL_USE_SDC
-#define SDC 0
-#endif
-
-#if HAL_USBH_USE_MSD
-#if defined(MMC) || defined(SDC)
-#define MSDLUN0 1
-#else
-#define MSDLUN0 0
-#endif
-#endif
-
/*-----------------------------------------------------------------------*/
/* Inidialize a Drive */
@@ -71,7 +55,7 @@ DSTATUS disk_initialize (
switch (pdrv) {
#if HAL_USE_MMC_SPI
- case MMC:
+ case FATFSDEV_MMC:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
@@ -80,7 +64,7 @@ DSTATUS disk_initialize (
stat |= STA_PROTECT;
return stat;
#elif HAL_USE_SDC
- case SDC:
+ case FATFSDEV_MMC:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
@@ -90,7 +74,7 @@ DSTATUS disk_initialize (
return stat;
#endif
#if HAL_USBH_USE_MSD
- case MSDLUN0:
+ case FATFSDEV_MSD:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&MSBLKD[0]) != BLK_READY)
@@ -114,7 +98,7 @@ DSTATUS disk_status (
switch (pdrv) {
#if HAL_USE_MMC_SPI
- case MMC:
+ case FATFSDEV_MMC:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
@@ -123,7 +107,7 @@ DSTATUS disk_status (
stat |= STA_PROTECT;
return stat;
#elif HAL_USE_SDC
- case SDC:
+ case FATFSDEV_MMC:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
@@ -133,7 +117,7 @@ DSTATUS disk_status (
return stat;
#endif
#if HAL_USBH_USE_MSD
- case MSDLUN0:
+ case FATFSDEV_MSD:
stat = 0;
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&MSBLKD[0]) != BLK_READY)
@@ -158,7 +142,7 @@ DRESULT disk_read (
{
switch (pdrv) {
#if HAL_USE_MMC_SPI
- case MMC:
+ case FATFSDEV_MMC:
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
return RES_NOTRDY;
if (mmcStartSequentialRead(&FATFS_HAL_DEVICE, sector))
@@ -173,7 +157,7 @@ DRESULT disk_read (
return RES_ERROR;
return RES_OK;
#elif HAL_USE_SDC
- case SDC:
+ case FATFSDEV_MMC:
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
return RES_NOTRDY;
if (sdcRead(&FATFS_HAL_DEVICE, sector, buff, count))
@@ -181,7 +165,7 @@ DRESULT disk_read (
return RES_OK;
#endif
#if HAL_USBH_USE_MSD
- case MSDLUN0:
+ case FATFSDEV_MSD:
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&MSBLKD[0]) != BLK_READY)
return RES_NOTRDY;
@@ -209,7 +193,7 @@ DRESULT disk_write (
switch (pdrv) {
#if HAL_USE_MMC_SPI
- case MMC:
+ case FATFSDEV_MMC:
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
return RES_NOTRDY;
if (mmcIsWriteProtected(&FATFS_HAL_DEVICE))
@@ -218,19 +202,19 @@ DRESULT disk_write (
return RES_ERROR;
while (count > 0) {
- // invalidate cache on buffer
- cacheBufferFlush(buff, MMCSD_BLOCK_SIZE);
+ // invalidate cache on buffer
+ cacheBufferFlush(buff, MMCSD_BLOCK_SIZE);
- if (mmcSequentialWrite(&FATFS_HAL_DEVICE, buff))
- return RES_ERROR;
- buff += MMCSD_BLOCK_SIZE;
- count--;
+ if (mmcSequentialWrite(&FATFS_HAL_DEVICE, buff))
+ return RES_ERROR;
+ buff += MMCSD_BLOCK_SIZE;
+ count--;
}
if (mmcStopSequentialWrite(&FATFS_HAL_DEVICE))
return RES_ERROR;
return RES_OK;
#elif HAL_USE_SDC
- case SDC:
+ case FATFSDEV_MMC:
if (blkGetDriverState(&FATFS_HAL_DEVICE) != BLK_READY)
return RES_NOTRDY;
@@ -238,18 +222,18 @@ DRESULT disk_write (
cacheBufferFlush(buff, count * MMCSD_BLOCK_SIZE);
if (sdcWrite(&FATFS_HAL_DEVICE, sector, buff, count))
- return RES_ERROR;
+ return RES_ERROR;
return RES_OK;
#endif
#if HAL_USBH_USE_MSD
- case MSDLUN0:
+ case FATFSDEV_MSD:
/* It is initialized externally, just reads the status.*/
if (blkGetDriverState(&MSBLKD[0]) != BLK_READY)
return RES_NOTRDY;
- // invalidate cache on buffer
- cacheBufferFlush(buff, count * MSBLKD[0].info.blk_size);
+ // invalidate cache on buffer
+ cacheBufferFlush(buff, count * MSBLKD[0].info.blk_size);
if (usbhmsdLUNWrite(&MSBLKD[0], sector, buff, count))
return RES_ERROR;
@@ -275,7 +259,7 @@ DRESULT disk_ioctl (
switch (pdrv) {
#if HAL_USE_MMC_SPI
- case MMC:
+ case FATFSDEV_MMC:
switch (cmd) {
case CTRL_SYNC:
return RES_OK;
@@ -293,7 +277,7 @@ DRESULT disk_ioctl (
return RES_PARERR;
}
#elif HAL_USE_SDC
- case SDC:
+ case FATFSDEV_MMC:
switch (cmd) {
case CTRL_SYNC:
return RES_OK;
@@ -318,7 +302,7 @@ DRESULT disk_ioctl (
}
#endif
#if HAL_USBH_USE_MSD
- case MSDLUN0:
+ case FATFSDEV_MSD:
switch (cmd) {
case CTRL_SYNC:
return RES_OK;
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/.cproject b/testhal/STM32/STM32F4xx/USB_HOST/.cproject
index d733e39..8d56b51 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/.cproject
+++ b/testhal/STM32/STM32F4xx/USB_HOST/.cproject
@@ -14,7 +14,7 @@
</extensions>
</storageModule>
<storageModule moduleId="cdtBuildSystem" version="4.0.0">
- <configuration buildProperties="" description="" id="0.1003150841" name="Default" parent="org.eclipse.cdt.build.core.prefbase.cfg">
+ <configuration buildProperties="" description="" id="0.1003150841" name="Default" optionalBuildProperties="" parent="org.eclipse.cdt.build.core.prefbase.cfg">
<folderInfo id="0.1003150841." name="/" resourcePath="">
<toolChain id="org.eclipse.cdt.build.core.prefbase.toolchain.748316353" name="No ToolChain" resourceTypeBasedDiscovery="false" superClass="org.eclipse.cdt.build.core.prefbase.toolchain">
<targetPlatform id="org.eclipse.cdt.build.core.prefbase.toolchain.748316353.81353447" name=""/>
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/.project b/testhal/STM32/STM32F4xx/USB_HOST/.project
index 066a4d6..8db459b 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/.project
+++ b/testhal/STM32/STM32F4xx/USB_HOST/.project
@@ -31,9 +31,9 @@
<locationURI>$%7BPARENT-5-PROJECT_LOC%7D/ChibiOS-contrib/os</locationURI>
</link>
<link>
- <name>ChibiOS-RT-os</name>
+ <name>ChibiOS-RT</name>
<type>2</type>
- <locationURI>$%7BPARENT-5-PROJECT_LOC%7D/ChibiOS-RT/os</locationURI>
+ <locationURI>$%7BPARENT-5-PROJECT_LOC%7D/ChibiOS</locationURI>
</link>
</linkedResources>
</projectDescription>
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/.settings/org.eclipse.cdt.core.prefs b/testhal/STM32/STM32F4xx/USB_HOST/.settings/org.eclipse.cdt.core.prefs
new file mode 100644
index 0000000..8ae48ef
--- /dev/null
+++ b/testhal/STM32/STM32F4xx/USB_HOST/.settings/org.eclipse.cdt.core.prefs
@@ -0,0 +1,6 @@
+eclipse.preferences.version=1
+environment/project/0.1003150841/PATH/delimiter=;
+environment/project/0.1003150841/PATH/operation=replace
+environment/project/0.1003150841/PATH/value=${PATH};D\:\\toolchains\\gcc-arm-none-eabi-8-2018-q4-major-win32\\bin;${PATH};D\:\\toolchains\\gcc-arm-none-eabi-4_9-2014q4-20141203-win32\\bin;D\:\\toolchains\\msys64\\usr\\bin
+environment/project/0.1003150841/append=true
+environment/project/0.1003150841/appendContributed=true
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/Makefile b/testhal/STM32/STM32F4xx/USB_HOST/Makefile
index f518c5f..54c23ca 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/Makefile
+++ b/testhal/STM32/STM32F4xx/USB_HOST/Makefile
@@ -30,7 +30,7 @@ endif
# Enable this if you want link time optimizations (LTO)
ifeq ($(USE_LTO),)
- USE_LTO = yes
+ USE_LTO = no
endif
# If enabled, this option allows to compile the application in THUMB mode.
@@ -88,6 +88,7 @@ PROJECT = ch
# Imported source files and paths
CHIBIOS = ../../../../../ChibiOS
CHIBIOS_CONTRIB = $(CHIBIOS)/../ChibiOS-Contrib
+
# Licensing files.
include $(CHIBIOS)/os/license/license.mk
# Startup files.
@@ -96,10 +97,12 @@ include $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk/startup_stm32f4xx.m
include $(CHIBIOS_CONTRIB)/os/hal/hal.mk
include $(CHIBIOS_CONTRIB)/os/hal/ports/STM32/STM32F4xx/platform.mk
include $(CHIBIOS)/os/hal/boards/ST_STM32F4_DISCOVERY/board.mk
-include $(CHIBIOS)/os/hal/osal/rt/osal.mk
+include $(CHIBIOS)/os/hal/osal/rt-nil/osal.mk
# RTOS files (optional).
include $(CHIBIOS)/os/rt/rt.mk
include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk
+# Auto-build files in ./source recursively.
+include $(CHIBIOS)/tools/mk/autobuild.mk
# Other files (optional).
include $(CHIBIOS)/test/lib/test.mk
include $(CHIBIOS)/test/rt/rt_test.mk
@@ -213,5 +216,6 @@ ULIBS =
# End of user defines
##############################################################################
-RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC
+RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk
+include $(RULESPATH)/arm-none-eabi.mk
include $(RULESPATH)/rules.mk
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/chconf.h b/testhal/STM32/STM32F4xx/USB_HOST/chconf.h
index 58cd5db..17496b1 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/chconf.h
+++ b/testhal/STM32/STM32F4xx/USB_HOST/chconf.h
@@ -15,7 +15,7 @@
*/
/**
- * @file templates/chconf.h
+ * @file rt/templates/chconf.h
* @brief Configuration file template.
* @details A copy of this file must be placed in each project directory, it
* contains the application specific kernel settings.
@@ -29,7 +29,7 @@
#define CHCONF_H
#define _CHIBIOS_RT_CONF_
-#define _CHIBIOS_RT_CONF_VER_5_1_
+#define _CHIBIOS_RT_CONF_VER_6_0_
/*===========================================================================*/
/**
@@ -172,7 +172,7 @@
* @note The default is @p TRUE.
*/
#if !defined(CH_CFG_USE_TM)
-#define CH_CFG_USE_TM FALSE
+#define CH_CFG_USE_TM TRUE
#endif
/**
@@ -360,7 +360,7 @@
#endif
/**
- * @brief Objects FIFOs APIs.
+ * @brief Objects FIFOs APIs.
* @details If enabled then the objects FIFOs APIs are included
* in the kernel.
*
@@ -371,6 +371,17 @@
#endif
/**
+ * @brief Pipes APIs.
+ * @details If enabled then the pipes APIs are included
+ * in the kernel.
+ *
+ * @note The default is @p TRUE.
+ */
+#if !defined(CH_CFG_USE_PIPES)
+#define CH_CFG_USE_PIPES TRUE
+#endif
+
+/**
* @brief Dynamic Threads APIs.
* @details If enabled then the dynamic threads creation APIs are included
* in the kernel.
@@ -447,6 +458,13 @@
#define CH_CFG_FACTORY_OBJ_FIFOS TRUE
#endif
+/**
+ * @brief Enables factory for Pipes.
+ */
+#if !defined(CH_CFG_FACTORY_PIPES) || defined(__DOXYGEN__)
+#define CH_CFG_FACTORY_PIPES TRUE
+#endif
+
/** @} */
/*===========================================================================*/
@@ -506,7 +524,7 @@
* @note The default is @p CH_DBG_TRACE_MASK_DISABLED.
*/
#if !defined(CH_DBG_TRACE_MASK)
-#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_ALL
+#define CH_DBG_TRACE_MASK CH_DBG_TRACE_MASK_DISABLED
#endif
/**
@@ -674,6 +692,8 @@
*/
#define CH_CFG_SYSTEM_HALT_HOOK(reason) { \
/* System halt code here.*/ \
+ void usbDbgSystemHalted(void); \
+ usbDbgSystemHalted(); \
}
/**
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h b/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h
index 944ffde..c3530a5 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h
+++ b/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h
@@ -2,10 +2,10 @@
#include "ch.h"
/*---------------------------------------------------------------------------/
-/ FatFs - Configuration file
+/ FatFs Functional Configurations
/---------------------------------------------------------------------------*/
-#define FFCONF_DEF 87030 /* Revision ID */
+#define FFCONF_DEF 86604 /* Revision ID */
/*---------------------------------------------------------------------------/
/ Function Configurations
@@ -21,7 +21,7 @@
#define FF_FS_MINIMIZE 0
/* This option defines minimization level to remove some basic API functions.
/
-/ 0: All basic functions are enabled.
+/ 0: Basic functions are fully enabled.
/ 1: f_stat(), f_getfree(), f_unlink(), f_mkdir(), f_truncate() and f_rename()
/ are removed.
/ 2: f_opendir(), f_readdir() and f_closedir() are removed in addition to 1.
@@ -71,7 +71,7 @@
/ Locale and Namespace Configurations
/---------------------------------------------------------------------------*/
-#define FF_CODE_PAGE 850
+#define FF_CODE_PAGE 437
/* This option specifies the OEM code page to be used on the target system.
/ Incorrect code page setting can cause a file open failure.
/
@@ -100,8 +100,8 @@
*/
-#define FF_USE_LFN 3
-#define FF_MAX_LFN 255
+#define FF_USE_LFN 3
+#define FF_MAX_LFN 255
/* The FF_USE_LFN switches the support for LFN (long file name).
/
/ 0: Disable LFN. FF_MAX_LFN has no effect.
@@ -109,32 +109,47 @@
/ 2: Enable LFN with dynamic working buffer on the STACK.
/ 3: Enable LFN with dynamic working buffer on the HEAP.
/
-/ To enable the LFN, Unicode handling functions (option/unicode.c) must be added
-/ to the project. The working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
-/ additional 608 bytes at exFAT enabled. FF_MAX_LFN can be in range from 12 to 255.
-/ It should be set 255 to support full featured LFN operations.
+/ To enable the LFN, ffunicode.c needs to be added to the project. The LFN function
+/ requiers certain internal working buffer occupies (FF_MAX_LFN + 1) * 2 bytes and
+/ additional (FF_MAX_LFN + 44) / 15 * 32 bytes when exFAT is enabled.
+/ The FF_MAX_LFN defines size of the working buffer in UTF-16 code unit and it can
+/ be in range of 12 to 255. It is recommended to be set 255 to fully support LFN
+/ specification.
/ When use stack for the working buffer, take care on stack overflow. When use heap
/ memory for the working buffer, memory management functions, ff_memalloc() and
-/ ff_memfree(), must be added to the project. */
+/ ff_memfree() in ffsystem.c, need to be added to the project. */
#define FF_LFN_UNICODE 0
-/* This option switches character encoding on the API, 0:ANSI/OEM or 1:UTF-16,
-/ when LFN is enabled. Also behavior of string I/O functions will be affected by
-/ this option. When LFN is not enabled, this option has no effect.
-*/
+/* This option switches the character encoding on the API when LFN is enabled.
+/
+/ 0: ANSI/OEM in current CP (TCHAR = char)
+/ 1: Unicode in UTF-16 (TCHAR = WCHAR)
+/ 2: Unicode in UTF-8 (TCHAR = char)
+/ 3: Unicode in UTF-32 (TCHAR = DWORD)
+/
+/ Also behavior of string I/O functions will be affected by this option.
+/ When LFN is not enabled, this option has no effect. */
+
+
+#define FF_LFN_BUF 255
+#define FF_SFN_BUF 12
+/* This set of options defines size of file name members in the FILINFO structure
+/ which is used to read out directory items. These values should be suffcient for
+/ the file names to read. The maximum possible length of the read file name depends
+/ on character encoding. When LFN is not enabled, these options have no effect. */
#define FF_STRF_ENCODE 3
-/* When FF_LFN_UNICODE = 1 with LFN enabled, string I/O functions, f_gets(),
+/* When FF_LFN_UNICODE >= 1 with LFN enabled, string I/O functions, f_gets(),
/ f_putc(), f_puts and f_printf() convert the character encoding in it.
/ This option selects assumption of character encoding ON THE FILE to be
/ read/written via those functions.
/
-/ 0: ANSI/OEM
-/ 1: UTF-16LE
-/ 2: UTF-16BE
-/ 3: UTF-8
+/ 0: ANSI/OEM in current CP
+/ 1: Unicode in UTF-16LE
+/ 2: Unicode in UTF-16BE
+/ 3: Unicode in UTF-8
*/
@@ -157,11 +172,16 @@
#define FF_STR_VOLUME_ID 0
#define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3"
-/* FF_STR_VOLUME_ID switches string support for volume ID.
-/ When FF_STR_VOLUME_ID is set to 1, also pre-defined strings can be used as drive
-/ number in the path name. FF_VOLUME_STRS defines the drive ID strings for each
-/ logical drives. Number of items must be equal to FF_VOLUMES. Valid characters for
-/ the drive ID strings are: A-Z and 0-9. */
+/* FF_STR_VOLUME_ID switches support for volume ID in arbitrary strings.
+/ When FF_STR_VOLUME_ID is set to 1 or 2, arbitrary strings can be used as drive
+/ number in the path name. FF_VOLUME_STRS defines the volume ID strings for each
+/ logical drives. Number of items must not be less than FF_VOLUMES. Valid
+/ characters for the volume ID strings are A-Z, a-z and 0-9, however, they are
+/ compared in case-insensitive. If FF_STR_VOLUME_ID >= 1 and FF_VOLUME_STRS is
+/ not defined, a user defined volume string table needs to be defined as:
+/
+/ const char* VolumeStr[FF_VOLUMES] = {"ram","flash","sd","usb",...
+*/
#define FF_MULTI_PARTITION 0
@@ -213,19 +233,19 @@
/ buffer in the filesystem object (FATFS) is used for the file data transfer. */
-#define FF_FS_EXFAT 1
+#define FF_FS_EXFAT 1
/* This option switches support for exFAT filesystem. (0:Disable or 1:Enable)
/ When enable exFAT, also LFN needs to be enabled.
/ Note that enabling exFAT discards ANSI C (C89) compatibility. */
-#define FF_FS_NORTC 1
-#define FF_NORTC_MON 5
+#define FF_FS_NORTC 1
+#define FF_NORTC_MON 1
#define FF_NORTC_MDAY 1
-#define FF_NORTC_YEAR 2017
+#define FF_NORTC_YEAR 2018
/* The option FF_FS_NORTC switches timestamp functiton. If the system does not have
/ any RTC function or valid timestamp is not needed, set FF_FS_NORTC = 1 to disable
-/ the timestamp function. All objects modified by FatFs will have a fixed timestamp
+/ the timestamp function. Every object modified by FatFs will have a fixed timestamp
/ defined by FF_NORTC_MON, FF_NORTC_MDAY and FF_NORTC_YEAR in local time.
/ To enable timestamp function (FF_FS_NORTC = 0), get_fattime() function need to be
/ added to the project to read current time form real-time clock. FF_NORTC_MON,
@@ -245,9 +265,10 @@
/ lock control is independent of re-entrancy. */
-#define FF_FS_REENTRANT 0
-#define FF_FS_TIMEOUT MS2ST(1000)
-#define FF_SYNC_t semaphore_t*
+/* #include <somertos.h> // O/S definitions */
+#define FF_FS_REENTRANT 0
+#define FF_FS_TIMEOUT 1000
+#define FF_SYNC_t HANDLE
/* The option FF_FS_REENTRANT switches the re-entrancy (thread safe) of the FatFs
/ module itself. Note that regardless of this option, file access to different
/ volume is always re-entrant and volume control functions, f_mount(), f_mkfs()
@@ -265,8 +286,6 @@
/ SemaphoreHandle_t and etc. A header file for O/S definitions needs to be
/ included somewhere in the scope of ff.h. */
-/* #include <windows.h> // O/S definitions */
-
/*--- End of configuration options ---*/
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
index 24a2af7..8b5d823 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
+++ b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h
@@ -28,6 +28,9 @@
#ifndef HALCONF_H
#define HALCONF_H
+#define _CHIBIOS_HAL_CONF_
+#define _CHIBIOS_HAL_CONF_VER_7_1_
+
#include "mcuconf.h"
/**
@@ -41,7 +44,7 @@
* @brief Enables the ADC subsystem.
*/
#if !defined(HAL_USE_ADC) || defined(__DOXYGEN__)
-#define HAL_USE_ADC TRUE
+#define HAL_USE_ADC FALSE
#endif
/**
@@ -66,10 +69,10 @@
#endif
/**
- * @brief Enables the EXT subsystem.
+ * @brief Enables the EFlash subsystem.
*/
-#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__)
-#define HAL_USE_EXT FALSE
+#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__)
+#define HAL_USE_EFL FALSE
#endif
/**
@@ -122,13 +125,6 @@
#endif
/**
- * @brief Enables the QSPI subsystem.
- */
-#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__)
-#define HAL_USE_QSPI FALSE
-#endif
-
-/**
* @brief Enables the RTC subsystem.
*/
#if !defined(HAL_USE_RTC) || defined(__DOXYGEN__)
@@ -157,6 +153,13 @@
#endif
/**
+ * @brief Enables the SIO subsystem.
+ */
+#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__)
+#define HAL_USE_SIO FALSE
+#endif
+
+/**
* @brief Enables the SPI subsystem.
*/
#if !defined(HAL_USE_SPI) || defined(__DOXYGEN__)
@@ -164,6 +167,13 @@
#endif
/**
+ * @brief Enables the TRNG subsystem.
+ */
+#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__)
+#define HAL_USE_TRNG FALSE
+#endif
+
+/**
* @brief Enables the UART subsystem.
*/
#if !defined(HAL_USE_UART) || defined(__DOXYGEN__)
@@ -184,6 +194,33 @@
#define HAL_USE_WDG FALSE
#endif
+/**
+ * @brief Enables the WSPI subsystem.
+ */
+#if !defined(HAL_USE_WSPI) || defined(__DOXYGEN__)
+#define HAL_USE_WSPI FALSE
+#endif
+
+/*===========================================================================*/
+/* PAL driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define PAL_USE_CALLBACKS FALSE
+#endif
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(PAL_USE_WAIT) || defined(__DOXYGEN__)
+#define PAL_USE_WAIT FALSE
+#endif
+
/*===========================================================================*/
/* ADC driver related settings. */
/*===========================================================================*/
@@ -215,6 +252,13 @@
#define CAN_USE_SLEEP_MODE TRUE
#endif
+/**
+ * @brief Enforces the driver to use direct callbacks rather than OSAL events.
+ */
+#if !defined(CAN_ENFORCE_USE_CALLBACKS) || defined(__DOXYGEN__)
+#define CAN_ENFORCE_USE_CALLBACKS FALSE
+#endif
+
/*===========================================================================*/
/* CRY driver related settings. */
/*===========================================================================*/
@@ -238,6 +282,26 @@
#endif
/*===========================================================================*/
+/* DAC driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_WAIT) || defined(__DOXYGEN__)
+#define DAC_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p dacAcquireBus() and @p dacReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(DAC_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define DAC_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
+/*===========================================================================*/
/* I2C driver related settings. */
/*===========================================================================*/
@@ -253,7 +317,7 @@
/*===========================================================================*/
/**
- * @brief Enables an event sources for incoming packets.
+ * @brief Enables the zero-copy API.
*/
#if !defined(MAC_USE_ZERO_COPY) || defined(__DOXYGEN__)
#define MAC_USE_ZERO_COPY FALSE
@@ -313,6 +377,20 @@
#define SDC_NICE_WAITING TRUE
#endif
+/**
+ * @brief OCR initialization constant for V20 cards.
+ */
+#if !defined(SDC_INIT_OCR_V20) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR_V20 0x50FF8000U
+#endif
+
+/**
+ * @brief OCR initialization constant for non-V20 cards.
+ */
+#if !defined(SDC_INIT_OCR) || defined(__DOXYGEN__)
+#define SDC_INIT_OCR 0x80100000U
+#endif
+
/*===========================================================================*/
/* SERIAL driver related settings. */
/*===========================================================================*/
@@ -323,7 +401,7 @@
* default configuration.
*/
#if !defined(SERIAL_DEFAULT_BITRATE) || defined(__DOXYGEN__)
-#define SERIAL_DEFAULT_BITRATE 38400
+#define SERIAL_DEFAULT_BITRATE 115200
#endif
/**
@@ -334,7 +412,7 @@
* buffers.
*/
#if !defined(SERIAL_BUFFERS_SIZE) || defined(__DOXYGEN__)
-#define SERIAL_BUFFERS_SIZE 16
+#define SERIAL_BUFFERS_SIZE 64
#endif
/*===========================================================================*/
@@ -373,6 +451,14 @@
#endif
/**
+ * @brief Enables circular transfers APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_USE_CIRCULAR) || defined(__DOXYGEN__)
+#define SPI_USE_CIRCULAR FALSE
+#endif
+
+/**
* @brief Enables the @p spiAcquireBus() and @p spiReleaseBus() APIs.
* @note Disabling this option saves both code and data space.
*/
@@ -380,6 +466,14 @@
#define SPI_USE_MUTUAL_EXCLUSION TRUE
#endif
+/**
+ * @brief Handling method for SPI CS line.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(SPI_SELECT_MODE) || defined(__DOXYGEN__)
+#define SPI_SELECT_MODE SPI_SELECT_MODE_PAD
+#endif
+
/*===========================================================================*/
/* UART driver related settings. */
/*===========================================================================*/
@@ -412,6 +506,26 @@
#define USB_USE_WAIT FALSE
#endif
+/*===========================================================================*/
+/* WSPI driver related settings. */
+/*===========================================================================*/
+
+/**
+ * @brief Enables synchronous APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_WAIT) || defined(__DOXYGEN__)
+#define WSPI_USE_WAIT TRUE
+#endif
+
+/**
+ * @brief Enables the @p wspiAcquireBus() and @p wspiReleaseBus() APIs.
+ * @note Disabling this option saves both code and data space.
+ */
+#if !defined(WSPI_USE_MUTUAL_EXCLUSION) || defined(__DOXYGEN__)
+#define WSPI_USE_MUTUAL_EXCLUSION TRUE
+#endif
+
#include "halconf_community.h"
#endif /* HALCONF_H */
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/main.c b/testhal/STM32/STM32F4xx/USB_HOST/main.c
index c540233..c88880b 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_MSD_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_MSD_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_MSD_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_MSD_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((char *)fbuff, FATFSDEV_MSD_DRIVE);
scan_files(chp, (char *)fbuff);
}
}
diff --git a/testhal/STM32/STM32F4xx/USB_HOST/mcuconf.h b/testhal/STM32/STM32F4xx/USB_HOST/mcuconf.h
index 65258ff..242a0e3 100644
--- a/testhal/STM32/STM32F4xx/USB_HOST/mcuconf.h
+++ b/testhal/STM32/STM32F4xx/USB_HOST/mcuconf.h
@@ -32,11 +32,18 @@
*/
#define STM32F4xx_MCUCONF
+#define STM32F405_MCUCONF
+#define STM32F415_MCUCONF
+#define STM32F407_MCUCONF
+#define STM32F417_MCUCONF
/*
* HAL driver system settings.
*/
#define STM32_NO_INIT FALSE
+#define STM32_PVD_ENABLE FALSE
+#define STM32_PLS STM32_PLS_LEV0
+#define STM32_BKPRAM_ENABLE FALSE
#define STM32_HSI_ENABLED TRUE
#define STM32_LSI_ENABLED TRUE
#define STM32_HSE_ENABLED TRUE
@@ -60,9 +67,6 @@
#define STM32_I2SSRC STM32_I2SSRC_CKIN
#define STM32_PLLI2SN_VALUE 192
#define STM32_PLLI2SR_VALUE 5
-#define STM32_PVD_ENABLE FALSE
-#define STM32_PLS STM32_PLS_LEV0
-#define STM32_BKPRAM_ENABLE FALSE
/*
* IRQ system settings.
@@ -86,9 +90,9 @@
* ADC driver system settings.
*/
#define STM32_ADC_ADCPRE ADC_CCR_ADCPRE_DIV4
-#define STM32_ADC_USE_ADC1 TRUE
-#define STM32_ADC_USE_ADC2 TRUE
-#define STM32_ADC_USE_ADC3 TRUE
+#define STM32_ADC_USE_ADC1 FALSE
+#define STM32_ADC_USE_ADC2 FALSE
+#define STM32_ADC_USE_ADC3 FALSE
#define STM32_ADC_ADC1_DMA_STREAM STM32_DMA_STREAM_ID(2, 4)
#define STM32_ADC_ADC2_DMA_STREAM STM32_DMA_STREAM_ID(2, 2)
#define STM32_ADC_ADC3_DMA_STREAM STM32_DMA_STREAM_ID(2, 1)
@@ -234,6 +238,14 @@
#define STM32_PWM_TIM9_IRQ_PRIORITY 7
/*
+ * RTC driver system settings.
+ */
+#define STM32_RTC_PRESA_VALUE 32
+#define STM32_RTC_PRESS_VALUE 1024
+#define STM32_RTC_CR_INIT 0
+#define STM32_RTC_TAMPCR_INIT 0
+
+/*
* SDC driver system settings.
*/
#define STM32_SDC_SDIO_DMA_PRIORITY 3
@@ -330,9 +342,7 @@
#define STM32_USB_OTG2_IRQ_PRIORITY 14
#define STM32_USB_OTG1_RX_FIFO_SIZE 512
#define STM32_USB_OTG2_RX_FIFO_SIZE 1024
-#define STM32_USB_OTG_THREAD_PRIO LOWPRIO
-#define STM32_USB_OTG_THREAD_STACK_SIZE 128
-#define STM32_USB_OTGFIFO_FILL_BASEPRI 0
+#define STM32_USB_HOST_WAKEUP_DURATION 2
/*
* WDG driver system settings.