├── .cproject ├── .gitignore ├── .project ├── LICENSE ├── README.md ├── include ├── arbwave.h ├── stm32f4xx_hal_conf.h └── stm32f4xx_it.h ├── ldscripts ├── libs.ld ├── mem.ld └── sections.ld ├── src ├── _initialize_hardware.c ├── _write.c ├── arbwave.c ├── main.c ├── stm32f4xx_hal_msp.c └── stm32f4xx_it.c └── system ├── include ├── arm │ └── semihosting.h ├── cmsis │ ├── README_ARM_CMSIS.md │ ├── README_DEVICE_CMSIS.md │ ├── arm_common_tables.h │ ├── arm_const_structs.h │ ├── arm_math.h │ ├── cmsis_armcc.h │ ├── cmsis_armcc_V6.h │ ├── cmsis_device.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 │ ├── stm32f405xx.h │ ├── stm32f4xx.h │ └── system_stm32f4xx.h ├── cortexm │ └── ExceptionHandlers.h ├── diag │ └── Trace.h └── stm32f4-hal │ ├── Legacy │ └── stm32_hal_legacy.h │ ├── README_HAL.md │ ├── stm32f4xx_hal.h │ ├── stm32f4xx_hal_adc.h │ ├── stm32f4xx_hal_adc_ex.h │ ├── stm32f4xx_hal_can.h │ ├── stm32f4xx_hal_cec.h │ ├── stm32f4xx_hal_conf_template.h │ ├── stm32f4xx_hal_cortex.h │ ├── stm32f4xx_hal_crc.h │ ├── stm32f4xx_hal_cryp.h │ ├── stm32f4xx_hal_cryp_ex.h │ ├── stm32f4xx_hal_dac.h │ ├── stm32f4xx_hal_dac_ex.h │ ├── stm32f4xx_hal_dcmi.h │ ├── stm32f4xx_hal_dcmi_ex.h │ ├── stm32f4xx_hal_def.h │ ├── stm32f4xx_hal_dma.h │ ├── stm32f4xx_hal_dma2d.h │ ├── stm32f4xx_hal_dma_ex.h │ ├── stm32f4xx_hal_dsi.h │ ├── stm32f4xx_hal_eth.h │ ├── stm32f4xx_hal_flash.h │ ├── stm32f4xx_hal_flash_ex.h │ ├── stm32f4xx_hal_flash_ramfunc.h │ ├── stm32f4xx_hal_fmpi2c.h │ ├── stm32f4xx_hal_fmpi2c_ex.h │ ├── stm32f4xx_hal_gpio.h │ ├── stm32f4xx_hal_gpio_ex.h │ ├── stm32f4xx_hal_hash.h │ ├── stm32f4xx_hal_hash_ex.h │ ├── stm32f4xx_hal_hcd.h │ ├── stm32f4xx_hal_i2c.h │ ├── stm32f4xx_hal_i2c_ex.h │ ├── stm32f4xx_hal_i2s.h │ ├── stm32f4xx_hal_i2s_ex.h │ ├── stm32f4xx_hal_irda.h │ ├── stm32f4xx_hal_iwdg.h │ ├── stm32f4xx_hal_lptim.h │ ├── stm32f4xx_hal_ltdc.h │ ├── stm32f4xx_hal_ltdc_ex.h │ ├── stm32f4xx_hal_nand.h │ ├── stm32f4xx_hal_nor.h │ ├── stm32f4xx_hal_pccard.h │ ├── stm32f4xx_hal_pcd.h │ ├── stm32f4xx_hal_pcd_ex.h │ ├── stm32f4xx_hal_pwr.h │ ├── stm32f4xx_hal_pwr_ex.h │ ├── stm32f4xx_hal_qspi.h │ ├── stm32f4xx_hal_rcc.h │ ├── stm32f4xx_hal_rcc_ex.h │ ├── stm32f4xx_hal_rng.h │ ├── stm32f4xx_hal_rtc.h │ ├── stm32f4xx_hal_rtc_ex.h │ ├── stm32f4xx_hal_sai.h │ ├── stm32f4xx_hal_sai_ex.h │ ├── stm32f4xx_hal_sd.h │ ├── stm32f4xx_hal_sdram.h │ ├── stm32f4xx_hal_smartcard.h │ ├── stm32f4xx_hal_spdifrx.h │ ├── stm32f4xx_hal_spi.h │ ├── stm32f4xx_hal_sram.h │ ├── stm32f4xx_hal_tim.h │ ├── stm32f4xx_hal_tim_ex.h │ ├── stm32f4xx_hal_uart.h │ ├── stm32f4xx_hal_usart.h │ ├── stm32f4xx_hal_wwdg.h │ ├── stm32f4xx_ll_fmc.h │ ├── stm32f4xx_ll_fsmc.h │ ├── stm32f4xx_ll_sdmmc.h │ └── stm32f4xx_ll_usb.h └── src ├── cmsis ├── README_DEVICE_CMSIS.md ├── arm_abs_f32.c ├── arm_common_tables.c ├── arm_cos_f32.c ├── arm_sin_f32.c ├── system_stm32f4xx.c └── vectors_stm32f405xx.c ├── cortexm ├── _initialize_hardware.c ├── _reset_hardware.c └── exception_handlers.c ├── diag ├── Trace.c └── trace_impl.c ├── newlib ├── README.txt ├── _cxx.cpp ├── _exit.c ├── _sbrk.c ├── _startup.c ├── _syscalls.c └── assert.c └── stm32f4-hal ├── README_HAL.md ├── stm32f4xx_hal.c ├── stm32f4xx_hal_adc.c ├── stm32f4xx_hal_adc_ex.c ├── stm32f4xx_hal_can.c ├── stm32f4xx_hal_cec.c ├── stm32f4xx_hal_cortex.c ├── stm32f4xx_hal_crc.c ├── stm32f4xx_hal_cryp.c ├── stm32f4xx_hal_cryp_ex.c ├── stm32f4xx_hal_dac.c ├── stm32f4xx_hal_dac_ex.c ├── stm32f4xx_hal_dcmi.c ├── stm32f4xx_hal_dcmi_ex.c ├── stm32f4xx_hal_dma.c ├── stm32f4xx_hal_dma2d.c ├── stm32f4xx_hal_dma_ex.c ├── stm32f4xx_hal_dsi.c ├── stm32f4xx_hal_eth.c ├── stm32f4xx_hal_flash.c ├── stm32f4xx_hal_flash_ex.c ├── stm32f4xx_hal_flash_ramfunc.c ├── stm32f4xx_hal_fmpi2c.c ├── stm32f4xx_hal_fmpi2c_ex.c ├── stm32f4xx_hal_gpio.c ├── stm32f4xx_hal_hash.c ├── stm32f4xx_hal_hash_ex.c ├── stm32f4xx_hal_hcd.c ├── stm32f4xx_hal_i2c.c ├── stm32f4xx_hal_i2c_ex.c ├── stm32f4xx_hal_i2s.c ├── stm32f4xx_hal_i2s_ex.c ├── stm32f4xx_hal_irda.c ├── stm32f4xx_hal_iwdg.c ├── stm32f4xx_hal_lptim.c ├── stm32f4xx_hal_ltdc.c ├── stm32f4xx_hal_ltdc_ex.c ├── stm32f4xx_hal_msp_template.c ├── stm32f4xx_hal_nand.c ├── stm32f4xx_hal_nor.c ├── stm32f4xx_hal_pccard.c ├── stm32f4xx_hal_pcd.c ├── stm32f4xx_hal_pcd_ex.c ├── stm32f4xx_hal_pwr.c ├── stm32f4xx_hal_pwr_ex.c ├── stm32f4xx_hal_qspi.c ├── stm32f4xx_hal_rcc.c ├── stm32f4xx_hal_rcc_ex.c ├── stm32f4xx_hal_rng.c ├── stm32f4xx_hal_rtc.c ├── stm32f4xx_hal_rtc_ex.c ├── stm32f4xx_hal_sai.c ├── stm32f4xx_hal_sai_ex.c ├── stm32f4xx_hal_sd.c ├── stm32f4xx_hal_sdram.c ├── stm32f4xx_hal_smartcard.c ├── stm32f4xx_hal_spdifrx.c ├── stm32f4xx_hal_spi.c ├── stm32f4xx_hal_sram.c ├── stm32f4xx_hal_tim.c ├── stm32f4xx_hal_tim_ex.c ├── stm32f4xx_hal_uart.c ├── stm32f4xx_hal_usart.c ├── stm32f4xx_hal_wwdg.c ├── stm32f4xx_ll_fmc.c ├── stm32f4xx_ll_fsmc.c ├── stm32f4xx_ll_sdmmc.c └── stm32f4xx_ll_usb.c /.gitignore: -------------------------------------------------------------------------------- 1 | /.settings/ 2 | /Debug/ 3 | /Release/ 4 | -------------------------------------------------------------------------------- /.project: -------------------------------------------------------------------------------- 1 | 2 | 3 | ARMKit1-1 4 | 5 | 6 | 7 | 8 | 9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder 10 | clean,full,incremental, 11 | 12 | 13 | 14 | 15 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder 16 | full,incremental, 17 | 18 | 19 | 20 | 21 | 22 | org.eclipse.cdt.core.cnature 23 | org.eclipse.cdt.managedbuilder.core.managedBuildNature 24 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature 25 | org.eclipse.cdt.core.ccnature 26 | 27 | 28 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Copyright (c) 2015, Matt Roche 2 | All rights reserved. 3 | 4 | Redistribution and use in source and binary forms, with or without 5 | modification, are permitted provided that the following conditions are met: 6 | 7 | 1. Redistributions of source code must retain the above copyright notice, this 8 | list of conditions and the following disclaimer. 9 | 2. Redistributions in binary form must reproduce the above copyright notice, 10 | this list of conditions and the following disclaimer in the documentation 11 | and/or other materials provided with the distribution. 12 | 13 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 14 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 15 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 16 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 17 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 18 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 19 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 20 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 21 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 22 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 23 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | #STM32 FunctGen# 2 | 3 | This is a basic function generator that uses the DAC on STM32F4 microcontrollers. This makes use of the floating point math on the F4 4 | so other MPUs will require some rework (or may not work at all). 5 | 6 | This is a GNU ARM Eclipse project. It was written to work with the [stm32 breakout board](https://github.com/angst7/stm32-breakout-mk2). 7 | 8 | Currently implemented functions are: 9 | * Sine Wave (computed via the CMSIS f32 lookup tables) 10 | * Square Wave 11 | * Triangle Wave 12 | * Sawtooth Wave 13 | 14 | You can control the amplitude (from ~0 to VCC PP) the frequency (From ~100HZ to 26kHz), and the offset using a potentiometer as a voltage 15 | divider read on ADC1 Channels 0, 1 and 5 respectively. 16 | 17 | Definitions for the default pins and ports are in arbwave.h for quick reference or modification. 18 | 19 | It's pretty rough at the moment, but I wanted to get it up here for folks who've been watching me make this on livecoding.tv/angst7 20 | 21 | ## License ## 22 | Licensed under BSD unless otherwise specified in the source code (some code is ST Microcelectronics boilerplate and CMSIS libraries) 23 | See LICENSE for other info. 24 | -------------------------------------------------------------------------------- /include/arbwave.h: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * arbwave.h 4 | * 5 | * Definitions for the configuration and operation of the STM32 Function 6 | * Generator 7 | * 8 | * Copyright (c) 2016 Matt Roche 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, this 15 | * list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | *****************************************************************************/ 31 | 32 | #ifndef ARBWAVE_H_ 33 | #define ARBWAVE_H_ 34 | 35 | #include "stm32f4xx.h" 36 | 37 | #define DAC_OUTPUT_RATE 420000 // The update rate of the DAC in Hz 38 | #define DAC_SAMPLES_SIZE 10000 // The size of the DAC output buffer (Mult of 10) 39 | 40 | #define SAMPLES_SIZE 3 // Number of ADC channels we're scanning 41 | 42 | #define FREQUENCY_PIN GPIO_PIN_0 // The ADC Inputs for setting wave 43 | #define AMPLITUDE_PIN GPIO_PIN_1 // attributes 44 | #define OFFSET_PIN GPIO_PIN_5 45 | 46 | #define FREQUENCY_CHANNEL ADC_CHANNEL_0 // ADC Channels corresponding to the 47 | #define AMPLITUDE_CHANNEL ADC_CHANNEL_1 // IO pins selected above 48 | #define OFFSET_CHANNEL ADC_CHANNEL_5 49 | 50 | #define DAC_OUTPUT_PIN GPIO_PIN_4 // DAC audio output 51 | 52 | #define SQUARE_PIN GPIO_PIN_11 // GPIO Inputs to select waveform type 53 | #define TRIANGLE_PIN GPIO_PIN_12 54 | #define SAWTOOTH_PIN GPIO_PIN_13 55 | #define SINE_PIN GPIO_PIN_14 56 | 57 | #define GREEN_LED_PIN GPIO_PIN_8 // LED GPIO Outputs 58 | #define RED_LED_PIN GPIO_PIN_9 59 | 60 | #define ADC_PORT GPIOA // Ports for various peripherals 61 | #define DAC_PORT GPIOA 62 | #define SELECT_PORT GPIOB 63 | #define LED_PORT GPIOC 64 | 65 | // Shorthand macros for GPIO read and toggle 66 | 67 | #define pinset(X) HAL_GPIO_ReadPin(X)==GPIO_PIN_SET 68 | #define toggle(X) HAL_GPIO_TogglePin(X) 69 | 70 | #define SQUARE SELECT_PORT, SQUARE_PIN 71 | #define TRIANGLE SELECT_PORT, TRIANGLE_PIN 72 | #define SAWTOOTH SELECT_PORT, SAWTOOTH_PIN 73 | #define SINE SELECT_PORT, SINE_PIN 74 | 75 | #define GREEN_LED LED_PORT, GREEN_LED_PIN 76 | #define RED_LED LED_PORT, RED_LED_PIN 77 | 78 | 79 | typedef enum { 80 | F_SQUARE_WAVE, 81 | F_TRIANGLE_WAVE, 82 | F_SAWTOOTH_WAVE, 83 | F_SINE_WAVE 84 | } outputFunctionType; 85 | 86 | // applicationState stores the current operating state of the generator 87 | 88 | typedef struct { 89 | uint16_t* dacData; 90 | outputFunctionType func; 91 | uint8_t bin; 92 | uint16_t freq; 93 | uint16_t amp; 94 | uint16_t offset; 95 | } applicationState; 96 | 97 | void Fill_DAC_Half_Buffer(applicationState* appState); 98 | 99 | #endif /* ARBWAVE_H_ */ 100 | -------------------------------------------------------------------------------- /include/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_it.h 4 | * @brief This file contains the headers of the interrupt handlers. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2015 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 __STM32F4xx_IT_H 36 | #define __STM32F4xx_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 SysTick_Handler(void); 49 | 50 | #ifdef __cplusplus 51 | } 52 | #endif 53 | 54 | #endif /* __STM32F4xx_IT_H */ 55 | 56 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 57 | -------------------------------------------------------------------------------- /ldscripts/libs.ld: -------------------------------------------------------------------------------- 1 | 2 | /* 3 | * Placeholder to list other libraries required by the application. 4 | 5 | GROUP( 6 | ) 7 | 8 | */ 9 | -------------------------------------------------------------------------------- /ldscripts/mem.ld: -------------------------------------------------------------------------------- 1 | /* 2 | * Memory Spaces Definitions. 3 | * 4 | * Need modifying for a specific board. 5 | * FLASH.ORIGIN: starting address of flash 6 | * FLASH.LENGTH: length of flash 7 | * RAM.ORIGIN: starting address of RAM bank 0 8 | * RAM.LENGTH: length of RAM bank 0 9 | * 10 | * The values below can be addressed in further linker scripts 11 | * using functions like 'ORIGIN(RAM)' or 'LENGTH(RAM)'. 12 | */ 13 | 14 | MEMORY 15 | { 16 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K 17 | CCMRAM (xrw) : ORIGIN = 0x10000000, LENGTH = 64K 18 | FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K 19 | FLASHB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 20 | EXTMEMB0 (rx) : ORIGIN = 0x00000000, LENGTH = 0 21 | EXTMEMB1 (rx) : ORIGIN = 0x00000000, LENGTH = 0 22 | EXTMEMB2 (rx) : ORIGIN = 0x00000000, LENGTH = 0 23 | EXTMEMB3 (rx) : ORIGIN = 0x00000000, LENGTH = 0 24 | MEMORY_ARRAY (xrw) : ORIGIN = 0x20002000, LENGTH = 32 25 | } 26 | 27 | /* 28 | * For external ram use something like: 29 | 30 | RAM (xrw) : ORIGIN = 0x64000000, LENGTH = 2048K 31 | 32 | */ 33 | -------------------------------------------------------------------------------- /src/_initialize_hardware.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the GNU ARM Eclipse distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #include "stm32f4xx.h" 9 | #include "stm32f4xx_hal.h" 10 | #include "stm32f4xx_hal_cortex.h" 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | // The external clock frequency is specified as a preprocessor definition 15 | // passed to the compiler via a command line option (see the 'C/C++ General' -> 16 | // 'Paths and Symbols' -> the 'Symbols' tab, if you want to change it). 17 | // The value selected during project creation was HSE_VALUE=8000000. 18 | // 19 | // The code to set the clock is at the end. 20 | // 21 | // Note1: The default clock settings assume that the HSE_VALUE is a multiple 22 | // of 1MHz, and try to reach the maximum speed available for the 23 | // board. It does NOT guarantee that the required USB clock of 48MHz is 24 | // available. If you need this, please update the settings of PLL_M, PLL_N, 25 | // PLL_P, PLL_Q to match your needs. 26 | // 27 | // Note2: The external memory controllers are not enabled. If needed, you 28 | // have to define DATA_IN_ExtSRAM or DATA_IN_ExtSDRAM and to configure 29 | // the memory banks in system/src/cmsis/system_stm32f4xx.c to match your needs. 30 | 31 | // ---------------------------------------------------------------------------- 32 | 33 | // Forward declarations. 34 | 35 | void 36 | __initialize_hardware(void); 37 | 38 | void 39 | SystemClock_Config(void); 40 | 41 | // ---------------------------------------------------------------------------- 42 | 43 | // This is the application hardware initialisation routine, 44 | // redefined to add more inits. 45 | // 46 | // Called early from _start(), right after data & bss init, before 47 | // constructors. 48 | // 49 | // After Reset the Cortex-M processor is in Thread mode, 50 | // priority is Privileged, and the Stack is set to Main. 51 | // 52 | // Warning: The HAL requires the system timer, running at 1000 Hz 53 | // and calling HAL_IncTick(). 54 | 55 | void 56 | __initialize_hardware(void) 57 | { 58 | // Initialise the HAL Library; it must be the first function 59 | // to be executed before the call of any HAL function. 60 | HAL_Init(); 61 | 62 | // Enable HSE Oscillator and activate PLL with HSE as source 63 | SystemClock_Config(); 64 | 65 | // Call the CSMSIS system clock routine to store the clock frequency 66 | // in the SystemCoreClock global RAM location. 67 | SystemCoreClockUpdate(); 68 | } 69 | 70 | // Disable when using RTOSes, since they have their own handler. 71 | #if 0 72 | 73 | // This is a sample SysTick handler, use it if you need HAL timings. 74 | void __attribute__ ((section(".after_vectors"))) 75 | SysTick_Handler(void) 76 | { 77 | #if defined(USE_HAL_DRIVER) 78 | HAL_IncTick(); 79 | #endif 80 | } 81 | 82 | #endif 83 | 84 | // ---------------------------------------------------------------------------- 85 | 86 | /** 87 | * @brief System Clock Configuration 88 | * @param None 89 | * @retval None 90 | */ 91 | void 92 | __attribute__((weak)) 93 | SystemClock_Config(void) 94 | { 95 | // Enable Power Control clock 96 | __PWR_CLK_ENABLE(); 97 | 98 | // The voltage scaling allows optimizing the power consumption when the 99 | // device is clocked below the maximum system frequency, to update the 100 | // voltage scaling value regarding system frequency refer to product 101 | // datasheet. 102 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1); 103 | 104 | #warning "Please check if the SystemClock_Config() settings match your board!" 105 | // Comment out the warning after checking and updating. 106 | 107 | RCC_OscInitTypeDef RCC_OscInitStruct; 108 | 109 | #if defined(HSE_VALUE) && (HSE_VALUE != 0) 110 | // Enable HSE Oscillator and activate PLL with HSE as source. 111 | // This is tuned for STM32F4-DISCOVERY; update it for your board. 112 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE; 113 | RCC_OscInitStruct.HSEState = RCC_HSE_ON; 114 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE; 115 | // This assumes the HSE_VALUE is a multiple of 1 MHz. If this is not 116 | // your case, you have to recompute these PLL constants. 117 | RCC_OscInitStruct.PLL.PLLM = (HSE_VALUE/1000000u); 118 | #else 119 | // Use HSI and activate PLL with HSI as source. 120 | // This is tuned for NUCLEO-F411; update it for your board. 121 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI; 122 | RCC_OscInitStruct.HSIState = RCC_HSI_ON; 123 | // 16 is the average calibration value, adjust for your own board. 124 | RCC_OscInitStruct.HSICalibrationValue = 16; 125 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI; 126 | // This assumes the HSI_VALUE is a multiple of 1 MHz. If this is not 127 | // your case, you have to recompute these PLL constants. 128 | RCC_OscInitStruct.PLL.PLLM = (HSI_VALUE/1000000u); 129 | #endif 130 | 131 | RCC_OscInitStruct.PLL.PLLN = 336; 132 | #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) 133 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; /* 84 MHz */ 134 | #elif defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) 135 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; /* 168 MHz */ 136 | #elif defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) 137 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; /* 168 MHz */ 138 | #elif defined(STM32F446xx) 139 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2; /* 168 MHz */ 140 | #else 141 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4; /* 84 MHz, conservative */ 142 | #endif 143 | RCC_OscInitStruct.PLL.PLLQ = 7; /* To make USB work. */ 144 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON; 145 | HAL_RCC_OscConfig(&RCC_OscInitStruct); 146 | 147 | RCC_ClkInitTypeDef RCC_ClkInitStruct; 148 | // Select PLL as system clock source and configure the HCLK, PCLK1 and PCLK2 149 | // clocks dividers 150 | RCC_ClkInitStruct.ClockType = (RCC_CLOCKTYPE_SYSCLK | RCC_CLOCKTYPE_HCLK 151 | | RCC_CLOCKTYPE_PCLK1 | RCC_CLOCKTYPE_PCLK2); 152 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK; 153 | #if defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) 154 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 155 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV2; 156 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV1; 157 | HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_2); 158 | #else 159 | // This is expected to work for most large cores. 160 | // Check and update it for your own configuration. 161 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1; 162 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4; 163 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2; 164 | HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5); 165 | #endif 166 | 167 | HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000); 168 | 169 | HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK); 170 | } 171 | 172 | // ---------------------------------------------------------------------------- 173 | -------------------------------------------------------------------------------- /src/_write.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // Do not include on semihosting and when freestanding 7 | #if !defined(OS_USE_SEMIHOSTING) && !(__STDC_HOSTED__ == 0) 8 | 9 | // ---------------------------------------------------------------------------- 10 | 11 | #include 12 | #include "diag/Trace.h" 13 | 14 | // ---------------------------------------------------------------------------- 15 | 16 | // When using retargetted configurations, the standard write() system call, 17 | // after a long way inside newlib, finally calls this implementation function. 18 | 19 | // Based on the file descriptor, it can send arrays of characters to 20 | // different physical devices. 21 | 22 | // Currently only the output and error file descriptors are tested, 23 | // and the characters are forwarded to the trace device, mainly 24 | // for demonstration purposes. Adjust it for your specific needs. 25 | 26 | // For freestanding applications this file is not used and can be safely 27 | // ignored. 28 | 29 | ssize_t 30 | _write (int fd, const char* buf, size_t nbyte); 31 | 32 | ssize_t 33 | _write (int fd __attribute__((unused)), const char* buf __attribute__((unused)), 34 | size_t nbyte __attribute__((unused))) 35 | { 36 | #if defined(TRACE) 37 | // STDOUT and STDERR are routed to the trace device 38 | if (fd == 1 || fd == 2) 39 | { 40 | return trace_write (buf, nbyte); 41 | } 42 | #endif // TRACE 43 | 44 | errno = ENOSYS; 45 | return -1; 46 | } 47 | 48 | // ---------------------------------------------------------------------------- 49 | 50 | #endif // !defined(OS_USE_SEMIHOSTING) && !(__STDC_HOSTED__ == 0) 51 | -------------------------------------------------------------------------------- /src/arbwave.c: -------------------------------------------------------------------------------- 1 | /***************************************************************************** 2 | * 3 | * arbwave.c 4 | * 5 | * This is a collection of routines to generate Sine, Square, Triangle and 6 | * Sawtooth waveforms as part of a simple STM32 Function Generator 7 | * 8 | * Copyright (c) 2016 Matt Roche 9 | * All rights reserved. 10 | * 11 | * Redistribution and use in source and binary forms, with or without 12 | * modification, are permitted provided that the following conditions are met: 13 | * 14 | * 1. Redistributions of source code must retain the above copyright notice, this 15 | * list of conditions and the following disclaimer. 16 | * 2. Redistributions in binary form must reproduce the above copyright notice, 17 | * this list of conditions and the following disclaimer in the documentation 18 | * and/or other materials provided with the distribution. 19 | * 20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 21 | * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 22 | * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR 24 | * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 25 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 27 | * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 28 | * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 29 | * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 30 | *****************************************************************************/ 31 | 32 | #include 33 | #include "arbwave.h" 34 | #include "arm_math.h" 35 | 36 | uint16_t outPos = 0; 37 | uint16_t lastBinFreq = 0; 38 | uint16_t lastFreq = 0; 39 | 40 | 41 | inline uint16_t Calc_Triangle_Wave(applicationState* appState, float32_t scaleVal, 42 | uint16_t *position, float32_t slope) { 43 | uint16_t outVal = 0; 44 | float32_t plotPos = scaleVal * (*position)++; 45 | 46 | if (plotPos < M_PI) { 47 | outVal = slope*plotPos+appState->offset; 48 | } else if (plotPos < M_TWOPI) { 49 | outVal = 2*appState->amp-slope*(plotPos-M_PI) + 50 | appState->offset; 51 | } else { 52 | *position = 0; 53 | outVal = appState->offset; 54 | } 55 | 56 | return outVal; 57 | } 58 | 59 | inline uint16_t Calc_Square_Wave(uint16_t offset, uint16_t amp, 60 | float32_t scaleVal, uint16_t *position) { 61 | uint16_t outVal = 0; 62 | float32_t plotPos = scaleVal * (*position)++; 63 | 64 | if (plotPos < M_PI) { 65 | outVal = amp; 66 | } else if (plotPos < 6.243) { 67 | outVal = offset; 68 | } else { 69 | *position = 0; 70 | outVal = amp; 71 | } 72 | return outVal; 73 | } 74 | 75 | inline uint16_t Calc_SawTooth_Wave(applicationState* appState, float32_t scaleVal, 76 | uint16_t *position, float32_t slope) { 77 | uint16_t outVal = 0; 78 | float32_t plotPos = scaleVal * (*position)++; 79 | if (plotPos < M_TWOPI) { 80 | outVal = slope*plotPos+appState->offset; 81 | } else { 82 | *position = 0; 83 | outVal = appState->offset; 84 | } 85 | 86 | return outVal; 87 | } 88 | 89 | void Fill_DAC_Half_Buffer(applicationState* appState) { 90 | uint16_t *activeSample = appState->dacData+ 91 | ((appState->bin-1)*DAC_SAMPLES_SIZE); 92 | uint32_t i = 0; 93 | float32_t scaleVal=(appState->freq*M_TWOPI)/DAC_OUTPUT_RATE; 94 | 95 | float32_t slope = (2*appState->amp)/M_PI;; 96 | 97 | uint16_t offset = 2*appState->offset; 98 | 99 | uint16_t reset = DAC_OUTPUT_RATE/appState->freq; 100 | float32_t step = DAC_OUTPUT_RATE*1.0f/appState->freq; 101 | 102 | switch(appState->func) { 103 | case F_SQUARE_WAVE: 104 | offset = appState->offset; 105 | uint16_t amp = offset+2*appState->amp; 106 | while (i < DAC_SAMPLES_SIZE) { 107 | *activeSample++ = Calc_Square_Wave(offset, amp, scaleVal, &outPos); 108 | i++; 109 | } 110 | break; 111 | case F_TRIANGLE_WAVE: 112 | while (i < DAC_SAMPLES_SIZE) { 113 | *activeSample++ = Calc_Triangle_Wave(appState, scaleVal, &outPos, slope); 114 | i++; 115 | } 116 | break; 117 | case F_SAWTOOTH_WAVE: 118 | slope = appState->amp/M_PI; 119 | while (i < DAC_SAMPLES_SIZE) { 120 | *activeSample++ = Calc_SawTooth_Wave(appState, scaleVal, &outPos, slope); 121 | i++; 122 | } 123 | break; 124 | case F_SINE_WAVE: 125 | scaleVal *= (step/reset); // correct for floating point / integer error 126 | while (i < DAC_SAMPLES_SIZE) { 127 | // calculate the sin of 2*pi*f/dac rate 128 | *activeSample++ = (uint16_t)(arm_sin_f32(scaleVal*outPos++)*appState->amp+offset); 129 | 130 | // check to see if we're near a multiple of 2*pi 131 | if ((outPos > 10) && (outPos % reset == 0)) { 132 | outPos = 0; 133 | } 134 | 135 | i++; 136 | } 137 | break; 138 | default: 139 | break; 140 | } 141 | } 142 | 143 | -------------------------------------------------------------------------------- /src/stm32f4xx_hal_msp.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_msp_template.c 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief This file contains the HAL System and Peripheral (PPP) MSP initialization 8 | * and de-initialization functions. 9 | * It should be copied to the application folder and renamed into 'stm32f4xx_hal_msp.c'. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2015 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 "stm32f4xx_hal.h" 42 | #include "arbwave.h" 43 | 44 | extern DMA_HandleTypeDef hdma_adc1; 45 | extern DMA_HandleTypeDef hdma_dac1; 46 | //extern DMA_HandleTypeDef hdma_usart2_rx; 47 | 48 | /** @addtogroup STM32F4xx_HAL_Driver 49 | * @{ 50 | */ 51 | 52 | /** @defgroup HAL_MSP HAL MSP 53 | * @brief HAL MSP module. 54 | * @{ 55 | */ 56 | 57 | /* Private typedef -----------------------------------------------------------*/ 58 | /* Private define ------------------------------------------------------------*/ 59 | /* Private macro -------------------------------------------------------------*/ 60 | /* Private variables ---------------------------------------------------------*/ 61 | /* Private function prototypes -----------------------------------------------*/ 62 | /* Private functions ---------------------------------------------------------*/ 63 | 64 | /** @defgroup HAL_MSP_Private_Functions HAL MSP Private Functions 65 | * @{ 66 | */ 67 | 68 | /** 69 | * @brief Initializes the Global MSP. 70 | * @note This function is called from HAL_Init() function to perform system 71 | * level initialization (GPIOs, clock, DMA, interrupt). 72 | * @retval None 73 | */ 74 | void HAL_MspInit(void) 75 | { 76 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_4); 77 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 4); 78 | } 79 | 80 | /** 81 | * @brief DeInitializes the Global MSP. 82 | * @note This functiona is called from HAL_DeInit() function to perform system 83 | * level de-initialization (GPIOs, clock, DMA, interrupt). 84 | * @retval None 85 | */ 86 | void HAL_MspDeInit(void) 87 | { 88 | 89 | } 90 | 91 | void HAL_ADC_MspInit(ADC_HandleTypeDef* hadc) 92 | { 93 | 94 | GPIO_InitTypeDef GPIO_InitStruct; 95 | if(hadc->Instance==ADC1) 96 | { 97 | /* Peripheral clock enable */ 98 | __ADC1_CLK_ENABLE(); 99 | 100 | /**ADC1 GPIO Configuration 101 | PA0-WKUP ------> ADC1_IN0 102 | PA1 ------> ADC1_IN1 103 | PA5 ------> ADC1_IN5 104 | */ 105 | GPIO_InitStruct.Pin = FREQUENCY_PIN|AMPLITUDE_PIN|OFFSET_PIN; 106 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 107 | GPIO_InitStruct.Pull = GPIO_NOPULL; 108 | HAL_GPIO_Init(ADC_PORT, &GPIO_InitStruct); 109 | 110 | /* Peripheral DMA init*/ 111 | 112 | hdma_adc1.Instance = DMA2_Stream0; 113 | hdma_adc1.Init.Channel = DMA_CHANNEL_0; 114 | hdma_adc1.Init.Direction = DMA_PERIPH_TO_MEMORY; 115 | hdma_adc1.Init.PeriphInc = DMA_PINC_DISABLE; 116 | hdma_adc1.Init.MemInc = DMA_MINC_ENABLE; 117 | hdma_adc1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; 118 | hdma_adc1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; 119 | hdma_adc1.Init.Mode = DMA_CIRCULAR; 120 | hdma_adc1.Init.Priority = DMA_PRIORITY_LOW; 121 | hdma_adc1.Init.FIFOMode = DMA_FIFOMODE_ENABLE; 122 | hdma_adc1.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; 123 | hdma_adc1.Init.MemBurst = DMA_MBURST_SINGLE; 124 | hdma_adc1.Init.PeriphBurst = DMA_PBURST_SINGLE; 125 | HAL_DMA_Init(&hdma_adc1); 126 | 127 | __HAL_LINKDMA(hadc,DMA_Handle,hdma_adc1); 128 | 129 | } 130 | 131 | } 132 | 133 | void HAL_ADC_MspDeInit(ADC_HandleTypeDef* hadc) 134 | { 135 | 136 | if(hadc->Instance==ADC1) 137 | { 138 | /* Peripheral clock disable */ 139 | __ADC1_CLK_DISABLE(); 140 | 141 | /**ADC1 GPIO Configuration 142 | PA0-WKUP ------> ADC1_IN0 143 | */ 144 | HAL_GPIO_DeInit(ADC_PORT, FREQUENCY_PIN|AMPLITUDE_PIN|OFFSET_PIN); 145 | 146 | /* Peripheral DMA DeInit*/ 147 | HAL_DMA_DeInit(hadc->DMA_Handle); 148 | } 149 | 150 | } 151 | 152 | void HAL_DAC_MspInit(DAC_HandleTypeDef* hdac) 153 | { 154 | 155 | GPIO_InitTypeDef GPIO_InitStruct; 156 | if(hdac->Instance==DAC) 157 | { 158 | /* Peripheral clock enable */ 159 | __DAC_CLK_ENABLE(); 160 | 161 | /**DAC GPIO Configuration 162 | PA4 ------> DAC_OUT1 163 | */ 164 | GPIO_InitStruct.Pin = DAC_OUTPUT_PIN; 165 | GPIO_InitStruct.Mode = GPIO_MODE_ANALOG; 166 | GPIO_InitStruct.Pull = GPIO_NOPULL; 167 | HAL_GPIO_Init(DAC_PORT, &GPIO_InitStruct); 168 | 169 | hdma_dac1.Instance = DMA1_Stream5; 170 | hdma_dac1.Init.Channel = DMA_CHANNEL_7; 171 | hdma_dac1.Init.Direction = DMA_MEMORY_TO_PERIPH; 172 | hdma_dac1.Init.PeriphInc = DMA_PINC_DISABLE; 173 | hdma_dac1.Init.MemInc = DMA_MINC_ENABLE; 174 | hdma_dac1.Init.PeriphDataAlignment = DMA_PDATAALIGN_HALFWORD; 175 | hdma_dac1.Init.MemDataAlignment = DMA_MDATAALIGN_HALFWORD; 176 | hdma_dac1.Init.Mode = DMA_CIRCULAR; 177 | hdma_dac1.Init.Priority = DMA_PRIORITY_MEDIUM; 178 | hdma_dac1.Init.FIFOMode = DMA_FIFOMODE_ENABLE; 179 | hdma_dac1.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL; 180 | hdma_dac1.Init.MemBurst = DMA_MBURST_SINGLE; 181 | hdma_dac1.Init.PeriphBurst = DMA_PBURST_SINGLE; 182 | HAL_DMA_Init(&hdma_dac1); 183 | 184 | __HAL_LINKDMA(hdac,DMA_Handle1,hdma_dac1); 185 | 186 | /* Peripheral interrupt init*/ 187 | HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0); 188 | HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); 189 | } 190 | 191 | } 192 | 193 | void HAL_DAC_MspDeInit(DAC_HandleTypeDef* hdac) 194 | { 195 | 196 | if(hdac->Instance==DAC) 197 | { 198 | /* Peripheral clock disable */ 199 | __DAC_CLK_DISABLE(); 200 | 201 | /**DAC GPIO Configuration 202 | PA4 ------> DAC_OUT1 203 | */ 204 | HAL_GPIO_DeInit(DAC_PORT, DAC_OUTPUT_PIN); 205 | 206 | HAL_DMA_DeInit(hdac->DMA_Handle1); 207 | 208 | /* Peripheral interrupt DeInit*/ 209 | HAL_NVIC_DisableIRQ(TIM6_DAC_IRQn); 210 | 211 | } 212 | 213 | } 214 | 215 | 216 | void HAL_TIM_Base_MspInit(TIM_HandleTypeDef* htim_base) 217 | { 218 | 219 | if(htim_base->Instance==TIM2) 220 | { 221 | /* Peripheral clock enable */ 222 | __TIM2_CLK_ENABLE(); 223 | HAL_NVIC_SetPriority(TIM2_IRQn, 0, 6); 224 | HAL_NVIC_EnableIRQ(TIM2_IRQn); 225 | } else if(htim_base->Instance==TIM6) 226 | { 227 | /* Peripheral clock enable */ 228 | __TIM6_CLK_ENABLE(); 229 | /* Peripheral interrupt init*/ 230 | HAL_NVIC_SetPriority(TIM6_DAC_IRQn, 0, 0); 231 | HAL_NVIC_EnableIRQ(TIM6_DAC_IRQn); 232 | } 233 | 234 | } 235 | 236 | void HAL_TIM_Base_MspDeInit(TIM_HandleTypeDef* htim_base) 237 | { 238 | 239 | if(htim_base->Instance==TIM2) 240 | { 241 | /* Peripheral clock disable */ 242 | __TIM2_CLK_DISABLE(); 243 | HAL_NVIC_DisableIRQ(TIM2_IRQn); 244 | } else if(htim_base->Instance==TIM6) 245 | { 246 | __TIM6_CLK_DISABLE(); 247 | } 248 | 249 | } 250 | 251 | /** 252 | * @} 253 | */ 254 | 255 | /** 256 | * @} 257 | */ 258 | 259 | /** 260 | * @} 261 | */ 262 | 263 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 264 | -------------------------------------------------------------------------------- /src/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_it.c 4 | * @brief Interrupt Service Routines. 5 | ****************************************************************************** 6 | * 7 | * COPYRIGHT(c) 2015 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 "stm32f4xx_hal.h" 35 | #include "stm32f4xx.h" 36 | #include "stm32f4xx_it.h" 37 | 38 | /* USER CODE BEGIN 0 */ 39 | 40 | extern DMA_HandleTypeDef hdma_adc1; 41 | extern DMA_HandleTypeDef hdma_dac1; 42 | extern DAC_HandleTypeDef hdac; 43 | extern TIM_HandleTypeDef htim2; 44 | extern TIM_HandleTypeDef htim6; 45 | extern uint8_t sampleBucket; 46 | extern uint8_t dacBucket; 47 | 48 | /* USER CODE END 0 */ 49 | 50 | /* External variables --------------------------------------------------------*/ 51 | 52 | /******************************************************************************/ 53 | /* Cortex-M4 Processor Interruption and Exception Handlers */ 54 | /******************************************************************************/ 55 | 56 | /** 57 | * @brief This function handles System tick timer. 58 | */ 59 | void SysTick_Handler(void) 60 | { 61 | HAL_IncTick(); 62 | HAL_SYSTICK_IRQHandler(); 63 | } 64 | 65 | /******************************************************************************/ 66 | /* STM32F4xx Peripheral Interrupt Handlers */ 67 | /* Add here the Interrupt Handlers for the used peripherals. */ 68 | /* For the available peripheral interrupt handler names, */ 69 | /* please refer to the startup file (startup_stm32f4xx.s). */ 70 | /******************************************************************************/ 71 | 72 | /** 73 | * Timer 2 controls the ADC sample rate 74 | */ 75 | void TIM2_IRQHandler(void) 76 | { 77 | HAL_TIM_IRQHandler(&htim2); 78 | } 79 | 80 | 81 | /** 82 | * Timer 6 controls the DAC output rate 83 | */ 84 | void TIM6_DAC_IRQHandler(void) 85 | { 86 | HAL_DAC_IRQHandler(&hdac); 87 | HAL_TIM_IRQHandler(&htim6); 88 | } 89 | 90 | /** 91 | * The ADC is configured on DMA Channel 2, Stream 0. Whenever the HALF_MEM 92 | * interrupt is triggered, this sets the sampleBucket variable to the completed 93 | * half of the DMA area that is ready to be read. 94 | */ 95 | void DMA2_Stream0_IRQHandler(void) 96 | { 97 | HAL_DMA_IRQHandler(&hdma_adc1); 98 | if (hdma_adc1.State == HAL_DMA_STATE_READY_HALF_MEM0) { 99 | sampleBucket = 1; 100 | } else { 101 | sampleBucket = 2; 102 | } 103 | } 104 | 105 | /** 106 | * The DAC is configured on DMA Channel 1, Stream 5. Whenever the HALF_MEM 107 | * interrupt is triggered, this sets the dacBucket variable to the half of 108 | * DMA area that is ready to be written. 109 | */ 110 | void DMA1_Stream5_IRQHandler(void) 111 | { 112 | HAL_DMA_IRQHandler(&hdma_dac1); 113 | 114 | if (hdma_dac1.State == HAL_DMA_STATE_READY_HALF_MEM0) { 115 | dacBucket = 1; 116 | } else { 117 | dacBucket = 2; 118 | } 119 | 120 | } 121 | 122 | /* USER CODE END 1 */ 123 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 124 | -------------------------------------------------------------------------------- /system/include/arm/semihosting.h: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | #ifndef ARM_SEMIHOSTING_H_ 7 | #define ARM_SEMIHOSTING_H_ 8 | 9 | // ---------------------------------------------------------------------------- 10 | 11 | // Semihosting operations. 12 | enum OperationNumber 13 | { 14 | // Regular operations 15 | SEMIHOSTING_EnterSVC = 0x17, 16 | SEMIHOSTING_ReportException = 0x18, 17 | SEMIHOSTING_SYS_CLOSE = 0x02, 18 | SEMIHOSTING_SYS_CLOCK = 0x10, 19 | SEMIHOSTING_SYS_ELAPSED = 0x30, 20 | SEMIHOSTING_SYS_ERRNO = 0x13, 21 | SEMIHOSTING_SYS_FLEN = 0x0C, 22 | SEMIHOSTING_SYS_GET_CMDLINE = 0x15, 23 | SEMIHOSTING_SYS_HEAPINFO = 0x16, 24 | SEMIHOSTING_SYS_ISERROR = 0x08, 25 | SEMIHOSTING_SYS_ISTTY = 0x09, 26 | SEMIHOSTING_SYS_OPEN = 0x01, 27 | SEMIHOSTING_SYS_READ = 0x06, 28 | SEMIHOSTING_SYS_READC = 0x07, 29 | SEMIHOSTING_SYS_REMOVE = 0x0E, 30 | SEMIHOSTING_SYS_RENAME = 0x0F, 31 | SEMIHOSTING_SYS_SEEK = 0x0A, 32 | SEMIHOSTING_SYS_SYSTEM = 0x12, 33 | SEMIHOSTING_SYS_TICKFREQ = 0x31, 34 | SEMIHOSTING_SYS_TIME = 0x11, 35 | SEMIHOSTING_SYS_TMPNAM = 0x0D, 36 | SEMIHOSTING_SYS_WRITE = 0x05, 37 | SEMIHOSTING_SYS_WRITEC = 0x03, 38 | SEMIHOSTING_SYS_WRITE0 = 0x04, 39 | 40 | // Codes returned by SEMIHOSTING_ReportException 41 | ADP_Stopped_ApplicationExit = ((2 << 16) + 38), 42 | ADP_Stopped_RunTimeError = ((2 << 16) + 35), 43 | 44 | }; 45 | 46 | // ---------------------------------------------------------------------------- 47 | 48 | // SWI numbers and reason codes for RDI (Angel) monitors. 49 | #define AngelSWI_ARM 0x123456 50 | #ifdef __thumb__ 51 | #define AngelSWI 0xAB 52 | #else 53 | #define AngelSWI AngelSWI_ARM 54 | #endif 55 | // For thumb only architectures use the BKPT instruction instead of SWI. 56 | #if defined(__ARM_ARCH_7M__) \ 57 | || defined(__ARM_ARCH_7EM__) \ 58 | || defined(__ARM_ARCH_6M__) 59 | #define AngelSWIInsn "bkpt" 60 | #define AngelSWIAsm bkpt 61 | #else 62 | #define AngelSWIInsn "swi" 63 | #define AngelSWIAsm swi 64 | #endif 65 | 66 | #if defined(OS_DEBUG_SEMIHOSTING_FAULTS) 67 | // Testing the local semihosting handler cannot use another BKPT, since this 68 | // configuration cannot trigger HaedFault exceptions while the debugger is 69 | // connected, so we use an illegal op code, that will trigger an 70 | // UsageFault exception. 71 | #define AngelSWITestFault "setend be" 72 | #define AngelSWITestFaultOpCode (0xB658) 73 | #endif 74 | 75 | static inline int 76 | __attribute__ ((always_inline)) 77 | call_host (int reason, void* arg) 78 | { 79 | int value; 80 | asm volatile ( 81 | 82 | " mov r0, %[rsn] \n" 83 | " mov r1, %[arg] \n" 84 | #if defined(OS_DEBUG_SEMIHOSTING_FAULTS) 85 | " " AngelSWITestFault " \n" 86 | #else 87 | " " AngelSWIInsn " %[swi] \n" 88 | #endif 89 | " mov %[val], r0" 90 | 91 | : [val] "=r" (value) /* Outputs */ 92 | : [rsn] "r" (reason), [arg] "r" (arg), [swi] "i" (AngelSWI) /* Inputs */ 93 | : "r0", "r1", "r2", "r3", "ip", "lr", "memory", "cc" 94 | // Clobbers r0 and r1, and lr if in supervisor mode 95 | ); 96 | 97 | // Accordingly to page 13-77 of ARM DUI 0040D other registers 98 | // can also be clobbered. Some memory positions may also be 99 | // changed by a system call, so they should not be kept in 100 | // registers. Note: we are assuming the manual is right and 101 | // Angel is respecting the APCS. 102 | return value; 103 | } 104 | 105 | // ---------------------------------------------------------------------------- 106 | 107 | // Function used in _exit() to return the status code as Angel exception. 108 | static inline void 109 | __attribute__ ((always_inline,noreturn)) 110 | report_exception (int reason) 111 | { 112 | call_host (SEMIHOSTING_ReportException, (void*) reason); 113 | 114 | for (;;) 115 | ; 116 | } 117 | 118 | // ---------------------------------------------------------------------------- 119 | 120 | #endif // ARM_SEMIHOSTING_H_ 121 | -------------------------------------------------------------------------------- /system/include/cmsis/README_ARM_CMSIS.md: -------------------------------------------------------------------------------- 1 | The ARM files are from the original `CMSIS-SP-00300-r4p4-00rel0.tgz` 2 | archive, the folder: 3 | 4 | * `CMSIS/Include` 5 | 6 | The files are generally unchanged, except the `core_cm*.h` files which were 7 | braced with pragmas to avoid several warnings. 8 | -------------------------------------------------------------------------------- /system/include/cmsis/README_DEVICE_CMSIS.md: -------------------------------------------------------------------------------- 1 | The STM files are from the original `stm32cube_fw_f4_v190.zip` 2 | archive, the folder: 3 | 4 | * `STM32Cube_FW_F4_V1.9.0/Drivers/CMSIS/Device/ST/STM32F4xx/Include` 5 | 6 | There should be no changes from the STM originals. 7 | 8 | The `cmsis_device.h` was added for convenience. 9 | -------------------------------------------------------------------------------- /system/include/cmsis/arm_common_tables.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_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 | -------------------------------------------------------------------------------- /system/include/cmsis/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 | -------------------------------------------------------------------------------- /system/include/cmsis/cmsis_device.h: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the GNU ARM Eclipse distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | #ifndef STM32F4_CMSIS_DEVICE_H_ 7 | #define STM32F4_CMSIS_DEVICE_H_ 8 | 9 | #include "stm32f4xx.h" 10 | 11 | #endif // STM32F4_CMSIS_DEVICE_H_ 12 | -------------------------------------------------------------------------------- /system/include/cmsis/core_cmFunc.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmFunc.h 3 | * @brief CMSIS Cortex-M Core Function Access Header File 4 | * @version V4.20 5 | * @date 02. July 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 (__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 | #if defined ( __CC_ARM ) /*------------------ RealView Compiler -----------------*/ 52 | #include 53 | 54 | #elif (__ARMCC_VERSION >= 6010050) /*------------------ ARM Compiler V6 -------------------*/ 55 | #include 56 | 57 | #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ----------------------*/ 58 | #include 59 | 60 | #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler ----------------------*/ 61 | #include 62 | 63 | #elif defined ( __TMS470__ ) /*------------------ TI CCS Compiler -------------------*/ 64 | #include 65 | 66 | #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler ------------------*/ 67 | /* 68 | * The CMSIS functions have been implemented as intrinsics in the compiler. 69 | * Please use "carm -?i" to get an up to date list of all intrinsics, 70 | * Including the CMSIS ones. 71 | */ 72 | 73 | #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ 74 | #include 75 | 76 | #endif 77 | 78 | /*@} end of CMSIS_Core_RegAccFunctions */ 79 | 80 | #endif /* __CORE_CMFUNC_H */ 81 | -------------------------------------------------------------------------------- /system/include/cmsis/core_cmInstr.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmInstr.h 3 | * @brief CMSIS Cortex-M Core Instruction Access Header File 4 | * @version V4.20 5 | * @date 02. July 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 (__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 | #if defined ( __CC_ARM ) /*------------------ RealView Compiler -----------------*/ 52 | #include 53 | 54 | #elif (__ARMCC_VERSION >= 6010050) /*------------------ ARM Compiler V6 -------------------*/ 55 | #include 56 | 57 | #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ----------------------*/ 58 | #include 59 | 60 | #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler ----------------------*/ 61 | #include 62 | 63 | #elif defined ( __TMS470__ ) /*------------------ TI CCS Compiler -------------------*/ 64 | #include 65 | 66 | #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler ------------------*/ 67 | /* 68 | * The CMSIS functions have been implemented as intrinsics in the compiler. 69 | * Please use "carm -?i" to get an up to date list of all intrinsics, 70 | * Including the CMSIS ones. 71 | */ 72 | 73 | #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ 74 | #include 75 | 76 | #endif 77 | 78 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */ 79 | 80 | #endif /* __CORE_CMINSTR_H */ 81 | -------------------------------------------------------------------------------- /system/include/cmsis/core_cmSimd.h: -------------------------------------------------------------------------------- 1 | /**************************************************************************//** 2 | * @file core_cmSimd.h 3 | * @brief CMSIS Cortex-M SIMD Header File 4 | * @version V4.20 5 | * @date 02. July 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 (__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 | /******************************************************************************* 50 | * Hardware Abstraction Layer 51 | ******************************************************************************/ 52 | 53 | 54 | /* ################### Compiler specific Intrinsics ########################### */ 55 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics 56 | Access to dedicated SIMD instructions 57 | @{ 58 | */ 59 | 60 | #if defined ( __CC_ARM ) /*------------------ RealView Compiler -----------------*/ 61 | #include 62 | 63 | #elif (__ARMCC_VERSION >= 6010050) /*------------------ ARM Compiler V6 -------------------*/ 64 | #include 65 | 66 | #elif defined ( __GNUC__ ) /*------------------ GNU Compiler ----------------------*/ 67 | #include 68 | 69 | #elif defined ( __ICCARM__ ) /*------------------ ICC Compiler ----------------------*/ 70 | #include 71 | 72 | #elif defined ( __TMS470__ ) /*------------------ TI CCS Compiler -------------------*/ 73 | #include 74 | 75 | #elif defined ( __TASKING__ ) /*------------------ TASKING Compiler ------------------*/ 76 | /* 77 | * The CMSIS functions have been implemented as intrinsics in the compiler. 78 | * Please use "carm -?i" to get an up to date list of all intrinsics, 79 | * Including the CMSIS ones. 80 | */ 81 | 82 | #elif defined ( __CSMC__ ) /*------------------ COSMIC Compiler -------------------*/ 83 | #include 84 | 85 | #endif 86 | 87 | /*@} end of group CMSIS_SIMD_intrinsics */ 88 | 89 | 90 | #ifdef __cplusplus 91 | } 92 | #endif 93 | 94 | #endif /* __CORE_CMSIMD_H */ 95 | -------------------------------------------------------------------------------- /system/include/cmsis/stm32f405xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/include/cmsis/stm32f405xx.h -------------------------------------------------------------------------------- /system/include/cmsis/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/include/cmsis/stm32f4xx.h -------------------------------------------------------------------------------- /system/include/cmsis/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V2.4.1 6 | * @date 09-October-2015 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 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 stm32f4xx_system 43 | * @{ 44 | */ 45 | 46 | /** 47 | * @brief Define to prevent recursive inclusion 48 | */ 49 | #ifndef __SYSTEM_STM32F4XX_H 50 | #define __SYSTEM_STM32F4XX_H 51 | 52 | #ifdef __cplusplus 53 | extern "C" { 54 | #endif 55 | 56 | /** @addtogroup STM32F4xx_System_Includes 57 | * @{ 58 | */ 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @addtogroup STM32F4xx_System_Exported_types 66 | * @{ 67 | */ 68 | /* This 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 | 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @addtogroup STM32F4xx_System_Exported_Constants 84 | * @{ 85 | */ 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** @addtogroup STM32F4xx_System_Exported_Macros 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @addtogroup STM32F4xx_System_Exported_Functions 100 | * @{ 101 | */ 102 | 103 | extern void SystemInit(void); 104 | extern void SystemCoreClockUpdate(void); 105 | /** 106 | * @} 107 | */ 108 | 109 | #ifdef __cplusplus 110 | } 111 | #endif 112 | 113 | #endif /*__SYSTEM_STM32F4XX_H */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 123 | -------------------------------------------------------------------------------- /system/include/cortexm/ExceptionHandlers.h: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | #ifndef CORTEXM_EXCEPTION_HANDLERS_H_ 7 | #define CORTEXM_EXCEPTION_HANDLERS_H_ 8 | 9 | #include 10 | 11 | #if defined(DEBUG) 12 | #define __DEBUG_BKPT() asm volatile ("bkpt 0") 13 | #endif 14 | 15 | // ---------------------------------------------------------------------------- 16 | 17 | #if defined(__cplusplus) 18 | extern "C" 19 | { 20 | #endif 21 | 22 | // External references to cortexm_handlers.c 23 | 24 | extern void 25 | Reset_Handler (void); 26 | extern void 27 | NMI_Handler (void); 28 | extern void 29 | HardFault_Handler (void); 30 | 31 | #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 32 | extern void 33 | MemManage_Handler (void); 34 | extern void 35 | BusFault_Handler (void); 36 | extern void 37 | UsageFault_Handler (void); 38 | extern void 39 | DebugMon_Handler (void); 40 | #endif 41 | 42 | extern void 43 | SVC_Handler (void); 44 | 45 | extern void 46 | PendSV_Handler (void); 47 | extern void 48 | SysTick_Handler (void); 49 | 50 | // Exception Stack Frame of the Cortex-M3 or Cortex-M4 processor. 51 | typedef struct 52 | { 53 | uint32_t r0; 54 | uint32_t r1; 55 | uint32_t r2; 56 | uint32_t r3; 57 | uint32_t r12; 58 | uint32_t lr; 59 | uint32_t pc; 60 | uint32_t psr; 61 | #if defined(__ARM_ARCH_7EM__) 62 | uint32_t s[16]; 63 | #endif 64 | } ExceptionStackFrame; 65 | 66 | #if defined(TRACE) 67 | #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 68 | void 69 | dumpExceptionStack (ExceptionStackFrame* frame, uint32_t cfsr, uint32_t mmfar, 70 | uint32_t bfar, uint32_t lr); 71 | #endif // defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 72 | #if defined(__ARM_ARCH_6M__) 73 | void 74 | dumpExceptionStack (ExceptionStackFrame* frame, uint32_t lr); 75 | #endif // defined(__ARM_ARCH_6M__) 76 | #endif // defined(TRACE) 77 | 78 | void 79 | HardFault_Handler_C (ExceptionStackFrame* frame, uint32_t lr); 80 | 81 | #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 82 | void 83 | UsageFault_Handler_C (ExceptionStackFrame* frame, uint32_t lr); 84 | void 85 | BusFault_Handler_C (ExceptionStackFrame* frame, uint32_t lr); 86 | #endif // defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 87 | 88 | #if defined(__cplusplus) 89 | } 90 | #endif 91 | 92 | // ---------------------------------------------------------------------------- 93 | 94 | #endif // CORTEXM_EXCEPTION_HANDLERS_H_ 95 | -------------------------------------------------------------------------------- /system/include/diag/Trace.h: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | #ifndef DIAG_TRACE_H_ 7 | #define DIAG_TRACE_H_ 8 | 9 | // ---------------------------------------------------------------------------- 10 | 11 | #include 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | // The trace device is an independent output channel, intended for debug 16 | // purposes. 17 | // 18 | // The API is simple, and mimics the standard output calls: 19 | // - trace_printf() 20 | // - trace_puts() 21 | // - trace_putchar(); 22 | // 23 | // The implementation is done in 24 | // - trace_write() 25 | // 26 | // Trace support is enabled by adding the TRACE definition. 27 | // By default the trace messages are forwarded to the ITM output, 28 | // but can be rerouted via any device or completely suppressed by 29 | // changing the definitions required in system/src/diag/trace_impl.c 30 | // (currently OS_USE_TRACE_ITM, OS_USE_TRACE_SEMIHOSTING_DEBUG/_STDOUT). 31 | // 32 | // When TRACE is not defined, all functions are inlined to empty bodies. 33 | // This has the advantage that the trace call do not need to be conditionally 34 | // compiled with #ifdef TRACE/#endif 35 | 36 | 37 | #if defined(TRACE) 38 | 39 | #if defined(__cplusplus) 40 | extern "C" 41 | { 42 | #endif 43 | 44 | void 45 | trace_initialize(void); 46 | 47 | // Implementation dependent 48 | ssize_t 49 | trace_write(const char* buf, size_t nbyte); 50 | 51 | // ----- Portable ----- 52 | 53 | int 54 | trace_printf(const char* format, ...); 55 | 56 | int 57 | trace_puts(const char *s); 58 | 59 | int 60 | trace_putchar(int c); 61 | 62 | void 63 | trace_dump_args(int argc, char* argv[]); 64 | 65 | #if defined(__cplusplus) 66 | } 67 | #endif 68 | 69 | #else // !defined(TRACE) 70 | 71 | #if defined(__cplusplus) 72 | extern "C" 73 | { 74 | #endif 75 | 76 | inline void 77 | trace_initialize(void); 78 | 79 | // Implementation dependent 80 | inline ssize_t 81 | trace_write(const char* buf, size_t nbyte); 82 | 83 | inline int 84 | trace_printf(const char* format, ...); 85 | 86 | inline int 87 | trace_puts(const char *s); 88 | 89 | inline int 90 | trace_putchar(int c); 91 | 92 | inline void 93 | trace_dump_args(int argc, char* argv[]); 94 | 95 | #if defined(__cplusplus) 96 | } 97 | #endif 98 | 99 | inline void 100 | __attribute__((always_inline)) 101 | trace_initialize(void) 102 | { 103 | } 104 | 105 | // Empty definitions when trace is not defined 106 | inline ssize_t 107 | __attribute__((always_inline)) 108 | trace_write(const char* buf __attribute__((unused)), 109 | size_t nbyte __attribute__((unused))) 110 | { 111 | return 0; 112 | } 113 | 114 | inline int 115 | __attribute__((always_inline)) 116 | trace_printf(const char* format __attribute__((unused)), ...) 117 | { 118 | return 0; 119 | } 120 | 121 | inline int 122 | __attribute__((always_inline)) 123 | trace_puts(const char *s __attribute__((unused))) 124 | { 125 | return 0; 126 | } 127 | 128 | inline int 129 | __attribute__((always_inline)) 130 | trace_putchar(int c) 131 | { 132 | return c; 133 | } 134 | 135 | inline void 136 | __attribute__((always_inline)) 137 | trace_dump_args(int argc __attribute__((unused)), 138 | char* argv[] __attribute__((unused))) 139 | { 140 | } 141 | 142 | #endif // defined(TRACE) 143 | 144 | // ---------------------------------------------------------------------------- 145 | 146 | #endif // DIAG_TRACE_H_ 147 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/README_HAL.md: -------------------------------------------------------------------------------- 1 | The STM files are from the original `stm32cube_fw_f4_v190.zip` 2 | archive, the folder: 3 | 4 | * `STM32Cube_FW_F4_V1.9.0/Drivers/STM32F4xx_HAL_Driver/Inc` 5 | 6 | The changes include only adding pragmas to `stm32f4xx.h` to 7 | prevent compilation warnings. 8 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_crc.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of CRC HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_CRC_H 40 | #define __STM32F4xx_HAL_CRC_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | /* Includes ------------------------------------------------------------------*/ 47 | #include "stm32f4xx_hal_def.h" 48 | 49 | /** @addtogroup STM32F4xx_HAL_Driver 50 | * @{ 51 | */ 52 | 53 | /** @defgroup CRC CRC 54 | * @brief CRC HAL module driver 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /** @defgroup CRC_Exported_Types CRC Exported Types 60 | * @{ 61 | */ 62 | 63 | /** @defgroup CRC_Exported_Types_Group1 CRC State Structure definition 64 | * @{ 65 | */ 66 | typedef enum 67 | { 68 | HAL_CRC_STATE_RESET = 0x00, /*!< CRC not yet initialized or disabled */ 69 | HAL_CRC_STATE_READY = 0x01, /*!< CRC initialized and ready for use */ 70 | HAL_CRC_STATE_BUSY = 0x02, /*!< CRC internal process is ongoing */ 71 | HAL_CRC_STATE_TIMEOUT = 0x03, /*!< CRC timeout state */ 72 | HAL_CRC_STATE_ERROR = 0x04 /*!< CRC error state */ 73 | 74 | }HAL_CRC_StateTypeDef; 75 | /** 76 | * @} 77 | */ 78 | 79 | /** @defgroup CRC_Exported_Types_Group2 CRC Handle Structure definition 80 | * @{ 81 | */ 82 | typedef struct 83 | { 84 | CRC_TypeDef *Instance; /*!< Register base address */ 85 | 86 | HAL_LockTypeDef Lock; /*!< CRC locking object */ 87 | 88 | __IO HAL_CRC_StateTypeDef State; /*!< CRC communication state */ 89 | 90 | }CRC_HandleTypeDef; 91 | /** 92 | * @} 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /* Exported constants --------------------------------------------------------*/ 100 | /* Exported macro ------------------------------------------------------------*/ 101 | /** @defgroup CRC_Exported_Macros CRC Exported Macros 102 | * @{ 103 | */ 104 | 105 | /** @brief Resets CRC handle state 106 | * @param __HANDLE__: CRC handle 107 | * @retval None 108 | */ 109 | #define __HAL_CRC_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_CRC_STATE_RESET) 110 | 111 | /** 112 | * @brief Resets CRC Data Register. 113 | * @param __HANDLE__: CRC handle 114 | * @retval None 115 | */ 116 | #define __HAL_CRC_DR_RESET(__HANDLE__) ((__HANDLE__)->Instance->CR |= CRC_CR_RESET) 117 | 118 | /** 119 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 120 | * @param __HANDLE__: CRC handle 121 | * @param __VALUE__: 8-bit value to be stored in the ID register 122 | * @retval None 123 | */ 124 | #define __HAL_CRC_SET_IDR(__HANDLE__, __VALUE__) (WRITE_REG((__HANDLE__)->Instance->IDR, (__VALUE__))) 125 | 126 | /** 127 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register. 128 | * @param __HANDLE__: CRC handle 129 | * @retval 8-bit value of the ID register 130 | */ 131 | #define __HAL_CRC_GET_IDR(__HANDLE__) (((__HANDLE__)->Instance->IDR) & CRC_IDR_IDR) 132 | /** 133 | * @} 134 | */ 135 | 136 | /* Exported functions --------------------------------------------------------*/ 137 | /** @defgroup CRC_Exported_Functions CRC Exported Functions 138 | * @{ 139 | */ 140 | 141 | /** @defgroup CRC_Exported_Functions_Group1 Initialization and de-initialization functions 142 | * @{ 143 | */ 144 | HAL_StatusTypeDef HAL_CRC_Init(CRC_HandleTypeDef *hcrc); 145 | HAL_StatusTypeDef HAL_CRC_DeInit (CRC_HandleTypeDef *hcrc); 146 | void HAL_CRC_MspInit(CRC_HandleTypeDef *hcrc); 147 | void HAL_CRC_MspDeInit(CRC_HandleTypeDef *hcrc); 148 | /** 149 | * @} 150 | */ 151 | 152 | /** @defgroup CRC_Exported_Functions_Group2 Peripheral Control functions 153 | * @{ 154 | */ 155 | uint32_t HAL_CRC_Accumulate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 156 | uint32_t HAL_CRC_Calculate(CRC_HandleTypeDef *hcrc, uint32_t pBuffer[], uint32_t BufferLength); 157 | /** 158 | * @} 159 | */ 160 | 161 | /** @defgroup CRC_Exported_Functions_Group3 Peripheral State functions 162 | * @{ 163 | */ 164 | HAL_CRC_StateTypeDef HAL_CRC_GetState(CRC_HandleTypeDef *hcrc); 165 | /** 166 | * @} 167 | */ 168 | 169 | /** 170 | * @} 171 | */ 172 | /* Private types -------------------------------------------------------------*/ 173 | /** @defgroup CRC_Private_Types CRC Private Types 174 | * @{ 175 | */ 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /* Private defines -----------------------------------------------------------*/ 182 | /** @defgroup CRC_Private_Defines CRC Private Defines 183 | * @{ 184 | */ 185 | 186 | /** 187 | * @} 188 | */ 189 | 190 | /* Private variables ---------------------------------------------------------*/ 191 | /** @defgroup CRC_Private_Variables CRC Private Variables 192 | * @{ 193 | */ 194 | 195 | /** 196 | * @} 197 | */ 198 | 199 | /* Private constants ---------------------------------------------------------*/ 200 | /** @defgroup CRC_Private_Constants CRC Private Constants 201 | * @{ 202 | */ 203 | 204 | /** 205 | * @} 206 | */ 207 | 208 | /* Private macros ------------------------------------------------------------*/ 209 | /** @defgroup CRC_Private_Macros CRC Private Macros 210 | * @{ 211 | */ 212 | 213 | /** 214 | * @} 215 | */ 216 | 217 | /* Private functions prototypes ----------------------------------------------*/ 218 | /** @defgroup CRC_Private_Functions_Prototypes CRC Private Functions Prototypes 219 | * @{ 220 | */ 221 | 222 | /** 223 | * @} 224 | */ 225 | 226 | /* Private functions ---------------------------------------------------------*/ 227 | /** @defgroup CRC_Private_Functions CRC Private Functions 228 | * @{ 229 | */ 230 | 231 | /** 232 | * @} 233 | */ 234 | 235 | /** 236 | * @} 237 | */ 238 | 239 | /** 240 | * @} 241 | */ 242 | 243 | #ifdef __cplusplus 244 | } 245 | #endif 246 | 247 | #endif /* __STM32F4xx_HAL_CRC_H */ 248 | 249 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 250 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_cryp_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_cryp_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of CRYP HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_CRYP_EX_H 40 | #define __STM32F4xx_HAL_CRYP_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup CRYPEx 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported constants --------------------------------------------------------*/ 60 | 61 | /** @defgroup CRYPEx_Exported_Constants CRYPEx Exported Constants 62 | * @{ 63 | */ 64 | 65 | /** @defgroup CRYPEx_Exported_Constants_Group1 CRYP AlgoModeDirection 66 | * @{ 67 | */ 68 | #define CRYP_CR_ALGOMODE_AES_GCM_ENCRYPT ((uint32_t)0x00080000) 69 | #define CRYP_CR_ALGOMODE_AES_GCM_DECRYPT ((uint32_t)0x00080004) 70 | #define CRYP_CR_ALGOMODE_AES_CCM_ENCRYPT ((uint32_t)0x00080008) 71 | #define CRYP_CR_ALGOMODE_AES_CCM_DECRYPT ((uint32_t)0x0008000C) 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup CRYPEx_Exported_Constants_Group3 CRYP PhaseConfig 78 | * @brief The phases are relevant only to AES-GCM and AES-CCM 79 | * @{ 80 | */ 81 | #define CRYP_PHASE_INIT ((uint32_t)0x00000000) 82 | #define CRYP_PHASE_HEADER CRYP_CR_GCM_CCMPH_0 83 | #define CRYP_PHASE_PAYLOAD CRYP_CR_GCM_CCMPH_1 84 | #define CRYP_PHASE_FINAL CRYP_CR_GCM_CCMPH 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /* Exported macro ------------------------------------------------------------*/ 94 | /** @defgroup CRYPEx_Exported_Macros CRYP Exported Macros 95 | * @{ 96 | */ 97 | 98 | /** 99 | * @brief Set the phase: Init, header, payload, final. 100 | * This is relevant only for GCM and CCM modes. 101 | * @param __HANDLE__: specifies the CRYP handle. 102 | * @param __PHASE__: The phase. 103 | * @retval None 104 | */ 105 | #define __HAL_CRYP_SET_PHASE(__HANDLE__, __PHASE__) do{(__HANDLE__)->Instance->CR &= (uint32_t)(~CRYP_CR_GCM_CCMPH);\ 106 | (__HANDLE__)->Instance->CR |= (uint32_t)(__PHASE__);\ 107 | }while(0) 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /* Exported functions --------------------------------------------------------*/ 114 | /** @defgroup CRYPEx_Exported_Functions CRYPEx Exported Functions 115 | * @{ 116 | */ 117 | 118 | /** @addtogroup CRYPEx_Exported_Functions_Group1 119 | * @{ 120 | */ 121 | 122 | /* AES encryption/decryption using polling ***********************************/ 123 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); 124 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); 125 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Finish(CRYP_HandleTypeDef *hcryp, uint32_t Size, uint8_t *AuthTag, uint32_t Timeout); 126 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData, uint32_t Timeout); 127 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData, uint32_t Timeout); 128 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Finish(CRYP_HandleTypeDef *hcryp, uint8_t *AuthTag, uint32_t Timeout); 129 | 130 | /* AES encryption/decryption using interrupt *********************************/ 131 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 132 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 133 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 134 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_IT(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 135 | 136 | /* AES encryption/decryption using DMA ***************************************/ 137 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 138 | HAL_StatusTypeDef HAL_CRYPEx_AESGCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 139 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Encrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pPlainData, uint16_t Size, uint8_t *pCypherData); 140 | HAL_StatusTypeDef HAL_CRYPEx_AESCCM_Decrypt_DMA(CRYP_HandleTypeDef *hcryp, uint8_t *pCypherData, uint16_t Size, uint8_t *pPlainData); 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | /** @addtogroup CRYPEx_Exported_Functions_Group2 147 | * @{ 148 | */ 149 | 150 | void HAL_CRYPEx_GCMCCM_IRQHandler(CRYP_HandleTypeDef *hcryp); 151 | 152 | /** 153 | * @} 154 | */ 155 | 156 | /** 157 | * @} 158 | */ 159 | 160 | 161 | /* Private types -------------------------------------------------------------*/ 162 | /** @defgroup CRYPEx_Private_Types CRYPEx Private Types 163 | * @{ 164 | */ 165 | 166 | /** 167 | * @} 168 | */ 169 | 170 | /* Private variables ---------------------------------------------------------*/ 171 | /** @defgroup CRYPEx_Private_Variables CRYPEx Private Variables 172 | * @{ 173 | */ 174 | 175 | /** 176 | * @} 177 | */ 178 | 179 | /* Private constants ---------------------------------------------------------*/ 180 | /** @defgroup CRYPEx_Private_Constants CRYPEx Private Constants 181 | * @{ 182 | */ 183 | 184 | /** 185 | * @} 186 | */ 187 | 188 | /* Private macros ------------------------------------------------------------*/ 189 | /** @defgroup CRYPEx_Private_Macros CRYPEx Private Macros 190 | * @{ 191 | */ 192 | 193 | /** 194 | * @} 195 | */ 196 | 197 | /* Private functions ---------------------------------------------------------*/ 198 | /** @defgroup CRYPEx_Private_Functions CRYPEx Private Functions 199 | * @{ 200 | */ 201 | 202 | /** 203 | * @} 204 | */ 205 | 206 | #endif /* STM32F437xx || STM32F439xx || STM32F479xx */ 207 | /** 208 | * @} 209 | */ 210 | 211 | /** 212 | * @} 213 | */ 214 | 215 | #ifdef __cplusplus 216 | } 217 | #endif 218 | 219 | #endif /* __STM32F4xx_HAL_CRYP_EX_H */ 220 | 221 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 222 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_def.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/include/stm32f4-hal/stm32f4xx_hal_def.h -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_dma_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_dma_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of DMA HAL extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

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

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H 40 | #define __STM32F4xx_FLASH_RAMFUNC_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) 46 | 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup FLASHRAMFUNC 55 | * @{ 56 | */ 57 | 58 | /* Exported types ------------------------------------------------------------*/ 59 | /* Exported macro ------------------------------------------------------------*/ 60 | /* Exported functions --------------------------------------------------------*/ 61 | /** @addtogroup FLASHRAMFUNC_Exported_Functions 62 | * @{ 63 | */ 64 | 65 | /** @addtogroup FLASHRAMFUNC_Exported_Functions_Group1 66 | * @{ 67 | */ 68 | __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void); 69 | __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void); 70 | __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void); 71 | __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void); 72 | /** 73 | * @} 74 | */ 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx */ 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | 94 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */ 95 | 96 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 97 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_fmpi2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_fmpi2c_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of FMPI2C HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_FMPI2C_EX_H 40 | #define __STM32F4xx_HAL_FMPI2C_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F446xx) 47 | 48 | /* Includes ------------------------------------------------------------------*/ 49 | #include "stm32f4xx_hal_def.h" 50 | 51 | /** @addtogroup STM32F4xx_HAL_Driver 52 | * @{ 53 | */ 54 | 55 | /** @addtogroup FMPI2CEx 56 | * @{ 57 | */ 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | /** @defgroup FMPI2CEx_Exported_Constants FMPI2C Exported Constants 62 | * @{ 63 | */ 64 | 65 | /** @defgroup FMPI2CEx_Analog_Filter FMPI2C Analog Filter 66 | * @{ 67 | */ 68 | #define FMPI2C_ANALOGFILTER_ENABLE ((uint32_t)0x00000000) 69 | #define FMPI2C_ANALOGFILTER_DISABLE FMPI2C_CR1_ANFOFF 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup FMPI2CEx_FastModePlus FMPI2C Fast Mode Plus 75 | * @{ 76 | */ 77 | #define FMPI2C_FASTMODEPLUS_SCL SYSCFG_CFGR_FMPI2C1_SCL /*!< Enable Fast Mode Plus on FMPI2C1 SCL pins */ 78 | #define FMPI2C_FASTMODEPLUS_SDA SYSCFG_CFGR_FMPI2C1_SDA /*!< Enable Fast Mode Plus on FMPI2C1 SDA pins */ 79 | /** 80 | * @} 81 | */ 82 | 83 | /** 84 | * @} 85 | */ 86 | 87 | /* Exported macro ------------------------------------------------------------*/ 88 | /* Exported functions --------------------------------------------------------*/ 89 | /** @addtogroup FMPI2CEx_Exported_Functions 90 | * @{ 91 | */ 92 | 93 | /** @addtogroup FMPI2CEx_Exported_Functions_Group1 94 | * @{ 95 | */ 96 | /* Peripheral Control functions ************************************************/ 97 | HAL_StatusTypeDef HAL_FMPI2CEx_AnalogFilter_Config(FMPI2C_HandleTypeDef *hFMPI2C, uint32_t AnalogFilter); 98 | HAL_StatusTypeDef HAL_FMPI2CEx_DigitalFilter_Config(FMPI2C_HandleTypeDef *hFMPI2C, uint32_t DigitalFilter); 99 | HAL_StatusTypeDef HAL_FMPI2CEx_EnableWakeUp (FMPI2C_HandleTypeDef *hFMPI2C); 100 | HAL_StatusTypeDef HAL_FMPI2CEx_DisableWakeUp (FMPI2C_HandleTypeDef *hFMPI2C); 101 | void HAL_FMPI2CEx_EnableFastModePlus(uint32_t ConfigFastModePlus); 102 | void HAL_FMPI2CEx_DisableFastModePlus(uint32_t ConfigFastModePlus); 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | /* Private types -------------------------------------------------------------*/ 111 | /* Private variables ---------------------------------------------------------*/ 112 | /* Private constants ---------------------------------------------------------*/ 113 | /** @defgroup I2CEx_Private_Constants I2C Private Constants 114 | * @{ 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /* Private macros ------------------------------------------------------------*/ 122 | /** @defgroup I2CEx_Private_Macros I2C Private Macros 123 | * @{ 124 | */ 125 | #define IS_FMPI2C_ANALOG_FILTER(FILTER) (((FILTER) == FMPI2C_ANALOGFILTER_ENABLE) || \ 126 | ((FILTER) == FMPI2C_ANALOGFILTER_DISABLE)) 127 | 128 | #define IS_FMPI2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000F) 129 | 130 | #define IS_FMPI2C_FASTMODEPLUS(__CONFIG__) ((((__CONFIG__) & (FMPI2C_FASTMODEPLUS_SCL)) == FMPI2C_FASTMODEPLUS_SCL) || \ 131 | (((__CONFIG__) & (FMPI2C_FASTMODEPLUS_SDA)) == FMPI2C_FASTMODEPLUS_SDA)) 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /** 141 | * @} 142 | */ 143 | #endif /* STM32F410xx || STM32F446xx */ 144 | #ifdef __cplusplus 145 | } 146 | #endif 147 | 148 | #endif /* __STM32F4xx_HAL_FMPI2C_EX_H */ 149 | 150 | 151 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 152 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_hash_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_hash_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of HASH HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_HASH_EX_H 40 | #define __STM32F4xx_HAL_HASH_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F437xx) || defined(STM32F439xx) || defined(STM32F479xx) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | 50 | /** @addtogroup STM32F4xx_HAL_Driver 51 | * @{ 52 | */ 53 | 54 | /** @addtogroup HASHEx 55 | * @brief HASHEx HAL Extension module driver 56 | * @{ 57 | */ 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | /* Exported macro ------------------------------------------------------------*/ 62 | /* Exported functions --------------------------------------------------------*/ 63 | 64 | /** @defgroup HASHEx_Exported_Functions HASHEx Exported Functions 65 | * @{ 66 | */ 67 | 68 | /** @defgroup HASHEx_Exported_Functions_Group1 HASHEx processing using polling functions 69 | * @{ 70 | */ 71 | 72 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 73 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 74 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 75 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Accumulate(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup HASHEx_Exported_Functions_Group2 HMAC processing using polling functions 82 | * @{ 83 | */ 84 | 85 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 86 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer, uint32_t Timeout); 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup HASHEx_Exported_Functions_Group3 HASHEx processing using functions 93 | * @{ 94 | */ 95 | 96 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 97 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_IT(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size, uint8_t* pOutBuffer); 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup HASHEx_Exported_Functions_Group4 HASHEx processing using DMA 104 | * @{ 105 | */ 106 | 107 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 108 | HAL_StatusTypeDef HAL_HASHEx_SHA224_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 109 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 110 | HAL_StatusTypeDef HAL_HASHEx_SHA256_Finish(HASH_HandleTypeDef *hhash, uint8_t* pOutBuffer, uint32_t Timeout); 111 | 112 | /** 113 | * @} 114 | */ 115 | 116 | /** @defgroup HASHEx_Exported_Functions_Group5 HMAC processing using DMA 117 | * @{ 118 | */ 119 | 120 | HAL_StatusTypeDef HAL_HMACEx_SHA224_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 121 | HAL_StatusTypeDef HAL_HMACEx_SHA256_Start_DMA(HASH_HandleTypeDef *hhash, uint8_t *pInBuffer, uint32_t Size); 122 | /** 123 | * @} 124 | */ 125 | 126 | /** @defgroup HASHEx_Exported_Functions_Group6 HASHEx processing functions 127 | * @{ 128 | */ 129 | 130 | void HAL_HASHEx_IRQHandler(HASH_HandleTypeDef *hhash); 131 | 132 | /** 133 | * @} 134 | */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /* Private types -------------------------------------------------------------*/ 141 | /** @defgroup HASHEx_Private_Types HASHEx Private Types 142 | * @{ 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | /* Private variables ---------------------------------------------------------*/ 150 | /** @defgroup HASHEx_Private_Variables HASHEx Private Variables 151 | * @{ 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /* Private constants ---------------------------------------------------------*/ 159 | /** @defgroup HASHEx_Private_Constants HASHEx Private Constants 160 | * @{ 161 | */ 162 | 163 | /** 164 | * @} 165 | */ 166 | 167 | /* Private macros ------------------------------------------------------------*/ 168 | /** @defgroup HASHEx_Private_Macros HASHEx Private Macros 169 | * @{ 170 | */ 171 | 172 | /** 173 | * @} 174 | */ 175 | 176 | /* Private functions ---------------------------------------------------------*/ 177 | /** @defgroup HASHEx_Private_Functions HASHEx Private Functions 178 | * @{ 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | #endif /* STM32F437xx || STM32F439xx || STM32F479xx */ 186 | /** 187 | * @} 188 | */ 189 | 190 | /** 191 | * @} 192 | */ 193 | 194 | #ifdef __cplusplus 195 | } 196 | #endif 197 | 198 | #endif /* __STM32F4xx_HAL_HASH_EX_H */ 199 | 200 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 201 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_i2c_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_i2c_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of I2C HAL Extension module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

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

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_LTDC_EX_H 40 | #define __STM32F4xx_HAL_LTDC_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F469xx) || defined(STM32F479xx) 47 | /* Includes ------------------------------------------------------------------*/ 48 | #include "stm32f4xx_hal_def.h" 49 | #include "stm32f4xx_hal_dsi.h" 50 | 51 | /** @addtogroup STM32F4xx_HAL_Driver 52 | * @{ 53 | */ 54 | 55 | /** @addtogroup LTDCEx 56 | * @{ 57 | */ 58 | 59 | /* Exported types ------------------------------------------------------------*/ 60 | /* Exported constants --------------------------------------------------------*/ 61 | 62 | /** @defgroup LTDCEx_Exported_Constants LTDCEx Exported Constants 63 | * @{ 64 | */ 65 | 66 | /** 67 | * @} 68 | */ 69 | 70 | /* Exported macro ------------------------------------------------------------*/ 71 | /** @defgroup LTDCEx_Exported_Macros LTDC Exported Macros 72 | * @{ 73 | */ 74 | 75 | /** 76 | * @} 77 | */ 78 | 79 | /* Exported functions --------------------------------------------------------*/ 80 | /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions 81 | * @{ 82 | */ 83 | HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg); 84 | HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg); 85 | /** 86 | * @} 87 | */ 88 | 89 | 90 | /* Private types -------------------------------------------------------------*/ 91 | /** @defgroup LTDCEx_Private_Types LTDCEx Private Types 92 | * @{ 93 | */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /* Private variables ---------------------------------------------------------*/ 100 | /** @defgroup LTDCEx_Private_Variables LTDCEx Private Variables 101 | * @{ 102 | */ 103 | 104 | /** 105 | * @} 106 | */ 107 | 108 | /* Private constants ---------------------------------------------------------*/ 109 | /** @defgroup LTDCEx_Private_Constants LTDCEx Private Constants 110 | * @{ 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /* Private macros ------------------------------------------------------------*/ 118 | /** @defgroup LTDCEx_Private_Macros LTDCEx Private Macros 119 | * @{ 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /* Private functions ---------------------------------------------------------*/ 127 | /** @defgroup LTDCEx_Private_Functions LTDCEx Private Functions 128 | * @{ 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | #endif /* STM32F469xx || STM32F479xx */ 144 | 145 | #ifdef __cplusplus 146 | } 147 | #endif 148 | 149 | #endif /* __STM32F4xx_HAL_LTDC_EX_H */ 150 | 151 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 152 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_pcd_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_pcd_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of PCD HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_PCD_EX_H 40 | #define __STM32F4xx_HAL_PCD_EX_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ 46 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ 47 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ 48 | defined(STM32F469xx) || defined(STM32F479xx) 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32f4xx_hal_def.h" 51 | 52 | /** @addtogroup STM32F4xx_HAL_Driver 53 | * @{ 54 | */ 55 | 56 | /** @addtogroup PCDEx 57 | * @{ 58 | */ 59 | /* Exported types ------------------------------------------------------------*/ 60 | #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 61 | typedef enum 62 | { 63 | PCD_LPM_L0_ACTIVE = 0x00, /* on */ 64 | PCD_LPM_L1_ACTIVE = 0x01, /* LPM L1 sleep */ 65 | }PCD_LPM_MsgTypeDef; 66 | #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ 67 | 68 | /* Exported constants --------------------------------------------------------*/ 69 | /* Exported macros -----------------------------------------------------------*/ 70 | /* Exported functions --------------------------------------------------------*/ 71 | /** @addtogroup PCDEx_Exported_Functions PCD Extended Exported Functions 72 | * @{ 73 | */ 74 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 75 | * @{ 76 | */ 77 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size); 78 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size); 79 | #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 80 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd); 81 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd); 82 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg); 83 | #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || 101 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ 102 | #ifdef __cplusplus 103 | } 104 | #endif 105 | 106 | 107 | #endif /* __STM32F4xx_HAL_PCD_EX_H */ 108 | 109 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 110 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_sai_ex.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_sai_ex.h 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief Header file of SAI Extension HAL module. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT(c) 2015 STMicroelectronics

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

© COPYRIGHT(c) 2015 STMicroelectronics

12 | * 13 | * Redistribution and use in source and binary forms, with or without modification, 14 | * are permitted provided that the following conditions are met: 15 | * 1. Redistributions of source code must retain the above copyright notice, 16 | * this list of conditions and the following disclaimer. 17 | * 2. Redistributions in binary form must reproduce the above copyright notice, 18 | * this list of conditions and the following disclaimer in the documentation 19 | * and/or other materials provided with the distribution. 20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 21 | * may be used to endorse or promote products derived from this software 22 | * without specific prior written permission. 23 | * 24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 34 | * 35 | ****************************************************************************** 36 | */ 37 | 38 | /* Define to prevent recursive inclusion -------------------------------------*/ 39 | #ifndef __STM32F4xx_HAL_SDRAM_H 40 | #define __STM32F4xx_HAL_SDRAM_H 41 | 42 | #ifdef __cplusplus 43 | extern "C" { 44 | #endif 45 | 46 | #if defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) ||\ 47 | defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 48 | 49 | /* Includes ------------------------------------------------------------------*/ 50 | #include "stm32f4xx_ll_fmc.h" 51 | 52 | /** @addtogroup STM32F4xx_HAL_Driver 53 | * @{ 54 | */ 55 | 56 | /** @addtogroup SDRAM 57 | * @{ 58 | */ 59 | 60 | /* Exported typedef ----------------------------------------------------------*/ 61 | /** @defgroup SDRAM_Exported_Types SDRAM Exported Types 62 | * @{ 63 | */ 64 | 65 | /** 66 | * @brief HAL SDRAM State structure definition 67 | */ 68 | typedef enum 69 | { 70 | HAL_SDRAM_STATE_RESET = 0x00, /*!< SDRAM not yet initialized or disabled */ 71 | HAL_SDRAM_STATE_READY = 0x01, /*!< SDRAM initialized and ready for use */ 72 | HAL_SDRAM_STATE_BUSY = 0x02, /*!< SDRAM internal process is ongoing */ 73 | HAL_SDRAM_STATE_ERROR = 0x03, /*!< SDRAM error state */ 74 | HAL_SDRAM_STATE_WRITE_PROTECTED = 0x04, /*!< SDRAM device write protected */ 75 | HAL_SDRAM_STATE_PRECHARGED = 0x05 /*!< SDRAM device precharged */ 76 | 77 | }HAL_SDRAM_StateTypeDef; 78 | 79 | /** 80 | * @brief SDRAM handle Structure definition 81 | */ 82 | typedef struct 83 | { 84 | FMC_SDRAM_TypeDef *Instance; /*!< Register base address */ 85 | 86 | FMC_SDRAM_InitTypeDef Init; /*!< SDRAM device configuration parameters */ 87 | 88 | __IO HAL_SDRAM_StateTypeDef State; /*!< SDRAM access state */ 89 | 90 | HAL_LockTypeDef Lock; /*!< SDRAM locking object */ 91 | 92 | DMA_HandleTypeDef *hdma; /*!< Pointer DMA handler */ 93 | 94 | }SDRAM_HandleTypeDef; 95 | /** 96 | * @} 97 | */ 98 | 99 | /* Exported constants --------------------------------------------------------*/ 100 | /* Exported macro ------------------------------------------------------------*/ 101 | /** @defgroup SDRAM_Exported_Macros SDRAM Exported Macros 102 | * @{ 103 | */ 104 | 105 | /** @brief Reset SDRAM handle state 106 | * @param __HANDLE__: specifies the SDRAM handle. 107 | * @retval None 108 | */ 109 | #define __HAL_SDRAM_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = HAL_SDRAM_STATE_RESET) 110 | /** 111 | * @} 112 | */ 113 | 114 | /* Exported functions --------------------------------------------------------*/ 115 | /** @addtogroup SDRAM_Exported_Functions SDRAM Exported Functions 116 | * @{ 117 | */ 118 | 119 | /** @addtogroup SDRAM_Exported_Functions_Group1 120 | * @{ 121 | */ 122 | 123 | /* Initialization/de-initialization functions *********************************/ 124 | HAL_StatusTypeDef HAL_SDRAM_Init(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_TimingTypeDef *Timing); 125 | HAL_StatusTypeDef HAL_SDRAM_DeInit(SDRAM_HandleTypeDef *hsdram); 126 | void HAL_SDRAM_MspInit(SDRAM_HandleTypeDef *hsdram); 127 | void HAL_SDRAM_MspDeInit(SDRAM_HandleTypeDef *hsdram); 128 | 129 | void HAL_SDRAM_IRQHandler(SDRAM_HandleTypeDef *hsdram); 130 | void HAL_SDRAM_RefreshErrorCallback(SDRAM_HandleTypeDef *hsdram); 131 | void HAL_SDRAM_DMA_XferCpltCallback(DMA_HandleTypeDef *hdma); 132 | void HAL_SDRAM_DMA_XferErrorCallback(DMA_HandleTypeDef *hdma); 133 | /** 134 | * @} 135 | */ 136 | 137 | /** @addtogroup SDRAM_Exported_Functions_Group2 138 | * @{ 139 | */ 140 | /* I/O operation functions ****************************************************/ 141 | HAL_StatusTypeDef HAL_SDRAM_Read_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pDstBuffer, uint32_t BufferSize); 142 | HAL_StatusTypeDef HAL_SDRAM_Write_8b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint8_t *pSrcBuffer, uint32_t BufferSize); 143 | HAL_StatusTypeDef HAL_SDRAM_Read_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pDstBuffer, uint32_t BufferSize); 144 | HAL_StatusTypeDef HAL_SDRAM_Write_16b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint16_t *pSrcBuffer, uint32_t BufferSize); 145 | HAL_StatusTypeDef HAL_SDRAM_Read_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 146 | HAL_StatusTypeDef HAL_SDRAM_Write_32b(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 147 | 148 | HAL_StatusTypeDef HAL_SDRAM_Read_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t * pAddress, uint32_t *pDstBuffer, uint32_t BufferSize); 149 | HAL_StatusTypeDef HAL_SDRAM_Write_DMA(SDRAM_HandleTypeDef *hsdram, uint32_t *pAddress, uint32_t *pSrcBuffer, uint32_t BufferSize); 150 | /** 151 | * @} 152 | */ 153 | 154 | /** @addtogroup SDRAM_Exported_Functions_Group3 155 | * @{ 156 | */ 157 | /* SDRAM Control functions *****************************************************/ 158 | HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Enable(SDRAM_HandleTypeDef *hsdram); 159 | HAL_StatusTypeDef HAL_SDRAM_WriteProtection_Disable(SDRAM_HandleTypeDef *hsdram); 160 | HAL_StatusTypeDef HAL_SDRAM_SendCommand(SDRAM_HandleTypeDef *hsdram, FMC_SDRAM_CommandTypeDef *Command, uint32_t Timeout); 161 | HAL_StatusTypeDef HAL_SDRAM_ProgramRefreshRate(SDRAM_HandleTypeDef *hsdram, uint32_t RefreshRate); 162 | HAL_StatusTypeDef HAL_SDRAM_SetAutoRefreshNumber(SDRAM_HandleTypeDef *hsdram, uint32_t AutoRefreshNumber); 163 | uint32_t HAL_SDRAM_GetModeStatus(SDRAM_HandleTypeDef *hsdram); 164 | /** 165 | * @} 166 | */ 167 | 168 | /** @addtogroup SDRAM_Exported_Functions_Group4 169 | * @{ 170 | */ 171 | /* SDRAM State functions ********************************************************/ 172 | HAL_SDRAM_StateTypeDef HAL_SDRAM_GetState(SDRAM_HandleTypeDef *hsdram); 173 | /** 174 | * @} 175 | */ 176 | 177 | /** 178 | * @} 179 | */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | #endif /* STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || STM32F446xx || STM32F469xx || STM32F479xx */ 186 | 187 | /** 188 | * @} 189 | */ 190 | 191 | #ifdef __cplusplus 192 | } 193 | #endif 194 | 195 | #endif /* __STM32F4xx_HAL_SDRAM_H */ 196 | 197 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 198 | -------------------------------------------------------------------------------- /system/include/stm32f4-hal/stm32f4xx_hal_tim.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/include/stm32f4-hal/stm32f4xx_hal_tim.h -------------------------------------------------------------------------------- /system/src/cmsis/README_DEVICE_CMSIS.md: -------------------------------------------------------------------------------- 1 | The STM files are from the original `stm32cube_fw_f4_v190.zip` 2 | archive, the folder: 3 | 4 | * `STM32Cube_FW_F4_V1.9.0/Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates` 5 | 6 | There should be no changes from the STM originals. 7 | 8 | The `vectors_*.c` files were created using the ARM assembly files. 9 | -------------------------------------------------------------------------------- /system/src/cmsis/arm_abs_f32.c: -------------------------------------------------------------------------------- 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_abs_f32.c 9 | * 10 | * Description: Vector absolute value. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 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 | #include "arm_math.h" 42 | #include 43 | 44 | /** 45 | * @ingroup groupMath 46 | */ 47 | 48 | /** 49 | * @defgroup BasicAbs Vector Absolute Value 50 | * 51 | * Computes the absolute value of a vector on an element-by-element basis. 52 | * 53 | *
        
 54 |  *     pDst[n] = abs(pSrc[n]),   0 <= n < blockSize.        
 55 |  * 
56 | * 57 | * The functions support in-place computation allowing the source and 58 | * destination pointers to reference the same memory buffer. 59 | * There are separate functions for floating-point, Q7, Q15, and Q31 data types. 60 | */ 61 | 62 | /** 63 | * @addtogroup BasicAbs 64 | * @{ 65 | */ 66 | 67 | /** 68 | * @brief Floating-point vector absolute value. 69 | * @param[in] *pSrc points to the input buffer 70 | * @param[out] *pDst points to the output buffer 71 | * @param[in] blockSize number of samples in each vector 72 | * @return none. 73 | */ 74 | 75 | void arm_abs_f32( 76 | float32_t * pSrc, 77 | float32_t * pDst, 78 | uint32_t blockSize) 79 | { 80 | uint32_t blkCnt; /* loop counter */ 81 | 82 | #ifndef ARM_MATH_CM0_FAMILY 83 | 84 | /* Run the below code for Cortex-M4 and Cortex-M3 */ 85 | float32_t in1, in2, in3, in4; /* temporary variables */ 86 | 87 | /*loop Unrolling */ 88 | blkCnt = blockSize >> 2u; 89 | 90 | /* First part of the processing with loop unrolling. Compute 4 outputs at a time. 91 | ** a second loop below computes the remaining 1 to 3 samples. */ 92 | while(blkCnt > 0u) 93 | { 94 | /* C = |A| */ 95 | /* Calculate absolute and then store the results in the destination buffer. */ 96 | /* read sample from source */ 97 | in1 = *pSrc; 98 | in2 = *(pSrc + 1); 99 | in3 = *(pSrc + 2); 100 | 101 | /* find absolute value */ 102 | in1 = fabsf(in1); 103 | 104 | /* read sample from source */ 105 | in4 = *(pSrc + 3); 106 | 107 | /* find absolute value */ 108 | in2 = fabsf(in2); 109 | 110 | /* read sample from source */ 111 | *pDst = in1; 112 | 113 | /* find absolute value */ 114 | in3 = fabsf(in3); 115 | 116 | /* find absolute value */ 117 | in4 = fabsf(in4); 118 | 119 | /* store result to destination */ 120 | *(pDst + 1) = in2; 121 | 122 | /* store result to destination */ 123 | *(pDst + 2) = in3; 124 | 125 | /* store result to destination */ 126 | *(pDst + 3) = in4; 127 | 128 | 129 | /* Update source pointer to process next sampels */ 130 | pSrc += 4u; 131 | 132 | /* Update destination pointer to process next sampels */ 133 | pDst += 4u; 134 | 135 | /* Decrement the loop counter */ 136 | blkCnt--; 137 | } 138 | 139 | /* If the blockSize is not a multiple of 4, compute any remaining output samples here. 140 | ** No loop unrolling is used. */ 141 | blkCnt = blockSize % 0x4u; 142 | 143 | #else 144 | 145 | /* Run the below code for Cortex-M0 */ 146 | 147 | /* Initialize blkCnt with number of samples */ 148 | blkCnt = blockSize; 149 | 150 | #endif /* #ifndef ARM_MATH_CM0_FAMILY */ 151 | 152 | while(blkCnt > 0u) 153 | { 154 | /* C = |A| */ 155 | /* Calculate absolute and then store the results in the destination buffer. */ 156 | *pDst++ = fabsf(*pSrc++); 157 | 158 | /* Decrement the loop counter */ 159 | blkCnt--; 160 | } 161 | } 162 | 163 | /** 164 | * @} end of BasicAbs group 165 | */ 166 | -------------------------------------------------------------------------------- /system/src/cmsis/arm_cos_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 21. September 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_cos_f32.c 9 | * 10 | * Description: Fast cosine calculation for floating-point values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 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 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | /** 44 | * @ingroup groupFastMath 45 | */ 46 | 47 | /** 48 | * @defgroup cos Cosine 49 | * 50 | * Computes the trigonometric cosine function using a combination of table lookup 51 | * and linear interpolation. There are separate functions for 52 | * Q15, Q31, and floating-point data types. 53 | * The input to the floating-point version is in radians while the 54 | * fixed-point Q15 and Q31 have a scaled input with the range 55 | * [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a 56 | * value of 2*pi wraps around to 0. 57 | * 58 | * The implementation is based on table lookup using 256 values together with linear interpolation. 59 | * The steps used are: 60 | * -# Calculation of the nearest integer table index 61 | * -# Compute the fractional portion (fract) of the table index. 62 | * -# The final result equals (1.0f-fract)*a + fract*b; 63 | * 64 | * where 65 | *
 66 |  *    b=Table[index+0];
 67 |  *    c=Table[index+1];
 68 |  * 
69 | */ 70 | 71 | /** 72 | * @addtogroup cos 73 | * @{ 74 | */ 75 | 76 | /** 77 | * @brief Fast approximation to the trigonometric cosine function for floating-point data. 78 | * @param[in] x input value in radians. 79 | * @return cos(x). 80 | */ 81 | 82 | float32_t arm_cos_f32( 83 | float32_t x) 84 | { 85 | float32_t cosVal, fract, in; /* Temporary variables for input, output */ 86 | uint16_t index; /* Index variable */ 87 | float32_t a, b; /* Two nearest output values */ 88 | int32_t n; 89 | float32_t findex; 90 | 91 | /* input x is in radians */ 92 | /* Scale the input to [0 1] range from [0 2*PI] , divide input by 2*pi, add 0.25 (pi/2) to read sine table */ 93 | in = x * 0.159154943092f + 0.25f; 94 | 95 | /* Calculation of floor value of input */ 96 | n = (int32_t) in; 97 | 98 | /* Make negative values towards -infinity */ 99 | if(in < 0.0f) 100 | { 101 | n--; 102 | } 103 | 104 | /* Map input value to [0 1] */ 105 | in = in - (float32_t) n; 106 | 107 | /* Calculation of index of the table */ 108 | findex = (float32_t) FAST_MATH_TABLE_SIZE * in; 109 | index = ((uint16_t)findex) & 0x1ff; 110 | 111 | /* fractional value calculation */ 112 | fract = findex - (float32_t) index; 113 | 114 | /* Read two nearest values of input value from the cos table */ 115 | a = sinTable_f32[index]; 116 | b = sinTable_f32[index+1]; 117 | 118 | /* Linear interpolation process */ 119 | cosVal = (1.0f-fract)*a + fract*b; 120 | 121 | /* Return the output value */ 122 | return (cosVal); 123 | } 124 | 125 | /** 126 | * @} end of cos group 127 | */ 128 | -------------------------------------------------------------------------------- /system/src/cmsis/arm_sin_f32.c: -------------------------------------------------------------------------------- 1 | /* ---------------------------------------------------------------------- 2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved. 3 | * 4 | * $Date: 21. September 2015 5 | * $Revision: V.1.4.5 a 6 | * 7 | * Project: CMSIS DSP Library 8 | * Title: arm_sin_f32.c 9 | * 10 | * Description: Fast sine calculation for floating-point values. 11 | * 12 | * Target Processor: Cortex-M4/Cortex-M3/Cortex-M0 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 | #include "arm_math.h" 42 | #include "arm_common_tables.h" 43 | #include 44 | 45 | /** 46 | * @ingroup groupFastMath 47 | */ 48 | 49 | /** 50 | * @defgroup sin Sine 51 | * 52 | * Computes the trigonometric sine function using a combination of table lookup 53 | * and linear interpolation. There are separate functions for 54 | * Q15, Q31, and floating-point data types. 55 | * The input to the floating-point version is in radians while the 56 | * fixed-point Q15 and Q31 have a scaled input with the range 57 | * [0 +0.9999] mapping to [0 2*pi). The fixed-point range is chosen so that a 58 | * value of 2*pi wraps around to 0. 59 | * 60 | * The implementation is based on table lookup using 256 values together with linear interpolation. 61 | * The steps used are: 62 | * -# Calculation of the nearest integer table index 63 | * -# Compute the fractional portion (fract) of the table index. 64 | * -# The final result equals (1.0f-fract)*a + fract*b; 65 | * 66 | * where 67 | *
 68 |  *    b=Table[index+0];
 69 |  *    c=Table[index+1];
 70 |  * 
71 | */ 72 | 73 | /** 74 | * @addtogroup sin 75 | * @{ 76 | */ 77 | 78 | /** 79 | * @brief Fast approximation to the trigonometric sine function for floating-point data. 80 | * @param[in] x input value in radians. 81 | * @return sin(x). 82 | */ 83 | 84 | float32_t arm_sin_f32( 85 | float32_t x) 86 | { 87 | float32_t sinVal, fract, in; /* Temporary variables for input, output */ 88 | uint16_t index; /* Index variable */ 89 | float32_t a, b; /* Two nearest output values */ 90 | int32_t n; 91 | float32_t findex; 92 | 93 | /* input x is in radians */ 94 | /* Scale the input to [0 1] range from [0 2*PI] , divide input by 2*pi */ 95 | in = x * 0.159154943092f; 96 | 97 | /* Calculation of floor value of input */ 98 | n = (int32_t) in; 99 | 100 | /* Make negative values towards -infinity */ 101 | if(x < 0.0f) 102 | { 103 | n--; 104 | } 105 | 106 | /* Map input value to [0 1] */ 107 | in = in - (float32_t) n; 108 | 109 | /* Calculation of index of the table */ 110 | findex = (float32_t) FAST_MATH_TABLE_SIZE * in; 111 | if (findex >= 512.0f) { 112 | findex -= 512.0f; 113 | } 114 | 115 | index = ((uint16_t)findex) & 0x1ff; 116 | 117 | /* fractional value calculation */ 118 | fract = findex - (float32_t) index; 119 | 120 | /* Read two nearest values of input value from the sin table */ 121 | a = sinTable_f32[index]; 122 | b = sinTable_f32[index+1]; 123 | 124 | /* Linear interpolation process */ 125 | sinVal = (1.0f-fract)*a + fract*b; 126 | 127 | /* Return the output value */ 128 | return (sinVal); 129 | } 130 | 131 | /** 132 | * @} end of sin group 133 | */ 134 | -------------------------------------------------------------------------------- /system/src/cortexm/_initialize_hardware.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #include "cmsis_device.h" 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | extern unsigned int __vectors_start; 13 | 14 | // Forward declarations. 15 | 16 | void 17 | __initialize_hardware_early(void); 18 | 19 | void 20 | __initialize_hardware(void); 21 | 22 | // ---------------------------------------------------------------------------- 23 | 24 | // This is the early hardware initialisation routine, it can be 25 | // redefined in the application for more complex cases that 26 | // require early inits (before BSS init). 27 | // 28 | // Called early from _start(), right before data & bss init. 29 | // 30 | // After Reset the Cortex-M processor is in Thread mode, 31 | // priority is Privileged, and the Stack is set to Main. 32 | 33 | void 34 | __attribute__((weak)) 35 | __initialize_hardware_early(void) 36 | { 37 | // Call the CSMSIS system initialisation routine. 38 | SystemInit(); 39 | 40 | #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 41 | // Set VTOR to the actual address, provided by the linker script. 42 | // Override the manual, possibly wrong, SystemInit() setting. 43 | SCB->VTOR = (uint32_t)(&__vectors_start); 44 | #endif 45 | 46 | // The current version of SystemInit() leaves the value of the clock 47 | // in a RAM variable (SystemCoreClock), which will be cleared shortly, 48 | // so it needs to be recomputed after the RAM initialisations 49 | // are completed. 50 | 51 | #if defined(OS_INCLUDE_STARTUP_INIT_FP) || (defined (__VFP_FP__) && !defined (__SOFTFP__)) 52 | 53 | // Normally FP init is done by SystemInit(). In case this is not done 54 | // there, it is possible to force its inclusion by defining 55 | // OS_INCLUDE_STARTUP_INIT_FP. 56 | 57 | // Enable the Cortex-M4 FPU only when -mfloat-abi=hard. 58 | // Code taken from Section 7.1, Cortex-M4 TRM (DDI0439C) 59 | 60 | // Set bits 20-23 to enable CP10 and CP11 coprocessor 61 | SCB->CPACR |= (0xF << 20); 62 | 63 | #endif // (__VFP_FP__) && !(__SOFTFP__) 64 | 65 | #if defined(OS_DEBUG_SEMIHOSTING_FAULTS) 66 | SCB->SHCSR |= SCB_SHCSR_USGFAULTENA_Msk; 67 | #endif 68 | } 69 | 70 | // This is the second hardware initialisation routine, it can be 71 | // redefined in the application for more complex cases that 72 | // require custom inits (before constructors), otherwise these can 73 | // be done in main(). 74 | // 75 | // Called from _start(), right after data & bss init, before 76 | // constructors. 77 | 78 | void 79 | __attribute__((weak)) 80 | __initialize_hardware(void) 81 | { 82 | // Call the CSMSIS system clock routine to store the clock frequency 83 | // in the SystemCoreClock global RAM location. 84 | SystemCoreClockUpdate(); 85 | } 86 | 87 | // ---------------------------------------------------------------------------- 88 | -------------------------------------------------------------------------------- /system/src/cortexm/_reset_hardware.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #include "cmsis_device.h" 9 | 10 | // ---------------------------------------------------------------------------- 11 | 12 | extern void 13 | __attribute__((noreturn)) 14 | NVIC_SystemReset(void); 15 | 16 | // ---------------------------------------------------------------------------- 17 | 18 | // Forward declarations 19 | 20 | void 21 | __reset_hardware(void); 22 | 23 | // ---------------------------------------------------------------------------- 24 | 25 | // This is the default hardware reset routine; it can be 26 | // redefined in the application for more complex applications. 27 | // 28 | // Called from _exit(). 29 | 30 | void 31 | __attribute__((weak,noreturn)) 32 | __reset_hardware() 33 | { 34 | NVIC_SystemReset(); 35 | } 36 | 37 | // ---------------------------------------------------------------------------- 38 | -------------------------------------------------------------------------------- /system/src/diag/Trace.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #if defined(TRACE) 9 | 10 | #include 11 | #include 12 | #include "diag/Trace.h" 13 | #include "string.h" 14 | 15 | #ifndef OS_INTEGER_TRACE_PRINTF_TMP_ARRAY_SIZE 16 | #define OS_INTEGER_TRACE_PRINTF_TMP_ARRAY_SIZE (128) 17 | #endif 18 | 19 | // ---------------------------------------------------------------------------- 20 | 21 | int 22 | trace_printf(const char* format, ...) 23 | { 24 | int ret; 25 | va_list ap; 26 | 27 | va_start (ap, format); 28 | 29 | // TODO: rewrite it to no longer use newlib, it is way too heavy 30 | 31 | static char buf[OS_INTEGER_TRACE_PRINTF_TMP_ARRAY_SIZE]; 32 | 33 | // Print to the local buffer 34 | ret = vsnprintf (buf, sizeof(buf), format, ap); 35 | if (ret > 0) 36 | { 37 | // Transfer the buffer to the device 38 | ret = trace_write (buf, (size_t)ret); 39 | } 40 | 41 | va_end (ap); 42 | return ret; 43 | } 44 | 45 | int 46 | trace_puts(const char *s) 47 | { 48 | trace_write(s, strlen(s)); 49 | return trace_write("\n", 1); 50 | } 51 | 52 | int 53 | trace_putchar(int c) 54 | { 55 | trace_write((const char*)&c, 1); 56 | return c; 57 | } 58 | 59 | void 60 | trace_dump_args(int argc, char* argv[]) 61 | { 62 | trace_printf("main(argc=%d, argv=[", argc); 63 | for (int i = 0; i < argc; ++i) 64 | { 65 | if (i != 0) 66 | { 67 | trace_printf(", "); 68 | } 69 | trace_printf("\"%s\"", argv[i]); 70 | } 71 | trace_printf("]);\n"); 72 | } 73 | 74 | // ---------------------------------------------------------------------------- 75 | 76 | #endif // TRACE 77 | -------------------------------------------------------------------------------- /system/src/diag/trace_impl.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #if defined(TRACE) 9 | 10 | #include "cmsis_device.h" 11 | #include "diag/Trace.h" 12 | 13 | // ---------------------------------------------------------------------------- 14 | 15 | // One of these definitions must be passed via the compiler command line 16 | // Note: small Cortex-M0/M0+ might implement a simplified debug interface. 17 | 18 | //#define OS_USE_TRACE_ITM 19 | //#define OS_USE_TRACE_SEMIHOSTING_DEBUG 20 | //#define OS_USE_TRACE_SEMIHOSTING_STDOUT 21 | 22 | #if !(defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)) 23 | #if defined(OS_USE_TRACE_ITM) 24 | #undef OS_USE_TRACE_ITM 25 | #warning "ITM unavailable" 26 | #endif // defined(OS_USE_TRACE_ITM) 27 | #endif // !(defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__)) 28 | 29 | #if defined(OS_DEBUG_SEMIHOSTING_FAULTS) 30 | #if defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) || defined(OS_USE_TRACE_SEMIHOSTING_DEBUG) 31 | #error "Cannot debug semihosting using semihosting trace; use OS_USE_TRACE_ITM" 32 | #endif 33 | #endif 34 | 35 | // ---------------------------------------------------------------------------- 36 | 37 | // Forward definitions. 38 | 39 | #if defined(OS_USE_TRACE_ITM) 40 | static ssize_t 41 | _trace_write_itm (const char* buf, size_t nbyte); 42 | #endif 43 | 44 | #if defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) 45 | static ssize_t 46 | _trace_write_semihosting_stdout(const char* buf, size_t nbyte); 47 | #endif 48 | 49 | #if defined(OS_USE_TRACE_SEMIHOSTING_DEBUG) 50 | static ssize_t 51 | _trace_write_semihosting_debug(const char* buf, size_t nbyte); 52 | #endif 53 | 54 | // ---------------------------------------------------------------------------- 55 | 56 | void 57 | trace_initialize(void) 58 | { 59 | // For regular ITM / semihosting, no inits required. 60 | } 61 | 62 | // ---------------------------------------------------------------------------- 63 | 64 | // This function is called from _write() for fd==1 or fd==2 and from some 65 | // of the trace_* functions. 66 | 67 | ssize_t 68 | trace_write (const char* buf __attribute__((unused)), 69 | size_t nbyte __attribute__((unused))) 70 | { 71 | #if defined(OS_USE_TRACE_ITM) 72 | return _trace_write_itm (buf, nbyte); 73 | #elif defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) 74 | return _trace_write_semihosting_stdout(buf, nbyte); 75 | #elif defined(OS_USE_TRACE_SEMIHOSTING_DEBUG) 76 | return _trace_write_semihosting_debug(buf, nbyte); 77 | #endif 78 | 79 | return -1; 80 | } 81 | 82 | // ---------------------------------------------------------------------------- 83 | 84 | #if defined(OS_USE_TRACE_ITM) 85 | 86 | #if defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 87 | 88 | // ITM is the ARM standard mechanism, running over SWD/SWO on Cortex-M3/M4 89 | // devices, and is the recommended setting, if available. 90 | // 91 | // The JLink probe and the GDB server fully support SWD/SWO 92 | // and the JLink Debugging plug-in enables it by default. 93 | // The current OpenOCD does not include support to parse the SWO stream, 94 | // so this configuration will not work on OpenOCD (will not crash, but 95 | // nothing will be displayed in the output console). 96 | 97 | #if !defined(OS_INTEGER_TRACE_ITM_STIMULUS_PORT) 98 | #define OS_INTEGER_TRACE_ITM_STIMULUS_PORT (0) 99 | #endif 100 | 101 | static ssize_t 102 | _trace_write_itm (const char* buf, size_t nbyte) 103 | { 104 | for (size_t i = 0; i < nbyte; i++) 105 | { 106 | // Check if ITM or the stimulus port are not enabled 107 | if (((ITM->TCR & ITM_TCR_ITMENA_Msk) == 0) 108 | || ((ITM->TER & (1UL << OS_INTEGER_TRACE_ITM_STIMULUS_PORT)) == 0)) 109 | { 110 | return (ssize_t)i; // return the number of sent characters (may be 0) 111 | } 112 | 113 | // Wait until STIMx is ready... 114 | while (ITM->PORT[OS_INTEGER_TRACE_ITM_STIMULUS_PORT].u32 == 0) 115 | ; 116 | // then send data, one byte at a time 117 | ITM->PORT[OS_INTEGER_TRACE_ITM_STIMULUS_PORT].u8 = (uint8_t) (*buf++); 118 | } 119 | 120 | return (ssize_t)nbyte; // all characters successfully sent 121 | } 122 | 123 | #endif // defined(__ARM_ARCH_7M__) || defined(__ARM_ARCH_7EM__) 124 | 125 | #endif // OS_USE_TRACE_ITM 126 | 127 | // ---------------------------------------------------------------------------- 128 | 129 | #if defined(OS_USE_TRACE_SEMIHOSTING_DEBUG) || defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) 130 | 131 | #include "arm/semihosting.h" 132 | 133 | // Semihosting is the other output channel that can be used for the trace 134 | // messages. It comes in two flavours: STDOUT and DEBUG. The STDOUT channel 135 | // is the equivalent of the stdout in POSIX and in most cases it is forwarded 136 | // to the GDB server stdout stream. The debug channel is a separate 137 | // channel. STDOUT is buffered, so nothing is displayed until a \n; 138 | // DEBUG is not buffered, but can be slow. 139 | // 140 | // Choosing between semihosting stdout and debug depends on the capabilities 141 | // of your GDB server, and also on specific needs. It is recommended to test 142 | // DEBUG first, and if too slow, try STDOUT. 143 | // 144 | // The JLink GDB server fully support semihosting, and both configurations 145 | // are available; to activate it, use "monitor semihosting enable" or check 146 | // the corresponding button in the JLink Debugging plug-in. 147 | // In OpenOCD, support for semihosting can be enabled using 148 | // "monitor arm semihosting enable". 149 | // 150 | // Note: Applications built with semihosting output active normally cannot 151 | // be executed without the debugger connected and active, since they use 152 | // BKPT to communicate with the host. However, with a carefully written 153 | // HardFault_Handler, the semihosting BKPT calls can be processed, making 154 | // possible to run semihosting applications as standalone, without being 155 | // terminated with hardware faults. 156 | 157 | #endif // OS_USE_TRACE_SEMIHOSTING_DEBUG_* 158 | 159 | // ---------------------------------------------------------------------------- 160 | 161 | #if defined(OS_USE_TRACE_SEMIHOSTING_STDOUT) 162 | 163 | static ssize_t 164 | _trace_write_semihosting_stdout (const char* buf, size_t nbyte) 165 | { 166 | static int handle; 167 | void* block[3]; 168 | int ret; 169 | 170 | if (handle == 0) 171 | { 172 | // On the first call get the file handle from the host 173 | block[0] = ":tt"; // special filename to be used for stdin/out/err 174 | block[1] = (void*) 4; // mode "w" 175 | // length of ":tt", except null terminator 176 | block[2] = (void*) (sizeof(":tt") - 1); 177 | 178 | ret = call_host (SEMIHOSTING_SYS_OPEN, (void*) block); 179 | if (ret == -1) 180 | return -1; 181 | 182 | handle = ret; 183 | } 184 | 185 | block[0] = (void*) handle; 186 | block[1] = (void*) buf; 187 | block[2] = (void*) nbyte; 188 | // send character array to host file/device 189 | ret = call_host (SEMIHOSTING_SYS_WRITE, (void*) block); 190 | // this call returns the number of bytes NOT written (0 if all ok) 191 | 192 | // -1 is not a legal value, but SEGGER seems to return it 193 | if (ret == -1) 194 | return -1; 195 | 196 | // The compliant way of returning errors 197 | if (ret == (int) nbyte) 198 | return -1; 199 | 200 | // Return the number of bytes written 201 | return (ssize_t) (nbyte) - (ssize_t) ret; 202 | } 203 | 204 | #endif // OS_USE_TRACE_SEMIHOSTING_STDOUT 205 | 206 | // ---------------------------------------------------------------------------- 207 | 208 | #if defined(OS_USE_TRACE_SEMIHOSTING_DEBUG) 209 | 210 | #define OS_INTEGER_TRACE_TMP_ARRAY_SIZE (16) 211 | 212 | static ssize_t 213 | _trace_write_semihosting_debug (const char* buf, size_t nbyte) 214 | { 215 | // Since the single character debug channel is quite slow, try to 216 | // optimise and send a null terminated string, if possible. 217 | if (buf[nbyte] == '\0') 218 | { 219 | // send string 220 | call_host (SEMIHOSTING_SYS_WRITE0, (void*) buf); 221 | } 222 | else 223 | { 224 | // If not, use a local buffer to speed things up 225 | char tmp[OS_INTEGER_TRACE_TMP_ARRAY_SIZE]; 226 | size_t togo = nbyte; 227 | while (togo > 0) 228 | { 229 | unsigned int n = ((togo < sizeof(tmp)) ? togo : sizeof(tmp)); 230 | unsigned int i = 0; 231 | for (; i < n; ++i, ++buf) 232 | { 233 | tmp[i] = *buf; 234 | } 235 | tmp[i] = '\0'; 236 | 237 | call_host (SEMIHOSTING_SYS_WRITE0, (void*) tmp); 238 | 239 | togo -= n; 240 | } 241 | } 242 | 243 | // All bytes written 244 | return (ssize_t) nbyte; 245 | } 246 | 247 | #endif // OS_USE_TRACE_SEMIHOSTING_DEBUG 248 | 249 | #endif // TRACE 250 | 251 | // ---------------------------------------------------------------------------- 252 | 253 | -------------------------------------------------------------------------------- /system/src/newlib/README.txt: -------------------------------------------------------------------------------- 1 | 2 | The following files extend or replace some of the the newlib functionality: 3 | 4 | _startup.c: a customised startup sequence, written in C 5 | 6 | _exit.c: a customised exit() implementation 7 | 8 | _syscalls.c: local versions of the libnosys/librdimon code 9 | 10 | _sbrk.c: a custom _sbrk() to match the actual linker scripts 11 | 12 | assert.c: implementation for the asserion macros 13 | 14 | _cxx.cpp: local versions of some C++ support, to avoid references to 15 | large functions. 16 | 17 | -------------------------------------------------------------------------------- /system/src/newlib/_cxx.cpp: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | // These functions are redefined locally, to avoid references to some 9 | // heavy implementations in the standard C++ library. 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | #include 14 | #include 15 | #include "diag/Trace.h" 16 | 17 | // ---------------------------------------------------------------------------- 18 | 19 | namespace __gnu_cxx 20 | { 21 | void 22 | __attribute__((noreturn)) 23 | __verbose_terminate_handler(); 24 | 25 | void 26 | __verbose_terminate_handler() 27 | { 28 | trace_puts(__func__); 29 | abort(); 30 | } 31 | } 32 | 33 | // ---------------------------------------------------------------------------- 34 | 35 | extern "C" 36 | { 37 | void 38 | __attribute__((noreturn)) 39 | __cxa_pure_virtual(); 40 | 41 | void 42 | __cxa_pure_virtual() 43 | { 44 | trace_puts(__func__); 45 | abort(); 46 | } 47 | } 48 | 49 | // ---------------------------------------------------------------------------- 50 | 51 | -------------------------------------------------------------------------------- /system/src/newlib/_exit.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #include 9 | #include "diag/Trace.h" 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | extern void 14 | __attribute__((noreturn)) 15 | __reset_hardware(void); 16 | 17 | // ---------------------------------------------------------------------------- 18 | 19 | // Forward declaration 20 | 21 | void 22 | _exit(int code); 23 | 24 | // ---------------------------------------------------------------------------- 25 | 26 | // On Release, call the hardware reset procedure. 27 | // On Debug we just enter an infinite loop, to be used as landmark when halting 28 | // the debugger. 29 | // 30 | // It can be redefined in the application, if more functionality 31 | // is required. 32 | 33 | void 34 | __attribute__((weak)) 35 | _exit(int code __attribute__((unused))) 36 | { 37 | #if !defined(DEBUG) 38 | __reset_hardware(); 39 | #endif 40 | 41 | // TODO: write on trace 42 | while (1) 43 | ; 44 | } 45 | 46 | // ---------------------------------------------------------------------------- 47 | 48 | void 49 | __attribute__((weak,noreturn)) 50 | abort(void) 51 | { 52 | trace_puts("abort(), exiting..."); 53 | 54 | _exit(1); 55 | } 56 | 57 | // ---------------------------------------------------------------------------- 58 | -------------------------------------------------------------------------------- /system/src/newlib/_sbrk.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | // ---------------------------------------------------------------------------- 7 | 8 | #include 9 | #include 10 | 11 | // ---------------------------------------------------------------------------- 12 | 13 | caddr_t 14 | _sbrk(int incr); 15 | 16 | // ---------------------------------------------------------------------------- 17 | 18 | // The definitions used here should be kept in sync with the 19 | // stack definitions in the linker script. 20 | 21 | caddr_t 22 | _sbrk(int incr) 23 | { 24 | extern char _Heap_Begin; // Defined by the linker. 25 | extern char _Heap_Limit; // Defined by the linker. 26 | 27 | static char* current_heap_end; 28 | char* current_block_address; 29 | 30 | if (current_heap_end == 0) 31 | { 32 | current_heap_end = &_Heap_Begin; 33 | } 34 | 35 | current_block_address = current_heap_end; 36 | 37 | // Need to align heap to word boundary, else will get 38 | // hard faults on Cortex-M0. So we assume that heap starts on 39 | // word boundary, hence make sure we always add a multiple of 40 | // 4 to it. 41 | incr = (incr + 3) & (~3); // align value to 4 42 | if (current_heap_end + incr > &_Heap_Limit) 43 | { 44 | // Some of the libstdc++-v3 tests rely upon detecting 45 | // out of memory errors, so do not abort here. 46 | #if 0 47 | extern void abort (void); 48 | 49 | _write (1, "_sbrk: Heap and stack collision\n", 32); 50 | 51 | abort (); 52 | #else 53 | // Heap has overflowed 54 | errno = ENOMEM; 55 | return (caddr_t) - 1; 56 | #endif 57 | } 58 | 59 | current_heap_end += incr; 60 | 61 | return (caddr_t) current_block_address; 62 | } 63 | 64 | // ---------------------------------------------------------------------------- 65 | 66 | -------------------------------------------------------------------------------- /system/src/newlib/assert.c: -------------------------------------------------------------------------------- 1 | // 2 | // This file is part of the µOS++ III distribution. 3 | // Copyright (c) 2014 Liviu Ionescu. 4 | // 5 | 6 | #include 7 | #include 8 | #include 9 | 10 | #include "diag/Trace.h" 11 | 12 | // ---------------------------------------------------------------------------- 13 | 14 | void 15 | __attribute__((noreturn)) 16 | __assert_func (const char *file, int line, const char *func, 17 | const char *failedexpr) 18 | { 19 | trace_printf ("assertion \"%s\" failed: file \"%s\", line %d%s%s\n", 20 | failedexpr, file, line, func ? ", function: " : "", 21 | func ? func : ""); 22 | abort (); 23 | /* NOTREACHED */ 24 | } 25 | 26 | // ---------------------------------------------------------------------------- 27 | 28 | // This is STM32 specific, but can be used on other platforms too. 29 | // If you need it, add the following to your application header: 30 | 31 | //#ifdef USE_FULL_ASSERT 32 | //#define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__)) 33 | //void assert_failed(uint8_t* file, uint32_t line); 34 | //#else 35 | //#define assert_param(expr) ((void)0) 36 | //#endif // USE_FULL_ASSERT 37 | 38 | #if defined(USE_FULL_ASSERT) 39 | 40 | void 41 | assert_failed (uint8_t* file, uint32_t line); 42 | 43 | // Called from the assert_param() macro, usually defined in the stm32f*_conf.h 44 | void 45 | __attribute__((noreturn, weak)) 46 | assert_failed (uint8_t* file, uint32_t line) 47 | { 48 | trace_printf ("assert_param() failed: file \"%s\", line %d\n", file, line); 49 | abort (); 50 | /* NOTREACHED */ 51 | } 52 | 53 | #endif // defined(USE_FULL_ASSERT) 54 | 55 | // ---------------------------------------------------------------------------- 56 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/README_HAL.md: -------------------------------------------------------------------------------- 1 | The STM files are from the original `stm32cube_fw_f4_v190.zip` 2 | archive, the folder: 3 | 4 | * `STM32Cube_FW_F4_V1.9.0/Drivers/STM32F4xx_HAL_Driver/Src` 5 | 6 | There should be no changes from the STM originals. 7 | 8 | To disable compilation warnings, the compiler settings were changed 9 | to include `-Wno-*`. 10 | 11 | Files excluded from build can be re-enabled by using: 12 | 13 | * right click -> **Resource Configurations** -> **Exclude from build** 14 | * uncheck Debug and/or Release 15 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_flash_ramfunc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_flash_ramfunc.c 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief FLASH RAMFUNC module driver. 8 | * This file provides a FLASH firmware functions which should be 9 | * executed from internal SRAM 10 | * + Stop/Start the flash interface while System Run 11 | * + Enable/Disable the flash sleep while System Run 12 | @verbatim 13 | ============================================================================== 14 | ##### APIs executed from Internal RAM ##### 15 | ============================================================================== 16 | [..] 17 | *** ARM Compiler *** 18 | -------------------- 19 | [..] RAM functions are defined using the toolchain options. 20 | Functions that are be executed in RAM should reside in a separate 21 | source module. Using the 'Options for File' dialog you can simply change 22 | the 'Code / Const' area of a module to a memory space in physical RAM. 23 | Available memory areas are declared in the 'Target' tab of the 24 | Options for Target' dialog. 25 | 26 | *** ICCARM Compiler *** 27 | ----------------------- 28 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc". 29 | 30 | *** GNU Compiler *** 31 | -------------------- 32 | [..] RAM functions are defined using a specific toolchain attribute 33 | "__attribute__((section(".RamFunc")))". 34 | 35 | @endverbatim 36 | ****************************************************************************** 37 | * @attention 38 | * 39 | *

© COPYRIGHT(c) 2015 STMicroelectronics

40 | * 41 | * Redistribution and use in source and binary forms, with or without modification, 42 | * are permitted provided that the following conditions are met: 43 | * 1. Redistributions of source code must retain the above copyright notice, 44 | * this list of conditions and the following disclaimer. 45 | * 2. Redistributions in binary form must reproduce the above copyright notice, 46 | * this list of conditions and the following disclaimer in the documentation 47 | * and/or other materials provided with the distribution. 48 | * 3. Neither the name of STMicroelectronics nor the names of its contributors 49 | * may be used to endorse or promote products derived from this software 50 | * without specific prior written permission. 51 | * 52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 53 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 55 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE 56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 58 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 59 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 60 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 61 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 62 | * 63 | ****************************************************************************** 64 | */ 65 | 66 | /* Includes ------------------------------------------------------------------*/ 67 | #include "stm32f4xx_hal.h" 68 | 69 | /** @addtogroup STM32F4xx_HAL_Driver 70 | * @{ 71 | */ 72 | 73 | /** @defgroup FLASHRAMFUNC FLASH RAMFUNC 74 | * @brief FLASH functions executed from RAM 75 | * @{ 76 | */ 77 | #ifdef HAL_FLASH_MODULE_ENABLED 78 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) 79 | 80 | /* Private typedef -----------------------------------------------------------*/ 81 | /* Private define ------------------------------------------------------------*/ 82 | /* Private macro -------------------------------------------------------------*/ 83 | /* Private variables ---------------------------------------------------------*/ 84 | /* Private function prototypes -----------------------------------------------*/ 85 | /* Exported functions --------------------------------------------------------*/ 86 | /** @defgroup FLASHRAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions 87 | * @{ 88 | */ 89 | 90 | /** @defgroup FLASHRAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM 91 | * @brief Peripheral Extended features functions 92 | * 93 | @verbatim 94 | 95 | =============================================================================== 96 | ##### ramfunc functions ##### 97 | =============================================================================== 98 | [..] 99 | This subsection provides a set of functions that should be executed from RAM 100 | transfers. 101 | 102 | @endverbatim 103 | * @{ 104 | */ 105 | 106 | /** 107 | * @brief Stop the flash interface while System Run 108 | * @note This mode is only available for STM32F411xx devices. 109 | * @note This mode couldn't be set while executing with the flash itself. 110 | * It should be done with specific routine executed from RAM. 111 | * @retval None 112 | */ 113 | __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void) 114 | { 115 | /* Enable Power ctrl clock */ 116 | __HAL_RCC_PWR_CLK_ENABLE(); 117 | /* Stop the flash interface while System Run */ 118 | SET_BIT(PWR->CR, PWR_CR_FISSR); 119 | 120 | return HAL_OK; 121 | } 122 | 123 | /** 124 | * @brief Start the flash interface while System Run 125 | * @note This mode is only available for STM32F411xx devices. 126 | * @note This mode couldn't be set while executing with the flash itself. 127 | * It should be done with specific routine executed from RAM. 128 | * @retval None 129 | */ 130 | __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void) 131 | { 132 | /* Enable Power ctrl clock */ 133 | __HAL_RCC_PWR_CLK_ENABLE(); 134 | /* Start the flash interface while System Run */ 135 | CLEAR_BIT(PWR->CR, PWR_CR_FISSR); 136 | 137 | return HAL_OK; 138 | } 139 | 140 | /** 141 | * @brief Enable the flash sleep while System Run 142 | * @note This mode is only available for STM32F411xx devices. 143 | * @note This mode could n't be set while executing with the flash itself. 144 | * It should be done with specific routine executed from RAM. 145 | * @retval None 146 | */ 147 | __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void) 148 | { 149 | /* Enable Power ctrl clock */ 150 | __HAL_RCC_PWR_CLK_ENABLE(); 151 | /* Enable the flash sleep while System Run */ 152 | SET_BIT(PWR->CR, PWR_CR_FMSSR); 153 | 154 | return HAL_OK; 155 | } 156 | 157 | /** 158 | * @brief Disable the flash sleep while System Run 159 | * @note This mode is only available for STM32F411xx devices. 160 | * @note This mode couldn't be set while executing with the flash itself. 161 | * It should be done with specific routine executed from RAM. 162 | * @retval None 163 | */ 164 | __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void) 165 | { 166 | /* Enable Power ctrl clock */ 167 | __HAL_RCC_PWR_CLK_ENABLE(); 168 | /* Disable the flash sleep while System Run */ 169 | CLEAR_BIT(PWR->CR, PWR_CR_FMSSR); 170 | 171 | return HAL_OK; 172 | } 173 | 174 | /** 175 | * @} 176 | */ 177 | 178 | /** 179 | * @} 180 | */ 181 | 182 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx */ 183 | #endif /* HAL_FLASH_MODULE_ENABLED */ 184 | /** 185 | * @} 186 | */ 187 | 188 | /** 189 | * @} 190 | */ 191 | 192 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 193 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_i2c_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_i2c_ex.c 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief I2C Extension HAL module driver. 8 | * This file provides firmware functions to manage the following 9 | * functionalities of I2C extension peripheral: 10 | * + Extension features functions 11 | * 12 | @verbatim 13 | ============================================================================== 14 | ##### I2C peripheral extension features ##### 15 | ============================================================================== 16 | 17 | [..] Comparing to other previous devices, the I2C interface for STM32F427xx/437xx/ 18 | 429xx/439xx devices contains the following additional features : 19 | 20 | (+) Possibility to disable or enable Analog Noise Filter 21 | (+) Use of a configured Digital Noise Filter 22 | 23 | ##### How to use this driver ##### 24 | ============================================================================== 25 | [..] This driver provides functions to configure Noise Filter 26 | (#) Configure I2C Analog noise filter using the function HAL_I2C_AnalogFilter_Config() 27 | (#) Configure I2C Digital noise filter using the function HAL_I2C_DigitalFilter_Config() 28 | 29 | @endverbatim 30 | ****************************************************************************** 31 | * @attention 32 | * 33 | *

© COPYRIGHT(c) 2015 STMicroelectronics

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

© COPYRIGHT(c) 2015 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 | /* Includes ------------------------------------------------------------------*/ 39 | #include "stm32f4xx_hal.h" 40 | 41 | /** @addtogroup STM32F4xx_HAL_Driver 42 | * @{ 43 | */ 44 | /** @defgroup LTDCEx LTDCEx 45 | * @brief LTDC HAL module driver 46 | * @{ 47 | */ 48 | 49 | #ifdef HAL_LTDC_MODULE_ENABLED 50 | 51 | /* Private typedef -----------------------------------------------------------*/ 52 | /* Private define ------------------------------------------------------------*/ 53 | /* Private macro -------------------------------------------------------------*/ 54 | /* Private variables ---------------------------------------------------------*/ 55 | /* Private function prototypes -----------------------------------------------*/ 56 | /* Exported functions --------------------------------------------------------*/ 57 | 58 | /** @defgroup LTDCEx_Exported_Functions LTDC Extended Exported Functions 59 | * @{ 60 | */ 61 | 62 | /** @defgroup LTDCEx_Exported_Functions_Group1 Initialization and Configuration functions 63 | * @brief Initialization and Configuration functions 64 | * 65 | @verbatim 66 | =============================================================================== 67 | ##### Initialization and Configuration functions ##### 68 | =============================================================================== 69 | [..] This section provides functions allowing to: 70 | (+) Initialize and configure the LTDC 71 | 72 | @endverbatim 73 | * @{ 74 | */ 75 | #if defined(STM32F469xx) || defined(STM32F479xx) 76 | /** 77 | * @brief Retrieve common parameters from DSI Video mode configuration structure 78 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains 79 | * the configuration information for the LTDC. 80 | * @param VidCfg: pointer to a DSI_VidCfgTypeDef structure that contains 81 | * the DSI video mode configuration parameters 82 | * @note The implementation of this function is taking into account the LTDC 83 | * polarities inversion as described in the current LTDC specification 84 | * @retval HAL status 85 | */ 86 | HAL_StatusTypeDef HAL_LTDC_StructInitFromVideoConfig(LTDC_HandleTypeDef* hltdc, DSI_VidCfgTypeDef *VidCfg) 87 | { 88 | /* Retrieve signal polarities from DSI */ 89 | 90 | /* The following polarities are inverted: 91 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH 92 | LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH 93 | LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/ 94 | 95 | /* Note 1 : Code in line w/ Current LTDC specification */ 96 | hltdc->Init.DEPolarity = (VidCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 97 | hltdc->Init.VSPolarity = (VidCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH; 98 | hltdc->Init.HSPolarity = (VidCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH; 99 | 100 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 101 | /* hltdc->Init.DEPolarity = VidCfg->DEPolarity << 29; 102 | hltdc->Init.VSPolarity = VidCfg->VSPolarity << 29; 103 | hltdc->Init.HSPolarity = VidCfg->HSPolarity << 29; */ 104 | 105 | /* Retrieve vertical timing parameters from DSI */ 106 | hltdc->Init.VerticalSync = VidCfg->VerticalSyncActive - 1; 107 | hltdc->Init.AccumulatedVBP = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch - 1; 108 | hltdc->Init.AccumulatedActiveH = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive - 1; 109 | hltdc->Init.TotalHeigh = VidCfg->VerticalSyncActive + VidCfg->VerticalBackPorch + VidCfg->VerticalActive + VidCfg->VerticalFrontPorch - 1; 110 | 111 | return HAL_OK; 112 | } 113 | 114 | /** 115 | * @brief Retrieve common parameters from DSI Adapted command mode configuration structure 116 | * @param hltdc: pointer to a LTDC_HandleTypeDef structure that contains 117 | * the configuration information for the LTDC. 118 | * @param CmdCfg: pointer to a DSI_CmdCfgTypeDef structure that contains 119 | * the DSI command mode configuration parameters 120 | * @note The implementation of this function is taking into account the LTDC 121 | * polarities inversion as described in the current LTDC specification 122 | * @retval HAL status 123 | */ 124 | HAL_StatusTypeDef HAL_LTDC_StructInitFromAdaptedCommandConfig(LTDC_HandleTypeDef* hltdc, DSI_CmdCfgTypeDef *CmdCfg) 125 | { 126 | /* Retrieve signal polarities from DSI */ 127 | 128 | /* The following polarities are inverted: 129 | LTDC_DEPOLARITY_AL <-> LTDC_DEPOLARITY_AH 130 | LTDC_VSPOLARITY_AL <-> LTDC_VSPOLARITY_AH 131 | LTDC_HSPOLARITY_AL <-> LTDC_HSPOLARITY_AH)*/ 132 | 133 | /* Note 1 : Code in line w/ Current LTDC specification */ 134 | hltdc->Init.DEPolarity = (CmdCfg->DEPolarity == DSI_DATA_ENABLE_ACTIVE_HIGH) ? LTDC_DEPOLARITY_AL : LTDC_DEPOLARITY_AH; 135 | hltdc->Init.VSPolarity = (CmdCfg->VSPolarity == DSI_VSYNC_ACTIVE_HIGH) ? LTDC_VSPOLARITY_AL : LTDC_VSPOLARITY_AH; 136 | hltdc->Init.HSPolarity = (CmdCfg->HSPolarity == DSI_HSYNC_ACTIVE_HIGH) ? LTDC_HSPOLARITY_AL : LTDC_HSPOLARITY_AH; 137 | 138 | /* Note 2: Code to be used in case LTDC polarities inversion updated in the specification */ 139 | /* hltdc->Init.DEPolarity = CmdCfg->DEPolarity << 29; 140 | hltdc->Init.VSPolarity = CmdCfg->VSPolarity << 29; 141 | hltdc->Init.HSPolarity = CmdCfg->HSPolarity << 29; */ 142 | 143 | return HAL_OK; 144 | } 145 | #endif /* STM32F469xx || STM32F479xx */ 146 | 147 | /** 148 | * @} 149 | */ 150 | 151 | /** 152 | * @} 153 | */ 154 | 155 | #endif /* HAL_DCMI_MODULE_ENABLED */ 156 | /** 157 | * @} 158 | */ 159 | 160 | /** 161 | * @} 162 | */ 163 | 164 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 165 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_msp_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_msp_template.c 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief This file contains the HAL System and Peripheral (PPP) MSP initialization 8 | * and de-initialization functions. 9 | * It should be copied to the application folder and renamed into 'stm32f4xx_hal_msp.c'. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© COPYRIGHT(c) 2015 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 "stm32f4xx_hal.h" 42 | 43 | /** @addtogroup STM32F4xx_HAL_Driver 44 | * @{ 45 | */ 46 | 47 | /** @defgroup HAL_MSP HAL MSP 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 HAL MSP Private Functions 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @brief Initializes the Global MSP. 65 | * @note This function is called from HAL_Init() function to perform system 66 | * level initialization (GPIOs, clock, DMA, interrupt). 67 | * @retval None 68 | */ 69 | void HAL_MspInit(void) 70 | { 71 | 72 | } 73 | 74 | /** 75 | * @brief DeInitializes the Global MSP. 76 | * @note This functiona is called from HAL_DeInit() function to perform system 77 | * level de-initialization (GPIOs, clock, DMA, interrupt). 78 | * @retval None 79 | */ 80 | void HAL_MspDeInit(void) 81 | { 82 | 83 | } 84 | 85 | /** 86 | * @brief Initializes the PPP MSP. 87 | * @note This functiona is called from HAL_PPP_Init() function to perform 88 | * peripheral(PPP) system level initialization (GPIOs, clock, DMA, interrupt) 89 | * @retval None 90 | */ 91 | void HAL_PPP_MspInit(void) 92 | { 93 | 94 | } 95 | 96 | /** 97 | * @brief DeInitializes the PPP MSP. 98 | * @note This functiona is called from HAL_PPP_DeInit() function to perform 99 | * peripheral(PPP) system level de-initialization (GPIOs, clock, DMA, interrupt) 100 | * @retval None 101 | */ 102 | void HAL_PPP_MspDeInit(void) 103 | { 104 | 105 | } 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_pcd_ex.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_hal_pcd_ex.c 4 | * @author MCD Application Team 5 | * @version V1.4.1 6 | * @date 09-October-2015 7 | * @brief PCD HAL module driver. 8 | * This file provides firmware functions to manage the following 9 | * functionalities of the USB Peripheral Controller: 10 | * + Extended features functions 11 | * 12 | ****************************************************************************** 13 | * @attention 14 | * 15 | *

© COPYRIGHT(c) 2015 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 "stm32f4xx_hal.h" 44 | 45 | /** @addtogroup STM32F4xx_HAL_Driver 46 | * @{ 47 | */ 48 | 49 | /** @defgroup PCDEx PCDEx 50 | * @brief PCD Extended HAL module driver 51 | * @{ 52 | */ 53 | #ifdef HAL_PCD_MODULE_ENABLED 54 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \ 55 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \ 56 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \ 57 | defined(STM32F469xx) || defined(STM32F479xx) 58 | /* Private types -------------------------------------------------------------*/ 59 | /* Private variables ---------------------------------------------------------*/ 60 | /* Private constants ---------------------------------------------------------*/ 61 | /* Private macros ------------------------------------------------------------*/ 62 | /* Private functions ---------------------------------------------------------*/ 63 | /* Exported functions --------------------------------------------------------*/ 64 | 65 | /** @defgroup PCDEx_Exported_Functions PCD Extended Exported Functions 66 | * @{ 67 | */ 68 | 69 | /** @defgroup PCDEx_Exported_Functions_Group1 Peripheral Control functions 70 | * @brief PCDEx control functions 71 | * 72 | @verbatim 73 | =============================================================================== 74 | ##### Extended features functions ##### 75 | =============================================================================== 76 | [..] This section provides functions allowing to: 77 | (+) Update FIFO configuration 78 | 79 | @endverbatim 80 | * @{ 81 | */ 82 | 83 | /** 84 | * @brief Set Tx FIFO 85 | * @param hpcd: PCD handle 86 | * @param fifo: The number of Tx fifo 87 | * @param size: Fifo size 88 | * @retval HAL status 89 | */ 90 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size) 91 | { 92 | uint8_t i = 0; 93 | uint32_t Tx_Offset = 0; 94 | 95 | /* TXn min size = 16 words. (n : Transmit FIFO index) 96 | When a TxFIFO is not used, the Configuration should be as follows: 97 | case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes) 98 | --> Txm can use the space allocated for Txn. 99 | case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes) 100 | --> Txn should be configured with the minimum space of 16 words 101 | The FIFO is used optimally when used TxFIFOs are allocated in the top 102 | of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones. 103 | When DMA is used 3n * FIFO locations should be reserved for internal DMA registers */ 104 | 105 | Tx_Offset = hpcd->Instance->GRXFSIZ; 106 | 107 | if(fifo == 0) 108 | { 109 | hpcd->Instance->DIEPTXF0_HNPTXFSIZ = (uint32_t)(((uint32_t)size << 16) | Tx_Offset); 110 | } 111 | else 112 | { 113 | Tx_Offset += (hpcd->Instance->DIEPTXF0_HNPTXFSIZ) >> 16; 114 | for (i = 0; i < (fifo - 1); i++) 115 | { 116 | Tx_Offset += (hpcd->Instance->DIEPTXF[i] >> 16); 117 | } 118 | 119 | /* Multiply Tx_Size by 2 to get higher performance */ 120 | hpcd->Instance->DIEPTXF[fifo - 1] = (uint32_t)(((uint32_t)size << 16) | Tx_Offset); 121 | } 122 | 123 | return HAL_OK; 124 | } 125 | 126 | /** 127 | * @brief Set Rx FIFO 128 | * @param hpcd: PCD handle 129 | * @param size: Size of Rx fifo 130 | * @retval HAL status 131 | */ 132 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size) 133 | { 134 | hpcd->Instance->GRXFSIZ = size; 135 | 136 | return HAL_OK; 137 | } 138 | 139 | #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) 140 | /** 141 | * @brief Activate LPM feature 142 | * @param hpcd: PCD handle 143 | * @retval HAL status 144 | */ 145 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd) 146 | { 147 | USB_OTG_GlobalTypeDef *USBx = hpcd->Instance; 148 | 149 | hpcd->lpm_active = ENABLE; 150 | hpcd->LPM_State = LPM_L0; 151 | USBx->GINTMSK |= USB_OTG_GINTMSK_LPMINTM; 152 | USBx->GLPMCFG |= (USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL); 153 | 154 | return HAL_OK; 155 | } 156 | 157 | /** 158 | * @brief Deactivate LPM feature. 159 | * @param hpcd: PCD handle 160 | * @retval HAL status 161 | */ 162 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd) 163 | { 164 | USB_OTG_GlobalTypeDef *USBx = hpcd->Instance; 165 | 166 | hpcd->lpm_active = DISABLE; 167 | USBx->GINTMSK &= ~USB_OTG_GINTMSK_LPMINTM; 168 | USBx->GLPMCFG &= ~(USB_OTG_GLPMCFG_LPMEN | USB_OTG_GLPMCFG_LPMACK | USB_OTG_GLPMCFG_ENBESL); 169 | 170 | return HAL_OK; 171 | } 172 | 173 | /** 174 | * @brief Send LPM message to user layer callback. 175 | * @param hpcd: PCD handle 176 | * @param msg: LPM message 177 | * @retval HAL status 178 | */ 179 | __weak void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg) 180 | { 181 | } 182 | #endif /* STM32F446xx || STM32F469xx || STM32F479xx */ 183 | 184 | /** 185 | * @} 186 | */ 187 | 188 | /** 189 | * @} 190 | */ 191 | 192 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx || 193 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx */ 194 | #endif /* HAL_PCD_MODULE_ENABLED */ 195 | /** 196 | * @} 197 | */ 198 | 199 | /** 200 | * @} 201 | */ 202 | 203 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 204 | -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_rcc_ex.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/src/stm32f4-hal/stm32f4xx_hal_rcc_ex.c -------------------------------------------------------------------------------- /system/src/stm32f4-hal/stm32f4xx_hal_wwdg.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/angst7/stm32_functgen/e142b51e4a9a2bfc9fa5d4bed017f30a9b8dcb84/system/src/stm32f4-hal/stm32f4xx_hal_wwdg.c --------------------------------------------------------------------------------