├── .gitignore ├── .gitmodules ├── CMakeLists.txt ├── Makefile ├── cmsis ├── arm_math.h ├── core_cm4.h ├── core_cm4_simd.h ├── core_cmFunc.h ├── core_cmInstr.h ├── stm32f401xc.h ├── stm32f401xe.h ├── stm32f405xx.h ├── stm32f407xx.h ├── stm32f415xx.h ├── stm32f417xx.h ├── stm32f427xx.h ├── stm32f429xx.h ├── stm32f437xx.h ├── stm32f439xx.h ├── stm32f4xx.h └── system_stm32f4xx.h ├── config.h ├── hw_init.c ├── hw_init.h ├── main.c ├── startup.S ├── stm ├── lcd_utils │ ├── font12.c │ ├── font16.c │ ├── font20.c │ ├── font24.c │ ├── font8.c │ ├── fonts.h │ ├── lcd_log.c │ ├── lcd_log.h │ └── lcd_log_conf.h ├── stm32f429 │ ├── ili9341.c │ ├── ili9341.h │ ├── lcd.h │ ├── stm32f429i_discovery.c │ ├── stm32f429i_discovery.h │ ├── stm32f429i_discovery_lcd.c │ ├── stm32f429i_discovery_lcd.h │ ├── stm32f429i_discovery_sdram.c │ └── stm32f429i_discovery_sdram.h ├── stm32f4_spl │ ├── inc │ │ ├── stm32f4xx_hal.h │ │ ├── stm32f4xx_hal_adc.h │ │ ├── stm32f4xx_hal_adc_ex.h │ │ ├── stm32f4xx_hal_can.h │ │ ├── stm32f4xx_hal_conf_template.h │ │ ├── stm32f4xx_hal_cortex.h │ │ ├── stm32f4xx_hal_crc.h │ │ ├── stm32f4xx_hal_cryp.h │ │ ├── stm32f4xx_hal_cryp_ex.h │ │ ├── stm32f4xx_hal_dac.h │ │ ├── stm32f4xx_hal_dac_ex.h │ │ ├── stm32f4xx_hal_dcmi.h │ │ ├── stm32f4xx_hal_def.h │ │ ├── stm32f4xx_hal_dma.h │ │ ├── stm32f4xx_hal_dma2d.h │ │ ├── stm32f4xx_hal_dma_ex.h │ │ ├── stm32f4xx_hal_eth.h │ │ ├── stm32f4xx_hal_flash.h │ │ ├── stm32f4xx_hal_flash_ex.h │ │ ├── stm32f4xx_hal_gpio.h │ │ ├── stm32f4xx_hal_gpio_ex.h │ │ ├── stm32f4xx_hal_hash.h │ │ ├── stm32f4xx_hal_hash_ex.h │ │ ├── stm32f4xx_hal_hcd.h │ │ ├── stm32f4xx_hal_i2c.h │ │ ├── stm32f4xx_hal_i2c_ex.h │ │ ├── stm32f4xx_hal_i2s.h │ │ ├── stm32f4xx_hal_i2s_ex.h │ │ ├── stm32f4xx_hal_irda.h │ │ ├── stm32f4xx_hal_iwdg.h │ │ ├── stm32f4xx_hal_ltdc.h │ │ ├── stm32f4xx_hal_nand.h │ │ ├── stm32f4xx_hal_nor.h │ │ ├── stm32f4xx_hal_pccard.h │ │ ├── stm32f4xx_hal_pcd.h │ │ ├── stm32f4xx_hal_pwr.h │ │ ├── stm32f4xx_hal_pwr_ex.h │ │ ├── stm32f4xx_hal_rcc.h │ │ ├── stm32f4xx_hal_rcc_ex.h │ │ ├── stm32f4xx_hal_rng.h │ │ ├── stm32f4xx_hal_rtc.h │ │ ├── stm32f4xx_hal_rtc_ex.h │ │ ├── stm32f4xx_hal_sai.h │ │ ├── stm32f4xx_hal_sd.h │ │ ├── stm32f4xx_hal_sdram.h │ │ ├── stm32f4xx_hal_smartcard.h │ │ ├── stm32f4xx_hal_spi.h │ │ ├── stm32f4xx_hal_sram.h │ │ ├── stm32f4xx_hal_tim.h │ │ ├── stm32f4xx_hal_tim_ex.h │ │ ├── stm32f4xx_hal_uart.h │ │ ├── stm32f4xx_hal_usart.h │ │ ├── stm32f4xx_hal_wwdg.h │ │ ├── stm32f4xx_ll_fmc.h │ │ ├── stm32f4xx_ll_fsmc.h │ │ ├── stm32f4xx_ll_sdmmc.h │ │ └── stm32f4xx_ll_usb.h │ └── src │ │ ├── stm32f4xx_hal.c │ │ ├── stm32f4xx_hal_adc.c │ │ ├── stm32f4xx_hal_adc_ex.c │ │ ├── stm32f4xx_hal_can.c │ │ ├── stm32f4xx_hal_cortex.c │ │ ├── stm32f4xx_hal_crc.c │ │ ├── stm32f4xx_hal_cryp.c │ │ ├── stm32f4xx_hal_cryp_ex.c │ │ ├── stm32f4xx_hal_dac.c │ │ ├── stm32f4xx_hal_dac_ex.c │ │ ├── stm32f4xx_hal_dcmi.c │ │ ├── stm32f4xx_hal_dma.c │ │ ├── stm32f4xx_hal_dma2d.c │ │ ├── stm32f4xx_hal_dma_ex.c │ │ ├── stm32f4xx_hal_eth.c │ │ ├── stm32f4xx_hal_flash.c │ │ ├── stm32f4xx_hal_flash_ex.c │ │ ├── stm32f4xx_hal_gpio.c │ │ ├── stm32f4xx_hal_hash.c │ │ ├── stm32f4xx_hal_hash_ex.c │ │ ├── stm32f4xx_hal_hcd.c │ │ ├── stm32f4xx_hal_i2c.c │ │ ├── stm32f4xx_hal_i2c_ex.c │ │ ├── stm32f4xx_hal_i2s.c │ │ ├── stm32f4xx_hal_i2s_ex.c │ │ ├── stm32f4xx_hal_irda.c │ │ ├── stm32f4xx_hal_iwdg.c │ │ ├── stm32f4xx_hal_ltdc.c │ │ ├── stm32f4xx_hal_msp_template.c │ │ ├── stm32f4xx_hal_nand.c │ │ ├── stm32f4xx_hal_nor.c │ │ ├── stm32f4xx_hal_pccard.c │ │ ├── stm32f4xx_hal_pcd.c │ │ ├── stm32f4xx_hal_pwr.c │ │ ├── stm32f4xx_hal_pwr_ex.c │ │ ├── stm32f4xx_hal_rcc.c │ │ ├── stm32f4xx_hal_rcc_ex.c │ │ ├── stm32f4xx_hal_rng.c │ │ ├── stm32f4xx_hal_rtc.c │ │ ├── stm32f4xx_hal_rtc_ex.c │ │ ├── stm32f4xx_hal_sai.c │ │ ├── stm32f4xx_hal_sd.c │ │ ├── stm32f4xx_hal_sdram.c │ │ ├── stm32f4xx_hal_smartcard.c │ │ ├── stm32f4xx_hal_spi.c │ │ ├── stm32f4xx_hal_sram.c │ │ ├── stm32f4xx_hal_tim.c │ │ ├── stm32f4xx_hal_tim_ex.c │ │ ├── stm32f4xx_hal_uart.c │ │ ├── stm32f4xx_hal_usart.c │ │ ├── stm32f4xx_hal_wwdg.c │ │ ├── stm32f4xx_ll_fmc.c │ │ ├── stm32f4xx_ll_fsmc.c │ │ ├── stm32f4xx_ll_sdmmc.c │ │ └── stm32f4xx_ll_usb.c ├── usb_host │ ├── Class │ │ └── MSC │ │ │ ├── inc │ │ │ ├── usbh_msc.h │ │ │ ├── usbh_msc_bot.h │ │ │ └── usbh_msc_scsi.h │ │ │ └── src │ │ │ ├── usbh_msc.c │ │ │ ├── usbh_msc_bot.c │ │ │ └── usbh_msc_scsi.c │ └── Core │ │ ├── inc │ │ ├── usbh_core.h │ │ ├── usbh_ctlreq.h │ │ ├── usbh_def.h │ │ ├── usbh_ioreq.h │ │ └── usbh_pipes.h │ │ └── src │ │ ├── usbh_core.c │ │ ├── usbh_ctlreq.c │ │ ├── usbh_ioreq.c │ │ └── usbh_pipes.c └── usb_user │ ├── stm32f4xx_hal_conf.h │ ├── stm32f4xx_it.c │ ├── stm32f4xx_it.h │ ├── usbh_conf.c │ └── usbh_conf.h ├── stm32f429.ld ├── syscalls.c ├── system_stm32f4xx.c ├── usb_msc_lwext4.c ├── usb_msc_lwext4.h └── vectors.c /.gitignore: -------------------------------------------------------------------------------- 1 | build_*/ 2 | 3 | .cproject 4 | .project 5 | .settings/ 6 | -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "lwext4"] 2 | path = lwext4 3 | url = https://github.com/gkostka/lwext4 4 | -------------------------------------------------------------------------------- /CMakeLists.txt: -------------------------------------------------------------------------------- 1 | project(stm32f429-lwext4 C) 2 | cmake_minimum_required(VERSION 2.8) 3 | 4 | #Discoery disco demo 5 | enable_language(ASM) 6 | set (STM32F429_DEMO_ASM 7 | startup.S 8 | ) 9 | 10 | add_subdirectory(lwext4) 11 | include_directories(lwext4/include) 12 | include_directories(lwext4/fs_test/common) 13 | include_directories(${PROJECT_BINARY_DIR}/lwext4/include) 14 | 15 | include_directories(.) 16 | include_directories(cmsis) 17 | include_directories(stm/lcd_utils) 18 | include_directories(stm/stm32f4_spl/inc) 19 | include_directories(stm/stm32f429) 20 | include_directories(stm/usb_host/Core/inc) 21 | include_directories(stm/usb_host/Class/MSC/inc) 22 | include_directories(stm/usb_otg/inc) 23 | include_directories(stm/usb_user) 24 | 25 | aux_source_directory(lwext4/fs_test/common STM32F429_DEMO) 26 | aux_source_directory(. STM32F429_DEMO) 27 | aux_source_directory(cmsis STM32F429_DEMO) 28 | aux_source_directory(stm/lcd_utils STM32F429_DEMO) 29 | aux_source_directory(stm/stm32f4_spl/src STM32F429_DEMO) 30 | aux_source_directory(stm/stm32f429 STM32F429_DEMO) 31 | aux_source_directory(stm/usb_host/Core/src STM32F429_DEMO) 32 | aux_source_directory(stm/usb_host/Class/MSC/src STM32F429_DEMO) 33 | aux_source_directory(stm/usb_otg/src STM32F429_DEMO) 34 | aux_source_directory(stm/usb_user STM32F429_DEMO) 35 | add_executable(stm32f429_demo ${STM32F429_DEMO} ${STM32F429_DEMO_ASM}) 36 | 37 | add_definitions(-DSTM32F429xx) 38 | 39 | set_target_properties(stm32f429_demo PROPERTIES COMPILE_FLAGS "-Wno-unused-parameter") 40 | set_target_properties(stm32f429_demo PROPERTIES COMPILE_FLAGS "-Wno-format") 41 | set_target_properties(stm32f429_demo PROPERTIES COMPILE_DEFINITIONS "STM32F429_439xx") 42 | 43 | set_target_properties(stm32f429_demo PROPERTIES LINK_FLAGS "-T${CMAKE_SOURCE_DIR}/stm32f429.ld") 44 | target_link_libraries(stm32f429_demo blockdev) 45 | target_link_libraries(stm32f429_demo lwext4) 46 | 47 | add_custom_target(stm32f429_size ALL DEPENDS stm32f429_demo COMMAND ${SIZE} -B stm32f429_demo) 48 | add_custom_target(stm32f429_bin ALL DEPENDS stm32f429_demo COMMAND ${OBJCOPY} -O binary stm32f429_demo stm32f429_demo.bin) 49 | -------------------------------------------------------------------------------- /Makefile: -------------------------------------------------------------------------------- 1 | 2 | BUILD_TYPE = Release 3 | PROJECT_SETUP = "Unix Makefiles" 4 | 5 | stm32f429disco: 6 | rm -R -f build_stm32f429disco 7 | mkdir build_stm32f429disco 8 | cd build_stm32f429disco && cmake -G$(PROJECT_SETUP) -DCMAKE_BUILD_TYPE=$(BUILD_TYPE) -DCMAKE_TOOLCHAIN_FILE=../lwext4/toolchain/cortex-m4.cmake .. 9 | 10 | 11 | clean: 12 | rm -R -f build_* 13 | rm -R -f ext_images -------------------------------------------------------------------------------- /cmsis/stm32f401xc.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f401xc.h -------------------------------------------------------------------------------- /cmsis/stm32f401xe.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f401xe.h -------------------------------------------------------------------------------- /cmsis/stm32f405xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f405xx.h -------------------------------------------------------------------------------- /cmsis/stm32f407xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f407xx.h -------------------------------------------------------------------------------- /cmsis/stm32f415xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f415xx.h -------------------------------------------------------------------------------- /cmsis/stm32f417xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f417xx.h -------------------------------------------------------------------------------- /cmsis/stm32f427xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f427xx.h -------------------------------------------------------------------------------- /cmsis/stm32f429xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f429xx.h -------------------------------------------------------------------------------- /cmsis/stm32f437xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f437xx.h -------------------------------------------------------------------------------- /cmsis/stm32f439xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f439xx.h -------------------------------------------------------------------------------- /cmsis/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/cmsis/stm32f4xx.h -------------------------------------------------------------------------------- /cmsis/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.3.0 6 | * @date 08-November-2013 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2013 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /** @addtogroup CMSIS 29 | * @{ 30 | */ 31 | 32 | /** @addtogroup stm32f4xx_system 33 | * @{ 34 | */ 35 | 36 | /** 37 | * @brief Define to prevent recursive inclusion 38 | */ 39 | #ifndef __SYSTEM_STM32F4XX_H 40 | #define __SYSTEM_STM32F4XX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /** @addtogroup STM32F4xx_System_Includes 47 | * @{ 48 | */ 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @addtogroup STM32F4xx_System_Exported_types 56 | * @{ 57 | */ 58 | 59 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 60 | 61 | 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @addtogroup STM32F4xx_System_Exported_Constants 67 | * @{ 68 | */ 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @addtogroup STM32F4xx_System_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @addtogroup STM32F4xx_System_Exported_Functions 83 | * @{ 84 | */ 85 | 86 | extern void SystemInit(void); 87 | extern void SystemCoreClockUpdate(void); 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /*__SYSTEM_STM32F4XX_H */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /config.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef CONFIG_H_ 30 | #define CONFIG_H_ 31 | 32 | /**@brief Main clock frequency.*/ 33 | #define CFG_CCLK_FREQ 168000000ul 34 | 35 | #endif /* CONFIG_H_ */ 36 | -------------------------------------------------------------------------------- /hw_init.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | 35 | #include 36 | #include 37 | 38 | #include 39 | #include 40 | 41 | USBH_HandleTypeDef hUSB_Host; 42 | 43 | static bool msc_connected = false; 44 | static bool enum_done = false; 45 | 46 | static void USBH_UserProcess(USBH_HandleTypeDef *phost, uint8_t id) 47 | { 48 | switch (id) { 49 | case HOST_USER_SELECT_CONFIGURATION: 50 | break; 51 | 52 | case HOST_USER_DISCONNECTION: 53 | msc_connected = false; 54 | enum_done = false; 55 | break; 56 | 57 | case HOST_USER_CLASS_ACTIVE: 58 | enum_done = true; 59 | break; 60 | 61 | case HOST_USER_CONNECTION: 62 | msc_connected = true; 63 | break; 64 | default: 65 | break; 66 | } 67 | } 68 | 69 | #define LCD_FRAME_BUFFER_LAYER0 (LCD_FRAME_BUFFER + 0x130000) 70 | #define LCD_FRAME_BUFFER_LAYER1 LCD_FRAME_BUFFER 71 | #define CONVERTED_FRAME_BUFFER (LCD_FRAME_BUFFER + 0x260000) 72 | 73 | static void SystemClock_Config(void) 74 | { 75 | RCC_ClkInitTypeDef RCC_ClkInitStruct; 76 | RCC_OscInitTypeDef RCC_OscInitStruct; 77 | 78 | /* Enable Power Control clock */ 79 | __PWR_CLK_ENABLE(); 80 | 81 | /* The voltage scaling allows optimizing the power consumption when the 82 | device is 83 | clocked below the maximum system frequency, to update the voltage 84 | scaling value 85 | regarding system frequency refer to product datasheet. */ 86 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); 87 | 88 | /* Enable HSE Oscillator and activate PLL with HSE as source */ 89 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; 90 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; 91 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 92 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 93 | RCC_OscInitStruct.PLL.PLLM = 8; 94 | RCC_OscInitStruct.PLL.PLLN = 336; 95 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; 96 | RCC_OscInitStruct.PLL.PLLQ = 7; 97 | HAL_RCC_OscConfig(&RCC_OscInitStruct); 98 | 99 | /* Select PLL as system clock source and configure the HCLK, PCLK1 and 100 | PCLK2 101 | clocks dividers */ 102 | RCC_ClkInitStruct.ClockType = 103 | (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK | RCC_CLOCKTYPE_PCLK1 | 104 | RCC_CLOCKTYPE_PCLK2); 105 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 106 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 107 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; 108 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; 109 | HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5); 110 | } 111 | 112 | void hw_init(void) 113 | { 114 | SystemInit(); 115 | HAL_Init(); 116 | SystemClock_Config(); 117 | 118 | /* Initialize the LEDs */ 119 | BSP_LED_Init(LED3); 120 | BSP_LED_Init(LED4); 121 | 122 | SysTick_Config(CFG_CCLK_FREQ / 1000); 123 | 124 | USBH_Init(&hUSB_Host, USBH_UserProcess, 0); 125 | USBH_RegisterClass(&hUSB_Host, USBH_MSC_CLASS); 126 | USBH_Start(&hUSB_Host); 127 | 128 | BSP_LCD_Init(); 129 | 130 | /* Layer2 Init */ 131 | BSP_LCD_LayerDefaultInit(1, LCD_FRAME_BUFFER_LAYER1); 132 | BSP_LCD_SelectLayer(1); 133 | BSP_LCD_Clear(LCD_COLOR_WHITE); 134 | BSP_LCD_SetColorKeying(1, LCD_COLOR_WHITE); 135 | BSP_LCD_SetLayerVisible(1, DISABLE); 136 | 137 | /* Layer1 Init */ 138 | BSP_LCD_LayerDefaultInit(0, LCD_FRAME_BUFFER_LAYER0); 139 | BSP_LCD_SelectLayer(0); 140 | BSP_LCD_DisplayOn(); 141 | BSP_LCD_Clear(LCD_COLOR_BLACK); 142 | 143 | LCD_LOG_Init(); 144 | LCD_LOG_SetHeader((uint8_t *)"STM32 LWEXT4 DEMO "); 145 | } 146 | 147 | void hw_usb_process(void) { USBH_Process(&hUSB_Host); } 148 | 149 | bool hw_usb_connected(void) { return msc_connected; } 150 | 151 | bool hw_usb_enum_done(void) { return enum_done; } 152 | 153 | void hw_led_red(bool on) { on ? BSP_LED_On(LED4) : BSP_LED_Off(LED4); } 154 | 155 | void hw_led_green(bool on) { on ? BSP_LED_On(LED3) : BSP_LED_Off(LED3); } 156 | 157 | uint32_t tim_get_ms(void) { return HAL_GetTick(); } 158 | 159 | uint64_t tim_get_us(void) 160 | { 161 | return (uint64_t)HAL_GetTick() * 1000 + 162 | ((SysTick->LOAD - SysTick->VAL) * 1000) / SysTick->LOAD; 163 | } 164 | 165 | void tim_wait_ms(uint32_t ms) 166 | { 167 | volatile uint32_t t = HAL_GetTick(); 168 | 169 | while ((t + ms) > HAL_GetTick()) 170 | ; 171 | } 172 | -------------------------------------------------------------------------------- /hw_init.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #ifndef HW_INIT_H_ 30 | #define HW_INIT_H_ 31 | 32 | #include 33 | #include 34 | #include 35 | 36 | void hw_init(void); 37 | void hw_usb_process(void); 38 | bool hw_usb_connected(void); 39 | bool hw_usb_enum_done(void); 40 | 41 | void hw_led_red(bool on); 42 | void hw_led_green(bool on); 43 | 44 | uint32_t tim_get_ms(void); 45 | uint64_t tim_get_us(void); 46 | void tim_wait_ms(uint32_t ms); 47 | 48 | #endif /* HW_INIT_H_ */ 49 | -------------------------------------------------------------------------------- /main.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | #include 31 | 32 | #include 33 | #include 34 | #include 35 | #include 36 | #include 37 | #include 38 | #include 39 | #include 40 | #include 41 | 42 | #include 43 | #include 44 | #include 45 | #include "test_lwext4.h" 46 | 47 | /**@brief Read-write size*/ 48 | #define READ_WRITE_SZIZE 1024 * 16 49 | 50 | /**@brief Delay test (slower LCD scroll)*/ 51 | #define TEST_DELAY_MS 1000 52 | 53 | /**@brief Input stream name.*/ 54 | char input_name[128] = "ext2"; 55 | 56 | /**@brief Read-write size*/ 57 | static int rw_szie = READ_WRITE_SZIZE; 58 | 59 | /**@brief Read-write buffer*/ 60 | static uint8_t rw_buff[READ_WRITE_SZIZE]; 61 | 62 | /**@brief Read-write size*/ 63 | static int rw_count = 100; 64 | 65 | /**@brief Directory test count*/ 66 | static int dir_cnt = 100; 67 | 68 | /**@brief Static or dynamic cache mode*/ 69 | static bool cache_mode = false; 70 | 71 | /**@brief Cleanup after test.*/ 72 | static bool cleanup_flag = false; 73 | 74 | /**@brief Block device stats.*/ 75 | static bool bstat = false; 76 | 77 | /**@brief Superblock stats.*/ 78 | static bool sbstat = false; 79 | 80 | /**@brief Block device handle.*/ 81 | static struct ext4_blockdev *parent_blockdev; 82 | 83 | /**@brief MBR blockdevices.*/ 84 | static struct ext4_mbr_bdevs bdevs; 85 | 86 | /**@brief Block cache handle.*/ 87 | static struct ext4_bcache *bc; 88 | 89 | static bool open_filedev(void) 90 | { 91 | parent_blockdev = ext4_usb_msc_get(); 92 | if (!parent_blockdev) { 93 | printf("open_filedev: fail\n"); 94 | return false; 95 | } 96 | return true; 97 | } 98 | 99 | static bool mbr_scan(void) 100 | { 101 | int r; 102 | printf("ext4_mbr\n"); 103 | r = ext4_mbr_scan(parent_blockdev, &bdevs); 104 | if (r != EOK) { 105 | printf("ext4_mbr_scan error\n"); 106 | return false; 107 | } 108 | 109 | int i; 110 | printf("ext4_mbr_scan:\n"); 111 | for (i = 0; i < 4; i++) { 112 | printf("mbr_entry %d:\n", i); 113 | if (!bdevs.partitions[i].bdif) { 114 | printf("\tempty/unknown\n"); 115 | continue; 116 | } 117 | 118 | printf(" offeset: 0x%"PRIx64", %"PRIu64"MB\n", 119 | bdevs.partitions[i].part_offset, 120 | bdevs.partitions[i].part_offset / (1024 * 1024)); 121 | printf(" size: 0x%"PRIx64", %"PRIu64"MB\n", 122 | bdevs.partitions[i].part_size, 123 | bdevs.partitions[i].part_size / (1024 * 1024)); 124 | 125 | 126 | } 127 | 128 | return true; 129 | } 130 | 131 | static bool do_tests(struct ext4_blockdev *part_blockdev) 132 | { 133 | tim_wait_ms(TEST_DELAY_MS); 134 | if (!test_lwext4_mount(part_blockdev, bc)) 135 | return false; 136 | 137 | tim_wait_ms(TEST_DELAY_MS); 138 | 139 | ext4_cache_write_back("/mp/", 1); 140 | test_lwext4_cleanup(); 141 | 142 | if (sbstat) { 143 | tim_wait_ms(TEST_DELAY_MS); 144 | test_lwext4_mp_stats(); 145 | } 146 | 147 | tim_wait_ms(TEST_DELAY_MS); 148 | test_lwext4_dir_ls("/mp/"); 149 | if (!test_lwext4_dir_test(dir_cnt)) 150 | return false; 151 | 152 | tim_wait_ms(TEST_DELAY_MS); 153 | if (!test_lwext4_file_test(rw_buff, rw_szie, rw_count)) 154 | return false; 155 | 156 | if (sbstat) { 157 | tim_wait_ms(TEST_DELAY_MS); 158 | test_lwext4_mp_stats(); 159 | } 160 | 161 | if (cleanup_flag) { 162 | tim_wait_ms(TEST_DELAY_MS); 163 | test_lwext4_cleanup(); 164 | } 165 | 166 | if (bstat) { 167 | tim_wait_ms(TEST_DELAY_MS); 168 | test_lwext4_block_stats(); 169 | } 170 | 171 | ext4_cache_write_back("/mp/", 0); 172 | if (!test_lwext4_umount()) 173 | return false; 174 | 175 | return true; 176 | } 177 | 178 | 179 | int main(void) 180 | { 181 | int i; 182 | hw_init(); 183 | 184 | setbuf(stdout, 0); 185 | printf("connect usb drive...\n"); 186 | 187 | while (!hw_usb_connected()) 188 | hw_usb_process(); 189 | printf("usb drive connected\n"); 190 | 191 | while (!hw_usb_enum_done()) 192 | hw_usb_process(); 193 | printf("usb drive enum done\n"); 194 | 195 | hw_led_red(1); 196 | 197 | printf("test conditions:\n"); 198 | printf(" rw size: %d\n", rw_szie); 199 | printf(" rw count: %d\n", rw_count); 200 | printf(" cache mode: %s\n", cache_mode ? "dynamic" : "static"); 201 | 202 | if (!open_filedev()) 203 | goto Finish; 204 | if (!mbr_scan()) 205 | goto Finish; 206 | 207 | /*Execute tests for every scaned partition.*/ 208 | for (i = 0; i < 4; i++) { 209 | if (!bdevs.partitions[i].bdif) 210 | continue; 211 | 212 | printf("do tests for mbr_entry %d:\n", i); 213 | printf(" offeset: 0x%"PRIx64", %"PRIu64"MB\n", 214 | bdevs.partitions[i].part_offset, 215 | bdevs.partitions[i].part_offset / (1024 * 1024)); 216 | printf(" size: 0x%"PRIx64", %"PRIu64"MB\n", 217 | bdevs.partitions[i].part_size, 218 | bdevs.partitions[i].part_size / (1024 * 1024)); 219 | 220 | tim_wait_ms(TEST_DELAY_MS); 221 | if (!do_tests(&bdevs.partitions[i])) 222 | goto Finish; 223 | } 224 | 225 | printf("press RESET button to restart\n"); 226 | Finish: 227 | while (1) { 228 | tim_wait_ms(500); 229 | hw_led_green(1); 230 | tim_wait_ms(500); 231 | hw_led_green(0); 232 | } 233 | } 234 | -------------------------------------------------------------------------------- /startup.S: -------------------------------------------------------------------------------- 1 | /****************************************************************************** 2 | * author: Freddie Chopin, http://www.freddiechopin.info/ 3 | * file: startup.S 4 | * last change: 2012-03-18 5 | * 6 | * chip: ARMv7-M(E) (Cortex-M3 / Cortex-M4) 7 | * compiler: arm-none-eabi-gcc (GNU Tools for ARM Embedded Processors) 4.6.2 8 | * 20110921 (release) [ARM/embedded-4_6-branch revision 182083] 9 | * 10 | * description: 11 | * ARMv7-M(E) (Cortex-M3 / Cortex-M4) assembly startup code 12 | ******************************************************************************/ 13 | 14 | 15 | #define PRIMASK_MASK_EXCEPTIONS_bit 0 16 | #define PRIMASK_MASK_EXCEPTIONS (1 << PRIMASK_MASK_EXCEPTIONS_bit) 17 | #define FAULTMASK_MASK_EXCEPTIONS_bit 0 18 | #define FAULTMASK_MASK_EXCEPTIONS (1 << FAULTMASK_MASK_EXCEPTIONS_bit) 19 | #define CONTROL_THREAD_UNPRIVILEGED_bit 0 20 | #define CONTROL_ALTERNATE_STACK_bit 1 21 | #define CONTROL_THREAD_UNPRIVILEGED (1 << CONTROL_THREAD_UNPRIVILEGED_bit) 22 | #define CONTROL_ALTERNATE_STACK (1 << CONTROL_ALTERNATE_STACK_bit) 23 | 24 | 25 | /* 26 | +=============================================================================+ 27 | | ARMv7-M(E) (Cortex-M3 / Cortex-M4) startup code 28 | +=============================================================================+ 29 | */ 30 | 31 | .text 32 | .balign 2 33 | .syntax unified 34 | .thumb 35 | .thumb_func 36 | .global Reset_Handler 37 | 38 | Reset_Handler: 39 | 40 | /* 41 | +-----------------------------------------------------------------------------+ 42 | | Initialize the process stack pointer 43 | +-----------------------------------------------------------------------------+ 44 | */ 45 | 46 | ldr r0, =__process_stack_end 47 | msr PSP, r0 48 | 49 | /* 50 | +-----------------------------------------------------------------------------+ 51 | | Thread mode uses process stack (PSP) and is privileged 52 | +-----------------------------------------------------------------------------+ 53 | */ 54 | 55 | movs r0, #CONTROL_ALTERNATE_STACK 56 | msr CONTROL, r0 57 | isb 58 | 59 | /* 60 | +-----------------------------------------------------------------------------+ 61 | | Branch to low_level_init_0() function (.data and .bss are not initialized!) 62 | +-----------------------------------------------------------------------------+ 63 | */ 64 | 65 | ldr r0, =low_level_init_0 66 | blx r0 67 | 68 | /* 69 | +-----------------------------------------------------------------------------+ 70 | | Initialize .data section 71 | +-----------------------------------------------------------------------------+ 72 | */ 73 | 74 | ldr r1, =__data_init_start 75 | ldr r2, =__data_start 76 | ldr r3, =__data_end 77 | 78 | 1: cmp r2, r3 79 | ittt lo 80 | ldrlo r0, [r1], #4 81 | strlo r0, [r2], #4 82 | blo 1b 83 | 84 | /* 85 | +-----------------------------------------------------------------------------+ 86 | | Zero-init .bss section 87 | +-----------------------------------------------------------------------------+ 88 | */ 89 | 90 | movs r0, #0 91 | ldr r1, =__bss_start 92 | ldr r2, =__bss_end 93 | 94 | 1: cmp r1, r2 95 | itt lo 96 | strlo r0, [r1], #4 97 | blo 1b 98 | 99 | /* 100 | +-----------------------------------------------------------------------------+ 101 | | Call C++ constructors for global and static objects 102 | +-----------------------------------------------------------------------------+ 103 | */ 104 | #ifdef __USES_CXX 105 | ldr r0, =__libc_init_array 106 | blx r0 107 | #endif 108 | 109 | /* 110 | +-----------------------------------------------------------------------------+ 111 | | Branch to low_level_init_1() function 112 | +-----------------------------------------------------------------------------+ 113 | */ 114 | 115 | ldr r0, =low_level_init_1 116 | blx r0 117 | 118 | /* 119 | +-----------------------------------------------------------------------------+ 120 | | Branch to main() with link 121 | +-----------------------------------------------------------------------------+ 122 | */ 123 | 124 | ldr r0, =main 125 | blx r0 126 | 127 | /* 128 | +-----------------------------------------------------------------------------+ 129 | | Call C++ destructors for global and static objects 130 | +-----------------------------------------------------------------------------+ 131 | */ 132 | #ifdef __USES_CXX 133 | ldr r0, =__libc_fini_array 134 | blx r0 135 | #endif 136 | 137 | /* 138 | +-----------------------------------------------------------------------------+ 139 | | On return - loop till the end of the world 140 | +-----------------------------------------------------------------------------+ 141 | */ 142 | 143 | b . 144 | 145 | /* 146 | +=============================================================================+ 147 | | __default_low_level_init() - replacement for undefined low_level_init_0() 148 | | and/or low_level_init_1(). This function just returns. 149 | +=============================================================================+ 150 | */ 151 | 152 | .text 153 | .balign 2 154 | .syntax unified 155 | .thumb 156 | .thumb_func 157 | .global __default_low_level_init 158 | 159 | __default_low_level_init: 160 | bx lr 161 | 162 | /* 163 | +=============================================================================+ 164 | | assign undefined low_level_init_0() and/or low_level_init_1() to 165 | | __default_low_level_init() 166 | +=============================================================================+ 167 | */ 168 | 169 | .weak low_level_init_0 170 | .global low_level_init_0 171 | .set low_level_init_0, __default_low_level_init 172 | 173 | .weak low_level_init_1 174 | .global low_level_init_1 175 | .set low_level_init_1, __default_low_level_init 176 | 177 | /****************************************************************************** 178 | * END OF FILE 179 | ******************************************************************************/ 180 | -------------------------------------------------------------------------------- /stm/lcd_utils/fonts.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file fonts.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header for fonts.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __FONTS_H 40 | #define __FONTS_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include 48 | 49 | /** @addtogroup Utilities 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup STM32_EVAL 54 | * @{ 55 | */ 56 | 57 | /** @addtogroup Common 58 | * @{ 59 | */ 60 | 61 | /** @addtogroup FONTS 62 | * @{ 63 | */ 64 | 65 | /** @defgroup FONTS_Exported_Types 66 | * @{ 67 | */ 68 | typedef struct _tFont 69 | { 70 | const uint8_t *table; 71 | uint16_t Width; 72 | uint16_t Height; 73 | 74 | } sFONT; 75 | 76 | extern sFONT Font24; 77 | extern sFONT Font20; 78 | extern sFONT Font16; 79 | extern sFONT Font12; 80 | extern sFONT Font8; 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @defgroup FONTS_Exported_Constants 86 | * @{ 87 | */ 88 | #define LINE(x) ((x) * (((sFONT *)BSP_LCD_GetFont())->Height)) 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup FONTS_Exported_Macros 95 | * @{ 96 | */ 97 | /** 98 | * @} 99 | */ 100 | 101 | /** @defgroup FONTS_Exported_Functions 102 | * @{ 103 | */ 104 | /** 105 | * @} 106 | */ 107 | 108 | #ifdef __cplusplus 109 | } 110 | #endif 111 | 112 | #endif /* __FONTS_H */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /** 127 | * @} 128 | */ 129 | 130 | /** 131 | * @} 132 | */ 133 | 134 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 135 | -------------------------------------------------------------------------------- /stm/lcd_utils/lcd_log.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file lcd_log.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief header for the lcd_log.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __LCD_LOG_H__ 40 | #define __LCD_LOG_H__ 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | 44 | #include "lcd_log_conf.h" 45 | 46 | /** @addtogroup Utilities 47 | * @{ 48 | */ 49 | 50 | /** @addtogroup STM32_EVAL 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup Common 55 | * @{ 56 | */ 57 | 58 | /** @addtogroup LCD_LOG 59 | * @{ 60 | */ 61 | 62 | /** @defgroup LCD_LOG 63 | * @brief 64 | * @{ 65 | */ 66 | 67 | 68 | /** @defgroup LCD_LOG_Exported_Defines 69 | * @{ 70 | */ 71 | 72 | #if (LCD_SCROLL_ENABLED == 1) 73 | #define LCD_CACHE_DEPTH (YWINDOW_SIZE + CACHE_SIZE) 74 | #else 75 | #define LCD_CACHE_DEPTH YWINDOW_SIZE 76 | #endif 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup LCD_LOG_Exported_Types 82 | * @{ 83 | */ 84 | typedef struct _LCD_LOG_line 85 | { 86 | uint8_t line[128]; 87 | uint32_t color; 88 | 89 | }LCD_LOG_line; 90 | 91 | /** 92 | * @} 93 | */ 94 | 95 | /** @defgroup LCD_LOG_Exported_Macros 96 | * @{ 97 | */ 98 | #define LCD_ErrLog(...) LCD_LineColor = LCD_COLOR_RED;\ 99 | printf("ERROR: ") ;\ 100 | printf(__VA_ARGS__);\ 101 | LCD_LineColor = LCD_LOG_DEFAULT_COLOR 102 | 103 | #define LCD_UsrLog(...) LCD_LineColor = LCD_LOG_TEXT_COLOR;\ 104 | printf(__VA_ARGS__);\ 105 | 106 | 107 | #define LCD_DbgLog(...) LCD_LineColor = LCD_COLOR_CYAN;\ 108 | printf(__VA_ARGS__);\ 109 | LCD_LineColor = LCD_LOG_DEFAULT_COLOR 110 | /** 111 | * @} 112 | */ 113 | 114 | /** @defgroup LCD_LOG_Exported_Variables 115 | * @{ 116 | */ 117 | extern uint32_t LCD_LineColor; 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** @defgroup LCD_LOG_Exported_FunctionsPrototype 124 | * @{ 125 | */ 126 | void LCD_LOG_Init(void); 127 | void LCD_LOG_DeInit(void); 128 | void LCD_LOG_SetHeader(uint8_t *Title); 129 | void LCD_LOG_SetFooter(uint8_t *Status); 130 | void LCD_LOG_ClearTextZone(void); 131 | void LCD_LOG_UpdateDisplay (void); 132 | 133 | #if (LCD_SCROLL_ENABLED == 1) 134 | ErrorStatus LCD_LOG_ScrollBack(void); 135 | ErrorStatus LCD_LOG_ScrollForward(void); 136 | #endif 137 | /** 138 | * @} 139 | */ 140 | 141 | 142 | #endif /* __LCD_LOG_H__ */ 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 165 | -------------------------------------------------------------------------------- /stm/lcd_utils/lcd_log_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file lcd_log_conf_template.h 4 | * @author MCD Application Team 5 | * @version V5.0.2 6 | * @date 05-March-2012 7 | * @brief lcd_log configuration template file. 8 | * This file should be copied to the application folder and modified 9 | * as follows: 10 | * - Rename it to 'lcd_log_conf.h'. 11 | * - Update the name of the LCD header file depending on the EVAL board 12 | * you are using (see line32 below). 13 | ****************************************************************************** 14 | * @attention 15 | * 16 | *

© COPYRIGHT 2012 STMicroelectronics

17 | * 18 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 19 | * You may not use this file except in compliance with the License. 20 | * You may obtain a copy of the License at: 21 | * 22 | * http://www.st.com/software_license_agreement_liberty_v2 23 | * 24 | * Unless required by applicable law or agreed to in writing, software 25 | * distributed under the License is distributed on an "AS IS" BASIS, 26 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 27 | * See the License for the specific language governing permissions and 28 | * limitations under the License. 29 | * 30 | ****************************************************************************** 31 | */ 32 | 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | #ifndef __LCD_LOG_CONF_H__ 35 | #define __LCD_LOG_CONF_H__ 36 | 37 | /* Includes ------------------------------------------------------------------*/ 38 | #include "stm32f429i_discovery_lcd.h" /* replace 'stm32xxx' with your EVAL board name, ex: stm3210c_eval_lcd.h */ 39 | #include 40 | 41 | /** @addtogroup LCD_LOG 42 | * @{ 43 | */ 44 | 45 | /** @defgroup LCD_LOG 46 | * @brief This file is the 47 | * @{ 48 | */ 49 | 50 | 51 | /** @defgroup LCD_LOG_CONF_Exported_Defines 52 | * @{ 53 | */ 54 | /* Comment the line below to disable the scroll back and forward features */ 55 | #define LCD_SCROLL_ENABLED 1 56 | 57 | /* Define the Fonts */ 58 | #define LCD_LOG_HEADER_FONT Font16 59 | #define LCD_LOG_FOOTER_FONT Font12 60 | #define LCD_LOG_TEXT_FONT Font12 61 | 62 | /* Define the LCD LOG Color */ 63 | #define LCD_LOG_BACKGROUND_COLOR LCD_COLOR_BLACK 64 | #define LCD_LOG_TEXT_COLOR LCD_COLOR_GREEN 65 | 66 | #define LCD_LOG_SOLID_BACKGROUND_COLOR LCD_COLOR_BLUE 67 | #define LCD_LOG_SOLID_TEXT_COLOR LCD_COLOR_WHITE 68 | 69 | /* Define the cache depth */ 70 | #define CACHE_SIZE 100 71 | #define YWINDOW_SIZE 22 72 | 73 | #ifdef __GNUC__ 74 | /* With GCC/RAISONANCE, small printf (option LD Linker->Libraries->Small printf 75 | set to 'Yes') calls __io_putchar() */ 76 | int __io_putchar(int ch); 77 | #define LCD_LOG_PUTCHAR int __io_putchar(int ch) 78 | #else 79 | #define LCD_LOG_PUTCHAR int fputc(int ch, FILE *f) 80 | #endif /* __GNUC__ */ 81 | 82 | /** @defgroup LCD_LOG_CONF_Exported_TypesDefinitions 83 | * @{ 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | 91 | /** @defgroup LCD_LOG_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup LCD_LOG_CONF_Exported_Variables 101 | * @{ 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** @defgroup LCD_LOG_CONF_Exported_FunctionsPrototype 109 | * @{ 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | 117 | #endif /* __LCD_LOG_H__ */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /stm/stm32f429/lcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file lcd.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief This file contains all the functions prototypes for the LCD driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __LCD_H 40 | #define __LCD_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include 48 | 49 | /** @addtogroup BSP 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup Components 54 | * @{ 55 | */ 56 | 57 | /** @addtogroup LCD 58 | * @{ 59 | */ 60 | 61 | 62 | /** @defgroup LCD_Exported_Types 63 | * @{ 64 | */ 65 | /** 66 | * @brief LCD driver structure definition 67 | */ 68 | typedef struct 69 | { 70 | void (*Init)(void); 71 | uint16_t (*ReadID)(void); 72 | void (*DisplayOn)(void); 73 | void (*DisplayOff)(void); 74 | void (*SetCursor)(uint16_t, uint16_t); 75 | void (*WritePixel)(uint16_t, uint16_t, uint16_t); 76 | uint16_t (*ReadPixel)(uint16_t, uint16_t); 77 | 78 | /* Optimized operation */ 79 | void (*SetDisplayWindow)(uint16_t, uint16_t, uint16_t, uint16_t); 80 | void (*DrawHLine)(uint16_t, uint16_t, uint16_t, uint16_t); 81 | void (*DrawVLine)(uint16_t, uint16_t, uint16_t, uint16_t); 82 | 83 | uint16_t (*GetLcdPixelWidth)(void); 84 | uint16_t (*GetLcdPixelHeight)(void); 85 | void (*DrawBitmap)(uint16_t, uint16_t, uint8_t*); 86 | void (*DrawRGBImage)(uint16_t, uint16_t, uint16_t, uint16_t, uint8_t*); 87 | } 88 | LCD_DrvTypeDef; 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup LCD_Exported_Constants 95 | * @{ 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @defgroup LCD_Exported_Functions 103 | * @{ 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | #endif /* LCD_H */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 130 | -------------------------------------------------------------------------------- /stm/stm32f429/stm32f429i_discovery_sdram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f429i_discovery_sdram.h 4 | * @author MCD Application Team 5 | * @version V2.0.1 6 | * @date 26-February-2014 7 | * @brief This file contains all the functions prototypes for the 8 | * stm32F429I_DISCOVERY_sdram.c driver. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT(c) 2014 STMicroelectronics

13 | * 14 | * Redistribution and use in source and binary forms, with or without modification, 15 | * are permitted provided that the following conditions are met: 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 22 | * may be used to endorse or promote products derived from this software 23 | * without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ 40 | #ifndef __STM32F429I_DISCOVERY_SDRAM_H 41 | #define __STM32F429I_DISCOVERY_SDRAM_H 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f429i_discovery.h" 49 | 50 | /** @addtogroup BSP 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup STM32F429I_DISCOVERY 55 | * @{ 56 | */ 57 | 58 | /** @defgroup STM32F429I_DISCOVERY_SDRAM STM32F429I_DISCOVERY_SDRAM 59 | * @{ 60 | */ 61 | 62 | /* Exported types ------------------------------------------------------------*/ 63 | 64 | /** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Types STM32F429I_DISCOVERY_SDRAM_Exported_Types 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /* Exported constants --------------------------------------------------------*/ 72 | 73 | /** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Constants STM32F429I_DISCOVERY_SDRAM_Exported_Constants 74 | * @{ 75 | */ 76 | /** 77 | * @brief FMC SDRAM Bank address 78 | */ 79 | #define SDRAM_DEVICE_ADDR ((uint32_t)0xD0000000) 80 | #define SDRAM_DEVICE_SIZE ((uint32_t)0x800000) /* SDRAM device size in MBytes */ 81 | 82 | /** 83 | * @brief FMC SDRAM Memory Width 84 | */ 85 | /* #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_8 */ 86 | #define SDRAM_MEMORY_WIDTH FMC_SDRAM_MEM_BUS_WIDTH_16 87 | 88 | /** 89 | * @brief FMC SDRAM CAS Latency 90 | */ 91 | /* #define SDRAM_CAS_LATENCY FMC_SDRAM_CAS_LATENCY_2 */ 92 | #define SDRAM_CAS_LATENCY FMC_SDRAM_CAS_LATENCY_3 93 | 94 | /** 95 | * @brief FMC SDRAM Memory clock period 96 | */ 97 | #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_2 /* Default configuration used with LCD */ 98 | /* #define SDCLOCK_PERIOD FMC_SDRAM_CLOCK_PERIOD_3 */ 99 | 100 | /** 101 | * @brief FMC SDRAM Memory Read Burst feature 102 | */ 103 | #define SDRAM_READBURST FMC_SDRAM_RBURST_DISABLE /* Default configuration used with LCD */ 104 | /* #define SDRAM_READBURST FMC_SDRAM_RBURST_ENABLE */ 105 | 106 | /** 107 | * @brief FMC SDRAM Bank Remap 108 | */ 109 | /* #define SDRAM_BANK_REMAP */ 110 | 111 | 112 | /* Set the refresh rate counter */ 113 | /* (15.62 us x Freq) - 20 */ 114 | #define REFRESH_COUNT ((uint32_t)1386) /* SDRAM refresh counter */ 115 | #define SDRAM_TIMEOUT ((uint32_t)0xFFFF) 116 | 117 | /* DMA definitions for SDRAM DMA transfer */ 118 | #define __DMAx_CLK_ENABLE __DMA2_CLK_ENABLE 119 | #define SDRAM_DMAx_CHANNEL DMA_CHANNEL_0 120 | #define SDRAM_DMAx_STREAM DMA2_Stream0 121 | #define SDRAM_DMAx_IRQn DMA2_Stream0_IRQn 122 | #define SDRAM_DMAx_IRQHandler DMA2_Stream0_IRQHandler 123 | 124 | /** 125 | * @brief FMC SDRAM Mode definition register defines 126 | */ 127 | #define SDRAM_MODEREG_BURST_LENGTH_1 ((uint16_t)0x0000) 128 | #define SDRAM_MODEREG_BURST_LENGTH_2 ((uint16_t)0x0001) 129 | #define SDRAM_MODEREG_BURST_LENGTH_4 ((uint16_t)0x0002) 130 | #define SDRAM_MODEREG_BURST_LENGTH_8 ((uint16_t)0x0004) 131 | #define SDRAM_MODEREG_BURST_TYPE_SEQUENTIAL ((uint16_t)0x0000) 132 | #define SDRAM_MODEREG_BURST_TYPE_INTERLEAVED ((uint16_t)0x0008) 133 | #define SDRAM_MODEREG_CAS_LATENCY_2 ((uint16_t)0x0020) 134 | #define SDRAM_MODEREG_CAS_LATENCY_3 ((uint16_t)0x0030) 135 | #define SDRAM_MODEREG_OPERATING_MODE_STANDARD ((uint16_t)0x0000) 136 | #define SDRAM_MODEREG_WRITEBURST_MODE_PROGRAMMED ((uint16_t)0x0000) 137 | #define SDRAM_MODEREG_WRITEBURST_MODE_SINGLE ((uint16_t)0x0200) 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | /* Exported macro ------------------------------------------------------------*/ 144 | 145 | /** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Macro STM32F429I_DISCOVERY_SDRAM_Exported_Macro 146 | * @{ 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /* Exported functions --------------------------------------------------------*/ 154 | 155 | /** @defgroup STM32F429I_DISCOVERY_SDRAM_Exported_Functions STM32F429I_DISCOVERY_SDRAM_Exported_Functions 156 | * @{ 157 | */ 158 | void BSP_SDRAM_Init(void); 159 | void BSP_SDRAM_Initialization_sequence(uint32_t RefreshCount); 160 | void BSP_SDRAM_ReadData(uint32_t uwStartAddress, uint32_t* pData, uint32_t uwDataSize); 161 | void BSP_SDRAM_ReadData_DMA(uint32_t uwStartAddress, uint32_t* pData, uint32_t uwDataSize); 162 | void BSP_SDRAM_WriteData(uint32_t uwStartAddress, uint32_t* pData, uint32_t uwDataSize); 163 | void BSP_SDRAM_WriteData_DMA(uint32_t uwStartAddress, uint32_t* pData, uint32_t uwDataSize); 164 | HAL_StatusTypeDef BSP_SDRAM_Sendcmd(FMC_SDRAM_CommandTypeDef *SdramCmd); 165 | void BSP_SDRAM_DMA_IRQHandler(void); 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #endif /* __STM32F429I_DISCOVERY_SDRAM_H */ 172 | 173 | /** 174 | * @} 175 | */ 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 189 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_cortex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_cortex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of CORTEX HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_CORTEX_H 40 | #define __STM32F4xx_HAL_CORTEX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup CORTEX 54 | * @{ 55 | */ 56 | /* Exported types ------------------------------------------------------------*/ 57 | /* Exported constants --------------------------------------------------------*/ 58 | 59 | /** @defgroup CORTEX_Exported_Constants 60 | * @{ 61 | */ 62 | 63 | 64 | /** @defgroup CORTEX_Preemption_Priority_Group 65 | * @{ 66 | */ 67 | 68 | #define NVIC_PRIORITYGROUP_0 ((uint32_t)0x00000007) /*!< 0 bits for pre-emption priority 69 | 4 bits for subpriority */ 70 | #define NVIC_PRIORITYGROUP_1 ((uint32_t)0x00000006) /*!< 1 bits for pre-emption priority 71 | 3 bits for subpriority */ 72 | #define NVIC_PRIORITYGROUP_2 ((uint32_t)0x00000005) /*!< 2 bits for pre-emption priority 73 | 2 bits for subpriority */ 74 | #define NVIC_PRIORITYGROUP_3 ((uint32_t)0x00000004) /*!< 3 bits for pre-emption priority 75 | 1 bits for subpriority */ 76 | #define NVIC_PRIORITYGROUP_4 ((uint32_t)0x00000003) /*!< 4 bits for pre-emption priority 77 | 0 bits for subpriority */ 78 | 79 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PRIORITYGROUP_0) || \ 80 | ((GROUP) == NVIC_PRIORITYGROUP_1) || \ 81 | ((GROUP) == NVIC_PRIORITYGROUP_2) || \ 82 | ((GROUP) == NVIC_PRIORITYGROUP_3) || \ 83 | ((GROUP) == NVIC_PRIORITYGROUP_4)) 84 | 85 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 86 | 87 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10) 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup CORTEX_SysTick_clock_source 94 | * @{ 95 | */ 96 | #define SYSTICK_CLKSOURCE_HCLK_DIV8 ((uint32_t)0x00000000) 97 | #define SYSTICK_CLKSOURCE_HCLK ((uint32_t)0x00000004) 98 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SYSTICK_CLKSOURCE_HCLK) || \ 99 | ((SOURCE) == SYSTICK_CLKSOURCE_HCLK_DIV8)) 100 | /** 101 | * @} 102 | */ 103 | 104 | /* Exported Macros -----------------------------------------------------------*/ 105 | 106 | /** @brief Configures the SysTick clock source. 107 | * @param __CLKSRC__: specifies the SysTick clock source. 108 | * This parameter can be one of the following values: 109 | * @arg SYSTICK_CLKSOURCE_HCLK_DIV8: AHB clock divided by 8 selected as SysTick clock source. 110 | * @arg SYSTICK_CLKSOURCE_HCLK: AHB clock selected as SysTick clock source. 111 | * @retval None 112 | */ 113 | #define __HAL_CORTEX_SYSTICKCLK_CONFIG(__CLKSRC__) \ 114 | do { \ 115 | if ((__CLKSRC__) == SYSTICK_CLKSOURCE_HCLK) \ 116 | { \ 117 | SysTick->CTRL |= SYSTICK_CLKSOURCE_HCLK; \ 118 | } \ 119 | else \ 120 | SysTick->CTRL &= ~SYSTICK_CLKSOURCE_HCLK; \ 121 | } while(0) 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /* Exported macro ------------------------------------------------------------*/ 128 | /* Exported functions --------------------------------------------------------*/ 129 | /* Initialization and de-initialization functions *******************************/ 130 | void HAL_NVIC_SetPriorityGrouping(uint32_t PriorityGroup); 131 | void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority); 132 | void HAL_NVIC_EnableIRQ(IRQn_Type IRQn); 133 | void HAL_NVIC_DisableIRQ(IRQn_Type IRQn); 134 | void HAL_NVIC_SystemReset(void); 135 | uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb); 136 | 137 | /* Peripheral Control functions *************************************************/ 138 | uint32_t HAL_NVIC_GetPriorityGrouping(void); 139 | void HAL_NVIC_GetPriority(IRQn_Type IRQn, uint32_t PriorityGroup, uint32_t* pPreemptPriority, uint32_t* pSubPriority); 140 | uint32_t HAL_NVIC_GetPendingIRQ(IRQn_Type IRQn); 141 | void HAL_NVIC_SetPendingIRQ(IRQn_Type IRQn); 142 | void HAL_NVIC_ClearPendingIRQ(IRQn_Type IRQn); 143 | uint32_t HAL_NVIC_GetActive(IRQn_Type IRQn); 144 | void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource); 145 | void HAL_SYSTICK_IRQHandler(void); 146 | void HAL_SYSTICK_Callback(void); 147 | 148 | /** 149 | * @} 150 | */ 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | #ifdef __cplusplus 157 | } 158 | #endif 159 | 160 | #endif /* __STM32F4xx_HAL_CORTEX_H */ 161 | 162 | 163 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 164 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_crc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of CRC HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_CRC_H 40 | #define __STM32F4xx_HAL_CRC_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup CRC 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | 59 | /** 60 | * @brief CRC HAL State Structure definition 61 | */ 62 | typedef enum 63 | { 64 | HAL_CRC_STATE_RESET = 0x00, /*!< CRC not yet initialized or disabled */ 65 | HAL_CRC_STATE_READY = 0x01, /*!< CRC initialized and ready for use */ 66 | HAL_CRC_STATE_BUSY = 0x02, /*!< CRC internal process is ongoing */ 67 | HAL_CRC_STATE_TIMEOUT = 0x03, /*!< CRC timeout state */ 68 | HAL_CRC_STATE_ERROR = 0x04 /*!< CRC error state */ 69 | 70 | }HAL_CRC_StateTypeDef; 71 | 72 | /** 73 | * @brief CRC handle Structure definition 74 | */ 75 | typedef struct 76 | { 77 | CRC_TypeDef *Instance; /*!< Register base address */ 78 | 79 | HAL_LockTypeDef Lock; /*!< CRC locking object */ 80 | 81 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ 82 | 83 | }CRC_HandleTypeDef; 84 | 85 | /* Exported constants --------------------------------------------------------*/ 86 | /* Exported macro ------------------------------------------------------------*/ 87 | 88 | /** 89 | * @brief Resets CRC Data Register. 90 | * @param __HANDLE__: CRC handle 91 | * @retval None 92 | */ 93 | #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) 94 | 95 | /* Exported functions --------------------------------------------------------*/ 96 | 97 | /* Initialization/de-initialization functions **********************************/ 98 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); 99 | HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc); 100 | void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); 101 | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); 102 | 103 | /* Peripheral Control functions ************************************************/ 104 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 105 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 106 | 107 | /* Peripheral State functions **************************************************/ 108 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | #ifdef __cplusplus 119 | } 120 | #endif 121 | 122 | #endif /* __STM32F4xx_HAL_CRC_H */ 123 | 124 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 125 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of CRYP HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_CRYP_EX_H 40 | #define __STM32F4xx_HAL_CRYP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F437xx) || defined(STM32F439xx) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup CRYPEx 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | 61 | /** @defgroup CRYPEx_Exported_Constants 62 | * @{ 63 | */ 64 | 65 | /** @defgroup CRYPEx_AlgoModeDirection 66 | * @{ 67 | */ 68 | #define CRYP_CR_ALGOMODE_AES_GCM_ENCRYPT ((uint32_t)0x00080000) 69 | #define CRYP_CR_ALGOMODE_AES_GCM_DECRYPT ((uint32_t)0x00080004) 70 | #define CRYP_CR_ALGOMODE_AES_CCM_ENCRYPT ((uint32_t)0x00080008) 71 | #define CRYP_CR_ALGOMODE_AES_CCM_DECRYPT ((uint32_t)0x0008000C) 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup CRYPEx_PhaseConfig 77 | * The phases are relevant only to AES-GCM and AES-CCM 78 | * @{ 79 | */ 80 | #define CRYP_PHASE_INIT ((uint32_t)0x00000000) 81 | #define CRYP_PHASE_HEADER CRYP_CR_GCM_CCMPH_0 82 | #define CRYP_PHASE_PAYLOAD CRYP_CR_GCM_CCMPH_1 83 | #define CRYP_PHASE_FINAL CRYP_CR_GCM_CCMPH 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /* Exported macro ------------------------------------------------------------*/ 93 | 94 | /** 95 | * @brief Set the phase: Init, header, payload, final. 96 | * This is relevant only for GCM and CCM modes. 97 | * @param PHASE: The phase. 98 | * @retval None 99 | */ 100 | #define __HAL_CRYP_SET_PHASE(PHASE) do{CRYP->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\ 101 | CRYP->CR |= (uint32_t)(PHASE);\ 102 | }while(0) 103 | 104 | 105 | /* Exported functions --------------------------------------------------------*/ 106 | 107 | /* AES encryption/decryption using polling ***********************************/ 108 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); 109 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); 110 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint16_t Size, uint8_t *AuthTag, uint32_t Timeout); 111 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); 112 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); 113 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout); 114 | 115 | /* AES encryption/decryption using interrupt *********************************/ 116 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 117 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 118 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 119 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 120 | 121 | /* AES encryption/decryption using DMA ***************************************/ 122 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 123 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 124 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 125 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 126 | 127 | 128 | /* Processing functions ********************************************************/ 129 | void HAL_CRYPEx_GCMCCM_IRQHandler(CRYP_HandleTypeDef *hcryp); 130 | 131 | #endif /* STM32F437xx || STM32F439xx */ 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | #ifdef __cplusplus 141 | } 142 | #endif 143 | 144 | #endif /* __STM32F4xx_HAL_CRYP_EX_H */ 145 | 146 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 147 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_def.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief This file contains HAL common defines, enumeration, macros and 8 | * structures definitions. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT(c) 2014 STMicroelectronics

13 | * 14 | * Redistribution and use in source and binary forms, with or without modification, 15 | * are permitted provided that the following conditions are met: 16 | * 1. Redistributions of source code must retain the above copyright notice, 17 | * this list of conditions and the following disclaimer. 18 | * 2. Redistributions in binary form must reproduce the above copyright notice, 19 | * this list of conditions and the following disclaimer in the documentation 20 | * and/or other materials provided with the distribution. 21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 22 | * may be used to endorse or promote products derived from this software 23 | * without specific prior written permission. 24 | * 25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 35 | * 36 | ****************************************************************************** 37 | */ 38 | 39 | /* Define to prevent recursive inclusion -------------------------------------*/ 40 | #ifndef __STM32F4xx_HAL_DEF 41 | #define __STM32F4xx_HAL_DEF 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx.h" 49 | 50 | /* Exported types ------------------------------------------------------------*/ 51 | 52 | /** 53 | * @brief HAL Status structures definition 54 | */ 55 | typedef enum 56 | { 57 | HAL_OK = 0x00, 58 | HAL_ERROR = 0x01, 59 | HAL_BUSY = 0x02, 60 | HAL_TIMEOUT = 0x03 61 | } HAL_StatusTypeDef; 62 | 63 | /** 64 | * @brief HAL Lock structures definition 65 | */ 66 | typedef enum 67 | { 68 | HAL_UNLOCKED = 0x00, 69 | HAL_LOCKED = 0x01 70 | } HAL_LockTypeDef; 71 | 72 | /* Exported macro ------------------------------------------------------------*/ 73 | #ifndef NULL 74 | #define NULL (void *) 0 75 | #endif 76 | 77 | #define HAL_MAX_DELAY 0xFFFFFFFF 78 | 79 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET) 80 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) 81 | 82 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD_, __DMA_HANDLE_) \ 83 | do{ \ 84 | (__HANDLE__)->__PPP_DMA_FIELD_ = &(__DMA_HANDLE_); \ 85 | (__DMA_HANDLE_).Parent = (__HANDLE__); \ 86 | } while(0) 87 | 88 | #if (USE_RTOS == 1) 89 | /* Reserved for future use */ 90 | #else 91 | #define __HAL_LOCK(__HANDLE__) \ 92 | do{ \ 93 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 94 | { \ 95 | return HAL_BUSY; \ 96 | } \ 97 | else \ 98 | { \ 99 | (__HANDLE__)->Lock = HAL_LOCKED; \ 100 | } \ 101 | }while (0) 102 | 103 | #define __HAL_UNLOCK(__HANDLE__) \ 104 | do{ \ 105 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 106 | }while (0) 107 | #endif /* USE_RTOS */ 108 | 109 | #if defined ( __GNUC__ ) 110 | #ifndef __weak 111 | #define __weak __attribute__((weak)) 112 | #endif /* __weak */ 113 | #ifndef __packed 114 | #define __packed __attribute__((__packed__)) 115 | #endif /* __packed */ 116 | #endif /* __GNUC__ */ 117 | 118 | 119 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 120 | #if defined (__GNUC__) /* GNU Compiler */ 121 | #ifndef __ALIGN_END 122 | #define __ALIGN_END __attribute__ ((aligned (4))) 123 | #endif /* __ALIGN_END */ 124 | #ifndef __ALIGN_BEGIN 125 | #define __ALIGN_BEGIN 126 | #endif /* __ALIGN_BEGIN */ 127 | #else 128 | #ifndef __ALIGN_END 129 | #define __ALIGN_END 130 | #endif /* __ALIGN_END */ 131 | #ifndef __ALIGN_BEGIN 132 | #if defined (__CC_ARM) /* ARM Compiler */ 133 | #define __ALIGN_BEGIN __align(4) 134 | #elif defined (__ICCARM__) /* IAR Compiler */ 135 | #define __ALIGN_BEGIN 136 | #elif defined (__TASKING__) /* TASKING Compiler */ 137 | #define __ALIGN_BEGIN __align(4) 138 | #endif /* __CC_ARM */ 139 | #endif /* __ALIGN_BEGIN */ 140 | #endif /* __GNUC__ */ 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | 146 | #endif /* ___STM32F4xx_HAL_DEF */ 147 | 148 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 149 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_dma_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_dma_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of DMA HAL extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_DMA_EX_H 40 | #define __STM32F4xx_HAL_DMA_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup DMAEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | 59 | /** 60 | * @brief HAL DMA Memory definition 61 | */ 62 | typedef enum 63 | { 64 | MEMORY0 = 0x00, /*!< Memory 0 */ 65 | MEMORY1 = 0x01, /*!< Memory 1 */ 66 | 67 | }HAL_DMA_MemoryTypeDef; 68 | 69 | /* Exported constants --------------------------------------------------------*/ 70 | /* Exported macro ------------------------------------------------------------*/ 71 | 72 | /* Exported functions --------------------------------------------------------*/ 73 | /* IO operation functions *******************************************************/ 74 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 75 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength); 76 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory); 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /* __STM32F4xx_HAL_DMA_H */ 91 | 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_hash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_hash_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of HASH HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_HASH_EX_H 40 | #define __STM32F4xx_HAL_HASH_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F437xx) || defined(STM32F439xx) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup HASHEx 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | /* Exported macro ------------------------------------------------------------*/ 61 | /* Exported functions --------------------------------------------------------*/ 62 | 63 | /* HASH processing using polling *********************************************/ 64 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 65 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 66 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 67 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 68 | 69 | /* HASH-MAC processing using polling *****************************************/ 70 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 71 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 72 | 73 | /* HASH processing using interrupt *******************************************/ 74 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 75 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 76 | 77 | /* HASH processing using DMA *************************************************/ 78 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 79 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 80 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 81 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 82 | 83 | /* HASH-HMAC processing using DMA ********************************************/ 84 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 85 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 86 | 87 | /* Processing functions ******************************************************/ 88 | void HAL_HASHEx_IRQHandler(HASH_HandleTypeDef *hhash); 89 | 90 | #endif /* STM32F437xx || STM32F439xx */ 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | #ifdef __cplusplus 100 | } 101 | #endif 102 | 103 | #endif /* __STM32F4xx_HAL_HASH_EX_H */ 104 | 105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of I2C HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_I2C_EX_H 40 | #define __STM32F4xx_HAL_I2C_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F401xC) || defined(STM32F401xE) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup I2CEx 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | 61 | /** @defgroup I2CEx_Exported_Constants 62 | * @{ 63 | */ 64 | 65 | /** @defgroup I2CEx_Analog_Filter 66 | * @{ 67 | */ 68 | #define I2C_ANALOGFILTER_ENABLED ((uint32_t)0x00000000) 69 | #define I2C_ANALOGFILTER_DISABLED I2C_FLTR_ANOFF 70 | 71 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLED) || \ 72 | ((FILTER) == I2C_ANALOGFILTER_DISABLED)) 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup I2CEx_Digital_Filter 78 | * @{ 79 | */ 80 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000F) 81 | /** 82 | * @} 83 | */ 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /* Exported macro ------------------------------------------------------------*/ 90 | /* Exported functions --------------------------------------------------------*/ 91 | 92 | /* Peripheral Control functions ************************************************/ 93 | HAL_StatusTypeDef HAL_I2CEx_AnalogFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); 94 | HAL_StatusTypeDef HAL_I2CEx_DigitalFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); 95 | 96 | /** 97 | * @} 98 | */ 99 | #endif /* STM32F427xx || STM32F429xx || STM32F437xx || STM32F439xx || STM32F401xC || STM32F401xE */ 100 | /** 101 | * @} 102 | */ 103 | 104 | #ifdef __cplusplus 105 | } 106 | #endif 107 | 108 | #endif /* __STM32F4xx_HAL_I2C_EX_H */ 109 | 110 | 111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 112 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_i2s_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_i2s_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of I2S HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_I2S_EX_H 40 | #define __STM32F4xx_HAL_I2S_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup I2SEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported constants --------------------------------------------------------*/ 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | 62 | /* Extended features functions **************************************************/ 63 | /* Blocking mode: Polling */ 64 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size, uint32_t Timeout); 65 | /* Non-Blocking mode: Interrupt */ 66 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size); 67 | /* Non-Blocking mode: DMA */ 68 | HAL_StatusTypeDef HAL_I2SEx_TransmitReceive_DMA(I2S_HandleTypeDef *hi2s, uint16_t *pTxData, uint16_t *pRxData, uint16_t Size); 69 | 70 | HAL_StatusTypeDef I2SEx_TransmitReceive_IT(I2S_HandleTypeDef *hi2s); 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | #ifdef __cplusplus 80 | } 81 | #endif 82 | 83 | 84 | #endif /* __STM32F4xx_HAL_I2S_EX_H */ 85 | 86 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 87 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_pccard.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_pccard.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of PCCARD HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_PCCARD_H 40 | #define __STM32F4xx_HAL_PCCARD_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) 48 | #include "stm32f4xx_ll_fsmc.h" 49 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ 50 | 51 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) 52 | #include "stm32f4xx_ll_fmc.h" 53 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 54 | 55 | /** @addtogroup STM32F4xx_HAL_Driver 56 | * @{ 57 | */ 58 | 59 | /** @addtogroup PCCARD 60 | * @{ 61 | */ 62 | 63 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 64 | 65 | /* Exported typedef ----------------------------------------------------------*/ 66 | 67 | /** 68 | * @brief HAL SRAM State structures definition 69 | */ 70 | typedef enum 71 | { 72 | HAL_PCCARD_STATE_RESET = 0x00, /*!< PCCARD peripheral not yet initialized or disabled */ 73 | HAL_PCCARD_STATE_READY = 0x01, /*!< PCCARD peripheral ready */ 74 | HAL_PCCARD_STATE_BUSY = 0x02, /*!< PCCARD peripheral busy */ 75 | HAL_PCCARD_STATE_ERROR = 0x04 /*!< PCCARD peripheral error */ 76 | }HAL_PCCARD_StateTypeDef; 77 | 78 | typedef enum 79 | { 80 | CF_SUCCESS = 0, 81 | CF_ONGOING, 82 | CF_ERROR, 83 | CF_TIMEOUT 84 | }CF_StatusTypedef; 85 | 86 | /** 87 | * @brief FMC_PCCARD handle Structure definition 88 | */ 89 | typedef struct 90 | { 91 | FMC_PCCARD_TypeDef *Instance; /*!< Register base address for PCCARD device */ 92 | 93 | FMC_PCCARD_InitTypeDef Init; /*!< PCCARD device control configuration parameters */ 94 | 95 | __IO HAL_PCCARD_StateTypeDef State; /*!< PCCARD device access state */ 96 | 97 | HAL_LockTypeDef Lock; /*!< PCCARD Lock */ 98 | 99 | }PCCARD_HandleTypeDef; 100 | 101 | 102 | /* Exported constants --------------------------------------------------------*/ 103 | /** @defgroup PCCARD_Exported_Constants 104 | * @{ 105 | */ 106 | 107 | #define CF_DEVICE_ADDRESS ((uint32_t)0x90000000) 108 | #define CF_ATTRIBUTE_SPACE_ADDRESS ((uint32_t)0x98000000) /* Attribute space size to @0x9BFF FFFF */ 109 | #define CF_COMMON_SPACE_ADDRESS CF_DEVICE_ADDRESS /* Common space size to @0x93FF FFFF */ 110 | #define CF_IO_SPACE_ADDRESS ((uint32_t)0x9C000000) /* IO space size to @0x9FFF FFFF */ 111 | #define CF_IO_SPACE_PRIMARY_ADDR ((uint32_t)0x9C0001F0) /* IO space size to @0x9FFF FFFF */ 112 | 113 | /* Compact Flash-ATA registers description */ 114 | #define CF_DATA ((uint8_t)0x00) /* Data register */ 115 | #define CF_SECTOR_COUNT ((uint8_t)0x02) /* Sector Count register */ 116 | #define CF_SECTOR_NUMBER ((uint8_t)0x03) /* Sector Number register */ 117 | #define CF_CYLINDER_LOW ((uint8_t)0x04) /* Cylinder low register */ 118 | #define CF_CYLINDER_HIGH ((uint8_t)0x05) /* Cylinder high register */ 119 | #define CF_CARD_HEAD ((uint8_t)0x06) /* Card/Head register */ 120 | #define CF_STATUS_CMD ((uint8_t)0x07) /* Status(read)/Command(write) register */ 121 | #define CF_STATUS_CMD_ALTERNATE ((uint8_t)0x0E) /* Alternate Status(read)/Command(write) register */ 122 | #define CF_COMMON_DATA_AREA ((uint16_t)0x0400) /* Start of data area (for Common access only!) */ 123 | 124 | /* Compact Flash-ATA commands */ 125 | #define CF_READ_SECTOR_CMD ((uint8_t)0x20) 126 | #define CF_WRITE_SECTOR_CMD ((uint8_t)0x30) 127 | #define CF_ERASE_SECTOR_CMD ((uint8_t)0xC0) 128 | #define CF_IDENTIFY_CMD ((uint8_t)0xEC) 129 | 130 | /* Compact Flash status */ 131 | #define CF_TIMEOUT_ERROR ((uint8_t)0x60) 132 | #define CF_BUSY ((uint8_t)0x80) 133 | #define CF_PROGR ((uint8_t)0x01) 134 | #define CF_READY ((uint8_t)0x40) 135 | 136 | #define CF_SECTOR_SIZE ((uint32_t)255) /* In half words */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /* Exported functions --------------------------------------------------------*/ 143 | /* Initialization/de-initialization functions **********************************/ 144 | HAL_StatusTypeDef HAL_PCCARD_Init(PCCARD_HandleTypeDef *hpccard, FMC_NAND_PCC_TimingTypeDef *ComSpaceTiming, FMC_NAND_PCC_TimingTypeDef *AttSpaceTiming, FMC_NAND_PCC_TimingTypeDef *IOSpaceTiming); 145 | HAL_StatusTypeDef HAL_PCCARD_DeInit(PCCARD_HandleTypeDef *hpccard); 146 | void HAL_PCCARD_MspInit(PCCARD_HandleTypeDef *hpccard); 147 | void HAL_PCCARD_MspDeInit(PCCARD_HandleTypeDef *hpccard); 148 | 149 | /* IO operation functions *****************************************************/ 150 | HAL_StatusTypeDef HAL_CF_Read_ID(PCCARD_HandleTypeDef *hpccard, uint8_t CompactFlash_ID[], uint8_t *pStatus); 151 | HAL_StatusTypeDef HAL_CF_Write_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); 152 | HAL_StatusTypeDef HAL_CF_Read_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t *pBuffer, uint16_t SectorAddress, uint8_t *pStatus); 153 | HAL_StatusTypeDef HAL_CF_Erase_Sector(PCCARD_HandleTypeDef *hpccard, uint16_t SectorAddress, uint8_t *pStatus); 154 | HAL_StatusTypeDef HAL_CF_Reset(PCCARD_HandleTypeDef *hpccard); 155 | void HAL_PCCARD_IRQHandler(PCCARD_HandleTypeDef *hpccard); 156 | void HAL_PCCARD_ITCallback(PCCARD_HandleTypeDef *hpccard); 157 | 158 | /* PCCARD State functions *******************************************************/ 159 | HAL_PCCARD_StateTypeDef HAL_PCCARD_GetState(PCCARD_HandleTypeDef *hpccard); 160 | CF_StatusTypedef HAL_CF_GetStatus(PCCARD_HandleTypeDef *hpccard); 161 | CF_StatusTypedef HAL_CF_ReadStatus(PCCARD_HandleTypeDef *hpccard); 162 | 163 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 164 | /** 165 | * @} 166 | */ 167 | 168 | /** 169 | * @} 170 | */ 171 | 172 | #ifdef __cplusplus 173 | } 174 | #endif 175 | 176 | #endif /* __STM32F4xx_HAL_PCCARD_H */ 177 | 178 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 179 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_pwr_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_pwr_ex.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of PWR HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_PWR_EX_H 40 | #define __STM32F4xx_HAL_PWR_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup PWREx 54 | * @{ 55 | */ 56 | 57 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | /* ------------- PWR registers bit address in the alias region ---------------*/ 62 | /* --- CR Register ---*/ 63 | 64 | /* Alias word address of ODEN bit */ 65 | #define ODEN_BitNumber 0x10 66 | #define CR_ODEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODEN_BitNumber * 4)) 67 | 68 | /* Alias word address of ODSWEN bit */ 69 | #define ODSWEN_BitNumber 0x11 70 | #define CR_ODSWEN_BB (PERIPH_BB_BASE + (CR_OFFSET * 32) + (ODSWEN_BitNumber * 4)) 71 | 72 | 73 | /** @defgroup PWREx_Over_Under_Drive_Flag 74 | * @{ 75 | */ 76 | #define PWR_FLAG_ODRDY PWR_CSR_ODRDY 77 | #define PWR_FLAG_ODSWRDY PWR_CSR_ODSWRDY 78 | #define PWR_FLAG_UDRDY PWR_CSR_UDSWRDY 79 | /** 80 | * @} 81 | */ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | 89 | /** @brief Macros to enable or disable the Over drive mode. 90 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. 91 | */ 92 | #define __HAL_PWR_OVERDRIVE_ENABLE() (*(__IO uint32_t *) CR_ODEN_BB = ENABLE) 93 | #define __HAL_PWR_OVERDRIVE_DISABLE() (*(__IO uint32_t *) CR_ODEN_BB = DISABLE) 94 | 95 | /** @brief Macros to enable or disable the Over drive switching. 96 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. 97 | */ 98 | #define __HAL_PWR_OVERDRIVESWITCHING_ENABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = ENABLE) 99 | #define __HAL_PWR_OVERDRIVESWITCHING_DISABLE() (*(__IO uint32_t *) CR_ODSWEN_BB = DISABLE) 100 | 101 | /** @brief Macros to enable or disable the Under drive mode. 102 | * @note This mode is enabled only with STOP low power mode. 103 | * In this mode, the 1.2V domain is preserved in reduced leakage mode. This 104 | * mode is only available when the main regulator or the low power regulator 105 | * is in low voltage mode. 106 | * @note If the Under-drive mode was enabled, it is automatically disabled after 107 | * exiting Stop mode. 108 | * When the voltage regulator operates in Under-drive mode, an additional 109 | * startup delay is induced when waking up from Stop mode. 110 | */ 111 | #define __HAL_PWR_UNDERDRIVE_ENABLE() (PWR->CR |= (uint32_t)PWR_CR_UDEN) 112 | #define __HAL_PWR_UNDERDRIVE_DISABLE() (PWR->CR &= (uint32_t)(~PWR_CR_UDEN)) 113 | 114 | /** @brief Check PWR flag is set or not. 115 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. 116 | * @param __FLAG__: specifies the flag to check. 117 | * This parameter can be one of the following values: 118 | * @arg PWR_FLAG_ODRDY: This flag indicates that the Over-drive mode 119 | * is ready 120 | * @arg PWR_FLAG_ODSWRDY: This flag indicates that the Over-drive mode 121 | * switching is ready 122 | * @arg PWR_FLAG_UDRDY: This flag indicates that the Under-drive mode 123 | * is enabled in Stop mode 124 | * @retval The new state of __FLAG__ (TRUE or FALSE). 125 | */ 126 | #define __HAL_PWR_GET_ODRUDR_FLAG(__FLAG__) ((PWR->CSR & (__FLAG__)) == (__FLAG__)) 127 | 128 | /** @brief Clear the Under-Drive Ready flag. 129 | * @note These macros can be used only for STM32F42xx/STM3243xx devices. 130 | */ 131 | #define __HAL_PWR_CLEAR_ODRUDR_FLAG() (PWR->CSR |= PWR_FLAG_UDRDY) 132 | 133 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 134 | 135 | /* Exported functions --------------------------------------------------------*/ 136 | void HAL_PWREx_EnableFlashPowerDown(void); 137 | void HAL_PWREx_DisableFlashPowerDown(void); 138 | HAL_StatusTypeDef HAL_PWREx_EnableBkUpReg(void); 139 | HAL_StatusTypeDef HAL_PWREx_DisableBkUpReg(void); 140 | 141 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 142 | HAL_StatusTypeDef HAL_PWREx_ActivateOverDrive(void); 143 | HAL_StatusTypeDef HAL_PWREx_DeactivateOverDrive(void); 144 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | #ifdef __cplusplus 155 | } 156 | #endif 157 | 158 | 159 | #endif /* __STM32F4xx_HAL_PWR_EX_H */ 160 | 161 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 162 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_rng.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_rng.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of RNG HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_RNG_H 40 | #define __STM32F4xx_HAL_RNG_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup RNG 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | 59 | /** 60 | * @brief RNG HAL State Structure definition 61 | */ 62 | typedef enum 63 | { 64 | HAL_RNG_STATE_RESET = 0x00, /*!< RNG not yet initialized or disabled */ 65 | HAL_RNG_STATE_READY = 0x01, /*!< RNG initialized and ready for use */ 66 | HAL_RNG_STATE_BUSY = 0x02, /*!< RNG internal process is ongoing */ 67 | HAL_RNG_STATE_TIMEOUT = 0x03, /*!< RNG timeout state */ 68 | HAL_RNG_STATE_ERROR = 0x04 /*!< RNG error state */ 69 | 70 | }HAL_RNG_StateTypeDef; 71 | 72 | /** 73 | * @brief RNG Handle Structure definition 74 | */ 75 | typedef struct 76 | { 77 | RNG_TypeDef *Instance; /*!< Register base address */ 78 | 79 | HAL_LockTypeDef Lock; /*!< RNG locking object */ 80 | 81 | __IO HAL_RNG_StateTypeDef State; /*!< RNG communication state */ 82 | 83 | }RNG_HandleTypeDef; 84 | 85 | /* Exported constants --------------------------------------------------------*/ 86 | 87 | /** @defgroup RNG_Exported_Constants 88 | * @{ 89 | */ 90 | 91 | /** @defgroup RNG_Interrupt_definition 92 | * @{ 93 | */ 94 | #define RNG_IT_CEI ((uint32_t)0x20) /*!< Clock error interrupt */ 95 | #define RNG_IT_SEI ((uint32_t)0x40) /*!< Seed error interrupt */ 96 | 97 | #define IS_RNG_IT(IT) (((IT) == RNG_IT_CEI) || \ 98 | ((IT) == RNG_IT_SEI)) 99 | /** 100 | * @} 101 | */ 102 | 103 | 104 | /** @defgroup RNG_Flag_definition 105 | * @{ 106 | */ 107 | #define RNG_FLAG_DRDY ((uint32_t)0x0001) /*!< Data ready */ 108 | #define RNG_FLAG_CECS ((uint32_t)0x0002) /*!< Clock error current status */ 109 | #define RNG_FLAG_SECS ((uint32_t)0x0004) /*!< Seed error current status */ 110 | 111 | #define IS_RNG_FLAG(FLAG) (((FLAG) == RNG_FLAG_DRDY) || \ 112 | ((FLAG) == RNG_FLAG_CECS) || \ 113 | ((FLAG) == RNG_FLAG_SECS)) 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /* Exported macro ------------------------------------------------------------*/ 123 | 124 | /** 125 | * @brief Enables the RNG peripheral. 126 | * @param __HANDLE__: RNG Handle 127 | * @retval None 128 | */ 129 | #define __HAL_RNG_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_RNGEN) 130 | 131 | /** 132 | * @brief Disables the RNG peripheral. 133 | * @param __HANDLE__: RNG Handle 134 | * @retval None 135 | */ 136 | #define __HAL_RNG_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_RNGEN) 137 | 138 | /** 139 | * @brief Gets the selected RNG's flag status. 140 | * @param __HANDLE__: RNG Handle 141 | * @param __FLAG__: RNG flag 142 | * @retval The new state of RNG_FLAG (SET or RESET). 143 | */ 144 | #define __HAL_RNG_GET_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR & (__FLAG__)) == (__FLAG__)) 145 | 146 | /** 147 | * @brief Clears the RNG's pending flags. 148 | * @param __HANDLE__: RNG Handle 149 | * @param __FLAG__: RNG flag 150 | * @retval None 151 | */ 152 | #define __HAL_RNG_CLEAR_FLAG(__HANDLE__, __FLAG__) (((__HANDLE__)->Instance->SR) &= ~(__FLAG__)) 153 | 154 | /** 155 | * @brief Enables the RNG interrupts. 156 | * @param __HANDLE__: RNG Handle 157 | * @retval None 158 | */ 159 | #define __HAL_RNG_ENABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR |= RNG_CR_IE) 160 | 161 | /** 162 | * @brief Disables the RNG interrupts. 163 | * @param __HANDLE__: RNG Handle 164 | * @retval None 165 | */ 166 | #define __HAL_RNG_DISABLE_IT(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~RNG_CR_IE) 167 | 168 | /** 169 | * @brief Checks whether the specified RNG interrupt has occurred or not. 170 | * @param __HANDLE__: RNG Handle 171 | * @param __INTERRUPT__: specifies the RNG interrupt source to check. 172 | * This parameter can be one of the following values: 173 | * @arg RNG_FLAG_DRDY: Data ready interrupt 174 | * @arg RNG_FLAG_CECS: Clock error interrupt 175 | * @arg RNG_FLAG_SECS: Seed error interrupt 176 | * @retval The new state of RNG_FLAG (SET or RESET). 177 | */ 178 | #define __HAL_RNG_GET_IT(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->SR & (__INTERRUPT__)) == (__INTERRUPT__)) 179 | 180 | /* Exported functions --------------------------------------------------------*/ 181 | 182 | /* Initialization/de-initialization functions **********************************/ 183 | HAL_StatusTypeDef HAL_RNG_Init(RNG_HandleTypeDef *hrng); 184 | HAL_StatusTypeDef HAL_RNG_DeInit (RNG_HandleTypeDef *hrng); 185 | void HAL_RNG_MspInit(RNG_HandleTypeDef *hrng); 186 | void HAL_RNG_MspDeInit(RNG_HandleTypeDef *hrng); 187 | 188 | /* Peripheral Control functions ************************************************/ 189 | uint32_t HAL_RNG_GetRandomNumber(RNG_HandleTypeDef *hrng); 190 | uint32_t HAL_RNG_GetRandomNumber_IT(RNG_HandleTypeDef *hrng); 191 | void HAL_RNG_IRQHandler(RNG_HandleTypeDef *hrng); 192 | void HAL_RNG_ReadyCallback(RNG_HandleTypeDef* hrng); 193 | void HAL_RNG_ErrorCallback(RNG_HandleTypeDef *hrng); 194 | 195 | /* Peripheral State functions **************************************************/ 196 | HAL_RNG_StateTypeDef HAL_RNG_GetState(RNG_HandleTypeDef *hrng); 197 | 198 | /** 199 | * @} 200 | */ 201 | 202 | /** 203 | * @} 204 | */ 205 | 206 | #ifdef __cplusplus 207 | } 208 | #endif 209 | 210 | #endif /* __STM32F4xx_HAL_RNG_H */ 211 | 212 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 213 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_sdram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_sdram.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of SDRAM HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_SDRAM_H 40 | #define __STM32F4xx_HAL_SDRAM_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 47 | 48 | /* Includes ------------------------------------------------------------------*/ 49 | #include "stm32f4xx_ll_fmc.h" 50 | 51 | /** @addtogroup STM32F4xx_HAL_Driver 52 | * @{ 53 | */ 54 | 55 | /** @addtogroup SDRAM 56 | * @{ 57 | */ 58 | 59 | /* Exported typedef ----------------------------------------------------------*/ 60 | 61 | /** 62 | * @brief HAL SDRAM State structure definition 63 | */ 64 | typedef enum 65 | { 66 | HAL_SDRAM_STATE_RESET = 0x00, /*!< SDRAM not yet initialized or disabled */ 67 | HAL_SDRAM_STATE_READY = 0x01, /*!< SDRAM initialized and ready for use */ 68 | HAL_SDRAM_STATE_BUSY = 0x02, /*!< SDRAM internal process is ongoing */ 69 | HAL_SDRAM_STATE_ERROR = 0x03, /*!< SDRAM error state */ 70 | HAL_SDRAM_STATE_WRITE_PROTECTED = 0x04, /*!< SDRAM device write protected */ 71 | HAL_SDRAM_STATE_PRECHARGED = 0x05 /*!< SDRAM device precharged */ 72 | 73 | }HAL_SDRAM_StateTypeDef; 74 | 75 | /** 76 | * @brief SDRAM handle Structure definition 77 | */ 78 | typedef struct 79 | { 80 | FMC_SDRAM_TypeDef *Instance; /*!< Register base address */ 81 | 82 | FMC_SDRAM_InitTypeDef Init; /*!< SDRAM device configuration parameters */ 83 | 84 | __IO HAL_SDRAM_StateTypeDef State; /*!< SDRAM access state */ 85 | 86 | HAL_LockTypeDef Lock; /*!< SDRAM locking object */ 87 | 88 | DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ 89 | 90 | }SDRAM_HandleTypeDef; 91 | 92 | /* Exported types ------------------------------------------------------------*/ 93 | /* Exported macro ------------------------------------------------------------*/ 94 | /* Exported functions --------------------------------------------------------*/ 95 | 96 | /* Initialization/de-initialization functions **********************************/ 97 | HAL_StatusTypeDef HAL_SDRAM_Init(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_TimingTypeDef *Timing); 98 | HAL_StatusTypeDef HAL_SDRAM_DeInit(SDRAM_HandleTypeDef *hsdram); 99 | void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram); 100 | void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram); 101 | 102 | void HAL_SDRAM_IRQHandler(SDRAM_HandleTypeDef *hsdram); 103 | void HAL_SDRAM_RefreshErrorCallback(SDRAM_HandleTypeDef *hsdram); 104 | void HAL_SDRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); 105 | void HAL_SDRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); 106 | 107 | /* I/O operation functions *****************************************************/ 108 | HAL_StatusTypeDef HAL_SDRAM_Read_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); 109 | HAL_StatusTypeDef HAL_SDRAM_Write_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); 110 | HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); 111 | HAL_StatusTypeDef HAL_SDRAM_Write_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); 112 | HAL_StatusTypeDef HAL_SDRAM_Read_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 113 | HAL_StatusTypeDef HAL_SDRAM_Write_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 114 | 115 | HAL_StatusTypeDef HAL_SDRAM_Read_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t * pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 116 | HAL_StatusTypeDef HAL_SDRAM_Write_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 117 | 118 | /* SDRAM Control functions *****************************************************/ 119 | HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram); 120 | HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram); 121 | HAL_StatusTypeDef HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout); 122 | HAL_StatusTypeDef HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram, uint32_t RefreshRate); 123 | HAL_StatusTypeDef HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram, uint32_t AutoRefreshNumber); 124 | uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram); 125 | 126 | /* SDRAM State functions ********************************************************/ 127 | HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram); 128 | 129 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 130 | /** 131 | * @} 132 | */ 133 | 134 | /** 135 | * @} 136 | */ 137 | 138 | #ifdef __cplusplus 139 | } 140 | #endif 141 | 142 | #endif /* __STM32F4xx_HAL_SDRAM_H */ 143 | 144 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 145 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/inc/stm32f4xx_hal_sram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_sram.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief Header file of SRAM HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_SRAM_H 40 | #define __STM32F4xx_HAL_SRAM_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx)|| defined(STM32F417xx) 48 | #include "stm32f4xx_ll_fsmc.h" 49 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx */ 50 | 51 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) 52 | #include "stm32f4xx_ll_fmc.h" 53 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 54 | 55 | 56 | /** @addtogroup STM32F4xx_HAL_Driver 57 | * @{ 58 | */ 59 | 60 | /** @addtogroup SRAM 61 | * @{ 62 | */ 63 | 64 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 65 | 66 | /* Exported typedef ----------------------------------------------------------*/ 67 | 68 | /** 69 | * @brief HAL SRAM State structures definition 70 | */ 71 | typedef enum 72 | { 73 | HAL_SRAM_STATE_RESET = 0x00, /*!< SRAM not yet initialized or disabled */ 74 | HAL_SRAM_STATE_READY = 0x01, /*!< SRAM initialized and ready for use */ 75 | HAL_SRAM_STATE_BUSY = 0x02, /*!< SRAM internal process is ongoing */ 76 | HAL_SRAM_STATE_ERROR = 0x03, /*!< SRAM error state */ 77 | HAL_SRAM_STATE_PROTECTED = 0x04 /*!< SRAM peripheral NORSRAM device write protected */ 78 | 79 | }HAL_SRAM_StateTypeDef; 80 | 81 | /** 82 | * @brief SRAM handle Structure definition 83 | */ 84 | typedef struct 85 | { 86 | FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ 87 | 88 | FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ 89 | 90 | FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */ 91 | 92 | HAL_LockTypeDef Lock; /*!< SRAM locking object */ 93 | 94 | __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */ 95 | 96 | DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ 97 | 98 | }SRAM_HandleTypeDef; 99 | 100 | /* Exported constants --------------------------------------------------------*/ 101 | /* Exported macro ------------------------------------------------------------*/ 102 | /* Exported functions --------------------------------------------------------*/ 103 | 104 | /* Initialization/de-initialization functions **********************************/ 105 | HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming); 106 | HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram); 107 | void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram); 108 | void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram); 109 | 110 | /* I/O operation functions *****************************************************/ 111 | HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); 112 | HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); 113 | HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); 114 | HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); 115 | HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 116 | HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 117 | HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 118 | HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 119 | 120 | void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); 121 | void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); 122 | 123 | /* SRAM Control functions ******************************************************/ 124 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram); 125 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram); 126 | 127 | /* SRAM State functions *********************************************************/ 128 | HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram); 129 | 130 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx */ 131 | /** 132 | * @} 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | #ifdef __cplusplus 140 | } 141 | #endif 142 | 143 | #endif /* __STM32F4xx_HAL_SRAM_H */ 144 | 145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 146 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/src/stm32f4xx_hal_i2c_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_i2c_ex.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief I2C Extension HAL module driver. 8 | * This file provides firmware functions to manage the following 9 | * functionalities of I2C extension peripheral: 10 | * + Extension features functions 11 | * 12 | @verbatim 13 | ============================================================================== 14 | ##### I2C peripheral extension features ##### 15 | ============================================================================== 16 | 17 | [..] Comparing to other previous devices, the I2C interface for STM32F427X and 18 | STM32F429X devices contains the following additional features 19 | 20 | (+) Possibility to disable or enable Analog Noise Filter 21 | (+) Use of a configured Digital Noise Filter 22 | 23 | ##### How to use this driver ##### 24 | ============================================================================== 25 | [..] This driver provides functions to configure Noise Filter 26 | (#) Configure I2C Analog noise filter using the function HAL_I2C_AnalogFilter_Config() 27 | (#) Configure I2C Digital noise filter using the function HAL_I2C_DigitalFilter_Config() 28 | 29 | @endverbatim 30 | ****************************************************************************** 31 | * @attention 32 | * 33 | *

© COPYRIGHT(c) 2014 STMicroelectronics

34 | * 35 | * Redistribution and use in source and binary forms, with or without modification, 36 | * are permitted provided that the following conditions are met: 37 | * 1. Redistributions of source code must retain the above copyright notice, 38 | * this list of conditions and the following disclaimer. 39 | * 2. Redistributions in binary form must reproduce the above copyright notice, 40 | * this list of conditions and the following disclaimer in the documentation 41 | * and/or other materials provided with the distribution. 42 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 43 | * may be used to endorse or promote products derived from this software 44 | * without specific prior written permission. 45 | * 46 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 47 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 48 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 49 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 50 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 51 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 52 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 53 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 54 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 55 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 56 | * 57 | ****************************************************************************** 58 | */ 59 | 60 | /* Includes ------------------------------------------------------------------*/ 61 | #include "stm32f4xx_hal.h" 62 | 63 | /** @addtogroup STM32F4xx_HAL_Driver 64 | * @{ 65 | */ 66 | 67 | /** @defgroup I2CEx 68 | * @brief I2C HAL module driver 69 | * @{ 70 | */ 71 | 72 | #ifdef HAL_I2C_MODULE_ENABLED 73 | 74 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx)|| defined(STM32F439xx) || defined(STM32F401xC) || defined(STM32F401xE) 75 | /* Private typedef -----------------------------------------------------------*/ 76 | /* Private define ------------------------------------------------------------*/ 77 | /* Private macro -------------------------------------------------------------*/ 78 | /* Private variables ---------------------------------------------------------*/ 79 | /* Private function prototypes -----------------------------------------------*/ 80 | /* Private functions ---------------------------------------------------------*/ 81 | 82 | /** @defgroup I2CEx_Private_Functions 83 | * @{ 84 | */ 85 | 86 | 87 | /** @defgroup I2CEx_Group1 Extension features functions 88 | * @brief Extension features functions 89 | * 90 | @verbatim 91 | =============================================================================== 92 | ##### Extension features functions ##### 93 | =============================================================================== 94 | [..] This section provides functions allowing to: 95 | (+) Configure Noise Filters 96 | 97 | @endverbatim 98 | * @{ 99 | */ 100 | 101 | /** 102 | * @brief Configures I2C Analog noise filter. 103 | * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains 104 | * the configuration information for the specified I2Cx peripheral. 105 | * @param AnalogFilter : new state of the Analog filter. 106 | * @retval HAL status 107 | */ 108 | HAL_StatusTypeDef HAL_I2CEx_AnalogFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter) 109 | { 110 | uint32_t tmp = 0; 111 | 112 | /* Check the parameters */ 113 | assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); 114 | assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter)); 115 | 116 | tmp = hi2c->State; 117 | if((tmp == HAL_I2C_STATE_BUSY) || (tmp == HAL_I2C_STATE_BUSY_TX) || (tmp == HAL_I2C_STATE_BUSY_RX)) 118 | { 119 | return HAL_BUSY; 120 | } 121 | 122 | hi2c->State = HAL_I2C_STATE_BUSY; 123 | 124 | /* Disable the selected I2C peripheral */ 125 | __HAL_I2C_DISABLE(hi2c); 126 | 127 | /* Reset I2Cx ANOFF bit */ 128 | hi2c->Instance->FLTR &= ~(I2C_FLTR_ANOFF); 129 | 130 | /* Disable the analog filter */ 131 | hi2c->Instance->FLTR |= AnalogFilter; 132 | 133 | __HAL_I2C_ENABLE(hi2c); 134 | 135 | hi2c->State = HAL_I2C_STATE_READY; 136 | 137 | return HAL_OK; 138 | } 139 | 140 | /** 141 | * @brief Configures I2C Digital noise filter. 142 | * @param hi2c : pointer to a I2C_HandleTypeDef structure that contains 143 | * the configuration information for the specified I2Cx peripheral. 144 | * @param DigitalFilter : Coefficient of digital noise filter between 0x00 and 0x0F. 145 | * @retval HAL status 146 | */ 147 | HAL_StatusTypeDef HAL_I2CEx_DigitalFilter_Config(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter) 148 | { 149 | uint16_t tmpreg = 0; 150 | uint32_t tmp = 0; 151 | 152 | /* Check the parameters */ 153 | assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance)); 154 | assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter)); 155 | 156 | tmp = hi2c->State; 157 | if((tmp == HAL_I2C_STATE_BUSY) || (tmp == HAL_I2C_STATE_BUSY_TX) || (tmp == HAL_I2C_STATE_BUSY_RX)) 158 | { 159 | return HAL_BUSY; 160 | } 161 | 162 | hi2c->State = HAL_I2C_STATE_BUSY; 163 | 164 | /* Disable the selected I2C peripheral */ 165 | __HAL_I2C_DISABLE(hi2c); 166 | 167 | /* Get the old register value */ 168 | tmpreg = hi2c->Instance->FLTR; 169 | 170 | /* Reset I2Cx DNF bit [3:0] */ 171 | tmpreg &= ~(I2C_FLTR_DNF); 172 | 173 | /* Set I2Cx DNF coefficient */ 174 | tmpreg |= DigitalFilter; 175 | 176 | /* Store the new register value */ 177 | hi2c->Instance->FLTR = tmpreg; 178 | 179 | __HAL_I2C_ENABLE(hi2c); 180 | 181 | hi2c->State = HAL_I2C_STATE_READY; 182 | 183 | return HAL_OK; 184 | } 185 | 186 | /** 187 | * @} 188 | */ 189 | 190 | /** 191 | * @} 192 | */ 193 | #endif /* STM32F427xx || STM32F429xx || STM32F437xx || STM32F439xx || STM32F401xC || STM32F401xE */ 194 | 195 | #endif /* HAL_I2C_MODULE_ENABLED */ 196 | /** 197 | * @} 198 | */ 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 205 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/src/stm32f4xx_hal_msp_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_msp_template.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 18-February-2014 7 | * @brief HAL MSP module. 8 | * This file template is located in the HAL folder and should be copied 9 | * to the user folder. 10 | * 11 | @verbatim 12 | =============================================================================== 13 | ##### How to use this driver ##### 14 | =============================================================================== 15 | [..] 16 | This file is generated automatically by MicroXplorer and eventually modified 17 | by the user 18 | 19 | @endverbatim 20 | ****************************************************************************** 21 | * @attention 22 | * 23 | *

© COPYRIGHT(c) 2014 STMicroelectronics

24 | * 25 | * Redistribution and use in source and binary forms, with or without modification, 26 | * are permitted provided that the following conditions are met: 27 | * 1. Redistributions of source code must retain the above copyright notice, 28 | * this list of conditions and the following disclaimer. 29 | * 2. Redistributions in binary form must reproduce the above copyright notice, 30 | * this list of conditions and the following disclaimer in the documentation 31 | * and/or other materials provided with the distribution. 32 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 33 | * may be used to endorse or promote products derived from this software 34 | * without specific prior written permission. 35 | * 36 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 37 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 38 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 39 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 40 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 41 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 42 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 43 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 44 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 45 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 46 | * 47 | ****************************************************************************** 48 | */ 49 | 50 | /* Includes ------------------------------------------------------------------*/ 51 | #include "stm32f4xx_hal.h" 52 | 53 | /** @addtogroup STM32F4xx_HAL_Driver 54 | * @{ 55 | */ 56 | 57 | /** @defgroup HAL_MSP 58 | * @brief HAL MSP module. 59 | * @{ 60 | */ 61 | 62 | /* Private typedef -----------------------------------------------------------*/ 63 | /* Private define ------------------------------------------------------------*/ 64 | /* Private macro -------------------------------------------------------------*/ 65 | /* Private variables ---------------------------------------------------------*/ 66 | /* Private function prototypes -----------------------------------------------*/ 67 | /* Private functions ---------------------------------------------------------*/ 68 | 69 | /** @defgroup HAL_MSP_Private_Functions 70 | * @{ 71 | */ 72 | 73 | /** 74 | * @brief Initializes the Global MSP. 75 | * @param None 76 | * @retval None 77 | */ 78 | void HAL_MspInit(void) 79 | { 80 | /* NOTE : This function is generated automatically by MicroXplorer and eventually 81 | modified by the user 82 | */ 83 | } 84 | 85 | /** 86 | * @brief DeInitializes the Global MSP. 87 | * @param None 88 | * @retval None 89 | */ 90 | void HAL_MspDeInit(void) 91 | { 92 | /* NOTE : This function is generated automatically by MicroXplorer and eventually 93 | modified by the user 94 | */ 95 | } 96 | 97 | /** 98 | * @brief Initializes the PPP MSP. 99 | * @param None 100 | * @retval None 101 | */ 102 | void HAL_PPP_MspInit(void) 103 | { 104 | /* NOTE : This function is generated automatically by MicroXplorer and eventually 105 | modified by the user 106 | */ 107 | } 108 | 109 | /** 110 | * @brief DeInitializes the PPP MSP. 111 | * @param None 112 | * @retval None 113 | */ 114 | void HAL_PPP_MspDeInit(void) 115 | { 116 | /* NOTE : This function is generated automatically by MicroXplorer and eventually 117 | modified by the user 118 | */ 119 | } 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 134 | -------------------------------------------------------------------------------- /stm/stm32f4_spl/src/stm32f4xx_hal_rcc_ex.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/stm/stm32f4_spl/src/stm32f4xx_hal_rcc_ex.c -------------------------------------------------------------------------------- /stm/stm32f4_spl/src/stm32f4xx_hal_wwdg.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/gkostka/stm32f429disco-lwext4/23b1d1ff8073befd62328409cc01bbab5d82dd6d/stm/stm32f4_spl/src/stm32f4xx_hal_wwdg.c -------------------------------------------------------------------------------- /stm/usb_host/Class/MSC/inc/usbh_msc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_msc.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief This file contains all the prototypes for the usbh_msc_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_MSC_H 30 | #define __USBH_MSC_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | #include "usbh_msc_bot.h" 35 | #include "usbh_msc_scsi.h" 36 | 37 | /** @addtogroup USBH_LIB 38 | * @{ 39 | */ 40 | 41 | /** @addtogroup USBH_CLASS 42 | * @{ 43 | */ 44 | 45 | /** @addtogroup USBH_MSC_CLASS 46 | * @{ 47 | */ 48 | 49 | /** @defgroup USBH_MSC_CORE 50 | * @brief This file is the Header file for usbh_msc_core.c 51 | * @{ 52 | */ 53 | 54 | 55 | /** @defgroup USBH_MSC_CORE_Exported_Types 56 | * @{ 57 | */ 58 | 59 | typedef enum 60 | { 61 | MSC_INIT = 0, 62 | MSC_IDLE, 63 | MSC_TEST_UNIT_READY, 64 | MSC_READ_CAPACITY10, 65 | MSC_READ_INQUIRY, 66 | MSC_REQUEST_SENSE, 67 | MSC_READ, 68 | MSC_WRITE, 69 | MSC_UNRECOVERED_ERROR, 70 | MSC_PERIODIC_CHECK, 71 | } 72 | MSC_StateTypeDef; 73 | 74 | typedef enum 75 | { 76 | MSC_OK, 77 | MSC_NOT_READY, 78 | MSC_ERROR, 79 | 80 | } 81 | MSC_ErrorTypeDef; 82 | 83 | typedef enum 84 | { 85 | MSC_REQ_IDLE = 0, 86 | MSC_REQ_RESET, 87 | MSC_REQ_GET_MAX_LUN, 88 | MSC_REQ_ERROR, 89 | } 90 | MSC_ReqStateTypeDef; 91 | 92 | #define MAX_SUPPORTED_LUN 2 93 | 94 | /* Structure for LUN */ 95 | typedef struct 96 | { 97 | MSC_StateTypeDef state; 98 | MSC_ErrorTypeDef error; 99 | USBH_StatusTypeDef prev_ready_state; 100 | SCSI_CapacityTypeDef capacity; 101 | SCSI_SenseTypeDef sense; 102 | SCSI_StdInquiryDataTypeDef inquiry; 103 | uint8_t state_changed; 104 | 105 | } 106 | MSC_LUNTypeDef; 107 | 108 | /* Structure for MSC process */ 109 | typedef struct _MSC_Process 110 | { 111 | uint32_t max_lun; 112 | uint8_t InPipe; 113 | uint8_t OutPipe; 114 | uint8_t OutEp; 115 | uint8_t InEp; 116 | uint16_t OutEpSize; 117 | uint16_t InEpSize; 118 | MSC_StateTypeDef state; 119 | MSC_ErrorTypeDef error; 120 | MSC_ReqStateTypeDef req_state; 121 | MSC_ReqStateTypeDef prev_req_state; 122 | BOT_HandleTypeDef hbot; 123 | MSC_LUNTypeDef unit[MAX_SUPPORTED_LUN]; 124 | uint16_t current_lun; 125 | uint16_t rw_lun; 126 | uint32_t timer; 127 | } 128 | MSC_HandleTypeDef; 129 | 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | 136 | 137 | /** @defgroup USBH_MSC_CORE_Exported_Defines 138 | * @{ 139 | */ 140 | 141 | #define USB_REQ_BOT_RESET 0xFF 142 | #define USB_REQ_GET_MAX_LUN 0xFE 143 | 144 | 145 | /* MSC Class Codes */ 146 | #define USB_MSC_CLASS 0x08 147 | 148 | /* Interface Descriptor field values for HID Boot Protocol */ 149 | #define MSC_BOT 0x50 150 | #define MSC_TRANSPARENT 0x06 151 | /** 152 | * @} 153 | */ 154 | 155 | /** @defgroup USBH_MSC_CORE_Exported_Macros 156 | * @{ 157 | */ 158 | /** 159 | * @} 160 | */ 161 | 162 | /** @defgroup USBH_MSC_CORE_Exported_Variables 163 | * @{ 164 | */ 165 | extern USBH_ClassTypeDef USBH_msc; 166 | #define USBH_MSC_CLASS &USBH_msc 167 | 168 | /** 169 | * @} 170 | */ 171 | 172 | /** @defgroup USBH_MSC_CORE_Exported_FunctionsPrototype 173 | * @{ 174 | */ 175 | 176 | /* Common APIs */ 177 | uint8_t USBH_MSC_IsReady (USBH_HandleTypeDef *phost); 178 | 179 | /* APIs for LUN */ 180 | int8_t USBH_MSC_GetMaxLUN (USBH_HandleTypeDef *phost); 181 | 182 | uint8_t USBH_MSC_UnitIsReady (USBH_HandleTypeDef *phost, uint8_t lun); 183 | 184 | USBH_StatusTypeDef USBH_MSC_GetLUNInfo(USBH_HandleTypeDef *phost, uint8_t lun, MSC_LUNTypeDef *info); 185 | 186 | USBH_StatusTypeDef USBH_MSC_Read(USBH_HandleTypeDef *phost, 187 | uint8_t lun, 188 | uint32_t address, 189 | uint8_t *pbuf, 190 | uint32_t length); 191 | 192 | USBH_StatusTypeDef USBH_MSC_Write(USBH_HandleTypeDef *phost, 193 | uint8_t lun, 194 | uint32_t address, 195 | uint8_t *pbuf, 196 | uint32_t length); 197 | /** 198 | * @} 199 | */ 200 | 201 | #endif /* __USBH_MSC_H */ 202 | 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | /** 209 | * @} 210 | */ 211 | 212 | /** 213 | * @} 214 | */ 215 | 216 | /** 217 | * @} 218 | */ 219 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 220 | 221 | 222 | 223 | -------------------------------------------------------------------------------- /stm/usb_host/Class/MSC/inc/usbh_msc_bot.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_msc_bot.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_msc_bot.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_MSC_BOT_H__ 30 | #define __USBH_MSC_BOT_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | #include "usbh_msc_bot.h" 35 | 36 | /** @addtogroup USBH_LIB 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup USBH_MSC_CLASS 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_MSC_BOT 49 | * @brief This file is the Header file for usbh_msc_core.c 50 | * @{ 51 | */ 52 | 53 | 54 | /** @defgroup USBH_MSC_BOT_Exported_Types 55 | * @{ 56 | */ 57 | 58 | typedef enum { 59 | BOT_OK = 0, 60 | BOT_FAIL = 1, 61 | BOT_PHASE_ERROR = 2, 62 | BOT_BUSY = 3 63 | } 64 | BOT_StatusTypeDef; 65 | 66 | typedef enum { 67 | BOT_CMD_IDLE = 0, 68 | BOT_CMD_SEND, 69 | BOT_CMD_WAIT, 70 | } 71 | BOT_CMDStateTypeDef; 72 | 73 | /* CSW Status Definitions */ 74 | typedef enum 75 | { 76 | 77 | BOT_CSW_CMD_PASSED = 0x00, 78 | BOT_CSW_CMD_FAILED = 0x01, 79 | BOT_CSW_PHASE_ERROR = 0x02, 80 | } 81 | BOT_CSWStatusTypeDef; 82 | 83 | typedef enum { 84 | BOT_SEND_CBW = 1, 85 | BOT_SEND_CBW_WAIT, 86 | BOT_DATA_IN, 87 | BOT_DATA_IN_WAIT, 88 | BOT_DATA_OUT, 89 | BOT_DATA_OUT_WAIT, 90 | BOT_RECEIVE_CSW, 91 | BOT_RECEIVE_CSW_WAIT, 92 | BOT_ERROR_IN, 93 | BOT_ERROR_OUT, 94 | BOT_UNRECOVERED_ERROR 95 | } 96 | BOT_StateTypeDef; 97 | 98 | typedef union 99 | { 100 | struct __CBW 101 | { 102 | uint32_t Signature; 103 | uint32_t Tag; 104 | uint32_t DataTransferLength; 105 | uint8_t Flags; 106 | uint8_t LUN; 107 | uint8_t CBLength; 108 | uint8_t CB[16]; 109 | }field; 110 | uint8_t data[31]; 111 | } 112 | BOT_CBWTypeDef; 113 | 114 | typedef union 115 | { 116 | struct __CSW 117 | { 118 | uint32_t Signature; 119 | uint32_t Tag; 120 | uint32_t DataResidue; 121 | uint8_t Status; 122 | }field; 123 | uint8_t data[13]; 124 | } 125 | BOT_CSWTypeDef; 126 | 127 | typedef struct 128 | { 129 | uint32_t data[16]; 130 | BOT_StateTypeDef state; 131 | BOT_StateTypeDef prev_state; 132 | BOT_CMDStateTypeDef cmd_state; 133 | BOT_CBWTypeDef cbw; 134 | uint8_t Reserved1; 135 | BOT_CSWTypeDef csw; 136 | uint8_t Reserved2[3]; 137 | uint8_t *pbuf; 138 | } 139 | BOT_HandleTypeDef; 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | 146 | 147 | /** @defgroup USBH_MSC_BOT_Exported_Defines 148 | * @{ 149 | */ 150 | #define BOT_CBW_SIGNATURE 0x43425355 151 | #define BOT_CBW_TAG 0x20304050 152 | #define BOT_CSW_SIGNATURE 0x53425355 153 | #define BOT_CBW_LENGTH 31 154 | #define BOT_CSW_LENGTH 13 155 | 156 | 157 | 158 | #define BOT_SEND_CSW_DISABLE 0 159 | #define BOT_SEND_CSW_ENABLE 1 160 | 161 | #define BOT_DIR_IN 0 162 | #define BOT_DIR_OUT 1 163 | #define BOT_DIR_BOTH 2 164 | 165 | #define BOT_PAGE_LENGTH 512 166 | 167 | 168 | #define BOT_CBW_CB_LENGTH 16 169 | 170 | 171 | #define USB_REQ_BOT_RESET 0xFF 172 | #define USB_REQ_GET_MAX_LUN 0xFE 173 | 174 | #define MAX_BULK_STALL_COUNT_LIMIT 0x04 /* If STALL is seen on Bulk 175 | Endpoint continously, this means 176 | that device and Host has phase error 177 | Hence a Reset is needed */ 178 | 179 | /** 180 | * @} 181 | */ 182 | 183 | /** @defgroup USBH_MSC_BOT_Exported_Macros 184 | * @{ 185 | */ 186 | /** 187 | * @} 188 | */ 189 | 190 | /** @defgroup USBH_MSC_BOT_Exported_Variables 191 | * @{ 192 | */ 193 | 194 | /** 195 | * @} 196 | */ 197 | 198 | /** @defgroup USBH_MSC_BOT_Exported_FunctionsPrototype 199 | * @{ 200 | */ 201 | USBH_StatusTypeDef USBH_MSC_BOT_REQ_Reset(USBH_HandleTypeDef *phost); 202 | USBH_StatusTypeDef USBH_MSC_BOT_REQ_GetMaxLUN(USBH_HandleTypeDef *phost, uint8_t *Maxlun); 203 | 204 | USBH_StatusTypeDef USBH_MSC_BOT_Init(USBH_HandleTypeDef *phost); 205 | USBH_StatusTypeDef USBH_MSC_BOT_Process (USBH_HandleTypeDef *phost, uint8_t lun); 206 | USBH_StatusTypeDef USBH_MSC_BOT_Error(USBH_HandleTypeDef *phost, uint8_t lun); 207 | 208 | 209 | 210 | /** 211 | * @} 212 | */ 213 | 214 | #endif //__USBH_MSC_BOT_H__ 215 | 216 | 217 | /** 218 | * @} 219 | */ 220 | 221 | /** 222 | * @} 223 | */ 224 | 225 | /** 226 | * @} 227 | */ 228 | 229 | /** 230 | * @} 231 | */ 232 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 233 | 234 | -------------------------------------------------------------------------------- /stm/usb_host/Class/MSC/inc/usbh_msc_scsi.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_msc_scsi.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_msc_scsi.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_MSC_SCSI_H__ 30 | #define __USBH_MSC_SCSI_H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | 35 | 36 | /** @addtogroup USBH_LIB 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup USBH_MSC_CLASS 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_MSC_SCSI 49 | * @brief This file is the Header file for usbh_msc_scsi.c 50 | * @{ 51 | */ 52 | 53 | 54 | // Capacity data. 55 | typedef struct 56 | { 57 | uint32_t block_nbr; 58 | uint16_t block_size; 59 | } SCSI_CapacityTypeDef; 60 | 61 | 62 | // Sense data. 63 | typedef struct 64 | { 65 | uint8_t key; 66 | uint8_t asc; 67 | uint8_t ascq; 68 | } SCSI_SenseTypeDef; 69 | 70 | // INQUIRY data. 71 | typedef struct 72 | { 73 | uint8_t PeripheralQualifier; 74 | uint8_t DeviceType; 75 | uint8_t RemovableMedia; 76 | uint8_t vendor_id[9]; 77 | uint8_t product_id[17]; 78 | uint8_t revision_id[5]; 79 | }SCSI_StdInquiryDataTypeDef; 80 | 81 | /** @defgroup USBH_MSC_SCSI_Exported_Defines 82 | * @{ 83 | */ 84 | #define OPCODE_TEST_UNIT_READY 0x00 85 | #define OPCODE_READ_CAPACITY10 0x25 86 | #define OPCODE_READ10 0x28 87 | #define OPCODE_WRITE10 0x2A 88 | #define OPCODE_REQUEST_SENSE 0x03 89 | #define OPCODE_INQUIRY 0x12 90 | 91 | #define DATA_LEN_MODE_TEST_UNIT_READY 0 92 | #define DATA_LEN_READ_CAPACITY10 8 93 | #define DATA_LEN_INQUIRY 36 94 | #define DATA_LEN_REQUEST_SENSE 14 95 | 96 | #define CBW_CB_LENGTH 16 97 | #define CBW_LENGTH 10 98 | 99 | /** @defgroup USBH_MSC_SCSI_Exported_Defines 100 | * @{ 101 | */ 102 | #define SCSI_SENSE_KEY_NO_SENSE 0x00 103 | #define SCSI_SENSE_KEY_RECOVERED_ERROR 0x01 104 | #define SCSI_SENSE_KEY_NOT_READY 0x02 105 | #define SCSI_SENSE_KEY_MEDIUM_ERROR 0x03 106 | #define SCSI_SENSE_KEY_HARDWARE_ERROR 0x04 107 | #define SCSI_SENSE_KEY_ILLEGAL_REQUEST 0x05 108 | #define SCSI_SENSE_KEY_UNIT_ATTENTION 0x06 109 | #define SCSI_SENSE_KEY_DATA_PROTECT 0x07 110 | #define SCSI_SENSE_KEY_BLANK_CHECK 0x08 111 | #define SCSI_SENSE_KEY_VENDOR_SPECIFIC 0x09 112 | #define SCSI_SENSE_KEY_COPY_ABORTED 0x0A 113 | #define SCSI_SENSE_KEY_ABORTED_COMMAND 0x0B 114 | #define SCSI_SENSE_KEY_VOLUME_OVERFLOW 0x0D 115 | #define SCSI_SENSE_KEY_MISCOMPARE 0x0E 116 | /** 117 | * @} 118 | */ 119 | 120 | 121 | /** @defgroup USBH_MSC_SCSI_Exported_Defines 122 | * @{ 123 | */ 124 | #define SCSI_ASC_NO_ADDITIONAL_SENSE_INFORMATION 0x00 125 | #define SCSI_ASC_LOGICAL_UNIT_NOT_READY 0x04 126 | #define SCSI_ASC_INVALID_FIELD_IN_CDB 0x24 127 | #define SCSI_ASC_WRITE_PROTECTED 0x27 128 | #define SCSI_ASC_FORMAT_ERROR 0x31 129 | #define SCSI_ASC_INVALID_COMMAND_OPERATION_CODE 0x20 130 | #define SCSI_ASC_NOT_READY_TO_READY_CHANGE 0x28 131 | #define SCSI_ASC_MEDIUM_NOT_PRESENT 0x3A 132 | /** 133 | * @} 134 | */ 135 | 136 | 137 | /** @defgroup USBH_MSC_SCSI_Exported_Defines 138 | * @{ 139 | */ 140 | #define SCSI_ASCQ_FORMAT_COMMAND_FAILED 0x01 141 | #define SCSI_ASCQ_INITIALIZING_COMMAND_REQUIRED 0x02 142 | #define SCSI_ASCQ_OPERATION_IN_PROGRESS 0x07 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | /** @defgroup USBH_MSC_SCSI_Exported_Macros 149 | * @{ 150 | */ 151 | /** 152 | * @} 153 | */ 154 | 155 | /** @defgroup _Exported_Variables 156 | * @{ 157 | */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** @defgroup USBH_MSC_SCSI_Exported_FunctionsPrototype 164 | * @{ 165 | */ 166 | USBH_StatusTypeDef USBH_MSC_SCSI_TestUnitReady (USBH_HandleTypeDef *phost, 167 | uint8_t lun); 168 | 169 | USBH_StatusTypeDef USBH_MSC_SCSI_ReadCapacity (USBH_HandleTypeDef *phost, 170 | uint8_t lun, 171 | SCSI_CapacityTypeDef *capacity); 172 | 173 | USBH_StatusTypeDef USBH_MSC_SCSI_Inquiry (USBH_HandleTypeDef *phost, 174 | uint8_t lun, 175 | SCSI_StdInquiryDataTypeDef *inquiry); 176 | 177 | USBH_StatusTypeDef USBH_MSC_SCSI_RequestSense (USBH_HandleTypeDef *phost, 178 | uint8_t lun, 179 | SCSI_SenseTypeDef *sense_data); 180 | 181 | USBH_StatusTypeDef USBH_MSC_SCSI_Write(USBH_HandleTypeDef *phost, 182 | uint8_t lun, 183 | uint32_t address, 184 | uint8_t *pbuf, 185 | uint32_t length); 186 | 187 | USBH_StatusTypeDef USBH_MSC_SCSI_Read(USBH_HandleTypeDef *phost, 188 | uint8_t lun, 189 | uint32_t address, 190 | uint8_t *pbuf, 191 | uint32_t length); 192 | 193 | 194 | /** 195 | * @} 196 | */ 197 | 198 | #endif //__USBH_MSC_SCSI_H__ 199 | 200 | 201 | /** 202 | * @} 203 | */ 204 | 205 | /** 206 | * @} 207 | */ 208 | 209 | /** 210 | * @} 211 | */ 212 | 213 | /** 214 | * @} 215 | */ 216 | 217 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 218 | 219 | -------------------------------------------------------------------------------- /stm/usb_host/Core/inc/usbh_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_core.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_CORE_H 30 | #define __USBH_CORE_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_conf.h" 34 | #include "usbh_def.h" 35 | #include "usbh_ioreq.h" 36 | #include "usbh_pipes.h" 37 | #include "usbh_ctlreq.h" 38 | 39 | /** @addtogroup USBH_LIB 40 | * @{ 41 | */ 42 | 43 | /** @addtogroup USBH_LIB_CORE 44 | * @{ 45 | */ 46 | 47 | /** @defgroup USBH_CORE 48 | * @brief This file is the Header file for usbh_core.c 49 | * @{ 50 | */ 51 | 52 | 53 | /** @defgroup USBH_CORE_Exported_Defines 54 | * @{ 55 | */ 56 | 57 | /** 58 | * @} 59 | */ 60 | #define HOST_USER_SELECT_CONFIGURATION 1 61 | #define HOST_USER_CLASS_ACTIVE 2 62 | #define HOST_USER_CLASS_SELECTED 3 63 | #define HOST_USER_CONNECTION 4 64 | #define HOST_USER_DISCONNECTION 5 65 | 66 | 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | 73 | 74 | /** @defgroup USBH_CORE_Exported_Macros 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup USBH_CORE_Exported_Variables 83 | * @{ 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /** @defgroup USBH_CORE_Exported_FunctionsPrototype 91 | * @{ 92 | */ 93 | 94 | 95 | USBH_StatusTypeDef USBH_Init(USBH_HandleTypeDef *phost, void (*pUsrFunc)(USBH_HandleTypeDef *phost, uint8_t ), uint8_t id); 96 | USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost); 97 | USBH_StatusTypeDef USBH_RegisterClass(USBH_HandleTypeDef *phost, USBH_ClassTypeDef *pclass); 98 | USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface); 99 | uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost, 100 | uint8_t Class, 101 | uint8_t SubClass, 102 | uint8_t Protocol); 103 | uint8_t USBH_GetActiveClass(USBH_HandleTypeDef *phost); 104 | 105 | uint8_t USBH_FindInterfaceIndex(USBH_HandleTypeDef *phost, 106 | uint8_t interface_number, 107 | uint8_t alt_settings); 108 | 109 | USBH_StatusTypeDef USBH_Start (USBH_HandleTypeDef *phost); 110 | USBH_StatusTypeDef USBH_Stop (USBH_HandleTypeDef *phost); 111 | USBH_StatusTypeDef USBH_Process (USBH_HandleTypeDef *phost); 112 | USBH_StatusTypeDef USBH_ReEnumerate (USBH_HandleTypeDef *phost); 113 | 114 | /* USBH Low Level Driver */ 115 | USBH_StatusTypeDef USBH_LL_Init (USBH_HandleTypeDef *phost); 116 | USBH_StatusTypeDef USBH_LL_DeInit (USBH_HandleTypeDef *phost); 117 | USBH_StatusTypeDef USBH_LL_Start (USBH_HandleTypeDef *phost); 118 | USBH_StatusTypeDef USBH_LL_Stop (USBH_HandleTypeDef *phost); 119 | 120 | USBH_StatusTypeDef USBH_LL_Connect (USBH_HandleTypeDef *phost); 121 | USBH_StatusTypeDef USBH_LL_Disconnect (USBH_HandleTypeDef *phost); 122 | USBH_SpeedTypeDef USBH_LL_GetSpeed (USBH_HandleTypeDef *phost); 123 | USBH_StatusTypeDef USBH_LL_ResetPort (USBH_HandleTypeDef *phost); 124 | uint32_t USBH_LL_GetLastXferSize (USBH_HandleTypeDef *phost, uint8_t ); 125 | USBH_StatusTypeDef USBH_LL_DriverVBUS (USBH_HandleTypeDef *phost, uint8_t ); 126 | 127 | USBH_StatusTypeDef USBH_LL_OpenPipe (USBH_HandleTypeDef *phost, uint8_t, uint8_t, uint8_t, uint8_t , uint8_t, uint16_t ); 128 | USBH_StatusTypeDef USBH_LL_ClosePipe (USBH_HandleTypeDef *phost, uint8_t ); 129 | USBH_StatusTypeDef USBH_LL_SubmitURB (USBH_HandleTypeDef *phost, uint8_t, uint8_t,uint8_t, uint8_t, uint8_t*, uint16_t, uint8_t ); 130 | USBH_URBStateTypeDef USBH_LL_GetURBState (USBH_HandleTypeDef *phost, uint8_t ); 131 | #if (USBH_USE_OS == 1) 132 | USBH_StatusTypeDef USBH_LL_NotifyURBChange (USBH_HandleTypeDef *phost); 133 | #endif 134 | USBH_StatusTypeDef USBH_LL_SetToggle (USBH_HandleTypeDef *phost, uint8_t , uint8_t ); 135 | uint8_t USBH_LL_GetToggle (USBH_HandleTypeDef *phost, uint8_t ); 136 | 137 | /* USBH Time base */ 138 | void USBH_Delay (uint32_t Delay); 139 | void USBH_LL_SetTimer (USBH_HandleTypeDef *phost, uint32_t ); 140 | void USBH_LL_IncTimer (USBH_HandleTypeDef *phost); 141 | /** 142 | * @} 143 | */ 144 | 145 | #endif /* __CORE_H */ 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 159 | 160 | 161 | 162 | -------------------------------------------------------------------------------- /stm/usb_host/Core/inc/usbh_ctlreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_ctlreq.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_ctlreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_CTLREQ_H 30 | #define __USBH_CTLREQ_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | 35 | /** @addtogroup USBH_LIB 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup USBH_LIB_CORE 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_CTLREQ 44 | * @brief This file is the 45 | * @{ 46 | */ 47 | 48 | 49 | /** @defgroup USBH_CTLREQ_Exported_Defines 50 | * @{ 51 | */ 52 | /*Standard Feature Selector for clear feature command*/ 53 | #define FEATURE_SELECTOR_ENDPOINT 0X00 54 | #define FEATURE_SELECTOR_DEVICE 0X01 55 | 56 | 57 | #define INTERFACE_DESC_TYPE 0x04 58 | #define ENDPOINT_DESC_TYPE 0x05 59 | #define INTERFACE_DESC_SIZE 0x09 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USBH_CTLREQ_Exported_Types 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | 74 | /** @defgroup USBH_CTLREQ_Exported_Macros 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBH_CTLREQ_Exported_Variables 82 | * @{ 83 | */ 84 | extern uint8_t USBH_CfgDesc[512]; 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USBH_CTLREQ_Exported_FunctionsPrototype 90 | * @{ 91 | */ 92 | USBH_StatusTypeDef USBH_CtlReq (USBH_HandleTypeDef *phost, 93 | uint8_t *buff, 94 | uint16_t length); 95 | 96 | USBH_StatusTypeDef USBH_GetDescriptor(USBH_HandleTypeDef *phost, 97 | uint8_t req_type, 98 | uint16_t value_idx, 99 | uint8_t* buff, 100 | uint16_t length ); 101 | 102 | USBH_StatusTypeDef USBH_Get_DevDesc(USBH_HandleTypeDef *phost, 103 | uint8_t length); 104 | 105 | USBH_StatusTypeDef USBH_Get_StringDesc(USBH_HandleTypeDef *phost, 106 | uint8_t string_index, 107 | uint8_t *buff, 108 | uint16_t length); 109 | 110 | USBH_StatusTypeDef USBH_SetCfg(USBH_HandleTypeDef *phost, 111 | uint16_t configuration_value); 112 | 113 | USBH_StatusTypeDef USBH_Get_CfgDesc(USBH_HandleTypeDef *phost, 114 | uint16_t length); 115 | 116 | USBH_StatusTypeDef USBH_SetAddress(USBH_HandleTypeDef *phost, 117 | uint8_t DeviceAddress); 118 | 119 | USBH_StatusTypeDef USBH_SetInterface(USBH_HandleTypeDef *phost, 120 | uint8_t ep_num, uint8_t altSetting); 121 | 122 | USBH_StatusTypeDef USBH_ClrFeature(USBH_HandleTypeDef *phost, 123 | uint8_t ep_num); 124 | 125 | USBH_DescHeader_t *USBH_GetNextDesc (uint8_t *pbuf, 126 | uint16_t *ptr); 127 | /** 128 | * @} 129 | */ 130 | 131 | #endif /* __USBH_CTLREQ_H */ 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 146 | 147 | 148 | -------------------------------------------------------------------------------- /stm/usb_host/Core/inc/usbh_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_ioreq.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_ioreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_IOREQ_H 30 | #define __USBH_IOREQ_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_conf.h" 34 | #include "usbh_core.h" 35 | /** @addtogroup USBH_LIB 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup USBH_LIB_CORE 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_IOREQ 44 | * @brief This file is the header file for usbh_ioreq.c 45 | * @{ 46 | */ 47 | 48 | 49 | /** @defgroup USBH_IOREQ_Exported_Defines 50 | * @{ 51 | */ 52 | 53 | #define USBH_PID_SETUP 0 54 | #define USBH_PID_DATA 1 55 | 56 | #define USBH_EP_CONTROL 0 57 | #define USBH_EP_ISO 1 58 | #define USBH_EP_BULK 2 59 | #define USBH_EP_INTERRUPT 3 60 | 61 | #define USBH_SETUP_PKT_SIZE 8 62 | /** 63 | * @} 64 | */ 65 | 66 | 67 | /** @defgroup USBH_IOREQ_Exported_Types 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | /** @defgroup USBH_IOREQ_Exported_Macros 76 | * @{ 77 | */ 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup USBH_IOREQ_Exported_Variables 83 | * @{ 84 | */ 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USBH_IOREQ_Exported_FunctionsPrototype 90 | * @{ 91 | */ 92 | USBH_StatusTypeDef USBH_CtlSendSetup (USBH_HandleTypeDef *phost, 93 | uint8_t *buff, 94 | uint8_t hc_num); 95 | 96 | USBH_StatusTypeDef USBH_CtlSendData (USBH_HandleTypeDef *phost, 97 | uint8_t *buff, 98 | uint16_t length, 99 | uint8_t hc_num, 100 | uint8_t do_ping ); 101 | 102 | USBH_StatusTypeDef USBH_CtlReceiveData(USBH_HandleTypeDef *phost, 103 | uint8_t *buff, 104 | uint16_t length, 105 | uint8_t hc_num); 106 | 107 | USBH_StatusTypeDef USBH_BulkReceiveData(USBH_HandleTypeDef *phost, 108 | uint8_t *buff, 109 | uint16_t length, 110 | uint8_t hc_num); 111 | 112 | USBH_StatusTypeDef USBH_BulkSendData (USBH_HandleTypeDef *phost, 113 | uint8_t *buff, 114 | uint16_t length, 115 | uint8_t hc_num, 116 | uint8_t do_ping ); 117 | 118 | USBH_StatusTypeDef USBH_InterruptReceiveData(USBH_HandleTypeDef *phost, 119 | uint8_t *buff, 120 | uint8_t length, 121 | uint8_t hc_num); 122 | 123 | USBH_StatusTypeDef USBH_InterruptSendData(USBH_HandleTypeDef *phost, 124 | uint8_t *buff, 125 | uint8_t length, 126 | uint8_t hc_num); 127 | 128 | 129 | USBH_StatusTypeDef USBH_IsocReceiveData(USBH_HandleTypeDef *phost, 130 | uint8_t *buff, 131 | uint32_t length, 132 | uint8_t hc_num); 133 | 134 | 135 | USBH_StatusTypeDef USBH_IsocSendData(USBH_HandleTypeDef *phost, 136 | uint8_t *buff, 137 | uint32_t length, 138 | uint8_t hc_num); 139 | /** 140 | * @} 141 | */ 142 | 143 | #endif /* __USBH_IOREQ_H */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /** 150 | * @} 151 | */ 152 | 153 | /** 154 | * @} 155 | */ 156 | 157 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 158 | 159 | 160 | -------------------------------------------------------------------------------- /stm/usb_host/Core/inc/usbh_pipes.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_PIPES.h 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief Header file for usbh_pipes.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive ----------------------------------------------*/ 29 | #ifndef __USBH_PIPES_H 30 | #define __USBH_PIPES_H 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbh_core.h" 34 | 35 | /** @addtogroup USBH_LIB 36 | * @{ 37 | */ 38 | 39 | /** @addtogroup USBH_LIB_CORE 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_PIPES 44 | * @brief This file is the header file for usbh_PIPES.c 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_PIPES_Exported_Defines 49 | * @{ 50 | */ 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup USBH_PIPES_Exported_Types 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USBH_PIPES_Exported_Macros 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USBH_PIPES_Exported_Variables 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USBH_PIPES_Exported_FunctionsPrototype 78 | * @{ 79 | */ 80 | 81 | USBH_StatusTypeDef USBH_OpenPipe (USBH_HandleTypeDef *phost, 82 | uint8_t ch_num, 83 | uint8_t epnum, 84 | uint8_t dev_address, 85 | uint8_t speed, 86 | uint8_t ep_type, 87 | uint16_t mps); 88 | 89 | USBH_StatusTypeDef USBH_ClosePipe (USBH_HandleTypeDef *phost, 90 | uint8_t pipe_num); 91 | 92 | uint8_t USBH_AllocPipe (USBH_HandleTypeDef *phost, 93 | uint8_t ep_addr); 94 | 95 | USBH_StatusTypeDef USBH_FreePipe (USBH_HandleTypeDef *phost, 96 | uint8_t idx); 97 | 98 | 99 | 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | 106 | 107 | #endif /* __USBH_PIPES_H */ 108 | 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 123 | 124 | 125 | -------------------------------------------------------------------------------- /stm/usb_host/Core/src/usbh_pipes.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_pipes.c 4 | * @author MCD Application Team 5 | * @version V3.0.0 6 | * @date 18-February-2014 7 | * @brief This file implements functions for opening and closing Pipes 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Includes ------------------------------------------------------------------*/ 29 | #include "usbh_pipes.h" 30 | 31 | /** @addtogroup USBH_LIB 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup USBH_LIB_CORE 36 | * @{ 37 | */ 38 | 39 | /** @defgroup USBH_PIPES 40 | * @brief This file includes opening and closing Pipes 41 | * @{ 42 | */ 43 | 44 | /** @defgroup USBH_PIPES_Private_Defines 45 | * @{ 46 | */ 47 | /** 48 | * @} 49 | */ 50 | 51 | /** @defgroup USBH_PIPES_Private_TypesDefinitions 52 | * @{ 53 | */ 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | /** @defgroup USBH_PIPES_Private_Macros 60 | * @{ 61 | */ 62 | /** 63 | * @} 64 | */ 65 | 66 | 67 | /** @defgroup USBH_PIPES_Private_Variables 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | 76 | /** @defgroup USBH_PIPES_Private_Functions 77 | * @{ 78 | */ 79 | static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost); 80 | 81 | 82 | /** 83 | * @brief USBH_Open_Pipe 84 | * Open a pipe 85 | * @param phost: Host Handle 86 | * @param pipe_num: Pipe Number 87 | * @param dev_address: USB Device address allocated to attached device 88 | * @param speed : USB device speed (Full/Low) 89 | * @param ep_type: end point type (Bulk/int/ctl) 90 | * @param mps: max pkt size 91 | * @retval USBH Status 92 | */ 93 | USBH_StatusTypeDef USBH_OpenPipe (USBH_HandleTypeDef *phost, 94 | uint8_t pipe_num, 95 | uint8_t epnum, 96 | uint8_t dev_address, 97 | uint8_t speed, 98 | uint8_t ep_type, 99 | uint16_t mps) 100 | { 101 | 102 | USBH_LL_OpenPipe(phost, 103 | pipe_num, 104 | epnum, 105 | dev_address, 106 | speed, 107 | ep_type, 108 | mps); 109 | 110 | return USBH_OK; 111 | 112 | } 113 | 114 | /** 115 | * @brief USBH_ClosePipe 116 | * Close a pipe 117 | * @param phost: Host Handle 118 | * @param pipe_num: Pipe Number 119 | * @retval USBH Status 120 | */ 121 | USBH_StatusTypeDef USBH_ClosePipe (USBH_HandleTypeDef *phost, 122 | uint8_t pipe_num) 123 | { 124 | 125 | USBH_LL_ClosePipe(phost, pipe_num); 126 | 127 | return USBH_OK; 128 | 129 | } 130 | 131 | /** 132 | * @brief USBH_Alloc_Pipe 133 | * Allocate a new Pipe 134 | * @param phost: Host Handle 135 | * @param ep_addr: End point for which the Pipe to be allocated 136 | * @retval Pipe number 137 | */ 138 | uint8_t USBH_AllocPipe (USBH_HandleTypeDef *phost, uint8_t ep_addr) 139 | { 140 | uint16_t pipe; 141 | 142 | pipe = USBH_GetFreePipe(phost); 143 | 144 | if (pipe != 0xFFFF) 145 | { 146 | phost->Pipes[pipe] = 0x8000 | ep_addr; 147 | } 148 | return pipe; 149 | } 150 | 151 | /** 152 | * @brief USBH_Free_Pipe 153 | * Free the USB Pipe 154 | * @param phost: Host Handle 155 | * @param idx: Pipe number to be freed 156 | * @retval USBH Status 157 | */ 158 | USBH_StatusTypeDef USBH_FreePipe (USBH_HandleTypeDef *phost, uint8_t idx) 159 | { 160 | if(idx < 11) 161 | { 162 | phost->Pipes[idx] &= 0x7FFF; 163 | } 164 | return USBH_OK; 165 | } 166 | 167 | /** 168 | * @brief USBH_GetFreePipe 169 | * @param phost: Host Handle 170 | * Get a free Pipe number for allocation to a device endpoint 171 | * @retval idx: Free Pipe number 172 | */ 173 | static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost) 174 | { 175 | uint8_t idx = 0; 176 | 177 | for (idx = 0 ; idx < 11 ; idx++) 178 | { 179 | if ((phost->Pipes[idx] & 0x8000) == 0) 180 | { 181 | return idx; 182 | } 183 | } 184 | return 0xFFFF; 185 | } 186 | /** 187 | * @} 188 | */ 189 | 190 | /** 191 | * @} 192 | */ 193 | 194 | /** 195 | * @} 196 | */ 197 | 198 | /** 199 | * @} 200 | */ 201 | 202 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 203 | 204 | 205 | -------------------------------------------------------------------------------- /stm/usb_user/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file FatFs/FatFs_USBDisk/Src/stm32f4xx_it.c 4 | * @author MCD Application Team 5 | * @version V1.0.1 6 | * @date 26-February-2014 7 | * @brief Main Interrupt Service Routines. 8 | * This file provides template for all exceptions handler and 9 | * peripherals interrupt service routine. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2014 STMicroelectronics

14 | * 15 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 16 | * You may not use this file except in compliance with the License. 17 | * You may obtain a copy of the License at: 18 | * 19 | * http://www.st.com/software_license_agreement_liberty_v2 20 | * 21 | * Unless required by applicable law or agreed to in writing, software 22 | * distributed under the License is distributed on an "AS IS" BASIS, 23 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 24 | * See the License for the specific language governing permissions and 25 | * limitations under the License. 26 | * 27 | ****************************************************************************** 28 | */ 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx_it.h" 32 | #include "stm32f4xx_hal_hcd.h" 33 | #include "stm32f4xx_hal.h" 34 | 35 | 36 | /* Private typedef -----------------------------------------------------------*/ 37 | /* Private define ------------------------------------------------------------*/ 38 | /* Private macro -------------------------------------------------------------*/ 39 | /* Private variables ---------------------------------------------------------*/ 40 | extern HCD_HandleTypeDef hhcd; 41 | 42 | /* Private function prototypes -----------------------------------------------*/ 43 | /* Private functions ---------------------------------------------------------*/ 44 | 45 | /******************************************************************************/ 46 | /* Cortex-M4 Processor Exceptions Handlers */ 47 | /******************************************************************************/ 48 | 49 | /** 50 | * @brief This function handles NMI exception. 51 | * @param None 52 | * @retval None 53 | */ 54 | void NMI_Handler(void) 55 | { 56 | } 57 | 58 | /** 59 | * @brief This function handles Hard Fault exception. 60 | * @param None 61 | * @retval None 62 | */ 63 | void HardFault_Handler(void) 64 | { 65 | /* Go to infinite loop when Hard Fault exception occurs */ 66 | while (1) 67 | { 68 | } 69 | } 70 | 71 | /** 72 | * @brief This function handles Memory Manage exception. 73 | * @param None 74 | * @retval None 75 | */ 76 | void MemManage_Handler(void) 77 | { 78 | /* Go to infinite loop when Memory Manage exception occurs */ 79 | while (1) 80 | { 81 | } 82 | } 83 | 84 | /** 85 | * @brief This function handles Bus Fault exception. 86 | * @param None 87 | * @retval None 88 | */ 89 | void BusFault_Handler(void) 90 | { 91 | /* Go to infinite loop when Bus Fault exception occurs */ 92 | while (1) 93 | { 94 | } 95 | } 96 | 97 | /** 98 | * @brief This function handles Usage Fault exception. 99 | * @param None 100 | * @retval None 101 | */ 102 | void UsageFault_Handler(void) 103 | { 104 | /* Go to infinite loop when Usage Fault exception occurs */ 105 | while (1) 106 | { 107 | } 108 | } 109 | 110 | /** 111 | * @brief This function handles SVCall exception. 112 | * @param None 113 | * @retval None 114 | */ 115 | void SVC_Handler(void) 116 | { 117 | } 118 | 119 | /** 120 | * @brief This function handles Debug Monitor exception. 121 | * @param None 122 | * @retval None 123 | */ 124 | void DebugMon_Handler(void) 125 | { 126 | } 127 | 128 | /** 129 | * @brief This function handles PendSVC exception. 130 | * @param None 131 | * @retval None 132 | */ 133 | void PendSV_Handler(void) 134 | { 135 | } 136 | 137 | /** 138 | * @brief This function handles SysTick Handler. 139 | * @param None 140 | * @retval None 141 | */ 142 | void SysTick_Handler(void) 143 | { 144 | HAL_IncTick(); 145 | } 146 | 147 | /******************************************************************************/ 148 | /* STM32F4xx Peripherals Interrupt Handlers */ 149 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 150 | /* available peripheral interrupt handler's name please refer to the startup */ 151 | /* file (startup_stm32f429xx.s). */ 152 | /******************************************************************************/ 153 | 154 | /** 155 | * @brief This function handles USB-On-The-Go FS global interrupt requests. 156 | * @param None 157 | * @retval None 158 | */ 159 | void OTG_HS_IRQHandler(void) 160 | { 161 | HAL_HCD_IRQHandler(&hhcd); 162 | } 163 | 164 | /** 165 | * @brief This function handles PPP interrupt request. 166 | * @param None 167 | * @retval None 168 | */ 169 | /*void PPP_IRQHandler(void) 170 | { 171 | }*/ 172 | 173 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 174 | -------------------------------------------------------------------------------- /stm/usb_user/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file FatFs/FatFs_USBDisk/Inc/stm32f4xx_it.h 4 | * @author MCD Application Team 5 | * @version V1.0.1 6 | * @date 26-February-2014 7 | * @brief This file contains the headers of the interrupt handlers. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __STM32F4xx_IT_H 30 | #define __STM32F4xx_IT_H 31 | 32 | #ifdef __cplusplus 33 | extern "C" { 34 | #endif 35 | 36 | /* Includes ------------------------------------------------------------------*/ 37 | 38 | 39 | /* Exported types ------------------------------------------------------------*/ 40 | /* Exported constants --------------------------------------------------------*/ 41 | /* Exported macro ------------------------------------------------------------*/ 42 | /* Exported functions ------------------------------------------------------- */ 43 | 44 | void NMI_Handler(void); 45 | void HardFault_Handler(void); 46 | void MemManage_Handler(void); 47 | void BusFault_Handler(void); 48 | void UsageFault_Handler(void); 49 | void SVC_Handler(void); 50 | void DebugMon_Handler(void); 51 | void PendSV_Handler(void); 52 | void SysTick_Handler(void); 53 | void OTG_HS_IRQHandler(void); 54 | #ifdef __cplusplus 55 | } 56 | #endif 57 | 58 | #endif /* __STM32F4xx_IT_H */ 59 | 60 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 61 | -------------------------------------------------------------------------------- /stm/usb_user/usbh_conf.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file FatFs/FatFs_USBDisk/Inc/usbh_conf.h 4 | * @author MCD Application Team 5 | * @version V1.0.1 6 | * @date 26-February-2014 7 | * @brief General low level driver configuration 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2014 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | #ifndef __USBH_CONF__H__ 30 | #define __USBH_CONF__H__ 31 | 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "stm32f4xx.h" 34 | #include 35 | #include 36 | #include 37 | 38 | /* Exported types ------------------------------------------------------------*/ 39 | #define USBH_MAX_NUM_ENDPOINTS 2 40 | #define USBH_MAX_NUM_INTERFACES 2 41 | #define USBH_MAX_NUM_CONFIGURATION 1 42 | #define USBH_MAX_NUM_SUPPORTED_CLASS 1 43 | #define USBH_KEEP_CFG_DESCRIPTOR 0 44 | #define USBH_MAX_SIZE_CONFIGURATION 0x200 45 | #define USBH_MAX_DATA_BUFFER 0x200 46 | #define USBH_DEBUG_LEVEL 0 47 | #define USBH_USE_OS 0 48 | 49 | /* Exported constants --------------------------------------------------------*/ 50 | /* Exported macro ------------------------------------------------------------*/ 51 | /* CMSIS OS macros */ 52 | #if (USBH_USE_OS == 1) 53 | #include "cmsis_os.h" 54 | #define USBH_PROCESS_PRIO osPriorityNormal 55 | #endif 56 | 57 | /* Memory management macros */ 58 | #define USBH_malloc malloc 59 | #define USBH_free free 60 | #define USBH_memset memset 61 | #define USBH_memcpy memcpy 62 | 63 | /* DEBUG macros */ 64 | #if (USBH_DEBUG_LEVEL > 0) 65 | #define USBH_UsrLog(...) printf(__VA_ARGS__);\ 66 | printf("\n"); 67 | #else 68 | #define USBH_UsrLog(...) 69 | #endif 70 | 71 | 72 | #if (USBH_DEBUG_LEVEL > 1) 73 | 74 | #define USBH_ErrLog(...) printf("ERROR: ") ;\ 75 | printf(__VA_ARGS__);\ 76 | printf("\n"); 77 | #else 78 | #define USBH_ErrLog(...) 79 | #endif 80 | 81 | #if (USBH_DEBUG_LEVEL > 2) 82 | #define USBH_DbgLog(...) printf("DEBUG : ") ;\ 83 | printf(__VA_ARGS__);\ 84 | printf("\n"); 85 | #else 86 | #define USBH_DbgLog(...) 87 | #endif 88 | 89 | /* Exported functions ------------------------------------------------------- */ 90 | 91 | #endif /* __USB_CONF_H */ 92 | 93 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /syscalls.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | 36 | #include 37 | 38 | int _getpid(void) { return 1; } 39 | 40 | int _kill(int pid, int sig) 41 | { 42 | errno = EINVAL; 43 | return -1; 44 | } 45 | 46 | void _exit(int status) 47 | { 48 | _kill(status, -1); 49 | while (1) { 50 | } /* Make sure we hang here */ 51 | } 52 | 53 | int _write(int file, char *ptr, int len) 54 | { 55 | int todo; 56 | 57 | for (todo = 0; todo < len; todo++) { 58 | __io_putchar(*ptr++); 59 | } 60 | 61 | /* Implement your write code here, this is used by puts and printf for 62 | * example */ 63 | return len; 64 | } 65 | 66 | caddr_t _sbrk(int incr) 67 | { 68 | extern char __heap_start; 69 | extern char __heap_end; 70 | static char *current_heap_end = &__heap_start; 71 | char *previous_heap_end; 72 | 73 | previous_heap_end = current_heap_end; 74 | 75 | if (current_heap_end + incr > &__heap_end) { 76 | errno = ENOMEM; 77 | return (caddr_t)-1; 78 | } 79 | 80 | current_heap_end += incr; 81 | 82 | return (caddr_t)previous_heap_end; 83 | } 84 | 85 | int _close(int file) { return -1; } 86 | 87 | int _fstat(int file, struct stat *st) 88 | { 89 | st->st_mode = S_IFCHR; 90 | return 0; 91 | } 92 | 93 | int _isatty(int file) { return 1; } 94 | 95 | int _lseek(int file, int ptr, int dir) { return 0; } 96 | 97 | int _read(int file, char *ptr, int len) { return 0; } 98 | 99 | int _open(char *path, int flags, ...) 100 | { 101 | /* Pretend like we always fail */ 102 | return -1; 103 | } 104 | 105 | int _wait(int *status) 106 | { 107 | errno = ECHILD; 108 | return -1; 109 | } 110 | 111 | int _unlink(char *name) 112 | { 113 | errno = ENOENT; 114 | return -1; 115 | } 116 | 117 | int _stat(char *file, struct stat *st) 118 | { 119 | st->st_mode = S_IFCHR; 120 | return 0; 121 | } 122 | 123 | int _link(char *old, char *new) 124 | { 125 | errno = EMLINK; 126 | return -1; 127 | } 128 | 129 | int _fork(void) 130 | { 131 | errno = EAGAIN; 132 | return -1; 133 | } 134 | 135 | int _execve(char *name, char **argv, char **env) 136 | { 137 | errno = ENOMEM; 138 | return -1; 139 | } 140 | -------------------------------------------------------------------------------- /usb_msc_lwext4.c: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | 29 | #include 30 | #include 31 | #include 32 | #include 33 | #include 34 | #include 35 | #include 36 | 37 | #include 38 | #include 39 | #include 40 | 41 | #include 42 | #include "test_lwext4.h" 43 | 44 | extern USBH_HandleTypeDef hUSB_Host; 45 | 46 | /**@brief Block size.*/ 47 | #define USB_MSC_BLOCK_SIZE 512 48 | 49 | /**@brief MBR_block ID*/ 50 | #define MBR_BLOCK_ID 0 51 | #define MBR_PART_TABLE_OFF 446 52 | 53 | struct part_tab_entry { 54 | uint8_t status; 55 | uint8_t chs1[3]; 56 | uint8_t type; 57 | uint8_t chs2[3]; 58 | uint32_t first_lba; 59 | uint32_t sectors; 60 | } __attribute__((packed)); 61 | 62 | /**@brief Partition block offset*/ 63 | static uint32_t part_offset; 64 | 65 | /**@brief IO timings*/ 66 | struct usb_msc_io_timings { 67 | uint64_t acc_bread; 68 | uint64_t acc_bwrite; 69 | 70 | uint32_t cnt_bread; 71 | uint32_t cnt_bwrite; 72 | 73 | uint32_t av_bread; 74 | uint32_t av_bwrite; 75 | }; 76 | 77 | static struct usb_msc_io_timings io_timings; 78 | 79 | void io_timings_clear(void) 80 | { 81 | memset(&io_timings, 0, sizeof(struct usb_msc_io_timings)); 82 | } 83 | 84 | const struct ext4_io_stats *io_timings_get(uint32_t time_sum_ms) 85 | { 86 | static struct ext4_io_stats s; 87 | 88 | s.io_read = (((float)io_timings.acc_bread * 100.0) / time_sum_ms); 89 | s.io_read /= 1000.0; 90 | 91 | s.io_write = (((float)io_timings.acc_bwrite * 100.0) / time_sum_ms); 92 | s.io_write /= 1000.0; 93 | 94 | s.cpu = 100.0 - s.io_read - s.io_write; 95 | 96 | return &s; 97 | } 98 | 99 | /**********************BLOCKDEV INTERFACE**************************************/ 100 | static int usb_msc_open(struct ext4_blockdev *bdev); 101 | static int usb_msc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id, 102 | uint32_t blk_cnt); 103 | static int usb_msc_bwrite(struct ext4_blockdev *bdev, const void *buf, 104 | uint64_t blk_id, uint32_t blk_cnt); 105 | static int usb_msc_close(struct ext4_blockdev *bdev); 106 | 107 | /******************************************************************************/ 108 | EXT4_BLOCKDEV_STATIC_INSTANCE(_usb_msc, USB_MSC_BLOCK_SIZE, 0, usb_msc_open, 109 | usb_msc_bread, usb_msc_bwrite, usb_msc_close, 0, 0); 110 | 111 | /******************************************************************************/ 112 | 113 | static int usb_msc_open(struct ext4_blockdev *bdev) 114 | { 115 | (void)bdev; 116 | if (!hw_usb_connected()) 117 | return EIO; 118 | 119 | MSC_LUNTypeDef lun; 120 | USBH_MSC_GetLUNInfo(&hUSB_Host, 0, &lun); 121 | 122 | _usb_msc.part_offset = 0; 123 | _usb_msc.part_size = lun.capacity.block_nbr * lun.capacity.block_size; 124 | _usb_msc.bdif->ph_bcnt = lun.capacity.block_nbr; 125 | return hw_usb_connected() ? EOK : EIO; 126 | } 127 | 128 | static int usb_msc_bread(struct ext4_blockdev *bdev, void *buf, uint64_t blk_id, 129 | uint32_t blk_cnt) 130 | { 131 | uint8_t status; 132 | 133 | uint64_t v = tim_get_us(); 134 | 135 | if (!hw_usb_connected()) 136 | return EIO; 137 | 138 | while (!USBH_MSC_UnitIsReady(&hUSB_Host, 0)) 139 | ; 140 | 141 | status = 142 | USBH_MSC_Read(&hUSB_Host, 0, blk_id + part_offset, buf, blk_cnt); 143 | if (status != USBH_OK) 144 | return EIO; 145 | 146 | io_timings.acc_bread += tim_get_us() - v; 147 | io_timings.cnt_bread++; 148 | io_timings.av_bread = io_timings.acc_bread / io_timings.cnt_bread; 149 | 150 | return EOK; 151 | } 152 | 153 | static int usb_msc_bwrite(struct ext4_blockdev *bdev, const void *buf, 154 | uint64_t blk_id, uint32_t blk_cnt) 155 | { 156 | uint8_t status; 157 | 158 | uint64_t v = tim_get_us(); 159 | 160 | if (!hw_usb_connected()) 161 | return EIO; 162 | 163 | while (!USBH_MSC_UnitIsReady(&hUSB_Host, 0)) 164 | ; 165 | 166 | status = USBH_MSC_Write(&hUSB_Host, 0, blk_id + part_offset, 167 | (void *)buf, blk_cnt); 168 | if (status != USBH_OK) 169 | return EIO; 170 | 171 | io_timings.acc_bwrite += tim_get_us() - v; 172 | io_timings.cnt_bwrite++; 173 | io_timings.av_bwrite = io_timings.acc_bwrite / io_timings.cnt_bwrite; 174 | 175 | return EOK; 176 | } 177 | 178 | static int usb_msc_close(struct ext4_blockdev *bdev) 179 | { 180 | (void)bdev; 181 | return EOK; 182 | } 183 | 184 | /******************************************************************************/ 185 | 186 | struct ext4_blockdev *ext4_usb_msc_get(void) { return &_usb_msc; } 187 | -------------------------------------------------------------------------------- /usb_msc_lwext4.h: -------------------------------------------------------------------------------- 1 | /* 2 | * Copyright (c) 2013 Grzegorz Kostka (kostka.grzegorz@gmail.com) 3 | * All rights reserved. 4 | * 5 | * Redistribution and use in source and binary forms, with or without 6 | * modification, are permitted provided that the following conditions 7 | * are met: 8 | * 9 | * - Redistributions of source code must retain the above copyright 10 | * notice, this list of conditions and the following disclaimer. 11 | * - Redistributions in binary form must reproduce the above copyright 12 | * notice, this list of conditions and the following disclaimer in the 13 | * documentation and/or other materials provided with the distribution. 14 | * - The name of the author may not be used to endorse or promote products 15 | * derived from this software without specific prior written permission. 16 | * 17 | * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 18 | * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES 19 | * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 20 | * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, 21 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 22 | * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, 23 | * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY 24 | * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 25 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF 26 | * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 27 | */ 28 | #ifndef USB_MSC_LWEXT4_H_ 29 | #define USB_MSC_LWEXT4_H_ 30 | 31 | #include 32 | #include 33 | 34 | #include 35 | #include 36 | 37 | /**@brief USB MSC blockdev get.*/ 38 | struct ext4_blockdev *ext4_usb_msc_get(void); 39 | 40 | #endif /* USB_MSC_LWEXT4_H_ */ 41 | --------------------------------------------------------------------------------