├── .gitignore ├── .mxproject ├── Drivers ├── CMSIS │ ├── Device │ │ └── ST │ │ │ └── STM32L4xx │ │ │ └── Include │ │ │ ├── stm32l431xx.h │ │ │ ├── stm32l432xx.h │ │ │ ├── stm32l433xx.h │ │ │ ├── stm32l442xx.h │ │ │ ├── stm32l443xx.h │ │ │ ├── stm32l451xx.h │ │ │ ├── stm32l452xx.h │ │ │ ├── stm32l462xx.h │ │ │ ├── stm32l471xx.h │ │ │ ├── stm32l475xx.h │ │ │ ├── stm32l476xx.h │ │ │ ├── stm32l485xx.h │ │ │ ├── stm32l486xx.h │ │ │ ├── stm32l496xx.h │ │ │ ├── stm32l4a6xx.h │ │ │ ├── stm32l4xx.h │ │ │ └── system_stm32l4xx.h │ └── Include │ │ ├── arm_common_tables.h │ │ ├── arm_const_structs.h │ │ ├── arm_math.h │ │ ├── cmsis_armcc.h │ │ ├── cmsis_armcc_V6.h │ │ ├── cmsis_gcc.h │ │ ├── core_cm0.h │ │ ├── core_cm0plus.h │ │ ├── core_cm3.h │ │ ├── core_cm4.h │ │ ├── core_cm7.h │ │ ├── core_cmFunc.h │ │ ├── core_cmInstr.h │ │ ├── core_cmSimd.h │ │ ├── core_sc000.h │ │ └── core_sc300.h └── STM32L4xx_HAL_Driver │ ├── Inc │ ├── Legacy │ │ └── stm32_hal_legacy.h │ ├── stm32_assert_template.h │ ├── stm32l4xx_hal.h │ ├── stm32l4xx_hal_adc.h │ ├── stm32l4xx_hal_adc_ex.h │ ├── stm32l4xx_hal_can.h │ ├── stm32l4xx_hal_comp.h │ ├── stm32l4xx_hal_conf_template.h │ ├── stm32l4xx_hal_cortex.h │ ├── stm32l4xx_hal_crc.h │ ├── stm32l4xx_hal_crc_ex.h │ ├── stm32l4xx_hal_cryp.h │ ├── stm32l4xx_hal_cryp_ex.h │ ├── stm32l4xx_hal_dac.h │ ├── stm32l4xx_hal_dac_ex.h │ ├── stm32l4xx_hal_dcmi.h │ ├── stm32l4xx_hal_def.h │ ├── stm32l4xx_hal_dfsdm.h │ ├── stm32l4xx_hal_dma.h │ ├── stm32l4xx_hal_dma2d.h │ ├── stm32l4xx_hal_firewall.h │ ├── stm32l4xx_hal_flash.h │ ├── stm32l4xx_hal_flash_ex.h │ ├── stm32l4xx_hal_flash_ramfunc.h │ ├── stm32l4xx_hal_gpio.h │ ├── stm32l4xx_hal_gpio_ex.h │ ├── stm32l4xx_hal_hash.h │ ├── stm32l4xx_hal_hash_ex.h │ ├── stm32l4xx_hal_hcd.h │ ├── stm32l4xx_hal_i2c.h │ ├── stm32l4xx_hal_i2c_ex.h │ ├── stm32l4xx_hal_irda.h │ ├── stm32l4xx_hal_irda_ex.h │ ├── stm32l4xx_hal_iwdg.h │ ├── stm32l4xx_hal_lcd.h │ ├── stm32l4xx_hal_lptim.h │ ├── stm32l4xx_hal_nand.h │ ├── stm32l4xx_hal_nor.h │ ├── stm32l4xx_hal_opamp.h │ ├── stm32l4xx_hal_opamp_ex.h │ ├── stm32l4xx_hal_pcd.h │ ├── stm32l4xx_hal_pcd_ex.h │ ├── stm32l4xx_hal_pwr.h │ ├── stm32l4xx_hal_pwr_ex.h │ ├── stm32l4xx_hal_qspi.h │ ├── stm32l4xx_hal_rcc.h │ ├── stm32l4xx_hal_rcc_ex.h │ ├── stm32l4xx_hal_rng.h │ ├── stm32l4xx_hal_rtc.h │ ├── stm32l4xx_hal_rtc_ex.h │ ├── stm32l4xx_hal_sai.h │ ├── stm32l4xx_hal_sd.h │ ├── stm32l4xx_hal_smartcard.h │ ├── stm32l4xx_hal_smartcard_ex.h │ ├── stm32l4xx_hal_smbus.h │ ├── stm32l4xx_hal_spi.h │ ├── stm32l4xx_hal_spi_ex.h │ ├── stm32l4xx_hal_sram.h │ ├── stm32l4xx_hal_swpmi.h │ ├── stm32l4xx_hal_tim.h │ ├── stm32l4xx_hal_tim_ex.h │ ├── stm32l4xx_hal_tsc.h │ ├── stm32l4xx_hal_uart.h │ ├── stm32l4xx_hal_uart_ex.h │ ├── stm32l4xx_hal_usart.h │ ├── stm32l4xx_hal_usart_ex.h │ ├── stm32l4xx_hal_wwdg.h │ ├── stm32l4xx_ll_adc.h │ ├── stm32l4xx_ll_bus.h │ ├── stm32l4xx_ll_comp.h │ ├── stm32l4xx_ll_cortex.h │ ├── stm32l4xx_ll_crc.h │ ├── stm32l4xx_ll_crs.h │ ├── stm32l4xx_ll_dac.h │ ├── stm32l4xx_ll_dma.h │ ├── stm32l4xx_ll_dma2d.h │ ├── stm32l4xx_ll_exti.h │ ├── stm32l4xx_ll_fmc.h │ ├── stm32l4xx_ll_gpio.h │ ├── stm32l4xx_ll_i2c.h │ ├── stm32l4xx_ll_iwdg.h │ ├── stm32l4xx_ll_lptim.h │ ├── stm32l4xx_ll_lpuart.h │ ├── stm32l4xx_ll_opamp.h │ ├── stm32l4xx_ll_pwr.h │ ├── stm32l4xx_ll_rcc.h │ ├── stm32l4xx_ll_rng.h │ ├── stm32l4xx_ll_rtc.h │ ├── stm32l4xx_ll_sdmmc.h │ ├── stm32l4xx_ll_spi.h │ ├── stm32l4xx_ll_swpmi.h │ ├── stm32l4xx_ll_system.h │ ├── stm32l4xx_ll_tim.h │ ├── stm32l4xx_ll_usart.h │ ├── stm32l4xx_ll_usb.h │ ├── stm32l4xx_ll_utils.h │ └── stm32l4xx_ll_wwdg.h │ └── Src │ ├── stm32l4xx_hal.c │ ├── stm32l4xx_hal_adc.c │ ├── stm32l4xx_hal_adc_ex.c │ ├── stm32l4xx_hal_can.c │ ├── stm32l4xx_hal_comp.c │ ├── stm32l4xx_hal_cortex.c │ ├── stm32l4xx_hal_crc.c │ ├── stm32l4xx_hal_crc_ex.c │ ├── stm32l4xx_hal_cryp.c │ ├── stm32l4xx_hal_cryp_ex.c │ ├── stm32l4xx_hal_dac.c │ ├── stm32l4xx_hal_dac_ex.c │ ├── stm32l4xx_hal_dcmi.c │ ├── stm32l4xx_hal_dfsdm.c │ ├── stm32l4xx_hal_dma.c │ ├── stm32l4xx_hal_dma2d.c │ ├── stm32l4xx_hal_firewall.c │ ├── stm32l4xx_hal_flash.c │ ├── stm32l4xx_hal_flash_ex.c │ ├── stm32l4xx_hal_flash_ramfunc.c │ ├── stm32l4xx_hal_gpio.c │ ├── stm32l4xx_hal_hash.c │ ├── stm32l4xx_hal_hash_ex.c │ ├── stm32l4xx_hal_hcd.c │ ├── stm32l4xx_hal_i2c.c │ ├── stm32l4xx_hal_i2c_ex.c │ ├── stm32l4xx_hal_irda.c │ ├── stm32l4xx_hal_iwdg.c │ ├── stm32l4xx_hal_lcd.c │ ├── stm32l4xx_hal_lptim.c │ ├── stm32l4xx_hal_msp_template.c │ ├── stm32l4xx_hal_nand.c │ ├── stm32l4xx_hal_nor.c │ ├── stm32l4xx_hal_opamp.c │ ├── stm32l4xx_hal_opamp_ex.c │ ├── stm32l4xx_hal_pcd.c │ ├── stm32l4xx_hal_pcd_ex.c │ ├── stm32l4xx_hal_pwr.c │ ├── stm32l4xx_hal_pwr_ex.c │ ├── stm32l4xx_hal_qspi.c │ ├── stm32l4xx_hal_rcc.c │ ├── stm32l4xx_hal_rcc_ex.c │ ├── stm32l4xx_hal_rng.c │ ├── stm32l4xx_hal_rtc.c │ ├── stm32l4xx_hal_rtc_ex.c │ ├── stm32l4xx_hal_sai.c │ ├── stm32l4xx_hal_sd.c │ ├── stm32l4xx_hal_smartcard.c │ ├── stm32l4xx_hal_smartcard_ex.c │ ├── stm32l4xx_hal_smbus.c │ ├── stm32l4xx_hal_spi.c │ ├── stm32l4xx_hal_spi_ex.c │ ├── stm32l4xx_hal_sram.c │ ├── stm32l4xx_hal_swpmi.c │ ├── stm32l4xx_hal_tim.c │ ├── stm32l4xx_hal_tim_ex.c │ ├── stm32l4xx_hal_timebase_tim_template.c │ ├── stm32l4xx_hal_tsc.c │ ├── stm32l4xx_hal_uart.c │ ├── stm32l4xx_hal_uart_ex.c │ ├── stm32l4xx_hal_usart.c │ ├── stm32l4xx_hal_wwdg.c │ ├── stm32l4xx_ll_adc.c │ ├── stm32l4xx_ll_comp.c │ ├── stm32l4xx_ll_crc.c │ ├── stm32l4xx_ll_crs.c │ ├── stm32l4xx_ll_dac.c │ ├── stm32l4xx_ll_dma.c │ ├── stm32l4xx_ll_dma2d.c │ ├── stm32l4xx_ll_exti.c │ ├── stm32l4xx_ll_fmc.c │ ├── stm32l4xx_ll_gpio.c │ ├── stm32l4xx_ll_i2c.c │ ├── stm32l4xx_ll_lptim.c │ ├── stm32l4xx_ll_lpuart.c │ ├── stm32l4xx_ll_opamp.c │ ├── stm32l4xx_ll_pwr.c │ ├── stm32l4xx_ll_rcc.c │ ├── stm32l4xx_ll_rng.c │ ├── stm32l4xx_ll_rtc.c │ ├── stm32l4xx_ll_sdmmc.c │ ├── stm32l4xx_ll_spi.c │ ├── stm32l4xx_ll_swpmi.c │ ├── stm32l4xx_ll_tim.c │ ├── stm32l4xx_ll_usart.c │ ├── stm32l4xx_ll_usb.c │ └── stm32l4xx_ll_utils.c ├── EWARM ├── Project.eww ├── STM32L4 SPI Bootloader host.ewd ├── STM32L4 SPI Bootloader host.ewp ├── startup_stm32l476xx.s ├── stm32l476xx_flash.icf └── stm32l476xx_sram.icf ├── Inc ├── bootloader.h ├── main.h ├── stm32l4xx_hal_conf.h └── stm32l4xx_it.h ├── README.md ├── STM32L4 SPI Bootloader host.ioc └── Src ├── bootloader.c ├── main.c ├── stm32l4xx_hal_msp.c ├── stm32l4xx_it.c └── system_stm32l4xx.c /.gitignore: -------------------------------------------------------------------------------- 1 | *.o 2 | tags 3 | *.d 4 | *.elf 5 | *.map 6 | *.list 7 | *.swp 8 | *~ 9 | .*~ 10 | 11 | # IAR Embedded Workbench 12 | *.dep 13 | EWARM/settings/ 14 | EWARM/*/ 15 | -------------------------------------------------------------------------------- /.mxproject: -------------------------------------------------------------------------------- 1 | [PreviousGenFiles] 2 | HeaderPath=C:/Users/legraing/workspace/STM32L4 SPI Bootloader host/Inc 3 | HeaderFiles=stm32l4xx_it.h;stm32l4xx_hal_conf.h;main.h; 4 | SourcePath=C:/Users/legraing/workspace/STM32L4 SPI Bootloader host/Src 5 | SourceFiles=stm32l4xx_it.h;stm32l4xx_hal_conf.h;main.h;stm32l4xx_it.c;stm32l4xx_hal_msp.c;main.c; 6 | 7 | [PreviousLibFiles] 8 | LibFiles=Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_tim_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h;Drivers/STM32L4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_rcc_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_gpio_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_dma_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pwr_ex.h;Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cortex.h;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l476xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Include/system_stm32l4xx.h;Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h; 9 | 10 | [PreviousUsedIarFiles] 11 | SourceFiles=../Src/main.c;../Src/stm32l4xx_it.c;../Src/stm32l4xx_hal_msp.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_tim_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_i2c_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_rcc_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_gpio.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_pwr_ex.c;../Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_cortex.c;../Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/system_stm32l4xx.c;../Drivers/CMSIS/Device/ST/STM32L4xx/Source/Templates/iar/startup_stm32l476xx.s; 12 | HeaderPath=..\Drivers\STM32L4xx_HAL_Driver\Inc;..\Drivers\STM32L4xx_HAL_Driver\Inc\Legacy;..\Drivers\CMSIS\Device\ST\STM32L4xx\Include;..\Drivers\CMSIS\Include; 13 | 14 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l431xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l431xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l432xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l432xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l433xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l433xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l442xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l442xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l443xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l443xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l451xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l451xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l452xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l452xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l462xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l462xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l471xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l471xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l475xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l475xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l476xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l476xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l485xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l485xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l486xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l486xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l496xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l496xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4a6xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4a6xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/CMSIS/Device/ST/STM32L4xx/Include/stm32l4xx.h -------------------------------------------------------------------------------- /Drivers/CMSIS/Device/ST/STM32L4xx/Include/system_stm32l4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32l4xx.h 4 | * @author MCD Application Team 5 | * @version V1.3.0 6 | * @date 17-February-2017 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32L4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | /** @addtogroup CMSIS 39 | * @{ 40 | */ 41 | 42 | /** @addtogroup stm32l4xx_system 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief Define to prevent recursive inclusion 48 | */ 49 | #ifndef __SYSTEM_STM32L4XX_H 50 | #define __SYSTEM_STM32L4XX_H 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | /** @addtogroup STM32L4xx_System_Includes 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @addtogroup STM32L4xx_System_Exported_Variables 66 | * @{ 67 | */ 68 | /* The SystemCoreClock variable is updated in three ways: 69 | 1) by calling CMSIS function SystemCoreClockUpdate() 70 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq() 71 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency 72 | Note: If you use this function to configure the system clock; then there 73 | is no need to call the 2 first functions listed above, since SystemCoreClock 74 | variable is updated automatically. 75 | */ 76 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 77 | 78 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */ 79 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */ 80 | extern const uint32_t MSIRangeTable[12]; /*!< MSI ranges table values */ 81 | 82 | /** 83 | * @} 84 | */ 85 | 86 | /** @addtogroup STM32L4xx_System_Exported_Constants 87 | * @{ 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @addtogroup STM32L4xx_System_Exported_Macros 95 | * @{ 96 | */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | /** @addtogroup STM32L4xx_System_Exported_Functions 103 | * @{ 104 | */ 105 | 106 | extern void SystemInit(void); 107 | extern void SystemCoreClockUpdate(void); 108 | /** 109 | * @} 110 | */ 111 | 112 | #ifdef __cplusplus 113 | } 114 | #endif 115 | 116 | #endif /*__SYSTEM_STM32L4XX_H */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/arm_common_tables.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. October 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_common_tables.h 9 | * 10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3 13 | * 14 | * Redistribution and use in source and binary forms, with or without 15 | * modification, are permitted provided that the following conditions 16 | * are met: 17 | * - Redistributions of source code must retain the above copyright 18 | * notice, this list of conditions and the following disclaimer. 19 | * - Redistributions in binary form must reproduce the above copyright 20 | * notice, this list of conditions and the following disclaimer in 21 | * the documentation and/or other materials provided with the 22 | * distribution. 23 | * - Neither the name of ARM LIMITED nor the names of its contributors 24 | * may be used to endorse or promote products derived from this 25 | * software without specific prior written permission. 26 | * 27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 38 | * POSSIBILITY OF SUCH DAMAGE. 39 | * -------------------------------------------------------------------- */ 40 | 41 | #ifndef _ARM_COMMON_TABLES_H 42 | #define _ARM_COMMON_TABLES_H 43 | 44 | #include "arm_math.h" 45 | 46 | extern const uint16_t armBitRevTable[1024]; 47 | extern const q15_t armRecipTableQ15[64]; 48 | extern const q31_t armRecipTableQ31[64]; 49 | /* extern const q31_t realCoefAQ31[1024]; */ 50 | /* extern const q31_t realCoefBQ31[1024]; */ 51 | extern const float32_t twiddleCoef_16[32]; 52 | extern const float32_t twiddleCoef_32[64]; 53 | extern const float32_t twiddleCoef_64[128]; 54 | extern const float32_t twiddleCoef_128[256]; 55 | extern const float32_t twiddleCoef_256[512]; 56 | extern const float32_t twiddleCoef_512[1024]; 57 | extern const float32_t twiddleCoef_1024[2048]; 58 | extern const float32_t twiddleCoef_2048[4096]; 59 | extern const float32_t twiddleCoef_4096[8192]; 60 | #define twiddleCoef twiddleCoef_4096 61 | extern const q31_t twiddleCoef_16_q31[24]; 62 | extern const q31_t twiddleCoef_32_q31[48]; 63 | extern const q31_t twiddleCoef_64_q31[96]; 64 | extern const q31_t twiddleCoef_128_q31[192]; 65 | extern const q31_t twiddleCoef_256_q31[384]; 66 | extern const q31_t twiddleCoef_512_q31[768]; 67 | extern const q31_t twiddleCoef_1024_q31[1536]; 68 | extern const q31_t twiddleCoef_2048_q31[3072]; 69 | extern const q31_t twiddleCoef_4096_q31[6144]; 70 | extern const q15_t twiddleCoef_16_q15[24]; 71 | extern const q15_t twiddleCoef_32_q15[48]; 72 | extern const q15_t twiddleCoef_64_q15[96]; 73 | extern const q15_t twiddleCoef_128_q15[192]; 74 | extern const q15_t twiddleCoef_256_q15[384]; 75 | extern const q15_t twiddleCoef_512_q15[768]; 76 | extern const q15_t twiddleCoef_1024_q15[1536]; 77 | extern const q15_t twiddleCoef_2048_q15[3072]; 78 | extern const q15_t twiddleCoef_4096_q15[6144]; 79 | extern const float32_t twiddleCoef_rfft_32[32]; 80 | extern const float32_t twiddleCoef_rfft_64[64]; 81 | extern const float32_t twiddleCoef_rfft_128[128]; 82 | extern const float32_t twiddleCoef_rfft_256[256]; 83 | extern const float32_t twiddleCoef_rfft_512[512]; 84 | extern const float32_t twiddleCoef_rfft_1024[1024]; 85 | extern const float32_t twiddleCoef_rfft_2048[2048]; 86 | extern const float32_t twiddleCoef_rfft_4096[4096]; 87 | 88 | 89 | /* floating-point bit reversal tables */ 90 | #define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 ) 91 | #define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 ) 92 | #define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 ) 93 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 ) 94 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 ) 95 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 ) 96 | #define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800) 97 | #define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808) 98 | #define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032) 99 | 100 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH]; 101 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH]; 102 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH]; 103 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH]; 104 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH]; 105 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH]; 106 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH]; 107 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH]; 108 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH]; 109 | 110 | /* fixed-point bit reversal tables */ 111 | #define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 ) 112 | #define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 ) 113 | #define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 ) 114 | #define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 ) 115 | #define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 ) 116 | #define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 ) 117 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 ) 118 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984) 119 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032) 120 | 121 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH]; 122 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH]; 123 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH]; 124 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH]; 125 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH]; 126 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH]; 127 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH]; 128 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH]; 129 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH]; 130 | 131 | /* Tables for Fast Math Sine and Cosine */ 132 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1]; 133 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1]; 134 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1]; 135 | 136 | #endif /* ARM_COMMON_TABLES_H */ 137 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/arm_const_structs.h: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 19. March 2015 5 | * $Revision: V.1.4.5 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_const_structs.h 9 | * 10 | * Description: This file has constant structs that are initialized for 11 | * user convenience. For example, some can be given as 12 | * arguments to the arm_cfft_f32() function. 13 | * 14 | * Target Processor: Cortex-M4/Cortex-M3 15 | * 16 | * Redistribution and use in source and binary forms, with or without 17 | * modification, are permitted provided that the following conditions 18 | * are met: 19 | * - Redistributions of source code must retain the above copyright 20 | * notice, this list of conditions and the following disclaimer. 21 | * - Redistributions in binary form must reproduce the above copyright 22 | * notice, this list of conditions and the following disclaimer in 23 | * the documentation and/or other materials provided with the 24 | * distribution. 25 | * - Neither the name of ARM LIMITED nor the names of its contributors 26 | * may be used to endorse or promote products derived from this 27 | * software without specific prior written permission. 28 | * 29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 40 | * POSSIBILITY OF SUCH DAMAGE. 41 | * -------------------------------------------------------------------- */ 42 | 43 | #ifndef _ARM_CONST_STRUCTS_H 44 | #define _ARM_CONST_STRUCTS_H 45 | 46 | #include "arm_math.h" 47 | #include "arm_common_tables.h" 48 | 49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16; 50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32; 51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64; 52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128; 53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256; 54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512; 55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024; 56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048; 57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096; 58 | 59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16; 60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32; 61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64; 62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128; 63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256; 64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512; 65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024; 66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048; 67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096; 68 | 69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16; 70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32; 71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64; 72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128; 73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256; 74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512; 75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024; 76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048; 77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096; 78 | 79 | #endif 80 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMFUNC_H 42 | #define __CORE_CMFUNC_H 43 | 44 | 45 | /* ########################### Core Function Access ########################### */ 46 | /** \ingroup CMSIS_Core_FunctionInterface 47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@} end of CMSIS_Core_RegAccFunctions */ 86 | 87 | #endif /* __CORE_CMFUNC_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMINSTR_H 42 | #define __CORE_CMINSTR_H 43 | 44 | 45 | /* ########################## Core Instruction Access ######################### */ 46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface 47 | Access to dedicated instructions 48 | @{ 49 | */ 50 | 51 | /*------------------ RealView Compiler -----------------*/ 52 | #if defined ( __CC_ARM ) 53 | #include "cmsis_armcc.h" 54 | 55 | /*------------------ ARM Compiler V6 -------------------*/ 56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 57 | #include "cmsis_armcc_V6.h" 58 | 59 | /*------------------ GNU Compiler ----------------------*/ 60 | #elif defined ( __GNUC__ ) 61 | #include "cmsis_gcc.h" 62 | 63 | /*------------------ ICC Compiler ----------------------*/ 64 | #elif defined ( __ICCARM__ ) 65 | #include 66 | 67 | /*------------------ TI CCS Compiler -------------------*/ 68 | #elif defined ( __TMS470__ ) 69 | #include 70 | 71 | /*------------------ TASKING Compiler ------------------*/ 72 | #elif defined ( __TASKING__ ) 73 | /* 74 | * The CMSIS functions have been implemented as intrinsics in the compiler. 75 | * Please use "carm -?i" to get an up to date list of all intrinsics, 76 | * Including the CMSIS ones. 77 | */ 78 | 79 | /*------------------ COSMIC Compiler -------------------*/ 80 | #elif defined ( __CSMC__ ) 81 | #include 82 | 83 | #endif 84 | 85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 86 | 87 | #endif /* __CORE_CMINSTR_H */ 88 | -------------------------------------------------------------------------------- /Drivers/CMSIS/Include/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.30 5 | * @date 20. October 2015 6 | ******************************************************************************/ 7 | /* Copyright (c) 2009 - 2015 ARM LIMITED 8 | 9 | All rights reserved. 10 | Redistribution and use in source and binary forms, with or without 11 | modification, are permitted provided that the following conditions are met: 12 | - Redistributions of source code must retain the above copyright 13 | notice, this list of conditions and the following disclaimer. 14 | - Redistributions in binary form must reproduce the above copyright 15 | notice, this list of conditions and the following disclaimer in the 16 | documentation and/or other materials provided with the distribution. 17 | - Neither the name of ARM nor the names of its contributors may be used 18 | to endorse or promote products derived from this software without 19 | specific prior written permission. 20 | * 21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE 25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 31 | POSSIBILITY OF SUCH DAMAGE. 32 | ---------------------------------------------------------------------------*/ 33 | 34 | 35 | #if defined ( __ICCARM__ ) 36 | #pragma system_include /* treat file as system include file for MISRA check */ 37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 38 | #pragma clang system_header /* treat file as system include file */ 39 | #endif 40 | 41 | #ifndef __CORE_CMSIMD_H 42 | #define __CORE_CMSIMD_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | 49 | /* ################### Compiler specific Intrinsics ########################### */ 50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 51 | Access to dedicated SIMD instructions 52 | @{ 53 | */ 54 | 55 | /*------------------ RealView Compiler -----------------*/ 56 | #if defined ( __CC_ARM ) 57 | #include "cmsis_armcc.h" 58 | 59 | /*------------------ ARM Compiler V6 -------------------*/ 60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) 61 | #include "cmsis_armcc_V6.h" 62 | 63 | /*------------------ GNU Compiler ----------------------*/ 64 | #elif defined ( __GNUC__ ) 65 | #include "cmsis_gcc.h" 66 | 67 | /*------------------ ICC Compiler ----------------------*/ 68 | #elif defined ( __ICCARM__ ) 69 | #include 70 | 71 | /*------------------ TI CCS Compiler -------------------*/ 72 | #elif defined ( __TMS470__ ) 73 | #include 74 | 75 | /*------------------ TASKING Compiler ------------------*/ 76 | #elif defined ( __TASKING__ ) 77 | /* 78 | * The CMSIS functions have been implemented as intrinsics in the compiler. 79 | * Please use "carm -?i" to get an up to date list of all intrinsics, 80 | * Including the CMSIS ones. 81 | */ 82 | 83 | /*------------------ COSMIC Compiler -------------------*/ 84 | #elif defined ( __CSMC__ ) 85 | #include 86 | 87 | #endif 88 | 89 | /*@} end of group CMSIS_SIMD_intrinsics */ 90 | 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __CORE_CMSIMD_H */ 97 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32_assert_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32_assert.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief STM32 assert template file. 8 | * This file should be copied to the application folder and renamed 9 | * to stm32_assert.h. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2017 STMicroelectronics

14 | * 15 | * Redistribution and use in source and binary forms, with or without modification, 16 | * are permitted provided that the following conditions are met: 17 | * 1. Redistributions of source code must retain the above copyright notice, 18 | * this list of conditions and the following disclaimer. 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************** 38 | */ 39 | 40 | /* Define to prevent recursive inclusion -------------------------------------*/ 41 | #ifndef __STM32_ASSERT_H 42 | #define __STM32_ASSERT_H 43 | 44 | #ifdef __cplusplus 45 | extern "C" { 46 | #endif 47 | 48 | /* Exported types ------------------------------------------------------------*/ 49 | /* Exported constants --------------------------------------------------------*/ 50 | /* Includes ------------------------------------------------------------------*/ 51 | /* Exported macro ------------------------------------------------------------*/ 52 | #ifdef USE_FULL_ASSERT 53 | /** 54 | * @brief The assert_param macro is used for function's parameters check. 55 | * @param expr: If expr is false, it calls assert_failed function 56 | * which reports the name of the source file and the source 57 | * line number of the call that failed. 58 | * If expr is true, it returns no value. 59 | * @retval None 60 | */ 61 | #define assert_param(expr) ((expr) ? (void)0U : assert_failed((uint8_t *)__FILE__, __LINE__)) 62 | /* Exported functions ------------------------------------------------------- */ 63 | void assert_failed(uint8_t* file, uint32_t line); 64 | #else 65 | #define assert_param(expr) ((void)0U) 66 | #endif /* USE_FULL_ASSERT */ 67 | 68 | #ifdef __cplusplus 69 | } 70 | #endif 71 | 72 | #endif /* __STM32_ASSERT_H */ 73 | 74 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_crc_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_crc_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of CRC HAL extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_CRC_EX_H 40 | #define __STM32L4xx_HAL_CRC_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup CRCEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported constants --------------------------------------------------------*/ 59 | /** @defgroup CRCEx_Exported_Constants CRCEx Exported Constants 60 | * @{ 61 | */ 62 | 63 | /** @defgroup CRCEx_Input_Data_Inversion Input Data Inversion Modes 64 | * @{ 65 | */ 66 | #define CRC_INPUTDATA_INVERSION_NONE ((uint32_t)0x00000000) /*!< No input data inversion */ 67 | #define CRC_INPUTDATA_INVERSION_BYTE ((uint32_t)CRC_CR_REV_IN_0) /*!< Byte-wise input data inversion */ 68 | #define CRC_INPUTDATA_INVERSION_HALFWORD ((uint32_t)CRC_CR_REV_IN_1) /*!< HalfWord-wise input data inversion */ 69 | #define CRC_INPUTDATA_INVERSION_WORD ((uint32_t)CRC_CR_REV_IN) /*!< Word-wise input data inversion */ 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup CRCEx_Output_Data_Inversion Output Data Inversion Modes 75 | * @{ 76 | */ 77 | #define CRC_OUTPUTDATA_INVERSION_DISABLE ((uint32_t)0x00000000) /*!< No output data inversion */ 78 | #define CRC_OUTPUTDATA_INVERSION_ENABLE ((uint32_t)CRC_CR_REV_OUT) /*!< Bit-wise output data inversion */ 79 | /** 80 | * @} 81 | */ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /** @defgroup CRCEx_Exported_Macros CRCEx Exported Macros 89 | * @{ 90 | */ 91 | 92 | /** 93 | * @brief Set CRC output reversal 94 | * @param __HANDLE__: CRC handle 95 | * @retval None 96 | */ 97 | #define __HAL_CRC_OUTPUTREVERSAL_ENABLE(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_REV_OUT) 98 | 99 | /** 100 | * @brief Unset CRC output reversal 101 | * @param __HANDLE__: CRC handle 102 | * @retval None 103 | */ 104 | #define __HAL_CRC_OUTPUTREVERSAL_DISABLE(__HANDLE__) ((__HANDLE__)->Instance->CR &= ~(CRC_CR_REV_OUT)) 105 | 106 | /** 107 | * @brief Set CRC non-default polynomial 108 | * @param __HANDLE__: CRC handle 109 | * @param __POLYNOMIAL__: 7, 8, 16 or 32-bit polynomial 110 | * @retval None 111 | */ 112 | #define __HAL_CRC_POLYNOMIAL_CONFIG(__HANDLE__, __POLYNOMIAL__) ((__HANDLE__)->Instance->POL = (__POLYNOMIAL__)) 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /* Private macros --------------------------------------------------------*/ 119 | /** @addtogroup CRCEx_Private_Macros CRCEx Private Macros 120 | * @{ 121 | */ 122 | 123 | #define IS_CRC_INPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_INPUTDATA_INVERSION_NONE) || \ 124 | ((MODE) == CRC_INPUTDATA_INVERSION_BYTE) || \ 125 | ((MODE) == CRC_INPUTDATA_INVERSION_HALFWORD) || \ 126 | ((MODE) == CRC_INPUTDATA_INVERSION_WORD)) 127 | 128 | 129 | #define IS_CRC_OUTPUTDATA_INVERSION_MODE(MODE) (((MODE) == CRC_OUTPUTDATA_INVERSION_DISABLE) || \ 130 | ((MODE) == CRC_OUTPUTDATA_INVERSION_ENABLE)) 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /* Exported functions --------------------------------------------------------*/ 137 | 138 | /** @addtogroup CRCEx_Exported_Functions CRC Extended Exported Functions 139 | * @{ 140 | */ 141 | 142 | /** @addtogroup CRCEx_Exported_Functions_Group1 Extended Initialization/de-initialization functions 143 | * @{ 144 | */ 145 | 146 | /* Initialization and de-initialization functions ****************************/ 147 | HAL_StatusTypeDef HAL_CRCEx_Polynomial_Set(CRC_HandleTypeDef *hcrc, uint32_t Pol, uint32_t PolyLength); 148 | HAL_StatusTypeDef HAL_CRCEx_Input_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t InputReverseMode); 149 | HAL_StatusTypeDef HAL_CRCEx_Output_Data_Reverse(CRC_HandleTypeDef *hcrc, uint32_t OutputReverseMode); 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | /** 156 | * @} 157 | */ 158 | 159 | /** 160 | * @} 161 | */ 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | #ifdef __cplusplus 168 | } 169 | #endif 170 | 171 | #endif /* __STM32L4xx_HAL_CRC_EX_H */ 172 | 173 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 174 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of CRYPEx HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_CRYP_EX_H 40 | #define __STM32L4xx_HAL_CRYP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined (STM32L442xx) || defined (STM32L443xx) || defined (STM32L462xx) || defined(STM32L485xx) || defined(STM32L486xx) || defined(STM32L4A6xx) 47 | 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32l4xx_hal_def.h" 51 | 52 | /** @addtogroup STM32L4xx_HAL_Driver 53 | * @{ 54 | */ 55 | 56 | /** @addtogroup CRYPEx 57 | * @{ 58 | */ 59 | 60 | /* Exported types ------------------------------------------------------------*/ 61 | /* Exported constants --------------------------------------------------------*/ 62 | /* Exported functions --------------------------------------------------------*/ 63 | 64 | /** @addtogroup CRYPEx_Exported_Functions 65 | * @{ 66 | */ 67 | 68 | /** @addtogroup CRYPEx_Exported_Functions_Group1 69 | * @{ 70 | */ 71 | 72 | /* CallBack functions ********************************************************/ 73 | void HAL_CRYPEx_ComputationCpltCallback(CRYP_HandleTypeDef *hcryp); 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @addtogroup CRYPEx_Exported_Functions_Group2 80 | * @{ 81 | */ 82 | 83 | /* AES encryption/decryption processing functions ****************************/ 84 | HAL_StatusTypeDef HAL_CRYPEx_AES(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData, uint32_t Timeout); 85 | HAL_StatusTypeDef HAL_CRYPEx_AES_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); 86 | HAL_StatusTypeDef HAL_CRYPEx_AES_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint16_t Size, uint8_t *pOutputData); 87 | 88 | /* AES encryption/decryption/authentication processing functions *************/ 89 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData, uint32_t Timeout); 90 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); 91 | HAL_StatusTypeDef HAL_CRYPEx_AES_Auth_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pInputData, uint64_t Size, uint8_t *pOutputData); 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** @addtogroup CRYPEx_Exported_Functions_Group3 98 | * @{ 99 | */ 100 | 101 | /* AES suspension/resumption functions ***************************************/ 102 | void HAL_CRYPEx_Read_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 103 | void HAL_CRYPEx_Write_IVRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 104 | void HAL_CRYPEx_Read_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 105 | void HAL_CRYPEx_Write_SuspendRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 106 | void HAL_CRYPEx_Read_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Output, uint32_t KeySize); 107 | void HAL_CRYPEx_Write_KeyRegisters(CRYP_HandleTypeDef *hcryp, uint8_t* Input, uint32_t KeySize); 108 | void HAL_CRYPEx_Read_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Output); 109 | void HAL_CRYPEx_Write_ControlRegister(CRYP_HandleTypeDef *hcryp, uint8_t* Input); 110 | void HAL_CRYPEx_ProcessSuspend(CRYP_HandleTypeDef *hcryp); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /* Private functions -----------------------------------------------------------*/ 122 | /** @addtogroup CRYPEx_Private_Functions CRYPEx Private Functions 123 | * @{ 124 | */ 125 | HAL_StatusTypeDef CRYP_AES_Auth_IT(CRYP_HandleTypeDef *hcryp); 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | #endif /* defined (STM32L442xx) || defined (STM32L443xx) || defined (STM32L462xx) || defined(STM32L485xx) || defined(STM32L486xx) || defined(STM32L4A6xx) */ 141 | 142 | #ifdef __cplusplus 143 | } 144 | #endif 145 | 146 | #endif /* __STM32L4xx_HAL_CRYP_EX_H */ 147 | 148 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 149 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_def.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_def.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief This file contains HAL common defines, enumeration, macros and 8 | * structures definitions. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_DEF 41 | #define __STM32L4xx_HAL_DEF 42 | 43 | #ifdef __cplusplus 44 | extern "C" { 45 | #endif 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32l4xx.h" 49 | #include "Legacy/stm32_hal_legacy.h" /* Aliases file for old names compatibility */ 50 | #include 51 | 52 | /* Exported types ------------------------------------------------------------*/ 53 | 54 | /** 55 | * @brief HAL Status structures definition 56 | */ 57 | typedef enum 58 | { 59 | HAL_OK = 0x00, 60 | HAL_ERROR = 0x01, 61 | HAL_BUSY = 0x02, 62 | HAL_TIMEOUT = 0x03 63 | } HAL_StatusTypeDef; 64 | 65 | /** 66 | * @brief HAL Lock structures definition 67 | */ 68 | typedef enum 69 | { 70 | HAL_UNLOCKED = 0x00, 71 | HAL_LOCKED = 0x01 72 | } HAL_LockTypeDef; 73 | 74 | /* Exported macros -----------------------------------------------------------*/ 75 | 76 | #define HAL_MAX_DELAY 0xFFFFFFFFU 77 | 78 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT)) 79 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET) 80 | 81 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \ 82 | do{ \ 83 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \ 84 | (__DMA_HANDLE__).Parent = (__HANDLE__); \ 85 | } while(0) 86 | 87 | #define UNUSED(x) ((void)(x)) 88 | 89 | /** @brief Reset the Handle's State field. 90 | * @param __HANDLE__: specifies the Peripheral Handle. 91 | * @note This macro can be used for the following purpose: 92 | * - When the Handle is declared as local variable; before passing it as parameter 93 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro 94 | * to set to 0 the Handle's "State" field. 95 | * Otherwise, "State" field may have any random value and the first time the function 96 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed 97 | * (i.e. HAL_PPP_MspInit() will not be executed). 98 | * - When there is a need to reconfigure the low level hardware: instead of calling 99 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init(). 100 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function 101 | * HAL_PPP_MspInit() which will reconfigure the low level hardware. 102 | * @retval None 103 | */ 104 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0) 105 | 106 | #if (USE_RTOS == 1) 107 | /* Reserved for future use */ 108 | #error " USE_RTOS should be 0 in the current HAL release " 109 | #else 110 | #define __HAL_LOCK(__HANDLE__) \ 111 | do{ \ 112 | if((__HANDLE__)->Lock == HAL_LOCKED) \ 113 | { \ 114 | return HAL_BUSY; \ 115 | } \ 116 | else \ 117 | { \ 118 | (__HANDLE__)->Lock = HAL_LOCKED; \ 119 | } \ 120 | }while (0) 121 | 122 | #define __HAL_UNLOCK(__HANDLE__) \ 123 | do{ \ 124 | (__HANDLE__)->Lock = HAL_UNLOCKED; \ 125 | }while (0) 126 | #endif /* USE_RTOS */ 127 | 128 | #if defined ( __GNUC__ ) 129 | #ifndef __weak 130 | #define __weak __attribute__((weak)) 131 | #endif /* __weak */ 132 | #ifndef __packed 133 | #define __packed __attribute__((__packed__)) 134 | #endif /* __packed */ 135 | #endif /* __GNUC__ */ 136 | 137 | 138 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */ 139 | #if defined (__GNUC__) /* GNU Compiler */ 140 | #ifndef __ALIGN_END 141 | #define __ALIGN_END __attribute__ ((aligned (4))) 142 | #endif /* __ALIGN_END */ 143 | #ifndef __ALIGN_BEGIN 144 | #define __ALIGN_BEGIN 145 | #endif /* __ALIGN_BEGIN */ 146 | #else 147 | #ifndef __ALIGN_END 148 | #define __ALIGN_END 149 | #endif /* __ALIGN_END */ 150 | #ifndef __ALIGN_BEGIN 151 | #if defined (__CC_ARM) /* ARM Compiler */ 152 | #define __ALIGN_BEGIN __align(4) 153 | #elif defined (__ICCARM__) /* IAR Compiler */ 154 | #define __ALIGN_BEGIN 155 | #endif /* __CC_ARM */ 156 | #endif /* __ALIGN_BEGIN */ 157 | #endif /* __GNUC__ */ 158 | 159 | /** 160 | * @brief __RAM_FUNC definition 161 | */ 162 | #if defined ( __CC_ARM ) 163 | /* ARM Compiler 164 | ------------ 165 | RAM functions are defined using the toolchain options. 166 | Functions that are executed in RAM should reside in a separate source module. 167 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 168 | area of a module to a memory space in physical RAM. 169 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 170 | dialog. 171 | */ 172 | #define __RAM_FUNC HAL_StatusTypeDef 173 | 174 | #elif defined ( __ICCARM__ ) 175 | /* ICCARM Compiler 176 | --------------- 177 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 178 | */ 179 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef 180 | 181 | #elif defined ( __GNUC__ ) 182 | /* GNU Compiler 183 | ------------ 184 | RAM functions are defined using a specific toolchain attribute 185 | "__attribute__((section(".RamFunc")))". 186 | */ 187 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc"))) 188 | 189 | #endif 190 | 191 | /** 192 | * @brief __NOINLINE definition 193 | */ 194 | #if defined ( __CC_ARM ) || defined ( __GNUC__ ) 195 | /* ARM & GNUCompiler 196 | ---------------- 197 | */ 198 | #define __NOINLINE __attribute__ ( (noinline) ) 199 | 200 | #elif defined ( __ICCARM__ ) 201 | /* ICCARM Compiler 202 | --------------- 203 | */ 204 | #define __NOINLINE _Pragma("optimize = no_inline") 205 | 206 | #endif 207 | 208 | 209 | #ifdef __cplusplus 210 | } 211 | #endif 212 | 213 | #endif /* ___STM32L4xx_HAL_DEF */ 214 | 215 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 216 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of FLASH HAL Extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_FLASH_EX_H 40 | #define __STM32L4xx_HAL_FLASH_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup FLASHEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | 59 | /* Exported constants --------------------------------------------------------*/ 60 | 61 | /* Exported macro ------------------------------------------------------------*/ 62 | 63 | /* Exported functions --------------------------------------------------------*/ 64 | /** @addtogroup FLASHEx_Exported_Functions 65 | * @{ 66 | */ 67 | 68 | /* Extended Program operation functions *************************************/ 69 | /** @addtogroup FLASHEx_Exported_Functions_Group1 70 | * @{ 71 | */ 72 | HAL_StatusTypeDef HAL_FLASHEx_Erase(FLASH_EraseInitTypeDef *pEraseInit, uint32_t *PageError); 73 | HAL_StatusTypeDef HAL_FLASHEx_Erase_IT(FLASH_EraseInitTypeDef *pEraseInit); 74 | HAL_StatusTypeDef HAL_FLASHEx_OBProgram(FLASH_OBProgramInitTypeDef *pOBInit); 75 | void HAL_FLASHEx_OBGetConfig(FLASH_OBProgramInitTypeDef *pOBInit); 76 | /** 77 | * @} 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | #ifdef __cplusplus 93 | } 94 | #endif 95 | 96 | #endif /* __STM32L4xx_HAL_FLASH_EX_H */ 97 | 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_flash_ramfunc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ramfunc.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of FLASH RAMFUNC driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_FLASH_RAMFUNC_H 40 | #define __STM32L4xx_FLASH_RAMFUNC_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup FLASH_RAMFUNC 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | /** 60 | * @brief __RAM_FUNC definition 61 | */ 62 | #if defined ( __CC_ARM ) 63 | /* ARM Compiler 64 | ------------ 65 | RAM functions are defined using the toolchain options. 66 | Functions that are executed in RAM should reside in a separate source module. 67 | Using the 'Options for File' dialog you can simply change the 'Code / Const' 68 | area of a module to a memory space in physical RAM. 69 | Available memory areas are declared in the 'Target' tab of the 'Options for Target' 70 | dialog. 71 | */ 72 | #define __RAM_FUNC HAL_StatusTypeDef 73 | 74 | #elif defined ( __ICCARM__ ) 75 | /* ICCARM Compiler 76 | --------------- 77 | RAM functions are defined using a specific toolchain keyword "__ramfunc". 78 | */ 79 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef 80 | 81 | #elif defined ( __GNUC__ ) 82 | /* GNU Compiler 83 | ------------ 84 | RAM functions are defined using a specific toolchain attribute 85 | "__attribute__((section(".RamFunc")))". 86 | */ 87 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc"))) 88 | 89 | #endif 90 | 91 | 92 | /* Exported functions --------------------------------------------------------*/ 93 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions 94 | * @{ 95 | */ 96 | 97 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1 98 | * @{ 99 | */ 100 | /* Peripheral Control functions ************************************************/ 101 | __RAM_FUNC HAL_FLASHEx_EnableRunPowerDown(void); 102 | __RAM_FUNC HAL_FLASHEx_DisableRunPowerDown(void); 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | #ifdef __cplusplus 120 | } 121 | #endif 122 | 123 | #endif /* __STM32L4xx_FLASH_RAMFUNC_H */ 124 | 125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_hash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_hash_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of HASH HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_HASH_EX_H 40 | #define __STM32L4xx_HAL_HASH_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined (STM32L4A6xx) 47 | 48 | /* Includes ------------------------------------------------------------------*/ 49 | #include "stm32l4xx_hal_def.h" 50 | 51 | /** @addtogroup STM32L4xx_HAL_Driver 52 | * @{ 53 | */ 54 | 55 | /** @addtogroup HASHEx 56 | * @{ 57 | */ 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | /* Exported macro ------------------------------------------------------------*/ 62 | 63 | 64 | /* Exported functions --------------------------------------------------------*/ 65 | 66 | /** @addtogroup HASHEx_Exported_Functions HASH Extended Exported Functions 67 | * @{ 68 | */ 69 | 70 | /** @addtogroup HASHEx_Exported_Functions_Group1 HASH extended processing functions in polling mode 71 | * @{ 72 | */ 73 | 74 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 75 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 76 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 77 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @addtogroup HASHEx_Exported_Functions_Group2 HASH extended processing functions in interrupt mode 84 | * @{ 85 | */ 86 | 87 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 88 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @addtogroup HASHEx_Exported_Functions_Group3 HASH extended processing functions in DMA mode 95 | * @{ 96 | */ 97 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 98 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 99 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 100 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /** @addtogroup HASHEx_Exported_Functions_Group4 HMAC extended processing functions in polling mode 107 | * @{ 108 | */ 109 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 110 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 111 | /** 112 | * @} 113 | */ 114 | 115 | /** @addtogroup HASHEx_Exported_Functions_Group5 HMAC extended processing functions in interrupt mode 116 | * @{ 117 | */ 118 | 119 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 120 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /** @addtogroup HASHEx_Exported_Functions_Group6 HMAC extended processing functions in DMA mode 127 | * @{ 128 | */ 129 | 130 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 131 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 132 | 133 | /** 134 | * @} 135 | */ 136 | 137 | /** @addtogroup HASHEx_Exported_Functions_Group7 Multi-buffer HMAC extended processing functions in DMA mode 138 | * @{ 139 | */ 140 | 141 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 142 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 143 | HAL_StatusTypeDef HAL_HMACEx_MD5_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 144 | 145 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 146 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 147 | HAL_StatusTypeDef HAL_HMACEx_SHA1_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 148 | 149 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 150 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 151 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 152 | 153 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step1_2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 154 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 155 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Step2_3_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 156 | 157 | /** 158 | * @} 159 | */ 160 | 161 | /** 162 | * @} 163 | */ 164 | 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | 173 | #endif /* defined (STM32L4A6xx) */ 174 | 175 | #ifdef __cplusplus 176 | } 177 | #endif 178 | 179 | 180 | #endif /* __STM32L4xx_HAL_HASH_EX_H */ 181 | 182 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 183 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of I2C HAL Extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_I2C_EX_H 40 | #define __STM32L4xx_HAL_I2C_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup I2CEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported constants --------------------------------------------------------*/ 59 | 60 | /** @defgroup I2CEx_Exported_Constants I2C Extended Exported Constants 61 | * @{ 62 | */ 63 | 64 | /** @defgroup I2CEx_Analog_Filter I2C Extended Analog Filter 65 | * @{ 66 | */ 67 | #define I2C_ANALOGFILTER_ENABLE 0x00000000U 68 | #define I2C_ANALOGFILTER_DISABLE I2C_CR1_ANFOFF 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup I2CEx_FastModePlus I2C Extended Fast Mode Plus 74 | * @{ 75 | */ 76 | #define I2C_FMP_NOT_SUPPORTED 0xAAAA0000U /*!< Fast Mode Plus not supported */ 77 | #define I2C_FASTMODEPLUS_PB6 SYSCFG_CFGR1_I2C_PB6_FMP /*!< Enable Fast Mode Plus on PB6 */ 78 | #define I2C_FASTMODEPLUS_PB7 SYSCFG_CFGR1_I2C_PB7_FMP /*!< Enable Fast Mode Plus on PB7 */ 79 | #if defined(SYSCFG_CFGR1_I2C_PB8_FMP) 80 | #define I2C_FASTMODEPLUS_PB8 SYSCFG_CFGR1_I2C_PB8_FMP /*!< Enable Fast Mode Plus on PB8 */ 81 | #define I2C_FASTMODEPLUS_PB9 SYSCFG_CFGR1_I2C_PB9_FMP /*!< Enable Fast Mode Plus on PB9 */ 82 | #else 83 | #define I2C_FASTMODEPLUS_PB8 (uint32_t)(0x00000010U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB8 not supported */ 84 | #define I2C_FASTMODEPLUS_PB9 (uint32_t)(0x00000012U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus PB9 not supported */ 85 | #endif 86 | #define I2C_FASTMODEPLUS_I2C1 SYSCFG_CFGR1_I2C1_FMP /*!< Enable Fast Mode Plus on I2C1 pins */ 87 | #if defined(SYSCFG_CFGR1_I2C2_FMP) 88 | #define I2C_FASTMODEPLUS_I2C2 SYSCFG_CFGR1_I2C2_FMP /*!< Enable Fast Mode Plus on I2C2 pins */ 89 | #else 90 | #define I2C_FASTMODEPLUS_I2C2 (uint32_t)(0x00000200U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C2 not supported */ 91 | #endif 92 | #define I2C_FASTMODEPLUS_I2C3 SYSCFG_CFGR1_I2C3_FMP /*!< Enable Fast Mode Plus on I2C3 pins */ 93 | #if defined(SYSCFG_CFGR1_I2C4_FMP) 94 | #define I2C_FASTMODEPLUS_I2C4 SYSCFG_CFGR1_I2C4_FMP /*!< Enable Fast Mode Plus on I2C4 pins */ 95 | #else 96 | #define I2C_FASTMODEPLUS_I2C4 (uint32_t)(0x00000800U | I2C_FMP_NOT_SUPPORTED) /*!< Fast Mode Plus I2C4 not supported */ 97 | #endif 98 | /** 99 | * @} 100 | */ 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | /* Exported macro ------------------------------------------------------------*/ 107 | /* Exported functions --------------------------------------------------------*/ 108 | 109 | /** @addtogroup I2CEx_Exported_Functions I2C Extended Exported Functions 110 | * @{ 111 | */ 112 | 113 | /** @addtogroup I2CEx_Exported_Functions_Group1 Extended features functions 114 | * @brief Extended features functions 115 | * @{ 116 | */ 117 | 118 | /* Peripheral Control functions ************************************************/ 119 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter); 120 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter); 121 | HAL_StatusTypeDef HAL_I2CEx_EnableWakeUp(I2C_HandleTypeDef *hi2c); 122 | HAL_StatusTypeDef HAL_I2CEx_DisableWakeUp(I2C_HandleTypeDef *hi2c); 123 | void HAL_I2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 124 | void HAL_I2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 125 | 126 | /* Private constants ---------------------------------------------------------*/ 127 | /** @defgroup I2CEx_Private_Constants I2C Extended Private Constants 128 | * @{ 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /* Private macros ------------------------------------------------------------*/ 136 | /** @defgroup I2CEx_Private_Macro I2C Extended Private Macros 137 | * @{ 138 | */ 139 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \ 140 | ((FILTER) == I2C_ANALOGFILTER_DISABLE)) 141 | 142 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU) 143 | 144 | #define IS_I2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & I2C_FMP_NOT_SUPPORTED) != I2C_FMP_NOT_SUPPORTED) && \ 145 | ((((__CONFIG__) & (I2C_FASTMODEPLUS_PB6)) == I2C_FASTMODEPLUS_PB6) || \ 146 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB7)) == I2C_FASTMODEPLUS_PB7) || \ 147 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB8)) == I2C_FASTMODEPLUS_PB8) || \ 148 | (((__CONFIG__) & (I2C_FASTMODEPLUS_PB9)) == I2C_FASTMODEPLUS_PB9) || \ 149 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C1)) == I2C_FASTMODEPLUS_I2C1) || \ 150 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C2)) == I2C_FASTMODEPLUS_I2C2) || \ 151 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C3)) == I2C_FASTMODEPLUS_I2C3) || \ 152 | (((__CONFIG__) & (I2C_FASTMODEPLUS_I2C4)) == I2C_FASTMODEPLUS_I2C4))) 153 | /** 154 | * @} 155 | */ 156 | 157 | /* Private Functions ---------------------------------------------------------*/ 158 | /** @defgroup I2CEx_Private_Functions I2C Extended Private Functions 159 | * @{ 160 | */ 161 | /* Private functions are defined in stm32l4xx_hal_i2c_ex.c file */ 162 | /** 163 | * @} 164 | */ 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | /** 171 | * @} 172 | */ 173 | 174 | /** 175 | * @} 176 | */ 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | #ifdef __cplusplus 183 | } 184 | #endif 185 | 186 | #endif /* __STM32L4xx_HAL_I2C_EX_H */ 187 | 188 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 189 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_iwdg.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of IWDG HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_IWDG_H 40 | #define __STM32L4xx_HAL_IWDG_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @defgroup IWDG IWDG 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /** @defgroup IWDG_Exported_Types IWDG Exported Types 59 | * @{ 60 | */ 61 | 62 | /** 63 | * @brief IWDG Init structure definition 64 | */ 65 | typedef struct 66 | { 67 | uint32_t Prescaler; /*!< Select the prescaler of the IWDG. 68 | This parameter can be a value of @ref IWDG_Prescaler */ 69 | 70 | uint32_t Reload; /*!< Specifies the IWDG down-counter reload value. 71 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 72 | 73 | uint32_t Window; /*!< Specifies the window value to be compared to the down-counter. 74 | This parameter must be a number between Min_Data = 0 and Max_Data = 0x0FFF */ 75 | 76 | } IWDG_InitTypeDef; 77 | 78 | /** 79 | * @brief IWDG Handle Structure definition 80 | */ 81 | typedef struct 82 | { 83 | IWDG_TypeDef *Instance; /*!< Register base address */ 84 | 85 | IWDG_InitTypeDef Init; /*!< IWDG required parameters */ 86 | 87 | }IWDG_HandleTypeDef; 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /* Exported constants --------------------------------------------------------*/ 94 | /** @defgroup IWDG_Exported_Constants IWDG Exported Constants 95 | * @{ 96 | */ 97 | 98 | /** @defgroup IWDG_Prescaler IWDG Prescaler 99 | * @{ 100 | */ 101 | #define IWDG_PRESCALER_4 0x00000000u /*!< IWDG prescaler set to 4 */ 102 | #define IWDG_PRESCALER_8 IWDG_PR_PR_0 /*!< IWDG prescaler set to 8 */ 103 | #define IWDG_PRESCALER_16 IWDG_PR_PR_1 /*!< IWDG prescaler set to 16 */ 104 | #define IWDG_PRESCALER_32 (IWDG_PR_PR_1 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 32 */ 105 | #define IWDG_PRESCALER_64 IWDG_PR_PR_2 /*!< IWDG prescaler set to 64 */ 106 | #define IWDG_PRESCALER_128 (IWDG_PR_PR_2 | IWDG_PR_PR_0) /*!< IWDG prescaler set to 128 */ 107 | #define IWDG_PRESCALER_256 (IWDG_PR_PR_2 | IWDG_PR_PR_1) /*!< IWDG prescaler set to 256 */ 108 | /** 109 | * @} 110 | */ 111 | 112 | /** @defgroup IWDG_Window_option IWDG Window option 113 | * @{ 114 | */ 115 | #define IWDG_WINDOW_DISABLE IWDG_WINR_WIN 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | /* Exported macros -----------------------------------------------------------*/ 125 | /** @defgroup IWDG_Exported_Macros IWDG Exported Macros 126 | * @{ 127 | */ 128 | 129 | /** 130 | * @brief Enable the IWDG peripheral. 131 | * @param __HANDLE__ IWDG handle 132 | * @retval None 133 | */ 134 | #define __HAL_IWDG_START(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_ENABLE) 135 | 136 | /** 137 | * @brief Reload IWDG counter with value defined in the reload register 138 | * (write access to IWDG_PR, IWDG_RLR & IWDG_WINR registers disabled). 139 | * @param __HANDLE__ IWDG handle 140 | * @retval None 141 | */ 142 | #define __HAL_IWDG_RELOAD_COUNTER(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_RELOAD) 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | /* Exported functions --------------------------------------------------------*/ 149 | /** @defgroup IWDG_Exported_Functions IWDG Exported Functions 150 | * @{ 151 | */ 152 | 153 | /** @defgroup IWDG_Exported_Functions_Group1 Initialization and Start functions 154 | * @{ 155 | */ 156 | /* Initialization/Start functions ********************************************/ 157 | HAL_StatusTypeDef HAL_IWDG_Init(IWDG_HandleTypeDef *hiwdg); 158 | /** 159 | * @} 160 | */ 161 | 162 | /** @defgroup IWDG_Exported_Functions_Group2 IO operation functions 163 | * @{ 164 | */ 165 | /* I/O operation functions ****************************************************/ 166 | HAL_StatusTypeDef HAL_IWDG_Refresh(IWDG_HandleTypeDef *hiwdg); 167 | /** 168 | * @} 169 | */ 170 | 171 | /** 172 | * @} 173 | */ 174 | 175 | /* Private constants ---------------------------------------------------------*/ 176 | /** @defgroup IWDG_Private_Constants IWDG Private Constants 177 | * @{ 178 | */ 179 | 180 | /** 181 | * @brief IWDG Key Register BitMask 182 | */ 183 | #define IWDG_KEY_RELOAD 0x0000AAAAu /*!< IWDG Reload Counter Enable */ 184 | #define IWDG_KEY_ENABLE 0x0000CCCCu /*!< IWDG Peripheral Enable */ 185 | #define IWDG_KEY_WRITE_ACCESS_ENABLE 0x00005555u /*!< IWDG KR Write Access Enable */ 186 | #define IWDG_KEY_WRITE_ACCESS_DISABLE 0x00000000u /*!< IWDG KR Write Access Disable */ 187 | 188 | /** 189 | * @} 190 | */ 191 | 192 | /* Private macros ------------------------------------------------------------*/ 193 | /** @defgroup IWDG_Private_Macros IWDG Private Macros 194 | * @{ 195 | */ 196 | 197 | /** 198 | * @brief Enable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 199 | * @param __HANDLE__ IWDG handle 200 | * @retval None 201 | */ 202 | #define IWDG_ENABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_ENABLE) 203 | 204 | /** 205 | * @brief Disable write access to IWDG_PR, IWDG_RLR and IWDG_WINR registers. 206 | * @param __HANDLE__ IWDG handle 207 | * @retval None 208 | */ 209 | #define IWDG_DISABLE_WRITE_ACCESS(__HANDLE__) WRITE_REG((__HANDLE__)->Instance->KR, IWDG_KEY_WRITE_ACCESS_DISABLE) 210 | 211 | /** 212 | * @brief Check IWDG prescaler value. 213 | * @param __PRESCALER__ IWDG prescaler value 214 | * @retval None 215 | */ 216 | #define IS_IWDG_PRESCALER(__PRESCALER__) (((__PRESCALER__) == IWDG_PRESCALER_4) || \ 217 | ((__PRESCALER__) == IWDG_PRESCALER_8) || \ 218 | ((__PRESCALER__) == IWDG_PRESCALER_16) || \ 219 | ((__PRESCALER__) == IWDG_PRESCALER_32) || \ 220 | ((__PRESCALER__) == IWDG_PRESCALER_64) || \ 221 | ((__PRESCALER__) == IWDG_PRESCALER_128)|| \ 222 | ((__PRESCALER__) == IWDG_PRESCALER_256)) 223 | 224 | /** 225 | * @brief Check IWDG reload value. 226 | * @param __RELOAD__ IWDG reload value 227 | * @retval None 228 | */ 229 | #define IS_IWDG_RELOAD(__RELOAD__) ((__RELOAD__) <= IWDG_RLR_RL) 230 | 231 | /** 232 | * @brief Check IWDG window value. 233 | * @param __WINDOW__ IWDG window value 234 | * @retval None 235 | */ 236 | #define IS_IWDG_WINDOW(__WINDOW__) ((__WINDOW__) <= IWDG_WINR_WIN) 237 | 238 | /** 239 | * @} 240 | */ 241 | 242 | /** 243 | * @} 244 | */ 245 | 246 | /** 247 | * @} 248 | */ 249 | 250 | 251 | #ifdef __cplusplus 252 | } 253 | #endif 254 | 255 | #endif /* __STM32L4xx_HAL_IWDG_H */ 256 | 257 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 258 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_opamp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_opamp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of OPAMP HAL Extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_OPAMP_EX_H 40 | #define __STM32L4xx_HAL_OPAMP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup OPAMPEx 54 | * @{ 55 | */ 56 | /* Exported types ------------------------------------------------------------*/ 57 | /* Exported constants --------------------------------------------------------*/ 58 | /* Exported macro ------------------------------------------------------------*/ 59 | /* Exported functions --------------------------------------------------------*/ 60 | /** @addtogroup OPAMPEx_Exported_Functions OPAMPEx Exported Functions 61 | * @{ 62 | */ 63 | 64 | #if defined (STM32L471xx) || defined (STM32L475xx) || defined (STM32L476xx) || defined (STM32L485xx) || defined (STM32L486xx) || \ 65 | defined (STM32L496xx) || defined (STM32L4A6xx) 66 | 67 | /* I/O operation functions *****************************************************/ 68 | /** @addtogroup OPAMPEx_Exported_Functions_Group1 Extended Input and Output operation functions 69 | * @{ 70 | */ 71 | 72 | HAL_StatusTypeDef HAL_OPAMPEx_SelfCalibrateAll(OPAMP_HandleTypeDef *hopamp1, OPAMP_HandleTypeDef *hopamp2); 73 | 74 | /** 75 | * @} 76 | */ 77 | #endif 78 | 79 | /* Peripheral Control functions ************************************************/ 80 | /** @addtogroup OPAMPEx_Exported_Functions_Group2 81 | * @{ 82 | */ 83 | HAL_StatusTypeDef HAL_OPAMPEx_Unlock(OPAMP_HandleTypeDef *hopamp); 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | 105 | #endif /* __STM32L4xx_HAL_OPAMP_EX_H */ 106 | 107 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 108 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of PCD HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_PCD_EX_H 40 | #define __STM32L4xx_HAL_PCD_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32L432xx) || defined(STM32L433xx) || defined(STM32L442xx) || defined(STM32L443xx) || \ 47 | defined(STM32L452xx) || defined(STM32L462xx) || \ 48 | defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \ 49 | defined(STM32L496xx) || defined(STM32L4A6xx) 50 | 51 | /* Includes ------------------------------------------------------------------*/ 52 | #include "stm32l4xx_hal_def.h" 53 | 54 | /** @addtogroup STM32L4xx_HAL_Driver 55 | * @{ 56 | */ 57 | 58 | /** @addtogroup PCDEx 59 | * @{ 60 | */ 61 | /* Exported types ------------------------------------------------------------*/ 62 | typedef enum 63 | { 64 | PCD_LPM_L0_ACTIVE = 0x00, /* on */ 65 | PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */ 66 | }PCD_LPM_MsgTypeDef; 67 | 68 | typedef enum 69 | { 70 | PCD_BCD_ERROR = 0xFF, 71 | PCD_BCD_CONTACT_DETECTION = 0xFE, 72 | PCD_BCD_STD_DOWNSTREAM_PORT = 0xFD, 73 | PCD_BCD_CHARGING_DOWNSTREAM_PORT = 0xFC, 74 | PCD_BCD_DEDICATED_CHARGING_PORT = 0xFB, 75 | PCD_BCD_DISCOVERY_COMPLETED = 0x00, 76 | 77 | }PCD_BCD_MsgTypeDef; 78 | 79 | /* Exported constants --------------------------------------------------------*/ 80 | /* Exported macros -----------------------------------------------------------*/ 81 | /* Exported functions --------------------------------------------------------*/ 82 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions 83 | * @{ 84 | */ 85 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 86 | * @{ 87 | */ 88 | 89 | #if defined(USB_OTG_FS) 90 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 91 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 92 | #endif /* USB_OTG_FS */ 93 | 94 | #if defined (USB) 95 | HAL_StatusTypeDef HAL_PCDEx_PMAConfig(PCD_HandleTypeDef *hpcd, 96 | uint16_t ep_addr, 97 | uint16_t ep_kind, 98 | uint32_t pmaadress); 99 | #endif /* USB */ 100 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 101 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 102 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd); 103 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd); 104 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd); 105 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 106 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg); 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | #endif /* STM32L432xx || STM32L433xx || STM32L442xx || STM32L443xx || */ 125 | /* STM32L452xx || STM32L462xx || */ 126 | /* STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || */ 127 | /* STM32L496xx || STM32L4A6xx */ 128 | 129 | #ifdef __cplusplus 130 | } 131 | #endif 132 | 133 | 134 | #endif /* __STM32L4xx_HAL_PCD_EX_H */ 135 | 136 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 137 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_spi_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_spi_ex.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of SPI HAL Extended module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_SPI_EX_H 40 | #define __STM32L4xx_HAL_SPI_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32l4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32L4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @addtogroup SPIEx 54 | * @{ 55 | */ 56 | 57 | /* Exported types ------------------------------------------------------------*/ 58 | /* Exported constants --------------------------------------------------------*/ 59 | /* Exported macros -----------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | /** @addtogroup SPIEx_Exported_Functions 62 | * @{ 63 | */ 64 | 65 | /* Initialization and de-initialization functions ****************************/ 66 | /* IO operation functions *****************************************************/ 67 | /** @addtogroup SPIEx_Exported_Functions_Group1 68 | * @{ 69 | */ 70 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi); 71 | /** 72 | * @} 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | #ifdef __cplusplus 88 | } 89 | #endif 90 | 91 | #endif /* __STM32L4xx_HAL_SPI_EX_H */ 92 | 93 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Inc/stm32l4xx_hal_sram.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_sram.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Header file of SRAM HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 __STM32L4xx_HAL_SRAM_H 40 | #define __STM32L4xx_HAL_SRAM_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32L471xx) || defined(STM32L475xx) || defined(STM32L476xx) || defined(STM32L485xx) || defined(STM32L486xx) || \ 47 | defined(STM32L496xx) || defined(STM32L4A6xx) 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32l4xx_ll_fmc.h" 51 | 52 | /** @addtogroup STM32L4xx_HAL_Driver 53 | * @{ 54 | */ 55 | 56 | /** @addtogroup SRAM 57 | * @{ 58 | */ 59 | 60 | /* Exported typedef ----------------------------------------------------------*/ 61 | 62 | /** @defgroup SRAM_Exported_Types SRAM Exported Types 63 | * @{ 64 | */ 65 | /** 66 | * @brief HAL SRAM State structures definition 67 | */ 68 | typedef enum 69 | { 70 | HAL_SRAM_STATE_RESET = 0x00, /*!< SRAM not yet initialized or disabled */ 71 | HAL_SRAM_STATE_READY = 0x01, /*!< SRAM initialized and ready for use */ 72 | HAL_SRAM_STATE_BUSY = 0x02, /*!< SRAM internal process is ongoing */ 73 | HAL_SRAM_STATE_ERROR = 0x03, /*!< SRAM error state */ 74 | HAL_SRAM_STATE_PROTECTED = 0x04 /*!< SRAM peripheral NORSRAM device write protected */ 75 | 76 | }HAL_SRAM_StateTypeDef; 77 | 78 | /** 79 | * @brief SRAM handle Structure definition 80 | */ 81 | typedef struct 82 | { 83 | FMC_NORSRAM_TypeDef *Instance; /*!< Register base address */ 84 | 85 | FMC_NORSRAM_EXTENDED_TypeDef *Extended; /*!< Extended mode register base address */ 86 | 87 | FMC_NORSRAM_InitTypeDef Init; /*!< SRAM device control configuration parameters */ 88 | 89 | HAL_LockTypeDef Lock; /*!< SRAM locking object */ 90 | 91 | __IO HAL_SRAM_StateTypeDef State; /*!< SRAM device access state */ 92 | 93 | DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ 94 | 95 | }SRAM_HandleTypeDef; 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /* Exported constants --------------------------------------------------------*/ 102 | /* Exported macro ------------------------------------------------------------*/ 103 | 104 | /** @defgroup SRAM_Exported_Macros SRAM Exported Macros 105 | * @{ 106 | */ 107 | 108 | /** @brief Reset SRAM handle state. 109 | * @param __HANDLE__: SRAM handle 110 | * @retval None 111 | */ 112 | #define __HAL_SRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SRAM_STATE_RESET) 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /* Exported functions --------------------------------------------------------*/ 119 | /** @addtogroup SRAM_Exported_Functions SRAM Exported Functions 120 | * @{ 121 | */ 122 | 123 | /** @addtogroup SRAM_Exported_Functions_Group1 Initialization and de-initialization functions 124 | * @{ 125 | */ 126 | 127 | /* Initialization/de-initialization functions ********************************/ 128 | HAL_StatusTypeDef HAL_SRAM_Init(SRAM_HandleTypeDef *hsram, FMC_NORSRAM_TimingTypeDef *Timing, FMC_NORSRAM_TimingTypeDef *ExtTiming); 129 | HAL_StatusTypeDef HAL_SRAM_DeInit(SRAM_HandleTypeDef *hsram); 130 | void HAL_SRAM_MspInit(SRAM_HandleTypeDef *hsram); 131 | void HAL_SRAM_MspDeInit(SRAM_HandleTypeDef *hsram); 132 | 133 | void HAL_SRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); 134 | void HAL_SRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /** @addtogroup SRAM_Exported_Functions_Group2 Input Output and memory control functions 141 | * @{ 142 | */ 143 | 144 | /* I/O operation functions ***************************************************/ 145 | HAL_StatusTypeDef HAL_SRAM_Read_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); 146 | HAL_StatusTypeDef HAL_SRAM_Write_8b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); 147 | HAL_StatusTypeDef HAL_SRAM_Read_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); 148 | HAL_StatusTypeDef HAL_SRAM_Write_16b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); 149 | HAL_StatusTypeDef HAL_SRAM_Read_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 150 | HAL_StatusTypeDef HAL_SRAM_Write_32b(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 151 | HAL_StatusTypeDef HAL_SRAM_Read_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 152 | HAL_StatusTypeDef HAL_SRAM_Write_DMA(SRAM_HandleTypeDef *hsram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** @addtogroup SRAM_Exported_Functions_Group3 Control functions 159 | * @{ 160 | */ 161 | 162 | /* SRAM Control functions ****************************************************/ 163 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Enable(SRAM_HandleTypeDef *hsram); 164 | HAL_StatusTypeDef HAL_SRAM_WriteOperation_Disable(SRAM_HandleTypeDef *hsram); 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | /** @addtogroup SRAM_Exported_Functions_Group4 Peripheral State functions 171 | * @{ 172 | */ 173 | 174 | /* SRAM Peripheral State functions ********************************************/ 175 | HAL_SRAM_StateTypeDef HAL_SRAM_GetState(SRAM_HandleTypeDef *hsram); 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | /** 190 | * @} 191 | */ 192 | 193 | #endif /* STM32L471xx || STM32L475xx || STM32L476xx || STM32L485xx || STM32L486xx || */ 194 | /* STM32L496xx || STM32L4A6xx || */ 195 | 196 | #ifdef __cplusplus 197 | } 198 | #endif 199 | 200 | #endif /* __STM32L4xx_HAL_SRAM_H */ 201 | 202 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 203 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma2d.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_dma2d.c -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_flash_ramfunc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_flash_ramfunc.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief FLASH RAMFUNC driver. 8 | * This file provides a Flash firmware functions which should be 9 | * executed from internal SRAM 10 | * + FLASH HalfPage Programming 11 | * + FLASH Power Down in Run mode 12 | * 13 | * @verbatim 14 | ============================================================================== 15 | ##### Flash RAM functions ##### 16 | ============================================================================== 17 | 18 | *** ARM Compiler *** 19 | -------------------- 20 | [..] RAM functions are defined using the toolchain options. 21 | Functions that are executed in RAM should reside in a separate 22 | source module. Using the 'Options for File' dialog you can simply change 23 | the 'Code / Const' area of a module to a memory space in physical RAM. 24 | Available memory areas are declared in the 'Target' tab of the 25 | Options for Target' dialog. 26 | 27 | *** ICCARM Compiler *** 28 | ----------------------- 29 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". 30 | 31 | *** GNU Compiler *** 32 | -------------------- 33 | [..] RAM functions are defined using a specific toolchain attribute 34 | "__attribute__((section(".RamFunc")))". 35 | 36 | @endverbatim 37 | ****************************************************************************** 38 | * @attention 39 | * 40 | *

© COPYRIGHT(c) 2017 STMicroelectronics

41 | * 42 | * Redistribution and use in source and binary forms, with or without modification, 43 | * are permitted provided that the following conditions are met: 44 | * 1. Redistributions of source code must retain the above copyright notice, 45 | * this list of conditions and the following disclaimer. 46 | * 2. Redistributions in binary form must reproduce the above copyright notice, 47 | * this list of conditions and the following disclaimer in the documentation 48 | * and/or other materials provided with the distribution. 49 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 50 | * may be used to endorse or promote products derived from this software 51 | * without specific prior written permission. 52 | * 53 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 54 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 55 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 56 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 57 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 58 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 59 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 60 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 61 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 62 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 63 | * 64 | ****************************************************************************** 65 | */ 66 | 67 | /* Includes ------------------------------------------------------------------*/ 68 | #include "stm32l4xx_hal.h" 69 | 70 | /** @addtogroup STM32L4xx_HAL_Driver 71 | * @{ 72 | */ 73 | 74 | /** @defgroup FLASH_RAMFUNC FLASH_RAMFUNC 75 | * @brief FLASH functions executed from RAM 76 | * @{ 77 | */ 78 | 79 | #ifdef HAL_FLASH_MODULE_ENABLED 80 | 81 | /* Private typedef -----------------------------------------------------------*/ 82 | /* Private define ------------------------------------------------------------*/ 83 | /* Private macro -------------------------------------------------------------*/ 84 | /* Private variables ---------------------------------------------------------*/ 85 | extern FLASH_ProcessTypeDef pFlash; 86 | 87 | /* Private function prototypes -----------------------------------------------*/ 88 | /* Exported functions -------------------------------------------------------*/ 89 | 90 | /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH in RAM function Exported Functions 91 | * @{ 92 | */ 93 | 94 | /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions 95 | * @brief Data transfers functions 96 | * 97 | @verbatim 98 | =============================================================================== 99 | ##### ramfunc functions ##### 100 | =============================================================================== 101 | [..] 102 | This subsection provides a set of functions that should be executed from RAM. 103 | 104 | @endverbatim 105 | * @{ 106 | */ 107 | 108 | /** 109 | * @brief Enable the Power down in Run Mode 110 | * @note This function should be called and executed from SRAM memory 111 | * @retval None 112 | */ 113 | __RAM_FUNC HAL_FLASHEx_EnableRunPowerDown(void) 114 | { 115 | /* Enable the Power Down in Run mode*/ 116 | __HAL_FLASH_POWER_DOWN_ENABLE(); 117 | 118 | return HAL_OK; 119 | 120 | } 121 | 122 | /** 123 | * @brief Disable the Power down in Run Mode 124 | * @note This function should be called and executed from SRAM memory 125 | * @retval None 126 | */ 127 | __RAM_FUNC HAL_FLASHEx_DisableRunPowerDown(void) 128 | { 129 | /* Disable the Power Down in Run mode*/ 130 | __HAL_FLASH_POWER_DOWN_DISABLE(); 131 | 132 | return HAL_OK; 133 | } 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | #endif /* HAL_FLASH_MODULE_ENABLED */ 143 | 144 | 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | 155 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 156 | 157 | 158 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_msp_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_msp_template.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 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 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2017 STMicroelectronics

14 | * 15 | * Redistribution and use in source and binary forms, with or without modification, 16 | * are permitted provided that the following conditions are met: 17 | * 1. Redistributions of source code must retain the above copyright notice, 18 | * this list of conditions and the following disclaimer. 19 | * 2. Redistributions in binary form must reproduce the above copyright notice, 20 | * this list of conditions and the following disclaimer in the documentation 21 | * and/or other materials provided with the distribution. 22 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 23 | * may be used to endorse or promote products derived from this software 24 | * without specific prior written permission. 25 | * 26 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 27 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 28 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 29 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 30 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 31 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 32 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 33 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 34 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 35 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 36 | * 37 | ****************************************************************************** 38 | */ 39 | 40 | /* Includes ------------------------------------------------------------------*/ 41 | #include "stm32l4xx_hal.h" 42 | 43 | /** @addtogroup STM32L4xx_HAL_Driver 44 | * @{ 45 | */ 46 | 47 | /** @defgroup HAL_MSP HAL MSP module driver 48 | * @brief HAL MSP module. 49 | * @{ 50 | */ 51 | 52 | /* Private typedef -----------------------------------------------------------*/ 53 | /* Private define ------------------------------------------------------------*/ 54 | /* Private macro -------------------------------------------------------------*/ 55 | /* Private variables ---------------------------------------------------------*/ 56 | /* Private function prototypes -----------------------------------------------*/ 57 | /* Private functions ---------------------------------------------------------*/ 58 | 59 | /** @defgroup HAL_MSP_Private_Functions 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @brief Initialize the Global MSP. 65 | * @param None 66 | * @retval None 67 | */ 68 | void HAL_MspInit(void) 69 | { 70 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 71 | modified by the user 72 | */ 73 | } 74 | 75 | /** 76 | * @brief DeInitialize the Global MSP. 77 | * @param None 78 | * @retval None 79 | */ 80 | void HAL_MspDeInit(void) 81 | { 82 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 83 | modified by the user 84 | */ 85 | } 86 | 87 | /** 88 | * @brief Initialize the PPP MSP. 89 | * @param None 90 | * @retval None 91 | */ 92 | void HAL_PPP_MspInit(void) 93 | { 94 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 95 | modified by the user 96 | */ 97 | } 98 | 99 | /** 100 | * @brief DeInitialize the PPP MSP. 101 | * @param None 102 | * @retval None 103 | */ 104 | void HAL_PPP_MspDeInit(void) 105 | { 106 | /* NOTE : This function is generated automatically by STM32CubeMX and eventually 107 | modified by the user 108 | */ 109 | } 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 124 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_smartcard_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_smartcard_ex.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief SMARTCARD HAL module driver. 8 | * This file provides extended firmware functions to manage the following 9 | * functionalities of the SmartCard. 10 | * + Initialization and de-initialization functions 11 | * + Peripheral Control functions 12 | * 13 | * 14 | @verbatim 15 | ============================================================================= 16 | ##### SMARTCARD peripheral extended features ##### 17 | ============================================================================= 18 | [..] 19 | The Extended SMARTCARD HAL driver can be used as follows: 20 | 21 | (#) After having configured the SMARTCARD basic features with HAL_SMARTCARD_Init(), 22 | then program SMARTCARD advanced features if required (TX/RX pins swap, TimeOut, 23 | auto-retry counter,...) in the hsmartcard AdvancedInit structure. 24 | 25 | 26 | 27 | @endverbatim 28 | ****************************************************************************** 29 | * @attention 30 | * 31 | *

© COPYRIGHT(c) 2017 STMicroelectronics

32 | * 33 | * Redistribution and use in source and binary forms, with or without modification, 34 | * are permitted provided that the following conditions are met: 35 | * 1. Redistributions of source code must retain the above copyright notice, 36 | * this list of conditions and the following disclaimer. 37 | * 2. Redistributions in binary form must reproduce the above copyright notice, 38 | * this list of conditions and the following disclaimer in the documentation 39 | * and/or other materials provided with the distribution. 40 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 41 | * may be used to endorse or promote products derived from this software 42 | * without specific prior written permission. 43 | * 44 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 45 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 46 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 47 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 48 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 49 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 50 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 51 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 52 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 53 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 54 | * 55 | ****************************************************************************** 56 | */ 57 | 58 | /* Includes ------------------------------------------------------------------*/ 59 | #include "stm32l4xx_hal.h" 60 | 61 | /** @addtogroup STM32L4xx_HAL_Driver 62 | * @{ 63 | */ 64 | 65 | /** @defgroup SMARTCARDEx SMARTCARDEx 66 | * @brief SMARTCARD Extended HAL module driver 67 | * @{ 68 | */ 69 | #ifdef HAL_SMARTCARD_MODULE_ENABLED 70 | 71 | /* Private typedef -----------------------------------------------------------*/ 72 | /* Private define ------------------------------------------------------------*/ 73 | /* Private macros ------------------------------------------------------------*/ 74 | /* Private variables ---------------------------------------------------------*/ 75 | /* Private function prototypes -----------------------------------------------*/ 76 | 77 | /* Exported functions --------------------------------------------------------*/ 78 | /** @defgroup SMARTCARDEx_Exported_Functions SMARTCARD Extended Exported Functions 79 | * @{ 80 | */ 81 | 82 | /** @defgroup SMARTCARDEx_Exported_Functions_Group1 Extended Peripheral Control functions 83 | * @brief Extended control functions 84 | * 85 | @verbatim 86 | =============================================================================== 87 | ##### Peripheral Control functions ##### 88 | =============================================================================== 89 | [..] 90 | This subsection provides a set of functions allowing to initialize the SMARTCARD. 91 | (+) HAL_SMARTCARDEx_BlockLength_Config() API allows to configure the Block Length on the fly 92 | (+) HAL_SMARTCARDEx_TimeOut_Config() API allows to configure the receiver timeout value on the fly 93 | (+) HAL_SMARTCARDEx_EnableReceiverTimeOut() API enables the receiver timeout feature 94 | (+) HAL_SMARTCARDEx_DisableReceiverTimeOut() API disables the receiver timeout feature 95 | 96 | @endverbatim 97 | * @{ 98 | */ 99 | 100 | /** 101 | * @brief Update on the fly the SMARTCARD block length in RTOR register. 102 | * @param hsmartcard: Pointer to a SMARTCARD_HandleTypeDef structure that contains 103 | * the configuration information for the specified SMARTCARD module. 104 | * @param BlockLength: SMARTCARD block length (8-bit long at most) 105 | * @retval None 106 | */ 107 | void HAL_SMARTCARDEx_BlockLength_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint8_t BlockLength) 108 | { 109 | MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_BLEN, ((uint32_t)BlockLength << SMARTCARD_RTOR_BLEN_LSB_POS)); 110 | } 111 | 112 | /** 113 | * @brief Update on the fly the receiver timeout value in RTOR register. 114 | * @param hsmartcard: Pointer to a SMARTCARD_HandleTypeDef structure that contains 115 | * the configuration information for the specified SMARTCARD module. 116 | * @param TimeOutValue: receiver timeout value in number of baud blocks. The timeout 117 | * value must be less or equal to 0x0FFFFFFFF. 118 | * @retval None 119 | */ 120 | void HAL_SMARTCARDEx_TimeOut_Config(SMARTCARD_HandleTypeDef *hsmartcard, uint32_t TimeOutValue) 121 | { 122 | assert_param(IS_SMARTCARD_TIMEOUT_VALUE(hsmartcard->Init.TimeOutValue)); 123 | MODIFY_REG(hsmartcard->Instance->RTOR, USART_RTOR_RTO, TimeOutValue); 124 | } 125 | 126 | /** 127 | * @brief Enable the SMARTCARD receiver timeout feature. 128 | * @param hsmartcard: Pointer to a SMARTCARD_HandleTypeDef structure that contains 129 | * the configuration information for the specified SMARTCARD module. 130 | * @retval HAL status 131 | */ 132 | HAL_StatusTypeDef HAL_SMARTCARDEx_EnableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard) 133 | { 134 | 135 | if(hsmartcard->gState == HAL_SMARTCARD_STATE_READY) 136 | { 137 | /* Process Locked */ 138 | __HAL_LOCK(hsmartcard); 139 | 140 | hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY; 141 | 142 | /* Set the USART RTOEN bit */ 143 | SET_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN); 144 | 145 | hsmartcard->gState = HAL_SMARTCARD_STATE_READY; 146 | 147 | /* Process Unlocked */ 148 | __HAL_UNLOCK(hsmartcard); 149 | 150 | return HAL_OK; 151 | } 152 | else 153 | { 154 | return HAL_BUSY; 155 | } 156 | } 157 | 158 | /** 159 | * @brief Disable the SMARTCARD receiver timeout feature. 160 | * @param hsmartcard: Pointer to a SMARTCARD_HandleTypeDef structure that contains 161 | * the configuration information for the specified SMARTCARD module. 162 | * @retval HAL status 163 | */ 164 | HAL_StatusTypeDef HAL_SMARTCARDEx_DisableReceiverTimeOut(SMARTCARD_HandleTypeDef *hsmartcard) 165 | { 166 | 167 | if(hsmartcard->gState == HAL_SMARTCARD_STATE_READY) 168 | { 169 | /* Process Locked */ 170 | __HAL_LOCK(hsmartcard); 171 | 172 | hsmartcard->gState = HAL_SMARTCARD_STATE_BUSY; 173 | 174 | /* Clear the USART RTOEN bit */ 175 | CLEAR_BIT(hsmartcard->Instance->CR2, USART_CR2_RTOEN); 176 | 177 | hsmartcard->gState = HAL_SMARTCARD_STATE_READY; 178 | 179 | /* Process Unlocked */ 180 | __HAL_UNLOCK(hsmartcard); 181 | 182 | return HAL_OK; 183 | } 184 | else 185 | { 186 | return HAL_BUSY; 187 | } 188 | } 189 | 190 | /** 191 | * @} 192 | */ 193 | 194 | /** 195 | * @} 196 | */ 197 | 198 | #endif /* HAL_SMARTCARD_MODULE_ENABLED */ 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 209 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_spi_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_spi_ex.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief Extended SPI HAL module driver. 8 | * This file provides firmware functions to manage the following 9 | * SPI peripheral extended functionalities : 10 | * + IO operation functions 11 | * 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | *

© COPYRIGHT(c) 2017 STMicroelectronics

16 | * 17 | * Redistribution and use in source and binary forms, with or without modification, 18 | * are permitted provided that the following conditions are met: 19 | * 1. Redistributions of source code must retain the above copyright notice, 20 | * this list of conditions and the following disclaimer. 21 | * 2. Redistributions in binary form must reproduce the above copyright notice, 22 | * this list of conditions and the following disclaimer in the documentation 23 | * and/or other materials provided with the distribution. 24 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 25 | * may be used to endorse or promote products derived from this software 26 | * without specific prior written permission. 27 | * 28 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 29 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 30 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 31 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 32 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 33 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 34 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 36 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 37 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 38 | * 39 | ****************************************************************************** 40 | */ 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | #include "stm32l4xx_hal.h" 44 | 45 | /** @addtogroup STM32L4xx_HAL_Driver 46 | * @{ 47 | */ 48 | 49 | /** @defgroup SPIEx SPIEx 50 | * @brief SPI Extended HAL module driver 51 | * @{ 52 | */ 53 | #ifdef HAL_SPI_MODULE_ENABLED 54 | 55 | /* Private typedef -----------------------------------------------------------*/ 56 | /* Private defines -----------------------------------------------------------*/ 57 | /** @defgroup SPIEx_Private_Constants SPIEx Private Constants 58 | * @{ 59 | */ 60 | #define SPI_FIFO_SIZE 4 61 | /** 62 | * @} 63 | */ 64 | 65 | /* Private macros ------------------------------------------------------------*/ 66 | /* Private variables ---------------------------------------------------------*/ 67 | /* Private function prototypes -----------------------------------------------*/ 68 | /* Exported functions ---------------------------------------------------------*/ 69 | 70 | /** @defgroup SPIEx_Exported_Functions SPIEx Exported Functions 71 | * @{ 72 | */ 73 | 74 | /** @defgroup SPIEx_Exported_Functions_Group1 IO operation functions 75 | * @brief Data transfers functions 76 | * 77 | @verbatim 78 | ============================================================================== 79 | ##### IO operation functions ##### 80 | =============================================================================== 81 | [..] 82 | This subsection provides a set of extended functions to manage the SPI 83 | data transfers. 84 | 85 | (#) Rx data flush function: 86 | (++) HAL_SPIEx_FlushRxFifo() 87 | 88 | @endverbatim 89 | * @{ 90 | */ 91 | 92 | /** 93 | * @brief Flush the RX fifo. 94 | * @param hspi: pointer to a SPI_HandleTypeDef structure that contains 95 | * the configuration information for the specified SPI module. 96 | * @retval HAL status 97 | */ 98 | HAL_StatusTypeDef HAL_SPIEx_FlushRxFifo(SPI_HandleTypeDef *hspi) 99 | { 100 | __IO uint32_t tmpreg; 101 | uint8_t count = 0U; 102 | while ((hspi->Instance->SR & SPI_FLAG_FRLVL) != SPI_FRLVL_EMPTY) 103 | { 104 | count++; 105 | tmpreg = hspi->Instance->DR; 106 | UNUSED(tmpreg); /* To avoid GCC warning */ 107 | if (count == SPI_FIFO_SIZE) 108 | { 109 | return HAL_TIMEOUT; 110 | } 111 | } 112 | return HAL_OK; 113 | } 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | #endif /* HAL_SPI_MODULE_ENABLED */ 124 | 125 | /** 126 | * @} 127 | */ 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 134 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_swpmi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/glegrain/STM32-SPI-Bootloader-host/6c91c69c593e99ac7dfcb746d5ed8bb85a7ff8f1/Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_swpmi.c -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_hal_timebase_tim_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_hal_timebase_tim_template.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief HAL time base based on the hardware TIM Template. 8 | * 9 | * This file override the native HAL time base functions (defined as weak) 10 | * the TIM time base: 11 | * + Intializes the TIM peripheral to generate a Period elapsed Event each 1ms 12 | * + HAL_IncTick is called inside HAL_TIM_PeriodElapsedCallback ie each 1ms 13 | * 14 | @verbatim 15 | ============================================================================== 16 | ##### How to use this driver ##### 17 | ============================================================================== 18 | [..] 19 | This file must be copied to the application folder and modified as follows: 20 | (#) Rename it to 'stm32l4xx_hal_timebase_tim.c' 21 | (#) Add this file and the TIM HAL driver files to your project and make sure 22 | HAL_TIM_MODULE_ENABLED is defined in stm32l4xx_hal_conf.h 23 | 24 | [..] 25 | (@) The application needs to ensure that the time base is always set to 1 millisecond 26 | to have correct HAL operation. 27 | 28 | @endverbatim 29 | ****************************************************************************** 30 | * @attention 31 | * 32 | *

© COPYRIGHT(c) 2017 STMicroelectronics

33 | * 34 | * Redistribution and use in source and binary forms, with or without modification, 35 | * are permitted provided that the following conditions are met: 36 | * 1. Redistributions of source code must retain the above copyright notice, 37 | * this list of conditions and the following disclaimer. 38 | * 2. Redistributions in binary form must reproduce the above copyright notice, 39 | * this list of conditions and the following disclaimer in the documentation 40 | * and/or other materials provided with the distribution. 41 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 42 | * may be used to endorse or promote products derived from this software 43 | * without specific prior written permission. 44 | * 45 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 46 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 47 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 48 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 49 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 50 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 51 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 52 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 53 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 54 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 55 | * 56 | ****************************************************************************** 57 | */ 58 | 59 | /* Includes ------------------------------------------------------------------*/ 60 | #include "stm32l4xx_hal.h" 61 | 62 | /** @addtogroup STM32L4xx_HAL_Driver 63 | * @{ 64 | */ 65 | 66 | /** @addtogroup HAL_TimeBase 67 | * @{ 68 | */ 69 | 70 | /* Private typedef -----------------------------------------------------------*/ 71 | /* Private define ------------------------------------------------------------*/ 72 | /* Private macro -------------------------------------------------------------*/ 73 | /* Private variables ---------------------------------------------------------*/ 74 | TIM_HandleTypeDef TimHandle; 75 | /* Private function prototypes -----------------------------------------------*/ 76 | void TIM6_DAC_IRQHandler(void); 77 | /* Private functions ---------------------------------------------------------*/ 78 | 79 | /** 80 | * @brief This function configures the TIM6 as a time base source. 81 | * The time source is configured to have 1ms time base with a dedicated 82 | * Tick interrupt priority. 83 | * @note This function is called automatically at the beginning of program after 84 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig(). 85 | * @param TickPriority: Tick interrupt priority. 86 | * @retval HAL status 87 | */ 88 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority) 89 | { 90 | RCC_ClkInitTypeDef clkconfig; 91 | uint32_t uwTimclock, uwAPB1Prescaler = 0U; 92 | uint32_t uwPrescalerValue = 0U; 93 | uint32_t pFLatency; 94 | 95 | /* Configure the TIM6 IRQ priority */ 96 | HAL_NVIC_SetPriority(TIM6_DAC_IRQn, TickPriority, 0U); 97 | 98 | /* Enable the TIM6 global Interrupt */ 99 | HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); 100 | 101 | /* Enable TIM6 clock */ 102 | __HAL_RCC_TIM6_CLK_ENABLE(); 103 | 104 | /* Get clock configuration */ 105 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency); 106 | 107 | /* Get APB1 prescaler */ 108 | uwAPB1Prescaler = clkconfig.APB1CLKDivider; 109 | 110 | /* Compute TIM6 clock */ 111 | if (uwAPB1Prescaler == RCC_HCLK_DIV1) 112 | { 113 | uwTimclock = HAL_RCC_GetPCLK1Freq(); 114 | } 115 | else 116 | { 117 | uwTimclock = 2*HAL_RCC_GetPCLK1Freq(); 118 | } 119 | 120 | /* Compute the prescaler value to have TIM6 counter clock equal to 1MHz */ 121 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U); 122 | 123 | /* Initialize TIM6 */ 124 | TimHandle.Instance = TIM6; 125 | 126 | /* Initialize TIMx peripheral as follow: 127 | + Period = [(TIM6CLK/1000) - 1]. to have a (1/1000) s time base. 128 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock. 129 | + ClockDivision = 0 130 | + Counter direction = Up 131 | */ 132 | TimHandle.Init.Period = (1000000U / 1000U) - 1U; 133 | TimHandle.Init.Prescaler = uwPrescalerValue; 134 | TimHandle.Init.ClockDivision = 0; 135 | TimHandle.Init.CounterMode = TIM_COUNTERMODE_UP; 136 | if(HAL_TIM_Base_Init(&TimHandle) == HAL_OK) 137 | { 138 | /* Start the TIM time Base generation in interrupt mode */ 139 | return HAL_TIM_Base_Start_IT(&TimHandle); 140 | } 141 | 142 | /* Return function status */ 143 | return HAL_ERROR; 144 | } 145 | 146 | /** 147 | * @brief Suspend Tick increment. 148 | * @note Disable the tick increment by disabling TIM6 update interrupt. 149 | * @param None 150 | * @retval None 151 | */ 152 | void HAL_SuspendTick(void) 153 | { 154 | /* Disable TIM6 update interrupt */ 155 | __HAL_TIM_DISABLE_IT(&TimHandle, TIM_IT_UPDATE); 156 | } 157 | 158 | /** 159 | * @brief Resume Tick increment. 160 | * @note Enable the tick increment by enabling TIM6 update interrupt. 161 | * @param None 162 | * @retval None 163 | */ 164 | void HAL_ResumeTick(void) 165 | { 166 | /* Enable TIM6 update interrupt */ 167 | __HAL_TIM_ENABLE_IT(&TimHandle, TIM_IT_UPDATE); 168 | } 169 | 170 | /** 171 | * @brief Period elapsed callback in non blocking mode 172 | * @note This function is called when TIM6 interrupt took place, inside 173 | * HAL_TIM_IRQHandler(). It makes a direct call to HAL_IncTick() to increment 174 | * a global variable "uwTick" used as application time base. 175 | * @param htim : TIM handle 176 | * @retval None 177 | */ 178 | void HAL_TIM_PeriodElapsedCallback(TIM_HandleTypeDef *htim) 179 | { 180 | HAL_IncTick(); 181 | } 182 | 183 | /** 184 | * @brief This function handles TIM interrupt request. 185 | * @param None 186 | * @retval None 187 | */ 188 | void TIM6_DAC_IRQHandler(void) 189 | { 190 | HAL_TIM_IRQHandler(&TimHandle); 191 | } 192 | 193 | /** 194 | * @} 195 | */ 196 | 197 | /** 198 | * @} 199 | */ 200 | 201 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 202 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_crc.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief CRC LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_crc.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | 43 | #ifdef USE_FULL_ASSERT 44 | #include "stm32_assert.h" 45 | #else 46 | #define assert_param(expr) ((void)0U) 47 | #endif 48 | 49 | /** @addtogroup STM32L4xx_LL_Driver 50 | * @{ 51 | */ 52 | 53 | #if defined (CRC) 54 | 55 | /** @addtogroup CRC_LL 56 | * @{ 57 | */ 58 | 59 | /* Private types -------------------------------------------------------------*/ 60 | /* Private variables ---------------------------------------------------------*/ 61 | /* Private constants ---------------------------------------------------------*/ 62 | /* Private macros ------------------------------------------------------------*/ 63 | /* Private function prototypes -----------------------------------------------*/ 64 | 65 | /* Exported functions --------------------------------------------------------*/ 66 | /** @addtogroup CRC_LL_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | /** @addtogroup CRC_LL_EF_Init 71 | * @{ 72 | */ 73 | 74 | /** 75 | * @brief De-initialize CRC registers (Registers restored to their default values). 76 | * @param CRCx CRC Instance 77 | * @retval An ErrorStatus enumeration value: 78 | * - SUCCESS: CRC registers are de-initialized 79 | * - ERROR: CRC registers are not de-initialized 80 | */ 81 | ErrorStatus LL_CRC_DeInit(CRC_TypeDef *CRCx) 82 | { 83 | ErrorStatus status = SUCCESS; 84 | 85 | /* Check the parameters */ 86 | assert_param(IS_CRC_ALL_INSTANCE(CRCx)); 87 | 88 | if (CRCx == CRC) 89 | { 90 | /* Force CRC reset */ 91 | LL_AHB1_GRP1_ForceReset(LL_AHB1_GRP1_PERIPH_CRC); 92 | 93 | /* Release CRC reset */ 94 | LL_AHB1_GRP1_ReleaseReset(LL_AHB1_GRP1_PERIPH_CRC); 95 | } 96 | else 97 | { 98 | status = ERROR; 99 | } 100 | 101 | return (status); 102 | } 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | #endif /* defined (CRC) */ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | #endif /* USE_FULL_LL_DRIVER */ 123 | 124 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 125 | 126 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_crs.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_crs.h 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief CRS LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_crs.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | 43 | /** @addtogroup STM32L4xx_LL_Driver 44 | * @{ 45 | */ 46 | 47 | #if defined(CRS) 48 | 49 | /** @defgroup CRS_LL CRS 50 | * @{ 51 | */ 52 | 53 | /* Private types -------------------------------------------------------------*/ 54 | /* Private variables ---------------------------------------------------------*/ 55 | /* Private constants ---------------------------------------------------------*/ 56 | /* Private macros ------------------------------------------------------------*/ 57 | /* Private function prototypes -----------------------------------------------*/ 58 | 59 | /* Exported functions --------------------------------------------------------*/ 60 | /** @addtogroup CRS_LL_Exported_Functions 61 | * @{ 62 | */ 63 | 64 | /** @addtogroup CRS_LL_EF_Init 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @brief De-Initializes CRS peripheral registers to their default reset values. 70 | * @retval An ErrorStatus enumeration value: 71 | * - SUCCESS: CRS registers are de-initialized 72 | * - ERROR: not applicable 73 | */ 74 | ErrorStatus LL_CRS_DeInit(void) 75 | { 76 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_CRS); 77 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_CRS); 78 | 79 | return SUCCESS; 80 | } 81 | 82 | 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | #endif /* defined(CRS) */ 97 | 98 | /** 99 | * @} 100 | */ 101 | 102 | #endif /* USE_FULL_LL_DRIVER */ 103 | 104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 105 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_lptim.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_lptim.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief LPTIM LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_lptim.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | 43 | #ifdef USE_FULL_ASSERT 44 | #include "stm32_assert.h" 45 | #else 46 | #define assert_param(expr) ((void)0U) 47 | #endif 48 | 49 | /** @addtogroup STM32L4xx_LL_Driver 50 | * @{ 51 | */ 52 | 53 | #if defined (LPTIM1) || defined (LPTIM2) 54 | 55 | /** @addtogroup LPTIM_LL 56 | * @{ 57 | */ 58 | 59 | /* Private types -------------------------------------------------------------*/ 60 | /* Private variables ---------------------------------------------------------*/ 61 | /* Private constants ---------------------------------------------------------*/ 62 | /* Private macros ------------------------------------------------------------*/ 63 | /** @addtogroup LPTIM_LL_Private_Macros 64 | * @{ 65 | */ 66 | #define IS_LPTIM_CLOCK_SOURCE(__VALUE__) (((__VALUE__) == LL_LPTIM_CLK_SOURCE_INTERNAL) \ 67 | || ((__VALUE__) == LL_LPTIM_CLK_SOURCE_EXTERNAL)) 68 | 69 | #define IS_LPTIM_CLOCK_PRESCALER(__VALUE__) (((__VALUE__) == LL_LPTIM_PRESCALER_DIV1) \ 70 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV2) \ 71 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV4) \ 72 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV8) \ 73 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV16) \ 74 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV32) \ 75 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV64) \ 76 | || ((__VALUE__) == LL_LPTIM_PRESCALER_DIV128)) 77 | 78 | #define IS_LPTIM_WAVEFORM(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_PWM) \ 79 | || ((__VALUE__) == LL_LPTIM_OUTPUT_WAVEFORM_SETONCE)) 80 | 81 | #define IS_LPTIM_OUTPUT_POLARITY(__VALUE__) (((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_REGULAR) \ 82 | || ((__VALUE__) == LL_LPTIM_OUTPUT_POLARITY_INVERSE)) 83 | /** 84 | * @} 85 | */ 86 | 87 | 88 | /* Private function prototypes -----------------------------------------------*/ 89 | /* Exported functions --------------------------------------------------------*/ 90 | /** @addtogroup LPTIM_LL_Exported_Functions 91 | * @{ 92 | */ 93 | 94 | /** @addtogroup LPTIM_LL_EF_Init 95 | * @{ 96 | */ 97 | 98 | /** 99 | * @brief Set LPTIMx registers to their reset values. 100 | * @param LPTIMx LP Timer instance 101 | * @retval An ErrorStatus enumeration value: 102 | * - SUCCESS: LPTIMx registers are de-initialized 103 | * - ERROR: invalid LPTIMx instance 104 | */ 105 | ErrorStatus LL_LPTIM_DeInit(LPTIM_TypeDef* LPTIMx) 106 | { 107 | ErrorStatus result = SUCCESS; 108 | 109 | /* Check the parameters */ 110 | assert_param(IS_LPTIM_INSTANCE(LPTIMx)); 111 | 112 | if (LPTIMx == LPTIM1) 113 | { 114 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_LPTIM1); 115 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_LPTIM1); 116 | } 117 | #if defined(LPTIM2) 118 | else if (LPTIMx == LPTIM2) 119 | { 120 | LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_LPTIM2); 121 | LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_LPTIM2); 122 | } 123 | #endif 124 | else 125 | { 126 | result = ERROR; 127 | } 128 | 129 | return result; 130 | } 131 | 132 | /** 133 | * @brief Set each fields of the LPTIM_InitStruct structure to its default 134 | * value. 135 | * @param LPTIM_InitStruct pointer to a @ref LL_LPTIM_InitTypeDef structure 136 | * @retval None 137 | */ 138 | void LL_LPTIM_StructInit(LL_LPTIM_InitTypeDef* LPTIM_InitStruct) 139 | { 140 | /* Set the default configuration */ 141 | LPTIM_InitStruct->ClockSource = LL_LPTIM_CLK_SOURCE_INTERNAL; 142 | LPTIM_InitStruct->Prescaler = LL_LPTIM_PRESCALER_DIV1; 143 | LPTIM_InitStruct->Waveform = LL_LPTIM_OUTPUT_WAVEFORM_PWM; 144 | LPTIM_InitStruct->Polarity = LL_LPTIM_OUTPUT_POLARITY_REGULAR; 145 | } 146 | 147 | /** 148 | * @brief Configure the LPTIMx peripheral according to the specified parameters. 149 | * @note LL_LPTIM_Init can only be called when the LPTIM instance is disabled. 150 | * @note LPTIMx can be disabled using unitary function @ref LL_LPTIM_Disable(). 151 | * @param LPTIMx LP Timer Instance 152 | * @param LPTIM_InitStruct pointer to a @ref LL_LPTIM_InitTypeDef structure 153 | * @retval An ErrorStatus enumeration value: 154 | * - SUCCESS: LPTIMx instance has been initialized 155 | * - ERROR: LPTIMx instance hasn't been initialized 156 | */ 157 | ErrorStatus LL_LPTIM_Init(LPTIM_TypeDef * LPTIMx, LL_LPTIM_InitTypeDef* LPTIM_InitStruct) 158 | { 159 | ErrorStatus result = SUCCESS; 160 | 161 | /* The LPTIMx_CFGR register must only be modified when the LPTIM is disabled 162 | (ENABLE bit is reset to 0). 163 | */ 164 | if (LL_LPTIM_IsEnabled(LPTIMx)) 165 | { 166 | result = ERROR; 167 | } 168 | else 169 | { 170 | /* Check the parameters */ 171 | assert_param(IS_LPTIM_INSTANCE(LPTIMx)); 172 | assert_param(IS_LPTIM_CLOCK_SOURCE(LPTIM_InitStruct->ClockSource)); 173 | assert_param(IS_LPTIM_CLOCK_PRESCALER(LPTIM_InitStruct->Prescaler)); 174 | assert_param(IS_LPTIM_WAVEFORM(LPTIM_InitStruct->Waveform)); 175 | assert_param(IS_LPTIM_OUTPUT_POLARITY(LPTIM_InitStruct->Polarity)); 176 | 177 | /* Set CKSEL bitfield according to ClockSource value */ 178 | /* Set PRESC bitfield according to Prescaler value */ 179 | /* Set WAVE bitfield according to Waveform value */ 180 | /* Set WAVEPOL bitfield according to Polarity value */ 181 | MODIFY_REG(LPTIMx->CFGR, 182 | (LPTIM_CFGR_CKSEL | LPTIM_CFGR_PRESC | LPTIM_CFGR_WAVE| LPTIM_CFGR_WAVPOL), 183 | LPTIM_InitStruct->ClockSource | \ 184 | LPTIM_InitStruct->Prescaler | \ 185 | LPTIM_InitStruct->Waveform | \ 186 | LPTIM_InitStruct->Polarity); 187 | } 188 | 189 | return result; 190 | } 191 | 192 | /** 193 | * @} 194 | */ 195 | 196 | /** 197 | * @} 198 | */ 199 | 200 | /** 201 | * @} 202 | */ 203 | 204 | #endif /* defined (LPTIM1) || defined (LPTIM2) */ 205 | 206 | /** 207 | * @} 208 | */ 209 | 210 | #endif /* USE_FULL_LL_DRIVER */ 211 | 212 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 213 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_pwr.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_pwr.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief PWR LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_pwr.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | 43 | /** @addtogroup STM32L4xx_LL_Driver 44 | * @{ 45 | */ 46 | 47 | #if defined(PWR) 48 | 49 | /** @defgroup PWR_LL PWR 50 | * @{ 51 | */ 52 | 53 | /* Private types -------------------------------------------------------------*/ 54 | /* Private variables ---------------------------------------------------------*/ 55 | /* Private constants ---------------------------------------------------------*/ 56 | /* Private macros ------------------------------------------------------------*/ 57 | /* Private function prototypes -----------------------------------------------*/ 58 | 59 | /* Exported functions --------------------------------------------------------*/ 60 | /** @addtogroup PWR_LL_Exported_Functions 61 | * @{ 62 | */ 63 | 64 | /** @addtogroup PWR_LL_EF_Init 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @brief De-initialize the PWR registers to their default reset values. 70 | * @retval An ErrorStatus enumeration value: 71 | * - SUCCESS: PWR registers are de-initialized 72 | * - ERROR: not applicable 73 | */ 74 | ErrorStatus LL_PWR_DeInit(void) 75 | { 76 | /* Force reset of PWR clock */ 77 | LL_APB1_GRP1_ForceReset(LL_APB1_GRP1_PERIPH_PWR); 78 | 79 | /* Release reset of PWR clock */ 80 | LL_APB1_GRP1_ReleaseReset(LL_APB1_GRP1_PERIPH_PWR); 81 | 82 | return SUCCESS; 83 | } 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | #endif /* defined(PWR) */ 97 | /** 98 | * @} 99 | */ 100 | 101 | #endif /* USE_FULL_LL_DRIVER */ 102 | 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_rng.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_rng.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief RNG LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_rng.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | 43 | #ifdef USE_FULL_ASSERT 44 | #include "stm32_assert.h" 45 | #else 46 | #define assert_param(expr) ((void)0U) 47 | #endif 48 | 49 | /** @addtogroup STM32L4xx_LL_Driver 50 | * @{ 51 | */ 52 | 53 | #if defined (RNG) 54 | 55 | /** @addtogroup RNG_LL 56 | * @{ 57 | */ 58 | 59 | /* Private types -------------------------------------------------------------*/ 60 | /* Private variables ---------------------------------------------------------*/ 61 | /* Private constants ---------------------------------------------------------*/ 62 | /* Private macros ------------------------------------------------------------*/ 63 | /* Private function prototypes -----------------------------------------------*/ 64 | 65 | /* Exported functions --------------------------------------------------------*/ 66 | /** @addtogroup RNG_LL_Exported_Functions 67 | * @{ 68 | */ 69 | 70 | /** @addtogroup RNG_LL_EF_Init 71 | * @{ 72 | */ 73 | 74 | /** 75 | * @brief De-initialize RNG registers (Registers restored to their default values). 76 | * @param RNGx RNG Instance 77 | * @retval An ErrorStatus enumeration value: 78 | * - SUCCESS: RNG registers are de-initialized 79 | * - ERROR: not applicable 80 | */ 81 | ErrorStatus LL_RNG_DeInit(RNG_TypeDef *RNGx) 82 | { 83 | /* Check the parameters */ 84 | assert_param(IS_RNG_ALL_INSTANCE(RNGx)); 85 | 86 | /* Enable RNG reset state */ 87 | LL_AHB2_GRP1_ForceReset(LL_AHB2_GRP1_PERIPH_RNG); 88 | 89 | /* Release RNG from reset state */ 90 | LL_AHB2_GRP1_ReleaseReset(LL_AHB2_GRP1_PERIPH_RNG); 91 | 92 | return (SUCCESS); 93 | } 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | #endif /* defined (RNG) */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | #endif /* USE_FULL_LL_DRIVER */ 114 | 115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 116 | 117 | -------------------------------------------------------------------------------- /Drivers/STM32L4xx_HAL_Driver/Src/stm32l4xx_ll_swpmi.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_ll_swpmi.c 4 | * @author MCD Application Team 5 | * @version V1.7.0 6 | * @date 17-February-2017 7 | * @brief SWPMI LL module driver. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2017 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 | #if defined(USE_FULL_LL_DRIVER) 38 | 39 | /* Includes ------------------------------------------------------------------*/ 40 | #include "stm32l4xx_ll_swpmi.h" 41 | #include "stm32l4xx_ll_bus.h" 42 | #ifdef USE_FULL_ASSERT 43 | #include "stm32_assert.h" 44 | #else 45 | #define assert_param(expr) ((void)0U) 46 | #endif 47 | 48 | /** @addtogroup STM32L4xx_LL_Driver 49 | * @{ 50 | */ 51 | 52 | #if defined (SWPMI1) 53 | 54 | /** @addtogroup SWPMI_LL 55 | * @{ 56 | */ 57 | 58 | /* Private types -------------------------------------------------------------*/ 59 | /* Private variables ---------------------------------------------------------*/ 60 | /* Private constants ---------------------------------------------------------*/ 61 | /* Private macros ------------------------------------------------------------*/ 62 | /** @addtogroup SWPMI_LL_Private_Macros 63 | * @{ 64 | */ 65 | 66 | #define IS_LL_SWPMI_BITRATE_VALUE(__VALUE__) (((__VALUE__) <= 63)) 67 | 68 | #define IS_LL_SWPMI_SW_BUFFER_RX(__VALUE__) (((__VALUE__) == LL_SWPMI_SW_BUFFER_RX_SINGLE) \ 69 | || ((__VALUE__) == LL_SWPMI_SW_BUFFER_RX_MULTI)) 70 | 71 | #define IS_LL_SWPMI_SW_BUFFER_TX(__VALUE__) (((__VALUE__) == LL_SWPMI_SW_BUFFER_TX_SINGLE) \ 72 | || ((__VALUE__) == LL_SWPMI_SW_BUFFER_TX_MULTI)) 73 | 74 | #define IS_LL_SWPMI_VOLTAGE_CLASS(__VALUE__) (((__VALUE__) == LL_SWPMI_VOLTAGE_CLASS_C) \ 75 | || ((__VALUE__) == LL_SWPMI_VOLTAGE_CLASS_B)) 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Private function prototypes -----------------------------------------------*/ 82 | 83 | /* Exported functions --------------------------------------------------------*/ 84 | /** @addtogroup SWPMI_LL_Exported_Functions 85 | * @{ 86 | */ 87 | 88 | /** @addtogroup SWPMI_LL_EF_Init 89 | * @{ 90 | */ 91 | 92 | /** 93 | * @brief De-initialize the SWPMI peripheral registers to their default reset values. 94 | * @param SWPMIx SWPMI Instance 95 | * @retval An ErrorStatus enumeration value 96 | * - SUCCESS: SWPMI registers are de-initialized 97 | * - ERROR: Not applicable 98 | */ 99 | ErrorStatus LL_SWPMI_DeInit(SWPMI_TypeDef *SWPMIx) 100 | { 101 | /* Check the parameter */ 102 | assert_param(IS_SWPMI_INSTANCE(SWPMIx)); 103 | 104 | LL_APB1_GRP2_ForceReset(LL_APB1_GRP2_PERIPH_SWPMI1); 105 | LL_APB1_GRP2_ReleaseReset(LL_APB1_GRP2_PERIPH_SWPMI1); 106 | 107 | return SUCCESS; 108 | } 109 | 110 | /** 111 | * @brief Initialize the SWPMI peripheral according to the specified parameters in the SWPMI_InitStruct. 112 | * @note As some bits in SWPMI configuration registers can only be written when the SWPMI is deactivated (SWPMI_CR_SWPACT bit = 0), 113 | * SWPMI IP should be in deactivated state prior calling this function. Otherwise, ERROR result will be returned. 114 | * @param SWPMIx SWPMI Instance 115 | * @param SWPMI_InitStruct pointer to a @ref LL_SWPMI_InitTypeDef structure that contains 116 | * the configuration information for the SWPMI peripheral. 117 | * @retval An ErrorStatus enumeration value 118 | * - SUCCESS: SWPMI registers are initialized 119 | * - ERROR: SWPMI registers are not initialized 120 | */ 121 | ErrorStatus LL_SWPMI_Init(SWPMI_TypeDef *SWPMIx, LL_SWPMI_InitTypeDef *SWPMI_InitStruct) 122 | { 123 | ErrorStatus status = SUCCESS; 124 | 125 | /* Check the parameters */ 126 | assert_param(IS_SWPMI_INSTANCE(SWPMIx)); 127 | assert_param(IS_LL_SWPMI_BITRATE_VALUE(SWPMI_InitStruct->BitRatePrescaler)); 128 | assert_param(IS_LL_SWPMI_SW_BUFFER_TX(SWPMI_InitStruct->TxBufferingMode)); 129 | assert_param(IS_LL_SWPMI_SW_BUFFER_RX(SWPMI_InitStruct->RxBufferingMode)); 130 | assert_param(IS_LL_SWPMI_VOLTAGE_CLASS(SWPMI_InitStruct->VoltageClass)); 131 | 132 | /* SWPMI needs to be in deactivated state, in order to be able to configure some bits */ 133 | if (LL_SWPMI_IsActivated(SWPMIx) == 0) 134 | { 135 | /* Configure the BRR register (Bitrate) */ 136 | LL_SWPMI_SetBitRatePrescaler(SWPMIx, SWPMI_InitStruct->BitRatePrescaler); 137 | 138 | /* Configure the voltage class */ 139 | LL_SWPMI_SetVoltageClass(SWPMIx, SWPMI_InitStruct->VoltageClass); 140 | 141 | /* Set the new configuration of the SWPMI peripheral */ 142 | MODIFY_REG(SWPMIx->CR, 143 | (SWPMI_CR_RXMODE | SWPMI_CR_TXMODE), 144 | (SWPMI_InitStruct->TxBufferingMode | SWPMI_InitStruct->RxBufferingMode)); 145 | } 146 | /* Else (SWPMI not in deactivated state => return ERROR) */ 147 | else 148 | { 149 | status = ERROR; 150 | } 151 | 152 | return status; 153 | } 154 | 155 | /** 156 | * @brief Set each @ref LL_SWPMI_InitTypeDef field to default value. 157 | * @param SWPMI_InitStruct pointer to a @ref LL_SWPMI_InitTypeDef structure that contains 158 | * the configuration information for the SWPMI peripheral. 159 | * @retval None 160 | */ 161 | void LL_SWPMI_StructInit(LL_SWPMI_InitTypeDef *SWPMI_InitStruct) 162 | { 163 | /* Set SWPMI_InitStruct fields to default values */ 164 | SWPMI_InitStruct->VoltageClass = LL_SWPMI_VOLTAGE_CLASS_C; 165 | SWPMI_InitStruct->BitRatePrescaler = (uint32_t)0x00000001; 166 | SWPMI_InitStruct->TxBufferingMode = LL_SWPMI_SW_BUFFER_TX_SINGLE; 167 | SWPMI_InitStruct->RxBufferingMode = LL_SWPMI_SW_BUFFER_RX_SINGLE; 168 | } 169 | 170 | /** 171 | * @} 172 | */ 173 | 174 | /** 175 | * @} 176 | */ 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | #endif /* defined (SWPMI1) */ 183 | 184 | /** 185 | * @} 186 | */ 187 | 188 | #endif /* USE_FULL_LL_DRIVER */ 189 | 190 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 191 | -------------------------------------------------------------------------------- /EWARM/Project.eww: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | $WS_DIR$\STM32L4 SPI Bootloader host.ewp 5 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /EWARM/stm32l476xx_flash.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20017FFF; 11 | define symbol __ICFEDIT_region_SRAM2_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_SRAM2_end__ = 0x10007FFF; 13 | 14 | /*-Sizes-*/ 15 | define symbol __ICFEDIT_size_cstack__ = 0x400; 16 | define symbol __ICFEDIT_size_heap__ = 0x200; 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | 20 | define memory mem with size = 4G; 21 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 22 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 23 | define region SRAM2_region = mem:[from __ICFEDIT_region_SRAM2_start__ to __ICFEDIT_region_SRAM2_end__]; 24 | 25 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 26 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 27 | 28 | initialize by copy { readwrite }; 29 | do not initialize { section .noinit }; 30 | 31 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 32 | 33 | place in ROM_region { readonly }; 34 | place in RAM_region { readwrite, 35 | block CSTACK, block HEAP }; 36 | place in SRAM2_region { }; 37 | 38 | -------------------------------------------------------------------------------- /EWARM/stm32l476xx_sram.icf: -------------------------------------------------------------------------------- 1 | /*###ICF### Section handled by ICF editor, don't touch! ****/ 2 | /*-Editor annotation file-*/ 3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */ 4 | /*-Specials-*/ 5 | define symbol __ICFEDIT_intvec_start__ = 0x20000000; 6 | /*-Memory Regions-*/ 7 | define symbol __ICFEDIT_region_ROM_start__ = 0x20000000; 8 | define symbol __ICFEDIT_region_ROM_end__ = 0x2000FFFF; 9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20010000; 10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20017FFF; 11 | define symbol __ICFEDIT_region_SRAM2_start__ = 0x10000000; 12 | define symbol __ICFEDIT_region_SRAM2_end__ = 0x10007FFF; 13 | 14 | /*-Sizes-*/ 15 | define symbol __ICFEDIT_size_cstack__ = 0x400; 16 | define symbol __ICFEDIT_size_heap__ = 0x200; 17 | /**** End of ICF editor section. ###ICF###*/ 18 | 19 | 20 | define memory mem with size = 4G; 21 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__]; 22 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__]; 23 | define region SRAM2_region = mem:[from __ICFEDIT_region_SRAM2_start__ to __ICFEDIT_region_SRAM2_end__]; 24 | 25 | 26 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { }; 27 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { }; 28 | 29 | initialize by copy { readwrite }; 30 | do not initialize { section .noinit }; 31 | 32 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec }; 33 | 34 | place in ROM_region { readonly }; 35 | place in RAM_region { readwrite, 36 | block CSTACK, block HEAP }; 37 | place in SRAM2_region { }; 38 | -------------------------------------------------------------------------------- /Inc/bootloader.h: -------------------------------------------------------------------------------- 1 | #ifndef __BOOTLOADER_H 2 | #define __BOOTLOADER_H 3 | 4 | #include "main.h" 5 | 6 | /* Bootloader command set */ 7 | #define GET_CMD_COMMAND 0x00U /*!< Get CMD command */ 8 | #define GET_VER_COMMAND 0x01U /*!< Get Version command */ 9 | #define GET_ID_COMMAND 0x02U /*!< Get ID command */ 10 | #define RMEM_COMMAND 0x11U /*!< Read Memory command */ 11 | #define GO_COMMAND 0x21U /*!< Go command */ 12 | #define WMEM_COMMAND 0x31U /*!< Write Memory command */ 13 | #define EMEM_COMMAND 0x44U /*!< Erase Memory command */ 14 | #define WP_COMMAND 0x63U /*!< Write Protect command */ 15 | #define WU_COMMAND 0x73U /*!< Write Unprotect command */ 16 | #define RP_COMMAND 0x82U /*!< Readout Protect command */ 17 | #define RU_COMMAND 0x92U /*!< Readout Unprotect command */ 18 | 19 | #define BL_SPI_SOF 0x5AU 20 | #define BL_ACK 0x79U 21 | #define BL_NAK 0x1FU 22 | 23 | /* Extended erase special parameters */ 24 | #define ERASE_ALL 0xFFFFU 25 | #define ERASE_BANK1 0xFFFEU 26 | #define ERASE_BANK2 0xFFFDU 27 | 28 | void BL_Init(SPI_HandleTypeDef *hspi); 29 | void BL_Get_Command(uint8_t *pData); 30 | uint8_t BL_GetVersion_Command(void); 31 | uint16_t BL_GetID_Command(void); 32 | void BL_ReadMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData); 33 | void BL_Go_Command(uint32_t address); 34 | void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData); 35 | void BL_EraseMemory_Command(uint16_t nb, uint8_t code); 36 | void BL_WriteProtect_Command(uint8_t nb, uint8_t *codes); 37 | void BL_WriteUnprotect_Command(void); 38 | void BL_ReadoutProtect_Command(void); 39 | void BL_ReadoutUnprotect_Command(void); 40 | 41 | #endif /* __BOOTLOADER_H */ 42 | -------------------------------------------------------------------------------- /Inc/main.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * File Name : main.h 4 | * Description : This file contains the common defines of the application 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2017 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | /* Define to prevent recursive inclusion -------------------------------------*/ 34 | #ifndef __MAIN_H 35 | #define __MAIN_H 36 | /* Includes ------------------------------------------------------------------*/ 37 | 38 | /* USER CODE BEGIN Includes */ 39 | #include "stm32l4xx_hal.h" 40 | /* USER CODE END Includes */ 41 | 42 | /* Private define ------------------------------------------------------------*/ 43 | 44 | /* USER CODE BEGIN Private defines */ 45 | void Error_Handler(void); 46 | /* USER CODE END Private defines */ 47 | 48 | /** 49 | * @} 50 | */ 51 | 52 | /** 53 | * @} 54 | */ 55 | 56 | #endif /* __MAIN_H */ 57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 58 | -------------------------------------------------------------------------------- /Inc/stm32l4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_it.h 4 | * @brief This file contains the headers of the interrupt handlers. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2017 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | 34 | /* Define to prevent recursive inclusion -------------------------------------*/ 35 | #ifndef __STM32L4xx_IT_H 36 | #define __STM32L4xx_IT_H 37 | 38 | #ifdef __cplusplus 39 | extern "C" { 40 | #endif 41 | 42 | /* Includes ------------------------------------------------------------------*/ 43 | /* Exported types ------------------------------------------------------------*/ 44 | /* Exported constants --------------------------------------------------------*/ 45 | /* Exported macro ------------------------------------------------------------*/ 46 | /* Exported functions ------------------------------------------------------- */ 47 | 48 | void NMI_Handler(void); 49 | void HardFault_Handler(void); 50 | void MemManage_Handler(void); 51 | void BusFault_Handler(void); 52 | void UsageFault_Handler(void); 53 | void SVC_Handler(void); 54 | void DebugMon_Handler(void); 55 | void PendSV_Handler(void); 56 | void SysTick_Handler(void); 57 | 58 | #ifdef __cplusplus 59 | } 60 | #endif 61 | 62 | #endif /* __STM32L4xx_IT_H */ 63 | 64 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 65 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # SPI Bootloader Host example 2 | This example project acts as a STM32 bootloader SPI host to communicate with 3 | another STM32 MCU configured to boot in system memory. The code provided in 4 | this example can be programmed onto a STM32L476RG-Nucleo and will use SPI1 as a 5 | default interface. The bootloader library can be used with any other STM32 MCU. 6 | 7 | 8 | ## SPI Bootloader library functions: 9 | ```c 10 | void BL_Init(SPI_HandleTypeDef *hspi); 11 | void BL_Get_Command(uint8_t *pData); 12 | uint8_t BL_GetVersion_Command(void); 13 | uint16_t BL_GetID_Command(void); 14 | void BL_ReadMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData); 15 | void BL_Go_Command(uint32_t address); 16 | void BL_WriteMemory_Command(uint32_t address, uint8_t nob, uint8_t *pData); 17 | void BL_EraseMemory_Command(uint16_t nb, uint8_t code); 18 | void BL_WriteProtect_Command(uint8_t nb, uint8_t *codes); 19 | void BL_WriteUnprotect_Command(void); 20 | void BL_ReadoutProtect_Command(void); 21 | void BL_ReadoutUnprotect_Command(void); 22 | ``` 23 | More details about the functions listed above can be found in [AN4286 SPI protocol used in the STM32 bootloader]. 24 | 25 | # Requirements 26 | * two STM32 27 | ### Windows 28 | * IAR Embedded Workbench 29 | * STM32 ST-LINK utility 30 | 31 | ## Enable target STM32 MCU to boot in system memory mode 32 | ### NUCLEO board 33 | Connect BOOT0 to VDD (Place a jumper on pin CN7-5 and CN7-7) 34 | Connect SPI1_NSS to GND (Connect CN7-32 to GND) 35 | 36 | Refer to [AN2606 STM32 microcontroller system memory boot mode] 37 | for more details on how to enable system memory boot on a particular STM32. 38 | 39 | ## Build 40 | ### Windows 41 | 1. Double-click on `EWARM/Project.eww` to open the workspace. 42 | 43 | 2. Make 44 | 45 | 3. Project > Download > Download active application 46 | 47 | ## SPI Connection 48 | The example project is configured to use SPI1. On a NUCLEO board, the two boards 49 | can be connected using the following pins: 50 | * SPI1_SCK PA5 (CN5-6 or CN10-11) 51 | * SPI1_MISO PA6 (CN5-5 or CN10-13) 52 | * SPI1_MOSI PA7 (CN5-4 or CN10-15) 53 | * GND 54 | 55 | [AN2606 STM32 microcontroller system memory boot mode]: 56 | [AN4286 SPI protocol used in the STM32 bootloader]: 57 | -------------------------------------------------------------------------------- /STM32L4 SPI Bootloader host.ioc: -------------------------------------------------------------------------------- 1 | #MicroXplorer Configuration settings - do not modify 2 | File.Version=6 3 | KeepUserPlacement=false 4 | Mcu.Family=STM32L4 5 | Mcu.IP0=NVIC 6 | Mcu.IP1=RCC 7 | Mcu.IP2=SPI1 8 | Mcu.IP3=SYS 9 | Mcu.IPNb=4 10 | Mcu.Name=STM32L476R(C-E-G)Tx 11 | Mcu.Package=LQFP64 12 | Mcu.Pin0=PA4 13 | Mcu.Pin1=PA5 14 | Mcu.Pin2=PA6 15 | Mcu.Pin3=PA7 16 | Mcu.Pin4=VP_SYS_VS_Systick 17 | Mcu.PinsNb=5 18 | Mcu.UserConstants= 19 | Mcu.UserName=STM32L476RGTx 20 | MxCube.Version=4.20.1 21 | MxDb.Version=DB.4.0.200 22 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:true 23 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:true 24 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:true 25 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:true 26 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:true 27 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:true 28 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_4 29 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:true 30 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true 31 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:true 32 | PA4.Mode=NSS_Signal_Hard_Output 33 | PA4.Signal=SPI1_NSS 34 | PA5.Mode=Full_Duplex_Master 35 | PA5.Signal=SPI1_SCK 36 | PA6.Mode=Full_Duplex_Master 37 | PA6.Signal=SPI1_MISO 38 | PA7.Mode=Full_Duplex_Master 39 | PA7.Signal=SPI1_MOSI 40 | PCC.Checker=true 41 | PCC.Line=STM32L4x6 42 | PCC.MCU=STM32L476R(C-E-G)Tx 43 | PCC.MXVersion=4.20.1 44 | PCC.PartNumber=STM32L476RGTx 45 | PCC.Seq0=0 46 | PCC.Series=STM32L4 47 | PCC.Temperature=25 48 | PCC.Vdd=null 49 | ProjectManager.AskForMigrate=true 50 | ProjectManager.BackupPrevious=false 51 | ProjectManager.CompilerOptimize=2 52 | ProjectManager.ComputerToolchain=false 53 | ProjectManager.CoupleFile=false 54 | ProjectManager.CustomerFirmwarePackage=C\:/Users/legraing/STM32Cube/Repository/STM32Cube_FW_L4_V1.7.0 55 | ProjectManager.DefaultFWLocation=true 56 | ProjectManager.DeletePrevious=true 57 | ProjectManager.DeviceId=STM32L476RGTx 58 | ProjectManager.FirmwarePackage=STM32Cube FW_L4 V1.7.0 59 | ProjectManager.FreePins=false 60 | ProjectManager.HalAssertFull=false 61 | ProjectManager.HeapSize=0x200 62 | ProjectManager.KeepUserCode=true 63 | ProjectManager.LastFirmware=true 64 | ProjectManager.LibraryCopy=0 65 | ProjectManager.PreviousToolchain= 66 | ProjectManager.ProjectBuild=false 67 | ProjectManager.ProjectFileName=STM32L4 SPI Bootloader host.ioc 68 | ProjectManager.ProjectName=STM32L4 SPI Bootloader host 69 | ProjectManager.StackSize=0x400 70 | ProjectManager.TargetToolchain=EWARM 71 | ProjectManager.ToolChainLocation= 72 | ProjectManager.UnderRoot=false 73 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false-HAL,2-SystemClock_Config-RCC-false-HAL,3-MX_SPI1_Init-SPI1-false-HAL 74 | RCC.ADCFreq_Value=16000000 75 | RCC.AHBFreq_Value=4000000 76 | RCC.APB1Freq_Value=4000000 77 | RCC.APB1TimFreq_Value=4000000 78 | RCC.APB2Freq_Value=4000000 79 | RCC.APB2TimFreq_Value=4000000 80 | RCC.CortexFreq_Value=4000000 81 | RCC.DFSDMFreq_Value=4000000 82 | RCC.FCLKCortexFreq_Value=4000000 83 | RCC.FamilyName=M 84 | RCC.HCLKFreq_Value=4000000 85 | RCC.HSE_VALUE=8000000 86 | RCC.HSI_VALUE=16000000 87 | RCC.I2C1Freq_Value=4000000 88 | RCC.I2C2Freq_Value=4000000 89 | RCC.I2C3Freq_Value=4000000 90 | RCC.IPParameters=ADCFreq_Value,AHBFreq_Value,APB1Freq_Value,APB1TimFreq_Value,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,DFSDMFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2C1Freq_Value,I2C2Freq_Value,I2C3Freq_Value,LPTIM1Freq_Value,LPTIM2Freq_Value,LPUART1Freq_Value,LSCOPinFreq_Value,LSE_VALUE,LSI_VALUE,MCO1PinFreq_Value,MSI_VALUE,PLLPoutputFreq_Value,PLLQoutputFreq_Value,PLLRCLKFreq_Value,PLLSAI1PoutputFreq_Value,PLLSAI1QoutputFreq_Value,PLLSAI1RoutputFreq_Value,PLLSAI2PoutputFreq_Value,PLLSAI2RoutputFreq_Value,PWRFreq_Value,RNGFreq_Value,SAI1Freq_Value,SAI2Freq_Value,SDMMCFreq_Value,SWPMI1Freq_Value,SYSCLKFreq_VALUE,UART4Freq_Value,UART5Freq_Value,USART1Freq_Value,USART2Freq_Value,USART3Freq_Value,USBFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VCOSAI1OutputFreq_Value,VCOSAI2OutputFreq_Value 91 | RCC.LPTIM1Freq_Value=4000000 92 | RCC.LPTIM2Freq_Value=4000000 93 | RCC.LPUART1Freq_Value=4000000 94 | RCC.LSCOPinFreq_Value=32000 95 | RCC.LSE_VALUE=32768 96 | RCC.LSI_VALUE=32000 97 | RCC.MCO1PinFreq_Value=4000000 98 | RCC.MSI_VALUE=4000000 99 | RCC.PLLPoutputFreq_Value=4571428.571428572 100 | RCC.PLLQoutputFreq_Value=16000000 101 | RCC.PLLRCLKFreq_Value=16000000 102 | RCC.PLLSAI1PoutputFreq_Value=4571428.571428572 103 | RCC.PLLSAI1QoutputFreq_Value=16000000 104 | RCC.PLLSAI1RoutputFreq_Value=16000000 105 | RCC.PLLSAI2PoutputFreq_Value=4571428.571428572 106 | RCC.PLLSAI2RoutputFreq_Value=16000000 107 | RCC.PWRFreq_Value=4000000 108 | RCC.RNGFreq_Value=16000000 109 | RCC.SAI1Freq_Value=4571428.571428572 110 | RCC.SAI2Freq_Value=4571428.571428572 111 | RCC.SDMMCFreq_Value=16000000 112 | RCC.SWPMI1Freq_Value=4000000 113 | RCC.SYSCLKFreq_VALUE=4000000 114 | RCC.UART4Freq_Value=4000000 115 | RCC.UART5Freq_Value=4000000 116 | RCC.USART1Freq_Value=4000000 117 | RCC.USART2Freq_Value=4000000 118 | RCC.USART3Freq_Value=4000000 119 | RCC.USBFreq_Value=16000000 120 | RCC.VCOInputFreq_Value=4000000 121 | RCC.VCOOutputFreq_Value=32000000 122 | RCC.VCOSAI1OutputFreq_Value=32000000 123 | RCC.VCOSAI2OutputFreq_Value=32000000 124 | SPI1.BaudRatePrescaler=SPI_BAUDRATEPRESCALER_256 125 | SPI1.CalculateBaudRate=15.625 KBits/s 126 | SPI1.DataSize=SPI_DATASIZE_8BIT 127 | SPI1.Direction=SPI_DIRECTION_2LINES 128 | SPI1.IPParameters=CalculateBaudRate,DataSize,BaudRatePrescaler,NSSPMode,VirtualType,Mode,Direction,VirtualNSS 129 | SPI1.Mode=SPI_MODE_MASTER 130 | SPI1.NSSPMode=SPI_NSS_PULSE_DISABLE 131 | SPI1.VirtualNSS=VM_NSSHARD 132 | SPI1.VirtualType=VM_MASTER 133 | VP_SYS_VS_Systick.Mode=SysTick 134 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick 135 | board=STM32L4 SPI Bootloader host 136 | -------------------------------------------------------------------------------- /Src/stm32l4xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * File Name : stm32l4xx_hal_msp.c 4 | * Description : This file provides code for the MSP Initialization 5 | * and de-Initialization codes. 6 | ****************************************************************************** 7 | * 8 | * COPYRIGHT(c) 2017 STMicroelectronics 9 | * 10 | * Redistribution and use in source and binary forms, with or without modification, 11 | * are permitted provided that the following conditions are met: 12 | * 1. Redistributions of source code must retain the above copyright notice, 13 | * this list of conditions and the following disclaimer. 14 | * 2. Redistributions in binary form must reproduce the above copyright notice, 15 | * this list of conditions and the following disclaimer in the documentation 16 | * and/or other materials provided with the distribution. 17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 18 | * may be used to endorse or promote products derived from this software 19 | * without specific prior written permission. 20 | * 21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31 | * 32 | ****************************************************************************** 33 | */ 34 | /* Includes ------------------------------------------------------------------*/ 35 | #include "stm32l4xx_hal.h" 36 | 37 | extern void Error_Handler(void); 38 | /* USER CODE BEGIN 0 */ 39 | 40 | /* USER CODE END 0 */ 41 | /** 42 | * Initializes the Global MSP. 43 | */ 44 | void HAL_MspInit(void) 45 | { 46 | /* USER CODE BEGIN MspInit 0 */ 47 | 48 | /* USER CODE END MspInit 0 */ 49 | 50 | __HAL_RCC_SYSCFG_CLK_ENABLE(); 51 | __HAL_RCC_PWR_CLK_ENABLE(); 52 | 53 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); 54 | 55 | /* System interrupt init*/ 56 | /* MemoryManagement_IRQn interrupt configuration */ 57 | HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0); 58 | /* BusFault_IRQn interrupt configuration */ 59 | HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0); 60 | /* UsageFault_IRQn interrupt configuration */ 61 | HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0); 62 | /* SVCall_IRQn interrupt configuration */ 63 | HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0); 64 | /* DebugMonitor_IRQn interrupt configuration */ 65 | HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0); 66 | /* PendSV_IRQn interrupt configuration */ 67 | HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0); 68 | /* SysTick_IRQn interrupt configuration */ 69 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0); 70 | 71 | /* USER CODE BEGIN MspInit 1 */ 72 | 73 | /* USER CODE END MspInit 1 */ 74 | } 75 | 76 | void HAL_SPI_MspInit(SPI_HandleTypeDef* hspi) 77 | { 78 | 79 | GPIO_InitTypeDef GPIO_InitStruct; 80 | if(hspi->Instance==SPI1) 81 | { 82 | /* USER CODE BEGIN SPI1_MspInit 0 */ 83 | 84 | /* USER CODE END SPI1_MspInit 0 */ 85 | /* Peripheral clock enable */ 86 | __HAL_RCC_SPI1_CLK_ENABLE(); 87 | 88 | /**SPI1 GPIO Configuration 89 | PA4 ------> SPI1_NSS 90 | PA5 ------> SPI1_SCK 91 | PA6 ------> SPI1_MISO 92 | PA7 ------> SPI1_MOSI 93 | */ 94 | GPIO_InitStruct.Pin = GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7; 95 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP; 96 | GPIO_InitStruct.Pull = GPIO_NOPULL; 97 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH; 98 | GPIO_InitStruct.Alternate = GPIO_AF5_SPI1; 99 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct); 100 | 101 | /* USER CODE BEGIN SPI1_MspInit 1 */ 102 | 103 | /* USER CODE END SPI1_MspInit 1 */ 104 | } 105 | 106 | } 107 | 108 | void HAL_SPI_MspDeInit(SPI_HandleTypeDef* hspi) 109 | { 110 | 111 | if(hspi->Instance==SPI1) 112 | { 113 | /* USER CODE BEGIN SPI1_MspDeInit 0 */ 114 | 115 | /* USER CODE END SPI1_MspDeInit 0 */ 116 | /* Peripheral clock disable */ 117 | __HAL_RCC_SPI1_CLK_DISABLE(); 118 | 119 | /**SPI1 GPIO Configuration 120 | PA4 ------> SPI1_NSS 121 | PA5 ------> SPI1_SCK 122 | PA6 ------> SPI1_MISO 123 | PA7 ------> SPI1_MOSI 124 | */ 125 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_4|GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7); 126 | 127 | } 128 | /* USER CODE BEGIN SPI1_MspDeInit 1 */ 129 | 130 | /* USER CODE END SPI1_MspDeInit 1 */ 131 | 132 | } 133 | 134 | /* USER CODE BEGIN 1 */ 135 | 136 | /* USER CODE END 1 */ 137 | 138 | /** 139 | * @} 140 | */ 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 147 | -------------------------------------------------------------------------------- /Src/stm32l4xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32l4xx_it.c 4 | * @brief Interrupt Service Routines. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2017 STMicroelectronics 8 | * 9 | * Redistribution and use in source and binary forms, with or without modification, 10 | * are permitted provided that the following conditions are met: 11 | * 1. Redistributions of source code must retain the above copyright notice, 12 | * this list of conditions and the following disclaimer. 13 | * 2. Redistributions in binary form must reproduce the above copyright notice, 14 | * this list of conditions and the following disclaimer in the documentation 15 | * and/or other materials provided with the distribution. 16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 17 | * may be used to endorse or promote products derived from this software 18 | * without specific prior written permission. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | * 31 | ****************************************************************************** 32 | */ 33 | /* Includes ------------------------------------------------------------------*/ 34 | #include "stm32l4xx_hal.h" 35 | #include "stm32l4xx.h" 36 | #include "stm32l4xx_it.h" 37 | 38 | /* USER CODE BEGIN 0 */ 39 | 40 | /* USER CODE END 0 */ 41 | 42 | /* External variables --------------------------------------------------------*/ 43 | 44 | /******************************************************************************/ 45 | /* Cortex-M4 Processor Interruption and Exception Handlers */ 46 | /******************************************************************************/ 47 | 48 | /** 49 | * @brief This function handles Non maskable interrupt. 50 | */ 51 | void NMI_Handler(void) 52 | { 53 | /* USER CODE BEGIN NonMaskableInt_IRQn 0 */ 54 | 55 | /* USER CODE END NonMaskableInt_IRQn 0 */ 56 | /* USER CODE BEGIN NonMaskableInt_IRQn 1 */ 57 | 58 | /* USER CODE END NonMaskableInt_IRQn 1 */ 59 | } 60 | 61 | /** 62 | * @brief This function handles Hard fault interrupt. 63 | */ 64 | void HardFault_Handler(void) 65 | { 66 | /* USER CODE BEGIN HardFault_IRQn 0 */ 67 | 68 | /* USER CODE END HardFault_IRQn 0 */ 69 | while (1) 70 | { 71 | } 72 | /* USER CODE BEGIN HardFault_IRQn 1 */ 73 | 74 | /* USER CODE END HardFault_IRQn 1 */ 75 | } 76 | 77 | /** 78 | * @brief This function handles Memory management fault. 79 | */ 80 | void MemManage_Handler(void) 81 | { 82 | /* USER CODE BEGIN MemoryManagement_IRQn 0 */ 83 | 84 | /* USER CODE END MemoryManagement_IRQn 0 */ 85 | while (1) 86 | { 87 | } 88 | /* USER CODE BEGIN MemoryManagement_IRQn 1 */ 89 | 90 | /* USER CODE END MemoryManagement_IRQn 1 */ 91 | } 92 | 93 | /** 94 | * @brief This function handles Prefetch fault, memory access fault. 95 | */ 96 | void BusFault_Handler(void) 97 | { 98 | /* USER CODE BEGIN BusFault_IRQn 0 */ 99 | 100 | /* USER CODE END BusFault_IRQn 0 */ 101 | while (1) 102 | { 103 | } 104 | /* USER CODE BEGIN BusFault_IRQn 1 */ 105 | 106 | /* USER CODE END BusFault_IRQn 1 */ 107 | } 108 | 109 | /** 110 | * @brief This function handles Undefined instruction or illegal state. 111 | */ 112 | void UsageFault_Handler(void) 113 | { 114 | /* USER CODE BEGIN UsageFault_IRQn 0 */ 115 | 116 | /* USER CODE END UsageFault_IRQn 0 */ 117 | while (1) 118 | { 119 | } 120 | /* USER CODE BEGIN UsageFault_IRQn 1 */ 121 | 122 | /* USER CODE END UsageFault_IRQn 1 */ 123 | } 124 | 125 | /** 126 | * @brief This function handles System service call via SWI instruction. 127 | */ 128 | void SVC_Handler(void) 129 | { 130 | /* USER CODE BEGIN SVCall_IRQn 0 */ 131 | 132 | /* USER CODE END SVCall_IRQn 0 */ 133 | /* USER CODE BEGIN SVCall_IRQn 1 */ 134 | 135 | /* USER CODE END SVCall_IRQn 1 */ 136 | } 137 | 138 | /** 139 | * @brief This function handles Debug monitor. 140 | */ 141 | void DebugMon_Handler(void) 142 | { 143 | /* USER CODE BEGIN DebugMonitor_IRQn 0 */ 144 | 145 | /* USER CODE END DebugMonitor_IRQn 0 */ 146 | /* USER CODE BEGIN DebugMonitor_IRQn 1 */ 147 | 148 | /* USER CODE END DebugMonitor_IRQn 1 */ 149 | } 150 | 151 | /** 152 | * @brief This function handles Pendable request for system service. 153 | */ 154 | void PendSV_Handler(void) 155 | { 156 | /* USER CODE BEGIN PendSV_IRQn 0 */ 157 | 158 | /* USER CODE END PendSV_IRQn 0 */ 159 | /* USER CODE BEGIN PendSV_IRQn 1 */ 160 | 161 | /* USER CODE END PendSV_IRQn 1 */ 162 | } 163 | 164 | /** 165 | * @brief This function handles System tick timer. 166 | */ 167 | void SysTick_Handler(void) 168 | { 169 | /* USER CODE BEGIN SysTick_IRQn 0 */ 170 | 171 | /* USER CODE END SysTick_IRQn 0 */ 172 | HAL_IncTick(); 173 | HAL_SYSTICK_IRQHandler(); 174 | /* USER CODE BEGIN SysTick_IRQn 1 */ 175 | 176 | /* USER CODE END SysTick_IRQn 1 */ 177 | } 178 | 179 | /******************************************************************************/ 180 | /* STM32L4xx Peripheral Interrupt Handlers */ 181 | /* Add here the Interrupt Handlers for the used peripherals. */ 182 | /* For the available peripheral interrupt handler names, */ 183 | /* please refer to the startup file (startup_stm32l4xx.s). */ 184 | /******************************************************************************/ 185 | 186 | /* USER CODE BEGIN 1 */ 187 | 188 | /* USER CODE END 1 */ 189 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 190 | --------------------------------------------------------------------------------