├── .gitattributes
├── .gitignore
├── Libraries
├── CMSIS
│ ├── Include
│ │ ├── arm_common_tables.h
│ │ ├── arm_math.h
│ │ ├── core_cm0.h
│ │ ├── core_cm3.h
│ │ ├── core_cm4.h
│ │ ├── core_cm4_simd.h
│ │ ├── core_cmFunc.h
│ │ └── core_cmInstr.h
│ └── ST
│ │ └── STM32F4xx
│ │ ├── Include
│ │ ├── stm32f4xx.h
│ │ └── system_stm32f4xx.h
│ │ ├── Release_Notes.html
│ │ └── Source
│ │ └── Templates
│ │ ├── TASKING
│ │ └── cstart_thumb2.asm
│ │ ├── TrueSTUDIO
│ │ └── startup_stm32f4xx.s
│ │ ├── arm
│ │ └── startup_stm32f4xx.s
│ │ ├── gcc_ride7
│ │ └── startup_stm32f4xx.s
│ │ ├── iar
│ │ └── startup_stm32f4xx.s
│ │ └── system_stm32f4xx.c
├── STM32F4xx_StdPeriph_Driver
│ ├── Release_Notes.html
│ ├── inc
│ │ ├── misc.h
│ │ ├── stm32f4xx_adc.h
│ │ ├── stm32f4xx_can.h
│ │ ├── stm32f4xx_crc.h
│ │ ├── stm32f4xx_cryp.h
│ │ ├── stm32f4xx_dac.h
│ │ ├── stm32f4xx_dbgmcu.h
│ │ ├── stm32f4xx_dcmi.h
│ │ ├── stm32f4xx_dma.h
│ │ ├── stm32f4xx_exti.h
│ │ ├── stm32f4xx_flash.h
│ │ ├── stm32f4xx_fsmc.h
│ │ ├── stm32f4xx_gpio.h
│ │ ├── stm32f4xx_hash.h
│ │ ├── stm32f4xx_i2c.h
│ │ ├── stm32f4xx_iwdg.h
│ │ ├── stm32f4xx_pwr.h
│ │ ├── stm32f4xx_rcc.h
│ │ ├── stm32f4xx_rng.h
│ │ ├── stm32f4xx_rtc.h
│ │ ├── stm32f4xx_sdio.h
│ │ ├── stm32f4xx_spi.h
│ │ ├── stm32f4xx_syscfg.h
│ │ ├── stm32f4xx_tim.h
│ │ ├── stm32f4xx_usart.h
│ │ └── stm32f4xx_wwdg.h
│ └── src
│ │ ├── misc.c
│ │ ├── stm32f4xx_adc.c
│ │ ├── stm32f4xx_can.c
│ │ ├── stm32f4xx_crc.c
│ │ ├── stm32f4xx_cryp.c
│ │ ├── stm32f4xx_cryp_aes.c
│ │ ├── stm32f4xx_cryp_des.c
│ │ ├── stm32f4xx_cryp_tdes.c
│ │ ├── stm32f4xx_dac.c
│ │ ├── stm32f4xx_dbgmcu.c
│ │ ├── stm32f4xx_dcmi.c
│ │ ├── stm32f4xx_dma.c
│ │ ├── stm32f4xx_exti.c
│ │ ├── stm32f4xx_flash.c
│ │ ├── stm32f4xx_fsmc.c
│ │ ├── stm32f4xx_gpio.c
│ │ ├── stm32f4xx_hash.c
│ │ ├── stm32f4xx_hash_md5.c
│ │ ├── stm32f4xx_hash_sha1.c
│ │ ├── stm32f4xx_i2c.c
│ │ ├── stm32f4xx_iwdg.c
│ │ ├── stm32f4xx_pwr.c
│ │ ├── stm32f4xx_rcc.c
│ │ ├── stm32f4xx_rng.c
│ │ ├── stm32f4xx_rtc.c
│ │ ├── stm32f4xx_sdio.c
│ │ ├── stm32f4xx_spi.c
│ │ ├── stm32f4xx_syscfg.c
│ │ ├── stm32f4xx_tim.c
│ │ ├── stm32f4xx_usart.c
│ │ └── stm32f4xx_wwdg.c
├── STM32_USB_Device_Library
│ ├── Class
│ │ └── audio
│ │ │ ├── inc
│ │ │ └── usbd_audio_core.h
│ │ │ └── src
│ │ │ └── usbd_audio_core.c
│ └── Core
│ │ ├── inc
│ │ ├── usbd_conf_template.h
│ │ ├── usbd_core.h
│ │ ├── usbd_def.h
│ │ ├── usbd_ioreq.h
│ │ ├── usbd_req.h
│ │ └── usbd_usr.h
│ │ └── src
│ │ ├── usbd_core.c
│ │ ├── usbd_ioreq.c
│ │ └── usbd_req.c
└── STM32_USB_OTG_Driver
│ ├── Release_Notes.html
│ ├── inc
│ ├── usb_bsp.h
│ ├── usb_core.h
│ ├── usb_dcd.h
│ ├── usb_dcd_int.h
│ ├── usb_defines.h
│ └── usb_regs.h
│ └── src
│ ├── usb_core.c
│ ├── usb_dcd.c
│ └── usb_dcd_int.c
├── README.md
├── STM32F4-Discovery_audio.hex
├── Utilities
└── STM32F4-Discovery
│ ├── libPDMFilter_GCC.a
│ ├── libPDMFilter_IAR.a
│ ├── libPDMFilter_Keil.lib
│ ├── pdm_filter.h
│ ├── stm32f4_discovery.c
│ ├── stm32f4_discovery.h
│ ├── stm32f4_discovery_audio_codec.c
│ └── stm32f4_discovery_audio_codec.h
└── my_mic_usb
├── EWARM
├── STM32F4-Discovery_audio.dep
├── STM32F4-Discovery_audio.ewd
├── STM32F4-Discovery_audio.ewp
├── STM32F4-Discovery_audio.ewt
├── STM32F4-Discovery_audio.eww
├── settings
│ ├── STM32F4-Discovery_Demo.cspy.bat
│ ├── STM32F4-Discovery_Demo.dbgdt
│ ├── STM32F4-Discovery_Demo.dni
│ ├── STM32F4-Discovery_Demo.wsdt
│ ├── STM32F4-Discovery_audio.Demo.cspy.bat
│ ├── STM32F4-Discovery_audio.Demo.driver.xcl
│ ├── STM32F4-Discovery_audio.Demo.general.xcl
│ ├── STM32F4-Discovery_audio.crun
│ ├── STM32F4-Discovery_audio.cspy.bat
│ ├── STM32F4-Discovery_audio.dbgdt
│ ├── STM32F4-Discovery_audio.dni
│ ├── STM32F4-Discovery_audio.wsdt
│ └── STM32F4-Discovery_audio.wspos
└── stm32f40x_flash.icf
├── main.c
├── main.h
├── stm32f4xx_conf.h
├── stm32f4xx_it.c
├── stm32f4xx_it.h
├── system_stm32f4xx.c
├── usb_bsp.c
├── usb_conf.h
├── usbd_conf.h
├── usbd_desc.c
├── usbd_desc.h
├── usbd_usr.c
├── waverecorder.c
└── waverecorder.h
/.gitattributes:
--------------------------------------------------------------------------------
1 | # Auto detect text files and perform LF normalization
2 | * text=auto
3 |
4 | # Custom for Visual Studio
5 | *.cs diff=csharp
6 | *.sln merge=union
7 | *.csproj merge=union
8 | *.vbproj merge=union
9 | *.fsproj merge=union
10 | *.dbproj merge=union
11 |
12 | # Standard to msysgit
13 | *.doc diff=astextplain
14 | *.DOC diff=astextplain
15 | *.docx diff=astextplain
16 | *.DOCX diff=astextplain
17 | *.dot diff=astextplain
18 | *.DOT diff=astextplain
19 | *.pdf diff=astextplain
20 | *.PDF diff=astextplain
21 | *.rtf diff=astextplain
22 | *.RTF diff=astextplain
23 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # Windows image file caches
2 | Thumbs.db
3 | ehthumbs.db
4 |
5 | # Folder config file
6 | Desktop.ini
7 |
8 | # Recycle Bin used on file shares
9 | $RECYCLE.BIN/
10 |
11 | # Windows Installer files
12 | *.cab
13 | *.msi
14 | *.msm
15 | *.msp
16 |
17 | # =========================
18 | # Operating System Files
19 | # =========================
20 |
21 | # OSX
22 | # =========================
23 |
24 | .DS_Store
25 | .AppleDouble
26 | .LSOverride
27 |
28 | # Icon must end with two \r
29 | Icon
30 |
31 | # Thumbnails
32 | ._*
33 |
34 | # Files that might appear on external disk
35 | .Spotlight-V100
36 | .Trashes
37 |
38 | # Directories potentially created on remote AFP share
39 | .AppleDB
40 | .AppleDesktop
41 | Network Trash Folder
42 | Temporary Items
43 | .apdisk
44 |
--------------------------------------------------------------------------------
/Libraries/CMSIS/Include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 11. November 2010
5 | * $Revision: V1.0.2
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 | * Version 1.0.2 2010/11/11
15 | * Documentation updated.
16 | *
17 | * Version 1.0.1 2010/10/05
18 | * Production release and review comments incorporated.
19 | *
20 | * Version 1.0.0 2010/09/20
21 | * Production release and review comments incorporated.
22 | * -------------------------------------------------------------------- */
23 |
24 | #ifndef _ARM_COMMON_TABLES_H
25 | #define _ARM_COMMON_TABLES_H
26 |
27 | #include "arm_math.h"
28 |
29 | extern uint16_t armBitRevTable[256];
30 | extern q15_t armRecipTableQ15[64];
31 | extern q31_t armRecipTableQ31[64];
32 | extern const q31_t realCoefAQ31[1024];
33 | extern const q31_t realCoefBQ31[1024];
34 |
35 | #endif /* ARM_COMMON_TABLES_H */
36 |
--------------------------------------------------------------------------------
/Libraries/CMSIS/ST/STM32F4xx/Include/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Libraries/CMSIS/ST/STM32F4xx/Include/stm32f4xx.h
--------------------------------------------------------------------------------
/Libraries/CMSIS/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | *
© COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /** @addtogroup CMSIS
23 | * @{
24 | */
25 |
26 | /** @addtogroup stm32f4xx_system
27 | * @{
28 | */
29 |
30 | /**
31 | * @brief Define to prevent recursive inclusion
32 | */
33 | #ifndef __SYSTEM_STM32F4XX_H
34 | #define __SYSTEM_STM32F4XX_H
35 |
36 | #ifdef __cplusplus
37 | extern "C" {
38 | #endif
39 |
40 | /** @addtogroup STM32F4xx_System_Includes
41 | * @{
42 | */
43 |
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @addtogroup STM32F4xx_System_Exported_types
50 | * @{
51 | */
52 |
53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
54 |
55 |
56 | /**
57 | * @}
58 | */
59 |
60 | /** @addtogroup STM32F4xx_System_Exported_Constants
61 | * @{
62 | */
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /** @addtogroup STM32F4xx_System_Exported_Macros
69 | * @{
70 | */
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /** @addtogroup STM32F4xx_System_Exported_Functions
77 | * @{
78 | */
79 |
80 | extern void SystemInit(void);
81 | extern void SystemCoreClockUpdate(void);
82 | /**
83 | * @}
84 | */
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /*__SYSTEM_STM32F4XX_H */
91 |
92 | /**
93 | * @}
94 | */
95 |
96 | /**
97 | * @}
98 | */
99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
100 |
--------------------------------------------------------------------------------
/Libraries/CMSIS/ST/STM32F4xx/Source/Templates/TASKING/cstart_thumb2.asm:
--------------------------------------------------------------------------------
1 |
2 |
3 | ;; NOTE: To allow the use of this file for both ARMv6M and ARMv7M,
4 | ;; we will only use 16-bit Thumb intructions.
5 |
6 | .extern _lc_ub_stack ; usr/sys mode stack pointer
7 | .extern _lc_ue_stack ; symbol required by debugger
8 | .extern _lc_ub_table ; ROM to RAM copy table
9 | .extern main
10 | .extern _Exit
11 | .extern exit
12 | .weak exit
13 | .global __get_argcv
14 | .weak __get_argcv
15 | .extern __argcvbuf
16 | .weak __argcvbuf
17 | ;;.extern __init_hardware
18 |
19 | .extern SystemInit
20 |
21 | .if @defined('__PROF_ENABLE__')
22 | .extern __prof_init
23 | .endif
24 | .if @defined('__POSIX__')
25 | .extern posix_main
26 | .extern _posix_boot_stack_top
27 | .endif
28 |
29 | .global _START
30 |
31 | .section .text.cstart
32 |
33 | .thumb
34 | _START:
35 | ;; anticipate possible ROM/RAM remapping
36 | ;; by loading the 'real' program address
37 | ldr r1,=_Next
38 | bx r1
39 | _Next:
40 | ;; initialize the stack pointer
41 | ldr r1,=_lc_ub_stack ; TODO: make this part of the vector table
42 | mov sp,r1
43 |
44 | ; Call the clock system intitialization function.
45 | bl SystemInit
46 |
47 | ;; copy initialized sections from ROM to RAM
48 | ;; and clear uninitialized data sections in RAM
49 |
50 | ldr r3,=_lc_ub_table
51 | movs r0,#0
52 | cploop:
53 | ldr r4,[r3,#0] ; load type
54 | ldr r5,[r3,#4] ; dst address
55 | ldr r6,[r3,#8] ; src address
56 | ldr r7,[r3,#12] ; size
57 |
58 | cmp r4,#1
59 | beq copy
60 | cmp r4,#2
61 | beq clear
62 | b done
63 |
64 | copy:
65 | subs r7,r7,#1
66 | ldrb r1,[r6,r7]
67 | strb r1,[r5,r7]
68 | bne copy
69 |
70 | adds r3,r3,#16
71 | b cploop
72 |
73 | clear:
74 | subs r7,r7,#1
75 | strb r0,[r5,r7]
76 | bne clear
77 |
78 | adds r3,r3,#16
79 | b cploop
80 |
81 | done:
82 |
83 |
84 | .if @defined('__POSIX__')
85 |
86 | ;; posix stack buffer for system upbringing
87 | ldr r0,=_posix_boot_stack_top
88 | ldr r0, [r0]
89 | mov sp,r0
90 |
91 | .else
92 |
93 | ;; load r10 with end of USR/SYS stack, which is
94 | ;; needed in case stack overflow checking is on
95 | ;; NOTE: use 16-bit instructions only, for ARMv6M
96 | ldr r0,=_lc_ue_stack
97 | mov r10,r0
98 |
99 | .endif
100 |
101 | .if @defined('__PROF_ENABLE__')
102 | bl __prof_init
103 | .endif
104 |
105 | .if @defined('__POSIX__')
106 | ;; call posix_main with no arguments
107 | bl posix_main
108 | .else
109 | ;; retrieve argc and argv (default argv[0]==NULL & argc==0)
110 | bl __get_argcv
111 | ldr r1,=__argcvbuf
112 | ;; call main
113 | bl main
114 | .endif
115 |
116 | ;; call exit using the return value from main()
117 | ;; Note. Calling exit will also run all functions
118 | ;; that were supplied through atexit().
119 | bl exit
120 |
121 | __get_argcv: ; weak definition
122 | movs r0,#0
123 | bx lr
124 |
125 | .ltorg
126 | .endsec
127 |
128 | .calls '_START', ' '
129 | .calls '_START','__init_vector_table'
130 | .if @defined('__PROF_ENABLE__')
131 | .calls '_START','__prof_init'
132 | .endif
133 | .if @defined('__POSIX__')
134 | .calls '_START','posix_main'
135 | .else
136 | .calls '_START','__get_argcv'
137 | .calls '_START','main'
138 | .endif
139 | .calls '_START','exit'
140 | .calls '_START','',0
141 |
142 | .end
143 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/misc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file misc.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the miscellaneous
8 | * firmware library functions (add-on to CMSIS functions).
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __MISC_H
25 | #define __MISC_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup MISC
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 |
44 | /**
45 | * @brief NVIC Init Structure definition
46 | */
47 |
48 | typedef struct
49 | {
50 | uint8_t NVIC_IRQChannel; /*!< Specifies the IRQ channel to be enabled or disabled.
51 | This parameter can be an enumerator of @ref IRQn_Type
52 | enumeration (For the complete STM32 Devices IRQ Channels
53 | list, please refer to stm32f4xx.h file) */
54 |
55 | uint8_t NVIC_IRQChannelPreemptionPriority; /*!< Specifies the pre-emption priority for the IRQ channel
56 | specified in NVIC_IRQChannel. This parameter can be a value
57 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
58 | A lower priority value indicates a higher priority */
59 |
60 | uint8_t NVIC_IRQChannelSubPriority; /*!< Specifies the subpriority level for the IRQ channel specified
61 | in NVIC_IRQChannel. This parameter can be a value
62 | between 0 and 15 as described in the table @ref MISC_NVIC_Priority_Table
63 | A lower priority value indicates a higher priority */
64 |
65 | FunctionalState NVIC_IRQChannelCmd; /*!< Specifies whether the IRQ channel defined in NVIC_IRQChannel
66 | will be enabled or disabled.
67 | This parameter can be set either to ENABLE or DISABLE */
68 | } NVIC_InitTypeDef;
69 |
70 | /* Exported constants --------------------------------------------------------*/
71 |
72 | /** @defgroup MISC_Exported_Constants
73 | * @{
74 | */
75 |
76 | /** @defgroup MISC_Vector_Table_Base
77 | * @{
78 | */
79 |
80 | #define NVIC_VectTab_RAM ((uint32_t)0x20000000)
81 | #define NVIC_VectTab_FLASH ((uint32_t)0x08000000)
82 | #define IS_NVIC_VECTTAB(VECTTAB) (((VECTTAB) == NVIC_VectTab_RAM) || \
83 | ((VECTTAB) == NVIC_VectTab_FLASH))
84 | /**
85 | * @}
86 | */
87 |
88 | /** @defgroup MISC_System_Low_Power
89 | * @{
90 | */
91 |
92 | #define NVIC_LP_SEVONPEND ((uint8_t)0x10)
93 | #define NVIC_LP_SLEEPDEEP ((uint8_t)0x04)
94 | #define NVIC_LP_SLEEPONEXIT ((uint8_t)0x02)
95 | #define IS_NVIC_LP(LP) (((LP) == NVIC_LP_SEVONPEND) || \
96 | ((LP) == NVIC_LP_SLEEPDEEP) || \
97 | ((LP) == NVIC_LP_SLEEPONEXIT))
98 | /**
99 | * @}
100 | */
101 |
102 | /** @defgroup MISC_Preemption_Priority_Group
103 | * @{
104 | */
105 |
106 | #define NVIC_PriorityGroup_0 ((uint32_t)0x700) /*!< 0 bits for pre-emption priority
107 | 4 bits for subpriority */
108 | #define NVIC_PriorityGroup_1 ((uint32_t)0x600) /*!< 1 bits for pre-emption priority
109 | 3 bits for subpriority */
110 | #define NVIC_PriorityGroup_2 ((uint32_t)0x500) /*!< 2 bits for pre-emption priority
111 | 2 bits for subpriority */
112 | #define NVIC_PriorityGroup_3 ((uint32_t)0x400) /*!< 3 bits for pre-emption priority
113 | 1 bits for subpriority */
114 | #define NVIC_PriorityGroup_4 ((uint32_t)0x300) /*!< 4 bits for pre-emption priority
115 | 0 bits for subpriority */
116 |
117 | #define IS_NVIC_PRIORITY_GROUP(GROUP) (((GROUP) == NVIC_PriorityGroup_0) || \
118 | ((GROUP) == NVIC_PriorityGroup_1) || \
119 | ((GROUP) == NVIC_PriorityGroup_2) || \
120 | ((GROUP) == NVIC_PriorityGroup_3) || \
121 | ((GROUP) == NVIC_PriorityGroup_4))
122 |
123 | #define IS_NVIC_PREEMPTION_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
124 |
125 | #define IS_NVIC_SUB_PRIORITY(PRIORITY) ((PRIORITY) < 0x10)
126 |
127 | #define IS_NVIC_OFFSET(OFFSET) ((OFFSET) < 0x000FFFFF)
128 |
129 | /**
130 | * @}
131 | */
132 |
133 | /** @defgroup MISC_SysTick_clock_source
134 | * @{
135 | */
136 |
137 | #define SysTick_CLKSource_HCLK_Div8 ((uint32_t)0xFFFFFFFB)
138 | #define SysTick_CLKSource_HCLK ((uint32_t)0x00000004)
139 | #define IS_SYSTICK_CLK_SOURCE(SOURCE) (((SOURCE) == SysTick_CLKSource_HCLK) || \
140 | ((SOURCE) == SysTick_CLKSource_HCLK_Div8))
141 | /**
142 | * @}
143 | */
144 |
145 | /**
146 | * @}
147 | */
148 |
149 | /* Exported macro ------------------------------------------------------------*/
150 | /* Exported functions --------------------------------------------------------*/
151 |
152 | void NVIC_PriorityGroupConfig(uint32_t NVIC_PriorityGroup);
153 | void NVIC_Init(NVIC_InitTypeDef* NVIC_InitStruct);
154 | void NVIC_SetVectorTable(uint32_t NVIC_VectTab, uint32_t Offset);
155 | void NVIC_SystemLPConfig(uint8_t LowPowerMode, FunctionalState NewState);
156 | void SysTick_CLKSourceConfig(uint32_t SysTick_CLKSource);
157 |
158 | #ifdef __cplusplus
159 | }
160 | #endif
161 |
162 | #endif /* __MISC_H */
163 |
164 | /**
165 | * @}
166 | */
167 |
168 | /**
169 | * @}
170 | */
171 |
172 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
173 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_crc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_crc.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the CRC firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_CRC_H
25 | #define __STM32F4xx_CRC_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup CRC
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup CRC_Exported_Constants
46 | * @{
47 | */
48 |
49 | /**
50 | * @}
51 | */
52 |
53 | /* Exported macro ------------------------------------------------------------*/
54 | /* Exported functions --------------------------------------------------------*/
55 |
56 | void CRC_ResetDR(void);
57 | uint32_t CRC_CalcCRC(uint32_t Data);
58 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength);
59 | uint32_t CRC_GetCRC(void);
60 | void CRC_SetIDRegister(uint8_t IDValue);
61 | uint8_t CRC_GetIDRegister(void);
62 |
63 | #ifdef __cplusplus
64 | }
65 | #endif
66 |
67 | #endif /* __STM32F4xx_CRC_H */
68 |
69 | /**
70 | * @}
71 | */
72 |
73 | /**
74 | * @}
75 | */
76 |
77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
78 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_dbgmcu.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_dbgmcu.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the DBGMCU firmware library.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4xx_DBGMCU_H
24 | #define __STM32F4xx_DBGMCU_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f4xx.h"
32 |
33 | /** @addtogroup STM32F4xx_StdPeriph_Driver
34 | * @{
35 | */
36 |
37 | /** @addtogroup DBGMCU
38 | * @{
39 | */
40 |
41 | /* Exported types ------------------------------------------------------------*/
42 | /* Exported constants --------------------------------------------------------*/
43 |
44 | /** @defgroup DBGMCU_Exported_Constants
45 | * @{
46 | */
47 | #define DBGMCU_SLEEP ((uint32_t)0x00000001)
48 | #define DBGMCU_STOP ((uint32_t)0x00000002)
49 | #define DBGMCU_STANDBY ((uint32_t)0x00000004)
50 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFFF8) == 0x00) && ((PERIPH) != 0x00))
51 |
52 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000001)
53 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00000002)
54 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00000004)
55 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00000008)
56 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00000010)
57 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00000020)
58 | #define DBGMCU_TIM12_STOP ((uint32_t)0x00000040)
59 | #define DBGMCU_TIM13_STOP ((uint32_t)0x00000080)
60 | #define DBGMCU_TIM14_STOP ((uint32_t)0x00000100)
61 | #define DBGMCU_RTC_STOP ((uint32_t)0x00000400)
62 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000800)
63 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00001000)
64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000)
65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000)
66 | #define DBGMCU_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000)
67 | #define DBGMCU_CAN1_STOP ((uint32_t)0x02000000)
68 | #define DBGMCU_CAN2_STOP ((uint32_t)0x04000000)
69 | #define IS_DBGMCU_APB1PERIPH(PERIPH) ((((PERIPH) & 0xF91FE200) == 0x00) && ((PERIPH) != 0x00))
70 |
71 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000001)
72 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00000002)
73 | #define DBGMCU_TIM9_STOP ((uint32_t)0x00010000)
74 | #define DBGMCU_TIM10_STOP ((uint32_t)0x00020000)
75 | #define DBGMCU_TIM11_STOP ((uint32_t)0x00040000)
76 | #define IS_DBGMCU_APB2PERIPH(PERIPH) ((((PERIPH) & 0xFFF8FFFC) == 0x00) && ((PERIPH) != 0x00))
77 | /**
78 | * @}
79 | */
80 |
81 | /* Exported macro ------------------------------------------------------------*/
82 | /* Exported functions --------------------------------------------------------*/
83 | uint32_t DBGMCU_GetREVID(void);
84 | uint32_t DBGMCU_GetDEVID(void);
85 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState);
86 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState);
87 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState);
88 |
89 | #ifdef __cplusplus
90 | }
91 | #endif
92 |
93 | #endif /* __STM32F4xx_DBGMCU_H */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
104 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_exti.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_exti.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the EXTI firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_EXTI_H
25 | #define __STM32F4xx_EXTI_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup EXTI
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 |
44 | /**
45 | * @brief EXTI mode enumeration
46 | */
47 |
48 | typedef enum
49 | {
50 | EXTI_Mode_Interrupt = 0x00,
51 | EXTI_Mode_Event = 0x04
52 | }EXTIMode_TypeDef;
53 |
54 | #define IS_EXTI_MODE(MODE) (((MODE) == EXTI_Mode_Interrupt) || ((MODE) == EXTI_Mode_Event))
55 |
56 | /**
57 | * @brief EXTI Trigger enumeration
58 | */
59 |
60 | typedef enum
61 | {
62 | EXTI_Trigger_Rising = 0x08,
63 | EXTI_Trigger_Falling = 0x0C,
64 | EXTI_Trigger_Rising_Falling = 0x10
65 | }EXTITrigger_TypeDef;
66 |
67 | #define IS_EXTI_TRIGGER(TRIGGER) (((TRIGGER) == EXTI_Trigger_Rising) || \
68 | ((TRIGGER) == EXTI_Trigger_Falling) || \
69 | ((TRIGGER) == EXTI_Trigger_Rising_Falling))
70 | /**
71 | * @brief EXTI Init Structure definition
72 | */
73 |
74 | typedef struct
75 | {
76 | uint32_t EXTI_Line; /*!< Specifies the EXTI lines to be enabled or disabled.
77 | This parameter can be any combination value of @ref EXTI_Lines */
78 |
79 | EXTIMode_TypeDef EXTI_Mode; /*!< Specifies the mode for the EXTI lines.
80 | This parameter can be a value of @ref EXTIMode_TypeDef */
81 |
82 | EXTITrigger_TypeDef EXTI_Trigger; /*!< Specifies the trigger signal active edge for the EXTI lines.
83 | This parameter can be a value of @ref EXTITrigger_TypeDef */
84 |
85 | FunctionalState EXTI_LineCmd; /*!< Specifies the new state of the selected EXTI lines.
86 | This parameter can be set either to ENABLE or DISABLE */
87 | }EXTI_InitTypeDef;
88 |
89 | /* Exported constants --------------------------------------------------------*/
90 |
91 | /** @defgroup EXTI_Exported_Constants
92 | * @{
93 | */
94 |
95 | /** @defgroup EXTI_Lines
96 | * @{
97 | */
98 |
99 | #define EXTI_Line0 ((uint32_t)0x00001) /*!< External interrupt line 0 */
100 | #define EXTI_Line1 ((uint32_t)0x00002) /*!< External interrupt line 1 */
101 | #define EXTI_Line2 ((uint32_t)0x00004) /*!< External interrupt line 2 */
102 | #define EXTI_Line3 ((uint32_t)0x00008) /*!< External interrupt line 3 */
103 | #define EXTI_Line4 ((uint32_t)0x00010) /*!< External interrupt line 4 */
104 | #define EXTI_Line5 ((uint32_t)0x00020) /*!< External interrupt line 5 */
105 | #define EXTI_Line6 ((uint32_t)0x00040) /*!< External interrupt line 6 */
106 | #define EXTI_Line7 ((uint32_t)0x00080) /*!< External interrupt line 7 */
107 | #define EXTI_Line8 ((uint32_t)0x00100) /*!< External interrupt line 8 */
108 | #define EXTI_Line9 ((uint32_t)0x00200) /*!< External interrupt line 9 */
109 | #define EXTI_Line10 ((uint32_t)0x00400) /*!< External interrupt line 10 */
110 | #define EXTI_Line11 ((uint32_t)0x00800) /*!< External interrupt line 11 */
111 | #define EXTI_Line12 ((uint32_t)0x01000) /*!< External interrupt line 12 */
112 | #define EXTI_Line13 ((uint32_t)0x02000) /*!< External interrupt line 13 */
113 | #define EXTI_Line14 ((uint32_t)0x04000) /*!< External interrupt line 14 */
114 | #define EXTI_Line15 ((uint32_t)0x08000) /*!< External interrupt line 15 */
115 | #define EXTI_Line16 ((uint32_t)0x10000) /*!< External interrupt line 16 Connected to the PVD Output */
116 | #define EXTI_Line17 ((uint32_t)0x20000) /*!< External interrupt line 17 Connected to the RTC Alarm event */
117 | #define EXTI_Line18 ((uint32_t)0x40000) /*!< External interrupt line 18 Connected to the USB OTG FS Wakeup from suspend event */
118 | #define EXTI_Line19 ((uint32_t)0x80000) /*!< External interrupt line 19 Connected to the Ethernet Wakeup event */
119 | #define EXTI_Line20 ((uint32_t)0x00100000) /*!< External interrupt line 20 Connected to the USB OTG HS (configured in FS) Wakeup event */
120 | #define EXTI_Line21 ((uint32_t)0x00200000) /*!< External interrupt line 21 Connected to the RTC Tamper and Time Stamp events */
121 | #define EXTI_Line22 ((uint32_t)0x00400000) /*!< External interrupt line 22 Connected to the RTC Wakeup event */
122 |
123 | #define IS_EXTI_LINE(LINE) ((((LINE) & (uint32_t)0xFF800000) == 0x00) && ((LINE) != (uint16_t)0x00))
124 |
125 | #define IS_GET_EXTI_LINE(LINE) (((LINE) == EXTI_Line0) || ((LINE) == EXTI_Line1) || \
126 | ((LINE) == EXTI_Line2) || ((LINE) == EXTI_Line3) || \
127 | ((LINE) == EXTI_Line4) || ((LINE) == EXTI_Line5) || \
128 | ((LINE) == EXTI_Line6) || ((LINE) == EXTI_Line7) || \
129 | ((LINE) == EXTI_Line8) || ((LINE) == EXTI_Line9) || \
130 | ((LINE) == EXTI_Line10) || ((LINE) == EXTI_Line11) || \
131 | ((LINE) == EXTI_Line12) || ((LINE) == EXTI_Line13) || \
132 | ((LINE) == EXTI_Line14) || ((LINE) == EXTI_Line15) || \
133 | ((LINE) == EXTI_Line16) || ((LINE) == EXTI_Line17) || \
134 | ((LINE) == EXTI_Line18) || ((LINE) == EXTI_Line19) || \
135 | ((LINE) == EXTI_Line20) || ((LINE) == EXTI_Line21) ||\
136 | ((LINE) == EXTI_Line22))
137 |
138 | /**
139 | * @}
140 | */
141 |
142 | /**
143 | * @}
144 | */
145 |
146 | /* Exported macro ------------------------------------------------------------*/
147 | /* Exported functions --------------------------------------------------------*/
148 |
149 | /* Function used to set the EXTI configuration to the default reset state *****/
150 | void EXTI_DeInit(void);
151 |
152 | /* Initialization and Configuration functions *********************************/
153 | void EXTI_Init(EXTI_InitTypeDef* EXTI_InitStruct);
154 | void EXTI_StructInit(EXTI_InitTypeDef* EXTI_InitStruct);
155 | void EXTI_GenerateSWInterrupt(uint32_t EXTI_Line);
156 |
157 | /* Interrupts and flags management functions **********************************/
158 | FlagStatus EXTI_GetFlagStatus(uint32_t EXTI_Line);
159 | void EXTI_ClearFlag(uint32_t EXTI_Line);
160 | ITStatus EXTI_GetITStatus(uint32_t EXTI_Line);
161 | void EXTI_ClearITPendingBit(uint32_t EXTI_Line);
162 |
163 | #ifdef __cplusplus
164 | }
165 | #endif
166 |
167 | #endif /* __STM32F4xx_EXTI_H */
168 |
169 | /**
170 | * @}
171 | */
172 |
173 | /**
174 | * @}
175 | */
176 |
177 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
178 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_iwdg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_iwdg.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the IWDG
8 | * firmware library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_IWDG_H
25 | #define __STM32F4xx_IWDG_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup IWDG
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup IWDG_Exported_Constants
46 | * @{
47 | */
48 |
49 | /** @defgroup IWDG_WriteAccess
50 | * @{
51 | */
52 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555)
53 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000)
54 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \
55 | ((ACCESS) == IWDG_WriteAccess_Disable))
56 | /**
57 | * @}
58 | */
59 |
60 | /** @defgroup IWDG_prescaler
61 | * @{
62 | */
63 | #define IWDG_Prescaler_4 ((uint8_t)0x00)
64 | #define IWDG_Prescaler_8 ((uint8_t)0x01)
65 | #define IWDG_Prescaler_16 ((uint8_t)0x02)
66 | #define IWDG_Prescaler_32 ((uint8_t)0x03)
67 | #define IWDG_Prescaler_64 ((uint8_t)0x04)
68 | #define IWDG_Prescaler_128 ((uint8_t)0x05)
69 | #define IWDG_Prescaler_256 ((uint8_t)0x06)
70 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \
71 | ((PRESCALER) == IWDG_Prescaler_8) || \
72 | ((PRESCALER) == IWDG_Prescaler_16) || \
73 | ((PRESCALER) == IWDG_Prescaler_32) || \
74 | ((PRESCALER) == IWDG_Prescaler_64) || \
75 | ((PRESCALER) == IWDG_Prescaler_128)|| \
76 | ((PRESCALER) == IWDG_Prescaler_256))
77 | /**
78 | * @}
79 | */
80 |
81 | /** @defgroup IWDG_Flag
82 | * @{
83 | */
84 | #define IWDG_FLAG_PVU ((uint16_t)0x0001)
85 | #define IWDG_FLAG_RVU ((uint16_t)0x0002)
86 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU))
87 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF)
88 | /**
89 | * @}
90 | */
91 |
92 | /**
93 | * @}
94 | */
95 |
96 | /* Exported macro ------------------------------------------------------------*/
97 | /* Exported functions --------------------------------------------------------*/
98 |
99 | /* Prescaler and Counter configuration functions ******************************/
100 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess);
101 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler);
102 | void IWDG_SetReload(uint16_t Reload);
103 | void IWDG_ReloadCounter(void);
104 |
105 | /* IWDG activation function ***************************************************/
106 | void IWDG_Enable(void);
107 |
108 | /* Flag management function ***************************************************/
109 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG);
110 |
111 | #ifdef __cplusplus
112 | }
113 | #endif
114 |
115 | #endif /* __STM32F4xx_IWDG_H */
116 |
117 | /**
118 | * @}
119 | */
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
126 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_pwr.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_pwr.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the PWR firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_PWR_H
25 | #define __STM32F4xx_PWR_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup PWR
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup PWR_Exported_Constants
46 | * @{
47 | */
48 |
49 | /** @defgroup PWR_PVD_detection_level
50 | * @{
51 | */
52 |
53 | #define PWR_PVDLevel_0 PWR_CR_PLS_LEV0
54 | #define PWR_PVDLevel_1 PWR_CR_PLS_LEV1
55 | #define PWR_PVDLevel_2 PWR_CR_PLS_LEV2
56 | #define PWR_PVDLevel_3 PWR_CR_PLS_LEV3
57 | #define PWR_PVDLevel_4 PWR_CR_PLS_LEV4
58 | #define PWR_PVDLevel_5 PWR_CR_PLS_LEV5
59 | #define PWR_PVDLevel_6 PWR_CR_PLS_LEV6
60 | #define PWR_PVDLevel_7 PWR_CR_PLS_LEV7
61 |
62 | #define IS_PWR_PVD_LEVEL(LEVEL) (((LEVEL) == PWR_PVDLevel_0) || ((LEVEL) == PWR_PVDLevel_1)|| \
63 | ((LEVEL) == PWR_PVDLevel_2) || ((LEVEL) == PWR_PVDLevel_3)|| \
64 | ((LEVEL) == PWR_PVDLevel_4) || ((LEVEL) == PWR_PVDLevel_5)|| \
65 | ((LEVEL) == PWR_PVDLevel_6) || ((LEVEL) == PWR_PVDLevel_7))
66 | /**
67 | * @}
68 | */
69 |
70 |
71 | /** @defgroup PWR_Regulator_state_in_STOP_mode
72 | * @{
73 | */
74 |
75 | #define PWR_Regulator_ON ((uint32_t)0x00000000)
76 | #define PWR_Regulator_LowPower PWR_CR_LPDS
77 | #define IS_PWR_REGULATOR(REGULATOR) (((REGULATOR) == PWR_Regulator_ON) || \
78 | ((REGULATOR) == PWR_Regulator_LowPower))
79 | /**
80 | * @}
81 | */
82 |
83 | /** @defgroup PWR_STOP_mode_entry
84 | * @{
85 | */
86 |
87 | #define PWR_STOPEntry_WFI ((uint8_t)0x01)
88 | #define PWR_STOPEntry_WFE ((uint8_t)0x02)
89 | #define IS_PWR_STOP_ENTRY(ENTRY) (((ENTRY) == PWR_STOPEntry_WFI) || ((ENTRY) == PWR_STOPEntry_WFE))
90 |
91 | /** @defgroup PWR_Regulator_Voltage_Scale
92 | * @{
93 | */
94 |
95 | #define PWR_Regulator_Voltage_Scale1 ((uint32_t)0x00004000)
96 | #define PWR_Regulator_Voltage_Scale2 ((uint32_t)0x00000000)
97 | #define IS_PWR_REGULATOR_VOLTAGE(VOLTAGE) (((VOLTAGE) == PWR_Regulator_Voltage_Scale1) || ((VOLTAGE) == PWR_Regulator_Voltage_Scale2))
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /** @defgroup PWR_Flag
104 | * @{
105 | */
106 |
107 | #define PWR_FLAG_WU PWR_CSR_WUF
108 | #define PWR_FLAG_SB PWR_CSR_SBF
109 | #define PWR_FLAG_PVDO PWR_CSR_PVDO
110 | #define PWR_FLAG_BRR PWR_CSR_BRR
111 | #define PWR_FLAG_VOSRDY PWR_CSR_VOSRDY
112 |
113 | /** @defgroup PWR_Flag_Legacy
114 | * @{
115 | */
116 | #define PWR_FLAG_REGRDY PWR_FLAG_VOSRDY
117 | /**
118 | * @}
119 | */
120 |
121 | #define IS_PWR_GET_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB) || \
122 | ((FLAG) == PWR_FLAG_PVDO) || ((FLAG) == PWR_FLAG_BRR) || \
123 | ((FLAG) == PWR_FLAG_VOSRDY))
124 |
125 | #define IS_PWR_CLEAR_FLAG(FLAG) (((FLAG) == PWR_FLAG_WU) || ((FLAG) == PWR_FLAG_SB))
126 | /**
127 | * @}
128 | */
129 |
130 | /**
131 | * @}
132 | */
133 |
134 | /* Exported macro ------------------------------------------------------------*/
135 | /* Exported functions --------------------------------------------------------*/
136 |
137 | /* Function used to set the PWR configuration to the default reset state ******/
138 | void PWR_DeInit(void);
139 |
140 | /* Backup Domain Access function **********************************************/
141 | void PWR_BackupAccessCmd(FunctionalState NewState);
142 |
143 | /* PVD configuration functions ************************************************/
144 | void PWR_PVDLevelConfig(uint32_t PWR_PVDLevel);
145 | void PWR_PVDCmd(FunctionalState NewState);
146 |
147 | /* WakeUp pins configuration functions ****************************************/
148 | void PWR_WakeUpPinCmd(FunctionalState NewState);
149 |
150 | /* Main and Backup Regulators configuration functions *************************/
151 | void PWR_BackupRegulatorCmd(FunctionalState NewState);
152 | void PWR_MainRegulatorModeConfig(uint32_t PWR_Regulator_Voltage);
153 |
154 | /* FLASH Power Down configuration functions ***********************************/
155 | void PWR_FlashPowerDownCmd(FunctionalState NewState);
156 |
157 | /* Low Power modes configuration functions ************************************/
158 | void PWR_EnterSTOPMode(uint32_t PWR_Regulator, uint8_t PWR_STOPEntry);
159 | void PWR_EnterSTANDBYMode(void);
160 |
161 | /* Flags management functions *************************************************/
162 | FlagStatus PWR_GetFlagStatus(uint32_t PWR_FLAG);
163 | void PWR_ClearFlag(uint32_t PWR_FLAG);
164 |
165 | #ifdef __cplusplus
166 | }
167 | #endif
168 |
169 | #endif /* __STM32F4xx_PWR_H */
170 |
171 | /**
172 | * @}
173 | */
174 |
175 | /**
176 | * @}
177 | */
178 |
179 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
180 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_rng.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_rng.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the Random
8 | * Number Generator(RNG) firmware library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_RNG_H
25 | #define __STM32F4xx_RNG_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup RNG
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup RNG_Exported_Constants
46 | * @{
47 | */
48 |
49 | /** @defgroup RNG_flags_definition
50 | * @{
51 | */
52 | #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */
53 | #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */
54 | #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */
55 |
56 | #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \
57 | ((RNG_FLAG) == RNG_FLAG_CECS) || \
58 | ((RNG_FLAG) == RNG_FLAG_SECS))
59 | #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \
60 | ((RNG_FLAG) == RNG_FLAG_SECS))
61 | /**
62 | * @}
63 | */
64 |
65 | /** @defgroup RNG_interrupts_definition
66 | * @{
67 | */
68 | #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */
69 | #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */
70 |
71 | #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00))
72 | #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI))
73 | /**
74 | * @}
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /* Exported macro ------------------------------------------------------------*/
82 | /* Exported functions --------------------------------------------------------*/
83 |
84 | /* Function used to set the RNG configuration to the default reset state *****/
85 | void RNG_DeInit(void);
86 |
87 | /* Configuration function *****************************************************/
88 | void RNG_Cmd(FunctionalState NewState);
89 |
90 | /* Get 32 bit Random number function ******************************************/
91 | uint32_t RNG_GetRandomNumber(void);
92 |
93 | /* Interrupts and flags management functions **********************************/
94 | void RNG_ITConfig(FunctionalState NewState);
95 | FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG);
96 | void RNG_ClearFlag(uint8_t RNG_FLAG);
97 | ITStatus RNG_GetITStatus(uint8_t RNG_IT);
98 | void RNG_ClearITPendingBit(uint8_t RNG_IT);
99 |
100 | #ifdef __cplusplus
101 | }
102 | #endif
103 |
104 | #endif /*__STM32F4xx_RNG_H */
105 |
106 | /**
107 | * @}
108 | */
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
115 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_syscfg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_syscfg.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the SYSCFG firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_SYSCFG_H
25 | #define __STM32F4xx_SYSCFG_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup SYSCFG
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup SYSCFG_Exported_Constants
46 | * @{
47 | */
48 |
49 | /** @defgroup SYSCFG_EXTI_Port_Sources
50 | * @{
51 | */
52 | #define EXTI_PortSourceGPIOA ((uint8_t)0x00)
53 | #define EXTI_PortSourceGPIOB ((uint8_t)0x01)
54 | #define EXTI_PortSourceGPIOC ((uint8_t)0x02)
55 | #define EXTI_PortSourceGPIOD ((uint8_t)0x03)
56 | #define EXTI_PortSourceGPIOE ((uint8_t)0x04)
57 | #define EXTI_PortSourceGPIOF ((uint8_t)0x05)
58 | #define EXTI_PortSourceGPIOG ((uint8_t)0x06)
59 | #define EXTI_PortSourceGPIOH ((uint8_t)0x07)
60 | #define EXTI_PortSourceGPIOI ((uint8_t)0x08)
61 |
62 | #define IS_EXTI_PORT_SOURCE(PORTSOURCE) (((PORTSOURCE) == EXTI_PortSourceGPIOA) || \
63 | ((PORTSOURCE) == EXTI_PortSourceGPIOB) || \
64 | ((PORTSOURCE) == EXTI_PortSourceGPIOC) || \
65 | ((PORTSOURCE) == EXTI_PortSourceGPIOD) || \
66 | ((PORTSOURCE) == EXTI_PortSourceGPIOE) || \
67 | ((PORTSOURCE) == EXTI_PortSourceGPIOF) || \
68 | ((PORTSOURCE) == EXTI_PortSourceGPIOG) || \
69 | ((PORTSOURCE) == EXTI_PortSourceGPIOH) || \
70 | ((PORTSOURCE) == EXTI_PortSourceGPIOI))
71 | /**
72 | * @}
73 | */
74 |
75 |
76 | /** @defgroup SYSCFG_EXTI_Pin_Sources
77 | * @{
78 | */
79 | #define EXTI_PinSource0 ((uint8_t)0x00)
80 | #define EXTI_PinSource1 ((uint8_t)0x01)
81 | #define EXTI_PinSource2 ((uint8_t)0x02)
82 | #define EXTI_PinSource3 ((uint8_t)0x03)
83 | #define EXTI_PinSource4 ((uint8_t)0x04)
84 | #define EXTI_PinSource5 ((uint8_t)0x05)
85 | #define EXTI_PinSource6 ((uint8_t)0x06)
86 | #define EXTI_PinSource7 ((uint8_t)0x07)
87 | #define EXTI_PinSource8 ((uint8_t)0x08)
88 | #define EXTI_PinSource9 ((uint8_t)0x09)
89 | #define EXTI_PinSource10 ((uint8_t)0x0A)
90 | #define EXTI_PinSource11 ((uint8_t)0x0B)
91 | #define EXTI_PinSource12 ((uint8_t)0x0C)
92 | #define EXTI_PinSource13 ((uint8_t)0x0D)
93 | #define EXTI_PinSource14 ((uint8_t)0x0E)
94 | #define EXTI_PinSource15 ((uint8_t)0x0F)
95 | #define IS_EXTI_PIN_SOURCE(PINSOURCE) (((PINSOURCE) == EXTI_PinSource0) || \
96 | ((PINSOURCE) == EXTI_PinSource1) || \
97 | ((PINSOURCE) == EXTI_PinSource2) || \
98 | ((PINSOURCE) == EXTI_PinSource3) || \
99 | ((PINSOURCE) == EXTI_PinSource4) || \
100 | ((PINSOURCE) == EXTI_PinSource5) || \
101 | ((PINSOURCE) == EXTI_PinSource6) || \
102 | ((PINSOURCE) == EXTI_PinSource7) || \
103 | ((PINSOURCE) == EXTI_PinSource8) || \
104 | ((PINSOURCE) == EXTI_PinSource9) || \
105 | ((PINSOURCE) == EXTI_PinSource10) || \
106 | ((PINSOURCE) == EXTI_PinSource11) || \
107 | ((PINSOURCE) == EXTI_PinSource12) || \
108 | ((PINSOURCE) == EXTI_PinSource13) || \
109 | ((PINSOURCE) == EXTI_PinSource14) || \
110 | ((PINSOURCE) == EXTI_PinSource15))
111 | /**
112 | * @}
113 | */
114 |
115 |
116 | /** @defgroup SYSCFG_Memory_Remap_Config
117 | * @{
118 | */
119 | #define SYSCFG_MemoryRemap_Flash ((uint8_t)0x00)
120 | #define SYSCFG_MemoryRemap_SystemFlash ((uint8_t)0x01)
121 | #define SYSCFG_MemoryRemap_FSMC ((uint8_t)0x02)
122 | #define SYSCFG_MemoryRemap_SRAM ((uint8_t)0x03)
123 |
124 | #define IS_SYSCFG_MEMORY_REMAP_CONFING(REMAP) (((REMAP) == SYSCFG_MemoryRemap_Flash) || \
125 | ((REMAP) == SYSCFG_MemoryRemap_SystemFlash) || \
126 | ((REMAP) == SYSCFG_MemoryRemap_SRAM) || \
127 | ((REMAP) == SYSCFG_MemoryRemap_FSMC))
128 | /**
129 | * @}
130 | */
131 |
132 |
133 | /** @defgroup SYSCFG_ETHERNET_Media_Interface
134 | * @{
135 | */
136 | #define SYSCFG_ETH_MediaInterface_MII ((uint32_t)0x00000000)
137 | #define SYSCFG_ETH_MediaInterface_RMII ((uint32_t)0x00000001)
138 |
139 | #define IS_SYSCFG_ETH_MEDIA_INTERFACE(INTERFACE) (((INTERFACE) == SYSCFG_ETH_MediaInterface_MII) || \
140 | ((INTERFACE) == SYSCFG_ETH_MediaInterface_RMII))
141 | /**
142 | * @}
143 | */
144 |
145 | /**
146 | * @}
147 | */
148 |
149 | /* Exported macro ------------------------------------------------------------*/
150 | /* Exported functions --------------------------------------------------------*/
151 |
152 | void SYSCFG_DeInit(void);
153 | void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap);
154 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex);
155 | void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface);
156 | void SYSCFG_CompensationCellCmd(FunctionalState NewState);
157 | FlagStatus SYSCFG_GetCompensationCellStatus(void);
158 |
159 | #ifdef __cplusplus
160 | }
161 | #endif
162 |
163 | #endif /*__STM32F4xx_SYSCFG_H */
164 |
165 | /**
166 | * @}
167 | */
168 |
169 | /**
170 | * @}
171 | */
172 |
173 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
174 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/inc/stm32f4xx_wwdg.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_wwdg.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file contains all the functions prototypes for the WWDG firmware
8 | * library.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4xx_WWDG_H
25 | #define __STM32F4xx_WWDG_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 |
34 | /** @addtogroup STM32F4xx_StdPeriph_Driver
35 | * @{
36 | */
37 |
38 | /** @addtogroup WWDG
39 | * @{
40 | */
41 |
42 | /* Exported types ------------------------------------------------------------*/
43 | /* Exported constants --------------------------------------------------------*/
44 |
45 | /** @defgroup WWDG_Exported_Constants
46 | * @{
47 | */
48 |
49 | /** @defgroup WWDG_Prescaler
50 | * @{
51 | */
52 |
53 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000)
54 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080)
55 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100)
56 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180)
57 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \
58 | ((PRESCALER) == WWDG_Prescaler_2) || \
59 | ((PRESCALER) == WWDG_Prescaler_4) || \
60 | ((PRESCALER) == WWDG_Prescaler_8))
61 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F)
62 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F))
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /**
69 | * @}
70 | */
71 |
72 | /* Exported macro ------------------------------------------------------------*/
73 | /* Exported functions --------------------------------------------------------*/
74 |
75 | /* Function used to set the WWDG configuration to the default reset state ****/
76 | void WWDG_DeInit(void);
77 |
78 | /* Prescaler, Refresh window and Counter configuration functions **************/
79 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler);
80 | void WWDG_SetWindowValue(uint8_t WindowValue);
81 | void WWDG_EnableIT(void);
82 | void WWDG_SetCounter(uint8_t Counter);
83 |
84 | /* WWDG activation function ***************************************************/
85 | void WWDG_Enable(uint8_t Counter);
86 |
87 | /* Interrupts and flags management functions **********************************/
88 | FlagStatus WWDG_GetFlagStatus(void);
89 | void WWDG_ClearFlag(void);
90 |
91 | #ifdef __cplusplus
92 | }
93 | #endif
94 |
95 | #endif /* __STM32F4xx_WWDG_H */
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_crc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_crc.c
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file provides all the CRC firmware functions.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 | #include "stm32f4xx_crc.h"
24 |
25 | /** @addtogroup STM32F4xx_StdPeriph_Driver
26 | * @{
27 | */
28 |
29 | /** @defgroup CRC
30 | * @brief CRC driver modules
31 | * @{
32 | */
33 |
34 | /* Private typedef -----------------------------------------------------------*/
35 | /* Private define ------------------------------------------------------------*/
36 | /* Private macro -------------------------------------------------------------*/
37 | /* Private variables ---------------------------------------------------------*/
38 | /* Private function prototypes -----------------------------------------------*/
39 | /* Private functions ---------------------------------------------------------*/
40 |
41 | /** @defgroup CRC_Private_Functions
42 | * @{
43 | */
44 |
45 | /**
46 | * @brief Resets the CRC Data register (DR).
47 | * @param None
48 | * @retval None
49 | */
50 | void CRC_ResetDR(void)
51 | {
52 | /* Reset CRC generator */
53 | CRC->CR = CRC_CR_RESET;
54 | }
55 |
56 | /**
57 | * @brief Computes the 32-bit CRC of a given data word(32-bit).
58 | * @param Data: data word(32-bit) to compute its CRC
59 | * @retval 32-bit CRC
60 | */
61 | uint32_t CRC_CalcCRC(uint32_t Data)
62 | {
63 | CRC->DR = Data;
64 |
65 | return (CRC->DR);
66 | }
67 |
68 | /**
69 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit).
70 | * @param pBuffer: pointer to the buffer containing the data to be computed
71 | * @param BufferLength: length of the buffer to be computed
72 | * @retval 32-bit CRC
73 | */
74 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength)
75 | {
76 | uint32_t index = 0;
77 |
78 | for(index = 0; index < BufferLength; index++)
79 | {
80 | CRC->DR = pBuffer[index];
81 | }
82 | return (CRC->DR);
83 | }
84 |
85 | /**
86 | * @brief Returns the current CRC value.
87 | * @param None
88 | * @retval 32-bit CRC
89 | */
90 | uint32_t CRC_GetCRC(void)
91 | {
92 | return (CRC->DR);
93 | }
94 |
95 | /**
96 | * @brief Stores a 8-bit data in the Independent Data(ID) register.
97 | * @param IDValue: 8-bit value to be stored in the ID register
98 | * @retval None
99 | */
100 | void CRC_SetIDRegister(uint8_t IDValue)
101 | {
102 | CRC->IDR = IDValue;
103 | }
104 |
105 | /**
106 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register
107 | * @param None
108 | * @retval 8-bit value of the ID register
109 | */
110 | uint8_t CRC_GetIDRegister(void)
111 | {
112 | return (CRC->IDR);
113 | }
114 |
115 | /**
116 | * @}
117 | */
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | /**
124 | * @}
125 | */
126 |
127 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
128 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_dbgmcu.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_dbgmcu.c
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file provides all the DBGMCU firmware functions.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 | #include "stm32f4xx_dbgmcu.h"
24 |
25 | /** @addtogroup STM32F4xx_StdPeriph_Driver
26 | * @{
27 | */
28 |
29 | /** @defgroup DBGMCU
30 | * @brief DBGMCU driver modules
31 | * @{
32 | */
33 |
34 | /* Private typedef -----------------------------------------------------------*/
35 | /* Private define ------------------------------------------------------------*/
36 | #define IDCODE_DEVID_MASK ((uint32_t)0x00000FFF)
37 |
38 | /* Private macro -------------------------------------------------------------*/
39 | /* Private variables ---------------------------------------------------------*/
40 | /* Private function prototypes -----------------------------------------------*/
41 | /* Private functions ---------------------------------------------------------*/
42 |
43 | /** @defgroup DBGMCU_Private_Functions
44 | * @{
45 | */
46 |
47 | /**
48 | * @brief Returns the device revision identifier.
49 | * @param None
50 | * @retval Device revision identifier
51 | */
52 | uint32_t DBGMCU_GetREVID(void)
53 | {
54 | return(DBGMCU->IDCODE >> 16);
55 | }
56 |
57 | /**
58 | * @brief Returns the device identifier.
59 | * @param None
60 | * @retval Device identifier
61 | */
62 | uint32_t DBGMCU_GetDEVID(void)
63 | {
64 | return(DBGMCU->IDCODE & IDCODE_DEVID_MASK);
65 | }
66 |
67 | /**
68 | * @brief Configures low power mode behavior when the MCU is in Debug mode.
69 | * @param DBGMCU_Periph: specifies the low power mode.
70 | * This parameter can be any combination of the following values:
71 | * @arg DBGMCU_SLEEP: Keep debugger connection during SLEEP mode
72 | * @arg DBGMCU_STOP: Keep debugger connection during STOP mode
73 | * @arg DBGMCU_STANDBY: Keep debugger connection during STANDBY mode
74 | * @param NewState: new state of the specified low power mode in Debug mode.
75 | * This parameter can be: ENABLE or DISABLE.
76 | * @retval None
77 | */
78 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState)
79 | {
80 | /* Check the parameters */
81 | assert_param(IS_DBGMCU_PERIPH(DBGMCU_Periph));
82 | assert_param(IS_FUNCTIONAL_STATE(NewState));
83 | if (NewState != DISABLE)
84 | {
85 | DBGMCU->CR |= DBGMCU_Periph;
86 | }
87 | else
88 | {
89 | DBGMCU->CR &= ~DBGMCU_Periph;
90 | }
91 | }
92 |
93 | /**
94 | * @brief Configures APB1 peripheral behavior when the MCU is in Debug mode.
95 | * @param DBGMCU_Periph: specifies the APB1 peripheral.
96 | * This parameter can be any combination of the following values:
97 | * @arg DBGMCU_TIM2_STOP: TIM2 counter stopped when Core is halted
98 | * @arg DBGMCU_TIM3_STOP: TIM3 counter stopped when Core is halted
99 | * @arg DBGMCU_TIM4_STOP: TIM4 counter stopped when Core is halted
100 | * @arg DBGMCU_TIM5_STOP: TIM5 counter stopped when Core is halted
101 | * @arg DBGMCU_TIM6_STOP: TIM6 counter stopped when Core is halted
102 | * @arg DBGMCU_TIM7_STOP: TIM7 counter stopped when Core is halted
103 | * @arg DBGMCU_TIM12_STOP: TIM12 counter stopped when Core is halted
104 | * @arg DBGMCU_TIM13_STOP: TIM13 counter stopped when Core is halted
105 | * @arg DBGMCU_TIM14_STOP: TIM14 counter stopped when Core is halted
106 | * @arg DBGMCU_RTC_STOP: RTC Calendar and Wakeup counter stopped when Core is halted.
107 | * @arg DBGMCU_WWDG_STOP: Debug WWDG stopped when Core is halted
108 | * @arg DBGMCU_IWDG_STOP: Debug IWDG stopped when Core is halted
109 | * @arg DBGMCU_I2C1_SMBUS_TIMEOUT: I2C1 SMBUS timeout mode stopped when Core is halted
110 | * @arg DBGMCU_I2C2_SMBUS_TIMEOUT: I2C2 SMBUS timeout mode stopped when Core is halted
111 | * @arg DBGMCU_I2C3_SMBUS_TIMEOUT: I2C3 SMBUS timeout mode stopped when Core is halted
112 | * @arg DBGMCU_CAN2_STOP: Debug CAN1 stopped when Core is halted
113 | * @arg DBGMCU_CAN1_STOP: Debug CAN2 stopped when Core is halted
114 | * This parameter can be: ENABLE or DISABLE.
115 | * @retval None
116 | */
117 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
118 | {
119 | /* Check the parameters */
120 | assert_param(IS_DBGMCU_APB1PERIPH(DBGMCU_Periph));
121 | assert_param(IS_FUNCTIONAL_STATE(NewState));
122 |
123 | if (NewState != DISABLE)
124 | {
125 | DBGMCU->APB1FZ |= DBGMCU_Periph;
126 | }
127 | else
128 | {
129 | DBGMCU->APB1FZ &= ~DBGMCU_Periph;
130 | }
131 | }
132 |
133 | /**
134 | * @brief Configures APB2 peripheral behavior when the MCU is in Debug mode.
135 | * @param DBGMCU_Periph: specifies the APB2 peripheral.
136 | * This parameter can be any combination of the following values:
137 | * @arg DBGMCU_TIM1_STOP: TIM1 counter stopped when Core is halted
138 | * @arg DBGMCU_TIM8_STOP: TIM8 counter stopped when Core is halted
139 | * @arg DBGMCU_TIM9_STOP: TIM9 counter stopped when Core is halted
140 | * @arg DBGMCU_TIM10_STOP: TIM10 counter stopped when Core is halted
141 | * @arg DBGMCU_TIM11_STOP: TIM11 counter stopped when Core is halted
142 | * @param NewState: new state of the specified peripheral in Debug mode.
143 | * This parameter can be: ENABLE or DISABLE.
144 | * @retval None
145 | */
146 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState)
147 | {
148 | /* Check the parameters */
149 | assert_param(IS_DBGMCU_APB2PERIPH(DBGMCU_Periph));
150 | assert_param(IS_FUNCTIONAL_STATE(NewState));
151 |
152 | if (NewState != DISABLE)
153 | {
154 | DBGMCU->APB2FZ |= DBGMCU_Periph;
155 | }
156 | else
157 | {
158 | DBGMCU->APB2FZ &= ~DBGMCU_Periph;
159 | }
160 | }
161 |
162 | /**
163 | * @}
164 | */
165 |
166 | /**
167 | * @}
168 | */
169 |
170 | /**
171 | * @}
172 | */
173 |
174 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
175 |
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_flash.c
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_rcc.c
--------------------------------------------------------------------------------
/Libraries/STM32F4xx_StdPeriph_Driver/src/stm32f4xx_syscfg.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_syscfg.c
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 30-September-2011
7 | * @brief This file provides firmware functions to manage the SYSCFG peripheral.
8 | *
9 | * @verbatim
10 | *
11 | * ===================================================================
12 | * How to use this driver
13 | * ===================================================================
14 | *
15 | * This driver provides functions for:
16 | *
17 | * 1. Remapping the memory accessible in the code area using SYSCFG_MemoryRemapConfig()
18 | *
19 | * 2. Manage the EXTI lines connection to the GPIOs using SYSCFG_EXTILineConfig()
20 | *
21 | * 3. Select the ETHERNET media interface (RMII/RII) using SYSCFG_ETH_MediaInterfaceConfig()
22 | *
23 | * @note SYSCFG APB clock must be enabled to get write access to SYSCFG registers,
24 | * using RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
25 | *
26 | * @endverbatim
27 | *
28 | ******************************************************************************
29 | * @attention
30 | *
31 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
32 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
33 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
34 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
35 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
36 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
37 | *
38 | * © COPYRIGHT 2011 STMicroelectronics
39 | ******************************************************************************
40 | */
41 |
42 | /* Includes ------------------------------------------------------------------*/
43 | #include "stm32f4xx_syscfg.h"
44 | #include "stm32f4xx_rcc.h"
45 |
46 | /** @addtogroup STM32F4xx_StdPeriph_Driver
47 | * @{
48 | */
49 |
50 | /** @defgroup SYSCFG
51 | * @brief SYSCFG driver modules
52 | * @{
53 | */
54 |
55 | /* Private typedef -----------------------------------------------------------*/
56 | /* Private define ------------------------------------------------------------*/
57 | /* ------------ RCC registers bit address in the alias region ----------- */
58 | #define SYSCFG_OFFSET (SYSCFG_BASE - PERIPH_BASE)
59 | /* --- PMC Register ---*/
60 | /* Alias word address of MII_RMII_SEL bit */
61 | #define PMC_OFFSET (SYSCFG_OFFSET + 0x04)
62 | #define MII_RMII_SEL_BitNumber ((uint8_t)0x17)
63 | #define PMC_MII_RMII_SEL_BB (PERIPH_BB_BASE + (PMC_OFFSET * 32) + (MII_RMII_SEL_BitNumber * 4))
64 |
65 | /* --- CMPCR Register ---*/
66 | /* Alias word address of CMP_PD bit */
67 | #define CMPCR_OFFSET (SYSCFG_OFFSET + 0x20)
68 | #define CMP_PD_BitNumber ((uint8_t)0x00)
69 | #define CMPCR_CMP_PD_BB (PERIPH_BB_BASE + (CMPCR_OFFSET * 32) + (CMP_PD_BitNumber * 4))
70 |
71 | /* Private macro -------------------------------------------------------------*/
72 | /* Private variables ---------------------------------------------------------*/
73 | /* Private function prototypes -----------------------------------------------*/
74 | /* Private functions ---------------------------------------------------------*/
75 |
76 | /** @defgroup SYSCFG_Private_Functions
77 | * @{
78 | */
79 |
80 | /**
81 | * @brief Deinitializes the Alternate Functions (remap and EXTI configuration)
82 | * registers to their default reset values.
83 | * @param None
84 | * @retval None
85 | */
86 | void SYSCFG_DeInit(void)
87 | {
88 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, ENABLE);
89 | RCC_APB2PeriphResetCmd(RCC_APB2Periph_SYSCFG, DISABLE);
90 | }
91 |
92 | /**
93 | * @brief Changes the mapping of the specified pin.
94 | * @param SYSCFG_Memory: selects the memory remapping.
95 | * This parameter can be one of the following values:
96 | * @arg SYSCFG_MemoryRemap_Flash: Main Flash memory mapped at 0x00000000
97 | * @arg SYSCFG_MemoryRemap_SystemFlash: System Flash memory mapped at 0x00000000
98 | * @arg SYSCFG_MemoryRemap_FSMC: FSMC (Bank1 (NOR/PSRAM 1 and 2) mapped at 0x00000000
99 | * @arg SYSCFG_MemoryRemap_SRAM: Embedded SRAM (112kB) mapped at 0x00000000
100 | * @retval None
101 | */
102 | void SYSCFG_MemoryRemapConfig(uint8_t SYSCFG_MemoryRemap)
103 | {
104 | /* Check the parameters */
105 | assert_param(IS_SYSCFG_MEMORY_REMAP_CONFING(SYSCFG_MemoryRemap));
106 |
107 | SYSCFG->MEMRMP = SYSCFG_MemoryRemap;
108 | }
109 |
110 | /**
111 | * @brief Selects the GPIO pin used as EXTI Line.
112 | * @param EXTI_PortSourceGPIOx : selects the GPIO port to be used as source for
113 | * EXTI lines where x can be (A..I).
114 | * @param EXTI_PinSourcex: specifies the EXTI line to be configured.
115 | * This parameter can be EXTI_PinSourcex where x can be (0..15, except
116 | * for EXTI_PortSourceGPIOI x can be (0..11).
117 | * @retval None
118 | */
119 | void SYSCFG_EXTILineConfig(uint8_t EXTI_PortSourceGPIOx, uint8_t EXTI_PinSourcex)
120 | {
121 | uint32_t tmp = 0x00;
122 |
123 | /* Check the parameters */
124 | assert_param(IS_EXTI_PORT_SOURCE(EXTI_PortSourceGPIOx));
125 | assert_param(IS_EXTI_PIN_SOURCE(EXTI_PinSourcex));
126 |
127 | tmp = ((uint32_t)0x0F) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03));
128 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] &= ~tmp;
129 | SYSCFG->EXTICR[EXTI_PinSourcex >> 0x02] |= (((uint32_t)EXTI_PortSourceGPIOx) << (0x04 * (EXTI_PinSourcex & (uint8_t)0x03)));
130 | }
131 |
132 | /**
133 | * @brief Selects the ETHERNET media interface
134 | * @param SYSCFG_ETH_MediaInterface: specifies the Media Interface mode.
135 | * This parameter can be one of the following values:
136 | * @arg SYSCFG_ETH_MediaInterface_MII: MII mode selected
137 | * @arg SYSCFG_ETH_MediaInterface_RMII: RMII mode selected
138 | * @retval None
139 | */
140 | void SYSCFG_ETH_MediaInterfaceConfig(uint32_t SYSCFG_ETH_MediaInterface)
141 | {
142 | assert_param(IS_SYSCFG_ETH_MEDIA_INTERFACE(SYSCFG_ETH_MediaInterface));
143 | /* Configure MII_RMII selection bit */
144 | *(__IO uint32_t *) PMC_MII_RMII_SEL_BB = SYSCFG_ETH_MediaInterface;
145 | }
146 |
147 | /**
148 | * @brief Enables or disables the I/O Compensation Cell.
149 | * @note The I/O compensation cell can be used only when the device supply
150 | * voltage ranges from 2.4 to 3.6 V.
151 | * @param NewState: new state of the I/O Compensation Cell.
152 | * This parameter can be one of the following values:
153 | * @arg ENABLE: I/O compensation cell enabled
154 | * @arg DISABLE: I/O compensation cell power-down mode
155 | * @retval None
156 | */
157 | void SYSCFG_CompensationCellCmd(FunctionalState NewState)
158 | {
159 | /* Check the parameters */
160 | assert_param(IS_FUNCTIONAL_STATE(NewState));
161 |
162 | *(__IO uint32_t *) CMPCR_CMP_PD_BB = (uint32_t)NewState;
163 | }
164 |
165 | /**
166 | * @brief Checks whether the I/O Compensation Cell ready flag is set or not.
167 | * @param None
168 | * @retval The new state of the I/O Compensation Cell ready flag (SET or RESET)
169 | */
170 | FlagStatus SYSCFG_GetCompensationCellStatus(void)
171 | {
172 | FlagStatus bitstatus = RESET;
173 |
174 | if ((SYSCFG->CMPCR & SYSCFG_CMPCR_READY ) != (uint32_t)RESET)
175 | {
176 | bitstatus = SET;
177 | }
178 | else
179 | {
180 | bitstatus = RESET;
181 | }
182 | return bitstatus;
183 | }
184 |
185 | /**
186 | * @}
187 | */
188 |
189 | /**
190 | * @}
191 | */
192 |
193 | /**
194 | * @}
195 | */
196 |
197 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
198 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Class/audio/inc/usbd_audio_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_audio_core.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief header file for the usbd_audio_core.c file.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 |
24 | #ifndef __USB_AUDIO_CORE_H_
25 | #define __USB_AUDIO_CORE_H_
26 |
27 | #include "usbd_ioreq.h"
28 | #include "usbd_req.h"
29 | #include "usbd_desc.h"
30 |
31 |
32 |
33 |
34 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
35 | * @{
36 | */
37 |
38 | /** @defgroup usbd_audio
39 | * @brief This file is the Header file for USBD_audio.c
40 | * @{
41 | */
42 |
43 |
44 | /** @defgroup usbd_audio_Exported_Defines
45 | * @{
46 | */
47 |
48 | /* AudioFreq * DataSize (2 bytes) * NumChannels (Stereo: 2) */
49 | #define AUDIO_OUT_PACKET (uint32_t)(((USBD_AUDIO_FREQ * 2 * 2) /1000))
50 | #define AUDIO_IN_PACKET (uint32_t)(((USBD_IN_AUDIO_FREQ * 2 * 1) /1000)) //16000 -> 32
51 |
52 |
53 | #define AUDIO_CONFIG_DESC_SIZE 109
54 | #define AUDIO_INTERFACE_DESC_SIZE 9
55 | #define USB_AUDIO_DESC_SIZ 0x09
56 | #define AUDIO_STANDARD_ENDPOINT_DESC_SIZE 0x09
57 | #define AUDIO_STREAMING_ENDPOINT_DESC_SIZE 0x07
58 |
59 | #define AUDIO_DESCRIPTOR_TYPE 0x21
60 | #define USB_DEVICE_CLASS_AUDIO 0x01
61 | #define AUDIO_SUBCLASS_AUDIOCONTROL 0x01
62 | #define AUDIO_SUBCLASS_AUDIOSTREAMING 0x02
63 | #define AUDIO_PROTOCOL_UNDEFINED 0x00
64 | #define AUDIO_STREAMING_GENERAL 0x01
65 | #define AUDIO_STREAMING_FORMAT_TYPE 0x02
66 |
67 | /* Audio Descriptor Types */
68 | #define AUDIO_INTERFACE_DESCRIPTOR_TYPE 0x24
69 | #define AUDIO_ENDPOINT_DESCRIPTOR_TYPE 0x25
70 |
71 | /* Audio Control Interface Descriptor Subtypes */
72 | #define AUDIO_CONTROL_HEADER 0x01
73 | #define AUDIO_CONTROL_INPUT_TERMINAL 0x02
74 | #define AUDIO_CONTROL_OUTPUT_TERMINAL 0x03
75 | #define AUDIO_CONTROL_FEATURE_UNIT 0x06
76 |
77 | #define AUDIO_INPUT_TERMINAL_DESC_SIZE 0x0C
78 | #define AUDIO_OUTPUT_TERMINAL_DESC_SIZE 0x09
79 | #define AUDIO_STREAMING_INTERFACE_DESC_SIZE 0x07
80 |
81 | #define AUDIO_CONTROL_MUTE 0x0001
82 |
83 | #define AUDIO_FORMAT_TYPE_I 0x01
84 | #define AUDIO_FORMAT_TYPE_III 0x03
85 |
86 | #define USB_ENDPOINT_TYPE_ISOCHRONOUS 0x01//00 = No Synchronization
87 | #define AUDIO_ENDPOINT_GENERAL 0x01
88 | #define USB_ENDPOINT_TYPE_asynchronous 0x05
89 |
90 | #define AUDIO_REQ_GET_CUR 0x81
91 | #define AUDIO_REQ_SET_CUR 0x01
92 |
93 | #define AUDIO_OUT_STREAMING_CTRL 0x02
94 |
95 | /**
96 | * @}
97 | */
98 |
99 |
100 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
101 | * @{
102 | */
103 | typedef struct _Audio_Fops
104 | {
105 | uint8_t (*Init) (uint32_t AudioFreq, uint32_t Volume, uint32_t options);
106 | uint8_t (*DeInit) (uint32_t options);
107 | uint8_t (*AudioCmd) (uint8_t* pbuf, uint32_t size, uint8_t cmd);
108 | uint8_t (*VolumeCtl) (uint8_t vol);
109 | uint8_t (*MuteCtl) (uint8_t cmd);
110 | uint8_t (*PeriodicTC) (uint8_t cmd);
111 | uint8_t (*GetState) (void);
112 | }AUDIO_FOPS_TypeDef;
113 | /**
114 | * @}
115 | */
116 |
117 |
118 |
119 | /** @defgroup USBD_CORE_Exported_Macros
120 | * @{
121 | */
122 | #define AUDIO_PACKET_SZE(frq) (uint8_t)(((frq * 2 * 2)/1000) & 0xFF), \
123 | (uint8_t)((((frq * 2 * 2)/1000) >> 8) & 0xFF)
124 | #define SAMPLE_FREQ(frq) (uint8_t)(frq), (uint8_t)((frq >> 8)), (uint8_t)((frq >> 16))
125 | /**
126 | * @}
127 | */
128 |
129 | /** @defgroup USBD_CORE_Exported_Variables
130 | * @{
131 | */
132 |
133 | extern USBD_Class_cb_TypeDef AUDIO_cb;
134 |
135 | /**
136 | * @}
137 | */
138 |
139 | /** @defgroup USB_CORE_Exported_Functions
140 | * @{
141 | */
142 | /**
143 | * @}
144 | */
145 |
146 | #endif // __USB_AUDIO_CORE_H_
147 | /**
148 | * @}
149 | */
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | void send_data(void);
156 |
157 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
158 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Class/audio/src/usbd_audio_core.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Libraries/STM32_USB_Device_Library/Class/audio/src/usbd_audio_core.c
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_conf_template.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_conf_template.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief usb device configuration template file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __USBD_CONF__H__
24 | #define __USBD_CONF__H__
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f2xx.h"
28 |
29 |
30 |
31 | /** @defgroup USB_CONF_Exported_Defines
32 | * @{
33 | */
34 | #define USE_USB_OTG_HS
35 |
36 | #define USBD_CFG_MAX_NUM 1
37 | #define USB_MAX_STR_DESC_SIZ 64
38 | #define USBD_EP0_MAX_PACKET_SIZE 64
39 |
40 | /**
41 | * @}
42 | */
43 |
44 |
45 | /** @defgroup USB_CONF_Exported_Types
46 | * @{
47 | */
48 | /**
49 | * @}
50 | */
51 |
52 |
53 | /** @defgroup USB_CONF_Exported_Macros
54 | * @{
55 | */
56 | /**
57 | * @}
58 | */
59 |
60 | /** @defgroup USB_CONF_Exported_Variables
61 | * @{
62 | */
63 | /**
64 | * @}
65 | */
66 |
67 | /** @defgroup USB_CONF_Exported_FunctionsPrototype
68 | * @{
69 | */
70 | /**
71 | * @}
72 | */
73 |
74 |
75 | #endif //__USBD_CONF__H__
76 |
77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
78 |
79 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_core.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief Header file for usbd_core.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USBD_CORE_H
30 | #define __USBD_CORE_H
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usb_dcd.h"
34 | #include "usbd_def.h"
35 | #include "usbd_conf.h"
36 |
37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_CORE
42 | * @brief This file is the Header file for usbd_core.c file
43 | * @{
44 | */
45 |
46 |
47 | /** @defgroup USBD_CORE_Exported_Defines
48 | * @{
49 | */
50 |
51 | typedef enum {
52 | USBD_OK = 0,
53 | USBD_BUSY,
54 | USBD_FAIL,
55 | }USBD_Status;
56 | /**
57 | * @}
58 | */
59 |
60 |
61 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
62 | * @{
63 | */
64 |
65 |
66 | /**
67 | * @}
68 | */
69 |
70 |
71 |
72 | /** @defgroup USBD_CORE_Exported_Macros
73 | * @{
74 | */
75 |
76 | /**
77 | * @}
78 | */
79 |
80 | /** @defgroup USBD_CORE_Exported_Variables
81 | * @{
82 | */
83 |
84 | /**
85 | * @}
86 | */
87 |
88 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype
89 | * @{
90 | */
91 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev,
92 | USB_OTG_CORE_ID_TypeDef coreID,
93 | USBD_DEVICE *pDevice,
94 | USBD_Class_cb_TypeDef *class_cb,
95 | USBD_Usr_cb_TypeDef *usr_cb);
96 |
97 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev);
98 |
99 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
100 |
101 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx);
102 |
103 | /**
104 | * @}
105 | */
106 |
107 | #endif /* __USBD_CORE_H */
108 |
109 | /**
110 | * @}
111 | */
112 |
113 | /**
114 | * @}
115 | */
116 |
117 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
118 |
119 |
120 |
121 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_def.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief general defines for the usb device library
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 |
30 | #ifndef __USBD_DEF_H
31 | #define __USBD_DEF_H
32 |
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "usbd_conf.h"
35 |
36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
37 | * @{
38 | */
39 |
40 | /** @defgroup USB_DEF
41 | * @brief general defines for the usb device library file
42 | * @{
43 | */
44 |
45 | /** @defgroup USB_DEF_Exported_Defines
46 | * @{
47 | */
48 |
49 | #ifndef NULL
50 | #define NULL 0
51 | #endif
52 |
53 | #define USB_LEN_DEV_QUALIFIER_DESC 0x0A
54 | #define USB_LEN_DEV_DESC 0x12
55 | #define USB_LEN_CFG_DESC 0x09
56 | #define USB_LEN_IF_DESC 0x09
57 | #define USB_LEN_EP_DESC 0x07
58 | #define USB_LEN_OTG_DESC 0x03
59 |
60 | #define USBD_IDX_LANGID_STR 0x00
61 | #define USBD_IDX_MFC_STR 0x01
62 | #define USBD_IDX_PRODUCT_STR 0x02
63 | #define USBD_IDX_SERIAL_STR 0x03
64 | #define USBD_IDX_CONFIG_STR 0x04
65 | #define USBD_IDX_INTERFACE_STR 0x05
66 |
67 | #define USB_REQ_TYPE_STANDARD 0x00
68 | #define USB_REQ_TYPE_CLASS 0x20
69 | #define USB_REQ_TYPE_VENDOR 0x40
70 | #define USB_REQ_TYPE_MASK 0x60
71 |
72 | #define USB_REQ_RECIPIENT_DEVICE 0x00
73 | #define USB_REQ_RECIPIENT_INTERFACE 0x01
74 | #define USB_REQ_RECIPIENT_ENDPOINT 0x02
75 | #define USB_REQ_RECIPIENT_MASK 0x03
76 |
77 | #define USB_REQ_GET_STATUS 0x00
78 | #define USB_REQ_CLEAR_FEATURE 0x01
79 | #define USB_REQ_SET_FEATURE 0x03
80 | #define USB_REQ_SET_ADDRESS 0x05
81 | #define USB_REQ_GET_DESCRIPTOR 0x06
82 | #define USB_REQ_SET_DESCRIPTOR 0x07
83 | #define USB_REQ_GET_CONFIGURATION 0x08
84 | #define USB_REQ_SET_CONFIGURATION 0x09
85 | #define USB_REQ_GET_INTERFACE 0x0A
86 | #define USB_REQ_SET_INTERFACE 0x0B
87 | #define USB_REQ_SYNCH_FRAME 0x0C
88 |
89 | #define USB_DESC_TYPE_DEVICE 1
90 | #define USB_DESC_TYPE_CONFIGURATION 2
91 | #define USB_DESC_TYPE_STRING 3
92 | #define USB_DESC_TYPE_INTERFACE 4
93 | #define USB_DESC_TYPE_ENDPOINT 5
94 | #define USB_DESC_TYPE_DEVICE_QUALIFIER 6
95 | #define USB_DESC_TYPE_OTHER_SPEED_CONFIGURATION 7
96 |
97 |
98 | #define USB_CONFIG_REMOTE_WAKEUP 2
99 | #define USB_CONFIG_SELF_POWERED 1
100 |
101 | #define USB_FEATURE_EP_HALT 0
102 | #define USB_FEATURE_REMOTE_WAKEUP 1
103 | #define USB_FEATURE_TEST_MODE 2
104 |
105 | /**
106 | * @}
107 | */
108 |
109 |
110 | /** @defgroup USBD_DEF_Exported_TypesDefinitions
111 | * @{
112 | */
113 | /**
114 | * @}
115 | */
116 |
117 |
118 |
119 | /** @defgroup USBD_DEF_Exported_Macros
120 | * @{
121 | */
122 | #define SWAPBYTE(addr) (((uint16_t)(*((uint8_t *)(addr)))) + \
123 | (((uint16_t)(*(((uint8_t *)(addr)) + 1))) << 8))
124 |
125 | #define LOBYTE(x) ((uint8_t)(x & 0x00FF))
126 | #define HIBYTE(x) ((uint8_t)((x & 0xFF00) >>8))
127 | /**
128 | * @}
129 | */
130 |
131 | /** @defgroup USBD_DEF_Exported_Variables
132 | * @{
133 | */
134 |
135 | /**
136 | * @}
137 | */
138 |
139 | /** @defgroup USBD_DEF_Exported_FunctionsPrototype
140 | * @{
141 | */
142 |
143 | /**
144 | * @}
145 | */
146 |
147 | #endif /* __USBD_DEF_H */
148 |
149 | /**
150 | * @}
151 | */
152 |
153 | /**
154 | * @}
155 | */
156 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
157 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief header file for the usbd_ioreq.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 |
30 | #ifndef __USBD_IOREQ_H_
31 | #define __USBD_IOREQ_H_
32 |
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "usbd_def.h"
35 | #include "usbd_core.h"
36 |
37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_IOREQ
42 | * @brief header file for the usbd_ioreq.c file
43 | * @{
44 | */
45 |
46 | /** @defgroup USBD_IOREQ_Exported_Defines
47 | * @{
48 | */
49 | /**
50 | * @}
51 | */
52 |
53 |
54 | /** @defgroup USBD_IOREQ_Exported_Types
55 | * @{
56 | */
57 |
58 |
59 | /**
60 | * @}
61 | */
62 |
63 |
64 |
65 | /** @defgroup USBD_IOREQ_Exported_Macros
66 | * @{
67 | */
68 |
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBD_IOREQ_Exported_Variables
74 | * @{
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
82 | * @{
83 | */
84 |
85 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev,
86 | uint8_t *buf,
87 | uint16_t len);
88 |
89 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev,
90 | uint8_t *pbuf,
91 | uint16_t len);
92 |
93 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev,
94 | uint8_t *pbuf,
95 | uint16_t len);
96 |
97 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev,
98 | uint8_t *pbuf,
99 | uint16_t len);
100 |
101 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev);
102 |
103 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev);
104 |
105 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev ,
106 | uint8_t epnum);
107 |
108 | /**
109 | * @}
110 | */
111 |
112 | #endif /* __USBD_IOREQ_H_ */
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /**
119 | * @}
120 | */
121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
122 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_req.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_req.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief header file for the usbd_req.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 |
30 | #ifndef __USB_REQUEST_H_
31 | #define __USB_REQUEST_H_
32 |
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "usbd_def.h"
35 | #include "usbd_core.h"
36 | #include "usbd_conf.h"
37 |
38 |
39 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
40 | * @{
41 | */
42 |
43 | /** @defgroup USBD_REQ
44 | * @brief header file for the usbd_ioreq.c file
45 | * @{
46 | */
47 |
48 | /** @defgroup USBD_REQ_Exported_Defines
49 | * @{
50 | */
51 | /**
52 | * @}
53 | */
54 |
55 |
56 | /** @defgroup USBD_REQ_Exported_Types
57 | * @{
58 | */
59 | /**
60 | * @}
61 | */
62 |
63 |
64 |
65 | /** @defgroup USBD_REQ_Exported_Macros
66 | * @{
67 | */
68 | /**
69 | * @}
70 | */
71 |
72 | /** @defgroup USBD_REQ_Exported_Variables
73 | * @{
74 | */
75 | /**
76 | * @}
77 | */
78 |
79 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype
80 | * @{
81 | */
82 |
83 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
84 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
85 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req);
86 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev,
87 | USB_SETUP_REQ *req);
88 |
89 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev,
90 | USB_SETUP_REQ *req);
91 |
92 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len);
93 | /**
94 | * @}
95 | */
96 |
97 | #endif /* __USB_REQUEST_H_ */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /**
104 | * @}
105 | */
106 |
107 |
108 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
109 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/inc/usbd_usr.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_usr.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief Header file for usbd_usr.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USBD_USR_H__
30 | #define __USBD_USR_H__
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usbd_core.h"
34 |
35 |
36 | /** @addtogroup USBD_USER
37 | * @{
38 | */
39 |
40 | /** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS
41 | * @{
42 | */
43 |
44 | /** @defgroup USBD_USR
45 | * @brief This file is the Header file for usbd_usr.c
46 | * @{
47 | */
48 |
49 |
50 | /** @defgroup USBD_USR_Exported_Types
51 | * @{
52 | */
53 |
54 | extern USBD_Usr_cb_TypeDef USR_cb;
55 | extern USBD_Usr_cb_TypeDef USR_FS_cb;
56 | extern USBD_Usr_cb_TypeDef USR_HS_cb;
57 |
58 |
59 |
60 | /**
61 | * @}
62 | */
63 |
64 |
65 |
66 | /** @defgroup USBD_USR_Exported_Defines
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @defgroup USBD_USR_Exported_Macros
75 | * @{
76 | */
77 | /**
78 | * @}
79 | */
80 |
81 | /** @defgroup USBD_USR_Exported_Variables
82 | * @{
83 | */
84 |
85 | void USBD_USR_Init(void);
86 | void USBD_USR_DeviceReset (uint8_t speed);
87 | void USBD_USR_DeviceConfigured (void);
88 | void USBD_USR_DeviceSuspended(void);
89 | void USBD_USR_DeviceResumed(void);
90 |
91 | void USBD_USR_DeviceConnected(void);
92 | void USBD_USR_DeviceDisconnected(void);
93 |
94 | void USBD_USR_FS_Init(void);
95 | void USBD_USR_FS_DeviceReset (uint8_t speed);
96 | void USBD_USR_FS_DeviceConfigured (void);
97 | void USBD_USR_FS_DeviceSuspended(void);
98 | void USBD_USR_FS_DeviceResumed(void);
99 |
100 | void USBD_USR_FS_DeviceConnected(void);
101 | void USBD_USR_FS_DeviceDisconnected(void);
102 |
103 | void USBD_USR_HS_Init(void);
104 | void USBD_USR_HS_DeviceReset (uint8_t speed);
105 | void USBD_USR_HS_DeviceConfigured (void);
106 | void USBD_USR_HS_DeviceSuspended(void);
107 | void USBD_USR_HS_DeviceResumed(void);
108 |
109 | void USBD_USR_HS_DeviceConnected(void);
110 | void USBD_USR_HS_DeviceDisconnected(void);
111 |
112 | /**
113 | * @}
114 | */
115 |
116 | /** @defgroup USBD_USR_Exported_FunctionsPrototype
117 | * @{
118 | */
119 | /**
120 | * @}
121 | */
122 |
123 | #endif /*__USBD_USR_H__*/
124 |
125 | /**
126 | * @}
127 | */
128 |
129 | /**
130 | * @}
131 | */
132 |
133 | /**
134 | * @}
135 | */
136 |
137 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
138 |
139 |
140 |
141 |
142 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_Device_Library/Core/src/usbd_ioreq.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.c
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief This file provides the IO requests APIs for control endpoints.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_ioreq.h"
30 |
31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 |
36 | /** @defgroup USBD_IOREQ
37 | * @brief control I/O requests module
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USBD_IOREQ_Private_Defines
50 | * @{
51 | */
52 |
53 | /**
54 | * @}
55 | */
56 |
57 |
58 | /** @defgroup USBD_IOREQ_Private_Macros
59 | * @{
60 | */
61 | /**
62 | * @}
63 | */
64 |
65 |
66 | /** @defgroup USBD_IOREQ_Private_Variables
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 |
75 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes
76 | * @{
77 | */
78 | /**
79 | * @}
80 | */
81 |
82 |
83 | /** @defgroup USBD_IOREQ_Private_Functions
84 | * @{
85 | */
86 |
87 | /**
88 | * @brief USBD_CtlSendData
89 | * send data on the ctl pipe
90 | * @param pdev: device instance
91 | * @param buff: pointer to data buffer
92 | * @param len: length of data to be sent
93 | * @retval status
94 | */
95 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev,
96 | uint8_t *pbuf,
97 | uint16_t len)
98 | {
99 | USBD_Status ret = USBD_OK;
100 |
101 | pdev->dev.in_ep[0].total_data_len = len;
102 | pdev->dev.in_ep[0].rem_data_len = len;
103 | pdev->dev.device_state = USB_OTG_EP0_DATA_IN;
104 |
105 | DCD_EP_Tx (pdev, 0, pbuf, len);
106 |
107 | return ret;
108 | }
109 |
110 | /**
111 | * @brief USBD_CtlContinueSendData
112 | * continue sending data on the ctl pipe
113 | * @param pdev: device instance
114 | * @param buff: pointer to data buffer
115 | * @param len: length of data to be sent
116 | * @retval status
117 | */
118 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev,
119 | uint8_t *pbuf,
120 | uint16_t len)
121 | {
122 | USBD_Status ret = USBD_OK;
123 |
124 | DCD_EP_Tx (pdev, 0, pbuf, len);
125 |
126 |
127 | return ret;
128 | }
129 |
130 | /**
131 | * @brief USBD_CtlPrepareRx
132 | * receive data on the ctl pipe
133 | * @param pdev: USB OTG device instance
134 | * @param buff: pointer to data buffer
135 | * @param len: length of data to be received
136 | * @retval status
137 | */
138 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev,
139 | uint8_t *pbuf,
140 | uint16_t len)
141 | {
142 | USBD_Status ret = USBD_OK;
143 |
144 | pdev->dev.out_ep[0].total_data_len = len;
145 | pdev->dev.out_ep[0].rem_data_len = len;
146 | pdev->dev.device_state = USB_OTG_EP0_DATA_OUT;
147 |
148 | DCD_EP_PrepareRx (pdev,
149 | 0,
150 | pbuf,
151 | len);
152 |
153 |
154 | return ret;
155 | }
156 |
157 | /**
158 | * @brief USBD_CtlContinueRx
159 | * continue receive data on the ctl pipe
160 | * @param pdev: USB OTG device instance
161 | * @param buff: pointer to data buffer
162 | * @param len: length of data to be received
163 | * @retval status
164 | */
165 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev,
166 | uint8_t *pbuf,
167 | uint16_t len)
168 | {
169 | USBD_Status ret = USBD_OK;
170 |
171 | DCD_EP_PrepareRx (pdev,
172 | 0,
173 | pbuf,
174 | len);
175 | return ret;
176 | }
177 | /**
178 | * @brief USBD_CtlSendStatus
179 | * send zero lzngth packet on the ctl pipe
180 | * @param pdev: USB OTG device instance
181 | * @retval status
182 | */
183 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev)
184 | {
185 | USBD_Status ret = USBD_OK;
186 | pdev->dev.device_state = USB_OTG_EP0_STATUS_IN;
187 | DCD_EP_Tx (pdev,
188 | 0,
189 | NULL,
190 | 0);
191 |
192 | USB_OTG_EP0_OutStart(pdev);
193 |
194 | return ret;
195 | }
196 |
197 | /**
198 | * @brief USBD_CtlReceiveStatus
199 | * receive zero lzngth packet on the ctl pipe
200 | * @param pdev: USB OTG device instance
201 | * @retval status
202 | */
203 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev)
204 | {
205 | USBD_Status ret = USBD_OK;
206 | pdev->dev.device_state = USB_OTG_EP0_STATUS_OUT;
207 | DCD_EP_PrepareRx ( pdev,
208 | 0,
209 | NULL,
210 | 0);
211 |
212 | USB_OTG_EP0_OutStart(pdev);
213 |
214 | return ret;
215 | }
216 |
217 |
218 | /**
219 | * @brief USBD_GetRxCount
220 | * returns the received data length
221 | * @param pdev: USB OTG device instance
222 | * epnum: endpoint index
223 | * @retval Rx Data blength
224 | */
225 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum)
226 | {
227 | return pdev->dev.out_ep[epnum].xfer_count;
228 | }
229 |
230 | /**
231 | * @}
232 | */
233 |
234 |
235 | /**
236 | * @}
237 | */
238 |
239 |
240 | /**
241 | * @}
242 | */
243 |
244 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
245 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_OTG_Driver/inc/usb_bsp.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_bsp.h
4 | * @author MCD Application Team
5 | * @version V2.1.0
6 | * @date 19-March-2012
7 | * @brief Specific api's relative to the used hardware platform
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USB_BSP__H__
30 | #define __USB_BSP__H__
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usb_core.h"
34 | #include "usb_conf.h"
35 |
36 | /** @addtogroup USB_OTG_DRIVER
37 | * @{
38 | */
39 |
40 | /** @defgroup USB_BSP
41 | * @brief This file is the
42 | * @{
43 | */
44 |
45 |
46 | /** @defgroup USB_BSP_Exported_Defines
47 | * @{
48 | */
49 | /**
50 | * @}
51 | */
52 |
53 |
54 | /** @defgroup USB_BSP_Exported_Types
55 | * @{
56 | */
57 | /**
58 | * @}
59 | */
60 |
61 |
62 | /** @defgroup USB_BSP_Exported_Macros
63 | * @{
64 | */
65 | /**
66 | * @}
67 | */
68 |
69 | /** @defgroup USB_BSP_Exported_Variables
70 | * @{
71 | */
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup USB_BSP_Exported_FunctionsPrototype
77 | * @{
78 | */
79 | void BSP_Init(void);
80 |
81 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev);
82 | void USB_OTG_BSP_uDelay (const uint32_t usec);
83 | void USB_OTG_BSP_mDelay (const uint32_t msec);
84 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev);
85 | #ifdef USE_HOST_MODE
86 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev);
87 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state);
88 | #endif
89 | /**
90 | * @}
91 | */
92 |
93 | #endif //__USB_BSP__H__
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /**
100 | * @}
101 | */
102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
103 |
104 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_dcd.h
4 | * @author MCD Application Team
5 | * @version V2.1.0
6 | * @date 19-March-2012
7 | * @brief Peripheral Driver Header file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __DCD_H__
30 | #define __DCD_H__
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usb_core.h"
34 |
35 |
36 | /** @addtogroup USB_OTG_DRIVER
37 | * @{
38 | */
39 |
40 | /** @defgroup USB_DCD
41 | * @brief This file is the
42 | * @{
43 | */
44 |
45 |
46 | /** @defgroup USB_DCD_Exported_Defines
47 | * @{
48 | */
49 | #define USB_OTG_EP_CONTROL 0
50 | #define USB_OTG_EP_ISOC 1
51 | #define USB_OTG_EP_BULK 2
52 | #define USB_OTG_EP_INT 3
53 | #define USB_OTG_EP_MASK 3
54 |
55 | /* Device Status */
56 | #define USB_OTG_DEFAULT 1
57 | #define USB_OTG_ADDRESSED 2
58 | #define USB_OTG_CONFIGURED 3
59 | #define USB_OTG_SUSPENDED 4
60 |
61 | /**
62 | * @}
63 | */
64 |
65 |
66 | /** @defgroup USB_DCD_Exported_Types
67 | * @{
68 | */
69 | /********************************************************************************
70 | Data structure type
71 | ********************************************************************************/
72 | typedef struct
73 | {
74 | uint8_t bLength;
75 | uint8_t bDescriptorType;
76 | uint8_t bEndpointAddress;
77 | uint8_t bmAttributes;
78 | uint16_t wMaxPacketSize;
79 | uint8_t bInterval;
80 | }
81 | EP_DESCRIPTOR , *PEP_DESCRIPTOR;
82 |
83 | /**
84 | * @}
85 | */
86 |
87 |
88 | /** @defgroup USB_DCD_Exported_Macros
89 | * @{
90 | */
91 | /**
92 | * @}
93 | */
94 |
95 | /** @defgroup USB_DCD_Exported_Variables
96 | * @{
97 | */
98 | /**
99 | * @}
100 | */
101 |
102 | /** @defgroup USB_DCD_Exported_FunctionsPrototype
103 | * @{
104 | */
105 | /********************************************************************************
106 | EXPORTED FUNCTION FROM THE USB-OTG LAYER
107 | ********************************************************************************/
108 | void DCD_Init(USB_OTG_CORE_HANDLE *pdev ,
109 | USB_OTG_CORE_ID_TypeDef coreID);
110 |
111 | void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev);
112 | void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev);
113 | void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev,
114 | uint8_t address);
115 | uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev ,
116 | uint8_t ep_addr,
117 | uint16_t ep_mps,
118 | uint8_t ep_type);
119 |
120 | uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev,
121 | uint8_t ep_addr);
122 |
123 |
124 | uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev,
125 | uint8_t ep_addr,
126 | uint8_t *pbuf,
127 | uint16_t buf_len);
128 |
129 | uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev,
130 | uint8_t ep_addr,
131 | uint8_t *pbuf,
132 | uint32_t buf_len);
133 | uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev,
134 | uint8_t epnum);
135 | uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev,
136 | uint8_t epnum);
137 | uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev,
138 | uint8_t epnum);
139 | uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev);
140 |
141 | uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev ,
142 | uint8_t epnum);
143 |
144 | void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev ,
145 | uint8_t epnum ,
146 | uint32_t Status);
147 |
148 | /**
149 | * @}
150 | */
151 |
152 |
153 | #endif //__DCD_H__
154 |
155 |
156 | /**
157 | * @}
158 | */
159 |
160 | /**
161 | * @}
162 | */
163 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
164 |
165 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_OTG_Driver/inc/usb_dcd_int.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_dcd_int.h
4 | * @author MCD Application Team
5 | * @version V2.1.0
6 | * @date 19-March-2012
7 | * @brief Peripheral Device Interface Layer
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef USB_DCD_INT_H__
30 | #define USB_DCD_INT_H__
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usb_dcd.h"
34 |
35 |
36 |
37 | /** @addtogroup USB_OTG_DRIVER
38 | * @{
39 | */
40 |
41 | /** @defgroup USB_DCD_INT
42 | * @brief This file is the
43 | * @{
44 | */
45 |
46 |
47 | /** @defgroup USB_DCD_INT_Exported_Defines
48 | * @{
49 | */
50 |
51 | typedef struct _USBD_DCD_INT
52 | {
53 | uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
54 | uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum);
55 | uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev);
56 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev);
57 | uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev);
58 | uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev);
59 | uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev);
60 | uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev);
61 | uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev);
62 |
63 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev);
64 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev);
65 |
66 | }USBD_DCD_INT_cb_TypeDef;
67 |
68 | extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops;
69 | /**
70 | * @}
71 | */
72 |
73 |
74 | /** @defgroup USB_DCD_INT_Exported_Types
75 | * @{
76 | */
77 | /**
78 | * @}
79 | */
80 |
81 | /** @defgroup USB_DCD_INT_Exported_Macros
82 | * @{
83 | */
84 |
85 | #define CLEAR_IN_EP_INTR(epnum,intr) \
86 | diepint.d32=0; \
87 | diepint.b.intr = 1; \
88 | USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32);
89 |
90 | #define CLEAR_OUT_EP_INTR(epnum,intr) \
91 | doepint.d32=0; \
92 | doepint.b.intr = 1; \
93 | USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[epnum]->DOEPINT,doepint.d32);
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /** @defgroup USB_DCD_INT_Exported_Variables
100 | * @{
101 | */
102 | /**
103 | * @}
104 | */
105 |
106 | /** @defgroup USB_DCD_INT_Exported_FunctionsPrototype
107 | * @{
108 | */
109 |
110 | uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev);
111 |
112 | /**
113 | * @}
114 | */
115 |
116 |
117 | #endif // USB_DCD_INT_H__
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | /**
124 | * @}
125 | */
126 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
127 |
128 |
--------------------------------------------------------------------------------
/Libraries/STM32_USB_OTG_Driver/inc/usb_defines.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_defines.h
4 | * @author MCD Application Team
5 | * @version V2.1.0
6 | * @date 19-March-2012
7 | * @brief Header of the Core Layer
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive inclusion -------------------------------------*/
29 | #ifndef __USB_DEF_H__
30 | #define __USB_DEF_H__
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | #include "usb_conf.h"
34 |
35 | /** @addtogroup USB_OTG_DRIVER
36 | * @{
37 | */
38 |
39 | /** @defgroup USB_DEFINES
40 | * @brief This file is the
41 | * @{
42 | */
43 |
44 |
45 | /** @defgroup USB_DEFINES_Exported_Defines
46 | * @{
47 | */
48 | /**
49 | * @}
50 | */
51 |
52 |
53 | /** @defgroup _CORE_DEFINES_
54 | * @{
55 | */
56 |
57 | #define USB_OTG_SPEED_PARAM_HIGH 0
58 | #define USB_OTG_SPEED_PARAM_HIGH_IN_FULL 1
59 | #define USB_OTG_SPEED_PARAM_FULL 3
60 |
61 | #define USB_OTG_SPEED_HIGH 0
62 | #define USB_OTG_SPEED_FULL 1
63 |
64 | #define USB_OTG_ULPI_PHY 1
65 | #define USB_OTG_EMBEDDED_PHY 2
66 |
67 | /**
68 | * @}
69 | */
70 |
71 |
72 | /** @defgroup _GLOBAL_DEFINES_
73 | * @{
74 | */
75 | #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
76 | #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
77 | #define GAHBCFG_GLBINT_ENABLE 1
78 | #define GAHBCFG_INT_DMA_BURST_SINGLE 0
79 | #define GAHBCFG_INT_DMA_BURST_INCR 1
80 | #define GAHBCFG_INT_DMA_BURST_INCR4 3
81 | #define GAHBCFG_INT_DMA_BURST_INCR8 5
82 | #define GAHBCFG_INT_DMA_BURST_INCR16 7
83 | #define GAHBCFG_DMAENABLE 1
84 | #define GAHBCFG_TXFEMPTYLVL_EMPTY 1
85 | #define GAHBCFG_TXFEMPTYLVL_HALFEMPTY 0
86 | #define GRXSTS_PKTSTS_IN 2
87 | #define GRXSTS_PKTSTS_IN_XFER_COMP 3
88 | #define GRXSTS_PKTSTS_DATA_TOGGLE_ERR 5
89 | #define GRXSTS_PKTSTS_CH_HALTED 7
90 | /**
91 | * @}
92 | */
93 |
94 |
95 | /** @defgroup _OnTheGo_DEFINES_
96 | * @{
97 | */
98 | #define MODE_HNP_SRP_CAPABLE 0
99 | #define MODE_SRP_ONLY_CAPABLE 1
100 | #define MODE_NO_HNP_SRP_CAPABLE 2
101 | #define MODE_SRP_CAPABLE_DEVICE 3
102 | #define MODE_NO_SRP_CAPABLE_DEVICE 4
103 | #define MODE_SRP_CAPABLE_HOST 5
104 | #define MODE_NO_SRP_CAPABLE_HOST 6
105 | #define A_HOST 1
106 | #define A_SUSPEND 2
107 | #define A_PERIPHERAL 3
108 | #define B_PERIPHERAL 4
109 | #define B_HOST 5
110 | #define DEVICE_MODE 0
111 | #define HOST_MODE 1
112 | #define OTG_MODE 2
113 | /**
114 | * @}
115 | */
116 |
117 |
118 | /** @defgroup __DEVICE_DEFINES_
119 | * @{
120 | */
121 | #define DSTS_ENUMSPD_HS_PHY_30MHZ_OR_60MHZ 0
122 | #define DSTS_ENUMSPD_FS_PHY_30MHZ_OR_60MHZ 1
123 | #define DSTS_ENUMSPD_LS_PHY_6MHZ 2
124 | #define DSTS_ENUMSPD_FS_PHY_48MHZ 3
125 |
126 | #define DCFG_FRAME_INTERVAL_80 0
127 | #define DCFG_FRAME_INTERVAL_85 1
128 | #define DCFG_FRAME_INTERVAL_90 2
129 | #define DCFG_FRAME_INTERVAL_95 3
130 |
131 | #define DEP0CTL_MPS_64 0
132 | #define DEP0CTL_MPS_32 1
133 | #define DEP0CTL_MPS_16 2
134 | #define DEP0CTL_MPS_8 3
135 |
136 | #define EP_SPEED_LOW 0
137 | #define EP_SPEED_FULL 1
138 | #define EP_SPEED_HIGH 2
139 |
140 | #define EP_TYPE_CTRL 0
141 | #define EP_TYPE_ISOC 1
142 | #define EP_TYPE_BULK 2
143 | #define EP_TYPE_INTR 3
144 | #define EP_TYPE_MSK 3
145 |
146 | #define STS_GOUT_NAK 1
147 | #define STS_DATA_UPDT 2
148 | #define STS_XFER_COMP 3
149 | #define STS_SETUP_COMP 4
150 | #define STS_SETUP_UPDT 6
151 | /**
152 | * @}
153 | */
154 |
155 |
156 | /** @defgroup __HOST_DEFINES_
157 | * @{
158 | */
159 | #define HC_PID_DATA0 0
160 | #define HC_PID_DATA2 1
161 | #define HC_PID_DATA1 2
162 | #define HC_PID_SETUP 3
163 |
164 | #define HPRT0_PRTSPD_HIGH_SPEED 0
165 | #define HPRT0_PRTSPD_FULL_SPEED 1
166 | #define HPRT0_PRTSPD_LOW_SPEED 2
167 |
168 | #define HCFG_30_60_MHZ 0
169 | #define HCFG_48_MHZ 1
170 | #define HCFG_6_MHZ 2
171 |
172 | #define HCCHAR_CTRL 0
173 | #define HCCHAR_ISOC 1
174 | #define HCCHAR_BULK 2
175 | #define HCCHAR_INTR 3
176 |
177 | #define MIN(a, b) (((a) < (b)) ? (a) : (b))
178 |
179 | /**
180 | * @}
181 | */
182 |
183 |
184 | /** @defgroup USB_DEFINES_Exported_Types
185 | * @{
186 | */
187 |
188 | typedef enum
189 | {
190 | USB_OTG_HS_CORE_ID = 0,
191 | USB_OTG_FS_CORE_ID = 1
192 | }USB_OTG_CORE_ID_TypeDef;
193 | /**
194 | * @}
195 | */
196 |
197 |
198 | /** @defgroup USB_DEFINES_Exported_Macros
199 | * @{
200 | */
201 | /**
202 | * @}
203 | */
204 |
205 | /** @defgroup USB_DEFINES_Exported_Variables
206 | * @{
207 | */
208 | /**
209 | * @}
210 | */
211 |
212 | /** @defgroup USB_DEFINES_Exported_FunctionsPrototype
213 | * @{
214 | */
215 | /**
216 | * @}
217 | */
218 |
219 |
220 | /** @defgroup Internal_Macro's
221 | * @{
222 | */
223 | #define USB_OTG_READ_REG32(reg) (*(__IO uint32_t *)reg)
224 | #define USB_OTG_WRITE_REG32(reg,value) (*(__IO uint32_t *)reg = value)
225 | #define USB_OTG_MODIFY_REG32(reg,clear_mask,set_mask) \
226 | USB_OTG_WRITE_REG32(reg, (((USB_OTG_READ_REG32(reg)) & ~clear_mask) | set_mask ) )
227 |
228 | /********************************************************************************
229 | ENUMERATION TYPE
230 | ********************************************************************************/
231 | enum USB_OTG_SPEED {
232 | USB_SPEED_UNKNOWN = 0,
233 | USB_SPEED_LOW,
234 | USB_SPEED_FULL,
235 | USB_SPEED_HIGH
236 | };
237 |
238 | #endif //__USB_DEFINES__H__
239 |
240 |
241 | /**
242 | * @}
243 | */
244 |
245 | /**
246 | * @}
247 | */
248 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
249 |
250 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | This is USB microphone realization for STM32F4-DISCOVERY.
2 | MEMS microphone installed at the board is used in this project.
3 |
4 | Проект USB микрофона для STM32F4-DISCOVERY.
5 |
6 | http://we.easyelectronics.ru/STM32/usb-mikrofon-na-baze-stm32f4-discovery.html
7 |
8 | See: https://github.com/iliasam/stm32f4-discovery_sound_playback if you need just audio playback.
9 |
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/libPDMFilter_GCC.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Utilities/STM32F4-Discovery/libPDMFilter_GCC.a
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/libPDMFilter_IAR.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Utilities/STM32F4-Discovery/libPDMFilter_IAR.a
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/libPDMFilter_Keil.lib:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Utilities/STM32F4-Discovery/libPDMFilter_Keil.lib
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/pdm_filter.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file pdm_filter.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 28-October-2011
7 | * @brief Header file for PDM audio software decoding Library.
8 | * This Library is used to decode and reconstruct the audio signal
9 | * produced by MP45DT02 MEMS microphone from STMicroelectronics.
10 | * For more details about this Library, please refer to document
11 | * "PDM audio software decoding on STM32 microcontrollers (AN3998)".
12 | ******************************************************************************
13 | * @attention
14 | *
15 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
16 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
17 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
18 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
19 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
20 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
21 | *
22 | * © COPYRIGHT 2011 STMicroelectronics
23 | ******************************************************************************
24 | */
25 |
26 | /* Define to prevent recursive inclusion -------------------------------------*/
27 | #ifndef __PDM_FILTER_H
28 | #define __PDM_FILTER_H
29 |
30 | #ifdef __cplusplus
31 | extern "C" {
32 | #endif
33 |
34 | /* Includes ------------------------------------------------------------------*/
35 | #include
36 |
37 | /* Exported types ------------------------------------------------------------*/
38 | typedef struct {
39 | uint16_t Fs;
40 | float LP_HZ;
41 | float HP_HZ;
42 | uint16_t In_MicChannels;
43 | uint16_t Out_MicChannels;
44 | char InternalFilter[34];
45 | } PDMFilter_InitStruct;
46 |
47 | /* Exported constants --------------------------------------------------------*/
48 | /* Exported macros -----------------------------------------------------------*/
49 | #define HTONS(A) ((((u16)(A) & 0xff00) >> 8) | \
50 | (((u16)(A) & 0x00ff) << 8))
51 |
52 | /* Exported functions ------------------------------------------------------- */
53 | void PDM_Filter_Init(PDMFilter_InitStruct * Filter);
54 |
55 | int32_t PDM_Filter_64_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
56 | int32_t PDM_Filter_80_MSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
57 | int32_t PDM_Filter_64_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
58 | int32_t PDM_Filter_80_LSB(uint8_t* data, uint16_t* dataOut, uint16_t MicGain, PDMFilter_InitStruct * Filter);
59 |
60 | #ifdef __cplusplus
61 | }
62 | #endif
63 |
64 | #endif /* __PDM_FILTER_H */
65 |
66 | /*******************(C)COPYRIGHT 2011 STMicroelectronics *****END OF FILE******/
67 |
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/stm32f4_discovery.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4_discovery.c
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 28-October-2011
7 | * @brief This file provides set of firmware functions to manage Leds and
8 | * push-button available on STM32F4-Discovery Kit from STMicroelectronics.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Includes ------------------------------------------------------------------*/
24 | #include "stm32f4_discovery.h"
25 |
26 | /** @addtogroup Utilities
27 | * @{
28 | */
29 |
30 | /** @addtogroup STM32F4_DISCOVERY
31 | * @{
32 | */
33 |
34 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL
35 | * @brief This file provides set of firmware functions to manage Leds and push-button
36 | * available on STM32F4-Discovery Kit from STMicroelectronics.
37 | * @{
38 | */
39 |
40 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_TypesDefinitions
41 | * @{
42 | */
43 | /**
44 | * @}
45 | */
46 |
47 |
48 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_Defines
49 | * @{
50 | */
51 | /**
52 | * @}
53 | */
54 |
55 |
56 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_Macros
57 | * @{
58 | */
59 | /**
60 | * @}
61 | */
62 |
63 |
64 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_Variables
65 | * @{
66 | */
67 | GPIO_TypeDef* GPIO_PORT[LEDn] = {LED4_GPIO_PORT, LED3_GPIO_PORT, LED5_GPIO_PORT,
68 | LED6_GPIO_PORT};
69 | const uint16_t GPIO_PIN[LEDn] = {LED4_PIN, LED3_PIN, LED5_PIN,
70 | LED6_PIN};
71 | const uint32_t GPIO_CLK[LEDn] = {LED4_GPIO_CLK, LED3_GPIO_CLK, LED5_GPIO_CLK,
72 | LED6_GPIO_CLK};
73 |
74 | GPIO_TypeDef* BUTTON_PORT[BUTTONn] = {USER_BUTTON_GPIO_PORT };
75 |
76 | const uint16_t BUTTON_PIN[BUTTONn] = {USER_BUTTON_PIN };
77 |
78 | const uint32_t BUTTON_CLK[BUTTONn] = {USER_BUTTON_GPIO_CLK };
79 |
80 | const uint16_t BUTTON_EXTI_LINE[BUTTONn] = {USER_BUTTON_EXTI_LINE };
81 |
82 | const uint8_t BUTTON_PORT_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PORT_SOURCE};
83 |
84 | const uint8_t BUTTON_PIN_SOURCE[BUTTONn] = {USER_BUTTON_EXTI_PIN_SOURCE };
85 | const uint8_t BUTTON_IRQn[BUTTONn] = {USER_BUTTON_EXTI_IRQn };
86 |
87 | NVIC_InitTypeDef NVIC_InitStructure;
88 |
89 | /**
90 | * @}
91 | */
92 |
93 |
94 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_FunctionPrototypes
95 | * @{
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Private_Functions
103 | * @{
104 | */
105 |
106 | /**
107 | * @brief Configures LED GPIO.
108 | * @param Led: Specifies the Led to be configured.
109 | * This parameter can be one of following parameters:
110 | * @arg LED4
111 | * @arg LED3
112 | * @arg LED5
113 | * @arg LED6
114 | * @retval None
115 | */
116 | void STM_EVAL_LEDInit(Led_TypeDef Led)
117 | {
118 | GPIO_InitTypeDef GPIO_InitStructure;
119 |
120 | /* Enable the GPIO_LED Clock */
121 | RCC_AHB1PeriphClockCmd(GPIO_CLK[Led], ENABLE);
122 |
123 | /* Configure the GPIO_LED pin */
124 | GPIO_InitStructure.GPIO_Pin = GPIO_PIN[Led];
125 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_OUT;
126 | GPIO_InitStructure.GPIO_OType = GPIO_OType_PP;
127 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_UP;
128 | GPIO_InitStructure.GPIO_Speed = GPIO_Speed_50MHz;
129 | GPIO_Init(GPIO_PORT[Led], &GPIO_InitStructure);
130 | }
131 |
132 | /**
133 | * @brief Turns selected LED On.
134 | * @param Led: Specifies the Led to be set on.
135 | * This parameter can be one of following parameters:
136 | * @arg LED4
137 | * @arg LED3
138 | * @arg LED5
139 | * @arg LED6
140 | * @retval None
141 | */
142 | void STM_EVAL_LEDOn(Led_TypeDef Led)
143 | {
144 | GPIO_PORT[Led]->BSRRL = GPIO_PIN[Led];
145 | }
146 |
147 | /**
148 | * @brief Turns selected LED Off.
149 | * @param Led: Specifies the Led to be set off.
150 | * This parameter can be one of following parameters:
151 | * @arg LED4
152 | * @arg LED3
153 | * @arg LED5
154 | * @arg LED6
155 | * @retval None
156 | */
157 | void STM_EVAL_LEDOff(Led_TypeDef Led)
158 | {
159 | GPIO_PORT[Led]->BSRRH = GPIO_PIN[Led];
160 | }
161 |
162 | /**
163 | * @brief Toggles the selected LED.
164 | * @param Led: Specifies the Led to be toggled.
165 | * This parameter can be one of following parameters:
166 | * @arg LED4
167 | * @arg LED3
168 | * @arg LED5
169 | * @arg LED6
170 | * @retval None
171 | */
172 | void STM_EVAL_LEDToggle(Led_TypeDef Led)
173 | {
174 | GPIO_PORT[Led]->ODR ^= GPIO_PIN[Led];
175 | }
176 |
177 | /**
178 | * @brief Configures Button GPIO and EXTI Line.
179 | * @param Button: Specifies the Button to be configured.
180 | * This parameter should be: BUTTON_USER
181 | * @param Button_Mode: Specifies Button mode.
182 | * This parameter can be one of following parameters:
183 | * @arg BUTTON_MODE_GPIO: Button will be used as simple IO
184 | * @arg BUTTON_MODE_EXTI: Button will be connected to EXTI line with interrupt
185 | * generation capability
186 | * @retval None
187 | */
188 | void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode)
189 | {
190 | GPIO_InitTypeDef GPIO_InitStructure;
191 | EXTI_InitTypeDef EXTI_InitStructure;
192 | NVIC_InitTypeDef NVIC_InitStructure;
193 |
194 | /* Enable the BUTTON Clock */
195 | RCC_AHB1PeriphClockCmd(BUTTON_CLK[Button], ENABLE);
196 | RCC_APB2PeriphClockCmd(RCC_APB2Periph_SYSCFG, ENABLE);
197 |
198 | /* Configure Button pin as input */
199 | GPIO_InitStructure.GPIO_Mode = GPIO_Mode_IN;
200 | GPIO_InitStructure.GPIO_PuPd = GPIO_PuPd_NOPULL;
201 | GPIO_InitStructure.GPIO_Pin = BUTTON_PIN[Button];
202 | GPIO_Init(BUTTON_PORT[Button], &GPIO_InitStructure);
203 |
204 | if (Button_Mode == BUTTON_MODE_EXTI)
205 | {
206 | /* Connect Button EXTI Line to Button GPIO Pin */
207 | SYSCFG_EXTILineConfig(BUTTON_PORT_SOURCE[Button], BUTTON_PIN_SOURCE[Button]);
208 |
209 | /* Configure Button EXTI line */
210 | EXTI_InitStructure.EXTI_Line = BUTTON_EXTI_LINE[Button];
211 | EXTI_InitStructure.EXTI_Mode = EXTI_Mode_Interrupt;
212 | EXTI_InitStructure.EXTI_Trigger = EXTI_Trigger_Rising;
213 | EXTI_InitStructure.EXTI_LineCmd = ENABLE;
214 | EXTI_Init(&EXTI_InitStructure);
215 |
216 | /* Enable and set Button EXTI Interrupt to the lowest priority */
217 | NVIC_InitStructure.NVIC_IRQChannel = BUTTON_IRQn[Button];
218 | NVIC_InitStructure.NVIC_IRQChannelPreemptionPriority = 0x0F;
219 | NVIC_InitStructure.NVIC_IRQChannelSubPriority = 0x0F;
220 | NVIC_InitStructure.NVIC_IRQChannelCmd = ENABLE;
221 |
222 | NVIC_Init(&NVIC_InitStructure);
223 | }
224 | }
225 |
226 | /**
227 | * @brief Returns the selected Button state.
228 | * @param Button: Specifies the Button to be checked.
229 | * This parameter should be: BUTTON_USER
230 | * @retval The Button GPIO pin value.
231 | */
232 | uint32_t STM_EVAL_PBGetState(Button_TypeDef Button)
233 | {
234 | return GPIO_ReadInputDataBit(BUTTON_PORT[Button], BUTTON_PIN[Button]);
235 | }
236 |
237 | /**
238 | * @}
239 | */
240 |
241 | /**
242 | * @}
243 | */
244 |
245 | /**
246 | * @}
247 | */
248 |
249 | /**
250 | * @}
251 | */
252 |
253 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
254 |
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/stm32f4_discovery.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4_discovery.h
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 28-October-2011
7 | * @brief This file contains definitions for STM32F4-Discovery Kit's Leds and
8 | * push-button hardware resources.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
18 | *
19 | * © COPYRIGHT 2011 STMicroelectronics
20 | ******************************************************************************
21 | */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __STM32F4_DISCOVERY_H
25 | #define __STM32F4_DISCOVERY_H
26 |
27 | #ifdef __cplusplus
28 | extern "C" {
29 | #endif
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "stm32f4xx.h"
33 | #include "stm32f4xx_gpio.h"
34 | #include "stm32f4xx_syscfg.h"
35 | #include "stm32f4xx_rcc.h"
36 | #include "stm32f4xx_exti.h"
37 | #include "misc.h"
38 |
39 | /** @addtogroup Utilities
40 | * @{
41 | */
42 |
43 | /** @addtogroup STM32F4_DISCOVERY
44 | * @{
45 | */
46 |
47 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL
48 | * @{
49 | */
50 |
51 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Types
52 | * @{
53 | */
54 | typedef enum
55 | {
56 | LED4 = 0,
57 | LED3 = 1,
58 | LED5 = 2,
59 | LED6 = 3
60 | } Led_TypeDef;
61 |
62 | typedef enum
63 | {
64 | BUTTON_USER = 0,
65 | } Button_TypeDef;
66 |
67 | typedef enum
68 | {
69 | BUTTON_MODE_GPIO = 0,
70 | BUTTON_MODE_EXTI = 1
71 | } ButtonMode_TypeDef;
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Constants
77 | * @{
78 | */
79 |
80 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_LED
81 | * @{
82 | */
83 | #define LEDn 4
84 |
85 | #define LED4_PIN GPIO_Pin_12
86 | #define LED4_GPIO_PORT GPIOD
87 | #define LED4_GPIO_CLK RCC_AHB1Periph_GPIOD
88 |
89 | #define LED3_PIN GPIO_Pin_13
90 | #define LED3_GPIO_PORT GPIOD
91 | #define LED3_GPIO_CLK RCC_AHB1Periph_GPIOD
92 |
93 | #define LED5_PIN GPIO_Pin_14
94 | #define LED5_GPIO_PORT GPIOD
95 | #define LED5_GPIO_CLK RCC_AHB1Periph_GPIOD
96 |
97 | #define LED6_PIN GPIO_Pin_15
98 | #define LED6_GPIO_PORT GPIOD
99 | #define LED6_GPIO_CLK RCC_AHB1Periph_GPIOD
100 | /**
101 | * @}
102 | */
103 |
104 | /** @addtogroup STM32F4_DISCOVERY_LOW_LEVEL_BUTTON
105 | * @{
106 | */
107 | #define BUTTONn 1
108 |
109 | /**
110 | * @brief Wakeup push-button
111 | */
112 | #define USER_BUTTON_PIN GPIO_Pin_0
113 | #define USER_BUTTON_GPIO_PORT GPIOA
114 | #define USER_BUTTON_GPIO_CLK RCC_AHB1Periph_GPIOA
115 | #define USER_BUTTON_EXTI_LINE EXTI_Line0
116 | #define USER_BUTTON_EXTI_PORT_SOURCE EXTI_PortSourceGPIOA
117 | #define USER_BUTTON_EXTI_PIN_SOURCE EXTI_PinSource0
118 | #define USER_BUTTON_EXTI_IRQn EXTI0_IRQn
119 | /**
120 | * @}
121 | */
122 |
123 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Macros
124 | * @{
125 | */
126 | /**
127 | * @}
128 | */
129 |
130 |
131 | /** @defgroup STM32F4_DISCOVERY_LOW_LEVEL_Exported_Functions
132 | * @{
133 | */
134 | void STM_EVAL_LEDInit(Led_TypeDef Led);
135 | void STM_EVAL_LEDOn(Led_TypeDef Led);
136 | void STM_EVAL_LEDOff(Led_TypeDef Led);
137 | void STM_EVAL_LEDToggle(Led_TypeDef Led);
138 | void STM_EVAL_PBInit(Button_TypeDef Button, ButtonMode_TypeDef Button_Mode);
139 | uint32_t STM_EVAL_PBGetState(Button_TypeDef Button);
140 | /**
141 | * @}
142 | */
143 |
144 | #ifdef __cplusplus
145 | }
146 | #endif
147 |
148 | #endif /* __STM32F4_DISCOVERY_H */
149 | /**
150 | * @}
151 | */
152 |
153 | /**
154 | * @}
155 | */
156 |
157 | /**
158 | * @}
159 | */
160 |
161 |
162 |
163 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
164 |
--------------------------------------------------------------------------------
/Utilities/STM32F4-Discovery/stm32f4_discovery_audio_codec.c:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/iliasam/STM32F4_USB_MICROPHONE/7fba59d68673fb96226769612abd1cc256fcfa42/Utilities/STM32F4-Discovery/stm32f4_discovery_audio_codec.c
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/STM32F4-Discovery_audio.eww:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | $WS_DIR$\STM32F4-Discovery_audio.ewp
6 |
7 |
8 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_Demo.cspy.bat:
--------------------------------------------------------------------------------
1 | @REM This batch file has been generated by the IAR Embedded Workbench
2 | @REM C-SPY Debugger, as an aid to preparing a command line for running
3 | @REM the cspybat command line utility using the appropriate settings.
4 | @REM
5 | @REM You can launch cspybat by typing the name of this batch file followed
6 | @REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
7 | @REM Note that this file is generated every time a new debug session
8 | @REM is initialized, so you may want to move or rename the file before
9 | @REM making changes.
10 | @REM
11 |
12 |
13 | "C:\Program Files\IAR Systems\Embedded Workbench 6.30\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armstlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armbat.dll" --flash_loader "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\config\flashloader\ST\FlashSTM32F4xxx.board" --backend -B "--endian=little" "--cpu=Cortex-M4" "--fpu=VFPv4" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\CONFIG\debugger\ST\iostm32f4xxx.ddf" "--drv_verify_download" "--semihosting" "--device=STM32F4xxx" "--stlink_interface=SWD" "--stlink_reset_strategy=0,0" "--drv_swo_clock_setup=72000000,0,2000000"
14 |
15 |
16 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_Demo.dbgdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 201307
10 |
11 |
12 |
13 |
14 |
15 | 2098026165
16 |
17 |
18 |
19 |
20 |
21 |
22 | 270272727
23 |
24 |
25 |
26 |
27 |
28 | - Disassembly
- _I0
29 |
30 |
31 |
32 | - 500
- 20
33 |
34 |
35 |
36 | 00
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | TabID-28414-16991
46 | Debug Log
47 | Debug-Log
48 |
49 |
50 |
51 | TabID-27891-17001
52 | Build
53 | Build
54 |
55 |
56 |
57 |
58 | 0
59 |
60 |
61 | TabID-6394-16995
62 | Workspace
63 | Workspace
64 |
65 |
66 | STM32F4-Discovery_DemoSTM32F4-Discovery_Demo/User
67 |
68 |
69 |
70 | 0
71 |
72 |
73 | TabID-17143-16998
74 | Disassembly
75 | Disassembly
76 |
77 |
78 |
79 |
80 | 0
81 |
82 |
83 |
84 |
85 |
86 | TextEditor$WS_DIR$\..\main.c053228722870TextEditor$WS_DIR$\..\stm32f4xx_it.c021658825902TextEditor$WS_DIR$\..\..\Libraries\STM32_USB_Device_Library\Class\hid\src\usbd_hid_core.c039210584105840100000010000001
87 |
88 |
89 |
90 |
91 |
92 |
93 | iaridepm.enu1debuggergui.enu1armstlink.enu1-2-2395344-2-2200200146413291545253294578717-2-2395198-2-2200200146413291545146413578717-2-21981368-2-213702001002928291545146413291545
94 |
95 |
96 |
97 |
98 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_Demo.dni:
--------------------------------------------------------------------------------
1 | [DebugChecksum]
2 | Checksum=894966980
3 | [Exceptions]
4 | StopOnUncaught=_ 0
5 | StopOnThrow=_ 0
6 | [Stack]
7 | FillEnabled=0
8 | OverflowWarningsEnabled=1
9 | WarningThreshold=90
10 | SpWarningsEnabled=1
11 | WarnLogOnly=1
12 | UseTrigger=1
13 | TriggerName=main
14 | LimitSize=0
15 | ByteLimit=50
16 | [CallStack]
17 | ShowArgs=0
18 | [Disassembly]
19 | MixedMode=1
20 | [SWOTraceHWSettings]
21 | OverrideDefaultClocks=0
22 | CpuClock=72000000
23 | ClockAutoDetect=0
24 | ClockWanted=2000000
25 | JtagSpeed=2000000
26 | Prescaler=36
27 | TimeStampPrescIndex=0
28 | TimeStampPrescData=0
29 | PcSampCYCTAP=1
30 | PcSampPOSTCNT=15
31 | PcSampIndex=0
32 | DataLogMode=0
33 | ITMportsEnable=0
34 | ITMportsTermIO=0
35 | ITMportsLogFile=0
36 | ITMlogFile=$PROJ_DIR$\ITM.log
37 | [DataLog]
38 | LogEnabled=0
39 | SumEnabled=0
40 | GraphEnabled=0
41 | ShowTimeLog=1
42 | ShowTimeSum=1
43 | [InterruptLog]
44 | LogEnabled=0
45 | SumEnabled=0
46 | GraphEnabled=0
47 | ShowTimeLog=1
48 | ShowTimeSum=1
49 | SumSortOrder=0
50 | [Log file]
51 | LoggingEnabled=_ 0
52 | LogFile=_ ""
53 | Category=_ 0
54 | [TermIOLog]
55 | LoggingEnabled=_ 0
56 | LogFile=_ ""
57 | [Trace2]
58 | Enabled=0
59 | [SWOTraceWindow]
60 | PcSampling=0
61 | InterruptLogs=0
62 | ForcedTimeStamps=0
63 | EventCPI=0
64 | EventEXC=0
65 | EventFOLD=0
66 | EventLSU=0
67 | EventSLEEP=0
68 | [CallStackLog]
69 | Enabled=0
70 | [DriverProfiling]
71 | Enabled=0
72 | Mode=3
73 | Graph=0
74 | Symbiont=0
75 | Exclusions=
76 | [Disassemble mode]
77 | mode=0
78 | [Breakpoints2]
79 | Count=0
80 | [Aliases]
81 | Count=0
82 | SuppressDialog=0
83 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_Demo.wsdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | STM32F4-Discovery_Demo/Demo
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 244272727
16 |
17 |
18 |
19 |
20 |
21 |
22 | 300Find-in-Files2098026165
23 |
24 | 300Build47067806
25 |
26 |
27 |
28 |
29 |
30 |
31 | TabID-28121-16792
32 | Workspace
33 | Workspace
34 |
35 |
36 | STM32F4-Discovery_DemoSTM32F4-Discovery_Demo/STM32F4_DiscoverySTM32F4-Discovery_Demo/STM32_USB_Device_LibrarySTM32F4-Discovery_Demo/User
37 |
38 |
39 |
40 | 0TabID-26863-27291BuildBuildTabID-10764-9152Find in FilesFind-in-Files0
41 |
42 |
43 |
44 |
45 |
46 | TextEditor$WS_DIR$\..\main.c011638123812TextEditor$WS_DIR$\..\usb_bsp.c023700TextEditor$WS_DIR$\..\usbd_desc.c030600TextEditor$WS_DIR$\..\main.h01712251225TextEditor$WS_DIR$\..\stm32f4xx_it.c01373867386740100000010000001
47 |
48 |
49 |
50 |
51 |
52 |
53 | iaridepm.enu1-2-2443318-2-2200200146413291545234261648688-2-21981368-2-213702001002928291545146413291545
54 |
55 |
56 |
57 |
58 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.Demo.cspy.bat:
--------------------------------------------------------------------------------
1 | @REM This batch file has been generated by the IAR Embedded Workbench
2 | @REM C-SPY Debugger, as an aid to preparing a command line for running
3 | @REM the cspybat command line utility using the appropriate settings.
4 | @REM
5 | @REM Note that this file is generated every time a new debug session
6 | @REM is initialized, so you may want to move or rename the file before
7 | @REM making changes.
8 | @REM
9 | @REM You can launch cspybat by typing the name of this batch file followed
10 | @REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
11 | @REM
12 | @REM Read about available command line parameters in the C-SPY Debugging
13 | @REM Guide. Hints about additional command line parameters that may be
14 | @REM useful in specific cases:
15 | @REM --download_only Downloads a code image without starting a debug
16 | @REM session afterwards.
17 | @REM --silent Omits the sign-on message.
18 | @REM --timeout Limits the maximum allowed execution time.
19 | @REM
20 |
21 |
22 | @echo off
23 |
24 | if not "%~1" == "" goto debugFile
25 |
26 | @echo on
27 |
28 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\common\bin\cspybat" -f "D:\GITHUB\USB_Microphone\my_mic_usb\EWARM\settings\STM32F4-Discovery_audio.Demo.general.xcl" --backend -f "D:\GITHUB\USB_Microphone\my_mic_usb\EWARM\settings\STM32F4-Discovery_audio.Demo.driver.xcl"
29 |
30 | @echo off
31 | goto end
32 |
33 | :debugFile
34 |
35 | @echo on
36 |
37 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\common\bin\cspybat" -f "D:\GITHUB\USB_Microphone\my_mic_usb\EWARM\settings\STM32F4-Discovery_audio.Demo.general.xcl" "--debug_file=%~1" --backend -f "D:\GITHUB\USB_Microphone\my_mic_usb\EWARM\settings\STM32F4-Discovery_audio.Demo.driver.xcl"
38 |
39 | @echo off
40 | :end
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.Demo.driver.xcl:
--------------------------------------------------------------------------------
1 | "--endian=little"
2 |
3 | "--cpu=Cortex-M4"
4 |
5 | "--fpu=VFPv4_SP"
6 |
7 | "-p"
8 |
9 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\CONFIG\debugger\ST\STM32F407VG.ddf"
10 |
11 | "--drv_verify_download"
12 |
13 | "--semihosting"
14 |
15 | "--device=STM32F407VG"
16 |
17 | "--drv_interface=SWD"
18 |
19 | "--stlink_reset_strategy=0,0"
20 |
21 | "--drv_swo_clock_setup=2000000,0,2000000"
22 |
23 | "--drv_catch_exceptions=0x000"
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.Demo.general.xcl:
--------------------------------------------------------------------------------
1 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\bin\armproc.dll"
2 |
3 | "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\bin\armstlink2.dll"
4 |
5 | "D:\GITHUB\USB_Microphone\my_mic_usb\EWARM\Demo\Exe\STM32F4-Discovery_Demo.out"
6 |
7 | --plugin "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\bin\armbat.dll"
8 |
9 | --device_macro "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\config\debugger\ST\STM32F4xx.dmac"
10 |
11 | --flash_loader "C:\Program Files (x86)\IAR Systems\Embedded Workbench 7.3\arm\config\flashloader\ST\FlashSTM32F4xxx.board"
12 |
13 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.crun:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | 1
5 |
6 |
7 | *
8 | *
9 | *
10 | 0
11 | 1
12 |
13 |
14 |
15 |
16 |
17 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.cspy.bat:
--------------------------------------------------------------------------------
1 | @REM This batch file has been generated by the IAR Embedded Workbench
2 | @REM C-SPY Debugger, as an aid to preparing a command line for running
3 | @REM the cspybat command line utility using the appropriate settings.
4 | @REM
5 | @REM You can launch cspybat by typing the name of this batch file followed
6 | @REM by the name of the debug file (usually an ELF/DWARF or UBROF file).
7 | @REM Note that this file is generated every time a new debug session
8 | @REM is initialized, so you may want to move or rename the file before
9 | @REM making changes.
10 | @REM
11 |
12 |
13 | "C:\Program Files\IAR Systems\Embedded Workbench 6.30\common\bin\cspybat" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armproc.dll" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armstlink.dll" %1 --plugin "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\bin\armbat.dll" --flash_loader "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\config\flashloader\ST\FlashSTM32F4xxx.board" --backend -B "--endian=little" "--cpu=Cortex-M4" "--fpu=VFPv4" "-p" "C:\Program Files\IAR Systems\Embedded Workbench 6.30\arm\CONFIG\debugger\ST\iostm32f4xxx.ddf" "--drv_verify_download" "--semihosting" "--device=STM32F4xxx" "--stlink_interface=SWD" "--stlink_reset_strategy=0,0" "--drv_swo_clock_setup=2000000,0,2000000"
14 |
15 |
16 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.dbgdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 | 300Find-in-Files201307
10 |
11 |
12 |
13 |
14 |
15 | 2098026165300Debug-LogFind-in-Files
16 |
17 |
18 |
19 |
20 |
21 |
22 | 231272727
23 |
24 |
25 |
26 |
27 |
28 | - Disassembly
- _I0
29 |
30 |
31 |
32 | - 500
- 20
33 |
34 |
35 |
36 | 20000
37 | 300Debug-Log47067806300- Breakpoint
- _I0
- 500
- 35
- IsocOutRdPtr
- IsocOutBuff
- AudioRemSize
- AudioState
- sinebuf2
- Addr
- cnt1
- IsocInWrPtr
- IsocInBuff
- PlayFlag
- usbd_audio_AltSet
- RecBuf1
- gintr_status
- Expression
- Location
- Type
- Value
- 173
- 150
- 100
- 114
200200200WATCH_1- Expression
- Location
- Type
- Value
- 100
- 150
- 100
- 100
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 | TabID-7375-20064
46 | Workspace
47 | Workspace
48 |
49 |
50 | STM32F4-Discovery_audioSTM32F4-Discovery_audio/STM32F4_DiscoverySTM32F4-Discovery_audio/STM32_USB_Device_LibrarySTM32F4-Discovery_audio/STM32_USB_Device_Library/ClassSTM32F4-Discovery_audio/STM32_USB_Device_Library/Class/AudioSTM32F4-Discovery_audio/STM32_USB_OTG_DriverSTM32F4-Discovery_audio/User
51 |
52 |
53 |
54 | 0TabID-18878-8212Find in FilesFind-in-FilesTabID-29558-24952Debug LogDebug-Log1TabID-10264-14435Watch 1WATCH_10
55 |
56 |
57 |
58 |
59 |
60 | TextEditor$WS_DIR$\..\waverecorder.c00000000TextEditor$WS_DIR$\..\main.c0000014104101TextEditor$WS_DIR$\..\..\Libraries\STM32_USB_Device_Library\Class\audio\src\usbd_audio_core.c00000989890100000010000001
61 |
62 |
63 |
64 |
65 |
66 |
67 | iaridepm.enu1debuggergui.enu1armstlink2.enu1-2-2520322-2-2499559324870715749210938668374-2-2520421-2-2386293251302375160275391668374-2-21681538-2-215401701002604217670324870715749
68 |
69 |
70 |
71 |
72 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.dni:
--------------------------------------------------------------------------------
1 | [DebugChecksum]
2 | Checksum=1394137733
3 | [Exceptions]
4 | StopOnUncaught=_ 0
5 | StopOnThrow=_ 0
6 | [Stack]
7 | FillEnabled=0
8 | OverflowWarningsEnabled=1
9 | WarningThreshold=90
10 | SpWarningsEnabled=1
11 | WarnLogOnly=1
12 | UseTrigger=1
13 | TriggerName=main
14 | LimitSize=0
15 | ByteLimit=50
16 | [CallStack]
17 | ShowArgs=0
18 | [Disassembly]
19 | MixedMode=1
20 | [SWOTraceHWSettings]
21 | OverrideDefaultClocks=0
22 | CpuClock=2000000
23 | ClockAutoDetect=0
24 | ClockWanted=2000000
25 | JtagSpeed=2000000
26 | Prescaler=1
27 | TimeStampPrescIndex=0
28 | TimeStampPrescData=0
29 | PcSampCYCTAP=1
30 | PcSampPOSTCNT=15
31 | PcSampIndex=0
32 | DataLogMode=0
33 | ITMportsEnable=0
34 | ITMportsTermIO=0
35 | ITMportsLogFile=0
36 | ITMlogFile=$PROJ_DIR$\ITM.log
37 | [StLinkDriver]
38 | stlinkserialNo=C0CCD28D
39 | stlinkfoundProbes=
40 | CStepIntDis=_ 0
41 | [CodeCoverage]
42 | Enabled=_ 0
43 | [watch_formats]
44 | Fmt0={W}0:Addr 4 0
45 | [Trace2]
46 | Enabled=0
47 | ShowSource=0
48 | [SWOTraceWindow]
49 | PcSampling=0
50 | InterruptLogs=0
51 | ForcedTimeStamps=0
52 | EventCPI=0
53 | EventEXC=0
54 | EventFOLD=0
55 | EventLSU=0
56 | EventSLEEP=0
57 | [DataLog]
58 | LogEnabled=0
59 | GraphEnabled=0
60 | ShowTimeLog=1
61 | SumEnabled=0
62 | ShowTimeSum=1
63 | [EventLog]
64 | Title_0=Ch3
65 | Symbol_0=0 4 1
66 | Title_1=Ch2
67 | Symbol_1=0 4 1
68 | Title_2=Ch1
69 | Symbol_2=0 4 1
70 | Title_3=Ch0
71 | Symbol_3=0 4 1
72 | LogEnabled=0
73 | GraphEnabled=0
74 | ShowTimeLog=1
75 | SumEnabled=0
76 | ShowTimeSum=1
77 | SumSortOrder=0
78 | [InterruptLog]
79 | LogEnabled=0
80 | GraphEnabled=0
81 | ShowTimeLog=1
82 | SumEnabled=0
83 | ShowTimeSum=1
84 | SumSortOrder=0
85 | [Log file]
86 | LoggingEnabled=_ 0
87 | LogFile=_ ""
88 | Category=_ 0
89 | [TermIOLog]
90 | LoggingEnabled=_ 0
91 | LogFile=_ ""
92 | [DriverProfiling]
93 | Enabled=0
94 | Mode=3
95 | Graph=0
96 | Symbiont=0
97 | Exclusions=
98 | [CallStackLog]
99 | Enabled=0
100 | [CallStackStripe]
101 | ShowTiming=1
102 | [Disassemble mode]
103 | mode=0
104 | [Breakpoints2]
105 | Bp0=_ 0 "EMUL_DATA" "AudioRemSize" 0 0 0 0 4294967295
106 | Count=1
107 | [Aliases]
108 | A0=_ "D:\MYPROGS\STM32F4\USB_AUDIO_IN\usb_audio\my_proj5\Libraries\STM32F4xx_StdPeriph_Driver\src\stm32f4xx_spi.c" ""
109 | A1=_ "D:\SHARE\USB_AUDIO\my_proj3\my_audio_usb_play_test\main.c" "D:\MYPROGS\STM32F4\USB_AUDIO_IN\usb_audio\my_proj3\my_audio_usb_play_test\main.c"
110 | Count=2
111 | SuppressDialog=1
112 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.wsdt:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 | STM32F4-Discovery_audio/Demo
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 | 273272727
16 |
17 | 209802616547067806302300- Breakpoint
- _I0
- 500
- 35
201307
18 |
19 |
20 |
21 |
22 |
23 | TabID-2026-11899
24 | Workspace
25 | Workspace
26 |
27 |
28 | STM32F4-Discovery_audioSTM32F4-Discovery_audio/STM32_USB_Device_LibrarySTM32F4-Discovery_audio/STM32_USB_Device_Library/ClassSTM32F4-Discovery_audio/STM32_USB_Device_Library/Class/AudioSTM32F4-Discovery_audio/User
29 |
30 |
31 |
32 | 0TabID-21657-19183BuildBuildTabID-15823-22158Find in FilesFind-in-FilesTabID-4713-19157Debug LogDebug-Log0
33 |
34 |
35 |
36 |
37 |
38 | TextEditor$WS_DIR$\..\waverecorder.c00000000TextEditor$WS_DIR$\..\main.c0000014104101TextEditor$WS_DIR$\..\..\Libraries\STM32_USB_Device_Library\Class\audio\src\usbd_audio_core.c00000989890100000010000001
39 |
40 |
41 |
42 |
43 |
44 |
45 | iaridepm.enu1-2-2498347-2-214712495703158771227214640205-2-22381538-2-21540240100260430729895703158771
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/settings/STM32F4-Discovery_audio.wspos:
--------------------------------------------------------------------------------
1 | [MainWindow]
2 | WindowPlacement=_ 16 -3 1520 827 3
3 |
--------------------------------------------------------------------------------
/my_mic_usb/EWARM/stm32f40x_flash.icf:
--------------------------------------------------------------------------------
1 | /*###ICF### Section handled by ICF editor, don't touch! ****/
2 | /*-Editor annotation file-*/
3 | /* IcfEditorFile="$TOOLKIT_DIR$\config\ide\IcfEditor\cortex_v1_0.xml" */
4 | /*-Specials-*/
5 | define symbol __ICFEDIT_intvec_start__ = 0x08000000;
6 | /*-Memory Regions-*/
7 | define symbol __ICFEDIT_region_ROM_start__ = 0x08000000;
8 | define symbol __ICFEDIT_region_ROM_end__ = 0x080FFFFF;
9 | define symbol __ICFEDIT_region_RAM_start__ = 0x20000000;
10 | define symbol __ICFEDIT_region_RAM_end__ = 0x20020000;
11 | /*-Sizes-*/
12 | define symbol __ICFEDIT_size_cstack__ = 0x400;
13 | define symbol __ICFEDIT_size_heap__ = 0x200;
14 | /**** End of ICF editor section. ###ICF###*/
15 |
16 |
17 | define memory mem with size = 4G;
18 | define region ROM_region = mem:[from __ICFEDIT_region_ROM_start__ to __ICFEDIT_region_ROM_end__];
19 | define region RAM_region = mem:[from __ICFEDIT_region_RAM_start__ to __ICFEDIT_region_RAM_end__];
20 |
21 | define block CSTACK with alignment = 8, size = __ICFEDIT_size_cstack__ { };
22 | define block HEAP with alignment = 8, size = __ICFEDIT_size_heap__ { };
23 |
24 | initialize by copy { readwrite };
25 | do not initialize { section .noinit };
26 |
27 | place at address mem:__ICFEDIT_intvec_start__ { readonly section .intvec };
28 |
29 | place in ROM_region { readonly };
30 | place in RAM_region { readwrite,
31 | block CSTACK, block HEAP };
--------------------------------------------------------------------------------
/my_mic_usb/main.c:
--------------------------------------------------------------------------------
1 | //STM32F4-Discovery USB MICROPHONE
2 | //by ILIASAM
3 |
4 | /* Includes ------------------------------------------------------------------*/
5 | #include "main.h"
6 | #include "stm32f4_discovery_audio_codec.h"
7 | #include "usbd_audio_core.h"
8 | #include "usbd_usr.h"
9 | #include "usbd_desc.h"
10 | #include "usbd_audio_core.h"
11 | #include "waverecorder.h"
12 |
13 |
14 | __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END;
15 |
16 | __IO uint8_t UserButtonPressed = 0;
17 |
18 | __IO uint32_t TimingDelay;
19 |
20 | int16_t audiodata[64];//this data is playing by speaker
21 |
22 | extern uint16_t RecBuf0[MIC_FILTER_RESULT_LENGTH]; //buffer for filtered PCM data from MIC
23 | extern uint16_t RecBuf1[MIC_FILTER_RESULT_LENGTH]; //buffer for filtered PCM data from MIC
24 | extern uint8_t buffer_ready;
25 |
26 | void init_audio_dac(void);
27 |
28 | int main(void)
29 | {
30 |
31 | RCC_ClocksTypeDef RCC_Clocks;
32 |
33 | /* Initialize LEDs and User_Button on STM32F4-Discovery --------------------*/
34 | STM_EVAL_PBInit(BUTTON_USER, BUTTON_MODE_GPIO);
35 |
36 | STM_EVAL_LEDInit(LED4);
37 | STM_EVAL_LEDInit(LED3);
38 | STM_EVAL_LEDInit(LED5);
39 | STM_EVAL_LEDInit(LED6);
40 |
41 |
42 | RCC_GetClocksFreq(&RCC_Clocks);//test
43 |
44 | EVAL_AUDIO_Init(OUTPUT_DEVICE_HEADPHONE, 86, I2S_AudioFreq_16k);//init speaker (optional)
45 |
46 | USBD_Init(&USB_OTG_dev,
47 | USB_OTG_FS_CORE_ID,
48 | &USR_desc,
49 | &AUDIO_cb,
50 | &USR_cb);
51 |
52 |
53 | simple_rec_start();//initialise MIC and start capture data from MIC
54 |
55 | EVAL_AUDIO_Play((uint16_t*)(&audiodata[0]),MIC_FILTER_RESULT_LENGTH*2*2);//play data to speaker (optional)
56 |
57 | while(1)
58 | {
59 | asm("nop");
60 | }
61 | }
62 |
63 |
64 | void delay_ms(uint32_t ms)
65 | {
66 | volatile uint32_t nCount;
67 | RCC_ClocksTypeDef RCC_Clocks;
68 | RCC_GetClocksFreq (&RCC_Clocks);
69 | nCount=(RCC_Clocks.HCLK_Frequency/10000)*ms;
70 | for (; nCount!=0; nCount--);
71 | }
72 |
73 |
74 | void Delay(__IO uint32_t nTime)
75 | {
76 | TimingDelay = nTime;
77 |
78 | while(TimingDelay != 0);
79 | }
80 |
81 |
82 | void TimingDelay_Decrement(void)
83 | {
84 | if (TimingDelay != 0x00)
85 | {
86 | TimingDelay--;
87 | }
88 | }
89 |
90 | //speaker CallBack - optional
91 | void EVAL_AUDIO_TransferComplete_CallBack(uint32_t* pBuffer, uint32_t Size)
92 | {
93 | uint8_t i;
94 | //called after speaker data TransferComplete
95 | asm("nop");
96 | #ifdef AUDIO_MAL_MODE_NORMAL
97 | for (i=0;i<(MIC_FILTER_RESULT_LENGTH*2);i++)
98 | {
99 | if (buffer_ready == 1) {audiodata[i] = RecBuf1[i>>1];} else {audiodata[i] = RecBuf0[i>>1];}//make pseudo-stereo
100 | }
101 |
102 | EVAL_AUDIO_Play((uint16_t*)(&audiodata[0]),MIC_FILTER_RESULT_LENGTH*2*2);
103 | #endif
104 | }
105 |
--------------------------------------------------------------------------------
/my_mic_usb/main.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file main.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Header for main.c module
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4_DISCOVERY_DEMO_H
24 | #define __STM32F4_DISCOVERY_DEMO_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4_discovery.h"
28 | #include
29 |
30 | /* Exported types ------------------------------------------------------------*/
31 | /* Exported constants --------------------------------------------------------*/
32 | /* TIM2 Autoreload and Capture Compare register values */
33 | #define TIM_ARR (uint16_t)1999
34 | #define TIM_CCR (uint16_t)1000
35 |
36 | /* MEMS Microphone SPI Interface */
37 | #define SPI_SCK_PIN GPIO_Pin_10
38 | #define SPI_SCK_GPIO_PORT GPIOB
39 | #define SPI_SCK_GPIO_CLK RCC_AHB1Periph_GPIOB
40 | #define SPI_SCK_SOURCE GPIO_PinSource10
41 | #define SPI_SCK_AF GPIO_AF_SPI2
42 |
43 | #define SPI_MOSI_PIN GPIO_Pin_3
44 | #define SPI_MOSI_GPIO_PORT GPIOC
45 | #define SPI_MOSI_GPIO_CLK RCC_AHB1Periph_GPIOC
46 | #define SPI_MOSI_SOURCE GPIO_PinSource3
47 | #define SPI_MOSI_AF GPIO_AF_SPI2
48 |
49 | /* Exported macro ------------------------------------------------------------*/
50 | #define ABS(x) (x < 0) ? (-x) : x
51 | #define MAX(a,b) (a < b) ? (b) : a
52 | /* Exported functions ------------------------------------------------------- */
53 | void TimingDelay_Decrement(void);
54 | void Delay(__IO uint32_t nTime);
55 | void Fail_Handler(void);
56 | #endif /* __STM32F4_DISCOVERY_DEMO_H */
57 |
58 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
59 |
--------------------------------------------------------------------------------
/my_mic_usb/stm32f4xx_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_conf.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Library configuration file.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4xx_CONF_H
24 | #define __STM32F4xx_CONF_H
25 |
26 | #if defined (HSE_VALUE)
27 | /* Redefine the HSE value; it's equal to 8 MHz on the STM32F4-DISCOVERY Kit */
28 | #undef HSE_VALUE
29 | #define HSE_VALUE ((uint32_t)8000000)
30 | #endif /* HSE_VALUE */
31 |
32 | /* Includes ------------------------------------------------------------------*/
33 | /* Uncomment the line below to enable peripheral header file inclusion */
34 | #include "stm32f4xx_adc.h"
35 | #include "stm32f4xx_can.h"
36 | #include "stm32f4xx_crc.h"
37 | #include "stm32f4xx_cryp.h"
38 | #include "stm32f4xx_dac.h"
39 | #include "stm32f4xx_dbgmcu.h"
40 | #include "stm32f4xx_dcmi.h"
41 | #include "stm32f4xx_dma.h"
42 | #include "stm32f4xx_exti.h"
43 | #include "stm32f4xx_flash.h"
44 | #include "stm32f4xx_fsmc.h"
45 | #include "stm32f4xx_hash.h"
46 | #include "stm32f4xx_gpio.h"
47 | #include "stm32f4xx_i2c.h"
48 | #include "stm32f4xx_iwdg.h"
49 | #include "stm32f4xx_pwr.h"
50 | #include "stm32f4xx_rcc.h"
51 | #include "stm32f4xx_rng.h"
52 | #include "stm32f4xx_rtc.h"
53 | #include "stm32f4xx_sdio.h"
54 | #include "stm32f4xx_spi.h"
55 | #include "stm32f4xx_syscfg.h"
56 | #include "stm32f4xx_tim.h"
57 | #include "stm32f4xx_usart.h"
58 | #include "stm32f4xx_wwdg.h"
59 | #include "misc.h" /* High level functions for NVIC and SysTick (add-on to CMSIS functions) */
60 |
61 | /* Exported types ------------------------------------------------------------*/
62 | /* Exported constants --------------------------------------------------------*/
63 |
64 | /* If an external clock source is used, then the value of the following define
65 | should be set to the value of the external clock source, else, if no external
66 | clock is used, keep this define commented */
67 | /*#define I2S_EXTERNAL_CLOCK_VAL 12288000 */ /* Value of the external clock in Hz */
68 |
69 |
70 | /* Uncomment the line below to expanse the "assert_param" macro in the
71 | Standard Peripheral Library drivers code */
72 | /* #define USE_FULL_ASSERT 1 */
73 |
74 | /* Exported macro ------------------------------------------------------------*/
75 | #ifdef USE_FULL_ASSERT
76 |
77 | /**
78 | * @brief The assert_param macro is used for function's parameters check.
79 | * @param expr: If expr is false, it calls assert_failed function
80 | * which reports the name of the source file and the source
81 | * line number of the call that failed.
82 | * If expr is true, it returns no value.
83 | * @retval None
84 | */
85 | #define assert_param(expr) ((expr) ? (void)0 : assert_failed((uint8_t *)__FILE__, __LINE__))
86 | /* Exported functions ------------------------------------------------------- */
87 | void assert_failed(uint8_t* file, uint32_t line);
88 | #else
89 | #define assert_param(expr) ((void)0)
90 | #endif /* USE_FULL_ASSERT */
91 |
92 | #endif /* __STM32F4xx_CONF_H */
93 |
94 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
95 |
--------------------------------------------------------------------------------
/my_mic_usb/stm32f4xx_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.c
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief Main Interrupt Service Routines.
8 | * This file provides all exceptions handler and peripherals interrupt
9 | * service routine.
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
14 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
15 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
16 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
17 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
18 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
19 | *
20 | * © COPYRIGHT 2011 STMicroelectronics
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes ------------------------------------------------------------------*/
25 | #include "stm32f4xx_it.h"
26 | #include "main.h"
27 | #include "usb_core.h"
28 | #include "usbd_core.h"
29 | #include "stm32f4_discovery.h"
30 | #include "usbd_audio_core.h"
31 |
32 |
33 | /* Private typedef -----------------------------------------------------------*/
34 | /* Private define ------------------------------------------------------------*/
35 |
36 | extern const int16_t sinebuf2[96];
37 |
38 | extern uint8_t Buffer[6];
39 | /* Private macro -------------------------------------------------------------*/
40 | /* Private variables ---------------------------------------------------------*/
41 |
42 |
43 | extern __IO uint8_t UserButtonPressed;
44 | /* Private function prototypes -----------------------------------------------*/
45 | extern USB_OTG_CORE_HANDLE USB_OTG_dev;
46 | extern uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev);
47 |
48 | /******************************************************************************/
49 | /* Cortex-M3 Processor Exceptions Handlers */
50 | /******************************************************************************/
51 |
52 | /**
53 | * @brief This function handles NMI exception.
54 | * @param None
55 | * @retval None
56 | */
57 | void NMI_Handler(void)
58 | {
59 | }
60 |
61 | /**
62 | * @brief This function handles Hard Fault exception.
63 | * @param None
64 | * @retval None
65 | */
66 | void HardFault_Handler(void)
67 | {
68 | /* Go to infinite loop when Hard Fault exception occurs */
69 | while (1)
70 | {
71 | }
72 | }
73 |
74 | /**
75 | * @brief This function handles Memory Manage exception.
76 | * @param None
77 | * @retval None
78 | */
79 | void MemManage_Handler(void)
80 | {
81 | /* Go to infinite loop when Memory Manage exception occurs */
82 | while (1)
83 | {
84 | }
85 | }
86 |
87 | /**
88 | * @brief This function handles Bus Fault exception.
89 | * @param None
90 | * @retval None
91 | */
92 | void BusFault_Handler(void)
93 | {
94 | /* Go to infinite loop when Bus Fault exception occurs */
95 | while (1)
96 | {
97 | }
98 | }
99 |
100 | /**
101 | * @brief This function handles Usage Fault exception.
102 | * @param None
103 | * @retval None
104 | */
105 | void UsageFault_Handler(void)
106 | {
107 | /* Go to infinite loop when Usage Fault exception occurs */
108 | while (1)
109 | {
110 | }
111 | }
112 |
113 | /**
114 | * @brief This function handles SVCall exception.
115 | * @param None
116 | * @retval None
117 | */
118 | void SVC_Handler(void)
119 | {
120 | }
121 |
122 | /**
123 | * @brief This function handles Debug Monitor exception.
124 | * @param None
125 | * @retval None
126 | */
127 | void DebugMon_Handler(void)
128 | {
129 | }
130 |
131 | /**
132 | * @brief This function handles PendSVC exception.
133 | * @param None
134 | * @retval None
135 | */
136 | void PendSV_Handler(void)
137 | {
138 | }
139 |
140 | /**
141 | * @brief This function handles SysTick Handler.
142 | * @param None
143 | * @retval None
144 | */
145 | void SysTick_Handler(void)
146 | {
147 | //if (STM_EVAL_PBGetState(BUTTON_USER) == Bit_SET) {STM_EVAL_LEDOn(LED6);Audio_MAL_Play((uint32_t)(&sinebuf2[0]),40);} else {STM_EVAL_LEDOff(LED6);}
148 | //Audio_MAL_Play((uint32_t)(&sinebuf2[0]),40);
149 | }
150 |
151 | /******************************************************************************/
152 | /* STM32Fxxx Peripherals Interrupt Handlers */
153 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */
154 | /* available peripheral interrupt handler's name please refer to the startup */
155 | /* file (startup_stm32fxxx.s). */
156 | /******************************************************************************/
157 |
158 | /**
159 | * @brief This function handles PPP interrupt request.
160 | * @param None
161 | * @retval None
162 | */
163 | /*void PPP_IRQHandler(void)
164 | {
165 | }*/
166 |
167 | /**
168 | * @brief This function handles EXTI0_IRQ Handler.
169 | * @param None
170 | * @retval None
171 | */
172 | void EXTI0_IRQHandler(void)
173 | {
174 | UserButtonPressed = 0x01;
175 | /* Clear the EXTI line pending bit */
176 | EXTI_ClearITPendingBit(USER_BUTTON_EXTI_LINE);
177 |
178 | //Audio_MAL_Play((uint32_t)(&sinebuf2[0]),48); - working
179 | }
180 |
181 | /**
182 | * @brief This function handles EXTI15_10_IRQ Handler.
183 | * @param None
184 | * @retval None
185 | */
186 | void OTG_FS_WKUP_IRQHandler(void)
187 | {
188 | if(USB_OTG_dev.cfg.low_power)
189 | {
190 | /* Reset SLEEPDEEP and SLEEPONEXIT bits */
191 | SCB->SCR &= (uint32_t)~((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
192 |
193 | /* After wake-up from sleep mode, reconfigure the system clock */
194 | SystemInit();
195 | USB_OTG_UngateClock(&USB_OTG_dev);
196 | }
197 | EXTI_ClearITPendingBit(EXTI_Line18);
198 | }
199 |
200 | /**
201 | * @brief This function handles OTG_HS Handler.
202 | * @param None
203 | * @retval None
204 | */
205 | void OTG_FS_IRQHandler(void)
206 | {
207 | USBD_OTG_ISR_Handler (&USB_OTG_dev);
208 | }
209 |
210 |
211 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
212 |
--------------------------------------------------------------------------------
/my_mic_usb/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 19-September-2011
7 | * @brief This file contains the headers of the interrupt handlers.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __STM32F4xx_IT_H
24 | #define __STM32F4xx_IT_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "usb_conf.h"
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 | /* Exported constants --------------------------------------------------------*/
35 | /* Exported macro ------------------------------------------------------------*/
36 | /* Exported functions ------------------------------------------------------- */
37 |
38 | void NMI_Handler(void);
39 | void HardFault_Handler(void);
40 | void MemManage_Handler(void);
41 | void BusFault_Handler(void);
42 | void UsageFault_Handler(void);
43 | void SVC_Handler(void);
44 | void DebugMon_Handler(void);
45 | void PendSV_Handler(void);
46 | void SysTick_Handler(void);
47 |
48 | #ifdef __cplusplus
49 | }
50 | #endif
51 |
52 | #endif /* __STM32F4xx_IT_H */
53 |
54 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
55 |
--------------------------------------------------------------------------------
/my_mic_usb/usb_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usb_conf.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief General low level driver configuration
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __USB_CONF__H__
24 | #define __USB_CONF__H__
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4xx.h"
28 |
29 |
30 | /** @addtogroup USB_OTG_DRIVER
31 | * @{
32 | */
33 |
34 | /** @defgroup USB_CONF
35 | * @brief USB low level driver configuration file
36 | * @{
37 | */
38 |
39 | /** @defgroup USB_CONF_Exported_Defines
40 | * @{
41 | */
42 |
43 | /* USB Core and PHY interface configuration.
44 | Tip: To avoid modifying these defines each time you need to change the USB
45 | configuration, you can declare the needed define in your toolchain
46 | compiler preprocessor.
47 | */
48 | #ifndef USE_USB_OTG_FS
49 | //#define USE_USB_OTG_FS
50 | #endif /* USE_USB_OTG_FS */
51 |
52 | #ifndef USE_USB_OTG_HS
53 | //#define USE_USB_OTG_HS
54 | #endif /* USE_USB_OTG_HS */
55 |
56 | #ifndef USE_ULPI_PHY
57 | //#define USE_ULPI_PHY
58 | #endif /* USE_ULPI_PHY */
59 |
60 | #ifndef USE_EMBEDDED_PHY
61 | //#define USE_EMBEDDED_PHY
62 | #endif /* USE_EMBEDDED_PHY */
63 |
64 |
65 | #ifndef USE_I2C_PHY
66 | //#define USE_I2C_PHY
67 | #endif /* USE_I2C_PHY */
68 |
69 | #ifdef USE_USB_OTG_FS
70 | #define USB_OTG_FS_CORE
71 | #endif
72 |
73 | #ifdef USE_USB_OTG_HS
74 | #define USB_OTG_HS_CORE
75 | #endif
76 |
77 | /*******************************************************************************
78 | * FIFO Size Configuration in Device mode
79 | *
80 | * (i) Receive data FIFO size = RAM for setup packets +
81 | * OUT endpoint control information +
82 | * data OUT packets + miscellaneous
83 | * Space = ONE 32-bits words
84 | * --> RAM for setup packets = 10 spaces
85 | * (n is the nbr of CTRL EPs the device core supports)
86 | * --> OUT EP CTRL info = 1 space
87 | * (one space for status information written to the FIFO along with each
88 | * received packet)
89 | * --> data OUT packets = (Largest Packet Size / 4) + 1 spaces
90 | * (MINIMUM to receive packets)
91 | * --> OR data OUT packets = at least 2*(Largest Packet Size / 4) + 1 spaces
92 | * (if high-bandwidth EP is enabled or multiple isochronous EPs)
93 | * --> miscellaneous = 1 space per OUT EP
94 | * (one space for transfer complete status information also pushed to the
95 | * FIFO with each endpoint's last packet)
96 | *
97 | * (ii)MINIMUM RAM space required for each IN EP Tx FIFO = MAX packet size for
98 | * that particular IN EP. More space allocated in the IN EP Tx FIFO results
99 | * in a better performance on the USB and can hide latencies on the AHB.
100 | *
101 | * (iii) TXn min size = 16 words. (n : Transmit FIFO index)
102 | * (iv) When a TxFIFO is not used, the Configuration should be as follows:
103 | * case 1 : n > m and Txn is not used (n,m : Transmit FIFO indexes)
104 | * --> Txm can use the space allocated for Txn.
105 | * case2 : n < m and Txn is not used (n,m : Transmit FIFO indexes)
106 | * --> Txn should be configured with the minimum space of 16 words
107 | * (v) The FIFO is used optimally when used TxFIFOs are allocated in the top
108 | * of the FIFO.Ex: use EP1 and EP2 as IN instead of EP1 and EP3 as IN ones.
109 | *******************************************************************************/
110 |
111 | /****************** USB OTG HS CONFIGURATION **********************************/
112 | #ifdef USB_OTG_HS_CORE
113 | #define RX_FIFO_HS_SIZE 512
114 | #define TX0_FIFO_HS_SIZE 512
115 | #define TX1_FIFO_HS_SIZE 0
116 | #define TX2_FIFO_HS_SIZE 0
117 | #define TX3_FIFO_HS_SIZE 0
118 | #define TX4_FIFO_HS_SIZE 0
119 | #define TX5_FIFO_HS_SIZE 0
120 |
121 | //#define USB_OTG_HS_SOF_OUTPUT_ENABLED
122 |
123 | #ifdef USE_ULPI_PHY
124 | #define USB_OTG_ULPI_PHY_ENABLED
125 | #endif
126 | #ifdef USE_EMBEDDED_PHY
127 | #define USB_OTG_EMBEDDED_PHY_ENABLED
128 | /* wakeup is working only when HS core is configured in FS mode */
129 | #define USB_OTG_HS_LOW_PWR_MGMT_SUPPORT
130 | #endif
131 | #ifdef USE_I2C_PHY
132 | #define USB_OTG_I2C_PHY_ENABLED
133 | #endif
134 | #define USB_OTG_HS_INTERNAL_DMA_ENABLED
135 | #define USB_OTG_HS_DEDICATED_EP1_ENABLED
136 | #endif
137 |
138 | /****************** USB OTG FS CONFIGURATION **********************************/
139 | #ifdef USB_OTG_FS_CORE
140 | #define RX_FIFO_FS_SIZE 128
141 | #define TX0_FIFO_FS_SIZE 128
142 | #define TX1_FIFO_FS_SIZE 256
143 | #define TX2_FIFO_FS_SIZE 0
144 | #define TX3_FIFO_FS_SIZE 0
145 |
146 | //#define USB_OTG_FS_LOW_PWR_MGMT_SUPPORT
147 | //#define USB_OTG_FS_SOF_OUTPUT_ENABLED
148 | #endif
149 |
150 | /****************** USB OTG MODE CONFIGURATION ********************************/
151 |
152 | //#define USE_HOST_MODE
153 | #define USE_DEVICE_MODE
154 | //#define USE_OTG_MODE
155 |
156 |
157 | #ifndef USB_OTG_FS_CORE
158 | #ifndef USB_OTG_HS_CORE
159 | #error "USB_OTG_HS_CORE or USB_OTG_FS_CORE should be defined"
160 | #endif
161 | #endif
162 |
163 |
164 | #ifndef USE_DEVICE_MODE
165 | #ifndef USE_HOST_MODE
166 | #error "USE_DEVICE_MODE or USE_HOST_MODE should be defined"
167 | #endif
168 | #endif
169 |
170 | #ifndef USE_USB_OTG_HS
171 | #ifndef USE_USB_OTG_FS
172 | #error "USE_USB_OTG_HS or USE_USB_OTG_FS should be defined"
173 | #endif
174 | #else //USE_USB_OTG_HS
175 | #ifndef USE_ULPI_PHY
176 | #ifndef USE_EMBEDDED_PHY
177 | #ifndef USE_I2C_PHY
178 | #error "USE_ULPI_PHY or USE_EMBEDDED_PHY or USE_I2C_PHY should be defined"
179 | #endif
180 | #endif
181 | #endif
182 | #endif
183 |
184 | /****************** C Compilers dependant keywords ****************************/
185 | /* In HS mode and when the DMA is used, all variables and data structures dealing
186 | with the DMA during the transaction process should be 4-bytes aligned */
187 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED
188 | #if defined (__GNUC__) /* GNU Compiler */
189 | #define __ALIGN_END __attribute__ ((aligned (4)))
190 | #define __ALIGN_BEGIN
191 | #else
192 | #define __ALIGN_END
193 | #if defined (__CC_ARM) /* ARM Compiler */
194 | #define __ALIGN_BEGIN __align(4)
195 | #elif defined (__ICCARM__) /* IAR Compiler */
196 | #define __ALIGN_BEGIN
197 | #elif defined (__TASKING__) /* TASKING Compiler */
198 | #define __ALIGN_BEGIN __align(4)
199 | #endif /* __CC_ARM */
200 | #endif /* __GNUC__ */
201 | #else
202 | #define __ALIGN_BEGIN
203 | #define __ALIGN_END
204 | #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */
205 |
206 | /* __packed keyword used to decrease the data type alignment to 1-byte */
207 | #if defined (__CC_ARM) /* ARM Compiler */
208 | #define __packed __packed
209 | #elif defined (__ICCARM__) /* IAR Compiler */
210 | #define __packed __packed
211 | #elif defined ( __GNUC__ ) /* GNU Compiler */
212 | #define __packed __attribute__ ((__packed__))
213 | #elif defined (__TASKING__) /* TASKING Compiler */
214 | #define __packed __unaligned
215 | #endif /* __CC_ARM */
216 |
217 | /**
218 | * @}
219 | */
220 |
221 |
222 | /** @defgroup USB_CONF_Exported_Types
223 | * @{
224 | */
225 | /**
226 | * @}
227 | */
228 |
229 |
230 | /** @defgroup USB_CONF_Exported_Macros
231 | * @{
232 | */
233 | /**
234 | * @}
235 | */
236 |
237 | /** @defgroup USB_CONF_Exported_Variables
238 | * @{
239 | */
240 | /**
241 | * @}
242 | */
243 |
244 | /** @defgroup USB_CONF_Exported_FunctionsPrototype
245 | * @{
246 | */
247 | /**
248 | * @}
249 | */
250 |
251 |
252 | #endif //__USB_CONF__H__
253 |
254 |
255 | /**
256 | * @}
257 | */
258 |
259 | /**
260 | * @}
261 | */
262 |
263 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
264 |
265 |
--------------------------------------------------------------------------------
/my_mic_usb/usbd_conf.h:
--------------------------------------------------------------------------------
1 |
2 |
3 | /* Define to prevent recursive inclusion -------------------------------------*/
4 | #ifndef __USBD_CONF__H__
5 | #define __USBD_CONF__H__
6 |
7 | /* Includes ------------------------------------------------------------------*/
8 | #include "stm32f4_discovery.h"
9 |
10 | #define USBD_IN_AUDIO_FREQ (uint16_t)(16000) //MIC frequency in Hz.
11 |
12 | /* Audio frequency in Hz */
13 | #ifndef EXTERNAL_CRYSTAL_25MHz
14 | #define USBD_AUDIO_FREQ (uint16_t)(16000) /* Audio frequency in Hz.
15 | It is advised to set standard frequencies >= 24KHz to get best quality
16 | except for STM32F10 devices, when the HSE value is 25MHz, it is advised to
17 | set audio frequencies reachable with this HSE value (refer to RM0008 for
18 | more details). ie. it is advised to set 16KHz value in this case.
19 | Note that maximum allowed audio frequency is 96KHz (this limitation is
20 | due to the codec used on the Evaluation board. The STM32 I2S cell allows
21 | to reach 192KHz frequency).
22 | @note
23 | When modifying this value, make sure that the I2S PLL configuration allows
24 | to get minimum error on audio frequency. This configuration is set in file
25 | system_stm32f2xx.c or system_stm32f10x.c.*/
26 | #else
27 | #define USBD_AUDIO_FREQ 48000 /* Audio frequency in Hz for STM32F10x devices family when 25MHz HSE value
28 | is used. */
29 | #endif /* EXTERNAL_CRYSTAL_25MHz */
30 |
31 | #define DEFAULT_VOLUME 80 /* Default volume in % (Mute=0%, Max = 100%) in Logarithmic values.
32 | To get accurate volume variations, it is possible to use a logarithmic
33 | coversion table to convert from percentage to logarithmic law.
34 | In order to keep this example code simple, this conversion is not used.*/
35 | #define AUDIO_TOTAL_IF_NUM 0x02
36 | #define USBD_CFG_MAX_NUM 1
37 | #define USBD_ITF_MAX_NUM 1
38 | #define USB_MAX_STR_DESC_SIZ 200
39 | #define AUDIO_IN_EP 0x81
40 |
41 | #endif //__USBD_CONF__H__
42 |
43 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
44 |
45 |
--------------------------------------------------------------------------------
/my_mic_usb/usbd_desc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_desc.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 22-July-2011
7 | * @brief header file for the usbd_desc.c file
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 |
24 | #ifndef __USB_DESC_H
25 | #define __USB_DESC_H
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "usbd_def.h"
29 |
30 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
31 | * @{
32 | */
33 |
34 | /** @defgroup USB_DESC
35 | * @brief general defines for the usb device library file
36 | * @{
37 | */
38 |
39 | /** @defgroup USB_DESC_Exported_Defines
40 | * @{
41 | */
42 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01
43 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02
44 | #define USB_STRING_DESCRIPTOR_TYPE 0x03
45 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04
46 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05
47 | #define USB_SIZ_DEVICE_DESC 18
48 | #define USB_SIZ_STRING_LANGID 4
49 |
50 | /**
51 | * @}
52 | */
53 |
54 |
55 | /** @defgroup USBD_DESC_Exported_TypesDefinitions
56 | * @{
57 | */
58 | /**
59 | * @}
60 | */
61 |
62 |
63 |
64 | /** @defgroup USBD_DESC_Exported_Macros
65 | * @{
66 | */
67 | /**
68 | * @}
69 | */
70 |
71 | /** @defgroup USBD_DESC_Exported_Variables
72 | * @{
73 | */
74 | extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC];
75 | extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ];
76 | extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC];
77 | extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC];
78 | extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID];
79 | extern USBD_DEVICE USR_desc;
80 | /**
81 | * @}
82 | */
83 |
84 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype
85 | * @{
86 | */
87 |
88 |
89 | uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length);
90 | uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length);
91 | uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length);
92 | uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length);
93 | uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length);
94 | uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length);
95 | uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length);
96 |
97 | #ifdef USB_SUPPORT_USER_STRING_DESC
98 | uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length);
99 | #endif /* USB_SUPPORT_USER_STRING_DESC */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | #endif /* __USBD_DESC_H */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /**
112 | * @}
113 | */
114 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
115 |
--------------------------------------------------------------------------------
/my_mic_usb/usbd_usr.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_usr.c
4 | * @author MCD Application Team
5 | * @version V1.1.0
6 | * @date 19-March-2012
7 | * @brief This file includes the user application layer
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2012 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_usr.h"
30 | #include "usbd_ioreq.h"
31 |
32 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
33 | * @{
34 | */
35 |
36 | /** @defgroup USBD_USR
37 | * @brief This file includes the user application layer
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_USR_Private_TypesDefinitions
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USBD_USR_Private_Defines
50 | * @{
51 | */
52 | /**
53 | * @}
54 | */
55 |
56 |
57 | /** @defgroup USBD_USR_Private_Macros
58 | * @{
59 | */
60 | /**
61 | * @}
62 | */
63 |
64 |
65 | /** @defgroup USBD_USR_Private_Variables
66 | * @{
67 | */
68 |
69 | USBD_Usr_cb_TypeDef USR_cb =
70 | {
71 | USBD_USR_Init,
72 | USBD_USR_DeviceReset,
73 | USBD_USR_DeviceConfigured,
74 | USBD_USR_DeviceSuspended,
75 | USBD_USR_DeviceResumed,
76 |
77 |
78 | USBD_USR_DeviceConnected,
79 | USBD_USR_DeviceDisconnected,
80 | };
81 |
82 | /**
83 | * @}
84 | */
85 |
86 | /** @defgroup USBD_USR_Private_Constants
87 | * @{
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 |
95 |
96 | /** @defgroup USBD_USR_Private_FunctionPrototypes
97 | * @{
98 | */
99 | /**
100 | * @}
101 | */
102 |
103 |
104 | /** @defgroup USBD_USR_Private_Functions
105 | * @{
106 | */
107 |
108 | /**
109 | * @brief USBD_USR_Init
110 | * Displays the message on LCD for host lib initialization
111 | * @param None
112 | * @retval None
113 | */
114 | void USBD_USR_Init(void)
115 | {
116 |
117 | }
118 |
119 | /**
120 | * @brief USBD_USR_DeviceReset
121 | * Displays the message on LCD on device Reset Event
122 | * @param speed : device speed
123 | * @retval None
124 | */
125 | void USBD_USR_DeviceReset(uint8_t speed )
126 | {
127 |
128 | }
129 |
130 |
131 | /**
132 | * @brief USBD_USR_DeviceConfigured
133 | * Displays the message on LCD on device configuration Event
134 | * @param None
135 | * @retval Staus
136 | */
137 | void USBD_USR_DeviceConfigured (void)
138 | {
139 |
140 | }
141 |
142 | /**
143 | * @brief USBD_USR_DeviceSuspended
144 | * Displays the message on LCD on device suspend Event
145 | * @param None
146 | * @retval None
147 | */
148 | void USBD_USR_DeviceSuspended(void)
149 | {
150 | /* Users can do their application actions here for the USB-Reset */
151 | }
152 |
153 |
154 | /**
155 | * @brief USBD_USR_DeviceResumed
156 | * Displays the message on LCD on device resume Event
157 | * @param None
158 | * @retval None
159 | */
160 | void USBD_USR_DeviceResumed(void)
161 | {
162 | /* Users can do their application actions here for the USB-Reset */
163 | }
164 |
165 |
166 | /**
167 | * @brief USBD_USR_DeviceConnected
168 | * Displays the message on LCD on device connection Event
169 | * @param None
170 | * @retval Staus
171 | */
172 | void USBD_USR_DeviceConnected (void)
173 | {
174 | }
175 |
176 |
177 | /**
178 | * @brief USBD_USR_DeviceDisonnected
179 | * Displays the message on LCD on device disconnection Event
180 | * @param None
181 | * @retval Staus
182 | */
183 | void USBD_USR_DeviceDisconnected (void)
184 | {
185 | }
186 | /**
187 | * @}
188 | */
189 |
190 | /**
191 | * @}
192 | */
193 |
194 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
195 |
--------------------------------------------------------------------------------
/my_mic_usb/waverecorder.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file Audio_playback_and_record/inc/waverecorder.h
4 | * @author MCD Application Team
5 | * @version V1.0.0
6 | * @date 28-October-2011
7 | * @brief Header for waverecorder.c module
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS
12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE
13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY
14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING
15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE
16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.
17 | *
18 | * © COPYRIGHT 2011 STMicroelectronics
19 | ******************************************************************************
20 | */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __I2S_AUDIO_H
24 | #define __I2S_AUDIO_H
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "stm32f4xx.h"
28 | #include "main.h"
29 |
30 |
31 | /* Exported types ------------------------------------------------------------*/
32 | /* Exported Defines ----------------------------------------------------------*/
33 | /* SPI Configuration defines */
34 | #define SPI_SCK_PIN GPIO_Pin_10
35 | #define SPI_SCK_GPIO_PORT GPIOB
36 | #define SPI_SCK_GPIO_CLK RCC_AHB1Periph_GPIOB
37 | #define SPI_SCK_SOURCE GPIO_PinSource10
38 | #define SPI_SCK_AF GPIO_AF_SPI2
39 |
40 | #define SPI_MOSI_PIN GPIO_Pin_3
41 | #define SPI_MOSI_GPIO_PORT GPIOC
42 | #define SPI_MOSI_GPIO_CLK RCC_AHB1Periph_GPIOC
43 | #define SPI_MOSI_SOURCE GPIO_PinSource3
44 | #define SPI_MOSI_AF GPIO_AF_SPI2
45 |
46 | #define AUDIO_REC_SPI_IRQHANDLER SPI2_IRQHandler
47 |
48 |
49 | #define MIC_FILTER_RESULT_LENGTH 16
50 | #define PCM_OUT_SIZE MIC_FILTER_RESULT_LENGTH
51 |
52 | /* PDM buffer input size */
53 | #define INTERNAL_BUFF_SIZE 64
54 |
55 |
56 | /* Exported constants --------------------------------------------------------*/
57 | /* Exported macro ------------------------------------------------------------*/
58 | /* Exported functions ------------------------------------------------------- */
59 | void AUDIO_REC_SPI_IRQHANDLER(void);
60 | uint32_t WaveRecorderInit(uint32_t AudioFreq, uint32_t BitRes, uint32_t ChnlNbr);
61 | uint8_t WaveRecorderStart(uint16_t* pbuf, uint32_t size);
62 | uint32_t WaveRecorderStop(void);
63 | uint32_t WavaRecorderHeaderInit(uint8_t* pHeadBuf);
64 | void Delay(__IO uint32_t nTime);
65 | void WaveRecorderUpdate(void);
66 | void simple_rec_start(void);
67 |
68 | static void WaveRecorder_GPIO_Init(void);
69 | static void WaveRecorder_SPI_Init(uint32_t Freq);
70 | static void WaveRecorder_DMA_Init(void);
71 |
72 | #endif /* __WAVE_RECORDER_H */
73 |
74 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/
75 |
--------------------------------------------------------------------------------