├── Drivers
├── CMSIS
│ ├── Device
│ │ └── ST
│ │ │ └── STM32F4xx
│ │ │ └── Include
│ │ │ ├── stm32f401xc.h
│ │ │ ├── stm32f401xe.h
│ │ │ ├── stm32f405xx.h
│ │ │ ├── stm32f407xx.h
│ │ │ ├── stm32f410cx.h
│ │ │ ├── stm32f410rx.h
│ │ │ ├── stm32f410tx.h
│ │ │ ├── stm32f411xe.h
│ │ │ ├── stm32f412cx.h
│ │ │ ├── stm32f412rx.h
│ │ │ ├── stm32f412vx.h
│ │ │ ├── stm32f412zx.h
│ │ │ ├── stm32f415xx.h
│ │ │ ├── stm32f417xx.h
│ │ │ ├── stm32f427xx.h
│ │ │ ├── stm32f429xx.h
│ │ │ ├── stm32f437xx.h
│ │ │ ├── stm32f439xx.h
│ │ │ ├── stm32f446xx.h
│ │ │ ├── stm32f469xx.h
│ │ │ ├── stm32f479xx.h
│ │ │ ├── stm32f4xx.h
│ │ │ └── system_stm32f4xx.h
│ └── Include
│ │ ├── core_cmFunc.h
│ │ ├── core_cmInstr.h
│ │ ├── core_cmSimd.h
│ │ ├── arm_const_structs.h
│ │ └── arm_common_tables.h
└── STM32F4xx_HAL_Driver
│ ├── Inc
│ ├── stm32f4xx_hal_flash_ramfunc.h
│ ├── stm32f4xx_hal_dma_ex.h
│ ├── stm32f4xx_hal_def.h
│ └── stm32f4xx_hal_hcd.h
│ └── Src
│ ├── stm32f4xx_hal_flash_ramfunc.c
│ └── stm32f4xx_hal_dma_ex.c
├── .settings
├── com.atollic.truestudio.debug.hardware_device.prefs
├── language.settings.xml
└── org.eclipse.cdt.managedbuilder.core.prefs
├── segger_flash.jflash
├── stm32f407_segger.jflash
├── .project
├── Inc
├── usb_host.h
├── stm32f4xx_it.h
├── mxconstants.h
└── usbh_conf.h
├── Middlewares
└── ST
│ └── STM32_USB_Host_Library
│ ├── Class
│ └── HID
│ │ ├── Inc
│ │ ├── usbh_hid_parser.h
│ │ ├── usbh_hid_mouse.h
│ │ ├── usbh_hid_usage.h
│ │ └── usbh_hid.h
│ │ └── Src
│ │ ├── usbh_hid_parser.c
│ │ └── usbh_hid_mouse.c
│ └── Core
│ ├── Inc
│ ├── usbh_pipes.h
│ ├── usbh_ctlreq.h
│ ├── usbh_ioreq.h
│ └── usbh_core.h
│ └── Src
│ └── usbh_pipes.c
├── Src
├── stm32f4xx_it.c
├── usb_host.c
├── stm32f4xx_hal_msp.c
└── main.c
├── STM32F407VG_FLASH.ld
├── .mxproject
└── stm32f407_disco_usbh_hid.ioc
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xc.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xc.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xe.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xe.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f405xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f405xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410cx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410cx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410rx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410rx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410tx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410tx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412cx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412cx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412rx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412rx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412vx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412vx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412zx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412zx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f415xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f415xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f417xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f417xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f427xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f427xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f437xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f437xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f439xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f439xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f469xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f469xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f479xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f479xx.h
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/jhgorse/stm32f407_disco_usbh_hid/HEAD/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
--------------------------------------------------------------------------------
/.settings/com.atollic.truestudio.debug.hardware_device.prefs:
--------------------------------------------------------------------------------
1 | BOARD=None
2 | CODE_LOCATION=FLASH
3 | ENDIAN=Little-endian
4 | MCU=STM32F407VG
5 | MCU_VENDOR=STMicroelectronics
6 | MODEL=Lite
7 | PROBE=ST-LINK
8 | PROJECT_FORMAT_VERSION=2
9 | TARGET=ARM\u00AE
10 | VERSION=4.1.0
11 | eclipse.preferences.version=1
12 |
--------------------------------------------------------------------------------
/.settings/language.settings.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/.settings/org.eclipse.cdt.managedbuilder.core.prefs:
--------------------------------------------------------------------------------
1 | eclipse.preferences.version=1
2 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/CPATH/delimiter=;
3 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/CPATH/operation=remove
4 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/C_INCLUDE_PATH/delimiter=;
5 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/C_INCLUDE_PATH/operation=remove
6 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/append=true
7 | environment/buildEnvironmentInclude/com.atollic.truestudio.exe.debug.1518366166/appendContributed=true
8 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/LIBRARY_PATH/delimiter=;
9 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/LIBRARY_PATH/operation=remove
10 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/append=true
11 | environment/buildEnvironmentLibrary/com.atollic.truestudio.exe.debug.1518366166/appendContributed=true
12 |
--------------------------------------------------------------------------------
/segger_flash.jflash:
--------------------------------------------------------------------------------
1 | AppVersion = 51209
2 | [GENERAL]
3 | ConnectMode = 0
4 | CurrentFile = "C:\STM32\2016 teb tft archive\STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade\Binary\STM32F4-Discovery_FW_Upgrade_V1.0.0.hex"
5 | DataFileSAddr = 0x00000000
6 | GUIMode = 0
7 | HostName = ""
8 | TargetIF = 1
9 | USBPort = 0
10 | USBSerialNo = 0x00000000
11 | [JTAG]
12 | IRLen = 0
13 | MultipleTargets = 0
14 | NumDevices = 0
15 | Speed0 = 4000
16 | Speed1 = 4000
17 | TAP_Number = 0
18 | UseAdaptive0 = 0
19 | UseAdaptive1 = 0
20 | UseMaxSpeed0 = 0
21 | UseMaxSpeed1 = 0
22 | [CPU]
23 | CheckCoreID = 1
24 | ChipName = "ST STM32F407VG"
25 | ClockSpeed = 0x00000000
26 | Core = 0x0E0000FF
27 | CoreID = 0x4BA00477
28 | CoreIDMask = 0x0F000FFF
29 | DeviceFamily = 0x0000000E
30 | EndianMode = 0
31 | HasInternalFlash = 1
32 | InitStep0_Action = "Reset"
33 | InitStep0_Comment = "Reset and halt target"
34 | InitStep0_Value0 = 0x00000000
35 | InitStep0_Value1 = 0x00000000
36 | NumExitSteps = 0
37 | NumInitSteps = 1
38 | RAMAddr = 0x20000000
39 | RAMSize = 0x00020000
40 | ScriptFile = ""
41 | UseAutoSpeed = 0x00000001
42 | UseRAM = 1
43 | UseScriptFile = 0
44 | [FLASH]
45 | aSectorSel[12] = 1,1,1,1,1,1,1,1,1,1,1,1
46 | AutoDetect = 0
47 | BankName = ""
48 | BankSelMode = 1
49 | BaseAddr = 0x08000000
50 | CheckId = 0
51 | CustomRAMCode = ""
52 | DeviceName = "STM32F407xG internal"
53 | EndBank = 11
54 | NumBanks = 1
55 | OrgNumBits = 32
56 | OrgNumChips = 1
57 | StartBank = 0
58 | UseCustomRAMCode = 0
59 | [PRODUCTION]
60 | AutoPerformsErase = 1
61 | AutoPerformsHardLock = 0
62 | AutoPerformsHardUnlock = 0
63 | AutoPerformsProgram = 1
64 | AutoPerformsSecure = 0
65 | AutoPerformsSoftLock = 0
66 | AutoPerformsSoftUnlock = 1
67 | AutoPerformsStartApp = 0
68 | AutoPerformsUnsecure = 0
69 | AutoPerformsVerify = 1
70 | EnableProductionMode = 0
71 | EnableTargetPower = 0
72 | EraseType = 2
73 | MonitorVTref = 0
74 | MonitorVTrefMax = 0x0000157C
75 | MonitorVTrefMin = 0x000003E8
76 | OverrideTimeouts = 0
77 | ProductionDelay = 0x000001F4
78 | ProductionThreshold = 0x00000BB8
79 | ProgramSN = 0
80 | SerialFile = ""
81 | SNAddr = 0x00000000
82 | SNInc = 0x00000001
83 | SNLen = 0x00000008
84 | SNListFile = ""
85 | SNValue = 0x00000001
86 | StartAppType = 0
87 | TargetPowerDelay = 0x00000014
88 | TimeoutErase = 0x00003A98
89 | TimeoutProgram = 0x00002710
90 | VerifyType = 1
91 |
--------------------------------------------------------------------------------
/stm32f407_segger.jflash:
--------------------------------------------------------------------------------
1 | AppVersion = 51209
2 | [GENERAL]
3 | ConnectMode = 0
4 | CurrentFile = "C:\STM32\2016 teb tft archive\STM32F4-Discovery_FW_V1.1.0\Project\FW_upgrade\Binary\STM32F4-Discovery_FW_Upgrade_V1.0.0.hex"
5 | DataFileSAddr = 0x08000000
6 | GUIMode = 0
7 | HostName = ""
8 | TargetIF = 1
9 | USBPort = 0
10 | USBSerialNo = 0x00000000
11 | [JTAG]
12 | IRLen = 0
13 | MultipleTargets = 0
14 | NumDevices = 0
15 | Speed0 = 4000
16 | Speed1 = 4000
17 | TAP_Number = 0
18 | UseAdaptive0 = 0
19 | UseAdaptive1 = 0
20 | UseMaxSpeed0 = 0
21 | UseMaxSpeed1 = 0
22 | [CPU]
23 | CheckCoreID = 1
24 | ChipName = "ST STM32F407VG"
25 | ClockSpeed = 0x00000000
26 | Core = 0x0E0000FF
27 | CoreID = 0x4BA00477
28 | CoreIDMask = 0x0F000FFF
29 | DeviceFamily = 0x0000000E
30 | EndianMode = 0
31 | HasInternalFlash = 1
32 | InitStep0_Action = "Reset"
33 | InitStep0_Comment = "Reset and halt target"
34 | InitStep0_Value0 = 0x00000000
35 | InitStep0_Value1 = 0x00000000
36 | NumExitSteps = 0
37 | NumInitSteps = 1
38 | RAMAddr = 0x20000000
39 | RAMSize = 0x00020000
40 | ScriptFile = ""
41 | UseAutoSpeed = 0x00000001
42 | UseRAM = 1
43 | UseScriptFile = 0
44 | [FLASH]
45 | aSectorSel[12] = 1,1,1,1,1,1,1,1,1,1,1,1
46 | AutoDetect = 0
47 | BankName = ""
48 | BankSelMode = 1
49 | BaseAddr = 0x08000000
50 | CheckId = 0
51 | CustomRAMCode = ""
52 | DeviceName = "STM32F407xG internal"
53 | EndBank = 11
54 | NumBanks = 1
55 | OrgNumBits = 32
56 | OrgNumChips = 1
57 | StartBank = 0
58 | UseCustomRAMCode = 0
59 | [PRODUCTION]
60 | AutoPerformsErase = 1
61 | AutoPerformsHardLock = 0
62 | AutoPerformsHardUnlock = 0
63 | AutoPerformsProgram = 1
64 | AutoPerformsSecure = 0
65 | AutoPerformsSoftLock = 0
66 | AutoPerformsSoftUnlock = 1
67 | AutoPerformsStartApp = 0
68 | AutoPerformsUnsecure = 0
69 | AutoPerformsVerify = 1
70 | EnableProductionMode = 0
71 | EnableTargetPower = 0
72 | EraseType = 2
73 | MonitorVTref = 0
74 | MonitorVTrefMax = 0x0000157C
75 | MonitorVTrefMin = 0x000003E8
76 | OverrideTimeouts = 0
77 | ProductionDelay = 0x000001F4
78 | ProductionThreshold = 0x00000BB8
79 | ProgramSN = 0
80 | SerialFile = ""
81 | SNAddr = 0x00000000
82 | SNInc = 0x00000001
83 | SNLen = 0x00000008
84 | SNListFile = ""
85 | SNValue = 0x00000001
86 | StartAppType = 0
87 | TargetPowerDelay = 0x00000014
88 | TimeoutErase = 0x00003A98
89 | TimeoutProgram = 0x00002710
90 | VerifyType = 1
91 |
--------------------------------------------------------------------------------
/.project:
--------------------------------------------------------------------------------
1 |
2 |
3 | stm32f407_disco_usbh_hid
4 |
5 |
6 |
7 |
8 |
9 | org.eclipse.cdt.managedbuilder.core.genmakebuilder
10 | clean,full,incremental,
11 |
12 |
13 | ?children?
14 | ?name?=outputEntries\|?children?=?name?=entry\\\\\\\|\\\|\||
15 |
16 |
17 | ?name?
18 |
19 |
20 |
21 | org.eclipse.cdt.make.core.append_environment
22 | true
23 |
24 |
25 | org.eclipse.cdt.make.core.buildArguments
26 |
27 |
28 |
29 | org.eclipse.cdt.make.core.buildCommand
30 | make
31 |
32 |
33 | org.eclipse.cdt.make.core.buildLocation
34 | ${workspace_loc:/STM32100B-EVAL/Debug}
35 |
36 |
37 | org.eclipse.cdt.make.core.contents
38 | org.eclipse.cdt.make.core.activeConfigSettings
39 |
40 |
41 | org.eclipse.cdt.make.core.enableAutoBuild
42 | false
43 |
44 |
45 | org.eclipse.cdt.make.core.enableCleanBuild
46 | true
47 |
48 |
49 | org.eclipse.cdt.make.core.enableFullBuild
50 | true
51 |
52 |
53 | org.eclipse.cdt.make.core.stopOnError
54 | true
55 |
56 |
57 | org.eclipse.cdt.make.core.useDefaultBuildCmd
58 | true
59 |
60 |
61 |
62 |
63 | org.eclipse.cdt.managedbuilder.core.ScannerConfigBuilder
64 |
65 |
66 |
67 |
68 |
69 | org.eclipse.cdt.core.cnature
70 | org.eclipse.cdt.managedbuilder.core.managedBuildNature
71 | org.eclipse.cdt.managedbuilder.core.ScannerConfigNature
72 |
73 |
74 |
75 |
76 |
77 |
78 |
79 |
80 |
81 |
--------------------------------------------------------------------------------
/Inc/usb_host.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : USB_HOST
4 | * @version : v1.0_Cube
5 | * @brief : Header for usb_host file.
6 | ******************************************************************************
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 |
34 | /* Define to prevent recursive inclusion -------------------------------------*/
35 | #ifndef __usb_host_H
36 | #define __usb_host_H
37 | #ifdef __cplusplus
38 | extern "C" {
39 | #endif
40 |
41 | /* Includes ------------------------------------------------------------------*/
42 | #include "stm32f4xx.h"
43 | #include "stm32f4xx_hal.h"
44 |
45 | typedef enum {
46 | APPLICATION_IDLE = 0,
47 | APPLICATION_START,
48 | APPLICATION_READY,
49 | APPLICATION_DISCONNECT,
50 | }ApplicationTypeDef;
51 |
52 | void MX_USB_HOST_Init(void);
53 | void MX_USB_HOST_Process(void);
54 |
55 | #ifdef __cplusplus
56 | }
57 | #endif
58 | #endif /*__usb_host_H */
59 |
60 | /**
61 | * @}
62 | */
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
69 |
--------------------------------------------------------------------------------
/Inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.h
4 | * @brief This file contains the headers of the interrupt handlers.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 |
34 | /* Define to prevent recursive inclusion -------------------------------------*/
35 | #ifndef __STM32F4xx_IT_H
36 | #define __STM32F4xx_IT_H
37 |
38 | #ifdef __cplusplus
39 | extern "C" {
40 | #endif
41 |
42 | /* Includes ------------------------------------------------------------------*/
43 | /* Exported types ------------------------------------------------------------*/
44 | /* Exported constants --------------------------------------------------------*/
45 | /* Exported macro ------------------------------------------------------------*/
46 | /* Exported functions ------------------------------------------------------- */
47 |
48 | void SysTick_Handler(void);
49 | void OTG_FS_IRQHandler(void);
50 |
51 | #ifdef __cplusplus
52 | }
53 | #endif
54 |
55 | #endif /* __STM32F4xx_IT_H */
56 |
57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
58 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_parser.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid_parser.c
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file is the header file of the usbh_hid_parser.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | *
© COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive -----------------------------------------------*/
29 | #ifndef __USBH_HID_PARSER_H
30 | #define __USBH_HID_PARSER_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_hid.h"
38 | #include "usbh_hid_usage.h"
39 |
40 | /** @addtogroup USBH_LIB
41 | * @{
42 | */
43 |
44 | /** @addtogroup USBH_CLASS
45 | * @{
46 | */
47 |
48 | /** @addtogroup USBH_HID_CLASS
49 | * @{
50 | */
51 |
52 | /** @defgroup USBH_HID_PARSER
53 | * @brief This file is the Header file for usbh_hid_parser.c
54 | * @{
55 | */
56 |
57 |
58 | /** @defgroup USBH_HID_PARSER_Exported_Types
59 | * @{
60 | */
61 | typedef struct
62 | {
63 | uint8_t *data;
64 | uint32_t size;
65 | uint8_t shift;
66 | uint8_t count;
67 | uint8_t sign;
68 | uint32_t logical_min; /*min value device can return*/
69 | uint32_t logical_max; /*max value device can return*/
70 | uint32_t physical_min; /*min vale read can report*/
71 | uint32_t physical_max; /*max value read can report*/
72 | uint32_t resolution;
73 | }
74 | HID_Report_ItemTypedef;
75 |
76 |
77 | uint32_t HID_ReadItem (HID_Report_ItemTypedef *ri, uint8_t ndx);
78 | uint32_t HID_WriteItem(HID_Report_ItemTypedef *ri, uint32_t value, uint8_t ndx);
79 |
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | #ifdef __cplusplus
86 | }
87 | #endif
88 |
89 | #endif /* __USBH_HID_PARSER_H */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /**
100 | * @}
101 | */
102 |
103 | /**
104 | * @}
105 | */
106 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
107 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_mouse.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid_mouse.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file contains all the prototypes for the usbh_hid_mouse.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_HID_MOUSE_H
30 | #define __USBH_HID_MOUSE_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_hid.h"
38 |
39 | /** @addtogroup USBH_LIB
40 | * @{
41 | */
42 |
43 | /** @addtogroup USBH_CLASS
44 | * @{
45 | */
46 |
47 | /** @addtogroup USBH_HID_CLASS
48 | * @{
49 | */
50 |
51 | /** @defgroup USBH_HID_MOUSE
52 | * @brief This file is the Header file for usbh_hid_mouse.c
53 | * @{
54 | */
55 |
56 |
57 | /** @defgroup USBH_HID_MOUSE_Exported_Types
58 | * @{
59 | */
60 |
61 | typedef struct _HID_MOUSE_Info
62 | {
63 | uint8_t x;
64 | uint8_t y;
65 | uint8_t buttons[3];
66 | }
67 | HID_MOUSE_Info_TypeDef;
68 |
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBH_HID_MOUSE_Exported_Defines
74 | * @{
75 | */
76 | /**
77 | * @}
78 | */
79 |
80 | /** @defgroup USBH_HID_MOUSE_Exported_Macros
81 | * @{
82 | */
83 | /**
84 | * @}
85 | */
86 |
87 | /** @defgroup USBH_HID_MOUSE_Exported_Variables
88 | * @{
89 | */
90 | /**
91 | * @}
92 | */
93 |
94 | /** @defgroup USBH_HID_MOUSE_Exported_FunctionsPrototype
95 | * @{
96 | */
97 | USBH_StatusTypeDef USBH_HID_MouseInit(USBH_HandleTypeDef *phost);
98 | HID_MOUSE_Info_TypeDef *USBH_HID_GetMouseInfo(USBH_HandleTypeDef *phost);
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | #ifdef __cplusplus
105 | }
106 | #endif
107 |
108 | #endif /* __USBH_HID_MOUSE_H */
109 |
110 | /**
111 | * @}
112 | */
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /**
119 | * @}
120 | */
121 |
122 | /**
123 | * @}
124 | */
125 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
126 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_pipes.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_pipes.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief Header file for usbh_pipes.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_PIPES_H
30 | #define __USBH_PIPES_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_core.h"
38 |
39 | /** @addtogroup USBH_LIB
40 | * @{
41 | */
42 |
43 | /** @addtogroup USBH_LIB_CORE
44 | * @{
45 | */
46 |
47 | /** @defgroup USBH_PIPES
48 | * @brief This file is the header file for usbh_pipes.c
49 | * @{
50 | */
51 |
52 | /** @defgroup USBH_PIPES_Exported_Defines
53 | * @{
54 | */
55 | /**
56 | * @}
57 | */
58 |
59 | /** @defgroup USBH_PIPES_Exported_Types
60 | * @{
61 | */
62 | /**
63 | * @}
64 | */
65 |
66 |
67 | /** @defgroup USBH_PIPES_Exported_Macros
68 | * @{
69 | */
70 | /**
71 | * @}
72 | */
73 |
74 | /** @defgroup USBH_PIPES_Exported_Variables
75 | * @{
76 | */
77 | /**
78 | * @}
79 | */
80 |
81 | /** @defgroup USBH_PIPES_Exported_FunctionsPrototype
82 | * @{
83 | */
84 |
85 | USBH_StatusTypeDef USBH_OpenPipe (USBH_HandleTypeDef *phost,
86 | uint8_t ch_num,
87 | uint8_t epnum,
88 | uint8_t dev_address,
89 | uint8_t speed,
90 | uint8_t ep_type,
91 | uint16_t mps);
92 |
93 | USBH_StatusTypeDef USBH_ClosePipe (USBH_HandleTypeDef *phost,
94 | uint8_t pipe_num);
95 |
96 | uint8_t USBH_AllocPipe (USBH_HandleTypeDef *phost,
97 | uint8_t ep_addr);
98 |
99 | USBH_StatusTypeDef USBH_FreePipe (USBH_HandleTypeDef *phost,
100 | uint8_t idx);
101 |
102 |
103 |
104 |
105 | /**
106 | * @}
107 | */
108 |
109 |
110 | #ifdef __cplusplus
111 | }
112 | #endif
113 |
114 | #endif /* __USBH_PIPES_H */
115 |
116 |
117 | /**
118 | * @}
119 | */
120 |
121 | /**
122 | * @}
123 | */
124 |
125 | /**
126 | * @}
127 | */
128 |
129 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
130 |
131 |
132 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmFunc.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmFunc.h
3 | * @brief CMSIS Cortex-M Core Function Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMFUNC_H
42 | #define __CORE_CMFUNC_H
43 |
44 |
45 | /* ########################### Core Function Access ########################### */
46 | /** \ingroup CMSIS_Core_FunctionInterface
47 | \defgroup CMSIS_Core_RegAccFunctions CMSIS Core Register Access Functions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@} end of CMSIS_Core_RegAccFunctions */
86 |
87 | #endif /* __CORE_CMFUNC_H */
88 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmInstr.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmInstr.h
3 | * @brief CMSIS Cortex-M Core Instruction Access Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMINSTR_H
42 | #define __CORE_CMINSTR_H
43 |
44 |
45 | /* ########################## Core Instruction Access ######################### */
46 | /** \defgroup CMSIS_Core_InstructionInterface CMSIS Core Instruction Interface
47 | Access to dedicated instructions
48 | @{
49 | */
50 |
51 | /*------------------ RealView Compiler -----------------*/
52 | #if defined ( __CC_ARM )
53 | #include "cmsis_armcc.h"
54 |
55 | /*------------------ ARM Compiler V6 -------------------*/
56 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
57 | #include "cmsis_armcc_V6.h"
58 |
59 | /*------------------ GNU Compiler ----------------------*/
60 | #elif defined ( __GNUC__ )
61 | #include "cmsis_gcc.h"
62 |
63 | /*------------------ ICC Compiler ----------------------*/
64 | #elif defined ( __ICCARM__ )
65 | #include
66 |
67 | /*------------------ TI CCS Compiler -------------------*/
68 | #elif defined ( __TMS470__ )
69 | #include
70 |
71 | /*------------------ TASKING Compiler ------------------*/
72 | #elif defined ( __TASKING__ )
73 | /*
74 | * The CMSIS functions have been implemented as intrinsics in the compiler.
75 | * Please use "carm -?i" to get an up to date list of all intrinsics,
76 | * Including the CMSIS ones.
77 | */
78 |
79 | /*------------------ COSMIC Compiler -------------------*/
80 | #elif defined ( __CSMC__ )
81 | #include
82 |
83 | #endif
84 |
85 | /*@}*/ /* end of group CMSIS_Core_InstructionInterface */
86 |
87 | #endif /* __CORE_CMINSTR_H */
88 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/core_cmSimd.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file core_cmSimd.h
3 | * @brief CMSIS Cortex-M SIMD Header File
4 | * @version V4.30
5 | * @date 20. October 2015
6 | ******************************************************************************/
7 | /* Copyright (c) 2009 - 2015 ARM LIMITED
8 |
9 | All rights reserved.
10 | Redistribution and use in source and binary forms, with or without
11 | modification, are permitted provided that the following conditions are met:
12 | - Redistributions of source code must retain the above copyright
13 | notice, this list of conditions and the following disclaimer.
14 | - Redistributions in binary form must reproduce the above copyright
15 | notice, this list of conditions and the following disclaimer in the
16 | documentation and/or other materials provided with the distribution.
17 | - Neither the name of ARM nor the names of its contributors may be used
18 | to endorse or promote products derived from this software without
19 | specific prior written permission.
20 | *
21 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24 | ARE DISCLAIMED. IN NO EVENT SHALL COPYRIGHT HOLDERS AND CONTRIBUTORS BE
25 | LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
26 | CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
27 | SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
28 | INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
29 | CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
30 | ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
31 | POSSIBILITY OF SUCH DAMAGE.
32 | ---------------------------------------------------------------------------*/
33 |
34 |
35 | #if defined ( __ICCARM__ )
36 | #pragma system_include /* treat file as system include file for MISRA check */
37 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
38 | #pragma clang system_header /* treat file as system include file */
39 | #endif
40 |
41 | #ifndef __CORE_CMSIMD_H
42 | #define __CORE_CMSIMD_H
43 |
44 | #ifdef __cplusplus
45 | extern "C" {
46 | #endif
47 |
48 |
49 | /* ################### Compiler specific Intrinsics ########################### */
50 | /** \defgroup CMSIS_SIMD_intrinsics CMSIS SIMD Intrinsics
51 | Access to dedicated SIMD instructions
52 | @{
53 | */
54 |
55 | /*------------------ RealView Compiler -----------------*/
56 | #if defined ( __CC_ARM )
57 | #include "cmsis_armcc.h"
58 |
59 | /*------------------ ARM Compiler V6 -------------------*/
60 | #elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
61 | #include "cmsis_armcc_V6.h"
62 |
63 | /*------------------ GNU Compiler ----------------------*/
64 | #elif defined ( __GNUC__ )
65 | #include "cmsis_gcc.h"
66 |
67 | /*------------------ ICC Compiler ----------------------*/
68 | #elif defined ( __ICCARM__ )
69 | #include
70 |
71 | /*------------------ TI CCS Compiler -------------------*/
72 | #elif defined ( __TMS470__ )
73 | #include
74 |
75 | /*------------------ TASKING Compiler ------------------*/
76 | #elif defined ( __TASKING__ )
77 | /*
78 | * The CMSIS functions have been implemented as intrinsics in the compiler.
79 | * Please use "carm -?i" to get an up to date list of all intrinsics,
80 | * Including the CMSIS ones.
81 | */
82 |
83 | /*------------------ COSMIC Compiler -------------------*/
84 | #elif defined ( __CSMC__ )
85 | #include
86 |
87 | #endif
88 |
89 | /*@} end of group CMSIS_SIMD_intrinsics */
90 |
91 |
92 | #ifdef __cplusplus
93 | }
94 | #endif
95 |
96 | #endif /* __CORE_CMSIMD_H */
97 |
--------------------------------------------------------------------------------
/Src/stm32f4xx_it.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_it.c
4 | * @brief Interrupt Service Routines.
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 | /* Includes ------------------------------------------------------------------*/
34 | #include "stm32f4xx_hal.h"
35 | #include "stm32f4xx.h"
36 | #include "stm32f4xx_it.h"
37 |
38 | /* USER CODE BEGIN 0 */
39 |
40 | /* USER CODE END 0 */
41 |
42 | /* External variables --------------------------------------------------------*/
43 | extern HCD_HandleTypeDef hhcd_USB_OTG_FS;
44 |
45 | /******************************************************************************/
46 | /* Cortex-M4 Processor Interruption and Exception Handlers */
47 | /******************************************************************************/
48 |
49 | /**
50 | * @brief This function handles System tick timer.
51 | */
52 | void SysTick_Handler(void)
53 | {
54 | /* USER CODE BEGIN SysTick_IRQn 0 */
55 |
56 | /* USER CODE END SysTick_IRQn 0 */
57 | HAL_IncTick();
58 | HAL_SYSTICK_IRQHandler();
59 | /* USER CODE BEGIN SysTick_IRQn 1 */
60 |
61 | /* USER CODE END SysTick_IRQn 1 */
62 | }
63 |
64 | /******************************************************************************/
65 | /* STM32F4xx Peripheral Interrupt Handlers */
66 | /* Add here the Interrupt Handlers for the used peripherals. */
67 | /* For the available peripheral interrupt handler names, */
68 | /* please refer to the startup file (startup_stm32f4xx.s). */
69 | /******************************************************************************/
70 |
71 | /**
72 | * @brief This function handles USB On The Go FS global interrupt.
73 | */
74 | void OTG_FS_IRQHandler(void)
75 | {
76 | /* USER CODE BEGIN OTG_FS_IRQn 0 */
77 |
78 | /* USER CODE END OTG_FS_IRQn 0 */
79 | HAL_HCD_IRQHandler(&hhcd_USB_OTG_FS);
80 | /* USER CODE BEGIN OTG_FS_IRQn 1 */
81 |
82 | /* USER CODE END OTG_FS_IRQn 1 */
83 | }
84 |
85 | /* USER CODE BEGIN 1 */
86 |
87 | /* USER CODE END 1 */
88 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
89 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_flash_ramfunc.h
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief Header file of FLASH RAMFUNC driver.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H
40 | #define __STM32F4xx_FLASH_RAMFUNC_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
46 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
47 |
48 | /* Includes ------------------------------------------------------------------*/
49 | #include "stm32f4xx_hal_def.h"
50 |
51 | /** @addtogroup STM32F4xx_HAL_Driver
52 | * @{
53 | */
54 |
55 | /** @addtogroup FLASH_RAMFUNC
56 | * @{
57 | */
58 |
59 | /* Exported types ------------------------------------------------------------*/
60 | /* Exported macro ------------------------------------------------------------*/
61 | /* Exported functions --------------------------------------------------------*/
62 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
63 | * @{
64 | */
65 |
66 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
67 | * @{
68 | */
69 | __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void);
70 | __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void);
71 | __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void);
72 | __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void);
73 | /**
74 | * @}
75 | */
76 |
77 | /**
78 | * @}
79 | */
80 |
81 | /**
82 | * @}
83 | */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
90 | #ifdef __cplusplus
91 | }
92 | #endif
93 |
94 |
95 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */
96 |
97 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
98 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/arm_const_structs.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 19. March 2015
5 | * $Revision: V.1.4.5
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_const_structs.h
9 | *
10 | * Description: This file has constant structs that are initialized for
11 | * user convenience. For example, some can be given as
12 | * arguments to the arm_cfft_f32() function.
13 | *
14 | * Target Processor: Cortex-M4/Cortex-M3
15 | *
16 | * Redistribution and use in source and binary forms, with or without
17 | * modification, are permitted provided that the following conditions
18 | * are met:
19 | * - Redistributions of source code must retain the above copyright
20 | * notice, this list of conditions and the following disclaimer.
21 | * - Redistributions in binary form must reproduce the above copyright
22 | * notice, this list of conditions and the following disclaimer in
23 | * the documentation and/or other materials provided with the
24 | * distribution.
25 | * - Neither the name of ARM LIMITED nor the names of its contributors
26 | * may be used to endorse or promote products derived from this
27 | * software without specific prior written permission.
28 | *
29 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
30 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
31 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
32 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
33 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
34 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
35 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
36 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
37 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
38 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
39 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
40 | * POSSIBILITY OF SUCH DAMAGE.
41 | * -------------------------------------------------------------------- */
42 |
43 | #ifndef _ARM_CONST_STRUCTS_H
44 | #define _ARM_CONST_STRUCTS_H
45 |
46 | #include "arm_math.h"
47 | #include "arm_common_tables.h"
48 |
49 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
50 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
51 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
52 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
53 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
54 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
55 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
56 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
57 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
58 |
59 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
60 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
61 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
62 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
63 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
64 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
65 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
66 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
67 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
68 |
69 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
70 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
71 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
72 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
73 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
74 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
75 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
76 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
77 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
78 |
79 | #endif
80 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @version V2.5.1
6 | * @date 28-June-2016
7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /** @addtogroup CMSIS
39 | * @{
40 | */
41 |
42 | /** @addtogroup stm32f4xx_system
43 | * @{
44 | */
45 |
46 | /**
47 | * @brief Define to prevent recursive inclusion
48 | */
49 | #ifndef __SYSTEM_STM32F4XX_H
50 | #define __SYSTEM_STM32F4XX_H
51 |
52 | #ifdef __cplusplus
53 | extern "C" {
54 | #endif
55 |
56 | /** @addtogroup STM32F4xx_System_Includes
57 | * @{
58 | */
59 |
60 | /**
61 | * @}
62 | */
63 |
64 |
65 | /** @addtogroup STM32F4xx_System_Exported_types
66 | * @{
67 | */
68 | /* This variable is updated in three ways:
69 | 1) by calling CMSIS function SystemCoreClockUpdate()
70 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
71 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
72 | Note: If you use this function to configure the system clock; then there
73 | is no need to call the 2 first functions listed above, since SystemCoreClock
74 | variable is updated automatically.
75 | */
76 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
77 |
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /** @addtogroup STM32F4xx_System_Exported_Constants
84 | * @{
85 | */
86 |
87 | /**
88 | * @}
89 | */
90 |
91 | /** @addtogroup STM32F4xx_System_Exported_Macros
92 | * @{
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | /** @addtogroup STM32F4xx_System_Exported_Functions
100 | * @{
101 | */
102 |
103 | extern void SystemInit(void);
104 | extern void SystemCoreClockUpdate(void);
105 | /**
106 | * @}
107 | */
108 |
109 | #ifdef __cplusplus
110 | }
111 | #endif
112 |
113 | #endif /*__SYSTEM_STM32F4XX_H */
114 |
115 | /**
116 | * @}
117 | */
118 |
119 | /**
120 | * @}
121 | */
122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
123 |
--------------------------------------------------------------------------------
/Src/usb_host.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : USB_HOST
4 | * @version : v1.0_Cube
5 | * @brief : This file implements the USB Host
6 | ******************************************************************************
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 |
34 | /* Includes ------------------------------------------------------------------*/
35 |
36 | #include "usb_host.h"
37 | #include "usbh_core.h"
38 | #include "usbh_hid.h"
39 |
40 | /* USB Host Core handle declaration */
41 | USBH_HandleTypeDef hUsbHostFS;
42 | ApplicationTypeDef Appli_state = APPLICATION_IDLE;
43 |
44 | /**
45 | * -- Insert your variables declaration here --
46 | */
47 | /* USER CODE BEGIN 0 */
48 |
49 | /* USER CODE END 0 */
50 |
51 | /*
52 | * user callbak declaration
53 | */
54 | static void USBH_UserProcess (USBH_HandleTypeDef *phost, uint8_t id);
55 |
56 | /**
57 | * -- Insert your external function declaration here --
58 | */
59 | /* USER CODE BEGIN 1 */
60 |
61 | void USBH_HID_EventCallback(USBH_HandleTypeDef *phost) {
62 | printf("key %c\n", USBH_HID_GetASCIICode(USBH_HID_GetKeybdInfo(phost)));
63 | }
64 | /* USER CODE END 1 */
65 |
66 | /* init function */
67 | void MX_USB_HOST_Init(void)
68 | {
69 | /* Init Host Library,Add Supported Class and Start the library*/
70 | USBH_Init(&hUsbHostFS, USBH_UserProcess, HOST_FS);
71 |
72 | USBH_RegisterClass(&hUsbHostFS, USBH_HID_CLASS);
73 |
74 | USBH_Start(&hUsbHostFS);
75 | }
76 |
77 | /*
78 | * Background task
79 | */
80 | void MX_USB_HOST_Process(void)
81 | {
82 | /* USB Host Background task */
83 | USBH_Process(&hUsbHostFS);
84 | }
85 | /*
86 | * user callbak definition
87 | */
88 | static void USBH_UserProcess (USBH_HandleTypeDef *phost, uint8_t id)
89 | {
90 |
91 | /* USER CODE BEGIN 2 */
92 | switch(id)
93 | {
94 | case HOST_USER_SELECT_CONFIGURATION:
95 | break;
96 |
97 | case HOST_USER_DISCONNECTION:
98 | Appli_state = APPLICATION_DISCONNECT;
99 | break;
100 |
101 | case HOST_USER_CLASS_ACTIVE:
102 | Appli_state = APPLICATION_READY;
103 | break;
104 |
105 | case HOST_USER_CONNECTION:
106 | Appli_state = APPLICATION_START;
107 | break;
108 |
109 | default:
110 | break;
111 | }
112 | /* USER CODE END 2 */
113 | }
114 |
115 | /**
116 | * @}
117 | */
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
124 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_dma_ex.h
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief Header file of DMA HAL extension module.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32F4xx_HAL_DMA_EX_H
40 | #define __STM32F4xx_HAL_DMA_EX_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 |
46 | /* Includes ------------------------------------------------------------------*/
47 | #include "stm32f4xx_hal_def.h"
48 |
49 | /** @addtogroup STM32F4xx_HAL_Driver
50 | * @{
51 | */
52 |
53 | /** @addtogroup DMAEx
54 | * @{
55 | */
56 |
57 | /* Exported types ------------------------------------------------------------*/
58 | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
59 | * @brief DMAEx Exported types
60 | * @{
61 | */
62 |
63 | /**
64 | * @brief HAL DMA Memory definition
65 | */
66 | typedef enum
67 | {
68 | MEMORY0 = 0x00U, /*!< Memory 0 */
69 | MEMORY1 = 0x01U /*!< Memory 1 */
70 | }HAL_DMA_MemoryTypeDef;
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /* Exported functions --------------------------------------------------------*/
77 | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions
78 | * @brief DMAEx Exported functions
79 | * @{
80 | */
81 |
82 | /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions
83 | * @brief Extended features functions
84 | * @{
85 | */
86 |
87 | /* IO operation functions *******************************************************/
88 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
89 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
90 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory);
91 |
92 | /**
93 | * @}
94 | */
95 | /**
96 | * @}
97 | */
98 |
99 | /* Private functions ---------------------------------------------------------*/
100 | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions
101 | * @brief DMAEx Private functions
102 | * @{
103 | */
104 | /**
105 | * @}
106 | */
107 |
108 | /**
109 | * @}
110 | */
111 |
112 | /**
113 | * @}
114 | */
115 |
116 | #ifdef __cplusplus
117 | }
118 | #endif
119 |
120 | #endif /*__STM32F4xx_HAL_DMA_EX_H*/
121 |
122 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
123 |
--------------------------------------------------------------------------------
/Inc/mxconstants.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : mxconstants.h
4 | * Description : This file contains the common defines of the application
5 | ******************************************************************************
6 | *
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 | /* Define to prevent recursive inclusion -------------------------------------*/
34 | #ifndef __MXCONSTANT_H
35 | #define __MXCONSTANT_H
36 | /* Includes ------------------------------------------------------------------*/
37 |
38 | /* USER CODE BEGIN Includes */
39 |
40 | /* USER CODE END Includes */
41 |
42 | /* Private define ------------------------------------------------------------*/
43 |
44 | #define CS_I2C_SPI_Pin GPIO_PIN_3
45 | #define CS_I2C_SPI_GPIO_Port GPIOE
46 | #define PC14_OSC32_IN_Pin GPIO_PIN_14
47 | #define PC14_OSC32_IN_GPIO_Port GPIOC
48 | #define PC15_OSC32_OUT_Pin GPIO_PIN_15
49 | #define PC15_OSC32_OUT_GPIO_Port GPIOC
50 | #define PH0_OSC_IN_Pin GPIO_PIN_0
51 | #define PH0_OSC_IN_GPIO_Port GPIOH
52 | #define PH1_OSC_OUT_Pin GPIO_PIN_1
53 | #define PH1_OSC_OUT_GPIO_Port GPIOH
54 | #define OTG_FS_PowerSwitchOn_Pin GPIO_PIN_0
55 | #define OTG_FS_PowerSwitchOn_GPIO_Port GPIOC
56 | #define PDM_OUT_Pin GPIO_PIN_3
57 | #define PDM_OUT_GPIO_Port GPIOC
58 | #define BOOT1_Pin GPIO_PIN_2
59 | #define BOOT1_GPIO_Port GPIOB
60 | #define CLK_IN_Pin GPIO_PIN_10
61 | #define CLK_IN_GPIO_Port GPIOB
62 | #define LD4_Pin GPIO_PIN_12
63 | #define LD4_GPIO_Port GPIOD
64 | #define LD3_Pin GPIO_PIN_13
65 | #define LD3_GPIO_Port GPIOD
66 | #define LD5_Pin GPIO_PIN_14
67 | #define LD5_GPIO_Port GPIOD
68 | #define LD6_Pin GPIO_PIN_15
69 | #define LD6_GPIO_Port GPIOD
70 | #define VBUS_FS_Pin GPIO_PIN_9
71 | #define VBUS_FS_GPIO_Port GPIOA
72 | #define OTG_FS_ID_Pin GPIO_PIN_10
73 | #define OTG_FS_ID_GPIO_Port GPIOA
74 | #define OTG_FS_DM_Pin GPIO_PIN_11
75 | #define OTG_FS_DM_GPIO_Port GPIOA
76 | #define OTG_FS_DP_Pin GPIO_PIN_12
77 | #define OTG_FS_DP_GPIO_Port GPIOA
78 | #define SWDIO_Pin GPIO_PIN_13
79 | #define SWDIO_GPIO_Port GPIOA
80 | #define SWCLK_Pin GPIO_PIN_14
81 | #define SWCLK_GPIO_Port GPIOA
82 | #define I2S3_SCK_Pin GPIO_PIN_10
83 | #define I2S3_SCK_GPIO_Port GPIOC
84 | #define Audio_RST_Pin GPIO_PIN_4
85 | #define Audio_RST_GPIO_Port GPIOD
86 | #define OTG_FS_OverCurrent_Pin GPIO_PIN_5
87 | #define OTG_FS_OverCurrent_GPIO_Port GPIOD
88 | #define SWO_Pin GPIO_PIN_3
89 | #define SWO_GPIO_Port GPIOB
90 | #define Audio_SCL_Pin GPIO_PIN_6
91 | #define Audio_SCL_GPIO_Port GPIOB
92 | #define Audio_SDA_Pin GPIO_PIN_9
93 | #define Audio_SDA_GPIO_Port GPIOB
94 | #define MEMS_INT1_Pin GPIO_PIN_0
95 | #define MEMS_INT1_GPIO_Port GPIOE
96 | #define MEMS_INT2_Pin GPIO_PIN_1
97 | #define MEMS_INT2_GPIO_Port GPIOE
98 | /* USER CODE BEGIN Private defines */
99 |
100 | /* USER CODE END Private defines */
101 |
102 | /**
103 | * @}
104 | */
105 |
106 | /**
107 | * @}
108 | */
109 |
110 | #endif /* __MXCONSTANT_H */
111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
112 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_ctlreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_ctlreq.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief Header file for usbh_ctlreq.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_CTLREQ_H
30 | #define __USBH_CTLREQ_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_core.h"
38 |
39 | /** @addtogroup USBH_LIB
40 | * @{
41 | */
42 |
43 | /** @addtogroup USBH_LIB_CORE
44 | * @{
45 | */
46 |
47 | /** @defgroup USBH_CTLREQ
48 | * @brief This file is the
49 | * @{
50 | */
51 |
52 |
53 | /** @defgroup USBH_CTLREQ_Exported_Defines
54 | * @{
55 | */
56 | /*Standard Feature Selector for clear feature command*/
57 | #define FEATURE_SELECTOR_ENDPOINT 0X00
58 | #define FEATURE_SELECTOR_DEVICE 0X01
59 |
60 |
61 | #define INTERFACE_DESC_TYPE 0x04
62 | #define ENDPOINT_DESC_TYPE 0x05
63 | #define INTERFACE_DESC_SIZE 0x09
64 |
65 | /**
66 | * @}
67 | */
68 |
69 |
70 | /** @defgroup USBH_CTLREQ_Exported_Types
71 | * @{
72 | */
73 | /**
74 | * @}
75 | */
76 |
77 |
78 | /** @defgroup USBH_CTLREQ_Exported_Macros
79 | * @{
80 | */
81 | /**
82 | * @}
83 | */
84 |
85 | /** @defgroup USBH_CTLREQ_Exported_Variables
86 | * @{
87 | */
88 | extern uint8_t USBH_CfgDesc[512];
89 | /**
90 | * @}
91 | */
92 |
93 | /** @defgroup USBH_CTLREQ_Exported_FunctionsPrototype
94 | * @{
95 | */
96 | USBH_StatusTypeDef USBH_CtlReq (USBH_HandleTypeDef *phost,
97 | uint8_t *buff,
98 | uint16_t length);
99 |
100 | USBH_StatusTypeDef USBH_GetDescriptor(USBH_HandleTypeDef *phost,
101 | uint8_t req_type,
102 | uint16_t value_idx,
103 | uint8_t* buff,
104 | uint16_t length );
105 |
106 | USBH_StatusTypeDef USBH_Get_DevDesc(USBH_HandleTypeDef *phost,
107 | uint8_t length);
108 |
109 | USBH_StatusTypeDef USBH_Get_StringDesc(USBH_HandleTypeDef *phost,
110 | uint8_t string_index,
111 | uint8_t *buff,
112 | uint16_t length);
113 |
114 | USBH_StatusTypeDef USBH_SetCfg(USBH_HandleTypeDef *phost,
115 | uint16_t configuration_value);
116 |
117 | USBH_StatusTypeDef USBH_Get_CfgDesc(USBH_HandleTypeDef *phost,
118 | uint16_t length);
119 |
120 | USBH_StatusTypeDef USBH_SetAddress(USBH_HandleTypeDef *phost,
121 | uint8_t DeviceAddress);
122 |
123 | USBH_StatusTypeDef USBH_SetInterface(USBH_HandleTypeDef *phost,
124 | uint8_t ep_num, uint8_t altSetting);
125 |
126 | USBH_StatusTypeDef USBH_ClrFeature(USBH_HandleTypeDef *phost,
127 | uint8_t ep_num);
128 |
129 | USBH_DescHeader_t *USBH_GetNextDesc (uint8_t *pbuf,
130 | uint16_t *ptr);
131 | /**
132 | * @}
133 | */
134 |
135 | #ifdef __cplusplus
136 | }
137 | #endif
138 |
139 | #endif /* __USBH_CTLREQ_H */
140 |
141 | /**
142 | * @}
143 | */
144 |
145 | /**
146 | * @}
147 | */
148 |
149 | /**
150 | * @}
151 | */
152 |
153 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
154 |
155 |
156 |
--------------------------------------------------------------------------------
/Src/stm32f4xx_hal_msp.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * File Name : stm32f4xx_hal_msp.c
4 | * Description : This file provides code for the MSP Initialization
5 | * and de-Initialization codes.
6 | ******************************************************************************
7 | *
8 | * COPYRIGHT(c) 2016 STMicroelectronics
9 | *
10 | * Redistribution and use in source and binary forms, with or without modification,
11 | * are permitted provided that the following conditions are met:
12 | * 1. Redistributions of source code must retain the above copyright notice,
13 | * this list of conditions and the following disclaimer.
14 | * 2. Redistributions in binary form must reproduce the above copyright notice,
15 | * this list of conditions and the following disclaimer in the documentation
16 | * and/or other materials provided with the distribution.
17 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
18 | * may be used to endorse or promote products derived from this software
19 | * without specific prior written permission.
20 | *
21 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
22 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
25 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
27 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
28 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
29 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 | *
32 | ******************************************************************************
33 | */
34 | /* Includes ------------------------------------------------------------------*/
35 | #include "stm32f4xx_hal.h"
36 |
37 | extern void Error_Handler(void);
38 | /* USER CODE BEGIN 0 */
39 |
40 | /* USER CODE END 0 */
41 |
42 | /**
43 | * Initializes the Global MSP.
44 | */
45 | void HAL_MspInit(void)
46 | {
47 | /* USER CODE BEGIN MspInit 0 */
48 |
49 | /* USER CODE END MspInit 0 */
50 |
51 | HAL_NVIC_SetPriorityGrouping(NVIC_PRIORITYGROUP_0);
52 |
53 | /* System interrupt init*/
54 | /* MemoryManagement_IRQn interrupt configuration */
55 | HAL_NVIC_SetPriority(MemoryManagement_IRQn, 0, 0);
56 | /* BusFault_IRQn interrupt configuration */
57 | HAL_NVIC_SetPriority(BusFault_IRQn, 0, 0);
58 | /* UsageFault_IRQn interrupt configuration */
59 | HAL_NVIC_SetPriority(UsageFault_IRQn, 0, 0);
60 | /* SVCall_IRQn interrupt configuration */
61 | HAL_NVIC_SetPriority(SVCall_IRQn, 0, 0);
62 | /* DebugMonitor_IRQn interrupt configuration */
63 | HAL_NVIC_SetPriority(DebugMonitor_IRQn, 0, 0);
64 | /* PendSV_IRQn interrupt configuration */
65 | HAL_NVIC_SetPriority(PendSV_IRQn, 0, 0);
66 | /* SysTick_IRQn interrupt configuration */
67 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
68 |
69 | /* USER CODE BEGIN MspInit 1 */
70 |
71 | /* USER CODE END MspInit 1 */
72 | }
73 |
74 | void HAL_UART_MspInit(UART_HandleTypeDef* huart)
75 | {
76 |
77 | GPIO_InitTypeDef GPIO_InitStruct;
78 | if(huart->Instance==USART2)
79 | {
80 | /* USER CODE BEGIN USART2_MspInit 0 */
81 |
82 | /* USER CODE END USART2_MspInit 0 */
83 | /* Peripheral clock enable */
84 | __HAL_RCC_USART2_CLK_ENABLE();
85 |
86 | /**USART2 GPIO Configuration
87 | PA2 ------> USART2_TX
88 | PA3 ------> USART2_RX
89 | */
90 | GPIO_InitStruct.Pin = GPIO_PIN_2|GPIO_PIN_3;
91 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
92 | GPIO_InitStruct.Pull = GPIO_PULLUP;
93 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_VERY_HIGH;
94 | GPIO_InitStruct.Alternate = GPIO_AF7_USART2;
95 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
96 |
97 | /* USER CODE BEGIN USART2_MspInit 1 */
98 |
99 | /* USER CODE END USART2_MspInit 1 */
100 | }
101 |
102 | }
103 |
104 | void HAL_UART_MspDeInit(UART_HandleTypeDef* huart)
105 | {
106 |
107 | if(huart->Instance==USART2)
108 | {
109 | /* USER CODE BEGIN USART2_MspDeInit 0 */
110 |
111 | /* USER CODE END USART2_MspDeInit 0 */
112 | /* Peripheral clock disable */
113 | __HAL_RCC_USART2_CLK_DISABLE();
114 |
115 | /**USART2 GPIO Configuration
116 | PA2 ------> USART2_TX
117 | PA3 ------> USART2_RX
118 | */
119 | HAL_GPIO_DeInit(GPIOA, GPIO_PIN_2|GPIO_PIN_3);
120 |
121 | }
122 | /* USER CODE BEGIN USART2_MspDeInit 1 */
123 |
124 | /* USER CODE END USART2_MspDeInit 1 */
125 |
126 | }
127 |
128 | /* USER CODE BEGIN 1 */
129 |
130 | /* USER CODE END 1 */
131 |
132 | /**
133 | * @}
134 | */
135 |
136 | /**
137 | * @}
138 | */
139 |
140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
141 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_pipes.c
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file implements functions for opening and closing Pipes
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbh_pipes.h"
30 |
31 | /** @addtogroup USBH_LIB
32 | * @{
33 | */
34 |
35 | /** @addtogroup USBH_LIB_CORE
36 | * @{
37 | */
38 |
39 | /** @defgroup USBH_PIPES
40 | * @brief This file includes opening and closing Pipes
41 | * @{
42 | */
43 |
44 | /** @defgroup USBH_PIPES_Private_Defines
45 | * @{
46 | */
47 | /**
48 | * @}
49 | */
50 |
51 | /** @defgroup USBH_PIPES_Private_TypesDefinitions
52 | * @{
53 | */
54 | /**
55 | * @}
56 | */
57 |
58 |
59 | /** @defgroup USBH_PIPES_Private_Macros
60 | * @{
61 | */
62 | /**
63 | * @}
64 | */
65 |
66 |
67 | /** @defgroup USBH_PIPES_Private_Variables
68 | * @{
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 |
76 | /** @defgroup USBH_PIPES_Private_Functions
77 | * @{
78 | */
79 | static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost);
80 |
81 |
82 | /**
83 | * @brief USBH_Open_Pipe
84 | * Open a pipe
85 | * @param phost: Host Handle
86 | * @param pipe_num: Pipe Number
87 | * @param dev_address: USB Device address allocated to attached device
88 | * @param speed : USB device speed (Full/Low)
89 | * @param ep_type: end point type (Bulk/int/ctl)
90 | * @param mps: max pkt size
91 | * @retval USBH Status
92 | */
93 | USBH_StatusTypeDef USBH_OpenPipe (USBH_HandleTypeDef *phost,
94 | uint8_t pipe_num,
95 | uint8_t epnum,
96 | uint8_t dev_address,
97 | uint8_t speed,
98 | uint8_t ep_type,
99 | uint16_t mps)
100 | {
101 |
102 | USBH_LL_OpenPipe(phost,
103 | pipe_num,
104 | epnum,
105 | dev_address,
106 | speed,
107 | ep_type,
108 | mps);
109 |
110 | return USBH_OK;
111 |
112 | }
113 |
114 | /**
115 | * @brief USBH_ClosePipe
116 | * Close a pipe
117 | * @param phost: Host Handle
118 | * @param pipe_num: Pipe Number
119 | * @retval USBH Status
120 | */
121 | USBH_StatusTypeDef USBH_ClosePipe (USBH_HandleTypeDef *phost,
122 | uint8_t pipe_num)
123 | {
124 |
125 | USBH_LL_ClosePipe(phost, pipe_num);
126 |
127 | return USBH_OK;
128 |
129 | }
130 |
131 | /**
132 | * @brief USBH_Alloc_Pipe
133 | * Allocate a new Pipe
134 | * @param phost: Host Handle
135 | * @param ep_addr: End point for which the Pipe to be allocated
136 | * @retval Pipe number
137 | */
138 | uint8_t USBH_AllocPipe (USBH_HandleTypeDef *phost, uint8_t ep_addr)
139 | {
140 | uint16_t pipe;
141 |
142 | pipe = USBH_GetFreePipe(phost);
143 |
144 | if (pipe != 0xFFFF)
145 | {
146 | phost->Pipes[pipe] = 0x8000 | ep_addr;
147 | }
148 | return pipe;
149 | }
150 |
151 | /**
152 | * @brief USBH_Free_Pipe
153 | * Free the USB Pipe
154 | * @param phost: Host Handle
155 | * @param idx: Pipe number to be freed
156 | * @retval USBH Status
157 | */
158 | USBH_StatusTypeDef USBH_FreePipe (USBH_HandleTypeDef *phost, uint8_t idx)
159 | {
160 | if(idx < 11)
161 | {
162 | phost->Pipes[idx] &= 0x7FFF;
163 | }
164 | return USBH_OK;
165 | }
166 |
167 | /**
168 | * @brief USBH_GetFreePipe
169 | * @param phost: Host Handle
170 | * Get a free Pipe number for allocation to a device endpoint
171 | * @retval idx: Free Pipe number
172 | */
173 | static uint16_t USBH_GetFreePipe (USBH_HandleTypeDef *phost)
174 | {
175 | uint8_t idx = 0;
176 |
177 | for (idx = 0 ; idx < 11 ; idx++)
178 | {
179 | if ((phost->Pipes[idx] & 0x8000) == 0)
180 | {
181 | return idx;
182 | }
183 | }
184 | return 0xFFFF;
185 | }
186 | /**
187 | * @}
188 | */
189 |
190 | /**
191 | * @}
192 | */
193 |
194 | /**
195 | * @}
196 | */
197 |
198 | /**
199 | * @}
200 | */
201 |
202 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
203 |
204 |
205 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_ioreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_ioreq.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief Header file for usbh_ioreq.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_IOREQ_H
30 | #define __USBH_IOREQ_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_conf.h"
38 | #include "usbh_core.h"
39 |
40 | /** @addtogroup USBH_LIB
41 | * @{
42 | */
43 |
44 | /** @addtogroup USBH_LIB_CORE
45 | * @{
46 | */
47 |
48 | /** @defgroup USBH_IOREQ
49 | * @brief This file is the header file for usbh_ioreq.c
50 | * @{
51 | */
52 |
53 |
54 | /** @defgroup USBH_IOREQ_Exported_Defines
55 | * @{
56 | */
57 |
58 | #define USBH_PID_SETUP 0
59 | #define USBH_PID_DATA 1
60 |
61 | #define USBH_EP_CONTROL 0
62 | #define USBH_EP_ISO 1
63 | #define USBH_EP_BULK 2
64 | #define USBH_EP_INTERRUPT 3
65 |
66 | #define USBH_SETUP_PKT_SIZE 8
67 | /**
68 | * @}
69 | */
70 |
71 |
72 | /** @defgroup USBH_IOREQ_Exported_Types
73 | * @{
74 | */
75 | /**
76 | * @}
77 | */
78 |
79 |
80 | /** @defgroup USBH_IOREQ_Exported_Macros
81 | * @{
82 | */
83 | /**
84 | * @}
85 | */
86 |
87 | /** @defgroup USBH_IOREQ_Exported_Variables
88 | * @{
89 | */
90 | /**
91 | * @}
92 | */
93 |
94 | /** @defgroup USBH_IOREQ_Exported_FunctionsPrototype
95 | * @{
96 | */
97 | USBH_StatusTypeDef USBH_CtlSendSetup (USBH_HandleTypeDef *phost,
98 | uint8_t *buff,
99 | uint8_t hc_num);
100 |
101 | USBH_StatusTypeDef USBH_CtlSendData (USBH_HandleTypeDef *phost,
102 | uint8_t *buff,
103 | uint16_t length,
104 | uint8_t hc_num,
105 | uint8_t do_ping );
106 |
107 | USBH_StatusTypeDef USBH_CtlReceiveData(USBH_HandleTypeDef *phost,
108 | uint8_t *buff,
109 | uint16_t length,
110 | uint8_t hc_num);
111 |
112 | USBH_StatusTypeDef USBH_BulkReceiveData(USBH_HandleTypeDef *phost,
113 | uint8_t *buff,
114 | uint16_t length,
115 | uint8_t hc_num);
116 |
117 | USBH_StatusTypeDef USBH_BulkSendData (USBH_HandleTypeDef *phost,
118 | uint8_t *buff,
119 | uint16_t length,
120 | uint8_t hc_num,
121 | uint8_t do_ping );
122 |
123 | USBH_StatusTypeDef USBH_InterruptReceiveData(USBH_HandleTypeDef *phost,
124 | uint8_t *buff,
125 | uint8_t length,
126 | uint8_t hc_num);
127 |
128 | USBH_StatusTypeDef USBH_InterruptSendData(USBH_HandleTypeDef *phost,
129 | uint8_t *buff,
130 | uint8_t length,
131 | uint8_t hc_num);
132 |
133 |
134 | USBH_StatusTypeDef USBH_IsocReceiveData(USBH_HandleTypeDef *phost,
135 | uint8_t *buff,
136 | uint32_t length,
137 | uint8_t hc_num);
138 |
139 |
140 | USBH_StatusTypeDef USBH_IsocSendData(USBH_HandleTypeDef *phost,
141 | uint8_t *buff,
142 | uint32_t length,
143 | uint8_t hc_num);
144 | /**
145 | * @}
146 | */
147 |
148 | #ifdef __cplusplus
149 | }
150 | #endif
151 |
152 | #endif /* __USBH_IOREQ_H */
153 |
154 | /**
155 | * @}
156 | */
157 |
158 | /**
159 | * @}
160 | */
161 |
162 | /**
163 | * @}
164 | */
165 |
166 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
167 |
168 |
169 |
--------------------------------------------------------------------------------
/STM32F407VG_FLASH.ld:
--------------------------------------------------------------------------------
1 | /*
2 | *****************************************************************************
3 | **
4 |
5 | ** File : stm32_flash.ld
6 | **
7 | ** Abstract : Linker script for STM32F407VG Device with
8 | ** 1024KByte FLASH, 128KByte RAM
9 | **
10 | ** Set heap size, stack size and stack location according
11 | ** to application requirements.
12 | **
13 | ** Set memory bank area and size if external memory is used.
14 | **
15 | ** Target : STMicroelectronics STM32
16 | **
17 | ** Environment : Atollic TrueSTUDIO(R)
18 | **
19 | ** Distribution: The file is distributed as is, without any warranty
20 | ** of any kind.
21 | **
22 | ** (c)Copyright Atollic AB.
23 | ** You may use this file as-is or modify it according to the needs of your
24 | ** project. This file may only be built (assembled or compiled and linked)
25 | ** using the Atollic TrueSTUDIO(R) product. The use of this file together
26 | ** with other tools than Atollic TrueSTUDIO(R) is not permitted.
27 | **
28 | *****************************************************************************
29 | */
30 |
31 | /* Entry Point */
32 | ENTRY(Reset_Handler)
33 |
34 | /* Highest address of the user mode stack */
35 | _estack = 0x20020000; /* end of RAM */
36 | /* Generate a link error if heap and stack don't fit into RAM */
37 | _Min_Heap_Size = 0x200; /* required amount of heap */
38 | _Min_Stack_Size = 0x400; /* required amount of stack */
39 |
40 | /* Specify the memory areas */
41 | MEMORY
42 | {
43 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 1024K
44 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
45 | CCMRAM (rw) : ORIGIN = 0x10000000, LENGTH = 64K
46 | }
47 |
48 | /* Define output sections */
49 | SECTIONS
50 | {
51 | /* The startup code goes first into FLASH */
52 | .isr_vector :
53 | {
54 | . = ALIGN(4);
55 | KEEP(*(.isr_vector)) /* Startup code */
56 | . = ALIGN(4);
57 | } >FLASH
58 |
59 | /* The program code and other data goes into FLASH */
60 | .text :
61 | {
62 | . = ALIGN(4);
63 | *(.text) /* .text sections (code) */
64 | *(.text*) /* .text* sections (code) */
65 | *(.glue_7) /* glue arm to thumb code */
66 | *(.glue_7t) /* glue thumb to arm code */
67 | *(.eh_frame)
68 |
69 | KEEP (*(.init))
70 | KEEP (*(.fini))
71 |
72 | . = ALIGN(4);
73 | _etext = .; /* define a global symbols at end of code */
74 | } >FLASH
75 |
76 | /* Constant data goes into FLASH */
77 | .rodata :
78 | {
79 | . = ALIGN(4);
80 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
81 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
82 | . = ALIGN(4);
83 | } >FLASH
84 |
85 | .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
86 | .ARM : {
87 | __exidx_start = .;
88 | *(.ARM.exidx*)
89 | __exidx_end = .;
90 | } >FLASH
91 |
92 | .preinit_array :
93 | {
94 | PROVIDE_HIDDEN (__preinit_array_start = .);
95 | KEEP (*(.preinit_array*))
96 | PROVIDE_HIDDEN (__preinit_array_end = .);
97 | } >FLASH
98 | .init_array :
99 | {
100 | PROVIDE_HIDDEN (__init_array_start = .);
101 | KEEP (*(SORT(.init_array.*)))
102 | KEEP (*(.init_array*))
103 | PROVIDE_HIDDEN (__init_array_end = .);
104 | } >FLASH
105 | .fini_array :
106 | {
107 | PROVIDE_HIDDEN (__fini_array_start = .);
108 | KEEP (*(SORT(.fini_array.*)))
109 | KEEP (*(.fini_array*))
110 | PROVIDE_HIDDEN (__fini_array_end = .);
111 | } >FLASH
112 |
113 | /* used by the startup to initialize data */
114 | _sidata = LOADADDR(.data);
115 |
116 | /* Initialized data sections goes into RAM, load LMA copy after code */
117 | .data :
118 | {
119 | . = ALIGN(4);
120 | _sdata = .; /* create a global symbol at data start */
121 | *(.data) /* .data sections */
122 | *(.data*) /* .data* sections */
123 |
124 | . = ALIGN(4);
125 | _edata = .; /* define a global symbol at data end */
126 | } >RAM AT> FLASH
127 |
128 | _siccmram = LOADADDR(.ccmram);
129 |
130 | /* CCM-RAM section
131 | *
132 | * IMPORTANT NOTE!
133 | * If initialized variables will be placed in this section,
134 | * the startup code needs to be modified to copy the init-values.
135 | */
136 | .ccmram :
137 | {
138 | . = ALIGN(4);
139 | _sccmram = .; /* create a global symbol at ccmram start */
140 | *(.ccmram)
141 | *(.ccmram*)
142 |
143 | . = ALIGN(4);
144 | _eccmram = .; /* create a global symbol at ccmram end */
145 | } >CCMRAM AT> FLASH
146 |
147 |
148 | /* Uninitialized data section */
149 | . = ALIGN(4);
150 | .bss :
151 | {
152 | /* This is used by the startup in order to initialize the .bss secion */
153 | _sbss = .; /* define a global symbol at bss start */
154 | __bss_start__ = _sbss;
155 | *(.bss)
156 | *(.bss*)
157 | *(COMMON)
158 |
159 | . = ALIGN(4);
160 | _ebss = .; /* define a global symbol at bss end */
161 | __bss_end__ = _ebss;
162 | } >RAM
163 |
164 | /* User_heap_stack section, used to check that there is enough RAM left */
165 | ._user_heap_stack :
166 | {
167 | . = ALIGN(4);
168 | PROVIDE ( end = . );
169 | PROVIDE ( _end = . );
170 | . = . + _Min_Heap_Size;
171 | . = . + _Min_Stack_Size;
172 | . = ALIGN(4);
173 | } >RAM
174 |
175 |
176 |
177 | /* Remove information from the standard libraries */
178 | /DISCARD/ :
179 | {
180 | libc.a ( * )
181 | libm.a ( * )
182 | libgcc.a ( * )
183 | }
184 |
185 | .ARM.attributes 0 : { *(.ARM.attributes) }
186 | }
187 |
188 |
189 |
--------------------------------------------------------------------------------
/Inc/usbh_conf.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file : usbh_conf.h
4 | * @version : v1.0_Cube
5 | * @brief : Header for usbh_conf file.
6 | ******************************************************************************
7 | * COPYRIGHT(c) 2016 STMicroelectronics
8 | *
9 | * Redistribution and use in source and binary forms, with or without modification,
10 | * are permitted provided that the following conditions are met:
11 | * 1. Redistributions of source code must retain the above copyright notice,
12 | * this list of conditions and the following disclaimer.
13 | * 2. Redistributions in binary form must reproduce the above copyright notice,
14 | * this list of conditions and the following disclaimer in the documentation
15 | * and/or other materials provided with the distribution.
16 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
17 | * may be used to endorse or promote products derived from this software
18 | * without specific prior written permission.
19 | *
20 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
21 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
22 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
23 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
24 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
25 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
26 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
27 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
28 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
29 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 | *
31 | ******************************************************************************
32 | */
33 | /* Define to prevent recursive inclusion -------------------------------------*/
34 | #ifndef __USBH_CONF__H__
35 | #define __USBH_CONF__H__
36 | #include
37 | #include
38 | #include
39 | #ifdef __cplusplus
40 | extern "C" {
41 | #endif
42 |
43 | /* Includes ------------------------------------------------------------------*/
44 | #include "stm32f4xx.h"
45 | #include "stm32f4xx_hal.h"
46 |
47 | /**
48 | MiddleWare name : USB_HOST
49 | MiddleWare fileName : usbh_conf.h
50 | MiddleWare version :
51 | */
52 | /*---------- -----------*/
53 | #define USBH_MAX_NUM_ENDPOINTS 2
54 |
55 | /*---------- -----------*/
56 | #define USBH_MAX_NUM_INTERFACES 2
57 |
58 | /*---------- -----------*/
59 | #define USBH_MAX_NUM_CONFIGURATION 1
60 |
61 | /*---------- -----------*/
62 | #define USBH_KEEP_CFG_DESCRIPTOR 1
63 |
64 | /*---------- -----------*/
65 | #define USBH_MAX_NUM_SUPPORTED_CLASS 1
66 |
67 | /*---------- -----------*/
68 | #define USBH_MAX_SIZE_CONFIGURATION 256
69 |
70 | /*---------- -----------*/
71 | #define USBH_MAX_DATA_BUFFER 512
72 |
73 | /*---------- -----------*/
74 | #define USBH_DEBUG_LEVEL 3
75 |
76 | /*---------- -----------*/
77 | #define USBH_USE_OS 0
78 |
79 |
80 |
81 |
82 | /****************************************/
83 | /* #define for FS and HS identification */
84 | #define HOST_HS 0
85 | #define HOST_FS 1
86 |
87 | /** @defgroup USBH_Exported_Macros
88 | * @{
89 | */
90 | #if (USBH_USE_OS == 1)
91 | #include "cmsis_os.h"
92 | #define USBH_PROCESS_PRIO osPriorityNormal
93 | #define USBH_PROCESS_STACK_SIZE ((uint16_t)0)
94 | #endif
95 |
96 | /* Memory management macros */
97 | #define USBH_malloc malloc
98 | #define USBH_free free
99 | #define USBH_memset memset
100 | #define USBH_memcpy memcpy
101 |
102 | /* DEBUG macros */
103 |
104 | #if (USBH_DEBUG_LEVEL > 0)
105 | #define USBH_UsrLog(...) printf(__VA_ARGS__);\
106 | printf("\n");
107 | #else
108 | #define USBH_UsrLog(...)
109 | #endif
110 |
111 |
112 | #if (USBH_DEBUG_LEVEL > 1)
113 |
114 | #define USBH_ErrLog(...) printf("ERROR: ") ;\
115 | printf(__VA_ARGS__);\
116 | printf("\n");
117 | #else
118 | #define USBH_ErrLog(...)
119 | #endif
120 |
121 |
122 | #if (USBH_DEBUG_LEVEL > 2)
123 | #define USBH_DbgLog(...) printf("DEBUG : ") ;\
124 | printf(__VA_ARGS__);\
125 | printf("\n");
126 | #else
127 | #define USBH_DbgLog(...)
128 | #endif
129 |
130 | /**
131 | * @}
132 | */
133 |
134 |
135 |
136 | /**
137 | * @}
138 | */
139 |
140 | /** @defgroup USBH_CONF_Exported_Types
141 | * @{
142 | */
143 | /**
144 | * @}
145 | */
146 |
147 | /** @defgroup USBH_CONF_Exported_Macros
148 | * @{
149 | */
150 | /**
151 | * @}
152 | */
153 |
154 | /** @defgroup USBH_CONF_Exported_Variables
155 | * @{
156 | */
157 | /**
158 | * @}
159 | */
160 |
161 | /** @defgroup USBH_CONF_Exported_FunctionsPrototype
162 | * @{
163 | */
164 | /**
165 | * @}
166 | */
167 |
168 | #ifdef __cplusplus
169 | }
170 | #endif
171 |
172 | #endif /* __USBH_CONF__H__ */
173 |
174 | /**
175 | * @}
176 | */
177 |
178 | /**
179 | * @}
180 | */
181 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
182 |
183 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_core.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief Header file for usbh_core.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_CORE_H
30 | #define __USBH_CORE_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_conf.h"
38 | #include "usbh_def.h"
39 | #include "usbh_ioreq.h"
40 | #include "usbh_pipes.h"
41 | #include "usbh_ctlreq.h"
42 |
43 | /** @addtogroup USBH_LIB
44 | * @{
45 | */
46 |
47 | /** @addtogroup USBH_LIB_CORE
48 | * @{
49 | */
50 |
51 | /** @defgroup USBH_CORE
52 | * @brief This file is the Header file for usbh_core.c
53 | * @{
54 | */
55 |
56 |
57 | /** @defgroup USBH_CORE_Exported_Defines
58 | * @{
59 | */
60 |
61 | /**
62 | * @}
63 | */
64 | #define HOST_USER_SELECT_CONFIGURATION 1
65 | #define HOST_USER_CLASS_ACTIVE 2
66 | #define HOST_USER_CLASS_SELECTED 3
67 | #define HOST_USER_CONNECTION 4
68 | #define HOST_USER_DISCONNECTION 5
69 | #define HOST_USER_UNRECOVERED_ERROR 6
70 |
71 |
72 | /**
73 | * @}
74 | */
75 |
76 |
77 |
78 | /** @defgroup USBH_CORE_Exported_Macros
79 | * @{
80 | */
81 |
82 | /**
83 | * @}
84 | */
85 |
86 | /** @defgroup USBH_CORE_Exported_Variables
87 | * @{
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | /** @defgroup USBH_CORE_Exported_FunctionsPrototype
95 | * @{
96 | */
97 |
98 |
99 | USBH_StatusTypeDef USBH_Init(USBH_HandleTypeDef *phost, void (*pUsrFunc)(USBH_HandleTypeDef *phost, uint8_t ), uint8_t id);
100 | USBH_StatusTypeDef USBH_DeInit(USBH_HandleTypeDef *phost);
101 | USBH_StatusTypeDef USBH_RegisterClass(USBH_HandleTypeDef *phost, USBH_ClassTypeDef *pclass);
102 | USBH_StatusTypeDef USBH_SelectInterface(USBH_HandleTypeDef *phost, uint8_t interface);
103 | uint8_t USBH_FindInterface(USBH_HandleTypeDef *phost,
104 | uint8_t Class,
105 | uint8_t SubClass,
106 | uint8_t Protocol);
107 | uint8_t USBH_GetActiveClass(USBH_HandleTypeDef *phost);
108 |
109 | uint8_t USBH_FindInterfaceIndex(USBH_HandleTypeDef *phost,
110 | uint8_t interface_number,
111 | uint8_t alt_settings);
112 |
113 | USBH_StatusTypeDef USBH_Start (USBH_HandleTypeDef *phost);
114 | USBH_StatusTypeDef USBH_Stop (USBH_HandleTypeDef *phost);
115 | USBH_StatusTypeDef USBH_Process (USBH_HandleTypeDef *phost);
116 | USBH_StatusTypeDef USBH_ReEnumerate (USBH_HandleTypeDef *phost);
117 |
118 | /* USBH Low Level Driver */
119 | USBH_StatusTypeDef USBH_LL_Init (USBH_HandleTypeDef *phost);
120 | USBH_StatusTypeDef USBH_LL_DeInit (USBH_HandleTypeDef *phost);
121 | USBH_StatusTypeDef USBH_LL_Start (USBH_HandleTypeDef *phost);
122 | USBH_StatusTypeDef USBH_LL_Stop (USBH_HandleTypeDef *phost);
123 |
124 | USBH_StatusTypeDef USBH_LL_Connect (USBH_HandleTypeDef *phost);
125 | USBH_StatusTypeDef USBH_LL_Disconnect (USBH_HandleTypeDef *phost);
126 | USBH_SpeedTypeDef USBH_LL_GetSpeed (USBH_HandleTypeDef *phost);
127 | USBH_StatusTypeDef USBH_LL_ResetPort (USBH_HandleTypeDef *phost);
128 | uint32_t USBH_LL_GetLastXferSize (USBH_HandleTypeDef *phost, uint8_t );
129 | USBH_StatusTypeDef USBH_LL_DriverVBUS (USBH_HandleTypeDef *phost, uint8_t );
130 |
131 | USBH_StatusTypeDef USBH_LL_OpenPipe (USBH_HandleTypeDef *phost, uint8_t, uint8_t, uint8_t, uint8_t , uint8_t, uint16_t );
132 | USBH_StatusTypeDef USBH_LL_ClosePipe (USBH_HandleTypeDef *phost, uint8_t );
133 | USBH_StatusTypeDef USBH_LL_SubmitURB (USBH_HandleTypeDef *phost, uint8_t, uint8_t,uint8_t, uint8_t, uint8_t*, uint16_t, uint8_t );
134 | USBH_URBStateTypeDef USBH_LL_GetURBState (USBH_HandleTypeDef *phost, uint8_t );
135 | #if (USBH_USE_OS == 1)
136 | USBH_StatusTypeDef USBH_LL_NotifyURBChange (USBH_HandleTypeDef *phost);
137 | #endif
138 | USBH_StatusTypeDef USBH_LL_SetToggle (USBH_HandleTypeDef *phost, uint8_t , uint8_t );
139 | uint8_t USBH_LL_GetToggle (USBH_HandleTypeDef *phost, uint8_t );
140 |
141 | /* USBH Time base */
142 | void USBH_Delay (uint32_t Delay);
143 | void USBH_LL_SetTimer (USBH_HandleTypeDef *phost, uint32_t );
144 | void USBH_LL_IncTimer (USBH_HandleTypeDef *phost);
145 | /**
146 | * @}
147 | */
148 |
149 | #ifdef __cplusplus
150 | }
151 | #endif
152 |
153 | #endif /* __USBH_CORE_H */
154 | /**
155 | * @}
156 | */
157 |
158 | /**
159 | * @}
160 | */
161 |
162 | /**
163 | * @}
164 | */
165 |
166 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
167 |
168 |
169 |
170 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_parser.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid_parser.c
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file is the HID Layer Handlers for USB Host HID class.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 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 | /* Includes ------------------------------------------------------------------*/
28 | #include "usbh_hid_parser.h"
29 |
30 |
31 | /** @addtogroup USBH_LIB
32 | * @{
33 | */
34 |
35 | /** @addtogroup USBH_CLASS
36 | * @{
37 | */
38 |
39 | /** @addtogroup USBH_HID_CLASS
40 | * @{
41 | */
42 |
43 | /** @defgroup USBH_HID_PARSER
44 | * @brief This file includes HID parsers for USB Host HID class.
45 | * @{
46 | */
47 |
48 | /** @defgroup USBH_HID_PARSER_Private_TypesDefinitions
49 | * @{
50 | */
51 | /**
52 | * @}
53 | */
54 |
55 |
56 | /** @defgroup USBH_HID_PARSER_Private_Defines
57 | * @{
58 | */
59 | /**
60 | * @}
61 | */
62 |
63 |
64 | /** @defgroup USBH_HID_PARSER_Private_Macros
65 | * @{
66 | */
67 | /**
68 | * @}
69 | */
70 |
71 | /** @defgroup USBH_HID_PARSER_Private_FunctionPrototypes
72 | * @{
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 |
80 | /** @defgroup USBH_HID_PARSER_Private_Variables
81 | * @{
82 | */
83 |
84 | /**
85 | * @}
86 | */
87 |
88 |
89 | /** @defgroup USBH_HID_PARSER_Private_Functions
90 | * @{
91 | */
92 |
93 | /**
94 | * @brief HID_ReadItem
95 | * The function read a report item.
96 | * @param ri: report item
97 | * @param ndx: report index
98 | * @retval status (0 : fail / otherwise: item value)
99 | */
100 | uint32_t HID_ReadItem(HID_Report_ItemTypedef *ri, uint8_t ndx)
101 | {
102 | uint32_t val=0;
103 | uint32_t x=0;
104 | uint32_t bofs;
105 | uint8_t *data=ri->data;
106 | uint8_t shift=ri->shift;
107 |
108 | /* get the logical value of the item */
109 |
110 | /* if this is an array, wee may need to offset ri->data.*/
111 | if (ri->count > 0)
112 | {
113 | /* If app tries to read outside of the array. */
114 | if (ri->count <= ndx)
115 | {
116 | return(0);
117 | }
118 |
119 | /* calculate bit offset */
120 | bofs = ndx*ri->size;
121 | bofs += shift;
122 | /* calculate byte offset + shift pair from bit offset. */
123 | data+=bofs/8;
124 | shift=(uint8_t)(bofs%8);
125 | }
126 | /* read data bytes in little endian order */
127 | for(x=0; x < ((ri->size & 0x7) ? (ri->size/8)+1 : (ri->size/8)); x++)
128 | {
129 | val=(uint32_t)(*data << (x*8));
130 | }
131 | val=(val >> shift) & ((1<size)-1);
132 |
133 | if (val < ri->logical_min || val > ri->logical_max)
134 | {
135 | return(0);
136 | }
137 |
138 | /* convert logical value to physical value */
139 | /* See if the number is negative or not. */
140 | if ((ri->sign) && (val & (1<<(ri->size-1))))
141 | {
142 | /* yes, so sign extend value to 32 bits. */
143 | int vs=(int)((-1 & ~((1<<(ri->size))-1)) | val);
144 |
145 | if(ri->resolution == 1)
146 | {
147 | return((uint32_t)vs);
148 | }
149 | return((uint32_t)(vs*ri->resolution));
150 | }
151 | else
152 | {
153 | if(ri->resolution == 1)
154 | {
155 | return(val);
156 | }
157 | return(val*ri->resolution);
158 | }
159 | }
160 |
161 | /**
162 | * @brief HID_WriteItem
163 | * The function write a report item.
164 | * @param ri: report item
165 | * @param ndx: report index
166 | * @retval status (1: fail/ 0 : Ok)
167 | */
168 | uint32_t HID_WriteItem(HID_Report_ItemTypedef *ri, uint32_t value, uint8_t ndx)
169 | {
170 | uint32_t x;
171 | uint32_t mask;
172 | uint32_t bofs;
173 | uint8_t *data=ri->data;
174 | uint8_t shift=ri->shift;
175 |
176 | if (value < ri->physical_min || value > ri->physical_max)
177 | {
178 | return(1);
179 | }
180 |
181 | /* if this is an array, wee may need to offset ri->data.*/
182 | if (ri->count > 0)
183 | {
184 | /* If app tries to read outside of the array. */
185 | if (ri->count >= ndx)
186 | {
187 | return(0);
188 | }
189 | /* calculate bit offset */
190 | bofs = ndx*ri->size;
191 | bofs += shift;
192 | /* calculate byte offset + shift pair from bit offset. */
193 | data+=bofs/8;
194 | shift=(uint8_t)(bofs%8);
195 |
196 | }
197 |
198 | /* Convert physical value to logical value. */
199 | if (ri->resolution != 1)
200 | {
201 | value=value/ri->resolution;
202 | }
203 |
204 | /* Write logical value to report in little endian order. */
205 | mask=(uint32_t)((1<size)-1);
206 | value = (value & mask) << shift;
207 |
208 | for(x=0; x < ((ri->size & 0x7) ? (ri->size/8)+1 : (ri->size/8)); x++)
209 | {
210 | *(ri->data+x)=(uint8_t)((*(ri->data+x) & ~(mask>>(x*8))) | ((value>>(x*8)) & (mask>>(x*8))));
211 | }
212 | return(0);
213 | }
214 |
215 | /**
216 | * @}
217 | */
218 |
219 | /**
220 | * @}
221 | */
222 |
223 | /**
224 | * @}
225 | */
226 |
227 | /**
228 | * @}
229 | */
230 |
231 |
232 | /**
233 | * @}
234 | */
235 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
236 |
--------------------------------------------------------------------------------
/Drivers/CMSIS/Include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Copyright (C) 2010-2014 ARM Limited. All rights reserved.
3 | *
4 | * $Date: 19. October 2015
5 | * $Revision: V.1.4.5 a
6 | *
7 | * Project: CMSIS DSP Library
8 | * Title: arm_common_tables.h
9 | *
10 | * Description: This file has extern declaration for common tables like Bitreverse, reciprocal etc which are used across different functions
11 | *
12 | * Target Processor: Cortex-M4/Cortex-M3
13 | *
14 | * Redistribution and use in source and binary forms, with or without
15 | * modification, are permitted provided that the following conditions
16 | * are met:
17 | * - Redistributions of source code must retain the above copyright
18 | * notice, this list of conditions and the following disclaimer.
19 | * - Redistributions in binary form must reproduce the above copyright
20 | * notice, this list of conditions and the following disclaimer in
21 | * the documentation and/or other materials provided with the
22 | * distribution.
23 | * - Neither the name of ARM LIMITED nor the names of its contributors
24 | * may be used to endorse or promote products derived from this
25 | * software without specific prior written permission.
26 | *
27 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
28 | * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
29 | * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
30 | * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
31 | * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
32 | * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
33 | * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
34 | * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
35 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
36 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
37 | * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
38 | * POSSIBILITY OF SUCH DAMAGE.
39 | * -------------------------------------------------------------------- */
40 |
41 | #ifndef _ARM_COMMON_TABLES_H
42 | #define _ARM_COMMON_TABLES_H
43 |
44 | #include "arm_math.h"
45 |
46 | extern const uint16_t armBitRevTable[1024];
47 | extern const q15_t armRecipTableQ15[64];
48 | extern const q31_t armRecipTableQ31[64];
49 | /* extern const q31_t realCoefAQ31[1024]; */
50 | /* extern const q31_t realCoefBQ31[1024]; */
51 | extern const float32_t twiddleCoef_16[32];
52 | extern const float32_t twiddleCoef_32[64];
53 | extern const float32_t twiddleCoef_64[128];
54 | extern const float32_t twiddleCoef_128[256];
55 | extern const float32_t twiddleCoef_256[512];
56 | extern const float32_t twiddleCoef_512[1024];
57 | extern const float32_t twiddleCoef_1024[2048];
58 | extern const float32_t twiddleCoef_2048[4096];
59 | extern const float32_t twiddleCoef_4096[8192];
60 | #define twiddleCoef twiddleCoef_4096
61 | extern const q31_t twiddleCoef_16_q31[24];
62 | extern const q31_t twiddleCoef_32_q31[48];
63 | extern const q31_t twiddleCoef_64_q31[96];
64 | extern const q31_t twiddleCoef_128_q31[192];
65 | extern const q31_t twiddleCoef_256_q31[384];
66 | extern const q31_t twiddleCoef_512_q31[768];
67 | extern const q31_t twiddleCoef_1024_q31[1536];
68 | extern const q31_t twiddleCoef_2048_q31[3072];
69 | extern const q31_t twiddleCoef_4096_q31[6144];
70 | extern const q15_t twiddleCoef_16_q15[24];
71 | extern const q15_t twiddleCoef_32_q15[48];
72 | extern const q15_t twiddleCoef_64_q15[96];
73 | extern const q15_t twiddleCoef_128_q15[192];
74 | extern const q15_t twiddleCoef_256_q15[384];
75 | extern const q15_t twiddleCoef_512_q15[768];
76 | extern const q15_t twiddleCoef_1024_q15[1536];
77 | extern const q15_t twiddleCoef_2048_q15[3072];
78 | extern const q15_t twiddleCoef_4096_q15[6144];
79 | extern const float32_t twiddleCoef_rfft_32[32];
80 | extern const float32_t twiddleCoef_rfft_64[64];
81 | extern const float32_t twiddleCoef_rfft_128[128];
82 | extern const float32_t twiddleCoef_rfft_256[256];
83 | extern const float32_t twiddleCoef_rfft_512[512];
84 | extern const float32_t twiddleCoef_rfft_1024[1024];
85 | extern const float32_t twiddleCoef_rfft_2048[2048];
86 | extern const float32_t twiddleCoef_rfft_4096[4096];
87 |
88 |
89 | /* floating-point bit reversal tables */
90 | #define ARMBITREVINDEXTABLE__16_TABLE_LENGTH ((uint16_t)20 )
91 | #define ARMBITREVINDEXTABLE__32_TABLE_LENGTH ((uint16_t)48 )
92 | #define ARMBITREVINDEXTABLE__64_TABLE_LENGTH ((uint16_t)56 )
93 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208 )
94 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440 )
95 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448 )
96 | #define ARMBITREVINDEXTABLE1024_TABLE_LENGTH ((uint16_t)1800)
97 | #define ARMBITREVINDEXTABLE2048_TABLE_LENGTH ((uint16_t)3808)
98 | #define ARMBITREVINDEXTABLE4096_TABLE_LENGTH ((uint16_t)4032)
99 |
100 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE__16_TABLE_LENGTH];
101 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE__32_TABLE_LENGTH];
102 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE__64_TABLE_LENGTH];
103 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
104 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
105 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
106 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE1024_TABLE_LENGTH];
107 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE2048_TABLE_LENGTH];
108 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE4096_TABLE_LENGTH];
109 |
110 | /* fixed-point bit reversal tables */
111 | #define ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH ((uint16_t)12 )
112 | #define ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH ((uint16_t)24 )
113 | #define ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH ((uint16_t)56 )
114 | #define ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH ((uint16_t)112 )
115 | #define ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH ((uint16_t)240 )
116 | #define ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH ((uint16_t)480 )
117 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992 )
118 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
119 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
120 |
121 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED___16_TABLE_LENGTH];
122 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED___32_TABLE_LENGTH];
123 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED___64_TABLE_LENGTH];
124 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED__128_TABLE_LENGTH];
125 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED__256_TABLE_LENGTH];
126 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED__512_TABLE_LENGTH];
127 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
128 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
129 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
130 |
131 | /* Tables for Fast Math Sine and Cosine */
132 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
133 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
134 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
135 |
136 | #endif /* ARM_COMMON_TABLES_H */
137 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_mouse.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid_mouse.c
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file is the application layer for USB Host HID Mouse Handling.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbh_hid_mouse.h"
30 | #include "usbh_hid_parser.h"
31 |
32 |
33 | /** @addtogroup USBH_LIB
34 | * @{
35 | */
36 |
37 | /** @addtogroup USBH_CLASS
38 | * @{
39 | */
40 |
41 | /** @addtogroup USBH_HID_CLASS
42 | * @{
43 | */
44 |
45 | /** @defgroup USBH_HID_MOUSE
46 | * @brief This file includes HID Layer Handlers for USB Host HID class.
47 | * @{
48 | */
49 |
50 | /** @defgroup USBH_HID_MOUSE_Private_TypesDefinitions
51 | * @{
52 | */
53 | /**
54 | * @}
55 | */
56 |
57 |
58 | /** @defgroup USBH_HID_MOUSE_Private_Defines
59 | * @{
60 | */
61 | /**
62 | * @}
63 | */
64 |
65 |
66 | /** @defgroup USBH_HID_MOUSE_Private_Macros
67 | * @{
68 | */
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBH_HID_MOUSE_Private_FunctionPrototypes
74 | * @{
75 | */
76 | static USBH_StatusTypeDef USBH_HID_MouseDecode(USBH_HandleTypeDef *phost);
77 |
78 | /**
79 | * @}
80 | */
81 |
82 |
83 | /** @defgroup USBH_HID_MOUSE_Private_Variables
84 | * @{
85 | */
86 | HID_MOUSE_Info_TypeDef mouse_info;
87 | uint32_t mouse_report_data[1];
88 |
89 | /* Structures defining how to access items in a HID mouse report */
90 | /* Access button 1 state. */
91 | static const HID_Report_ItemTypedef prop_b1={
92 | (uint8_t *)mouse_report_data+0, /*data*/
93 | 1, /*size*/
94 | 0, /*shift*/
95 | 0, /*count (only for array items)*/
96 | 0, /*signed?*/
97 | 0, /*min value read can return*/
98 | 1, /*max value read can return*/
99 | 0, /*min value device can report*/
100 | 1, /*max value device can report*/
101 | 1 /*resolution*/
102 | };
103 |
104 | /* Access button 2 state. */
105 | static const HID_Report_ItemTypedef prop_b2={
106 | (uint8_t *)mouse_report_data+0, /*data*/
107 | 1, /*size*/
108 | 1, /*shift*/
109 | 0, /*count (only for array items)*/
110 | 0, /*signed?*/
111 | 0, /*min value read can return*/
112 | 1, /*max value read can return*/
113 | 0, /*min value device can report*/
114 | 1, /*max value device can report*/
115 | 1 /*resolution*/
116 | };
117 |
118 | /* Access button 3 state. */
119 | static const HID_Report_ItemTypedef prop_b3={
120 | (uint8_t *)mouse_report_data+0, /*data*/
121 | 1, /*size*/
122 | 2, /*shift*/
123 | 0, /*count (only for array items)*/
124 | 0, /*signed?*/
125 | 0, /*min value read can return*/
126 | 1, /*max value read can return*/
127 | 0, /*min vale device can report*/
128 | 1, /*max value device can report*/
129 | 1 /*resolution*/
130 | };
131 |
132 | /* Access x coordinate change. */
133 | static const HID_Report_ItemTypedef prop_x={
134 | (uint8_t *)mouse_report_data+1, /*data*/
135 | 8, /*size*/
136 | 0, /*shift*/
137 | 0, /*count (only for array items)*/
138 | 1, /*signed?*/
139 | 0, /*min value read can return*/
140 | 0xFFFF,/*max value read can return*/
141 | 0, /*min vale device can report*/
142 | 0xFFFF,/*max value device can report*/
143 | 1 /*resolution*/
144 | };
145 |
146 | /* Access y coordinate change. */
147 | static const HID_Report_ItemTypedef prop_y={
148 | (uint8_t *)mouse_report_data+2, /*data*/
149 | 8, /*size*/
150 | 0, /*shift*/
151 | 0, /*count (only for array items)*/
152 | 1, /*signed?*/
153 | 0, /*min value read can return*/
154 | 0xFFFF,/*max value read can return*/
155 | 0, /*min vale device can report*/
156 | 0xFFFF,/*max value device can report*/
157 | 1 /*resolution*/
158 | };
159 |
160 |
161 | /**
162 | * @}
163 | */
164 |
165 |
166 | /** @defgroup USBH_HID_MOUSE_Private_Functions
167 | * @{
168 | */
169 |
170 | /**
171 | * @brief USBH_HID_MouseInit
172 | * The function init the HID mouse.
173 | * @param phost: Host handle
174 | * @retval USBH Status
175 | */
176 | USBH_StatusTypeDef USBH_HID_MouseInit(USBH_HandleTypeDef *phost)
177 | {
178 | HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
179 |
180 | mouse_info.x=0;
181 | mouse_info.y=0;
182 | mouse_info.buttons[0]=0;
183 | mouse_info.buttons[1]=0;
184 | mouse_info.buttons[2]=0;
185 |
186 | mouse_report_data[0]=0;
187 |
188 | if(HID_Handle->length > sizeof(mouse_report_data))
189 | {
190 | HID_Handle->length = sizeof(mouse_report_data);
191 | }
192 | HID_Handle->pData = (uint8_t *)mouse_report_data;
193 | fifo_init(&HID_Handle->fifo, phost->device.Data, HID_QUEUE_SIZE * sizeof(mouse_report_data));
194 |
195 | return USBH_OK;
196 | }
197 |
198 | /**
199 | * @brief USBH_HID_GetMouseInfo
200 | * The function return mouse information.
201 | * @param phost: Host handle
202 | * @retval mouse information
203 | */
204 | HID_MOUSE_Info_TypeDef *USBH_HID_GetMouseInfo(USBH_HandleTypeDef *phost)
205 | {
206 | if(USBH_HID_MouseDecode(phost)== USBH_OK)
207 | {
208 | return &mouse_info;
209 | }
210 | else
211 | {
212 | return NULL;
213 | }
214 | }
215 |
216 | /**
217 | * @brief USBH_HID_MouseDecode
218 | * The function decode mouse data.
219 | * @param phost: Host handle
220 | * @retval USBH Status
221 | */
222 | static USBH_StatusTypeDef USBH_HID_MouseDecode(USBH_HandleTypeDef *phost)
223 | {
224 | HID_HandleTypeDef *HID_Handle = (HID_HandleTypeDef *) phost->pActiveClass->pData;
225 |
226 | if(HID_Handle->length == 0)
227 | {
228 | return USBH_FAIL;
229 | }
230 | /*Fill report */
231 | if(fifo_read(&HID_Handle->fifo, &mouse_report_data, HID_Handle->length) == HID_Handle->length)
232 | {
233 |
234 | /*Decode report */
235 | mouse_info.x = (int16_t )HID_ReadItem((HID_Report_ItemTypedef *) &prop_x, 0);
236 | mouse_info.y = (int16_t )HID_ReadItem((HID_Report_ItemTypedef *) &prop_y, 0);
237 |
238 | mouse_info.buttons[0]=(uint8_t)HID_ReadItem((HID_Report_ItemTypedef *) &prop_b1, 0);
239 | mouse_info.buttons[1]=(uint8_t)HID_ReadItem((HID_Report_ItemTypedef *) &prop_b2, 0);
240 | mouse_info.buttons[2]=(uint8_t)HID_ReadItem((HID_Report_ItemTypedef *) &prop_b3, 0);
241 |
242 | return USBH_OK;
243 | }
244 | return USBH_FAIL;
245 | }
246 |
247 | /**
248 | * @}
249 | */
250 |
251 | /**
252 | * @}
253 | */
254 |
255 | /**
256 | * @}
257 | */
258 |
259 | /**
260 | * @}
261 | */
262 |
263 |
264 | /**
265 | * @}
266 | */
267 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
268 |
--------------------------------------------------------------------------------
/.mxproject:
--------------------------------------------------------------------------------
1 | [PreviousGenFiles]
2 | HeaderPath=C:/ARM_workspace_6/stm32f407_disco_usbh_hid_cubemx/stm32f407_disco_usbh_hid/Inc
3 | SourcePath=C:/ARM_workspace_6/stm32f407_disco_usbh_hid_cubemx/stm32f407_disco_usbh_hid/Src
4 | SourceFiles=usb_host.h;usbh_conf.h;stm32f4xx_it.h;stm32f4xx_hal_conf.h;mxconstants.h;usb_host.c;usbh_conf.c;stm32f4xx_it.c;stm32f4xx_hal_msp.c;main.c;
5 | HeaderFiles=usb_host.h;usbh_conf.h;stm32f4xx_it.h;stm32f4xx_hal_conf.h;mxconstants.h;
6 |
7 | [PreviousLibFiles]
8 | LibFiles=Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_hcd.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_ll_usb.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_tim_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_uart.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_rcc_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_flash_ramfunc.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_gpio_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_dma.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pwr_ex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_cortex.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal.h;Drivers/STM32F4xx_HAL_Driver/Inc/Legacy/stm32_hal_legacy.h;Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h;Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_core.h;Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_ctlreq.h;Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_def.h;Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_ioreq.h;Middlewares/ST/STM32_USB_Host_Library/Core/Inc/usbh_pipes.h;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid.h;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_keybd.h;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_mouse.h;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_parser.h;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_usage.h;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c;Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c;Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c;Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid.c;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_keybd.c;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_mouse.c;Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_parser.c;Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;Drivers/CMSIS/Include/arm_common_tables.h;Drivers/CMSIS/Include/arm_const_structs.h;Drivers/CMSIS/Include/arm_math.h;Drivers/CMSIS/Include/cmsis_armcc.h;Drivers/CMSIS/Include/cmsis_armcc_V6.h;Drivers/CMSIS/Include/cmsis_gcc.h;Drivers/CMSIS/Include/core_cm0.h;Drivers/CMSIS/Include/core_cm0plus.h;Drivers/CMSIS/Include/core_cm3.h;Drivers/CMSIS/Include/core_cm4.h;Drivers/CMSIS/Include/core_cm7.h;Drivers/CMSIS/Include/core_cmFunc.h;Drivers/CMSIS/Include/core_cmInstr.h;Drivers/CMSIS/Include/core_cmSimd.h;Drivers/CMSIS/Include/core_sc000.h;Drivers/CMSIS/Include/core_sc300.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xc.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f401xe.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f405xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f407xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410cx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410rx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f410tx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f411xe.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412cx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412rx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412vx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f412zx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f415xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f417xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f427xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f429xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f437xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f439xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f446xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f469xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f479xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h;Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h;
9 |
10 | [PreviousUsedTStudioFiles]
11 | HeaderPath=..\Drivers\STM32F4xx_HAL_Driver\Inc;..\Drivers\STM32F4xx_HAL_Driver\Inc\Legacy;..\Middlewares\ST\STM32_USB_Host_Library\Core\Inc;..\Middlewares\ST\STM32_USB_Host_Library\Class\HID\Inc;..\Drivers\CMSIS\Include;..\Drivers\CMSIS\Device\ST\STM32F4xx\Include;
12 | SourceFiles=../Src/main.c;../Src/usb_host.c;../Src/usbh_conf.c;../Src/stm32f4xx_it.c;../Src/stm32f4xx_hal_msp.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_hcd.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_ll_usb.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_tim_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_uart.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_rcc_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_gpio.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_pwr_ex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_cortex.c;../Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_keybd.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_mouse.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_parser.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/system_stm32f4xx.c;../Drivers/CMSIS/Device/ST/STM32F4xx/Source/Templates/gcc/startup_stm32f407xx.s;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_core.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ctlreq.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_ioreq.c;../Middlewares/ST/STM32_USB_Host_Library/Core/Src/usbh_pipes.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_keybd.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_mouse.c;../Middlewares/ST/STM32_USB_Host_Library/Class/HID/Src/usbh_hid_parser.c;
13 |
14 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_flash_ramfunc.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_flash_ramfunc.c
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief FLASH RAMFUNC module driver.
8 | * This file provides a FLASH firmware functions which should be
9 | * executed from internal SRAM
10 | * + Stop/Start the flash interface while System Run
11 | * + Enable/Disable the flash sleep while System Run
12 | @verbatim
13 | ==============================================================================
14 | ##### APIs executed from Internal RAM #####
15 | ==============================================================================
16 | [..]
17 | *** ARM Compiler ***
18 | --------------------
19 | [..] RAM functions are defined using the toolchain options.
20 | Functions that are be executed in RAM should reside in a separate
21 | source module. Using the 'Options for File' dialog you can simply change
22 | the 'Code / Const' area of a module to a memory space in physical RAM.
23 | Available memory areas are declared in the 'Target' tab of the
24 | Options for Target' dialog.
25 |
26 | *** ICCARM Compiler ***
27 | -----------------------
28 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
29 |
30 | *** GNU Compiler ***
31 | --------------------
32 | [..] RAM functions are defined using a specific toolchain attribute
33 | "__attribute__((section(".RamFunc")))".
34 |
35 | @endverbatim
36 | ******************************************************************************
37 | * @attention
38 | *
39 | * © COPYRIGHT(c) 2016 STMicroelectronics
40 | *
41 | * Redistribution and use in source and binary forms, with or without modification,
42 | * are permitted provided that the following conditions are met:
43 | * 1. Redistributions of source code must retain the above copyright notice,
44 | * this list of conditions and the following disclaimer.
45 | * 2. Redistributions in binary form must reproduce the above copyright notice,
46 | * this list of conditions and the following disclaimer in the documentation
47 | * and/or other materials provided with the distribution.
48 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
49 | * may be used to endorse or promote products derived from this software
50 | * without specific prior written permission.
51 | *
52 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
53 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
54 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
55 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
56 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
57 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
58 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
59 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
60 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
61 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
62 | *
63 | ******************************************************************************
64 | */
65 |
66 | /* Includes ------------------------------------------------------------------*/
67 | #include "stm32f4xx_hal.h"
68 |
69 | /** @addtogroup STM32F4xx_HAL_Driver
70 | * @{
71 | */
72 |
73 | /** @defgroup FLASH_RAMFUNC FLASH RAMFUNC
74 | * @brief FLASH functions executed from RAM
75 | * @{
76 | */
77 | #ifdef HAL_FLASH_MODULE_ENABLED
78 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
79 | defined(STM32F412Rx) || defined(STM32F412Cx)
80 |
81 | /* Private typedef -----------------------------------------------------------*/
82 | /* Private define ------------------------------------------------------------*/
83 | /* Private macro -------------------------------------------------------------*/
84 | /* Private variables ---------------------------------------------------------*/
85 | /* Private function prototypes -----------------------------------------------*/
86 | /* Exported functions --------------------------------------------------------*/
87 | /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions
88 | * @{
89 | */
90 |
91 | /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM
92 | * @brief Peripheral Extended features functions
93 | *
94 | @verbatim
95 |
96 | ===============================================================================
97 | ##### ramfunc functions #####
98 | ===============================================================================
99 | [..]
100 | This subsection provides a set of functions that should be executed from RAM
101 | transfers.
102 |
103 | @endverbatim
104 | * @{
105 | */
106 |
107 | /**
108 | * @brief Stop the flash interface while System Run
109 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
110 | * @note This mode couldn't be set while executing with the flash itself.
111 | * It should be done with specific routine executed from RAM.
112 | * @retval None
113 | */
114 | __RAM_FUNC HAL_FLASHEx_StopFlashInterfaceClk(void)
115 | {
116 | /* Enable Power ctrl clock */
117 | __HAL_RCC_PWR_CLK_ENABLE();
118 | /* Stop the flash interface while System Run */
119 | SET_BIT(PWR->CR, PWR_CR_FISSR);
120 |
121 | return HAL_OK;
122 | }
123 |
124 | /**
125 | * @brief Start the flash interface while System Run
126 | * @note This mode is only available for STM32F411xx/STM32F446xx devices.
127 | * @note This mode couldn't be set while executing with the flash itself.
128 | * It should be done with specific routine executed from RAM.
129 | * @retval None
130 | */
131 | __RAM_FUNC HAL_FLASHEx_StartFlashInterfaceClk(void)
132 | {
133 | /* Enable Power ctrl clock */
134 | __HAL_RCC_PWR_CLK_ENABLE();
135 | /* Start the flash interface while System Run */
136 | CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
137 |
138 | return HAL_OK;
139 | }
140 |
141 | /**
142 | * @brief Enable the flash sleep while System Run
143 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
144 | * @note This mode could n't be set while executing with the flash itself.
145 | * It should be done with specific routine executed from RAM.
146 | * @retval None
147 | */
148 | __RAM_FUNC HAL_FLASHEx_EnableFlashSleepMode(void)
149 | {
150 | /* Enable Power ctrl clock */
151 | __HAL_RCC_PWR_CLK_ENABLE();
152 | /* Enable the flash sleep while System Run */
153 | SET_BIT(PWR->CR, PWR_CR_FMSSR);
154 |
155 | return HAL_OK;
156 | }
157 |
158 | /**
159 | * @brief Disable the flash sleep while System Run
160 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
161 | * @note This mode couldn't be set while executing with the flash itself.
162 | * It should be done with specific routine executed from RAM.
163 | * @retval None
164 | */
165 | __RAM_FUNC HAL_FLASHEx_DisableFlashSleepMode(void)
166 | {
167 | /* Enable Power ctrl clock */
168 | __HAL_RCC_PWR_CLK_ENABLE();
169 | /* Disable the flash sleep while System Run */
170 | CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
171 |
172 | return HAL_OK;
173 | }
174 |
175 | /**
176 | * @}
177 | */
178 |
179 | /**
180 | * @}
181 | */
182 |
183 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
184 | #endif /* HAL_FLASH_MODULE_ENABLED */
185 | /**
186 | * @}
187 | */
188 |
189 | /**
190 | * @}
191 | */
192 |
193 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
194 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_def.h
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief This file contains HAL common defines, enumeration, macros and
8 | * structures definitions.
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * © COPYRIGHT(c) 2016 STMicroelectronics
13 | *
14 | * Redistribution and use in source and binary forms, with or without modification,
15 | * are permitted provided that the following conditions are met:
16 | * 1. Redistributions of source code must retain the above copyright notice,
17 | * this list of conditions and the following disclaimer.
18 | * 2. Redistributions in binary form must reproduce the above copyright notice,
19 | * this list of conditions and the following disclaimer in the documentation
20 | * and/or other materials provided with the distribution.
21 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
22 | * may be used to endorse or promote products derived from this software
23 | * without specific prior written permission.
24 | *
25 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
26 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
28 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
29 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
31 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
32 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
33 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
34 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
35 | *
36 | ******************************************************************************
37 | */
38 |
39 | /* Define to prevent recursive inclusion -------------------------------------*/
40 | #ifndef __STM32F4xx_HAL_DEF
41 | #define __STM32F4xx_HAL_DEF
42 |
43 | #ifdef __cplusplus
44 | extern "C" {
45 | #endif
46 |
47 | /* Includes ------------------------------------------------------------------*/
48 | #include "stm32f4xx.h"
49 | #include "Legacy/stm32_hal_legacy.h"
50 | #include
51 |
52 | /* Exported types ------------------------------------------------------------*/
53 |
54 | /**
55 | * @brief HAL Status structures definition
56 | */
57 | typedef enum
58 | {
59 | HAL_OK = 0x00U,
60 | HAL_ERROR = 0x01U,
61 | HAL_BUSY = 0x02U,
62 | HAL_TIMEOUT = 0x03U
63 | } HAL_StatusTypeDef;
64 |
65 | /**
66 | * @brief HAL Lock structures definition
67 | */
68 | typedef enum
69 | {
70 | HAL_UNLOCKED = 0x00U,
71 | HAL_LOCKED = 0x01U
72 | } HAL_LockTypeDef;
73 |
74 | /* Exported macro ------------------------------------------------------------*/
75 | #define HAL_MAX_DELAY 0xFFFFFFFFU
76 |
77 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) != RESET)
78 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == RESET)
79 |
80 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
81 | do{ \
82 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
83 | (__DMA_HANDLE__).Parent = (__HANDLE__); \
84 | } while(0)
85 |
86 | #define UNUSED(x) ((void)(x))
87 |
88 | /** @brief Reset the Handle's State field.
89 | * @param __HANDLE__: specifies the Peripheral Handle.
90 | * @note This macro can be used for the following purpose:
91 | * - When the Handle is declared as local variable; before passing it as parameter
92 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
93 | * to set to 0 the Handle's "State" field.
94 | * Otherwise, "State" field may have any random value and the first time the function
95 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed
96 | * (i.e. HAL_PPP_MspInit() will not be executed).
97 | * - When there is a need to reconfigure the low level hardware: instead of calling
98 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
99 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function
100 | * HAL_PPP_MspInit() which will reconfigure the low level hardware.
101 | * @retval None
102 | */
103 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
104 |
105 | #if (USE_RTOS == 1)
106 | /* Reserved for future use */
107 | #error "USE_RTOS should be 0 in the current HAL release"
108 | #else
109 | #define __HAL_LOCK(__HANDLE__) \
110 | do{ \
111 | if((__HANDLE__)->Lock == HAL_LOCKED) \
112 | { \
113 | return HAL_BUSY; \
114 | } \
115 | else \
116 | { \
117 | (__HANDLE__)->Lock = HAL_LOCKED; \
118 | } \
119 | }while (0)
120 |
121 | #define __HAL_UNLOCK(__HANDLE__) \
122 | do{ \
123 | (__HANDLE__)->Lock = HAL_UNLOCKED; \
124 | }while (0)
125 | #endif /* USE_RTOS */
126 |
127 | #if defined ( __GNUC__ )
128 | #ifndef __weak
129 | #define __weak __attribute__((weak))
130 | #endif /* __weak */
131 | #ifndef __packed
132 | #define __packed __attribute__((__packed__))
133 | #endif /* __packed */
134 | #endif /* __GNUC__ */
135 |
136 |
137 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
138 | #if defined (__GNUC__) /* GNU Compiler */
139 | #ifndef __ALIGN_END
140 | #define __ALIGN_END __attribute__ ((aligned (4)))
141 | #endif /* __ALIGN_END */
142 | #ifndef __ALIGN_BEGIN
143 | #define __ALIGN_BEGIN
144 | #endif /* __ALIGN_BEGIN */
145 | #else
146 | #ifndef __ALIGN_END
147 | #define __ALIGN_END
148 | #endif /* __ALIGN_END */
149 | #ifndef __ALIGN_BEGIN
150 | #if defined (__CC_ARM) /* ARM Compiler */
151 | #define __ALIGN_BEGIN __align(4)
152 | #elif defined (__ICCARM__) /* IAR Compiler */
153 | #define __ALIGN_BEGIN
154 | #endif /* __CC_ARM */
155 | #endif /* __ALIGN_BEGIN */
156 | #endif /* __GNUC__ */
157 |
158 |
159 | /**
160 | * @brief __RAM_FUNC definition
161 | */
162 | #if defined ( __CC_ARM )
163 | /* ARM Compiler
164 | ------------
165 | RAM functions are defined using the toolchain options.
166 | Functions that are executed in RAM should reside in a separate source module.
167 | Using the 'Options for File' dialog you can simply change the 'Code / Const'
168 | area of a module to a memory space in physical RAM.
169 | Available memory areas are declared in the 'Target' tab of the 'Options for Target'
170 | dialog.
171 | */
172 | #define __RAM_FUNC HAL_StatusTypeDef
173 |
174 | #elif defined ( __ICCARM__ )
175 | /* ICCARM Compiler
176 | ---------------
177 | RAM functions are defined using a specific toolchain keyword "__ramfunc".
178 | */
179 | #define __RAM_FUNC __ramfunc HAL_StatusTypeDef
180 |
181 | #elif defined ( __GNUC__ )
182 | /* GNU Compiler
183 | ------------
184 | RAM functions are defined using a specific toolchain attribute
185 | "__attribute__((section(".RamFunc")))".
186 | */
187 | #define __RAM_FUNC HAL_StatusTypeDef __attribute__((section(".RamFunc")))
188 |
189 | #endif
190 |
191 | /**
192 | * @brief __NOINLINE definition
193 | */
194 | #if defined ( __CC_ARM ) || defined ( __GNUC__ )
195 | /* ARM & GNUCompiler
196 | ----------------
197 | */
198 | #define __NOINLINE __attribute__ ( (noinline) )
199 |
200 | #elif defined ( __ICCARM__ )
201 | /* ICCARM Compiler
202 | ---------------
203 | */
204 | #define __NOINLINE _Pragma("optimize = no_inline")
205 |
206 | #endif
207 |
208 | #ifdef __cplusplus
209 | }
210 | #endif
211 |
212 | #endif /* ___STM32F4xx_HAL_DEF */
213 |
214 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
215 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_hcd.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_hcd.h
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief Header file of HCD HAL module.
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT(c) 2016 STMicroelectronics
12 | *
13 | * Redistribution and use in source and binary forms, with or without modification,
14 | * are permitted provided that the following conditions are met:
15 | * 1. Redistributions of source code must retain the above copyright notice,
16 | * this list of conditions and the following disclaimer.
17 | * 2. Redistributions in binary form must reproduce the above copyright notice,
18 | * this list of conditions and the following disclaimer in the documentation
19 | * and/or other materials provided with the distribution.
20 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
21 | * may be used to endorse or promote products derived from this software
22 | * without specific prior written permission.
23 | *
24 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
25 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
27 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
28 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
30 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
31 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
32 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
33 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34 | *
35 | ******************************************************************************
36 | */
37 |
38 | /* Define to prevent recursive inclusion -------------------------------------*/
39 | #ifndef __STM32F4xx_HAL_HCD_H
40 | #define __STM32F4xx_HAL_HCD_H
41 |
42 | #ifdef __cplusplus
43 | extern "C" {
44 | #endif
45 | #if defined(STM32F405xx) || defined(STM32F415xx) || defined(STM32F407xx) || defined(STM32F417xx) || \
46 | defined(STM32F427xx) || defined(STM32F437xx) || defined(STM32F429xx) || defined(STM32F439xx) || \
47 | defined(STM32F401xC) || defined(STM32F401xE) || defined(STM32F411xE) || defined(STM32F446xx) || \
48 | defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
49 | defined(STM32F412Rx) || defined(STM32F412Cx)
50 | /* Includes ------------------------------------------------------------------*/
51 | #include "stm32f4xx_ll_usb.h"
52 |
53 | /** @addtogroup STM32F4xx_HAL_Driver
54 | * @{
55 | */
56 |
57 | /** @addtogroup HCD
58 | * @{
59 | */
60 |
61 | /* Exported types ------------------------------------------------------------*/
62 | /** @defgroup HCD_Exported_Types HCD Exported Types
63 | * @{
64 | */
65 |
66 | /** @defgroup HCD_Exported_Types_Group1 HCD State Structure definition
67 | * @{
68 | */
69 | typedef enum
70 | {
71 | HAL_HCD_STATE_RESET = 0x00U,
72 | HAL_HCD_STATE_READY = 0x01U,
73 | HAL_HCD_STATE_ERROR = 0x02U,
74 | HAL_HCD_STATE_BUSY = 0x03U,
75 | HAL_HCD_STATE_TIMEOUT = 0x04U
76 | } HCD_StateTypeDef;
77 |
78 | typedef USB_OTG_GlobalTypeDef HCD_TypeDef;
79 | typedef USB_OTG_CfgTypeDef HCD_InitTypeDef;
80 | typedef USB_OTG_HCTypeDef HCD_HCTypeDef ;
81 | typedef USB_OTG_URBStateTypeDef HCD_URBStateTypeDef ;
82 | typedef USB_OTG_HCStateTypeDef HCD_HCStateTypeDef ;
83 | /**
84 | * @}
85 | */
86 |
87 | /** @defgroup HCD_Exported_Types_Group2 HCD Handle Structure definition
88 | * @{
89 | */
90 | typedef struct
91 | {
92 | HCD_TypeDef *Instance; /*!< Register base address */
93 | HCD_InitTypeDef Init; /*!< HCD required parameters */
94 | HCD_HCTypeDef hc[15]; /*!< Host channels parameters */
95 | HAL_LockTypeDef Lock; /*!< HCD peripheral status */
96 | __IO HCD_StateTypeDef State; /*!< HCD communication state */
97 | void *pData; /*!< Pointer Stack Handler */
98 | } HCD_HandleTypeDef;
99 | /**
100 | * @}
101 | */
102 |
103 | /**
104 | * @}
105 | */
106 |
107 | /* Exported constants --------------------------------------------------------*/
108 | /** @defgroup HCD_Exported_Constants HCD Exported Constants
109 | * @{
110 | */
111 |
112 | /** @defgroup HCD_Speed HCD Speed
113 | * @{
114 | */
115 | #define HCD_SPEED_HIGH 0U
116 | #define HCD_SPEED_LOW 2U
117 | #define HCD_SPEED_FULL 3U
118 | /**
119 | * @}
120 | */
121 |
122 | /** @defgroup HCD_PHY_Module HCD PHY Module
123 | * @{
124 | */
125 | #define HCD_PHY_ULPI 1U
126 | #define HCD_PHY_EMBEDDED 2U
127 | /**
128 | * @}
129 | */
130 |
131 | /**
132 | * @}
133 | */
134 |
135 | /* Exported macro ------------------------------------------------------------*/
136 | /** @defgroup HCD_Exported_Macros HCD Exported Macros
137 | * @brief macros to handle interrupts and specific clock configurations
138 | * @{
139 | */
140 | #define __HAL_HCD_ENABLE(__HANDLE__) USB_EnableGlobalInt ((__HANDLE__)->Instance)
141 | #define __HAL_HCD_DISABLE(__HANDLE__) USB_DisableGlobalInt ((__HANDLE__)->Instance)
142 |
143 | #define __HAL_HCD_GET_FLAG(__HANDLE__, __INTERRUPT__) ((USB_ReadInterrupts((__HANDLE__)->Instance) & (__INTERRUPT__)) == (__INTERRUPT__))
144 | #define __HAL_HCD_CLEAR_FLAG(__HANDLE__, __INTERRUPT__) (((__HANDLE__)->Instance->GINTSTS) = (__INTERRUPT__))
145 | #define __HAL_HCD_IS_INVALID_INTERRUPT(__HANDLE__) (USB_ReadInterrupts((__HANDLE__)->Instance) == 0U)
146 |
147 | #define __HAL_HCD_CLEAR_HC_INT(chnum, __INTERRUPT__) (USBx_HC(chnum)->HCINT = (__INTERRUPT__))
148 | #define __HAL_HCD_MASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_CHHM)
149 | #define __HAL_HCD_UNMASK_HALT_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_CHHM)
150 | #define __HAL_HCD_MASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK &= ~USB_OTG_HCINTMSK_ACKM)
151 | #define __HAL_HCD_UNMASK_ACK_HC_INT(chnum) (USBx_HC(chnum)->HCINTMSK |= USB_OTG_HCINTMSK_ACKM)
152 | /**
153 | * @}
154 | */
155 |
156 | /* Exported functions --------------------------------------------------------*/
157 | /** @addtogroup HCD_Exported_Functions HCD Exported Functions
158 | * @{
159 | */
160 |
161 | /* Initialization/de-initialization functions ********************************/
162 | /** @addtogroup HCD_Exported_Functions_Group1 Initialization and de-initialization functions
163 | * @{
164 | */
165 | HAL_StatusTypeDef HAL_HCD_Init(HCD_HandleTypeDef *hhcd);
166 | HAL_StatusTypeDef HAL_HCD_DeInit(HCD_HandleTypeDef *hhcd);
167 | HAL_StatusTypeDef HAL_HCD_HC_Init(HCD_HandleTypeDef *hhcd,
168 | uint8_t ch_num,
169 | uint8_t epnum,
170 | uint8_t dev_address,
171 | uint8_t speed,
172 | uint8_t ep_type,
173 | uint16_t mps);
174 |
175 | HAL_StatusTypeDef HAL_HCD_HC_Halt(HCD_HandleTypeDef *hhcd, uint8_t ch_num);
176 |
177 | void HAL_HCD_MspInit(HCD_HandleTypeDef *hhcd);
178 | void HAL_HCD_MspDeInit(HCD_HandleTypeDef *hhcd);
179 | /**
180 | * @}
181 | */
182 |
183 | /* I/O operation functions ***************************************************/
184 | /** @addtogroup HCD_Exported_Functions_Group2 Input and Output operation functions
185 | * @{
186 | */
187 | HAL_StatusTypeDef HAL_HCD_HC_SubmitRequest(HCD_HandleTypeDef *hhcd,
188 | uint8_t pipe,
189 | uint8_t direction,
190 | uint8_t ep_type,
191 | uint8_t token,
192 | uint8_t* pbuff,
193 | uint16_t length,
194 | uint8_t do_ping);
195 |
196 | /* Non-Blocking mode: Interrupt */
197 | void HAL_HCD_IRQHandler(HCD_HandleTypeDef *hhcd);
198 | void HAL_HCD_SOF_Callback(HCD_HandleTypeDef *hhcd);
199 | void HAL_HCD_Connect_Callback(HCD_HandleTypeDef *hhcd);
200 | void HAL_HCD_Disconnect_Callback(HCD_HandleTypeDef *hhcd);
201 | void HAL_HCD_HC_NotifyURBChange_Callback(HCD_HandleTypeDef *hhcd,
202 | uint8_t chnum,
203 | HCD_URBStateTypeDef urb_state);
204 | /**
205 | * @}
206 | */
207 |
208 | /* Peripheral Control functions **********************************************/
209 | /** @addtogroup HCD_Exported_Functions_Group3 Peripheral Control functions
210 | * @{
211 | */
212 | HAL_StatusTypeDef HAL_HCD_ResetPort(HCD_HandleTypeDef *hhcd);
213 | HAL_StatusTypeDef HAL_HCD_Start(HCD_HandleTypeDef *hhcd);
214 | HAL_StatusTypeDef HAL_HCD_Stop(HCD_HandleTypeDef *hhcd);
215 | /**
216 | * @}
217 | */
218 |
219 | /* Peripheral State functions ************************************************/
220 | /** @addtogroup HCD_Exported_Functions_Group4 Peripheral State functions
221 | * @{
222 | */
223 | HCD_StateTypeDef HAL_HCD_GetState(HCD_HandleTypeDef *hhcd);
224 | HCD_URBStateTypeDef HAL_HCD_HC_GetURBState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
225 | uint32_t HAL_HCD_HC_GetXferCount(HCD_HandleTypeDef *hhcd, uint8_t chnum);
226 | HCD_HCStateTypeDef HAL_HCD_HC_GetState(HCD_HandleTypeDef *hhcd, uint8_t chnum);
227 | uint32_t HAL_HCD_GetCurrentFrame(HCD_HandleTypeDef *hhcd);
228 | uint32_t HAL_HCD_GetCurrentSpeed(HCD_HandleTypeDef *hhcd);
229 | /**
230 | * @}
231 | */
232 |
233 | /**
234 | * @}
235 | */
236 |
237 | /* Private macros ------------------------------------------------------------*/
238 | /** @defgroup HCD_Private_Macros HCD Private Macros
239 | * @{
240 | */
241 |
242 | /**
243 | * @}
244 | */
245 |
246 | /**
247 | * @}
248 | */
249 |
250 | /**
251 | * @}
252 | */
253 | #endif /* STM32F405xx || STM32F415xx || STM32F407xx || STM32F417xx || STM32F427xx || STM32F437xx || STM32F429xx || STM32F439xx ||
254 | STM32F401xC || STM32F401xE || STM32F411xE || STM32F446xx || STM32F469xx || STM32F479xx || STM32F412Zx || STM32F412Rx ||
255 | STM32F412Vx || STM32F412Cx */
256 | #ifdef __cplusplus
257 | }
258 | #endif
259 |
260 | #endif /* __STM32F4xx_HAL_HCD_H */
261 |
262 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
263 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid_usage.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid_usage.c
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file contain the USAGE page codes
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 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 | /* Define to prevent recursive ----------------------------------------------*/
28 | #ifndef __USDH_HID_USAGE_H
29 | #define __USDH_HID_USAGE_H
30 |
31 | #ifdef __cplusplus
32 | extern "C" {
33 | #endif
34 |
35 | /** @addtogroup USBH_LIB
36 | * @{
37 | */
38 |
39 | /** @addtogroup USBH_CLASS
40 | * @{
41 | */
42 |
43 | /** @addtogroup USBH_HID_CLASS
44 | * @{
45 | */
46 |
47 | /** @defgroup USBH_HID_USAGE
48 | * @brief This file is the Header file for usbh_hid_usage.c
49 | * @{
50 | */
51 |
52 |
53 | /** @defgroup USBH_HID_USAGE_Exported_Types
54 | * @{
55 | */
56 |
57 | /****************************************************/
58 | /* HID 1.11 usage pages */
59 | /****************************************************/
60 |
61 | #define HID_USAGE_PAGE_UNDEFINED uint16_t (0x00) /* Undefined */
62 | /**** Top level pages */
63 | #define HID_USAGE_PAGE_GEN_DES uint16_t (0x01) /* Generic Desktop Controls*/
64 | #define HID_USAGE_PAGE_SIM_CTR uint16_t (0x02) /* Simulation Controls */
65 | #define HID_USAGE_PAGE_VR_CTR uint16_t (0x03) /* VR Controls */
66 | #define HID_USAGE_PAGE_SPORT_CTR uint16_t (0x04) /* Sport Controls */
67 | #define HID_USAGE_PAGE_GAME_CTR uint16_t (0x05) /* Game Controls */
68 | #define HID_USAGE_PAGE_GEN_DEV uint16_t (0x06) /* Generic Device Controls */
69 | #define HID_USAGE_PAGE_KEYB uint16_t (0x07) /* Keyboard/Keypad */
70 | #define HID_USAGE_PAGE_LED uint16_t (0x08) /* LEDs */
71 | #define HID_USAGE_PAGE_BUTTON uint16_t (0x09) /* Button */
72 | #define HID_USAGE_PAGE_ORDINAL uint16_t (0x0A) /* Ordinal */
73 | #define HID_USAGE_PAGE_PHONE uint16_t (0x0B) /* Telephony */
74 | #define HID_USAGE_PAGE_CONSUMER uint16_t (0x0C) /* Consumer */
75 | #define HID_USAGE_PAGE_DIGITIZER uint16_t (0x0D) /* Digitizer*/
76 | /* 0E Reserved */
77 | #define HID_USAGE_PAGE_PID uint16_t (0x0F) /* PID Page (force feedback and related devices) */
78 | #define HID_USAGE_PAGE_UNICODE uint16_t (0x10) /* Unicode */
79 | /* 11-13 Reserved */
80 | #define HID_USAGE_PAGE_ALNUM_DISP uint16_t (0x14) /* Alphanumeric Display */
81 | /* 15-1f Reserved */
82 | /**** END of top level pages */
83 | /* 25-3f Reserved */
84 | #define HID_USAGE_PAGE_MEDICAL uint16_t (0x40) /* Medical Instruments */
85 | /* 41-7F Reserved */
86 | /*80-83 Monitor pages USB Device Class Definition for Monitor Devices
87 | 84-87 Power pages USB Device Class Definition for Power Devices */
88 | /* 88-8B Reserved */
89 | #define HID_USAGE_PAGE_BARCODE uint16_t (0x8C) /* Bar Code Scanner page */
90 | #define HID_USAGE_PAGE_SCALE uint16_t (0x8D) /* Scale page */
91 | #define HID_USAGE_PAGE_MSR uint16_t (0x8E) /* Magnetic Stripe Reading (MSR) Devices */
92 | #define HID_USAGE_PAGE_POS uint16_t (0x8F) /* Reserved Point of Sale pages */
93 | #define HID_USAGE_PAGE_CAMERA_CTR uint16_t (0x90) /* Camera Control Page */
94 | #define HID_USAGE_PAGE_ARCADE uint16_t (0x91) /* Arcade Page */
95 |
96 | /****************************************************/
97 | /* Usage definitions for the "Generic Desktop" page */
98 | /****************************************************/
99 | #define HID_USAGE_UNDEFINED uint16_t (0x00) /* Undefined */
100 | #define HID_USAGE_POINTER uint16_t (0x01) /* Pointer (Physical Collection) */
101 | #define HID_USAGE_MOUSE uint16_t (0x02) /* Mouse (Application Collection) */
102 | /* 03 Reserved */
103 | #define HID_USAGE_JOYSTICK uint16_t (0x04) /* Joystick (Application Collection) */
104 | #define HID_USAGE_GAMEPAD uint16_t (0x05) /* Game Pad (Application Collection) */
105 | #define HID_USAGE_KBD uint16_t (0x06) /* Keyboard (Application Collection) */
106 | #define HID_USAGE_KEYPAD uint16_t (0x07) /* Keypad (Application Collection) */
107 | #define HID_USAGE_MAX_CTR uint16_t (0x08) /* Multi-axis Controller (Application Collection) */
108 | /* 09-2F Reserved */
109 | #define HID_USAGE_X uint16_t (0x30) /* X (Dynamic Value) */
110 | #define HID_USAGE_Y uint16_t (0x31) /* Y (Dynamic Value) */
111 | #define HID_USAGE_Z uint16_t (0x32) /* Z (Dynamic Value) */
112 | #define HID_USAGE_RX uint16_t (0x33) /* Rx (Dynamic Value) */
113 | #define HID_USAGE_RY uint16_t (0x34) /* Ry (Dynamic Value) */
114 | #define HID_USAGE_RZ uint16_t (0x35) /* Rz (Dynamic Value) */
115 | #define HID_USAGE_SLIDER uint16_t (0x36) /* Slider (Dynamic Value) */
116 | #define HID_USAGE_DIAL uint16_t (0x37) /* Dial (Dynamic Value) */
117 | #define HID_USAGE_WHEEL uint16_t (0x38) /* Wheel (Dynamic Value) */
118 | #define HID_USAGE_HATSW uint16_t (0x39) /* Hat switch (Dynamic Value) */
119 | #define HID_USAGE_COUNTEDBUF uint16_t (0x3A) /* Counted Buffer (Logical Collection) */
120 | #define HID_USAGE_BYTECOUNT uint16_t (0x3B) /* Byte Count (Dynamic Value) */
121 | #define HID_USAGE_MOTIONWAKE uint16_t (0x3C) /* Motion Wakeup (One Shot Control) */
122 | #define HID_USAGE_START uint16_t (0x3D) /* Start (On/Off Control) */
123 | #define HID_USAGE_SELECT uint16_t (0x3E) /* Select (On/Off Control) */
124 | /* 3F Reserved */
125 | #define HID_USAGE_VX uint16_t (0x40) /* Vx (Dynamic Value) */
126 | #define HID_USAGE_VY uint16_t (0x41) /* Vy (Dynamic Value) */
127 | #define HID_USAGE_VZ uint16_t (0x42) /* Vz (Dynamic Value) */
128 | #define HID_USAGE_VBRX uint16_t (0x43) /* Vbrx (Dynamic Value) */
129 | #define HID_USAGE_VBRY uint16_t (0x44) /* Vbry (Dynamic Value) */
130 | #define HID_USAGE_VBRZ uint16_t (0x45) /* Vbrz (Dynamic Value) */
131 | #define HID_USAGE_VNO uint16_t (0x46) /* Vno (Dynamic Value) */
132 | #define HID_USAGE_FEATNOTIF uint16_t (0x47) /* Feature Notification (Dynamic Value),(Dynamic Flag) */
133 | /* 48-7F Reserved */
134 | #define HID_USAGE_SYSCTL uint16_t (0x80) /* System Control (Application Collection) */
135 | #define HID_USAGE_PWDOWN uint16_t (0x81) /* System Power Down (One Shot Control) */
136 | #define HID_USAGE_SLEEP uint16_t (0x82) /* System Sleep (One Shot Control) */
137 | #define HID_USAGE_WAKEUP uint16_t (0x83) /* System Wake Up (One Shot Control) */
138 | #define HID_USAGE_CONTEXTM uint16_t (0x84) /* System Context Menu (One Shot Control) */
139 | #define HID_USAGE_MAINM uint16_t (0x85) /* System Main Menu (One Shot Control) */
140 | #define HID_USAGE_APPM uint16_t (0x86) /* System App Menu (One Shot Control) */
141 | #define HID_USAGE_MENUHELP uint16_t (0x87) /* System Menu Help (One Shot Control) */
142 | #define HID_USAGE_MENUEXIT uint16_t (0x88) /* System Menu Exit (One Shot Control) */
143 | #define HID_USAGE_MENUSELECT uint16_t (0x89) /* System Menu Select (One Shot Control) */
144 | #define HID_USAGE_SYSM_RIGHT uint16_t (0x8A) /* System Menu Right (Re-Trigger Control) */
145 | #define HID_USAGE_SYSM_LEFT uint16_t (0x8B) /* System Menu Left (Re-Trigger Control) */
146 | #define HID_USAGE_SYSM_UP uint16_t (0x8C) /* System Menu Up (Re-Trigger Control) */
147 | #define HID_USAGE_SYSM_DOWN uint16_t (0x8D) /* System Menu Down (Re-Trigger Control) */
148 | #define HID_USAGE_COLDRESET uint16_t (0x8E) /* System Cold Restart (One Shot Control) */
149 | #define HID_USAGE_WARMRESET uint16_t (0x8F) /* System Warm Restart (One Shot Control) */
150 | #define HID_USAGE_DUP uint16_t (0x90) /* D-pad Up (On/Off Control) */
151 | #define HID_USAGE_DDOWN uint16_t (0x91) /* D-pad Down (On/Off Control) */
152 | #define HID_USAGE_DRIGHT uint16_t (0x92) /* D-pad Right (On/Off Control) */
153 | #define HID_USAGE_DLEFT uint16_t (0x93) /* D-pad Left (On/Off Control) */
154 | /* 94-9F Reserved */
155 | #define HID_USAGE_SYS_DOCK uint16_t (0xA0) /* System Dock (One Shot Control) */
156 | #define HID_USAGE_SYS_UNDOCK uint16_t (0xA1) /* System Undock (One Shot Control) */
157 | #define HID_USAGE_SYS_SETUP uint16_t (0xA2) /* System Setup (One Shot Control) */
158 | #define HID_USAGE_SYS_BREAK uint16_t (0xA3) /* System Break (One Shot Control) */
159 | #define HID_USAGE_SYS_DBGBRK uint16_t (0xA4) /* System Debugger Break (One Shot Control) */
160 | #define HID_USAGE_APP_BRK uint16_t (0xA5) /* Application Break (One Shot Control) */
161 | #define HID_USAGE_APP_DBGBRK uint16_t (0xA6) /* Application Debugger Break (One Shot Control) */
162 | #define HID_USAGE_SYS_SPKMUTE uint16_t (0xA7) /* System Speaker Mute (One Shot Control) */
163 | #define HID_USAGE_SYS_HIBERN uint16_t (0xA8) /* System Hibernate (One Shot Control) */
164 | /* A9-AF Reserved */
165 | #define HID_USAGE_SYS_SIDPINV uint16_t (0xB0) /* System Display Invert (One Shot Control) */
166 | #define HID_USAGE_SYS_DISPINT uint16_t (0xB1) /* System Display Internal (One Shot Control) */
167 | #define HID_USAGE_SYS_DISPEXT uint16_t (0xB2) /* System Display External (One Shot Control) */
168 | #define HID_USAGE_SYS_DISPBOTH uint16_t (0xB3) /* System Display Both (One Shot Control) */
169 | #define HID_USAGE_SYS_DISPDUAL uint16_t (0xB4) /* System Display Dual (One Shot Control) */
170 | #define HID_USAGE_SYS_DISPTGLIE uint16_t (0xB5) /* System Display Toggle Int/Ext (One Shot Control) */
171 | #define HID_USAGE_SYS_DISP_SWAP uint16_t (0xB6) /* System Display Swap Primary/Secondary (One Shot Control) */
172 | #define HID_USAGE_SYS_DIPS_LCDA uint16_t (0xB7) /* System Display LCD Autoscale (One Shot Control) */
173 | /* B8-FFFF Reserved */
174 |
175 | /**
176 | * @}
177 | */
178 |
179 | #ifdef __cplusplus
180 | }
181 | #endif
182 |
183 | #endif /* __USDH_HID_USAGE_H */
184 |
185 | /**
186 | * @}
187 | */
188 |
189 | /**
190 | * @}
191 | */
192 |
193 | /**
194 | * @}
195 | */
196 |
197 | /**
198 | * @}
199 | */
200 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
201 |
--------------------------------------------------------------------------------
/Src/main.c:
--------------------------------------------------------------------------------
1 | /* Includes ------------------------------------------------------------------*/
2 | #include "stm32f4xx_hal.h"
3 | #include "usb_host.h"
4 |
5 | /* USER CODE BEGIN Includes */
6 |
7 | /* USER CODE END Includes */
8 |
9 | /* Private variables ---------------------------------------------------------*/
10 | UART_HandleTypeDef huart2;
11 |
12 | /* USER CODE BEGIN PV */
13 | /* Private variables ---------------------------------------------------------*/
14 |
15 | /* USER CODE END PV */
16 |
17 | /* Private function prototypes -----------------------------------------------*/
18 | void SystemClock_Config(void);
19 | void Error_Handler(void);
20 | static void MX_GPIO_Init(void);
21 | static void MX_USART2_UART_Init(void);
22 | void MX_USB_HOST_Process(void);
23 |
24 | /* USER CODE BEGIN PFP */
25 | /* Private function prototypes -----------------------------------------------*/
26 |
27 | /* USER CODE END PFP */
28 |
29 | /* USER CODE BEGIN 0 */
30 | int __io_putchar(int ch)
31 | {
32 | while (!(USART2->SR & USART_SR_TXE)) {}
33 | USART2->DR = (uint32_t)ch;
34 | return ch;
35 | }
36 |
37 | int _write(int32_t file, uint8_t *ptr, int32_t len)
38 | {
39 | int i;
40 | for (i=0; iODR ^= GPIO_Pin_1;
89 | HAL_GPIO_TogglePin(GPIOD, LD5_Pin|LD6_Pin);
90 | i = 0;
91 | }
92 | }
93 | /* USER CODE END 3 */
94 |
95 | }
96 |
97 | /** System Clock Configuration
98 | */
99 | void SystemClock_Config(void)
100 | {
101 |
102 | RCC_OscInitTypeDef RCC_OscInitStruct;
103 | RCC_ClkInitTypeDef RCC_ClkInitStruct;
104 |
105 | __HAL_RCC_PWR_CLK_ENABLE();
106 |
107 | __HAL_PWR_VOLTAGESCALING_CONFIG(PWR_REGULATOR_VOLTAGE_SCALE1);
108 |
109 | RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
110 | RCC_OscInitStruct.HSEState = RCC_HSE_ON;
111 | RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
112 | RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
113 | RCC_OscInitStruct.PLL.PLLM = 8;
114 | RCC_OscInitStruct.PLL.PLLN = 336;
115 | RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
116 | RCC_OscInitStruct.PLL.PLLQ = 7;
117 | if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
118 | {
119 | Error_Handler();
120 | }
121 |
122 | RCC_ClkInitStruct.ClockType = RCC_CLOCKTYPE_HCLK|RCC_CLOCKTYPE_SYSCLK
123 | |RCC_CLOCKTYPE_PCLK1|RCC_CLOCKTYPE_PCLK2;
124 | RCC_ClkInitStruct.SYSCLKSource = RCC_SYSCLKSOURCE_PLLCLK;
125 | RCC_ClkInitStruct.AHBCLKDivider = RCC_SYSCLK_DIV1;
126 | RCC_ClkInitStruct.APB1CLKDivider = RCC_HCLK_DIV4;
127 | RCC_ClkInitStruct.APB2CLKDivider = RCC_HCLK_DIV2;
128 | if (HAL_RCC_ClockConfig(&RCC_ClkInitStruct, FLASH_LATENCY_5) != HAL_OK)
129 | {
130 | Error_Handler();
131 | }
132 |
133 | HAL_SYSTICK_Config(HAL_RCC_GetHCLKFreq()/1000);
134 |
135 | HAL_SYSTICK_CLKSourceConfig(SYSTICK_CLKSOURCE_HCLK);
136 |
137 | /* SysTick_IRQn interrupt configuration */
138 | HAL_NVIC_SetPriority(SysTick_IRQn, 0, 0);
139 | }
140 |
141 | /* USART2 init function */
142 | static void MX_USART2_UART_Init(void)
143 | {
144 |
145 | huart2.Instance = USART2;
146 | huart2.Init.BaudRate = 115200;
147 | huart2.Init.WordLength = UART_WORDLENGTH_8B;
148 | huart2.Init.StopBits = UART_STOPBITS_1;
149 | huart2.Init.Parity = UART_PARITY_NONE;
150 | huart2.Init.Mode = UART_MODE_TX_RX;
151 | huart2.Init.HwFlowCtl = UART_HWCONTROL_NONE;
152 | huart2.Init.OverSampling = UART_OVERSAMPLING_16;
153 | if (HAL_UART_Init(&huart2) != HAL_OK)
154 | {
155 | Error_Handler();
156 | }
157 |
158 | }
159 |
160 | /** Configure pins as
161 | * Analog
162 | * Input
163 | * Output
164 | * EVENT_OUT
165 | * EXTI
166 | PC3 ------> I2S2_SD
167 | PA4 ------> I2S3_WS
168 | PA5 ------> SPI1_SCK
169 | PA6 ------> SPI1_MISO
170 | PA7 ------> SPI1_MOSI
171 | PB10 ------> I2S2_CK
172 | PC7 ------> I2S3_MCK
173 | PC10 ------> I2S3_CK
174 | PC12 ------> I2S3_SD
175 | PB6 ------> I2C1_SCL
176 | PB9 ------> I2C1_SDA
177 | */
178 | static void MX_GPIO_Init(void)
179 | {
180 |
181 | GPIO_InitTypeDef GPIO_InitStruct;
182 |
183 | /* GPIO Ports Clock Enable */
184 | __HAL_RCC_GPIOE_CLK_ENABLE();
185 | __HAL_RCC_GPIOC_CLK_ENABLE();
186 | __HAL_RCC_GPIOH_CLK_ENABLE();
187 | __HAL_RCC_GPIOA_CLK_ENABLE();
188 | __HAL_RCC_GPIOB_CLK_ENABLE();
189 | __HAL_RCC_GPIOD_CLK_ENABLE();
190 |
191 | /*Configure GPIO pin Output Level */
192 | HAL_GPIO_WritePin(CS_I2C_SPI_GPIO_Port, CS_I2C_SPI_Pin, GPIO_PIN_RESET);
193 |
194 | /*Configure GPIO pin Output Level */
195 | HAL_GPIO_WritePin(OTG_FS_PowerSwitchOn_GPIO_Port, OTG_FS_PowerSwitchOn_Pin, GPIO_PIN_SET);
196 |
197 | /*Configure GPIO pin Output Level */
198 | HAL_GPIO_WritePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
199 | |Audio_RST_Pin, GPIO_PIN_RESET);
200 |
201 | /*Configure GPIO pin : CS_I2C_SPI_Pin */
202 | GPIO_InitStruct.Pin = CS_I2C_SPI_Pin;
203 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
204 | GPIO_InitStruct.Pull = GPIO_NOPULL;
205 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
206 | HAL_GPIO_Init(CS_I2C_SPI_GPIO_Port, &GPIO_InitStruct);
207 |
208 | /*Configure GPIO pin : OTG_FS_PowerSwitchOn_Pin */
209 | GPIO_InitStruct.Pin = OTG_FS_PowerSwitchOn_Pin;
210 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
211 | GPIO_InitStruct.Pull = GPIO_NOPULL;
212 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
213 | HAL_GPIO_Init(OTG_FS_PowerSwitchOn_GPIO_Port, &GPIO_InitStruct);
214 |
215 | /*Configure GPIO pin : PDM_OUT_Pin */
216 | GPIO_InitStruct.Pin = PDM_OUT_Pin;
217 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
218 | GPIO_InitStruct.Pull = GPIO_NOPULL;
219 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
220 | GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
221 | HAL_GPIO_Init(PDM_OUT_GPIO_Port, &GPIO_InitStruct);
222 |
223 | /*Configure GPIO pin : PA4 */
224 | GPIO_InitStruct.Pin = GPIO_PIN_4;
225 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
226 | GPIO_InitStruct.Pull = GPIO_NOPULL;
227 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
228 | GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
229 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
230 |
231 | /*Configure GPIO pins : PA5 PA6 PA7 */
232 | GPIO_InitStruct.Pin = GPIO_PIN_5|GPIO_PIN_6|GPIO_PIN_7;
233 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
234 | GPIO_InitStruct.Pull = GPIO_NOPULL;
235 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
236 | GPIO_InitStruct.Alternate = GPIO_AF5_SPI1;
237 | HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);
238 |
239 | /*Configure GPIO pin : BOOT1_Pin */
240 | GPIO_InitStruct.Pin = BOOT1_Pin;
241 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
242 | GPIO_InitStruct.Pull = GPIO_NOPULL;
243 | HAL_GPIO_Init(BOOT1_GPIO_Port, &GPIO_InitStruct);
244 |
245 | /*Configure GPIO pin : CLK_IN_Pin */
246 | GPIO_InitStruct.Pin = CLK_IN_Pin;
247 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
248 | GPIO_InitStruct.Pull = GPIO_NOPULL;
249 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
250 | GPIO_InitStruct.Alternate = GPIO_AF5_SPI2;
251 | HAL_GPIO_Init(CLK_IN_GPIO_Port, &GPIO_InitStruct);
252 |
253 | /*Configure GPIO pins : LD4_Pin LD3_Pin LD5_Pin LD6_Pin
254 | Audio_RST_Pin */
255 | GPIO_InitStruct.Pin = LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin
256 | |Audio_RST_Pin;
257 | GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
258 | GPIO_InitStruct.Pull = GPIO_NOPULL;
259 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
260 | HAL_GPIO_Init(GPIOD, &GPIO_InitStruct);
261 |
262 | /*Configure GPIO pins : PC7 I2S3_SCK_Pin PC12 */
263 | GPIO_InitStruct.Pin = GPIO_PIN_7|I2S3_SCK_Pin|GPIO_PIN_12;
264 | GPIO_InitStruct.Mode = GPIO_MODE_AF_PP;
265 | GPIO_InitStruct.Pull = GPIO_NOPULL;
266 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
267 | GPIO_InitStruct.Alternate = GPIO_AF6_SPI3;
268 | HAL_GPIO_Init(GPIOC, &GPIO_InitStruct);
269 |
270 | /*Configure GPIO pin : OTG_FS_OverCurrent_Pin */
271 | GPIO_InitStruct.Pin = OTG_FS_OverCurrent_Pin;
272 | GPIO_InitStruct.Mode = GPIO_MODE_INPUT;
273 | GPIO_InitStruct.Pull = GPIO_NOPULL;
274 | HAL_GPIO_Init(OTG_FS_OverCurrent_GPIO_Port, &GPIO_InitStruct);
275 |
276 | /*Configure GPIO pins : Audio_SCL_Pin Audio_SDA_Pin */
277 | GPIO_InitStruct.Pin = Audio_SCL_Pin|Audio_SDA_Pin;
278 | GPIO_InitStruct.Mode = GPIO_MODE_AF_OD;
279 | GPIO_InitStruct.Pull = GPIO_PULLUP;
280 | GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
281 | GPIO_InitStruct.Alternate = GPIO_AF4_I2C1;
282 | HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);
283 |
284 | /*Configure GPIO pin : MEMS_INT1_Pin */
285 | GPIO_InitStruct.Pin = MEMS_INT1_Pin;
286 | GPIO_InitStruct.Mode = GPIO_MODE_IT_RISING;
287 | GPIO_InitStruct.Pull = GPIO_NOPULL;
288 | HAL_GPIO_Init(MEMS_INT1_GPIO_Port, &GPIO_InitStruct);
289 |
290 | /*Configure GPIO pin : MEMS_INT2_Pin */
291 | GPIO_InitStruct.Pin = MEMS_INT2_Pin;
292 | GPIO_InitStruct.Mode = GPIO_MODE_EVT_RISING;
293 | GPIO_InitStruct.Pull = GPIO_NOPULL;
294 | HAL_GPIO_Init(MEMS_INT2_GPIO_Port, &GPIO_InitStruct);
295 |
296 | }
297 |
298 | /* USER CODE BEGIN 4 */
299 |
300 | /* USER CODE END 4 */
301 |
302 | /**
303 | * @brief This function is executed in case of error occurrence.
304 | * @param None
305 | * @retval None
306 | */
307 | void Error_Handler(void)
308 | {
309 | /* USER CODE BEGIN Error_Handler */
310 | /* User can add his own implementation to report the HAL error return state */
311 | while(1)
312 | {
313 | }
314 | /* USER CODE END Error_Handler */
315 | }
316 |
317 | #ifdef USE_FULL_ASSERT
318 |
319 | /**
320 | * @brief Reports the name of the source file and the source line number
321 | * where the assert_param error has occurred.
322 | * @param file: pointer to the source file name
323 | * @param line: assert_param error line source number
324 | * @retval None
325 | */
326 | void assert_failed(uint8_t* file, uint32_t line)
327 | {
328 | /* USER CODE BEGIN 6 */
329 | /* User can add his own implementation to report the file name and line number,
330 | ex: printf("Wrong parameters value: file %s on line %d\r\n", file, line) */
331 | /* USER CODE END 6 */
332 |
333 | }
334 |
335 | #endif
336 |
337 | /**
338 | * @}
339 | */
340 |
341 | /**
342 | * @}
343 | */
344 |
345 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
346 |
--------------------------------------------------------------------------------
/Middlewares/ST/STM32_USB_Host_Library/Class/HID/Inc/usbh_hid.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbh_hid.h
4 | * @author MCD Application Team
5 | * @version V3.2.2
6 | * @date 07-July-2015
7 | * @brief This file contains all the prototypes for the usbh_hid.c
8 | ******************************************************************************
9 | * @attention
10 | *
11 | * © COPYRIGHT 2015 STMicroelectronics
12 | *
13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License");
14 | * You may not use this file except in compliance with the License.
15 | * You may obtain a copy of the License at:
16 | *
17 | * http://www.st.com/software_license_agreement_liberty_v2
18 | *
19 | * Unless required by applicable law or agreed to in writing, software
20 | * distributed under the License is distributed on an "AS IS" BASIS,
21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
22 | * See the License for the specific language governing permissions and
23 | * limitations under the License.
24 | *
25 | ******************************************************************************
26 | */
27 |
28 | /* Define to prevent recursive ----------------------------------------------*/
29 | #ifndef __USBH_HID_H
30 | #define __USBH_HID_H
31 |
32 | #ifdef __cplusplus
33 | extern "C" {
34 | #endif
35 |
36 | /* Includes ------------------------------------------------------------------*/
37 | #include "usbh_core.h"
38 | #include "usbh_hid_mouse.h"
39 | #include "usbh_hid_keybd.h"
40 |
41 | /** @addtogroup USBH_LIB
42 | * @{
43 | */
44 |
45 | /** @addtogroup USBH_CLASS
46 | * @{
47 | */
48 |
49 | /** @addtogroup USBH_HID_CLASS
50 | * @{
51 | */
52 |
53 | /** @defgroup USBH_HID_CORE
54 | * @brief This file is the Header file for usbh_hid.c
55 | * @{
56 | */
57 |
58 |
59 | /** @defgroup USBH_HID_CORE_Exported_Types
60 | * @{
61 | */
62 |
63 | #define HID_MIN_POLL 10
64 | #define HID_REPORT_SIZE 16
65 | #define HID_MAX_USAGE 10
66 | #define HID_MAX_NBR_REPORT_FMT 10
67 | #define HID_QUEUE_SIZE 10
68 |
69 | #define HID_ITEM_LONG 0xFE
70 |
71 | #define HID_ITEM_TYPE_MAIN 0x00
72 | #define HID_ITEM_TYPE_GLOBAL 0x01
73 | #define HID_ITEM_TYPE_LOCAL 0x02
74 | #define HID_ITEM_TYPE_RESERVED 0x03
75 |
76 |
77 | #define HID_MAIN_ITEM_TAG_INPUT 0x08
78 | #define HID_MAIN_ITEM_TAG_OUTPUT 0x09
79 | #define HID_MAIN_ITEM_TAG_COLLECTION 0x0A
80 | #define HID_MAIN_ITEM_TAG_FEATURE 0x0B
81 | #define HID_MAIN_ITEM_TAG_ENDCOLLECTION 0x0C
82 |
83 |
84 | #define HID_GLOBAL_ITEM_TAG_USAGE_PAGE 0x00
85 | #define HID_GLOBAL_ITEM_TAG_LOG_MIN 0x01
86 | #define HID_GLOBAL_ITEM_TAG_LOG_MAX 0x02
87 | #define HID_GLOBAL_ITEM_TAG_PHY_MIN 0x03
88 | #define HID_GLOBAL_ITEM_TAG_PHY_MAX 0x04
89 | #define HID_GLOBAL_ITEM_TAG_UNIT_EXPONENT 0x05
90 | #define HID_GLOBAL_ITEM_TAG_UNIT 0x06
91 | #define HID_GLOBAL_ITEM_TAG_REPORT_SIZE 0x07
92 | #define HID_GLOBAL_ITEM_TAG_REPORT_ID 0x08
93 | #define HID_GLOBAL_ITEM_TAG_REPORT_COUNT 0x09
94 | #define HID_GLOBAL_ITEM_TAG_PUSH 0x0A
95 | #define HID_GLOBAL_ITEM_TAG_POP 0x0B
96 |
97 |
98 | #define HID_LOCAL_ITEM_TAG_USAGE 0x00
99 | #define HID_LOCAL_ITEM_TAG_USAGE_MIN 0x01
100 | #define HID_LOCAL_ITEM_TAG_USAGE_MAX 0x02
101 | #define HID_LOCAL_ITEM_TAG_DESIGNATOR_INDEX 0x03
102 | #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MIN 0x04
103 | #define HID_LOCAL_ITEM_TAG_DESIGNATOR_MAX 0x05
104 | #define HID_LOCAL_ITEM_TAG_STRING_INDEX 0x07
105 | #define HID_LOCAL_ITEM_TAG_STRING_MIN 0x08
106 | #define HID_LOCAL_ITEM_TAG_STRING_MAX 0x09
107 | #define HID_LOCAL_ITEM_TAG_DELIMITER 0x0A
108 |
109 |
110 | /* States for HID State Machine */
111 | typedef enum
112 | {
113 | HID_INIT= 0,
114 | HID_IDLE,
115 | HID_SEND_DATA,
116 | HID_BUSY,
117 | HID_GET_DATA,
118 | HID_SYNC,
119 | HID_POLL,
120 | HID_ERROR,
121 | }
122 | HID_StateTypeDef;
123 |
124 | typedef enum
125 | {
126 | HID_REQ_INIT = 0,
127 | HID_REQ_IDLE,
128 | HID_REQ_GET_REPORT_DESC,
129 | HID_REQ_GET_HID_DESC,
130 | HID_REQ_SET_IDLE,
131 | HID_REQ_SET_PROTOCOL,
132 | HID_REQ_SET_REPORT,
133 |
134 | }
135 | HID_CtlStateTypeDef;
136 |
137 | typedef enum
138 | {
139 | HID_MOUSE = 0x01,
140 | HID_KEYBOARD = 0x02,
141 | HID_UNKNOWN = 0xFF,
142 | }
143 | HID_TypeTypeDef;
144 |
145 |
146 | typedef struct _HID_ReportData
147 | {
148 | uint8_t ReportID;
149 | uint8_t ReportType;
150 | uint16_t UsagePage;
151 | uint32_t Usage[HID_MAX_USAGE];
152 | uint32_t NbrUsage;
153 | uint32_t UsageMin;
154 | uint32_t UsageMax;
155 | int32_t LogMin;
156 | int32_t LogMax;
157 | int32_t PhyMin;
158 | int32_t PhyMax;
159 | int32_t UnitExp;
160 | uint32_t Unit;
161 | uint32_t ReportSize;
162 | uint32_t ReportCnt;
163 | uint32_t Flag;
164 | uint32_t PhyUsage;
165 | uint32_t AppUsage;
166 | uint32_t LogUsage;
167 | }
168 | HID_ReportDataTypeDef;
169 |
170 | typedef struct _HID_ReportIDTypeDef {
171 | uint8_t Size; /* Report size return by the device id */
172 | uint8_t ReportID; /* Report Id */
173 | uint8_t Type; /* Report Type (INPUT/OUTPUT/FEATURE) */
174 | } HID_ReportIDTypeDef;
175 |
176 | typedef struct _HID_CollectionTypeDef
177 | {
178 | uint32_t Usage;
179 | uint8_t Type;
180 | struct _HID_CollectionTypeDef *NextPtr;
181 | } HID_CollectionTypeDef;
182 |
183 |
184 | typedef struct _HID_AppCollectionTypeDef {
185 | uint32_t Usage;
186 | uint8_t Type;
187 | uint8_t NbrReportFmt;
188 | HID_ReportDataTypeDef ReportData[HID_MAX_NBR_REPORT_FMT];
189 | } HID_AppCollectionTypeDef;
190 |
191 |
192 | typedef struct _HIDDescriptor
193 | {
194 | uint8_t bLength;
195 | uint8_t bDescriptorType;
196 | uint16_t bcdHID; /* indicates what endpoint this descriptor is describing */
197 | uint8_t bCountryCode; /* specifies the transfer type. */
198 | uint8_t bNumDescriptors; /* specifies the transfer type. */
199 | uint8_t bReportDescriptorType; /* Maximum Packet Size this endpoint is capable of sending or receiving */
200 | uint16_t wItemLength; /* is used to specify the polling interval of certain transfers. */
201 | }
202 | HID_DescTypeDef;
203 |
204 |
205 | typedef struct
206 | {
207 | uint8_t *buf;
208 | uint16_t head;
209 | uint16_t tail;
210 | uint16_t size;
211 | uint8_t lock;
212 | } FIFO_TypeDef;
213 |
214 |
215 | /* Structure for HID process */
216 | typedef struct _HID_Process
217 | {
218 | uint8_t OutPipe;
219 | uint8_t InPipe;
220 | HID_StateTypeDef state;
221 | uint8_t OutEp;
222 | uint8_t InEp;
223 | HID_CtlStateTypeDef ctl_state;
224 | FIFO_TypeDef fifo;
225 | uint8_t *pData;
226 | uint16_t length;
227 | uint8_t ep_addr;
228 | uint16_t poll;
229 | uint32_t timer;
230 | uint8_t DataReady;
231 | HID_DescTypeDef HID_Desc;
232 | USBH_StatusTypeDef ( * Init)(USBH_HandleTypeDef *phost);
233 | }
234 | HID_HandleTypeDef;
235 |
236 | /**
237 | * @}
238 | */
239 |
240 | /** @defgroup USBH_HID_CORE_Exported_Defines
241 | * @{
242 | */
243 |
244 | #define USB_HID_GET_REPORT 0x01
245 | #define USB_HID_GET_IDLE 0x02
246 | #define USB_HID_GET_PROTOCOL 0x03
247 | #define USB_HID_SET_REPORT 0x09
248 | #define USB_HID_SET_IDLE 0x0A
249 | #define USB_HID_SET_PROTOCOL 0x0B
250 |
251 |
252 |
253 |
254 | /* HID Class Codes */
255 | #define USB_HID_CLASS 0x03
256 |
257 | /* Interface Descriptor field values for HID Boot Protocol */
258 | #define HID_BOOT_CODE 0x01
259 | #define HID_KEYBRD_BOOT_CODE 0x01
260 | #define HID_MOUSE_BOOT_CODE 0x02
261 |
262 |
263 | /**
264 | * @}
265 | */
266 |
267 | /** @defgroup USBH_HID_CORE_Exported_Macros
268 | * @{
269 | */
270 | /**
271 | * @}
272 | */
273 |
274 | /** @defgroup USBH_HID_CORE_Exported_Variables
275 | * @{
276 | */
277 | extern USBH_ClassTypeDef HID_Class;
278 | #define USBH_HID_CLASS &HID_Class
279 | /**
280 | * @}
281 | */
282 |
283 | /** @defgroup USBH_HID_CORE_Exported_FunctionsPrototype
284 | * @{
285 | */
286 |
287 | USBH_StatusTypeDef USBH_HID_SetReport (USBH_HandleTypeDef *phost,
288 | uint8_t reportType,
289 | uint8_t reportId,
290 | uint8_t* reportBuff,
291 | uint8_t reportLen);
292 |
293 | USBH_StatusTypeDef USBH_HID_GetReport (USBH_HandleTypeDef *phost,
294 | uint8_t reportType,
295 | uint8_t reportId,
296 | uint8_t* reportBuff,
297 | uint8_t reportLen);
298 |
299 | USBH_StatusTypeDef USBH_HID_GetHIDReportDescriptor (USBH_HandleTypeDef *phost,
300 | uint16_t length);
301 |
302 | USBH_StatusTypeDef USBH_HID_GetHIDDescriptor (USBH_HandleTypeDef *phost,
303 | uint16_t length);
304 |
305 | USBH_StatusTypeDef USBH_HID_SetIdle (USBH_HandleTypeDef *phost,
306 | uint8_t duration,
307 | uint8_t reportId);
308 |
309 | USBH_StatusTypeDef USBH_HID_SetProtocol (USBH_HandleTypeDef *phost,
310 | uint8_t protocol);
311 |
312 | void USBH_HID_EventCallback(USBH_HandleTypeDef *phost);
313 |
314 | HID_TypeTypeDef USBH_HID_GetDeviceType(USBH_HandleTypeDef *phost);
315 |
316 | uint8_t USBH_HID_GetPollInterval(USBH_HandleTypeDef *phost);
317 |
318 | void fifo_init(FIFO_TypeDef * f, uint8_t * buf, uint16_t size);
319 |
320 | uint16_t fifo_read(FIFO_TypeDef * f, void * buf, uint16_t nbytes);
321 |
322 | uint16_t fifo_write(FIFO_TypeDef * f, const void * buf, uint16_t nbytes);
323 |
324 | /**
325 | * @}
326 | */
327 |
328 | #ifdef __cplusplus
329 | }
330 | #endif
331 |
332 | #endif /* __USBH_HID_H */
333 |
334 | /**
335 | * @}
336 | */
337 |
338 | /**
339 | * @}
340 | */
341 |
342 | /**
343 | * @}
344 | */
345 |
346 | /**
347 | * @}
348 | */
349 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
350 |
351 |
--------------------------------------------------------------------------------
/stm32f407_disco_usbh_hid.ioc:
--------------------------------------------------------------------------------
1 | #MicroXplorer Configuration settings - do not modify
2 | File.Version=6
3 | KeepUserPlacement=true
4 | Mcu.Family=STM32F4
5 | Mcu.IP0=NVIC
6 | Mcu.IP1=RCC
7 | Mcu.IP2=SYS
8 | Mcu.IP3=USART2
9 | Mcu.IP4=USB_HOST
10 | Mcu.IP5=USB_OTG_FS
11 | Mcu.IPNb=6
12 | Mcu.Name=STM32F407V(E-G)Tx
13 | Mcu.Package=LQFP100
14 | Mcu.Pin0=PE3
15 | Mcu.Pin1=PC14-OSC32_IN
16 | Mcu.Pin10=PA5
17 | Mcu.Pin11=PA6
18 | Mcu.Pin12=PA7
19 | Mcu.Pin13=PB2
20 | Mcu.Pin14=PB10
21 | Mcu.Pin15=PD12
22 | Mcu.Pin16=PD13
23 | Mcu.Pin17=PD14
24 | Mcu.Pin18=PD15
25 | Mcu.Pin19=PC7
26 | Mcu.Pin2=PC15-OSC32_OUT
27 | Mcu.Pin20=PA9
28 | Mcu.Pin21=PA10
29 | Mcu.Pin22=PA11
30 | Mcu.Pin23=PA12
31 | Mcu.Pin24=PA13
32 | Mcu.Pin25=PA14
33 | Mcu.Pin26=PC10
34 | Mcu.Pin27=PC12
35 | Mcu.Pin28=PD4
36 | Mcu.Pin29=PD5
37 | Mcu.Pin3=PH0-OSC_IN
38 | Mcu.Pin30=PB3
39 | Mcu.Pin31=PB6
40 | Mcu.Pin32=PB9
41 | Mcu.Pin33=PE0
42 | Mcu.Pin34=PE1
43 | Mcu.Pin35=VP_SYS_VS_Systick
44 | Mcu.Pin36=VP_USB_HOST_VS_USB_HOST_HID_FS
45 | Mcu.Pin4=PH1-OSC_OUT
46 | Mcu.Pin5=PC0
47 | Mcu.Pin6=PC3
48 | Mcu.Pin7=PA2
49 | Mcu.Pin8=PA3
50 | Mcu.Pin9=PA4
51 | Mcu.PinsNb=37
52 | Mcu.UserConstants=
53 | Mcu.UserName=STM32F407VGTx
54 | MxCube.Version=4.16.0
55 | MxDb.Version=DB.4.0.160
56 | NVIC.BusFault_IRQn=true\:0\:0\:false\:false\:false
57 | NVIC.DebugMonitor_IRQn=true\:0\:0\:false\:false\:false
58 | NVIC.HardFault_IRQn=true\:0\:0\:false\:false\:false
59 | NVIC.MemoryManagement_IRQn=true\:0\:0\:false\:false\:false
60 | NVIC.NonMaskableInt_IRQn=true\:0\:0\:false\:false\:false
61 | NVIC.OTG_FS_IRQn=true\:0\:0\:false\:false\:true
62 | NVIC.PendSV_IRQn=true\:0\:0\:false\:false\:false
63 | NVIC.PriorityGroup=NVIC_PRIORITYGROUP_0
64 | NVIC.SVCall_IRQn=true\:0\:0\:false\:false\:false
65 | NVIC.SysTick_IRQn=true\:0\:0\:false\:false\:true
66 | NVIC.UsageFault_IRQn=true\:0\:0\:false\:false\:false
67 | PA10.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
68 | PA10.GPIO_Label=OTG_FS_ID
69 | PA10.GPIO_Mode=GPIO_MODE_AF_PP
70 | PA10.GPIO_PuPd=GPIO_NOPULL
71 | PA10.GPIO_Speed=GPIO_SPEED_FREQ_LOW
72 | PA10.Locked=true
73 | PA10.Signal=USB_OTG_FS_ID
74 | PA11.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
75 | PA11.GPIO_Label=OTG_FS_DM
76 | PA11.GPIO_Mode=GPIO_MODE_AF_PP
77 | PA11.GPIO_PuPd=GPIO_NOPULL
78 | PA11.GPIO_Speed=GPIO_SPEED_FREQ_LOW
79 | PA11.Locked=true
80 | PA11.Mode=Host_Only
81 | PA11.Signal=USB_OTG_FS_DM
82 | PA12.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
83 | PA12.GPIO_Label=OTG_FS_DP
84 | PA12.GPIO_Mode=GPIO_MODE_AF_PP
85 | PA12.GPIO_PuPd=GPIO_NOPULL
86 | PA12.GPIO_Speed=GPIO_SPEED_FREQ_LOW
87 | PA12.Locked=true
88 | PA12.Mode=Host_Only
89 | PA12.Signal=USB_OTG_FS_DP
90 | PA13.GPIOParameters=GPIO_Label
91 | PA13.GPIO_Label=SWDIO
92 | PA13.Locked=true
93 | PA13.Mode=Serial_Wire
94 | PA13.Signal=SYS_JTMS-SWDIO
95 | PA14.GPIOParameters=GPIO_Label
96 | PA14.GPIO_Label=SWCLK
97 | PA14.Locked=true
98 | PA14.Mode=Serial_Wire
99 | PA14.Signal=SYS_JTCK-SWCLK
100 | PA2.Mode=Asynchronous
101 | PA2.Signal=USART2_TX
102 | PA3.Mode=Asynchronous
103 | PA3.Signal=USART2_RX
104 | PA4.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
105 | PA4.GPIO_Label=I2S3_WS [CS43L22_LRCK]
106 | PA4.GPIO_Mode=GPIO_MODE_AF_PP
107 | PA4.GPIO_PuPd=GPIO_NOPULL
108 | PA4.GPIO_Speed=GPIO_SPEED_FREQ_LOW
109 | PA4.Locked=true
110 | PA4.Signal=I2S3_WS
111 | PA5.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
112 | PA5.GPIO_Label=SPI1_SCK [LIS302DL_SCL/SPC]
113 | PA5.GPIO_Mode=GPIO_MODE_AF_PP
114 | PA5.GPIO_PuPd=GPIO_NOPULL
115 | PA5.GPIO_Speed=GPIO_SPEED_FREQ_LOW
116 | PA5.Locked=true
117 | PA5.Signal=SPI1_SCK
118 | PA6.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
119 | PA6.GPIO_Label=SPI1_MISO [LIS302DL_SDO]
120 | PA6.GPIO_Mode=GPIO_MODE_AF_PP
121 | PA6.GPIO_PuPd=GPIO_NOPULL
122 | PA6.GPIO_Speed=GPIO_SPEED_FREQ_LOW
123 | PA6.Locked=true
124 | PA6.Signal=SPI1_MISO
125 | PA7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
126 | PA7.GPIO_Label=SPI1_MOSI [LIS302DL_SDA/SDI/SDO]
127 | PA7.GPIO_Mode=GPIO_MODE_AF_PP
128 | PA7.GPIO_PuPd=GPIO_NOPULL
129 | PA7.GPIO_Speed=GPIO_SPEED_FREQ_LOW
130 | PA7.Locked=true
131 | PA7.Signal=SPI1_MOSI
132 | PA9.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_Mode
133 | PA9.GPIO_Label=VBUS_FS
134 | PA9.GPIO_Mode=GPIO_MODE_INPUT
135 | PA9.GPIO_PuPd=GPIO_NOPULL
136 | PA9.Locked=true
137 | PA9.Mode=Activate_VBUS
138 | PA9.Signal=USB_OTG_FS_VBUS
139 | PB10.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
140 | PB10.GPIO_Label=CLK_IN [MP45DT02_CLK]
141 | PB10.GPIO_Mode=GPIO_MODE_AF_PP
142 | PB10.GPIO_PuPd=GPIO_NOPULL
143 | PB10.GPIO_Speed=GPIO_SPEED_FREQ_LOW
144 | PB10.Locked=true
145 | PB10.Signal=I2S2_CK
146 | PB2.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_Mode
147 | PB2.GPIO_Label=BOOT1
148 | PB2.GPIO_Mode=GPIO_MODE_INPUT
149 | PB2.GPIO_PuPd=GPIO_NOPULL
150 | PB2.Locked=true
151 | PB2.Signal=GPIO_Input
152 | PB3.GPIOParameters=GPIO_Label
153 | PB3.GPIO_Label=SWO
154 | PB3.Locked=true
155 | PB3.Signal=SYS_JTDO-SWO
156 | PB6.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
157 | PB6.GPIO_Label=Audio_SCL [CS43L22_SCL]
158 | PB6.GPIO_Mode=GPIO_MODE_AF_OD
159 | PB6.GPIO_PuPd=GPIO_NOPULL
160 | PB6.GPIO_Speed=GPIO_SPEED_FREQ_LOW
161 | PB6.Locked=true
162 | PB6.Signal=I2C1_SCL
163 | PB9.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
164 | PB9.GPIO_Label=Audio_SDA [CS43L22_SDA]
165 | PB9.GPIO_Mode=GPIO_MODE_AF_OD
166 | PB9.GPIO_PuPd=GPIO_NOPULL
167 | PB9.GPIO_Speed=GPIO_SPEED_FREQ_LOW
168 | PB9.Locked=true
169 | PB9.Signal=I2C1_SDA
170 | PC0.GPIOParameters=GPIO_Speed,PinState,GPIO_PuPd,GPIO_Label
171 | PC0.GPIO_Label=OTG_FS_PowerSwitchOn
172 | PC0.GPIO_PuPd=GPIO_NOPULL
173 | PC0.GPIO_Speed=GPIO_SPEED_FREQ_LOW
174 | PC0.Locked=true
175 | PC0.PinState=GPIO_PIN_SET
176 | PC0.Signal=GPIO_Output
177 | PC10.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
178 | PC10.GPIO_Label=I2S3_SCK [CS43L22_SCLK]
179 | PC10.GPIO_Mode=GPIO_MODE_AF_PP
180 | PC10.GPIO_PuPd=GPIO_NOPULL
181 | PC10.GPIO_Speed=GPIO_SPEED_FREQ_LOW
182 | PC10.Locked=true
183 | PC10.Signal=I2S3_CK
184 | PC12.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
185 | PC12.GPIO_Label=I2S3_SD [CS43L22_SDIN]
186 | PC12.GPIO_Mode=GPIO_MODE_AF_PP
187 | PC12.GPIO_PuPd=GPIO_NOPULL
188 | PC12.GPIO_Speed=GPIO_SPEED_FREQ_LOW
189 | PC12.Locked=true
190 | PC12.Signal=I2S3_SD
191 | PC14-OSC32_IN.GPIOParameters=GPIO_Label
192 | PC14-OSC32_IN.GPIO_Label=PC14-OSC32_IN
193 | PC14-OSC32_IN.Locked=true
194 | PC14-OSC32_IN.Signal=RCC_OSC32_IN
195 | PC15-OSC32_OUT.GPIOParameters=GPIO_Label
196 | PC15-OSC32_OUT.GPIO_Label=PC15-OSC32_OUT
197 | PC15-OSC32_OUT.Locked=true
198 | PC15-OSC32_OUT.Signal=RCC_OSC32_OUT
199 | PC3.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
200 | PC3.GPIO_Label=PDM_OUT [MP45DT02_DOUT]
201 | PC3.GPIO_Mode=GPIO_MODE_AF_PP
202 | PC3.GPIO_PuPd=GPIO_NOPULL
203 | PC3.GPIO_Speed=GPIO_SPEED_FREQ_LOW
204 | PC3.Locked=true
205 | PC3.Signal=I2S2_SD
206 | PC7.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label,GPIO_Mode
207 | PC7.GPIO_Label=I2S3_MCK [CS43L22_MCLK]
208 | PC7.GPIO_Mode=GPIO_MODE_AF_PP
209 | PC7.GPIO_PuPd=GPIO_NOPULL
210 | PC7.GPIO_Speed=GPIO_SPEED_FREQ_LOW
211 | PC7.Locked=true
212 | PC7.Signal=I2S3_MCK
213 | PCC.Checker=false
214 | PCC.Line=STM32F407/417
215 | PCC.MCU=STM32F407V(E-G)Tx
216 | PCC.MXVersion=4.16.0
217 | PCC.PartNumber=STM32F407VGTx
218 | PCC.Seq0=0
219 | PCC.Series=STM32F4
220 | PCC.Temperature=25
221 | PCC.Vdd=3.3
222 | PD12.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
223 | PD12.GPIO_Label=LD4 [Green Led]
224 | PD12.GPIO_PuPd=GPIO_NOPULL
225 | PD12.GPIO_Speed=GPIO_SPEED_FREQ_LOW
226 | PD12.Locked=true
227 | PD12.Signal=GPIO_Output
228 | PD13.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
229 | PD13.GPIO_Label=LD3 [Orange Led]
230 | PD13.GPIO_PuPd=GPIO_NOPULL
231 | PD13.GPIO_Speed=GPIO_SPEED_FREQ_LOW
232 | PD13.Locked=true
233 | PD13.Signal=GPIO_Output
234 | PD14.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
235 | PD14.GPIO_Label=LD5 [Red Led]
236 | PD14.GPIO_PuPd=GPIO_NOPULL
237 | PD14.GPIO_Speed=GPIO_SPEED_FREQ_LOW
238 | PD14.Locked=true
239 | PD14.Signal=GPIO_Output
240 | PD15.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
241 | PD15.GPIO_Label=LD6 [Blue Led]
242 | PD15.GPIO_PuPd=GPIO_NOPULL
243 | PD15.GPIO_Speed=GPIO_SPEED_FREQ_LOW
244 | PD15.Locked=true
245 | PD15.Signal=GPIO_Output
246 | PD4.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
247 | PD4.GPIO_Label=Audio_RST [CS43L22_RESET]
248 | PD4.GPIO_PuPd=GPIO_NOPULL
249 | PD4.GPIO_Speed=GPIO_SPEED_FREQ_LOW
250 | PD4.Locked=true
251 | PD4.Signal=GPIO_Output
252 | PD5.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_Mode
253 | PD5.GPIO_Label=OTG_FS_OverCurrent
254 | PD5.GPIO_Mode=GPIO_MODE_INPUT
255 | PD5.GPIO_PuPd=GPIO_NOPULL
256 | PD5.Locked=true
257 | PD5.Signal=GPIO_Input
258 | PE0.GPIOParameters=GPIO_Label
259 | PE0.GPIO_Label=MEMS_INT1 [LIS302DL_INT1]
260 | PE0.Locked=true
261 | PE0.Signal=GPXTI0
262 | PE1.GPIOParameters=GPIO_PuPd,GPIO_Label,GPIO_ModeDefaultEXTI
263 | PE1.GPIO_Label=MEMS_INT2 [LIS302DL_INT2]
264 | PE1.GPIO_ModeDefaultEXTI=GPIO_MODE_EVT_RISING
265 | PE1.GPIO_PuPd=GPIO_NOPULL
266 | PE1.Locked=true
267 | PE1.Signal=GPXTI1
268 | PE3.GPIOParameters=GPIO_Speed,GPIO_PuPd,GPIO_Label
269 | PE3.GPIO_Label=CS_I2C/SPI [LIS302DL_CS_I2C/SPI]
270 | PE3.GPIO_PuPd=GPIO_NOPULL
271 | PE3.GPIO_Speed=GPIO_SPEED_FREQ_LOW
272 | PE3.Locked=true
273 | PE3.Signal=GPIO_Output
274 | PH0-OSC_IN.GPIOParameters=GPIO_Label
275 | PH0-OSC_IN.GPIO_Label=PH0-OSC_IN
276 | PH0-OSC_IN.Locked=true
277 | PH0-OSC_IN.Mode=HSE-External-Oscillator
278 | PH0-OSC_IN.Signal=RCC_OSC_IN
279 | PH1-OSC_OUT.GPIOParameters=GPIO_Label
280 | PH1-OSC_OUT.GPIO_Label=PH1-OSC_OUT
281 | PH1-OSC_OUT.Locked=true
282 | PH1-OSC_OUT.Mode=HSE-External-Oscillator
283 | PH1-OSC_OUT.Signal=RCC_OSC_OUT
284 | ProjectManager.AskForMigrate=true
285 | ProjectManager.BackupPrevious=false
286 | ProjectManager.CompilerOptimize=2
287 | ProjectManager.ComputerToolchain=false
288 | ProjectManager.CoupleFile=false
289 | ProjectManager.DeletePrevious=true
290 | ProjectManager.DeviceId=STM32F407VGTx
291 | ProjectManager.FirmwarePackage=STM32Cube FW_F4 V1.13.0
292 | ProjectManager.FreePins=false
293 | ProjectManager.HalAssertFull=false
294 | ProjectManager.HeapSize=0x200
295 | ProjectManager.KeepUserCode=true
296 | ProjectManager.LastFirmware=true
297 | ProjectManager.LibraryCopy=1
298 | ProjectManager.PreviousToolchain=TrueSTUDIO
299 | ProjectManager.ProjectBuild=false
300 | ProjectManager.ProjectFileName=stm32f407_disco_usbh_hid.ioc
301 | ProjectManager.ProjectName=stm32f407_disco_usbh_hid
302 | ProjectManager.StackSize=0x400
303 | ProjectManager.TargetToolchain=TrueSTUDIO
304 | ProjectManager.ToolChainLocation=C\:\\ARM_workspace_6\\stm32f407_disco_usbh_hid_cubemx\\stm32f407_disco_usbh_hid
305 | ProjectManager.UnderRoot=true
306 | ProjectManager.functionlistsort=1-MX_GPIO_Init-GPIO-false,2-MX_USART2_UART_Init-USART2-false,3-MX_USB_HOST_Init-USB_HOST-false
307 | RCC.48MHZClocksFreq_Value=48000000
308 | RCC.AHBFreq_Value=168000000
309 | RCC.APB1CLKDivider=RCC_HCLK_DIV4
310 | RCC.APB1Freq_Value=42000000
311 | RCC.APB1TimFreq_Value=84000000
312 | RCC.APB2CLKDivider=RCC_HCLK_DIV2
313 | RCC.APB2Freq_Value=84000000
314 | RCC.APB2TimFreq_Value=168000000
315 | RCC.CortexFreq_Value=168000000
316 | RCC.EthernetFreq_Value=168000000
317 | RCC.FCLKCortexFreq_Value=168000000
318 | RCC.FamilyName=M
319 | RCC.HCLKFreq_Value=168000000
320 | RCC.HSE_VALUE=8000000
321 | RCC.HSI_VALUE=16000000
322 | RCC.I2SClocksFreq_Value=96000000
323 | RCC.IPParameters=48MHZClocksFreq_Value,AHBFreq_Value,APB1CLKDivider,APB1Freq_Value,APB1TimFreq_Value,APB2CLKDivider,APB2Freq_Value,APB2TimFreq_Value,CortexFreq_Value,EthernetFreq_Value,FCLKCortexFreq_Value,FamilyName,HCLKFreq_Value,HSE_VALUE,HSI_VALUE,I2SClocksFreq_Value,LSE_VALUE,LSI_VALUE,MCO2PinFreq_Value,PLLCLKFreq_Value,PLLM,PLLN,PLLQ,PLLQCLKFreq_Value,RTCFreq_Value,RTCHSEDivFreq_Value,SYSCLKFreq_VALUE,SYSCLKSource,VCOI2SOutputFreq_Value,VCOInputFreq_Value,VCOOutputFreq_Value,VcooutputI2S
324 | RCC.LSE_VALUE=32768
325 | RCC.LSI_VALUE=32000
326 | RCC.MCO2PinFreq_Value=168000000
327 | RCC.PLLCLKFreq_Value=168000000
328 | RCC.PLLM=8
329 | RCC.PLLN=336
330 | RCC.PLLQ=7
331 | RCC.PLLQCLKFreq_Value=48000000
332 | RCC.RTCFreq_Value=32000
333 | RCC.RTCHSEDivFreq_Value=4000000
334 | RCC.SYSCLKFreq_VALUE=168000000
335 | RCC.SYSCLKSource=RCC_SYSCLKSOURCE_PLLCLK
336 | RCC.VCOI2SOutputFreq_Value=192000000
337 | RCC.VCOInputFreq_Value=1000000
338 | RCC.VCOOutputFreq_Value=336000000
339 | RCC.VcooutputI2S=96000000
340 | SH.GPXTI0.0=GPIO_EXTI0
341 | SH.GPXTI0.ConfNb=1
342 | SH.GPXTI1.0=GPIO_EXTI1
343 | SH.GPXTI1.ConfNb=1
344 | USB_HOST.IPParameters=VirtualModeFS,USBH_HandleTypeDef-HID_FS,USBH_DEBUG_LEVEL-HID_FS
345 | USB_HOST.USBH_DEBUG_LEVEL-HID_FS=3
346 | USB_HOST.USBH_HandleTypeDef-HID_FS=hUsbHostFS
347 | USB_HOST.VirtualModeFS=Hid
348 | USB_OTG_FS.IPParameters=phy_itface
349 | USB_OTG_FS.phy_itface=HCD_PHY_EMBEDDED
350 | VP_SYS_VS_Systick.Mode=SysTick
351 | VP_SYS_VS_Systick.Signal=SYS_VS_Systick
352 | VP_USB_HOST_VS_USB_HOST_HID_FS.Mode=HID_FS
353 | VP_USB_HOST_VS_USB_HOST_HID_FS.Signal=USB_HOST_VS_USB_HOST_HID_FS
354 | board=STM32F407G-DISC1
355 | boardIOC=true
356 |
--------------------------------------------------------------------------------
/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_dma_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_dma_ex.c
4 | * @author MCD Application Team
5 | * @version V1.5.1
6 | * @date 01-July-2016
7 | * @brief DMA Extension HAL module driver
8 | * This file provides firmware functions to manage the following
9 | * functionalities of the DMA Extension peripheral:
10 | * + Extended features functions
11 | *
12 | @verbatim
13 | ==============================================================================
14 | ##### How to use this driver #####
15 | ==============================================================================
16 | [..]
17 | The DMA Extension HAL driver can be used as follows:
18 | (#) Start a multi buffer transfer using the HAL_DMA_MultiBufferStart() function
19 | for polling mode or HAL_DMA_MultiBufferStart_IT() for interrupt mode.
20 |
21 | -@- In Memory-to-Memory transfer mode, Multi (Double) Buffer mode is not allowed.
22 | -@- When Multi (Double) Buffer mode is enabled the, transfer is circular by default.
23 | -@- In Multi (Double) buffer mode, it is possible to update the base address for
24 | the AHB memory port on the fly (DMA_SxM0AR or DMA_SxM1AR) when the stream is enabled.
25 |
26 | @endverbatim
27 | ******************************************************************************
28 | * @attention
29 | *
30 | * © COPYRIGHT(c) 2016 STMicroelectronics
31 | *
32 | * Redistribution and use in source and binary forms, with or without modification,
33 | * are permitted provided that the following conditions are met:
34 | * 1. Redistributions of source code must retain the above copyright notice,
35 | * this list of conditions and the following disclaimer.
36 | * 2. Redistributions in binary form must reproduce the above copyright notice,
37 | * this list of conditions and the following disclaimer in the documentation
38 | * and/or other materials provided with the distribution.
39 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
40 | * may be used to endorse or promote products derived from this software
41 | * without specific prior written permission.
42 | *
43 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
44 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
45 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
46 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
47 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
48 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
49 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
50 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
51 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
52 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
53 | *
54 | ******************************************************************************
55 | */
56 |
57 | /* Includes ------------------------------------------------------------------*/
58 | #include "stm32f4xx_hal.h"
59 |
60 | /** @addtogroup STM32F4xx_HAL_Driver
61 | * @{
62 | */
63 |
64 | /** @defgroup DMAEx DMAEx
65 | * @brief DMA Extended HAL module driver
66 | * @{
67 | */
68 |
69 | #ifdef HAL_DMA_MODULE_ENABLED
70 |
71 | /* Private types -------------------------------------------------------------*/
72 | /* Private variables ---------------------------------------------------------*/
73 | /* Private Constants ---------------------------------------------------------*/
74 | /* Private macros ------------------------------------------------------------*/
75 | /* Private functions ---------------------------------------------------------*/
76 | /** @addtogroup DMAEx_Private_Functions
77 | * @{
78 | */
79 | static void DMA_MultiBufferSetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength);
80 | /**
81 | * @}
82 | */
83 |
84 | /* Exported functions ---------------------------------------------------------*/
85 |
86 | /** @addtogroup DMAEx_Exported_Functions
87 | * @{
88 | */
89 |
90 |
91 | /** @addtogroup DMAEx_Exported_Functions_Group1
92 | *
93 | @verbatim
94 | ===============================================================================
95 | ##### Extended features functions #####
96 | ===============================================================================
97 | [..] This section provides functions allowing to:
98 | (+) Configure the source, destination address and data length and
99 | Start MultiBuffer DMA transfer
100 | (+) Configure the source, destination address and data length and
101 | Start MultiBuffer DMA transfer with interrupt
102 | (+) Change on the fly the memory0 or memory1 address.
103 |
104 | @endverbatim
105 | * @{
106 | */
107 |
108 |
109 | /**
110 | * @brief Starts the multi_buffer DMA Transfer.
111 | * @param hdma : pointer to a DMA_HandleTypeDef structure that contains
112 | * the configuration information for the specified DMA Stream.
113 | * @param SrcAddress: The source memory Buffer address
114 | * @param DstAddress: The destination memory Buffer address
115 | * @param SecondMemAddress: The second memory Buffer address in case of multi buffer Transfer
116 | * @param DataLength: The length of data to be transferred from source to destination
117 | * @retval HAL status
118 | */
119 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength)
120 | {
121 | HAL_StatusTypeDef status = HAL_OK;
122 |
123 | /* Check the parameters */
124 | assert_param(IS_DMA_BUFFER_SIZE(DataLength));
125 |
126 | /* Memory-to-memory transfer not supported in double buffering mode */
127 | if (hdma->Init.Direction == DMA_MEMORY_TO_MEMORY)
128 | {
129 | hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED;
130 | status = HAL_ERROR;
131 | }
132 | else
133 | {
134 | /* Process Locked */
135 | __HAL_LOCK(hdma);
136 |
137 | if(HAL_DMA_STATE_READY == hdma->State)
138 | {
139 | /* Change DMA peripheral state */
140 | hdma->State = HAL_DMA_STATE_BUSY;
141 |
142 | /* Enable the double buffer mode */
143 | hdma->Instance->CR |= (uint32_t)DMA_SxCR_DBM;
144 |
145 | /* Configure DMA Stream destination address */
146 | hdma->Instance->M1AR = SecondMemAddress;
147 |
148 | /* Configure the source, destination address and the data length */
149 | DMA_MultiBufferSetConfig(hdma, SrcAddress, DstAddress, DataLength);
150 |
151 | /* Enable the peripheral */
152 | __HAL_DMA_ENABLE(hdma);
153 | }
154 | else
155 | {
156 | /* Return error status */
157 | status = HAL_BUSY;
158 | }
159 | }
160 | return status;
161 | }
162 |
163 | /**
164 | * @brief Starts the multi_buffer DMA Transfer with interrupt enabled.
165 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
166 | * the configuration information for the specified DMA Stream.
167 | * @param SrcAddress: The source memory Buffer address
168 | * @param DstAddress: The destination memory Buffer address
169 | * @param SecondMemAddress: The second memory Buffer address in case of multi buffer Transfer
170 | * @param DataLength: The length of data to be transferred from source to destination
171 | * @retval HAL status
172 | */
173 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength)
174 | {
175 | HAL_StatusTypeDef status = HAL_OK;
176 |
177 | /* Check the parameters */
178 | assert_param(IS_DMA_BUFFER_SIZE(DataLength));
179 |
180 | /* Memory-to-memory transfer not supported in double buffering mode */
181 | if (hdma->Init.Direction == DMA_MEMORY_TO_MEMORY)
182 | {
183 | hdma->ErrorCode = HAL_DMA_ERROR_NOT_SUPPORTED;
184 | return HAL_ERROR;
185 | }
186 |
187 | /* Check callback functions */
188 | if ((NULL == hdma->XferCpltCallback) || (NULL == hdma->XferM1CpltCallback) || (NULL == hdma->XferErrorCallback))
189 | {
190 | hdma->ErrorCode = HAL_DMA_ERROR_PARAM;
191 | return HAL_ERROR;
192 | }
193 |
194 | /* Process locked */
195 | __HAL_LOCK(hdma);
196 |
197 | if(HAL_DMA_STATE_READY == hdma->State)
198 | {
199 | /* Change DMA peripheral state */
200 | hdma->State = HAL_DMA_STATE_BUSY;
201 |
202 | /* Initialize the error code */
203 | hdma->ErrorCode = HAL_DMA_ERROR_NONE;
204 |
205 | /* Enable the Double buffer mode */
206 | hdma->Instance->CR |= (uint32_t)DMA_SxCR_DBM;
207 |
208 | /* Configure DMA Stream destination address */
209 | hdma->Instance->M1AR = SecondMemAddress;
210 |
211 | /* Configure the source, destination address and the data length */
212 | DMA_MultiBufferSetConfig(hdma, SrcAddress, DstAddress, DataLength);
213 |
214 | /* Clear all flags */
215 | __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_TC_FLAG_INDEX(hdma));
216 | __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_HT_FLAG_INDEX(hdma));
217 | __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_TE_FLAG_INDEX(hdma));
218 | __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_DME_FLAG_INDEX(hdma));
219 | __HAL_DMA_CLEAR_FLAG (hdma, __HAL_DMA_GET_FE_FLAG_INDEX(hdma));
220 |
221 | /* Enable Common interrupts*/
222 | hdma->Instance->CR |= DMA_IT_TC | DMA_IT_TE | DMA_IT_DME;
223 | hdma->Instance->FCR |= DMA_IT_FE;
224 |
225 | if((hdma->XferHalfCpltCallback != NULL) || (hdma->XferM1HalfCpltCallback != NULL))
226 | {
227 | hdma->Instance->CR |= DMA_IT_HT;
228 | }
229 |
230 | /* Enable the peripheral */
231 | __HAL_DMA_ENABLE(hdma);
232 | }
233 | else
234 | {
235 | /* Process unlocked */
236 | __HAL_UNLOCK(hdma);
237 |
238 | /* Return error status */
239 | status = HAL_BUSY;
240 | }
241 | return status;
242 | }
243 |
244 | /**
245 | * @brief Change the memory0 or memory1 address on the fly.
246 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
247 | * the configuration information for the specified DMA Stream.
248 | * @param Address: The new address
249 | * @param memory: the memory to be changed, This parameter can be one of
250 | * the following values:
251 | * MEMORY0 /
252 | * MEMORY1
253 | * @note The MEMORY0 address can be changed only when the current transfer use
254 | * MEMORY1 and the MEMORY1 address can be changed only when the current
255 | * transfer use MEMORY0.
256 | * @retval HAL status
257 | */
258 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory)
259 | {
260 | if(memory == MEMORY0)
261 | {
262 | /* change the memory0 address */
263 | hdma->Instance->M0AR = Address;
264 | }
265 | else
266 | {
267 | /* change the memory1 address */
268 | hdma->Instance->M1AR = Address;
269 | }
270 |
271 | return HAL_OK;
272 | }
273 |
274 | /**
275 | * @}
276 | */
277 |
278 | /**
279 | * @}
280 | */
281 |
282 | /** @addtogroup DMAEx_Private_Functions
283 | * @{
284 | */
285 |
286 | /**
287 | * @brief Set the DMA Transfer parameter.
288 | * @param hdma: pointer to a DMA_HandleTypeDef structure that contains
289 | * the configuration information for the specified DMA Stream.
290 | * @param SrcAddress: The source memory Buffer address
291 | * @param DstAddress: The destination memory Buffer address
292 | * @param DataLength: The length of data to be transferred from source to destination
293 | * @retval HAL status
294 | */
295 | static void DMA_MultiBufferSetConfig(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t DataLength)
296 | {
297 | /* Configure DMA Stream data length */
298 | hdma->Instance->NDTR = DataLength;
299 |
300 | /* Peripheral to Memory */
301 | if((hdma->Init.Direction) == DMA_MEMORY_TO_PERIPH)
302 | {
303 | /* Configure DMA Stream destination address */
304 | hdma->Instance->PAR = DstAddress;
305 |
306 | /* Configure DMA Stream source address */
307 | hdma->Instance->M0AR = SrcAddress;
308 | }
309 | /* Memory to Peripheral */
310 | else
311 | {
312 | /* Configure DMA Stream source address */
313 | hdma->Instance->PAR = SrcAddress;
314 |
315 | /* Configure DMA Stream destination address */
316 | hdma->Instance->M0AR = DstAddress;
317 | }
318 | }
319 |
320 | /**
321 | * @}
322 | */
323 |
324 | #endif /* HAL_DMA_MODULE_ENABLED */
325 | /**
326 | * @}
327 | */
328 |
329 | /**
330 | * @}
331 | */
332 |
333 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
334 |
--------------------------------------------------------------------------------