From 2644acd83a14e8652e30d65ac934d95992175ea0 Mon Sep 17 00:00:00 2001 From: Diego Ismirlian Date: Tue, 1 Oct 2019 09:18:18 -0300 Subject: USBH: testhal: fix compile with ChibiOS 18.2 --- testhal/STM32/STM32F4xx/USB_HOST/Makefile | 6 +- testhal/STM32/STM32F4xx/USB_HOST/chconf.h | 26 +----- testhal/STM32/STM32F4xx/USB_HOST/halconf.h | 134 +++-------------------------- 3 files changed, 16 insertions(+), 150 deletions(-) diff --git a/testhal/STM32/STM32F4xx/USB_HOST/Makefile b/testhal/STM32/STM32F4xx/USB_HOST/Makefile index 54c23ca..e38a6e5 100644 --- a/testhal/STM32/STM32F4xx/USB_HOST/Makefile +++ b/testhal/STM32/STM32F4xx/USB_HOST/Makefile @@ -97,7 +97,7 @@ 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-nil/osal.mk +include $(CHIBIOS)/os/hal/osal/rt/osal.mk # RTOS files (optional). include $(CHIBIOS)/os/rt/rt.mk include $(CHIBIOS)/os/common/ports/ARMCMx/compilers/GCC/mk/port_v7m.mk @@ -216,6 +216,6 @@ ULIBS = # End of user defines ############################################################################## -RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC/mk -include $(RULESPATH)/arm-none-eabi.mk +RULESPATH = $(CHIBIOS)/os/common/startup/ARMCMx/compilers/GCC +#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 40612ff..0788ce6 100644 --- a/testhal/STM32/STM32F4xx/USB_HOST/chconf.h +++ b/testhal/STM32/STM32F4xx/USB_HOST/chconf.h @@ -15,7 +15,7 @@ */ /** - * @file rt/templates/chconf.h + * @file 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_6_1_ +#define _CHIBIOS_RT_CONF_VER_5_1_ /*===========================================================================*/ /** @@ -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. * @@ -370,17 +370,6 @@ #define CH_CFG_USE_OBJ_FIFOS TRUE #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 @@ -458,13 +447,6 @@ #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 - /** @} */ /*===========================================================================*/ @@ -692,8 +674,6 @@ */ #define CH_CFG_SYSTEM_HALT_HOOK(reason) { \ /* System halt code here.*/ \ - void usbDbgSystemHalted(void); \ - usbDbgSystemHalted(); \ } /** diff --git a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h index 8b5d823..7096a3b 100644 --- a/testhal/STM32/STM32F4xx/USB_HOST/halconf.h +++ b/testhal/STM32/STM32F4xx/USB_HOST/halconf.h @@ -28,9 +28,6 @@ #ifndef HALCONF_H #define HALCONF_H -#define _CHIBIOS_HAL_CONF_ -#define _CHIBIOS_HAL_CONF_VER_7_1_ - #include "mcuconf.h" /** @@ -69,10 +66,10 @@ #endif /** - * @brief Enables the EFlash subsystem. + * @brief Enables the EXT subsystem. */ -#if !defined(HAL_USE_EFL) || defined(__DOXYGEN__) -#define HAL_USE_EFL FALSE +#if !defined(HAL_USE_EXT) || defined(__DOXYGEN__) +#define HAL_USE_EXT FALSE #endif /** @@ -124,6 +121,13 @@ #define HAL_USE_PWM FALSE #endif +/** + * @brief Enables the QSPI subsystem. + */ +#if !defined(HAL_USE_QSPI) || defined(__DOXYGEN__) +#define HAL_USE_QSPI FALSE +#endif + /** * @brief Enables the RTC subsystem. */ @@ -152,13 +156,6 @@ #define HAL_USE_SERIAL_USB FALSE #endif -/** - * @brief Enables the SIO subsystem. - */ -#if !defined(HAL_USE_SIO) || defined(__DOXYGEN__) -#define HAL_USE_SIO FALSE -#endif - /** * @brief Enables the SPI subsystem. */ @@ -166,13 +163,6 @@ #define HAL_USE_SPI FALSE #endif -/** - * @brief Enables the TRNG subsystem. - */ -#if !defined(HAL_USE_TRNG) || defined(__DOXYGEN__) -#define HAL_USE_TRNG FALSE -#endif - /** * @brief Enables the UART subsystem. */ @@ -194,33 +184,6 @@ #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. */ /*===========================================================================*/ @@ -252,13 +215,6 @@ #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. */ /*===========================================================================*/ @@ -281,26 +237,6 @@ #define HAL_CRY_ENFORCE_FALLBACK FALSE #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. */ /*===========================================================================*/ @@ -377,20 +313,6 @@ #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. */ /*===========================================================================*/ @@ -450,14 +372,6 @@ #define SPI_USE_WAIT TRUE #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. @@ -466,14 +380,6 @@ #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. */ /*===========================================================================*/ @@ -506,26 +412,6 @@ #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 */ -- cgit v1.2.3 From d685cfd0c27252b77fe3cb5416d3921f37033e81 Mon Sep 17 00:00:00 2001 From: Diego Ismirlian Date: Tue, 1 Oct 2019 09:27:51 -0300 Subject: USBH: testhal: fix compile with FATFS 0.13 --- testhal/STM32/STM32F4xx/USB_HOST/ffconf.h | 89 ++++++++++++------------------- 1 file changed, 35 insertions(+), 54 deletions(-) diff --git a/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h b/testhal/STM32/STM32F4xx/USB_HOST/ffconf.h index c3530a5..944ffde 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 Functional Configurations +/ FatFs - Configuration file /---------------------------------------------------------------------------*/ -#define FFCONF_DEF 86604 /* Revision ID */ +#define FFCONF_DEF 87030 /* 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: Basic functions are fully enabled. +/ 0: All basic functions are 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 437 +#define FF_CODE_PAGE 850 /* 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,47 +109,32 @@ / 2: Enable LFN with dynamic working buffer on the STACK. / 3: Enable LFN with dynamic working buffer on the HEAP. / -/ 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. +/ 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. / 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() in ffsystem.c, need to be added to the project. */ +/ ff_memfree(), must be added to the project. */ #define FF_LFN_UNICODE 0 -/* 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. */ +/* 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. +*/ #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 in current CP -/ 1: Unicode in UTF-16LE -/ 2: Unicode in UTF-16BE -/ 3: Unicode in UTF-8 +/ 0: ANSI/OEM +/ 1: UTF-16LE +/ 2: UTF-16BE +/ 3: UTF-8 */ @@ -172,16 +157,11 @@ #define FF_STR_VOLUME_ID 0 #define FF_VOLUME_STRS "RAM","NAND","CF","SD","SD2","USB","USB2","USB3" -/* 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",... -*/ +/* 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. */ #define FF_MULTI_PARTITION 0 @@ -233,19 +213,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 1 +#define FF_FS_NORTC 1 +#define FF_NORTC_MON 5 #define FF_NORTC_MDAY 1 -#define FF_NORTC_YEAR 2018 +#define FF_NORTC_YEAR 2017 /* 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. Every object modified by FatFs will have a fixed timestamp +/ the timestamp function. All objects 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, @@ -265,10 +245,9 @@ / lock control is independent of re-entrancy. */ -/* #include // O/S definitions */ -#define FF_FS_REENTRANT 0 -#define FF_FS_TIMEOUT 1000 -#define FF_SYNC_t HANDLE +#define FF_FS_REENTRANT 0 +#define FF_FS_TIMEOUT MS2ST(1000) +#define FF_SYNC_t semaphore_t* /* 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() @@ -286,6 +265,8 @@ / SemaphoreHandle_t and etc. A header file for O/S definitions needs to be / included somewhere in the scope of ff.h. */ +/* #include // O/S definitions */ + /*--- End of configuration options ---*/ -- cgit v1.2.3