├── Attacking_Board
├── AD_Attacking_Board.pcbdoc
├── Acrylic(optional).dwg
├── BOM_Attacking_Board_2023-03-23.csv
├── Gerber_Attacking_Board.zip
├── LCEDA_PCB_Attacking_Board.json
├── Model.jpg
├── PCB.jpg
└── Shell(optional).jpg
├── Auto_Clicker
├── AD_Auto_Clicker.pcbdoc
├── BOM_Auto_Clicker.csv
├── Gerber_Auto_Clicker.zip
├── LCEDA_PCB_Auto_Clicker.json
├── Model.jpg
├── PCB.jpg
└── Sucker.jpg
├── FPC_Cable
├── AD_FPC_Cable.pcbdoc
├── BOM_FPC_Cable.csv
├── Gerber_FPC_Cable.zip
├── LCEDA_PCB_FPC_Cable.json
└── PCB.jpg
├── Firmware
├── InfinityGauntlet
│ ├── Core
│ │ ├── Inc
│ │ │ ├── checksum.h
│ │ │ ├── main.h
│ │ │ ├── romimg.h
│ │ │ ├── stm32f4xx_hal_conf.h
│ │ │ └── stm32f4xx_it.h
│ │ ├── Src
│ │ │ ├── checksum.c
│ │ │ ├── main.c
│ │ │ ├── romimg.c
│ │ │ ├── stm32f4xx_hal_msp.c
│ │ │ ├── stm32f4xx_hal_timebase_tim.c
│ │ │ ├── stm32f4xx_it.c
│ │ │ ├── syscalls.c
│ │ │ ├── sysmem.c
│ │ │ └── system_stm32f4xx.c
│ │ └── Startup
│ │ │ └── startup_stm32f412ceux.s
│ ├── Drivers
│ │ ├── CMSIS
│ │ │ ├── Device
│ │ │ │ └── ST
│ │ │ │ │ └── STM32F4xx
│ │ │ │ │ └── Include
│ │ │ │ │ ├── stm32f412cx.h
│ │ │ │ │ ├── stm32f4xx.h
│ │ │ │ │ └── system_stm32f4xx.h
│ │ │ └── Include
│ │ │ │ ├── cmsis_armcc.h
│ │ │ │ ├── cmsis_armclang.h
│ │ │ │ ├── cmsis_compiler.h
│ │ │ │ ├── cmsis_gcc.h
│ │ │ │ ├── cmsis_iccarm.h
│ │ │ │ ├── cmsis_version.h
│ │ │ │ ├── core_armv8mbl.h
│ │ │ │ ├── core_armv8mml.h
│ │ │ │ ├── core_cm0.h
│ │ │ │ ├── core_cm0plus.h
│ │ │ │ ├── core_cm1.h
│ │ │ │ ├── core_cm23.h
│ │ │ │ ├── core_cm3.h
│ │ │ │ ├── core_cm33.h
│ │ │ │ ├── core_cm4.h
│ │ │ │ ├── core_cm7.h
│ │ │ │ ├── core_sc000.h
│ │ │ │ ├── core_sc300.h
│ │ │ │ ├── mpu_armv7.h
│ │ │ │ ├── mpu_armv8.h
│ │ │ │ └── tz_context.h
│ │ ├── DSP
│ │ │ ├── include
│ │ │ │ ├── arm_common_tables.h
│ │ │ │ ├── arm_const_structs.h
│ │ │ │ └── arm_math.h
│ │ │ └── libarm_cortexM4lf_math.a
│ │ ├── STM32F4xx_HAL_Driver
│ │ │ ├── Inc
│ │ │ │ ├── Legacy
│ │ │ │ │ └── stm32_hal_legacy.h
│ │ │ │ ├── stm32f4xx_hal.h
│ │ │ │ ├── stm32f4xx_hal_cortex.h
│ │ │ │ ├── stm32f4xx_hal_def.h
│ │ │ │ ├── stm32f4xx_hal_dma.h
│ │ │ │ ├── stm32f4xx_hal_dma_ex.h
│ │ │ │ ├── stm32f4xx_hal_exti.h
│ │ │ │ ├── stm32f4xx_hal_flash.h
│ │ │ │ ├── stm32f4xx_hal_flash_ex.h
│ │ │ │ ├── stm32f4xx_hal_flash_ramfunc.h
│ │ │ │ ├── stm32f4xx_hal_gpio.h
│ │ │ │ ├── stm32f4xx_hal_gpio_ex.h
│ │ │ │ ├── stm32f4xx_hal_i2c.h
│ │ │ │ ├── stm32f4xx_hal_i2c_ex.h
│ │ │ │ ├── stm32f4xx_hal_pcd.h
│ │ │ │ ├── stm32f4xx_hal_pcd_ex.h
│ │ │ │ ├── stm32f4xx_hal_pwr.h
│ │ │ │ ├── stm32f4xx_hal_pwr_ex.h
│ │ │ │ ├── stm32f4xx_hal_rcc.h
│ │ │ │ ├── stm32f4xx_hal_rcc_ex.h
│ │ │ │ ├── stm32f4xx_hal_sd.h
│ │ │ │ ├── stm32f4xx_hal_spi.h
│ │ │ │ ├── stm32f4xx_hal_tim.h
│ │ │ │ ├── stm32f4xx_hal_tim_ex.h
│ │ │ │ ├── stm32f4xx_hal_uart.h
│ │ │ │ ├── stm32f4xx_ll_sdmmc.h
│ │ │ │ └── stm32f4xx_ll_usb.h
│ │ │ └── Src
│ │ │ │ ├── stm32f4xx_hal.c
│ │ │ │ ├── stm32f4xx_hal_cortex.c
│ │ │ │ ├── stm32f4xx_hal_dma.c
│ │ │ │ ├── stm32f4xx_hal_dma_ex.c
│ │ │ │ ├── stm32f4xx_hal_exti.c
│ │ │ │ ├── stm32f4xx_hal_flash.c
│ │ │ │ ├── stm32f4xx_hal_flash_ex.c
│ │ │ │ ├── stm32f4xx_hal_flash_ramfunc.c
│ │ │ │ ├── stm32f4xx_hal_gpio.c
│ │ │ │ ├── stm32f4xx_hal_i2c.c
│ │ │ │ ├── stm32f4xx_hal_i2c_ex.c
│ │ │ │ ├── stm32f4xx_hal_pcd.c
│ │ │ │ ├── stm32f4xx_hal_pcd_ex.c
│ │ │ │ ├── stm32f4xx_hal_pwr.c
│ │ │ │ ├── stm32f4xx_hal_pwr_ex.c
│ │ │ │ ├── stm32f4xx_hal_rcc.c
│ │ │ │ ├── stm32f4xx_hal_rcc_ex.c
│ │ │ │ ├── stm32f4xx_hal_sd.c
│ │ │ │ ├── stm32f4xx_hal_spi.c
│ │ │ │ ├── stm32f4xx_hal_tim.c
│ │ │ │ ├── stm32f4xx_hal_tim_ex.c
│ │ │ │ ├── stm32f4xx_hal_uart.c
│ │ │ │ ├── stm32f4xx_ll_sdmmc.c
│ │ │ │ └── stm32f4xx_ll_usb.c
│ │ └── Users
│ │ │ ├── Include
│ │ │ ├── beep.h
│ │ │ ├── clicker.h
│ │ │ ├── leds.h
│ │ │ ├── sdcard.h
│ │ │ ├── segment.h
│ │ │ ├── spdt.h
│ │ │ ├── switch.h
│ │ │ └── user_drivers.h
│ │ │ └── Src
│ │ │ ├── beep.c
│ │ │ ├── clicker.c
│ │ │ ├── leds.c
│ │ │ ├── sdcard.c
│ │ │ ├── segment.c
│ │ │ ├── spdt.c
│ │ │ └── switch.c
│ ├── FATFS
│ │ ├── App
│ │ │ ├── fatfs.c
│ │ │ └── fatfs.h
│ │ └── Target
│ │ │ ├── bsp_driver_sd.c
│ │ │ ├── bsp_driver_sd.h
│ │ │ ├── ffconf.h
│ │ │ ├── sd_diskio.c
│ │ │ └── sd_diskio.h
│ ├── InfinityGauntlet.ioc
│ ├── Middlewares
│ │ ├── ST
│ │ │ └── STM32_USB_Device_Library
│ │ │ │ ├── Class
│ │ │ │ └── MSC
│ │ │ │ │ ├── Inc
│ │ │ │ │ ├── usbd_msc.h
│ │ │ │ │ ├── usbd_msc_bot.h
│ │ │ │ │ ├── usbd_msc_data.h
│ │ │ │ │ └── usbd_msc_scsi.h
│ │ │ │ │ └── Src
│ │ │ │ │ ├── usbd_msc.c
│ │ │ │ │ ├── usbd_msc_bot.c
│ │ │ │ │ ├── usbd_msc_data.c
│ │ │ │ │ └── usbd_msc_scsi.c
│ │ │ │ └── Core
│ │ │ │ ├── Inc
│ │ │ │ ├── usbd_core.h
│ │ │ │ ├── usbd_ctlreq.h
│ │ │ │ ├── usbd_def.h
│ │ │ │ └── usbd_ioreq.h
│ │ │ │ └── Src
│ │ │ │ ├── usbd_core.c
│ │ │ │ ├── usbd_ctlreq.c
│ │ │ │ └── usbd_ioreq.c
│ │ └── Third_Party
│ │ │ └── FatFs
│ │ │ └── src
│ │ │ ├── diskio.c
│ │ │ ├── diskio.h
│ │ │ ├── ff.c
│ │ │ ├── ff.h
│ │ │ ├── ff_gen_drv.c
│ │ │ ├── ff_gen_drv.h
│ │ │ ├── integer.h
│ │ │ └── option
│ │ │ ├── ccsbcs.c
│ │ │ └── syscall.c
│ ├── STM32F412CEUX_FLASH.ld
│ ├── STM32F412CEUX_RAM.ld
│ ├── USB_DEVICE
│ │ ├── App
│ │ │ ├── usb_device.c
│ │ │ ├── usb_device.h
│ │ │ ├── usbd_desc.c
│ │ │ ├── usbd_desc.h
│ │ │ ├── usbd_storage_if.c
│ │ │ └── usbd_storage_if.h
│ │ └── Target
│ │ │ ├── usbd_conf.c
│ │ │ └── usbd_conf.h
│ └── kernel
│ │ ├── inc
│ │ ├── os_api.h
│ │ ├── os_board.h
│ │ ├── os_comm.h
│ │ ├── os_config.h
│ │ └── os_task.h
│ │ └── src
│ │ ├── os_boad.c
│ │ ├── os_comm.c
│ │ ├── os_port.s
│ │ └── os_task.c
└── NOTE.txt
└── README.md
/Attacking_Board/Acrylic(optional).dwg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/Acrylic(optional).dwg
--------------------------------------------------------------------------------
/Attacking_Board/BOM_Attacking_Board_2023-03-23.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/BOM_Attacking_Board_2023-03-23.csv
--------------------------------------------------------------------------------
/Attacking_Board/Gerber_Attacking_Board.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/Gerber_Attacking_Board.zip
--------------------------------------------------------------------------------
/Attacking_Board/Model.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/Model.jpg
--------------------------------------------------------------------------------
/Attacking_Board/PCB.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/PCB.jpg
--------------------------------------------------------------------------------
/Attacking_Board/Shell(optional).jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Attacking_Board/Shell(optional).jpg
--------------------------------------------------------------------------------
/Auto_Clicker/BOM_Auto_Clicker.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Auto_Clicker/BOM_Auto_Clicker.csv
--------------------------------------------------------------------------------
/Auto_Clicker/Gerber_Auto_Clicker.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Auto_Clicker/Gerber_Auto_Clicker.zip
--------------------------------------------------------------------------------
/Auto_Clicker/Model.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Auto_Clicker/Model.jpg
--------------------------------------------------------------------------------
/Auto_Clicker/PCB.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Auto_Clicker/PCB.jpg
--------------------------------------------------------------------------------
/Auto_Clicker/Sucker.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Auto_Clicker/Sucker.jpg
--------------------------------------------------------------------------------
/FPC_Cable/BOM_FPC_Cable.csv:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/FPC_Cable/BOM_FPC_Cable.csv
--------------------------------------------------------------------------------
/FPC_Cable/Gerber_FPC_Cable.zip:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/FPC_Cable/Gerber_FPC_Cable.zip
--------------------------------------------------------------------------------
/FPC_Cable/PCB.jpg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/FPC_Cable/PCB.jpg
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Inc/checksum.h:
--------------------------------------------------------------------------------
1 | /*
2 | * checksum.h
3 | *
4 | * Created on: Feb 16, 2021
5 | * Author: chenyu
6 | */
7 |
8 | #ifndef INC_CHECKSUM_H_
9 | #define INC_CHECKSUM_H_
10 |
11 | unsigned short gf_crc_rawdata(unsigned char *param_1,unsigned short param_2);
12 | long long gf_checksum_rawdata(unsigned char *a1, int a2);
13 |
14 | #endif /* INC_CHECKSUM_H_ */
15 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Inc/main.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : main.h
5 | * @brief : Header for main.c file.
6 | * This file contains the common defines of the application.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | *
© Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under BSD 3-Clause license,
14 | * the "License"; You may not use this file except in compliance with the
15 | * License. You may obtain a copy of the License at:
16 | * opensource.org/licenses/BSD-3-Clause
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __MAIN_H
24 | #define __MAIN_H
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f4xx_hal.h"
32 |
33 | /* Private includes ----------------------------------------------------------*/
34 | /* USER CODE BEGIN Includes */
35 | #include "user_drivers.h"
36 | /* USER CODE END Includes */
37 |
38 | /* Exported types ------------------------------------------------------------*/
39 | /* USER CODE BEGIN ET */
40 |
41 | /* USER CODE END ET */
42 |
43 | /* Exported constants --------------------------------------------------------*/
44 | /* USER CODE BEGIN EC */
45 |
46 | /* USER CODE END EC */
47 |
48 | /* Exported macro ------------------------------------------------------------*/
49 | /* USER CODE BEGIN EM */
50 |
51 | /* USER CODE END EM */
52 |
53 | /* Exported functions prototypes ---------------------------------------------*/
54 | void Error_Handler(void);
55 |
56 | /* USER CODE BEGIN EFP */
57 |
58 | /* USER CODE END EFP */
59 |
60 | /* Private defines -----------------------------------------------------------*/
61 | /* USER CODE BEGIN Private defines */
62 |
63 | /* USER CODE END Private defines */
64 |
65 | #ifdef __cplusplus
66 | }
67 | #endif
68 |
69 | #endif /* __MAIN_H */
70 |
71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
72 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Inc/romimg.h:
--------------------------------------------------------------------------------
1 | /*
2 | * romimg.h
3 | *
4 | * Created on: Feb 16, 2021
5 | * Author: chenyu
6 | */
7 |
8 | #ifndef INC_ROMIMG_H_
9 | #define INC_ROMIMG_H_
10 |
11 | extern const unsigned char liveness_try0_part1[];
12 | extern const unsigned char liveness_try0_part2[];
13 | extern const unsigned char liveness_try0_part3[];
14 | extern const unsigned char liveness_try0_part4[];
15 |
16 | extern const unsigned char part1[];
17 | extern const unsigned char part2[];
18 | extern const unsigned char part3[];
19 | extern const unsigned char part4[];
20 | extern const unsigned char part5[];
21 | extern const unsigned char part6[];
22 | extern const unsigned char part7[];
23 | extern const unsigned char part8[];
24 | extern const unsigned char part9[];
25 | extern const unsigned char part10[];
26 | extern const unsigned char part11[];
27 | extern const unsigned char part12[];
28 | extern const unsigned char part13[];
29 |
30 | extern const unsigned char fpimg[86016];
31 | //extern const unsigned char fpimg_inv[86016];
32 | //extern const unsigned char fpimg2[86016];
33 | //extern const unsigned char fpimg_null[86016];
34 |
35 | #endif /* INC_ROMIMG_H_ */
36 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Inc/stm32f4xx_it.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32f4xx_it.h
5 | * @brief This file contains the headers of the interrupt handlers.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2021 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __STM32F4xx_IT_H
23 | #define __STM32F4xx_IT_H
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Private includes ----------------------------------------------------------*/
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | /* Exported types ------------------------------------------------------------*/
35 | /* USER CODE BEGIN ET */
36 |
37 | /* USER CODE END ET */
38 |
39 | /* Exported constants --------------------------------------------------------*/
40 | /* USER CODE BEGIN EC */
41 |
42 | /* USER CODE END EC */
43 |
44 | /* Exported macro ------------------------------------------------------------*/
45 | /* USER CODE BEGIN EM */
46 |
47 | /* USER CODE END EM */
48 |
49 | /* Exported functions prototypes ---------------------------------------------*/
50 | void NMI_Handler(void);
51 | void HardFault_Handler(void);
52 | void MemManage_Handler(void);
53 | void BusFault_Handler(void);
54 | void UsageFault_Handler(void);
55 | void SVC_Handler(void);
56 | void DebugMon_Handler(void);
57 | void PendSV_Handler(void);
58 | void SysTick_Handler(void);
59 | void TIM1_UP_TIM10_IRQHandler(void);
60 | void SPI1_IRQHandler(void);
61 | void SDIO_IRQHandler(void);
62 | void DMA2_Stream0_IRQHandler(void);
63 | void DMA2_Stream2_IRQHandler(void);
64 | void DMA2_Stream3_IRQHandler(void);
65 | void OTG_FS_IRQHandler(void);
66 | void DMA2_Stream6_IRQHandler(void);
67 | /* USER CODE BEGIN EFP */
68 |
69 | /* USER CODE END EFP */
70 |
71 | #ifdef __cplusplus
72 | }
73 | #endif
74 |
75 | #endif /* __STM32F4xx_IT_H */
76 |
77 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
78 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Src/stm32f4xx_hal_timebase_tim.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file stm32f4xx_hal_timebase_TIM.c
5 | * @brief HAL time base based on the hardware TIM.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2021 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Includes ------------------------------------------------------------------*/
22 | #include "stm32f4xx_hal.h"
23 | #include "stm32f4xx_hal_tim.h"
24 |
25 | /* Private typedef -----------------------------------------------------------*/
26 | /* Private define ------------------------------------------------------------*/
27 | /* Private macro -------------------------------------------------------------*/
28 | /* Private variables ---------------------------------------------------------*/
29 | TIM_HandleTypeDef htim1;
30 | /* Private function prototypes -----------------------------------------------*/
31 | /* Private functions ---------------------------------------------------------*/
32 |
33 | /**
34 | * @brief This function configures the TIM1 as a time base source.
35 | * The time source is configured to have 1ms time base with a dedicated
36 | * Tick interrupt priority.
37 | * @note This function is called automatically at the beginning of program after
38 | * reset by HAL_Init() or at any time when clock is configured, by HAL_RCC_ClockConfig().
39 | * @param TickPriority: Tick interrupt priority.
40 | * @retval HAL status
41 | */
42 | HAL_StatusTypeDef HAL_InitTick(uint32_t TickPriority)
43 | {
44 | RCC_ClkInitTypeDef clkconfig;
45 | uint32_t uwTimclock = 0;
46 | uint32_t uwPrescalerValue = 0;
47 | uint32_t pFLatency;
48 | /*Configure the TIM1 IRQ priority */
49 | HAL_NVIC_SetPriority(TIM1_UP_TIM10_IRQn, TickPriority ,0);
50 |
51 | /* Enable the TIM1 global Interrupt */
52 | HAL_NVIC_EnableIRQ(TIM1_UP_TIM10_IRQn);
53 |
54 | /* Enable TIM1 clock */
55 | __HAL_RCC_TIM1_CLK_ENABLE();
56 |
57 | /* Get clock configuration */
58 | HAL_RCC_GetClockConfig(&clkconfig, &pFLatency);
59 |
60 | /* Compute TIM1 clock */
61 | uwTimclock = HAL_RCC_GetPCLK2Freq();
62 | /* Compute the prescaler value to have TIM1 counter clock equal to 1MHz */
63 | uwPrescalerValue = (uint32_t) ((uwTimclock / 1000000U) - 1U);
64 |
65 | /* Initialize TIM1 */
66 | htim1.Instance = TIM1;
67 |
68 | /* Initialize TIMx peripheral as follow:
69 | + Period = [(TIM1CLK/1000) - 1]. to have a (1/1000) s time base.
70 | + Prescaler = (uwTimclock/1000000 - 1) to have a 1MHz counter clock.
71 | + ClockDivision = 0
72 | + Counter direction = Up
73 | */
74 | htim1.Init.Period = (1000000U / 1000U) - 1U;
75 | htim1.Init.Prescaler = uwPrescalerValue;
76 | htim1.Init.ClockDivision = 0;
77 | htim1.Init.CounterMode = TIM_COUNTERMODE_UP;
78 |
79 | if(HAL_TIM_Base_Init(&htim1) == HAL_OK)
80 | {
81 | /* Start the TIM time Base generation in interrupt mode */
82 | return HAL_TIM_Base_Start_IT(&htim1);
83 | }
84 |
85 | /* Return function status */
86 | return HAL_ERROR;
87 | }
88 |
89 | /**
90 | * @brief Suspend Tick increment.
91 | * @note Disable the tick increment by disabling TIM1 update interrupt.
92 | * @param None
93 | * @retval None
94 | */
95 | void HAL_SuspendTick(void)
96 | {
97 | /* Disable TIM1 update Interrupt */
98 | __HAL_TIM_DISABLE_IT(&htim1, TIM_IT_UPDATE);
99 | }
100 |
101 | /**
102 | * @brief Resume Tick increment.
103 | * @note Enable the tick increment by Enabling TIM1 update interrupt.
104 | * @param None
105 | * @retval None
106 | */
107 | void HAL_ResumeTick(void)
108 | {
109 | /* Enable TIM1 Update interrupt */
110 | __HAL_TIM_ENABLE_IT(&htim1, TIM_IT_UPDATE);
111 | }
112 |
113 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
114 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Src/syscalls.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file syscalls.c
4 | * @author Auto-generated by STM32CubeIDE
5 | * @brief STM32CubeIDE Minimal System calls file
6 | *
7 | * For more information about which c-functions
8 | * need which of these lowlevel functions
9 | * please consult the Newlib libc-manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * © Copyright (c) 2020 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software component is licensed by ST under BSD 3-Clause license,
17 | * the "License"; You may not use this file except in compliance with the
18 | * License. You may obtain a copy of the License at:
19 | * opensource.org/licenses/BSD-3-Clause
20 | *
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes */
25 | #include
26 | #include
27 | #include
28 | #include
29 | #include
30 | #include
31 | #include
32 | #include
33 |
34 |
35 | /* Variables */
36 | //#undef errno
37 | extern int errno;
38 | extern int __io_putchar(int ch) __attribute__((weak));
39 | extern int __io_getchar(void) __attribute__((weak));
40 |
41 | register char * stack_ptr asm("sp");
42 |
43 | char *__env[1] = { 0 };
44 | char **environ = __env;
45 |
46 |
47 | /* Functions */
48 | void initialise_monitor_handles()
49 | {
50 | }
51 |
52 | int _getpid(void)
53 | {
54 | return 1;
55 | }
56 |
57 | int _kill(int pid, int sig)
58 | {
59 | errno = EINVAL;
60 | return -1;
61 | }
62 |
63 | void _exit (int status)
64 | {
65 | _kill(status, -1);
66 | while (1) {} /* Make sure we hang here */
67 | }
68 |
69 | __attribute__((weak)) int _read(int file, char *ptr, int len)
70 | {
71 | int DataIdx;
72 |
73 | for (DataIdx = 0; DataIdx < len; DataIdx++)
74 | {
75 | *ptr++ = __io_getchar();
76 | }
77 |
78 | return len;
79 | }
80 |
81 | __attribute__((weak)) int _write(int file, char *ptr, int len)
82 | {
83 | int DataIdx;
84 |
85 | for (DataIdx = 0; DataIdx < len; DataIdx++)
86 | {
87 | __io_putchar(*ptr++);
88 | }
89 | return len;
90 | }
91 |
92 | int _close(int file)
93 | {
94 | return -1;
95 | }
96 |
97 |
98 | int _fstat(int file, struct stat *st)
99 | {
100 | st->st_mode = S_IFCHR;
101 | return 0;
102 | }
103 |
104 | int _isatty(int file)
105 | {
106 | return 1;
107 | }
108 |
109 | int _lseek(int file, int ptr, int dir)
110 | {
111 | return 0;
112 | }
113 |
114 | int _open(char *path, int flags, ...)
115 | {
116 | /* Pretend like we always fail */
117 | return -1;
118 | }
119 |
120 | int _wait(int *status)
121 | {
122 | errno = ECHILD;
123 | return -1;
124 | }
125 |
126 | int _unlink(char *name)
127 | {
128 | errno = ENOENT;
129 | return -1;
130 | }
131 |
132 | int _times(struct tms *buf)
133 | {
134 | return -1;
135 | }
136 |
137 | int _stat(char *file, struct stat *st)
138 | {
139 | st->st_mode = S_IFCHR;
140 | return 0;
141 | }
142 |
143 | int _link(char *old, char *new)
144 | {
145 | errno = EMLINK;
146 | return -1;
147 | }
148 |
149 | int _fork(void)
150 | {
151 | errno = EAGAIN;
152 | return -1;
153 | }
154 |
155 | int _execve(char *name, char **argv, char **env)
156 | {
157 | errno = ENOMEM;
158 | return -1;
159 | }
160 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Core/Src/sysmem.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file sysmem.c
4 | * @author Generated by STM32CubeIDE
5 | * @brief STM32CubeIDE System Memory calls file
6 | *
7 | * For more information about which C functions
8 | * need which of these lowlevel functions
9 | * please consult the newlib libc manual
10 | ******************************************************************************
11 | * @attention
12 | *
13 | * © Copyright (c) 2020 STMicroelectronics.
14 | * All rights reserved.
15 | *
16 | * This software component is licensed by ST under BSD 3-Clause license,
17 | * the "License"; You may not use this file except in compliance with the
18 | * License. You may obtain a copy of the License at:
19 | * opensource.org/licenses/BSD-3-Clause
20 | *
21 | ******************************************************************************
22 | */
23 |
24 | /* Includes */
25 | #include
26 | #include
27 |
28 | /**
29 | * Pointer to the current high watermark of the heap usage
30 | */
31 | static uint8_t *__sbrk_heap_end = NULL;
32 |
33 | /**
34 | * @brief _sbrk() allocates memory to the newlib heap and is used by malloc
35 | * and others from the C library
36 | *
37 | * @verbatim
38 | * ############################################################################
39 | * # .data # .bss # newlib heap # MSP stack #
40 | * # # # # Reserved by _Min_Stack_Size #
41 | * ############################################################################
42 | * ^-- RAM start ^-- _end _estack, RAM end --^
43 | * @endverbatim
44 | *
45 | * This implementation starts allocating at the '_end' linker symbol
46 | * The '_Min_Stack_Size' linker symbol reserves a memory for the MSP stack
47 | * The implementation considers '_estack' linker symbol to be RAM end
48 | * NOTE: If the MSP stack, at any point during execution, grows larger than the
49 | * reserved size, please increase the '_Min_Stack_Size'.
50 | *
51 | * @param incr Memory size
52 | * @return Pointer to allocated memory
53 | */
54 | void *_sbrk(ptrdiff_t incr)
55 | {
56 | extern uint8_t _end; /* Symbol defined in the linker script */
57 | extern uint8_t _estack; /* Symbol defined in the linker script */
58 | extern uint32_t _Min_Stack_Size; /* Symbol defined in the linker script */
59 | const uint32_t stack_limit = (uint32_t)&_estack - (uint32_t)&_Min_Stack_Size;
60 | const uint8_t *max_heap = (uint8_t *)stack_limit;
61 | uint8_t *prev_heap_end;
62 |
63 | /* Initialize heap end at first call */
64 | if (NULL == __sbrk_heap_end)
65 | {
66 | __sbrk_heap_end = &_end;
67 | }
68 |
69 | /* Protect heap from growing into the reserved MSP stack */
70 | if (__sbrk_heap_end + incr > max_heap)
71 | {
72 | errno = ENOMEM;
73 | return (void *)-1;
74 | }
75 |
76 | prev_heap_end = __sbrk_heap_end;
77 | __sbrk_heap_end += incr;
78 |
79 | return (void *)prev_heap_end;
80 | }
81 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Firmware/InfinityGauntlet/Drivers/CMSIS/Device/ST/STM32F4xx/Include/stm32f4xx.h
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/CMSIS/Device/ST/STM32F4xx/Include/system_stm32f4xx.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file system_stm32f4xx.h
4 | * @author MCD Application Team
5 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © COPYRIGHT(c) 2017 STMicroelectronics
10 | *
11 | * Redistribution and use in source and binary forms, with or without modification,
12 | * are permitted provided that the following conditions are met:
13 | * 1. Redistributions of source code must retain the above copyright notice,
14 | * this list of conditions and the following disclaimer.
15 | * 2. Redistributions in binary form must reproduce the above copyright notice,
16 | * this list of conditions and the following disclaimer in the documentation
17 | * and/or other materials provided with the distribution.
18 | * 3. Neither the name of STMicroelectronics nor the names of its contributors
19 | * may be used to endorse or promote products derived from this software
20 | * without specific prior written permission.
21 | *
22 | * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
23 | * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
24 | * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
25 | * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
26 | * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
27 | * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
28 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
29 | * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
30 | * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31 | * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 | *
33 | ******************************************************************************
34 | */
35 |
36 | /** @addtogroup CMSIS
37 | * @{
38 | */
39 |
40 | /** @addtogroup stm32f4xx_system
41 | * @{
42 | */
43 |
44 | /**
45 | * @brief Define to prevent recursive inclusion
46 | */
47 | #ifndef __SYSTEM_STM32F4XX_H
48 | #define __SYSTEM_STM32F4XX_H
49 |
50 | #ifdef __cplusplus
51 | extern "C" {
52 | #endif
53 |
54 | /** @addtogroup STM32F4xx_System_Includes
55 | * @{
56 | */
57 |
58 | /**
59 | * @}
60 | */
61 |
62 |
63 | /** @addtogroup STM32F4xx_System_Exported_types
64 | * @{
65 | */
66 | /* This variable is updated in three ways:
67 | 1) by calling CMSIS function SystemCoreClockUpdate()
68 | 2) by calling HAL API function HAL_RCC_GetSysClockFreq()
69 | 3) each time HAL_RCC_ClockConfig() is called to configure the system clock frequency
70 | Note: If you use this function to configure the system clock; then there
71 | is no need to call the 2 first functions listed above, since SystemCoreClock
72 | variable is updated automatically.
73 | */
74 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */
75 |
76 | extern const uint8_t AHBPrescTable[16]; /*!< AHB prescalers table values */
77 | extern const uint8_t APBPrescTable[8]; /*!< APB prescalers table values */
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 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/CMSIS/Include/cmsis_version.h:
--------------------------------------------------------------------------------
1 | /**************************************************************************//**
2 | * @file cmsis_version.h
3 | * @brief CMSIS Core(M) Version definitions
4 | * @version V5.0.2
5 | * @date 19. April 2017
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2009-2017 ARM Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef __CMSIS_VERSION_H
32 | #define __CMSIS_VERSION_H
33 |
34 | /* CMSIS Version definitions */
35 | #define __CM_CMSIS_VERSION_MAIN ( 5U) /*!< [31:16] CMSIS Core(M) main version */
36 | #define __CM_CMSIS_VERSION_SUB ( 1U) /*!< [15:0] CMSIS Core(M) sub version */
37 | #define __CM_CMSIS_VERSION ((__CM_CMSIS_VERSION_MAIN << 16U) | \
38 | __CM_CMSIS_VERSION_SUB ) /*!< CMSIS Core(M) version number */
39 | #endif
40 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/CMSIS/Include/tz_context.h:
--------------------------------------------------------------------------------
1 | /******************************************************************************
2 | * @file tz_context.h
3 | * @brief Context Management for Armv8-M TrustZone
4 | * @version V1.0.1
5 | * @date 10. January 2018
6 | ******************************************************************************/
7 | /*
8 | * Copyright (c) 2017-2018 Arm Limited. All rights reserved.
9 | *
10 | * SPDX-License-Identifier: Apache-2.0
11 | *
12 | * Licensed under the Apache License, Version 2.0 (the License); you may
13 | * not use this file except in compliance with the License.
14 | * You may obtain a copy of the License at
15 | *
16 | * www.apache.org/licenses/LICENSE-2.0
17 | *
18 | * Unless required by applicable law or agreed to in writing, software
19 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
20 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
21 | * See the License for the specific language governing permissions and
22 | * limitations under the License.
23 | */
24 |
25 | #if defined ( __ICCARM__ )
26 | #pragma system_include /* treat file as system include file for MISRA check */
27 | #elif defined (__clang__)
28 | #pragma clang system_header /* treat file as system include file */
29 | #endif
30 |
31 | #ifndef TZ_CONTEXT_H
32 | #define TZ_CONTEXT_H
33 |
34 | #include
35 |
36 | #ifndef TZ_MODULEID_T
37 | #define TZ_MODULEID_T
38 | /// \details Data type that identifies secure software modules called by a process.
39 | typedef uint32_t TZ_ModuleId_t;
40 | #endif
41 |
42 | /// \details TZ Memory ID identifies an allocated memory slot.
43 | typedef uint32_t TZ_MemoryId_t;
44 |
45 | /// Initialize secure context memory system
46 | /// \return execution status (1: success, 0: error)
47 | uint32_t TZ_InitContextSystem_S (void);
48 |
49 | /// Allocate context memory for calling secure software modules in TrustZone
50 | /// \param[in] module identifies software modules called from non-secure mode
51 | /// \return value != 0 id TrustZone memory slot identifier
52 | /// \return value 0 no memory available or internal error
53 | TZ_MemoryId_t TZ_AllocModuleContext_S (TZ_ModuleId_t module);
54 |
55 | /// Free context memory that was previously allocated with \ref TZ_AllocModuleContext_S
56 | /// \param[in] id TrustZone memory slot identifier
57 | /// \return execution status (1: success, 0: error)
58 | uint32_t TZ_FreeModuleContext_S (TZ_MemoryId_t id);
59 |
60 | /// Load secure context (called on RTOS thread context switch)
61 | /// \param[in] id TrustZone memory slot identifier
62 | /// \return execution status (1: success, 0: error)
63 | uint32_t TZ_LoadContext_S (TZ_MemoryId_t id);
64 |
65 | /// Store secure context (called on RTOS thread context switch)
66 | /// \param[in] id TrustZone memory slot identifier
67 | /// \return execution status (1: success, 0: error)
68 | uint32_t TZ_StoreContext_S (TZ_MemoryId_t id);
69 |
70 | #endif // TZ_CONTEXT_H
71 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/DSP/include/arm_common_tables.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Project: CMSIS DSP Library
3 | * Title: arm_common_tables.h
4 | * Description: Extern declaration for common tables
5 | *
6 | * $Date: 27. January 2017
7 | * $Revision: V.1.5.1
8 | *
9 | * Target Processor: Cortex-M cores
10 | * -------------------------------------------------------------------- */
11 | /*
12 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
13 | *
14 | * SPDX-License-Identifier: Apache-2.0
15 | *
16 | * Licensed under the Apache License, Version 2.0 (the License); you may
17 | * not use this file except in compliance with the License.
18 | * You may obtain a copy of the License at
19 | *
20 | * www.apache.org/licenses/LICENSE-2.0
21 | *
22 | * Unless required by applicable law or agreed to in writing, software
23 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
24 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
25 | * See the License for the specific language governing permissions and
26 | * limitations under the License.
27 | */
28 |
29 | #ifndef _ARM_COMMON_TABLES_H
30 | #define _ARM_COMMON_TABLES_H
31 |
32 | #include "arm_math.h"
33 |
34 | extern const uint16_t armBitRevTable[1024];
35 | extern const q15_t armRecipTableQ15[64];
36 | extern const q31_t armRecipTableQ31[64];
37 | extern const float32_t twiddleCoef_16[32];
38 | extern const float32_t twiddleCoef_32[64];
39 | extern const float32_t twiddleCoef_64[128];
40 | extern const float32_t twiddleCoef_128[256];
41 | extern const float32_t twiddleCoef_256[512];
42 | extern const float32_t twiddleCoef_512[1024];
43 | extern const float32_t twiddleCoef_1024[2048];
44 | extern const float32_t twiddleCoef_2048[4096];
45 | extern const float32_t twiddleCoef_4096[8192];
46 | #define twiddleCoef twiddleCoef_4096
47 | extern const q31_t twiddleCoef_16_q31[24];
48 | extern const q31_t twiddleCoef_32_q31[48];
49 | extern const q31_t twiddleCoef_64_q31[96];
50 | extern const q31_t twiddleCoef_128_q31[192];
51 | extern const q31_t twiddleCoef_256_q31[384];
52 | extern const q31_t twiddleCoef_512_q31[768];
53 | extern const q31_t twiddleCoef_1024_q31[1536];
54 | extern const q31_t twiddleCoef_2048_q31[3072];
55 | extern const q31_t twiddleCoef_4096_q31[6144];
56 | extern const q15_t twiddleCoef_16_q15[24];
57 | extern const q15_t twiddleCoef_32_q15[48];
58 | extern const q15_t twiddleCoef_64_q15[96];
59 | extern const q15_t twiddleCoef_128_q15[192];
60 | extern const q15_t twiddleCoef_256_q15[384];
61 | extern const q15_t twiddleCoef_512_q15[768];
62 | extern const q15_t twiddleCoef_1024_q15[1536];
63 | extern const q15_t twiddleCoef_2048_q15[3072];
64 | extern const q15_t twiddleCoef_4096_q15[6144];
65 | extern const float32_t twiddleCoef_rfft_32[32];
66 | extern const float32_t twiddleCoef_rfft_64[64];
67 | extern const float32_t twiddleCoef_rfft_128[128];
68 | extern const float32_t twiddleCoef_rfft_256[256];
69 | extern const float32_t twiddleCoef_rfft_512[512];
70 | extern const float32_t twiddleCoef_rfft_1024[1024];
71 | extern const float32_t twiddleCoef_rfft_2048[2048];
72 | extern const float32_t twiddleCoef_rfft_4096[4096];
73 |
74 | /* floating-point bit reversal tables */
75 | #define ARMBITREVINDEXTABLE_16_TABLE_LENGTH ((uint16_t)20)
76 | #define ARMBITREVINDEXTABLE_32_TABLE_LENGTH ((uint16_t)48)
77 | #define ARMBITREVINDEXTABLE_64_TABLE_LENGTH ((uint16_t)56)
78 | #define ARMBITREVINDEXTABLE_128_TABLE_LENGTH ((uint16_t)208)
79 | #define ARMBITREVINDEXTABLE_256_TABLE_LENGTH ((uint16_t)440)
80 | #define ARMBITREVINDEXTABLE_512_TABLE_LENGTH ((uint16_t)448)
81 | #define ARMBITREVINDEXTABLE_1024_TABLE_LENGTH ((uint16_t)1800)
82 | #define ARMBITREVINDEXTABLE_2048_TABLE_LENGTH ((uint16_t)3808)
83 | #define ARMBITREVINDEXTABLE_4096_TABLE_LENGTH ((uint16_t)4032)
84 |
85 | extern const uint16_t armBitRevIndexTable16[ARMBITREVINDEXTABLE_16_TABLE_LENGTH];
86 | extern const uint16_t armBitRevIndexTable32[ARMBITREVINDEXTABLE_32_TABLE_LENGTH];
87 | extern const uint16_t armBitRevIndexTable64[ARMBITREVINDEXTABLE_64_TABLE_LENGTH];
88 | extern const uint16_t armBitRevIndexTable128[ARMBITREVINDEXTABLE_128_TABLE_LENGTH];
89 | extern const uint16_t armBitRevIndexTable256[ARMBITREVINDEXTABLE_256_TABLE_LENGTH];
90 | extern const uint16_t armBitRevIndexTable512[ARMBITREVINDEXTABLE_512_TABLE_LENGTH];
91 | extern const uint16_t armBitRevIndexTable1024[ARMBITREVINDEXTABLE_1024_TABLE_LENGTH];
92 | extern const uint16_t armBitRevIndexTable2048[ARMBITREVINDEXTABLE_2048_TABLE_LENGTH];
93 | extern const uint16_t armBitRevIndexTable4096[ARMBITREVINDEXTABLE_4096_TABLE_LENGTH];
94 |
95 | /* fixed-point bit reversal tables */
96 | #define ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH ((uint16_t)12)
97 | #define ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH ((uint16_t)24)
98 | #define ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH ((uint16_t)56)
99 | #define ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH ((uint16_t)112)
100 | #define ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH ((uint16_t)240)
101 | #define ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH ((uint16_t)480)
102 | #define ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH ((uint16_t)992)
103 | #define ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH ((uint16_t)1984)
104 | #define ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH ((uint16_t)4032)
105 |
106 | extern const uint16_t armBitRevIndexTable_fixed_16[ARMBITREVINDEXTABLE_FIXED_16_TABLE_LENGTH];
107 | extern const uint16_t armBitRevIndexTable_fixed_32[ARMBITREVINDEXTABLE_FIXED_32_TABLE_LENGTH];
108 | extern const uint16_t armBitRevIndexTable_fixed_64[ARMBITREVINDEXTABLE_FIXED_64_TABLE_LENGTH];
109 | extern const uint16_t armBitRevIndexTable_fixed_128[ARMBITREVINDEXTABLE_FIXED_128_TABLE_LENGTH];
110 | extern const uint16_t armBitRevIndexTable_fixed_256[ARMBITREVINDEXTABLE_FIXED_256_TABLE_LENGTH];
111 | extern const uint16_t armBitRevIndexTable_fixed_512[ARMBITREVINDEXTABLE_FIXED_512_TABLE_LENGTH];
112 | extern const uint16_t armBitRevIndexTable_fixed_1024[ARMBITREVINDEXTABLE_FIXED_1024_TABLE_LENGTH];
113 | extern const uint16_t armBitRevIndexTable_fixed_2048[ARMBITREVINDEXTABLE_FIXED_2048_TABLE_LENGTH];
114 | extern const uint16_t armBitRevIndexTable_fixed_4096[ARMBITREVINDEXTABLE_FIXED_4096_TABLE_LENGTH];
115 |
116 | /* Tables for Fast Math Sine and Cosine */
117 | extern const float32_t sinTable_f32[FAST_MATH_TABLE_SIZE + 1];
118 | extern const q31_t sinTable_q31[FAST_MATH_TABLE_SIZE + 1];
119 | extern const q15_t sinTable_q15[FAST_MATH_TABLE_SIZE + 1];
120 |
121 | #endif /* ARM_COMMON_TABLES_H */
122 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/DSP/include/arm_const_structs.h:
--------------------------------------------------------------------------------
1 | /* ----------------------------------------------------------------------
2 | * Project: CMSIS DSP Library
3 | * Title: arm_const_structs.h
4 | * Description: Constant structs that are initialized for user convenience.
5 | * For example, some can be given as arguments to the arm_cfft_f32() function.
6 | *
7 | * $Date: 27. January 2017
8 | * $Revision: V.1.5.1
9 | *
10 | * Target Processor: Cortex-M cores
11 | * -------------------------------------------------------------------- */
12 | /*
13 | * Copyright (C) 2010-2017 ARM Limited or its affiliates. All rights reserved.
14 | *
15 | * SPDX-License-Identifier: Apache-2.0
16 | *
17 | * Licensed under the Apache License, Version 2.0 (the License); you may
18 | * not use this file except in compliance with the License.
19 | * You may obtain a copy of the License at
20 | *
21 | * www.apache.org/licenses/LICENSE-2.0
22 | *
23 | * Unless required by applicable law or agreed to in writing, software
24 | * distributed under the License is distributed on an AS IS BASIS, WITHOUT
25 | * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
26 | * See the License for the specific language governing permissions and
27 | * limitations under the License.
28 | */
29 |
30 | #ifndef _ARM_CONST_STRUCTS_H
31 | #define _ARM_CONST_STRUCTS_H
32 |
33 | #include "arm_math.h"
34 | #include "arm_common_tables.h"
35 |
36 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len16;
37 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len32;
38 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len64;
39 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len128;
40 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len256;
41 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len512;
42 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len1024;
43 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len2048;
44 | extern const arm_cfft_instance_f32 arm_cfft_sR_f32_len4096;
45 |
46 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len16;
47 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len32;
48 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len64;
49 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len128;
50 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len256;
51 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len512;
52 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len1024;
53 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len2048;
54 | extern const arm_cfft_instance_q31 arm_cfft_sR_q31_len4096;
55 |
56 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len16;
57 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len32;
58 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len64;
59 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len128;
60 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len256;
61 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len512;
62 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len1024;
63 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len2048;
64 | extern const arm_cfft_instance_q15 arm_cfft_sR_q15_len4096;
65 |
66 | #endif
67 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/DSP/libarm_cortexM4lf_math.a:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/alohachen/InfinityGauntlet/3b394ef4e1e7b3daf73e8206bb6dc4673882baeb/Firmware/InfinityGauntlet/Drivers/DSP/libarm_cortexM4lf_math.a
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_def.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_def.h
4 | * @author MCD Application Team
5 | * @brief This file contains HAL common defines, enumeration, macros and
6 | * structures definitions.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2017 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under BSD 3-Clause license,
14 | * the "License"; You may not use this file except in compliance with the
15 | * License. You may obtain a copy of the License at:
16 | * opensource.org/licenses/BSD-3-Clause
17 | *
18 | ******************************************************************************
19 | */
20 |
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __STM32F4xx_HAL_DEF
23 | #define __STM32F4xx_HAL_DEF
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "stm32f4xx.h"
31 | #include "Legacy/stm32_hal_legacy.h"
32 | #include
33 |
34 | /* Exported types ------------------------------------------------------------*/
35 |
36 | /**
37 | * @brief HAL Status structures definition
38 | */
39 | typedef enum
40 | {
41 | HAL_OK = 0x00U,
42 | HAL_ERROR = 0x01U,
43 | HAL_BUSY = 0x02U,
44 | HAL_TIMEOUT = 0x03U
45 | } HAL_StatusTypeDef;
46 |
47 | /**
48 | * @brief HAL Lock structures definition
49 | */
50 | typedef enum
51 | {
52 | HAL_UNLOCKED = 0x00U,
53 | HAL_LOCKED = 0x01U
54 | } HAL_LockTypeDef;
55 |
56 | /* Exported macro ------------------------------------------------------------*/
57 |
58 | #define UNUSED(X) (void)X /* To avoid gcc/g++ warnings */
59 |
60 | #define HAL_MAX_DELAY 0xFFFFFFFFU
61 |
62 | #define HAL_IS_BIT_SET(REG, BIT) (((REG) & (BIT)) == (BIT))
63 | #define HAL_IS_BIT_CLR(REG, BIT) (((REG) & (BIT)) == 0U)
64 |
65 | #define __HAL_LINKDMA(__HANDLE__, __PPP_DMA_FIELD__, __DMA_HANDLE__) \
66 | do{ \
67 | (__HANDLE__)->__PPP_DMA_FIELD__ = &(__DMA_HANDLE__); \
68 | (__DMA_HANDLE__).Parent = (__HANDLE__); \
69 | } while(0U)
70 |
71 | /** @brief Reset the Handle's State field.
72 | * @param __HANDLE__ specifies the Peripheral Handle.
73 | * @note This macro can be used for the following purpose:
74 | * - When the Handle is declared as local variable; before passing it as parameter
75 | * to HAL_PPP_Init() for the first time, it is mandatory to use this macro
76 | * to set to 0 the Handle's "State" field.
77 | * Otherwise, "State" field may have any random value and the first time the function
78 | * HAL_PPP_Init() is called, the low level hardware initialization will be missed
79 | * (i.e. HAL_PPP_MspInit() will not be executed).
80 | * - When there is a need to reconfigure the low level hardware: instead of calling
81 | * HAL_PPP_DeInit() then HAL_PPP_Init(), user can make a call to this macro then HAL_PPP_Init().
82 | * In this later function, when the Handle's "State" field is set to 0, it will execute the function
83 | * HAL_PPP_MspInit() which will reconfigure the low level hardware.
84 | * @retval None
85 | */
86 | #define __HAL_RESET_HANDLE_STATE(__HANDLE__) ((__HANDLE__)->State = 0U)
87 |
88 | #if (USE_RTOS == 1U)
89 | /* Reserved for future use */
90 | #error "USE_RTOS should be 0 in the current HAL release"
91 | #else
92 | #define __HAL_LOCK(__HANDLE__) \
93 | do{ \
94 | if((__HANDLE__)->Lock == HAL_LOCKED) \
95 | { \
96 | return HAL_BUSY; \
97 | } \
98 | else \
99 | { \
100 | (__HANDLE__)->Lock = HAL_LOCKED; \
101 | } \
102 | }while (0U)
103 |
104 | #define __HAL_UNLOCK(__HANDLE__) \
105 | do{ \
106 | (__HANDLE__)->Lock = HAL_UNLOCKED; \
107 | }while (0U)
108 | #endif /* USE_RTOS */
109 |
110 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
111 | #ifndef __weak
112 | #define __weak __attribute__((weak))
113 | #endif
114 | #ifndef __packed
115 | #define __packed __attribute__((packed))
116 | #endif
117 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
118 | #ifndef __weak
119 | #define __weak __attribute__((weak))
120 | #endif /* __weak */
121 | #ifndef __packed
122 | #define __packed __attribute__((__packed__))
123 | #endif /* __packed */
124 | #endif /* __GNUC__ */
125 |
126 |
127 | /* Macro to get variable aligned on 4-bytes, for __ICCARM__ the directive "#pragma data_alignment=4" must be used instead */
128 | #if defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050) /* ARM Compiler V6 */
129 | #ifndef __ALIGN_BEGIN
130 | #define __ALIGN_BEGIN
131 | #endif
132 | #ifndef __ALIGN_END
133 | #define __ALIGN_END __attribute__ ((aligned (4)))
134 | #endif
135 | #elif defined ( __GNUC__ ) && !defined (__CC_ARM) /* GNU Compiler */
136 | #ifndef __ALIGN_END
137 | #define __ALIGN_END __attribute__ ((aligned (4)))
138 | #endif /* __ALIGN_END */
139 | #ifndef __ALIGN_BEGIN
140 | #define __ALIGN_BEGIN
141 | #endif /* __ALIGN_BEGIN */
142 | #else
143 | #ifndef __ALIGN_END
144 | #define __ALIGN_END
145 | #endif /* __ALIGN_END */
146 | #ifndef __ALIGN_BEGIN
147 | #if defined (__CC_ARM) /* ARM Compiler V5*/
148 | #define __ALIGN_BEGIN __align(4)
149 | #elif defined (__ICCARM__) /* IAR Compiler */
150 | #define __ALIGN_BEGIN
151 | #endif /* __CC_ARM */
152 | #endif /* __ALIGN_BEGIN */
153 | #endif /* __GNUC__ */
154 |
155 |
156 | /**
157 | * @brief __RAM_FUNC definition
158 | */
159 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
160 | /* ARM Compiler V4/V5 and V6
161 | --------------------------
162 | RAM functions are defined using the toolchain options.
163 | Functions that are executed in RAM should reside in a separate source module.
164 | Using the 'Options for File' dialog you can simply change the 'Code / Const'
165 | area of a module to a memory space in physical RAM.
166 | Available memory areas are declared in the 'Target' tab of the 'Options for Target'
167 | dialog.
168 | */
169 | #define __RAM_FUNC
170 |
171 | #elif defined ( __ICCARM__ )
172 | /* ICCARM Compiler
173 | ---------------
174 | RAM functions are defined using a specific toolchain keyword "__ramfunc".
175 | */
176 | #define __RAM_FUNC __ramfunc
177 |
178 | #elif defined ( __GNUC__ )
179 | /* GNU Compiler
180 | ------------
181 | RAM functions are defined using a specific toolchain attribute
182 | "__attribute__((section(".RamFunc")))".
183 | */
184 | #define __RAM_FUNC __attribute__((section(".RamFunc")))
185 |
186 | #endif
187 |
188 | /**
189 | * @brief __NOINLINE definition
190 | */
191 | #if defined ( __CC_ARM ) || (defined (__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)) || defined ( __GNUC__ )
192 | /* ARM V4/V5 and V6 & GNU Compiler
193 | -------------------------------
194 | */
195 | #define __NOINLINE __attribute__ ( (noinline) )
196 |
197 | #elif defined ( __ICCARM__ )
198 | /* ICCARM Compiler
199 | ---------------
200 | */
201 | #define __NOINLINE _Pragma("optimize = no_inline")
202 |
203 | #endif
204 |
205 | #ifdef __cplusplus
206 | }
207 | #endif
208 |
209 | #endif /* ___STM32F4xx_HAL_DEF */
210 |
211 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
212 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/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 | * @brief Header file of DMA HAL extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4xx_HAL_DMA_EX_H
22 | #define __STM32F4xx_HAL_DMA_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal_def.h"
30 |
31 | /** @addtogroup STM32F4xx_HAL_Driver
32 | * @{
33 | */
34 |
35 | /** @addtogroup DMAEx
36 | * @{
37 | */
38 |
39 | /* Exported types ------------------------------------------------------------*/
40 | /** @defgroup DMAEx_Exported_Types DMAEx Exported Types
41 | * @brief DMAEx Exported types
42 | * @{
43 | */
44 |
45 | /**
46 | * @brief HAL DMA Memory definition
47 | */
48 | typedef enum
49 | {
50 | MEMORY0 = 0x00U, /*!< Memory 0 */
51 | MEMORY1 = 0x01U /*!< Memory 1 */
52 | }HAL_DMA_MemoryTypeDef;
53 |
54 | /**
55 | * @}
56 | */
57 |
58 | /* Exported functions --------------------------------------------------------*/
59 | /** @defgroup DMAEx_Exported_Functions DMAEx Exported Functions
60 | * @brief DMAEx Exported functions
61 | * @{
62 | */
63 |
64 | /** @defgroup DMAEx_Exported_Functions_Group1 Extended features functions
65 | * @brief Extended features functions
66 | * @{
67 | */
68 |
69 | /* IO operation functions *******************************************************/
70 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
71 | HAL_StatusTypeDef HAL_DMAEx_MultiBufferStart_IT(DMA_HandleTypeDef *hdma, uint32_t SrcAddress, uint32_t DstAddress, uint32_t SecondMemAddress, uint32_t DataLength);
72 | HAL_StatusTypeDef HAL_DMAEx_ChangeMemory(DMA_HandleTypeDef *hdma, uint32_t Address, HAL_DMA_MemoryTypeDef memory);
73 |
74 | /**
75 | * @}
76 | */
77 | /**
78 | * @}
79 | */
80 |
81 | /* Private functions ---------------------------------------------------------*/
82 | /** @defgroup DMAEx_Private_Functions DMAEx Private Functions
83 | * @brief DMAEx Private functions
84 | * @{
85 | */
86 | /**
87 | * @}
88 | */
89 |
90 | /**
91 | * @}
92 | */
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | #ifdef __cplusplus
99 | }
100 | #endif
101 |
102 | #endif /*__STM32F4xx_HAL_DMA_EX_H*/
103 |
104 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
105 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/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 | * @brief Header file of FLASH RAMFUNC driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2017 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4xx_FLASH_RAMFUNC_H
22 | #define __STM32F4xx_FLASH_RAMFUNC_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) ||\
28 | defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx)
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f4xx_hal_def.h"
32 |
33 | /** @addtogroup STM32F4xx_HAL_Driver
34 | * @{
35 | */
36 |
37 | /** @addtogroup FLASH_RAMFUNC
38 | * @{
39 | */
40 |
41 | /* Exported types ------------------------------------------------------------*/
42 | /* Exported macro ------------------------------------------------------------*/
43 | /* Exported functions --------------------------------------------------------*/
44 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions
45 | * @{
46 | */
47 |
48 | /** @addtogroup FLASH_RAMFUNC_Exported_Functions_Group1
49 | * @{
50 | */
51 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void);
52 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void);
53 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void);
54 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void);
55 | /**
56 | * @}
57 | */
58 |
59 | /**
60 | * @}
61 | */
62 |
63 | /**
64 | * @}
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
72 | #ifdef __cplusplus
73 | }
74 | #endif
75 |
76 |
77 | #endif /* __STM32F4xx_FLASH_RAMFUNC_H */
78 |
79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
80 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_i2c_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_i2c_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of I2C HAL Extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2016 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4xx_HAL_I2C_EX_H
22 | #define __STM32F4xx_HAL_I2C_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | #if defined(I2C_FLTR_ANOFF)&&defined(I2C_FLTR_DNF)
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "stm32f4xx_hal_def.h"
31 |
32 | /** @addtogroup STM32F4xx_HAL_Driver
33 | * @{
34 | */
35 |
36 | /** @addtogroup I2CEx
37 | * @{
38 | */
39 |
40 | /* Exported types ------------------------------------------------------------*/
41 | /* Exported constants --------------------------------------------------------*/
42 | /** @defgroup I2CEx_Exported_Constants I2C Exported Constants
43 | * @{
44 | */
45 |
46 | /** @defgroup I2CEx_Analog_Filter I2C Analog Filter
47 | * @{
48 | */
49 | #define I2C_ANALOGFILTER_ENABLE 0x00000000U
50 | #define I2C_ANALOGFILTER_DISABLE I2C_FLTR_ANOFF
51 | /**
52 | * @}
53 | */
54 |
55 | /**
56 | * @}
57 | */
58 |
59 | /* Exported macro ------------------------------------------------------------*/
60 | /* Exported functions --------------------------------------------------------*/
61 | /** @addtogroup I2CEx_Exported_Functions
62 | * @{
63 | */
64 |
65 | /** @addtogroup I2CEx_Exported_Functions_Group1
66 | * @{
67 | */
68 | /* Peripheral Control functions ************************************************/
69 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter);
70 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter);
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 | /* Private types -------------------------------------------------------------*/
79 | /* Private variables ---------------------------------------------------------*/
80 | /* Private constants ---------------------------------------------------------*/
81 | /** @defgroup I2CEx_Private_Constants I2C Private Constants
82 | * @{
83 | */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /* Private macros ------------------------------------------------------------*/
90 | /** @defgroup I2CEx_Private_Macros I2C Private Macros
91 | * @{
92 | */
93 | #define IS_I2C_ANALOG_FILTER(FILTER) (((FILTER) == I2C_ANALOGFILTER_ENABLE) || \
94 | ((FILTER) == I2C_ANALOGFILTER_DISABLE))
95 | #define IS_I2C_DIGITAL_FILTER(FILTER) ((FILTER) <= 0x0000000FU)
96 | /**
97 | * @}
98 | */
99 |
100 | /**
101 | * @}
102 | */
103 |
104 | /**
105 | * @}
106 | */
107 |
108 | #endif
109 |
110 | #ifdef __cplusplus
111 | }
112 | #endif
113 |
114 | #endif /* __STM32F4xx_HAL_I2C_EX_H */
115 |
116 |
117 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
118 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/STM32F4xx_HAL_Driver/Inc/stm32f4xx_hal_pcd_ex.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_pcd_ex.h
4 | * @author MCD Application Team
5 | * @brief Header file of PCD HAL Extension module.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2016 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under BSD 3-Clause license,
13 | * the "License"; You may not use this file except in compliance with the
14 | * License. You may obtain a copy of the License at:
15 | * opensource.org/licenses/BSD-3-Clause
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef STM32F4xx_HAL_PCD_EX_H
22 | #define STM32F4xx_HAL_PCD_EX_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal_def.h"
30 |
31 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
32 | /** @addtogroup STM32F4xx_HAL_Driver
33 | * @{
34 | */
35 |
36 | /** @addtogroup PCDEx
37 | * @{
38 | */
39 | /* Exported types ------------------------------------------------------------*/
40 | /* Exported constants --------------------------------------------------------*/
41 | /* Exported macros -----------------------------------------------------------*/
42 | /* Exported functions --------------------------------------------------------*/
43 | /** @addtogroup PCDEx_Exported_Functions PCDEx Exported Functions
44 | * @{
45 | */
46 | /** @addtogroup PCDEx_Exported_Functions_Group1 Peripheral Control functions
47 | * @{
48 | */
49 |
50 | #if defined (USB_OTG_FS) || defined (USB_OTG_HS)
51 | HAL_StatusTypeDef HAL_PCDEx_SetTxFiFo(PCD_HandleTypeDef *hpcd, uint8_t fifo, uint16_t size);
52 | HAL_StatusTypeDef HAL_PCDEx_SetRxFiFo(PCD_HandleTypeDef *hpcd, uint16_t size);
53 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
54 |
55 | #if defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
56 | HAL_StatusTypeDef HAL_PCDEx_ActivateLPM(PCD_HandleTypeDef *hpcd);
57 | HAL_StatusTypeDef HAL_PCDEx_DeActivateLPM(PCD_HandleTypeDef *hpcd);
58 | #endif /* defined(STM32F446xx) || defined(STM32F469xx) || defined(STM32F479xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
59 | #if defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx)
60 | HAL_StatusTypeDef HAL_PCDEx_ActivateBCD(PCD_HandleTypeDef *hpcd);
61 | HAL_StatusTypeDef HAL_PCDEx_DeActivateBCD(PCD_HandleTypeDef *hpcd);
62 | void HAL_PCDEx_BCD_VBUSDetect(PCD_HandleTypeDef *hpcd);
63 | #endif /* defined(STM32F412Zx) || defined(STM32F412Vx) || defined(STM32F412Rx) || defined(STM32F412Cx) || defined(STM32F413xx) || defined(STM32F423xx) */
64 | void HAL_PCDEx_LPM_Callback(PCD_HandleTypeDef *hpcd, PCD_LPM_MsgTypeDef msg);
65 | void HAL_PCDEx_BCD_Callback(PCD_HandleTypeDef *hpcd, PCD_BCD_MsgTypeDef msg);
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /**
72 | * @}
73 | */
74 |
75 | /**
76 | * @}
77 | */
78 |
79 | /**
80 | * @}
81 | */
82 | #endif /* defined (USB_OTG_FS) || defined (USB_OTG_HS) */
83 |
84 | #ifdef __cplusplus
85 | }
86 | #endif
87 |
88 |
89 | #endif /* STM32F4xx_HAL_PCD_EX_H */
90 |
91 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
92 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/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 | * @brief FLASH RAMFUNC module driver.
6 | * This file provides a FLASH firmware functions which should be
7 | * executed from internal SRAM
8 | * + Stop/Start the flash interface while System Run
9 | * + Enable/Disable the flash sleep while System Run
10 | @verbatim
11 | ==============================================================================
12 | ##### APIs executed from Internal RAM #####
13 | ==============================================================================
14 | [..]
15 | *** ARM Compiler ***
16 | --------------------
17 | [..] RAM functions are defined using the toolchain options.
18 | Functions that are be executed in RAM should reside in a separate
19 | source module. Using the 'Options for File' dialog you can simply change
20 | the 'Code / Const' area of a module to a memory space in physical RAM.
21 | Available memory areas are declared in the 'Target' tab of the
22 | Options for Target' dialog.
23 |
24 | *** ICCARM Compiler ***
25 | -----------------------
26 | [..] RAM functions are defined using a specific toolchain keyword "__ramfunc".
27 |
28 | *** GNU Compiler ***
29 | --------------------
30 | [..] RAM functions are defined using a specific toolchain attribute
31 | "__attribute__((section(".RamFunc")))".
32 |
33 | @endverbatim
34 | ******************************************************************************
35 | * @attention
36 | *
37 | * © Copyright (c) 2017 STMicroelectronics.
38 | * All rights reserved.
39 | *
40 | * This software component is licensed by ST under BSD 3-Clause license,
41 | * the "License"; You may not use this file except in compliance with the
42 | * License. You may obtain a copy of the License at:
43 | * opensource.org/licenses/BSD-3-Clause
44 | *
45 | ******************************************************************************
46 | */
47 |
48 | /* Includes ------------------------------------------------------------------*/
49 | #include "stm32f4xx_hal.h"
50 |
51 | /** @addtogroup STM32F4xx_HAL_Driver
52 | * @{
53 | */
54 |
55 | /** @defgroup FLASH_RAMFUNC FLASH RAMFUNC
56 | * @brief FLASH functions executed from RAM
57 | * @{
58 | */
59 | #ifdef HAL_FLASH_MODULE_ENABLED
60 | #if defined(STM32F410Tx) || defined(STM32F410Cx) || defined(STM32F410Rx) || defined(STM32F411xE) || defined(STM32F446xx) || defined(STM32F412Zx) || defined(STM32F412Vx) || \
61 | defined(STM32F412Rx) || defined(STM32F412Cx)
62 |
63 | /* Private typedef -----------------------------------------------------------*/
64 | /* Private define ------------------------------------------------------------*/
65 | /* Private macro -------------------------------------------------------------*/
66 | /* Private variables ---------------------------------------------------------*/
67 | /* Private function prototypes -----------------------------------------------*/
68 | /* Exported functions --------------------------------------------------------*/
69 | /** @defgroup FLASH_RAMFUNC_Exported_Functions FLASH RAMFUNC Exported Functions
70 | * @{
71 | */
72 |
73 | /** @defgroup FLASH_RAMFUNC_Exported_Functions_Group1 Peripheral features functions executed from internal RAM
74 | * @brief Peripheral Extended features functions
75 | *
76 | @verbatim
77 |
78 | ===============================================================================
79 | ##### ramfunc functions #####
80 | ===============================================================================
81 | [..]
82 | This subsection provides a set of functions that should be executed from RAM
83 | transfers.
84 |
85 | @endverbatim
86 | * @{
87 | */
88 |
89 | /**
90 | * @brief Stop the flash interface while System Run
91 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
92 | * @note This mode couldn't be set while executing with the flash itself.
93 | * It should be done with specific routine executed from RAM.
94 | * @retval HAL status
95 | */
96 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StopFlashInterfaceClk(void)
97 | {
98 | /* Enable Power ctrl clock */
99 | __HAL_RCC_PWR_CLK_ENABLE();
100 | /* Stop the flash interface while System Run */
101 | SET_BIT(PWR->CR, PWR_CR_FISSR);
102 |
103 | return HAL_OK;
104 | }
105 |
106 | /**
107 | * @brief Start the flash interface while System Run
108 | * @note This mode is only available for STM32F411xx/STM32F446xx devices.
109 | * @note This mode couldn't be set while executing with the flash itself.
110 | * It should be done with specific routine executed from RAM.
111 | * @retval HAL status
112 | */
113 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_StartFlashInterfaceClk(void)
114 | {
115 | /* Enable Power ctrl clock */
116 | __HAL_RCC_PWR_CLK_ENABLE();
117 | /* Start the flash interface while System Run */
118 | CLEAR_BIT(PWR->CR, PWR_CR_FISSR);
119 |
120 | return HAL_OK;
121 | }
122 |
123 | /**
124 | * @brief Enable the flash sleep while System Run
125 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
126 | * @note This mode could n't be set while executing with the flash itself.
127 | * It should be done with specific routine executed from RAM.
128 | * @retval HAL status
129 | */
130 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_EnableFlashSleepMode(void)
131 | {
132 | /* Enable Power ctrl clock */
133 | __HAL_RCC_PWR_CLK_ENABLE();
134 | /* Enable the flash sleep while System Run */
135 | SET_BIT(PWR->CR, PWR_CR_FMSSR);
136 |
137 | return HAL_OK;
138 | }
139 |
140 | /**
141 | * @brief Disable the flash sleep while System Run
142 | * @note This mode is only available for STM32F41xxx/STM32F446xx devices.
143 | * @note This mode couldn't be set while executing with the flash itself.
144 | * It should be done with specific routine executed from RAM.
145 | * @retval HAL status
146 | */
147 | __RAM_FUNC HAL_StatusTypeDef HAL_FLASHEx_DisableFlashSleepMode(void)
148 | {
149 | /* Enable Power ctrl clock */
150 | __HAL_RCC_PWR_CLK_ENABLE();
151 | /* Disable the flash sleep while System Run */
152 | CLEAR_BIT(PWR->CR, PWR_CR_FMSSR);
153 |
154 | return HAL_OK;
155 | }
156 |
157 | /**
158 | * @}
159 | */
160 |
161 | /**
162 | * @}
163 | */
164 |
165 | #endif /* STM32F410xx || STM32F411xE || STM32F446xx || STM32F412Zx || STM32F412Vx || STM32F412Rx || STM32F412Cx */
166 | #endif /* HAL_FLASH_MODULE_ENABLED */
167 | /**
168 | * @}
169 | */
170 |
171 | /**
172 | * @}
173 | */
174 |
175 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
176 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/STM32F4xx_HAL_Driver/Src/stm32f4xx_hal_i2c_ex.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file stm32f4xx_hal_i2c_ex.c
4 | * @author MCD Application Team
5 | * @brief I2C Extension HAL module driver.
6 | * This file provides firmware functions to manage the following
7 | * functionalities of I2C extension peripheral:
8 | * + Extension features functions
9 | *
10 | @verbatim
11 | ==============================================================================
12 | ##### I2C peripheral extension features #####
13 | ==============================================================================
14 |
15 | [..] Comparing to other previous devices, the I2C interface for STM32F427xx/437xx/
16 | 429xx/439xx devices contains the following additional features :
17 |
18 | (+) Possibility to disable or enable Analog Noise Filter
19 | (+) Use of a configured Digital Noise Filter
20 |
21 | ##### How to use this driver #####
22 | ==============================================================================
23 | [..] This driver provides functions to configure Noise Filter
24 | (#) Configure I2C Analog noise filter using the function HAL_I2C_AnalogFilter_Config()
25 | (#) Configure I2C Digital noise filter using the function HAL_I2C_DigitalFilter_Config()
26 |
27 | @endverbatim
28 | ******************************************************************************
29 | * @attention
30 | *
31 | * © Copyright (c) 2016 STMicroelectronics.
32 | * All rights reserved.
33 | *
34 | * This software component is licensed by ST under BSD 3-Clause license,
35 | * the "License"; You may not use this file except in compliance with the
36 | * License. You may obtain a copy of the License at:
37 | * opensource.org/licenses/BSD-3-Clause
38 | *
39 | ******************************************************************************
40 | */
41 |
42 | /* Includes ------------------------------------------------------------------*/
43 | #include "stm32f4xx_hal.h"
44 |
45 | /** @addtogroup STM32F4xx_HAL_Driver
46 | * @{
47 | */
48 |
49 | /** @defgroup I2CEx I2CEx
50 | * @brief I2C HAL module driver
51 | * @{
52 | */
53 |
54 | #ifdef HAL_I2C_MODULE_ENABLED
55 |
56 | #if defined(I2C_FLTR_ANOFF)&&defined(I2C_FLTR_DNF)
57 | /* Private typedef -----------------------------------------------------------*/
58 | /* Private define ------------------------------------------------------------*/
59 | /* Private macro -------------------------------------------------------------*/
60 | /* Private variables ---------------------------------------------------------*/
61 | /* Private function prototypes -----------------------------------------------*/
62 | /* Exported functions --------------------------------------------------------*/
63 | /** @defgroup I2CEx_Exported_Functions I2C Exported Functions
64 | * @{
65 | */
66 |
67 |
68 | /** @defgroup I2CEx_Exported_Functions_Group1 Extension features functions
69 | * @brief Extension features functions
70 | *
71 | @verbatim
72 | ===============================================================================
73 | ##### Extension features functions #####
74 | ===============================================================================
75 | [..] This section provides functions allowing to:
76 | (+) Configure Noise Filters
77 |
78 | @endverbatim
79 | * @{
80 | */
81 |
82 | /**
83 | * @brief Configures I2C Analog noise filter.
84 | * @param hi2c pointer to a I2C_HandleTypeDef structure that contains
85 | * the configuration information for the specified I2Cx peripheral.
86 | * @param AnalogFilter new state of the Analog filter.
87 | * @retval HAL status
88 | */
89 | HAL_StatusTypeDef HAL_I2CEx_ConfigAnalogFilter(I2C_HandleTypeDef *hi2c, uint32_t AnalogFilter)
90 | {
91 | /* Check the parameters */
92 | assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
93 | assert_param(IS_I2C_ANALOG_FILTER(AnalogFilter));
94 |
95 | if (hi2c->State == HAL_I2C_STATE_READY)
96 | {
97 | hi2c->State = HAL_I2C_STATE_BUSY;
98 |
99 | /* Disable the selected I2C peripheral */
100 | __HAL_I2C_DISABLE(hi2c);
101 |
102 | /* Reset I2Cx ANOFF bit */
103 | hi2c->Instance->FLTR &= ~(I2C_FLTR_ANOFF);
104 |
105 | /* Disable the analog filter */
106 | hi2c->Instance->FLTR |= AnalogFilter;
107 |
108 | __HAL_I2C_ENABLE(hi2c);
109 |
110 | hi2c->State = HAL_I2C_STATE_READY;
111 |
112 | return HAL_OK;
113 | }
114 | else
115 | {
116 | return HAL_BUSY;
117 | }
118 | }
119 |
120 | /**
121 | * @brief Configures I2C Digital noise filter.
122 | * @param hi2c pointer to a I2C_HandleTypeDef structure that contains
123 | * the configuration information for the specified I2Cx peripheral.
124 | * @param DigitalFilter Coefficient of digital noise filter between 0x00 and 0x0F.
125 | * @retval HAL status
126 | */
127 | HAL_StatusTypeDef HAL_I2CEx_ConfigDigitalFilter(I2C_HandleTypeDef *hi2c, uint32_t DigitalFilter)
128 | {
129 | uint16_t tmpreg = 0;
130 |
131 | /* Check the parameters */
132 | assert_param(IS_I2C_ALL_INSTANCE(hi2c->Instance));
133 | assert_param(IS_I2C_DIGITAL_FILTER(DigitalFilter));
134 |
135 | if (hi2c->State == HAL_I2C_STATE_READY)
136 | {
137 | hi2c->State = HAL_I2C_STATE_BUSY;
138 |
139 | /* Disable the selected I2C peripheral */
140 | __HAL_I2C_DISABLE(hi2c);
141 |
142 | /* Get the old register value */
143 | tmpreg = hi2c->Instance->FLTR;
144 |
145 | /* Reset I2Cx DNF bit [3:0] */
146 | tmpreg &= ~(I2C_FLTR_DNF);
147 |
148 | /* Set I2Cx DNF coefficient */
149 | tmpreg |= DigitalFilter;
150 |
151 | /* Store the new register value */
152 | hi2c->Instance->FLTR = tmpreg;
153 |
154 | __HAL_I2C_ENABLE(hi2c);
155 |
156 | hi2c->State = HAL_I2C_STATE_READY;
157 |
158 | return HAL_OK;
159 | }
160 | else
161 | {
162 | return HAL_BUSY;
163 | }
164 | }
165 |
166 | /**
167 | * @}
168 | */
169 |
170 | /**
171 | * @}
172 | */
173 | #endif
174 |
175 | #endif /* HAL_I2C_MODULE_ENABLED */
176 | /**
177 | * @}
178 | */
179 |
180 | /**
181 | * @}
182 | */
183 |
184 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
185 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/beep.h:
--------------------------------------------------------------------------------
1 | /*
2 | * beep.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_BEEP_H_
9 | #define USERS_INCLUDE_BEEP_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | void Beep_On(void);
14 | void Beep_Off(void);
15 |
16 | #endif /* USERS_INCLUDE_BEEP_H_ */
17 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/clicker.h:
--------------------------------------------------------------------------------
1 | /*
2 | * clicker.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_CLICKER_H_
9 | #define USERS_INCLUDE_CLICKER_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | void Clicker_Press(void);
14 | void Clicker_Release(void);
15 |
16 | #endif /* USERS_INCLUDE_CLICKER_H_ */
17 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/leds.h:
--------------------------------------------------------------------------------
1 | /*
2 | * leds.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_LEDS_H_
9 | #define USERS_INCLUDE_LEDS_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 |
14 | #define EYE_LED GPIO_PIN_13 /* EYE LED selected */
15 | #define STATE_LED GPIO_PIN_8 /* STATE LED selected */
16 | #define ALL_LED (GPIO_PIN_13|GPIO_PIN_8)
17 |
18 | void LED_ON(uint16_t LED);
19 | void LED_OFF(uint16_t LED);
20 | void LED_Toggle(uint16_t LED);
21 |
22 |
23 | #endif /* USERS_INCLUDE_LEDS_H_ */
24 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/sdcard.h:
--------------------------------------------------------------------------------
1 | /*
2 | * sdcard.h
3 | *
4 | * Created on: Apr 25, 2022
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_SDCARD_H_
9 | #define USERS_INCLUDE_SDCARD_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | void SD_Init(void);
14 | uint8_t SD_CheckInjectCntFile(__IO uint32_t *p_inject_cnt);
15 | uint8_t SD_ReadFingerprintBMP(uint32_t inject_cnt, char * path_name, uint8_t *sd_bmp_buf,uint32_t buf_size);
16 | uint8_t SD_SaveInjectCntFile(uint32_t inject_cnt);
17 | void SD_DelInjectCntFile(void);
18 | uint8_t SD_Log(uint32_t inject_cnt, uint8_t trystate, uint8_t reason);
19 | void SD_SaveFingerprintRAW(uint32_t capcnt, char * path_name,uint8_t *try0_rev_buf,uint8_t *try1_rev_buf);
20 | void SD_SaveFingerprintBMP(uint32_t capcnt, char * path_name,uint8_t *try0_rev_buf,uint8_t *try1_rev_buf);
21 |
22 | #endif /* USERS_INCLUDE_SDCARD_H_ */
23 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/segment.h:
--------------------------------------------------------------------------------
1 | /*
2 | * segment.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_SEGMENT_H_
9 | #define USERS_INCLUDE_SEGMENT_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | extern I2C_HandleTypeDef hi2c2;
14 |
15 | void Segment_Init(void);
16 | void Segment_Deinit(void);
17 | void Segment_ShowErrorCode(uint8_t reason);
18 | void Segment_ShowNum(uint8_t num);
19 | void Segment_ShowNull(void);
20 | void Segment_ShowDash(void);
21 | void Segment_ShowPA(void);
22 | void Segment_ShowBF(void);
23 | void Segment_ShowRC(void);
24 | void Segment_ShowTE(void);
25 | void Segment_ShowBFState(uint32_t num);
26 | void Segment_ShowRCState(uint32_t num);
27 |
28 | #endif /* USERS_INCLUDE_SEGMENT_H_ */
29 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/spdt.h:
--------------------------------------------------------------------------------
1 | /*
2 | * spdt.h
3 | *
4 | * Created on: Apr 24, 2022
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_SPDT_H_
9 | #define USERS_INCLUDE_SPDT_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | void SPDT_FakeMISO_On(void);
14 | void SPDT_FakeMISO_Off(void);
15 |
16 | void SPDT_ReadMOSI(void);
17 | void SPDT_ReadMISO(void);
18 |
19 | #endif /* USERS_INCLUDE_SPDT_H_ */
20 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/switch.h:
--------------------------------------------------------------------------------
1 | /*
2 | * switch.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_SWITCH_H_
9 | #define USERS_INCLUDE_SWITCH_H_
10 |
11 | #include "stm32f4xx_hal.h"
12 |
13 | #endif /* USERS_INCLUDE_SWITCH_H_ */
14 |
15 | #define SW_UNKNOWN ((uint16_t)0x0000)
16 | #define SW_PA ((uint16_t)0x0001)
17 | #define SW_BF ((uint16_t)0x0002)
18 | #define SW_RC ((uint16_t)0x0004)
19 | #define SW_TE ((uint16_t)0x0008)
20 | #define SW_SNAP ((uint16_t)0x0010)
21 |
22 | uint16_t SW_GetStates(void);
23 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Include/user_drivers.h:
--------------------------------------------------------------------------------
1 | /*
2 | * user_drivers.h
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #ifndef USERS_INCLUDE_USER_DRIVERS_H_
9 | #define USERS_INCLUDE_USER_DRIVERS_H_
10 |
11 | #include "beep.h"
12 | #include "clicker.h"
13 | #include "leds.h"
14 | #include "sdcard.h"
15 | #include "segment.h"
16 | #include "spdt.h"
17 | #include "switch.h"
18 |
19 | #endif /* USERS_INCLUDE_USER_DRIVERS_H_ */
20 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/beep.c:
--------------------------------------------------------------------------------
1 | /*
2 | * beep.c
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #include "beep.h"
9 |
10 | void Beep_On(void){
11 | HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,GPIO_PIN_SET);
12 | }
13 |
14 | void Beep_Off(void){
15 | HAL_GPIO_WritePin(GPIOB,GPIO_PIN_9,GPIO_PIN_RESET);
16 | }
17 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/clicker.c:
--------------------------------------------------------------------------------
1 | /*
2 | * clicker.c
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #include "beep.h"
9 |
10 | void Clicker_Press(void){
11 | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_SET);
12 | }
13 |
14 | void Clicker_Release(void){
15 | HAL_GPIO_WritePin(GPIOA, GPIO_PIN_1, GPIO_PIN_RESET);
16 | }
17 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/leds.c:
--------------------------------------------------------------------------------
1 | /*
2 | * leds.c
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 | #include "leds.h"
8 |
9 | void LED_ON(uint16_t LED){
10 | HAL_GPIO_WritePin(GPIOB,LED,GPIO_PIN_SET);
11 | }
12 |
13 | void LED_OFF(uint16_t LED){
14 | HAL_GPIO_WritePin(GPIOB,LED,GPIO_PIN_RESET);
15 | }
16 |
17 | void LED_Toggle(uint16_t LED){
18 | HAL_GPIO_TogglePin(GPIOB, LED);
19 | }
20 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/segment.c:
--------------------------------------------------------------------------------
1 | /*
2 | * segment.c
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 |
8 | #include "segment.h"
9 |
10 | const uint8_t dig[10]={0xc0,0xf9,0xa4,0xb0,0x99,0x92,0x82,0xf8,0x80,0x90};
11 |
12 | void Segment_Init(void){
13 | uint8_t cmd = 0x91;
14 |
15 | HAL_I2C_Master_Transmit(&hi2c2, 0x48, &cmd, 0x1, 10000);
16 | }
17 |
18 | void Segment_ShowErrorCode(uint8_t reason){
19 | uint8_t b;
20 |
21 | b = 0x83;
22 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &b, 1, 10000);
23 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, (uint8_t *)&dig[reason], 1, 10000);
24 | }
25 |
26 | void Segment_ShowNum(uint8_t num){
27 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, (uint8_t *)&dig[num/10], 1, 10000);
28 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, (uint8_t *)&dig[num%10], 1, 10000);
29 | }
30 |
31 | void Segment_ShowRCState(uint32_t num){
32 | static uint8_t step=0;
33 |
34 | switch(step){
35 | case 0:
36 | Segment_ShowRC();
37 | if(num<100)
38 | step = 3;
39 | else if(num<10000)
40 | step = 2;
41 | else if(num<1000000)
42 | step = 1;
43 | else
44 | step = 0;
45 | break;
46 | case 1:
47 | Segment_ShowNum((num/10000)%100);
48 | step = 2;
49 | break;
50 | case 2:
51 | Segment_ShowNum((num/100)%100);
52 | step = 3;
53 | break;
54 | case 3:
55 | Segment_ShowNum(num%100);
56 | step=0;
57 | break;
58 | default:
59 | break;
60 | }
61 | }
62 |
63 | void Segment_ShowBFState(uint32_t num){
64 | static uint8_t step=0;
65 |
66 | switch(step){
67 | case 0:
68 | Segment_ShowBF();
69 | if(num<100)
70 | step = 3;
71 | else if(num<10000)
72 | step = 2;
73 | else if(num<1000000)
74 | step = 1;
75 | else
76 | step = 0;
77 | break;
78 | case 1:
79 | Segment_ShowNum((num/10000)%100);
80 | step = 2;
81 | break;
82 | case 2:
83 | Segment_ShowNum((num/100)%100);
84 | step = 3;
85 | break;
86 | case 3:
87 | Segment_ShowNum(num%100);
88 | step=0;
89 | break;
90 | default:
91 | break;
92 | }
93 | }
94 |
95 | void Segment_ShowNull(void){
96 | uint8_t null;
97 |
98 | null = 0xff;
99 |
100 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &null, 1, 10000);
101 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &null, 1, 10000);
102 | }
103 |
104 | void Segment_ShowDash(void){
105 | uint8_t dash;
106 |
107 | dash = 0xbf;
108 |
109 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &dash, 1, 10000);
110 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &dash, 1, 10000);
111 | }
112 |
113 | void Segment_ShowPA(void){
114 | uint8_t P;
115 | uint8_t A;
116 |
117 | P = 0x8c;
118 | A = 0x88;
119 |
120 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &P, 1, 10000);
121 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &A, 1, 10000);
122 | }
123 |
124 | void Segment_ShowBF(void){
125 | uint8_t b;
126 | uint8_t F;
127 |
128 | b = 0x83;
129 | F = 0x8E;
130 |
131 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &b, 1, 10000);
132 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &F, 1, 10000);
133 |
134 | }
135 |
136 | void Segment_ShowRC(void){
137 | uint8_t r;
138 | uint8_t C;
139 |
140 | r = 0xCE;
141 | C = 0xC6;
142 |
143 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &r, 1, 10000);
144 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &C, 1, 10000);
145 | }
146 |
147 | void Segment_ShowTE(void){
148 | uint8_t T;
149 | uint8_t E;
150 |
151 | T = 0xF8;
152 | E = 0x86;
153 |
154 | HAL_I2C_Master_Transmit(&hi2c2, 0x68, &T, 1, 10000);
155 | HAL_I2C_Master_Transmit(&hi2c2, 0x6A, &E, 1, 10000);
156 |
157 | }
158 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/spdt.c:
--------------------------------------------------------------------------------
1 | /*
2 | * spdt.c
3 | *
4 | * Created on: Apr 24, 2022
5 | * Author: aloha
6 | */
7 |
8 | #include "spdt.h"
9 |
10 | void SPDT_FakeMISO_On(void){
11 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_RESET);
12 | }
13 |
14 | void SPDT_FakeMISO_Off(void){
15 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_14, GPIO_PIN_SET);
16 | }
17 |
18 | void SPDT_ReadMOSI(void){
19 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_SET);
20 | }
21 |
22 | void SPDT_ReadMISO(void){
23 | HAL_GPIO_WritePin(GPIOC, GPIO_PIN_13, GPIO_PIN_RESET);
24 | }
25 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Drivers/Users/Src/switch.c:
--------------------------------------------------------------------------------
1 | /*
2 | * switch.c
3 | *
4 | * Created on: 2022年4月22日
5 | * Author: aloha
6 | */
7 | #include "switch.h"
8 |
9 | uint16_t SW_GetStates(void){
10 | uint16_t states = SW_UNKNOWN;
11 |
12 | states += (uint16_t)HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_3);
13 | states += (uint16_t)HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_2)<<1;
14 | states += (uint16_t)HAL_GPIO_ReadPin(GPIOC, GPIO_PIN_15)<<2;
15 | states += (uint16_t)HAL_GPIO_ReadPin(GPIOB, GPIO_PIN_7)<<3;
16 | states += (1-(uint16_t)HAL_GPIO_ReadPin(GPIOA, GPIO_PIN_0))<<4;
17 | return states;
18 | }
19 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/FATFS/App/fatfs.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file fatfs.c
4 | * @brief Code for fatfs applications
5 | ******************************************************************************
6 | * @attention
7 | *
8 | * © Copyright (c) 2022 STMicroelectronics.
9 | * All rights reserved.
10 | *
11 | * This software component is licensed by ST under Ultimate Liberty license
12 | * SLA0044, the "License"; You may not use this file except in compliance with
13 | * the License. You may obtain a copy of the License at:
14 | * www.st.com/SLA0044
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | #include "fatfs.h"
20 |
21 | uint8_t retSD; /* Return value for SD */
22 | char SDPath[4]; /* SD logical drive path */
23 | FATFS SDFatFS; /* File system object for SD logical drive */
24 | FIL SDFile; /* File object for SD */
25 |
26 | /* USER CODE BEGIN Variables */
27 |
28 | /* USER CODE END Variables */
29 |
30 | void MX_FATFS_Init(void)
31 | {
32 | /*## FatFS: Link the SD driver ###########################*/
33 | retSD = FATFS_LinkDriver(&SD_Driver, SDPath);
34 |
35 | /* USER CODE BEGIN Init */
36 | /* additional user code for init */
37 |
38 | /* USER CODE END Init */
39 | }
40 |
41 | /**
42 | * @brief Gets Time from RTC
43 | * @param None
44 | * @retval Time in DWORD
45 | */
46 | DWORD get_fattime(void)
47 | {
48 | /* USER CODE BEGIN get_fattime */
49 | return 0;
50 | /* USER CODE END get_fattime */
51 | }
52 |
53 | /* USER CODE BEGIN Application */
54 |
55 | /* USER CODE END Application */
56 |
57 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
58 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/FATFS/App/fatfs.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file fatfs.h
4 | * @brief Header for fatfs applications
5 | ******************************************************************************
6 | * @attention
7 | *
8 | * © Copyright (c) 2022 STMicroelectronics.
9 | * All rights reserved.
10 | *
11 | * This software component is licensed by ST under Ultimate Liberty license
12 | * SLA0044, the "License"; You may not use this file except in compliance with
13 | * the License. You may obtain a copy of the License at:
14 | * www.st.com/SLA0044
15 | *
16 | ******************************************************************************
17 | */
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __fatfs_H
21 | #define __fatfs_H
22 | #ifdef __cplusplus
23 | extern "C" {
24 | #endif
25 |
26 | #include "ff.h"
27 | #include "ff_gen_drv.h"
28 | #include "sd_diskio.h" /* defines SD_Driver as external */
29 |
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | extern uint8_t retSD; /* Return value for SD */
35 | extern char SDPath[4]; /* SD logical drive path */
36 | extern FATFS SDFatFS; /* File system object for SD logical drive */
37 | extern FIL SDFile; /* File object for SD */
38 |
39 | void MX_FATFS_Init(void);
40 |
41 | /* USER CODE BEGIN Prototypes */
42 |
43 | /* USER CODE END Prototypes */
44 | #ifdef __cplusplus
45 | }
46 | #endif
47 | #endif /*__fatfs_H */
48 |
49 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
50 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/FATFS/Target/bsp_driver_sd.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file bsp_driver_sd.h for F4 (based on stm324x9i_eval_sd.h)
4 | * @brief This file contains the common defines and functions prototypes for
5 | * the bsp_driver_sd.c driver.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2022 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __STM32F4_SD_H
22 | #define __STM32F4_SD_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "stm32f4xx_hal.h"
30 |
31 | /* Exported types --------------------------------------------------------*/
32 | /**
33 | * @brief SD Card information structure
34 | */
35 | #define BSP_SD_CardInfo HAL_SD_CardInfoTypeDef
36 |
37 | /* Exported constants --------------------------------------------------------*/
38 | /**
39 | * @brief SD status structure definition
40 | */
41 | #define MSD_OK ((uint8_t)0x00)
42 | #define MSD_ERROR ((uint8_t)0x01)
43 |
44 | /**
45 | * @brief SD transfer state definition
46 | */
47 | #define SD_TRANSFER_OK ((uint8_t)0x00)
48 | #define SD_TRANSFER_BUSY ((uint8_t)0x01)
49 |
50 | #define SD_PRESENT ((uint8_t)0x01)
51 | #define SD_NOT_PRESENT ((uint8_t)0x00)
52 | #define SD_DATATIMEOUT ((uint32_t)100000000)
53 |
54 | #ifdef OLD_API
55 | /* kept to avoid issue when migrating old projects. */
56 | /* USER CODE BEGIN 0 */
57 |
58 | /* USER CODE END 0 */
59 | #else
60 | /* USER CODE BEGIN BSP_H_CODE */
61 | /* Exported functions --------------------------------------------------------*/
62 | uint8_t BSP_SD_Init(void);
63 | uint8_t BSP_SD_ITConfig(void);
64 | void BSP_SD_DetectIT(void);
65 | void BSP_SD_DetectCallback(void);
66 | uint8_t BSP_SD_ReadBlocks(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks, uint32_t Timeout);
67 | uint8_t BSP_SD_WriteBlocks(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks, uint32_t Timeout);
68 | uint8_t BSP_SD_ReadBlocks_DMA(uint32_t *pData, uint32_t ReadAddr, uint32_t NumOfBlocks);
69 | uint8_t BSP_SD_WriteBlocks_DMA(uint32_t *pData, uint32_t WriteAddr, uint32_t NumOfBlocks);
70 | uint8_t BSP_SD_Erase(uint32_t StartAddr, uint32_t EndAddr);
71 | void BSP_SD_IRQHandler(void);
72 | void BSP_SD_DMA_Tx_IRQHandler(void);
73 | void BSP_SD_DMA_Rx_IRQHandler(void);
74 | uint8_t BSP_SD_GetCardState(void);
75 | void BSP_SD_GetCardInfo(HAL_SD_CardInfoTypeDef *CardInfo);
76 | uint8_t BSP_SD_IsDetected(void);
77 |
78 | /* These functions can be modified in case the current settings (e.g. DMA stream)
79 | need to be changed for specific application needs */
80 | void BSP_SD_AbortCallback(void);
81 | void BSP_SD_WriteCpltCallback(void);
82 | void BSP_SD_ReadCpltCallback(void);
83 | /* USER CODE END BSP_H_CODE */
84 | #endif
85 |
86 | #ifdef __cplusplus
87 | }
88 | #endif
89 |
90 | #endif /* __STM32F4_SD_H */
91 |
92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
93 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/FATFS/Target/sd_diskio.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file sd_diskio.c
5 | * @brief SD Disk I/O driver
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2021 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Note: code generation based on sd_diskio_template_bspv1.c v2.1.4
22 | as "Use dma template" is disabled. */
23 |
24 | /* USER CODE BEGIN firstSection */
25 | /* can be used to modify / undefine following code or add new definitions */
26 | /* USER CODE END firstSection*/
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "ff_gen_drv.h"
30 | #include "sd_diskio.h"
31 |
32 | /* Private typedef -----------------------------------------------------------*/
33 | /* Private define ------------------------------------------------------------*/
34 | /* use the default SD timout as defined in the platform BSP driver*/
35 | #if defined(SDMMC_DATATIMEOUT)
36 | #define SD_TIMEOUT SDMMC_DATATIMEOUT
37 | #elif defined(SD_DATATIMEOUT)
38 | #define SD_TIMEOUT SD_DATATIMEOUT
39 | #else
40 | #define SD_TIMEOUT 30 * 1000
41 | #endif
42 |
43 | #define SD_DEFAULT_BLOCK_SIZE 512
44 |
45 | /*
46 | * Depending on the use case, the SD card initialization could be done at the
47 | * application level: if it is the case define the flag below to disable
48 | * the BSP_SD_Init() call in the SD_Initialize() and add a call to
49 | * BSP_SD_Init() elsewhere in the application.
50 | */
51 | /* USER CODE BEGIN disableSDInit */
52 | /* #define DISABLE_SD_INIT */
53 | /* USER CODE END disableSDInit */
54 |
55 | /* Private variables ---------------------------------------------------------*/
56 | /* Disk status */
57 | static volatile DSTATUS Stat = STA_NOINIT;
58 |
59 | /* Private function prototypes -----------------------------------------------*/
60 | static DSTATUS SD_CheckStatus(BYTE lun);
61 | DSTATUS SD_initialize (BYTE);
62 | DSTATUS SD_status (BYTE);
63 | DRESULT SD_read (BYTE, BYTE*, DWORD, UINT);
64 | #if _USE_WRITE == 1
65 | DRESULT SD_write (BYTE, const BYTE*, DWORD, UINT);
66 | #endif /* _USE_WRITE == 1 */
67 | #if _USE_IOCTL == 1
68 | DRESULT SD_ioctl (BYTE, BYTE, void*);
69 | #endif /* _USE_IOCTL == 1 */
70 |
71 | const Diskio_drvTypeDef SD_Driver =
72 | {
73 | SD_initialize,
74 | SD_status,
75 | SD_read,
76 | #if _USE_WRITE == 1
77 | SD_write,
78 | #endif /* _USE_WRITE == 1 */
79 |
80 | #if _USE_IOCTL == 1
81 | SD_ioctl,
82 | #endif /* _USE_IOCTL == 1 */
83 | };
84 |
85 | /* USER CODE BEGIN beforeFunctionSection */
86 | /* can be used to modify / undefine following code or add new code */
87 | /* USER CODE END beforeFunctionSection */
88 |
89 | /* Private functions ---------------------------------------------------------*/
90 |
91 | static DSTATUS SD_CheckStatus(BYTE lun)
92 | {
93 | Stat = STA_NOINIT;
94 |
95 | if(BSP_SD_GetCardState() == MSD_OK)
96 | {
97 | Stat &= ~STA_NOINIT;
98 | }
99 |
100 | return Stat;
101 | }
102 |
103 | /**
104 | * @brief Initializes a Drive
105 | * @param lun : not used
106 | * @retval DSTATUS: Operation status
107 | */
108 | DSTATUS SD_initialize(BYTE lun)
109 | {
110 | Stat = STA_NOINIT;
111 |
112 | #if !defined(DISABLE_SD_INIT)
113 |
114 | if(BSP_SD_Init() == MSD_OK)
115 | {
116 | Stat = SD_CheckStatus(lun);
117 | }
118 |
119 | #else
120 | Stat = SD_CheckStatus(lun);
121 | #endif
122 |
123 | return Stat;
124 | }
125 |
126 | /**
127 | * @brief Gets Disk Status
128 | * @param lun : not used
129 | * @retval DSTATUS: Operation status
130 | */
131 | DSTATUS SD_status(BYTE lun)
132 | {
133 | return SD_CheckStatus(lun);
134 | }
135 |
136 | /* USER CODE BEGIN beforeReadSection */
137 | /* can be used to modify previous code / undefine following code / add new code */
138 | /* USER CODE END beforeReadSection */
139 | /**
140 | * @brief Reads Sector(s)
141 | * @param lun : not used
142 | * @param *buff: Data buffer to store read data
143 | * @param sector: Sector address (LBA)
144 | * @param count: Number of sectors to read (1..128)
145 | * @retval DRESULT: Operation result
146 | */
147 |
148 | DRESULT SD_read(BYTE lun, BYTE *buff, DWORD sector, UINT count)
149 | {
150 | DRESULT res = RES_ERROR;
151 |
152 | if(BSP_SD_ReadBlocks((uint32_t*)buff,
153 | (uint32_t) (sector),
154 | count, SD_TIMEOUT) == MSD_OK)
155 | {
156 | /* wait until the read operation is finished */
157 | while(BSP_SD_GetCardState()!= MSD_OK)
158 | {
159 | }
160 | res = RES_OK;
161 | }
162 |
163 | return res;
164 | }
165 |
166 | /* USER CODE BEGIN beforeWriteSection */
167 | /* can be used to modify previous code / undefine following code / add new code */
168 | /* USER CODE END beforeWriteSection */
169 | /**
170 | * @brief Writes Sector(s)
171 | * @param lun : not used
172 | * @param *buff: Data to be written
173 | * @param sector: Sector address (LBA)
174 | * @param count: Number of sectors to write (1..128)
175 | * @retval DRESULT: Operation result
176 | */
177 | #if _USE_WRITE == 1
178 |
179 | DRESULT SD_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count)
180 | {
181 | DRESULT res = RES_ERROR;
182 |
183 | if(BSP_SD_WriteBlocks((uint32_t*)buff,
184 | (uint32_t)(sector),
185 | count, SD_TIMEOUT) == MSD_OK)
186 | {
187 | /* wait until the Write operation is finished */
188 | while(BSP_SD_GetCardState() != MSD_OK)
189 | {
190 | }
191 | res = RES_OK;
192 | }
193 |
194 | return res;
195 | }
196 | #endif /* _USE_WRITE == 1 */
197 |
198 | /* USER CODE BEGIN beforeIoctlSection */
199 | /* can be used to modify previous code / undefine following code / add new code */
200 | /* USER CODE END beforeIoctlSection */
201 | /**
202 | * @brief I/O control operation
203 | * @param lun : not used
204 | * @param cmd: Control code
205 | * @param *buff: Buffer to send/receive control data
206 | * @retval DRESULT: Operation result
207 | */
208 | #if _USE_IOCTL == 1
209 | DRESULT SD_ioctl(BYTE lun, BYTE cmd, void *buff)
210 | {
211 | DRESULT res = RES_ERROR;
212 | BSP_SD_CardInfo CardInfo;
213 |
214 | if (Stat & STA_NOINIT) return RES_NOTRDY;
215 |
216 | switch (cmd)
217 | {
218 | /* Make sure that no pending write process */
219 | case CTRL_SYNC :
220 | res = RES_OK;
221 | break;
222 |
223 | /* Get number of sectors on the disk (DWORD) */
224 | case GET_SECTOR_COUNT :
225 | BSP_SD_GetCardInfo(&CardInfo);
226 | *(DWORD*)buff = CardInfo.LogBlockNbr;
227 | res = RES_OK;
228 | break;
229 |
230 | /* Get R/W sector size (WORD) */
231 | case GET_SECTOR_SIZE :
232 | BSP_SD_GetCardInfo(&CardInfo);
233 | *(WORD*)buff = CardInfo.LogBlockSize;
234 | res = RES_OK;
235 | break;
236 |
237 | /* Get erase block size in unit of sector (DWORD) */
238 | case GET_BLOCK_SIZE :
239 | BSP_SD_GetCardInfo(&CardInfo);
240 | *(DWORD*)buff = CardInfo.LogBlockSize / SD_DEFAULT_BLOCK_SIZE;
241 | res = RES_OK;
242 | break;
243 |
244 | default:
245 | res = RES_PARERR;
246 | }
247 |
248 | return res;
249 | }
250 | #endif /* _USE_IOCTL == 1 */
251 |
252 | /* USER CODE BEGIN afterIoctlSection */
253 | /* can be used to modify previous code / undefine following code / add new code */
254 | /* USER CODE END afterIoctlSection */
255 |
256 | /* USER CODE BEGIN lastSection */
257 | /* can be used to modify / undefine previous code or add new code */
258 | /* USER CODE END lastSection */
259 |
260 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
261 |
262 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/FATFS/Target/sd_diskio.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file sd_diskio.h
5 | * @brief Header for sd_diskio.c module
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2021 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 | /* USER CODE END Header */
20 |
21 | /* Note: code generation based on sd_diskio_template.h */
22 |
23 | /* Define to prevent recursive inclusion -------------------------------------*/
24 | #ifndef __SD_DISKIO_H
25 | #define __SD_DISKIO_H
26 |
27 | /* USER CODE BEGIN firstSection */
28 | /* can be used to modify / undefine following code or add new definitions */
29 | /* USER CODE END firstSection */
30 |
31 | /* Includes ------------------------------------------------------------------*/
32 | #include "bsp_driver_sd.h"
33 | /* Exported types ------------------------------------------------------------*/
34 | /* Exported constants --------------------------------------------------------*/
35 | /* Exported functions ------------------------------------------------------- */
36 | extern const Diskio_drvTypeDef SD_Driver;
37 |
38 | /* USER CODE BEGIN lastSection */
39 | /* can be used to modify / undefine previous code or add new definitions */
40 | /* USER CODE END lastSection */
41 |
42 | #endif /* __SD_DISKIO_H */
43 |
44 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
45 |
46 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_msc.h
4 | * @author MCD Application Team
5 | * @brief Header for the usbd_msc.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_MSC_H
22 | #define __USBD_MSC_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_msc_bot.h"
30 | #include "usbd_msc_scsi.h"
31 | #include "usbd_ioreq.h"
32 |
33 | /** @addtogroup USBD_MSC_BOT
34 | * @{
35 | */
36 |
37 | /** @defgroup USBD_MSC
38 | * @brief This file is the Header file for usbd_msc.c
39 | * @{
40 | */
41 |
42 |
43 | /** @defgroup USBD_BOT_Exported_Defines
44 | * @{
45 | */
46 | /* MSC Class Config */
47 | #ifndef MSC_MEDIA_PACKET
48 | #define MSC_MEDIA_PACKET 512U
49 | #endif /* MSC_MEDIA_PACKET */
50 |
51 | #define MSC_MAX_FS_PACKET 0x40U
52 | #define MSC_MAX_HS_PACKET 0x200U
53 |
54 | #define BOT_GET_MAX_LUN 0xFE
55 | #define BOT_RESET 0xFF
56 | #define USB_MSC_CONFIG_DESC_SIZ 32
57 |
58 |
59 | #define MSC_EPIN_ADDR 0x81U
60 | #define MSC_EPOUT_ADDR 0x01U
61 |
62 | /**
63 | * @}
64 | */
65 |
66 | /** @defgroup USB_CORE_Exported_Types
67 | * @{
68 | */
69 | typedef struct _USBD_STORAGE
70 | {
71 | int8_t (* Init)(uint8_t lun);
72 | int8_t (* GetCapacity)(uint8_t lun, uint32_t *block_num, uint16_t *block_size);
73 | int8_t (* IsReady)(uint8_t lun);
74 | int8_t (* IsWriteProtected)(uint8_t lun);
75 | int8_t (* Read)(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
76 | int8_t (* Write)(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
77 | int8_t (* GetMaxLun)(void);
78 | int8_t *pInquiry;
79 |
80 | } USBD_StorageTypeDef;
81 |
82 |
83 | typedef struct
84 | {
85 | uint32_t max_lun;
86 | uint32_t interface;
87 | uint8_t bot_state;
88 | uint8_t bot_status;
89 | uint32_t bot_data_length;
90 | uint8_t bot_data[MSC_MEDIA_PACKET];
91 | USBD_MSC_BOT_CBWTypeDef cbw;
92 | USBD_MSC_BOT_CSWTypeDef csw;
93 |
94 | USBD_SCSI_SenseTypeDef scsi_sense [SENSE_LIST_DEEPTH];
95 | uint8_t scsi_sense_head;
96 | uint8_t scsi_sense_tail;
97 | uint8_t scsi_medium_state;
98 |
99 | uint16_t scsi_blk_size;
100 | uint32_t scsi_blk_nbr;
101 |
102 | uint32_t scsi_blk_addr;
103 | uint32_t scsi_blk_len;
104 | }
105 | USBD_MSC_BOT_HandleTypeDef;
106 |
107 | /* Structure for MSC process */
108 | extern USBD_ClassTypeDef USBD_MSC;
109 | #define USBD_MSC_CLASS &USBD_MSC
110 |
111 | uint8_t USBD_MSC_RegisterStorage(USBD_HandleTypeDef *pdev,
112 | USBD_StorageTypeDef *fops);
113 | /**
114 | * @}
115 | */
116 |
117 | /**
118 | * @}
119 | */
120 |
121 | #ifdef __cplusplus
122 | }
123 | #endif
124 |
125 | #endif /* __USBD_MSC_H */
126 | /**
127 | * @}
128 | */
129 |
130 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
131 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc_bot.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_msc_bot.h
4 | * @author MCD Application Team
5 | * @brief Header for the usbd_msc_bot.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_MSC_BOT_H
22 | #define __USBD_MSC_BOT_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_core.h"
30 |
31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 | /** @defgroup MSC_BOT
36 | * @brief This file is the Header file for usbd_msc_bot.c
37 | * @{
38 | */
39 |
40 |
41 | /** @defgroup USBD_CORE_Exported_Defines
42 | * @{
43 | */
44 | #define USBD_BOT_IDLE 0U /* Idle state */
45 | #define USBD_BOT_DATA_OUT 1U /* Data Out state */
46 | #define USBD_BOT_DATA_IN 2U /* Data In state */
47 | #define USBD_BOT_LAST_DATA_IN 3U /* Last Data In Last */
48 | #define USBD_BOT_SEND_DATA 4U /* Send Immediate data */
49 | #define USBD_BOT_NO_DATA 5U /* No data Stage */
50 |
51 | #define USBD_BOT_CBW_SIGNATURE 0x43425355U
52 | #define USBD_BOT_CSW_SIGNATURE 0x53425355U
53 | #define USBD_BOT_CBW_LENGTH 31U
54 | #define USBD_BOT_CSW_LENGTH 13U
55 | #define USBD_BOT_MAX_DATA 256U
56 |
57 | /* CSW Status Definitions */
58 | #define USBD_CSW_CMD_PASSED 0x00U
59 | #define USBD_CSW_CMD_FAILED 0x01U
60 | #define USBD_CSW_PHASE_ERROR 0x02U
61 |
62 | /* BOT Status */
63 | #define USBD_BOT_STATUS_NORMAL 0U
64 | #define USBD_BOT_STATUS_RECOVERY 1U
65 | #define USBD_BOT_STATUS_ERROR 2U
66 |
67 |
68 | #define USBD_DIR_IN 0U
69 | #define USBD_DIR_OUT 1U
70 | #define USBD_BOTH_DIR 2U
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup MSC_CORE_Private_TypesDefinitions
77 | * @{
78 | */
79 |
80 | typedef struct
81 | {
82 | uint32_t dSignature;
83 | uint32_t dTag;
84 | uint32_t dDataLength;
85 | uint8_t bmFlags;
86 | uint8_t bLUN;
87 | uint8_t bCBLength;
88 | uint8_t CB[16];
89 | uint8_t ReservedForAlign;
90 | }
91 | USBD_MSC_BOT_CBWTypeDef;
92 |
93 |
94 | typedef struct
95 | {
96 | uint32_t dSignature;
97 | uint32_t dTag;
98 | uint32_t dDataResidue;
99 | uint8_t bStatus;
100 | uint8_t ReservedForAlign[3];
101 | }
102 | USBD_MSC_BOT_CSWTypeDef;
103 |
104 | /**
105 | * @}
106 | */
107 |
108 |
109 | /** @defgroup USBD_CORE_Exported_Types
110 | * @{
111 | */
112 |
113 | /**
114 | * @}
115 | */
116 | /** @defgroup USBD_CORE_Exported_FunctionsPrototypes
117 | * @{
118 | */
119 | void MSC_BOT_Init(USBD_HandleTypeDef *pdev);
120 | void MSC_BOT_Reset(USBD_HandleTypeDef *pdev);
121 | void MSC_BOT_DeInit(USBD_HandleTypeDef *pdev);
122 | void MSC_BOT_DataIn(USBD_HandleTypeDef *pdev,
123 | uint8_t epnum);
124 |
125 | void MSC_BOT_DataOut(USBD_HandleTypeDef *pdev,
126 | uint8_t epnum);
127 |
128 | void MSC_BOT_SendCSW(USBD_HandleTypeDef *pdev,
129 | uint8_t CSW_Status);
130 |
131 | void MSC_BOT_CplClrFeature(USBD_HandleTypeDef *pdev,
132 | uint8_t epnum);
133 | /**
134 | * @}
135 | */
136 |
137 | #ifdef __cplusplus
138 | }
139 | #endif
140 |
141 | #endif /* __USBD_MSC_BOT_H */
142 | /**
143 | * @}
144 | */
145 |
146 | /**
147 | * @}
148 | */
149 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
150 |
151 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc_data.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_msc_data.h
4 | * @author MCD Application Team
5 | * @brief Header for the usbd_msc_data.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_MSC_DATA_H
22 | #define __USBD_MSC_DATA_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_conf.h"
30 |
31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 | /** @defgroup USB_INFO
36 | * @brief general defines for the usb device library file
37 | * @{
38 | */
39 |
40 | /** @defgroup USB_INFO_Exported_Defines
41 | * @{
42 | */
43 | #define MODE_SENSE6_LEN 0x17U
44 | #define MODE_SENSE10_LEN 0x1BU
45 | #define LENGTH_INQUIRY_PAGE00 0x06U
46 | #define LENGTH_INQUIRY_PAGE80 0x08U
47 | #define LENGTH_FORMAT_CAPACITIES 0x14U
48 |
49 | /**
50 | * @}
51 | */
52 |
53 |
54 | /** @defgroup USBD_INFO_Exported_TypesDefinitions
55 | * @{
56 | */
57 | /**
58 | * @}
59 | */
60 |
61 |
62 |
63 | /** @defgroup USBD_INFO_Exported_Macros
64 | * @{
65 | */
66 |
67 | /**
68 | * @}
69 | */
70 |
71 | /** @defgroup USBD_INFO_Exported_Variables
72 | * @{
73 | */
74 | extern uint8_t MSC_Page00_Inquiry_Data[LENGTH_INQUIRY_PAGE00];
75 | extern uint8_t MSC_Page80_Inquiry_Data[LENGTH_INQUIRY_PAGE80];
76 | extern uint8_t MSC_Mode_Sense6_data[MODE_SENSE6_LEN];
77 | extern uint8_t MSC_Mode_Sense10_data[MODE_SENSE10_LEN];
78 |
79 | /**
80 | * @}
81 | */
82 |
83 | /** @defgroup USBD_INFO_Exported_FunctionsPrototype
84 | * @{
85 | */
86 |
87 | /**
88 | * @}
89 | */
90 |
91 | #ifdef __cplusplus
92 | }
93 | #endif
94 |
95 | #endif /* __USBD_MSC_DATA_H */
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | /**
102 | * @}
103 | */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Inc/usbd_msc_scsi.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_msc_scsi.h
4 | * @author MCD Application Team
5 | * @brief Header for the usbd_msc_scsi.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_MSC_SCSI_H
22 | #define __USBD_MSC_SCSI_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_def.h"
30 |
31 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
32 | * @{
33 | */
34 |
35 | /** @defgroup USBD_SCSI
36 | * @brief header file for the storage disk file
37 | * @{
38 | */
39 |
40 | /** @defgroup USBD_SCSI_Exported_Defines
41 | * @{
42 | */
43 |
44 | #define SENSE_LIST_DEEPTH 4U
45 |
46 | /* SCSI Commands */
47 | #define SCSI_FORMAT_UNIT 0x04U
48 | #define SCSI_INQUIRY 0x12U
49 | #define SCSI_MODE_SELECT6 0x15U
50 | #define SCSI_MODE_SELECT10 0x55U
51 | #define SCSI_MODE_SENSE6 0x1AU
52 | #define SCSI_MODE_SENSE10 0x5AU
53 | #define SCSI_ALLOW_MEDIUM_REMOVAL 0x1EU
54 | #define SCSI_READ6 0x08U
55 | #define SCSI_READ10 0x28U
56 | #define SCSI_READ12 0xA8U
57 | #define SCSI_READ16 0x88U
58 |
59 | #define SCSI_READ_CAPACITY10 0x25U
60 | #define SCSI_READ_CAPACITY16 0x9EU
61 |
62 | #define SCSI_REQUEST_SENSE 0x03U
63 | #define SCSI_START_STOP_UNIT 0x1BU
64 | #define SCSI_TEST_UNIT_READY 0x00U
65 | #define SCSI_WRITE6 0x0AU
66 | #define SCSI_WRITE10 0x2AU
67 | #define SCSI_WRITE12 0xAAU
68 | #define SCSI_WRITE16 0x8AU
69 |
70 | #define SCSI_VERIFY10 0x2FU
71 | #define SCSI_VERIFY12 0xAFU
72 | #define SCSI_VERIFY16 0x8FU
73 |
74 | #define SCSI_SEND_DIAGNOSTIC 0x1DU
75 | #define SCSI_READ_FORMAT_CAPACITIES 0x23U
76 |
77 | #define NO_SENSE 0U
78 | #define RECOVERED_ERROR 1U
79 | #define NOT_READY 2U
80 | #define MEDIUM_ERROR 3U
81 | #define HARDWARE_ERROR 4U
82 | #define ILLEGAL_REQUEST 5U
83 | #define UNIT_ATTENTION 6U
84 | #define DATA_PROTECT 7U
85 | #define BLANK_CHECK 8U
86 | #define VENDOR_SPECIFIC 9U
87 | #define COPY_ABORTED 10U
88 | #define ABORTED_COMMAND 11U
89 | #define VOLUME_OVERFLOW 13U
90 | #define MISCOMPARE 14U
91 |
92 |
93 | #define INVALID_CDB 0x20U
94 | #define INVALID_FIELED_IN_COMMAND 0x24U
95 | #define PARAMETER_LIST_LENGTH_ERROR 0x1AU
96 | #define INVALID_FIELD_IN_PARAMETER_LIST 0x26U
97 | #define ADDRESS_OUT_OF_RANGE 0x21U
98 | #define MEDIUM_NOT_PRESENT 0x3AU
99 | #define MEDIUM_HAVE_CHANGED 0x28U
100 | #define WRITE_PROTECTED 0x27U
101 | #define UNRECOVERED_READ_ERROR 0x11U
102 | #define WRITE_FAULT 0x03U
103 |
104 | #define READ_FORMAT_CAPACITY_DATA_LEN 0x0CU
105 | #define READ_CAPACITY10_DATA_LEN 0x08U
106 | #define REQUEST_SENSE_DATA_LEN 0x12U
107 | #define STANDARD_INQUIRY_DATA_LEN 0x24U
108 | #define BLKVFY 0x04U
109 |
110 | #define SCSI_MEDIUM_UNLOCKED 0x00U
111 | #define SCSI_MEDIUM_LOCKED 0x01U
112 | #define SCSI_MEDIUM_EJECTED 0x02U
113 | /**
114 | * @}
115 | */
116 |
117 |
118 | /** @defgroup USBD_SCSI_Exported_TypesDefinitions
119 | * @{
120 | */
121 |
122 | typedef struct _SENSE_ITEM
123 | {
124 | uint8_t Skey;
125 | union
126 | {
127 | struct _ASCs
128 | {
129 | uint8_t ASC;
130 | uint8_t ASCQ;
131 | } b;
132 | uint8_t ASC;
133 | uint8_t *pData;
134 | } w;
135 | } USBD_SCSI_SenseTypeDef;
136 | /**
137 | * @}
138 | */
139 |
140 | /** @defgroup USBD_SCSI_Exported_Macros
141 | * @{
142 | */
143 |
144 | /**
145 | * @}
146 | */
147 |
148 | /** @defgroup USBD_SCSI_Exported_Variables
149 | * @{
150 | */
151 |
152 | /**
153 | * @}
154 | */
155 | /** @defgroup USBD_SCSI_Exported_FunctionsPrototype
156 | * @{
157 | */
158 | int8_t SCSI_ProcessCmd(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t *cmd);
159 |
160 | void SCSI_SenseCode(USBD_HandleTypeDef *pdev, uint8_t lun, uint8_t sKey,
161 | uint8_t ASC);
162 |
163 | /**
164 | * @}
165 | */
166 |
167 | #ifdef __cplusplus
168 | }
169 | #endif
170 |
171 | #endif /* __USBD_MSC_SCSI_H */
172 | /**
173 | * @}
174 | */
175 |
176 | /**
177 | * @}
178 | */
179 |
180 | /**
181 | * @}
182 | */
183 |
184 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
185 |
186 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Class/MSC/Src/usbd_msc_data.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_msc_data.c
4 | * @author MCD Application Team
5 | * @brief This file provides all the vital inquiry pages and sense data.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* BSPDependencies
21 | - "stm32xxxxx_{eval}{discovery}{nucleo_144}.c"
22 | - "stm32xxxxx_{eval}{discovery}_io.c"
23 | - "stm32xxxxx_{eval}{discovery}{adafruit}_sd.c"
24 | EndBSPDependencies */
25 |
26 | /* Includes ------------------------------------------------------------------*/
27 | #include "usbd_msc_data.h"
28 |
29 |
30 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
31 | * @{
32 | */
33 |
34 |
35 | /** @defgroup MSC_DATA
36 | * @brief Mass storage info/data module
37 | * @{
38 | */
39 |
40 | /** @defgroup MSC_DATA_Private_TypesDefinitions
41 | * @{
42 | */
43 | /**
44 | * @}
45 | */
46 |
47 |
48 | /** @defgroup MSC_DATA_Private_Defines
49 | * @{
50 | */
51 | /**
52 | * @}
53 | */
54 |
55 |
56 | /** @defgroup MSC_DATA_Private_Macros
57 | * @{
58 | */
59 | /**
60 | * @}
61 | */
62 |
63 |
64 | /** @defgroup MSC_DATA_Private_Variables
65 | * @{
66 | */
67 |
68 | /* USB Mass storage Page 0 Inquiry Data */
69 | uint8_t MSC_Page00_Inquiry_Data[LENGTH_INQUIRY_PAGE00] =
70 | {
71 | 0x00,
72 | 0x00,
73 | 0x00,
74 | (LENGTH_INQUIRY_PAGE00 - 4U),
75 | 0x00,
76 | 0x80
77 | };
78 |
79 | /* USB Mass storage VPD Page 0x80 Inquiry Data for Unit Serial Number */
80 | uint8_t MSC_Page80_Inquiry_Data[LENGTH_INQUIRY_PAGE80] =
81 | {
82 | 0x00,
83 | 0x80,
84 | 0x00,
85 | LENGTH_INQUIRY_PAGE80,
86 | 0x20, /* Put Product Serial number */
87 | 0x20,
88 | 0x20,
89 | 0x20
90 | };
91 |
92 | /* USB Mass storage sense 6 Data */
93 | uint8_t MSC_Mode_Sense6_data[MODE_SENSE6_LEN] =
94 | {
95 | 0x22,
96 | 0x00,
97 | 0x00,
98 | 0x00,
99 | 0x08,
100 | 0x12,
101 | 0x00,
102 | 0x00,
103 | 0x00,
104 | 0x00,
105 | 0x00,
106 | 0x00,
107 | 0x00,
108 | 0x00,
109 | 0x00,
110 | 0x00,
111 | 0x00,
112 | 0x00,
113 | 0x00,
114 | 0x00,
115 | 0x00,
116 | 0x00,
117 | 0x00
118 | };
119 |
120 |
121 | /* USB Mass storage sense 10 Data */
122 | uint8_t MSC_Mode_Sense10_data[MODE_SENSE10_LEN] =
123 | {
124 | 0x00,
125 | 0x26,
126 | 0x00,
127 | 0x00,
128 | 0x00,
129 | 0x00,
130 | 0x00,
131 | 0x00,
132 | 0x08,
133 | 0x12,
134 | 0x00,
135 | 0x00,
136 | 0x00,
137 | 0x00,
138 | 0x00,
139 | 0x00,
140 | 0x00,
141 | 0x00,
142 | 0x00,
143 | 0x00,
144 | 0x00,
145 | 0x00,
146 | 0x00,
147 | 0x00,
148 | 0x00,
149 | 0x00,
150 | 0x00
151 | };
152 | /**
153 | * @}
154 | */
155 |
156 |
157 | /** @defgroup MSC_DATA_Private_FunctionPrototypes
158 | * @{
159 | */
160 | /**
161 | * @}
162 | */
163 |
164 |
165 | /** @defgroup MSC_DATA_Private_Functions
166 | * @{
167 | */
168 |
169 | /**
170 | * @}
171 | */
172 |
173 |
174 | /**
175 | * @}
176 | */
177 |
178 |
179 | /**
180 | * @}
181 | */
182 |
183 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
184 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_core.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_core.h
4 | * @author MCD Application Team
5 | * @brief Header file for usbd_core.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_CORE_H
22 | #define __USBD_CORE_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_conf.h"
30 | #include "usbd_def.h"
31 | #include "usbd_ioreq.h"
32 | #include "usbd_ctlreq.h"
33 |
34 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
35 | * @{
36 | */
37 |
38 | /** @defgroup USBD_CORE
39 | * @brief This file is the Header file for usbd_core.c file
40 | * @{
41 | */
42 |
43 |
44 | /** @defgroup USBD_CORE_Exported_Defines
45 | * @{
46 | */
47 | #ifndef USBD_DEBUG_LEVEL
48 | #define USBD_DEBUG_LEVEL 0U
49 | #endif /* USBD_DEBUG_LEVEL */
50 | /**
51 | * @}
52 | */
53 |
54 |
55 | /** @defgroup USBD_CORE_Exported_TypesDefinitions
56 | * @{
57 | */
58 |
59 |
60 | /**
61 | * @}
62 | */
63 |
64 |
65 |
66 | /** @defgroup USBD_CORE_Exported_Macros
67 | * @{
68 | */
69 |
70 | /**
71 | * @}
72 | */
73 |
74 | /** @defgroup USBD_CORE_Exported_Variables
75 | * @{
76 | */
77 | #define USBD_SOF USBD_LL_SOF
78 | /**
79 | * @}
80 | */
81 |
82 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype
83 | * @{
84 | */
85 | USBD_StatusTypeDef USBD_Init(USBD_HandleTypeDef *pdev, USBD_DescriptorsTypeDef *pdesc, uint8_t id);
86 | USBD_StatusTypeDef USBD_DeInit(USBD_HandleTypeDef *pdev);
87 | USBD_StatusTypeDef USBD_Start(USBD_HandleTypeDef *pdev);
88 | USBD_StatusTypeDef USBD_Stop(USBD_HandleTypeDef *pdev);
89 | USBD_StatusTypeDef USBD_RegisterClass(USBD_HandleTypeDef *pdev, USBD_ClassTypeDef *pclass);
90 |
91 | USBD_StatusTypeDef USBD_RunTestMode(USBD_HandleTypeDef *pdev);
92 | USBD_StatusTypeDef USBD_SetClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
93 | USBD_StatusTypeDef USBD_ClrClassConfig(USBD_HandleTypeDef *pdev, uint8_t cfgidx);
94 |
95 | USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup);
96 | USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata);
97 | USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata);
98 |
99 | USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev);
100 | USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed);
101 | USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev);
102 | USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev);
103 |
104 | USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev);
105 | USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
106 | USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum);
107 |
108 | USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev);
109 | USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev);
110 |
111 | /* USBD Low Level Driver */
112 | USBD_StatusTypeDef USBD_LL_Init(USBD_HandleTypeDef *pdev);
113 | USBD_StatusTypeDef USBD_LL_DeInit(USBD_HandleTypeDef *pdev);
114 | USBD_StatusTypeDef USBD_LL_Start(USBD_HandleTypeDef *pdev);
115 | USBD_StatusTypeDef USBD_LL_Stop(USBD_HandleTypeDef *pdev);
116 |
117 | USBD_StatusTypeDef USBD_LL_OpenEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr,
118 | uint8_t ep_type, uint16_t ep_mps);
119 |
120 | USBD_StatusTypeDef USBD_LL_CloseEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
121 | USBD_StatusTypeDef USBD_LL_FlushEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
122 | USBD_StatusTypeDef USBD_LL_StallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
123 | USBD_StatusTypeDef USBD_LL_ClearStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
124 | USBD_StatusTypeDef USBD_LL_SetUSBAddress(USBD_HandleTypeDef *pdev, uint8_t dev_addr);
125 |
126 | USBD_StatusTypeDef USBD_LL_Transmit(USBD_HandleTypeDef *pdev, uint8_t ep_addr,
127 | uint8_t *pbuf, uint32_t size);
128 |
129 | USBD_StatusTypeDef USBD_LL_PrepareReceive(USBD_HandleTypeDef *pdev, uint8_t ep_addr,
130 | uint8_t *pbuf, uint32_t size);
131 |
132 | uint8_t USBD_LL_IsStallEP(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
133 | uint32_t USBD_LL_GetRxDataSize(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
134 |
135 | void USBD_LL_Delay(uint32_t Delay);
136 |
137 | /**
138 | * @}
139 | */
140 |
141 | #ifdef __cplusplus
142 | }
143 | #endif
144 |
145 | #endif /* __USBD_CORE_H */
146 |
147 | /**
148 | * @}
149 | */
150 |
151 | /**
152 | * @}
153 | */
154 |
155 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
156 |
157 |
158 |
159 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ctlreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_req.h
4 | * @author MCD Application Team
5 | * @brief Header file for the usbd_req.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USB_REQUEST_H
22 | #define __USB_REQUEST_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_def.h"
30 |
31 |
32 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
33 | * @{
34 | */
35 |
36 | /** @defgroup USBD_REQ
37 | * @brief header file for the usbd_req.c file
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_REQ_Exported_Defines
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USBD_REQ_Exported_Types
50 | * @{
51 | */
52 | /**
53 | * @}
54 | */
55 |
56 |
57 |
58 | /** @defgroup USBD_REQ_Exported_Macros
59 | * @{
60 | */
61 | /**
62 | * @}
63 | */
64 |
65 | /** @defgroup USBD_REQ_Exported_Variables
66 | * @{
67 | */
68 | /**
69 | * @}
70 | */
71 |
72 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype
73 | * @{
74 | */
75 |
76 | USBD_StatusTypeDef USBD_StdDevReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
77 | USBD_StatusTypeDef USBD_StdItfReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
78 | USBD_StatusTypeDef USBD_StdEPReq(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
79 |
80 | void USBD_CtlError(USBD_HandleTypeDef *pdev, USBD_SetupReqTypedef *req);
81 | void USBD_ParseSetupRequest(USBD_SetupReqTypedef *req, uint8_t *pdata);
82 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len);
83 |
84 | /**
85 | * @}
86 | */
87 |
88 | #ifdef __cplusplus
89 | }
90 | #endif
91 |
92 | #endif /* __USB_REQUEST_H */
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 |
103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
104 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Core/Inc/usbd_ioreq.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.h
4 | * @author MCD Application Team
5 | * @brief Header file for the usbd_ioreq.c file
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Define to prevent recursive inclusion -------------------------------------*/
21 | #ifndef __USBD_IOREQ_H
22 | #define __USBD_IOREQ_H
23 |
24 | #ifdef __cplusplus
25 | extern "C" {
26 | #endif
27 |
28 | /* Includes ------------------------------------------------------------------*/
29 | #include "usbd_def.h"
30 | #include "usbd_core.h"
31 |
32 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
33 | * @{
34 | */
35 |
36 | /** @defgroup USBD_IOREQ
37 | * @brief header file for the usbd_ioreq.c file
38 | * @{
39 | */
40 |
41 | /** @defgroup USBD_IOREQ_Exported_Defines
42 | * @{
43 | */
44 | /**
45 | * @}
46 | */
47 |
48 |
49 | /** @defgroup USBD_IOREQ_Exported_Types
50 | * @{
51 | */
52 |
53 |
54 | /**
55 | * @}
56 | */
57 |
58 |
59 |
60 | /** @defgroup USBD_IOREQ_Exported_Macros
61 | * @{
62 | */
63 |
64 | /**
65 | * @}
66 | */
67 |
68 | /** @defgroup USBD_IOREQ_Exported_Variables
69 | * @{
70 | */
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype
77 | * @{
78 | */
79 |
80 | USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev,
81 | uint8_t *pbuf, uint32_t len);
82 |
83 | USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev,
84 | uint8_t *pbuf, uint32_t len);
85 |
86 | USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev,
87 | uint8_t *pbuf, uint32_t len);
88 |
89 | USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev,
90 | uint8_t *pbuf, uint32_t len);
91 |
92 | USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev);
93 | USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev);
94 |
95 | uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr);
96 |
97 | /**
98 | * @}
99 | */
100 |
101 | #ifdef __cplusplus
102 | }
103 | #endif
104 |
105 | #endif /* __USBD_IOREQ_H */
106 |
107 | /**
108 | * @}
109 | */
110 |
111 | /**
112 | * @}
113 | */
114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
115 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/ST/STM32_USB_Device_Library/Core/Src/usbd_ioreq.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file usbd_ioreq.c
4 | * @author MCD Application Team
5 | * @brief This file provides the IO requests APIs for control endpoints.
6 | ******************************************************************************
7 | * @attention
8 | *
9 | * © Copyright (c) 2015 STMicroelectronics.
10 | * All rights reserved.
11 | *
12 | * This software component is licensed by ST under Ultimate Liberty license
13 | * SLA0044, the "License"; You may not use this file except in compliance with
14 | * the License. You may obtain a copy of the License at:
15 | * www.st.com/SLA0044
16 | *
17 | ******************************************************************************
18 | */
19 |
20 | /* Includes ------------------------------------------------------------------*/
21 | #include "usbd_ioreq.h"
22 |
23 | /** @addtogroup STM32_USB_DEVICE_LIBRARY
24 | * @{
25 | */
26 |
27 |
28 | /** @defgroup USBD_IOREQ
29 | * @brief control I/O requests module
30 | * @{
31 | */
32 |
33 | /** @defgroup USBD_IOREQ_Private_TypesDefinitions
34 | * @{
35 | */
36 | /**
37 | * @}
38 | */
39 |
40 |
41 | /** @defgroup USBD_IOREQ_Private_Defines
42 | * @{
43 | */
44 |
45 | /**
46 | * @}
47 | */
48 |
49 |
50 | /** @defgroup USBD_IOREQ_Private_Macros
51 | * @{
52 | */
53 | /**
54 | * @}
55 | */
56 |
57 |
58 | /** @defgroup USBD_IOREQ_Private_Variables
59 | * @{
60 | */
61 |
62 | /**
63 | * @}
64 | */
65 |
66 |
67 | /** @defgroup USBD_IOREQ_Private_FunctionPrototypes
68 | * @{
69 | */
70 | /**
71 | * @}
72 | */
73 |
74 |
75 | /** @defgroup USBD_IOREQ_Private_Functions
76 | * @{
77 | */
78 |
79 | /**
80 | * @brief USBD_CtlSendData
81 | * send data on the ctl pipe
82 | * @param pdev: device instance
83 | * @param buff: pointer to data buffer
84 | * @param len: length of data to be sent
85 | * @retval status
86 | */
87 | USBD_StatusTypeDef USBD_CtlSendData(USBD_HandleTypeDef *pdev,
88 | uint8_t *pbuf, uint32_t len)
89 | {
90 | /* Set EP0 State */
91 | pdev->ep0_state = USBD_EP0_DATA_IN;
92 | pdev->ep_in[0].total_length = len;
93 |
94 | #ifdef USBD_AVOID_PACKET_SPLIT_MPS
95 | pdev->ep_in[0].rem_length = 0U;
96 | #else
97 | pdev->ep_in[0].rem_length = len;
98 | #endif
99 |
100 | /* Start the transfer */
101 | (void)USBD_LL_Transmit(pdev, 0x00U, pbuf, len);
102 |
103 | return USBD_OK;
104 | }
105 |
106 | /**
107 | * @brief USBD_CtlContinueSendData
108 | * continue sending data on the ctl pipe
109 | * @param pdev: device instance
110 | * @param buff: pointer to data buffer
111 | * @param len: length of data to be sent
112 | * @retval status
113 | */
114 | USBD_StatusTypeDef USBD_CtlContinueSendData(USBD_HandleTypeDef *pdev,
115 | uint8_t *pbuf, uint32_t len)
116 | {
117 | /* Start the next transfer */
118 | (void)USBD_LL_Transmit(pdev, 0x00U, pbuf, len);
119 |
120 | return USBD_OK;
121 | }
122 |
123 | /**
124 | * @brief USBD_CtlPrepareRx
125 | * receive data on the ctl pipe
126 | * @param pdev: device instance
127 | * @param buff: pointer to data buffer
128 | * @param len: length of data to be received
129 | * @retval status
130 | */
131 | USBD_StatusTypeDef USBD_CtlPrepareRx(USBD_HandleTypeDef *pdev,
132 | uint8_t *pbuf, uint32_t len)
133 | {
134 | /* Set EP0 State */
135 | pdev->ep0_state = USBD_EP0_DATA_OUT;
136 | pdev->ep_out[0].total_length = len;
137 |
138 | #ifdef USBD_AVOID_PACKET_SPLIT_MPS
139 | pdev->ep_out[0].rem_length = 0U;
140 | #else
141 | pdev->ep_out[0].rem_length = len;
142 | #endif
143 |
144 | /* Start the transfer */
145 | (void)USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
146 |
147 | return USBD_OK;
148 | }
149 |
150 | /**
151 | * @brief USBD_CtlContinueRx
152 | * continue receive data on the ctl pipe
153 | * @param pdev: device instance
154 | * @param buff: pointer to data buffer
155 | * @param len: length of data to be received
156 | * @retval status
157 | */
158 | USBD_StatusTypeDef USBD_CtlContinueRx(USBD_HandleTypeDef *pdev,
159 | uint8_t *pbuf, uint32_t len)
160 | {
161 | (void)USBD_LL_PrepareReceive(pdev, 0U, pbuf, len);
162 |
163 | return USBD_OK;
164 | }
165 |
166 | /**
167 | * @brief USBD_CtlSendStatus
168 | * send zero lzngth packet on the ctl pipe
169 | * @param pdev: device instance
170 | * @retval status
171 | */
172 | USBD_StatusTypeDef USBD_CtlSendStatus(USBD_HandleTypeDef *pdev)
173 | {
174 | /* Set EP0 State */
175 | pdev->ep0_state = USBD_EP0_STATUS_IN;
176 |
177 | /* Start the transfer */
178 | (void)USBD_LL_Transmit(pdev, 0x00U, NULL, 0U);
179 |
180 | return USBD_OK;
181 | }
182 |
183 | /**
184 | * @brief USBD_CtlReceiveStatus
185 | * receive zero lzngth packet on the ctl pipe
186 | * @param pdev: device instance
187 | * @retval status
188 | */
189 | USBD_StatusTypeDef USBD_CtlReceiveStatus(USBD_HandleTypeDef *pdev)
190 | {
191 | /* Set EP0 State */
192 | pdev->ep0_state = USBD_EP0_STATUS_OUT;
193 |
194 | /* Start the transfer */
195 | (void)USBD_LL_PrepareReceive(pdev, 0U, NULL, 0U);
196 |
197 | return USBD_OK;
198 | }
199 |
200 | /**
201 | * @brief USBD_GetRxCount
202 | * returns the received data length
203 | * @param pdev: device instance
204 | * @param ep_addr: endpoint address
205 | * @retval Rx Data blength
206 | */
207 | uint32_t USBD_GetRxCount(USBD_HandleTypeDef *pdev, uint8_t ep_addr)
208 | {
209 | return USBD_LL_GetRxDataSize(pdev, ep_addr);
210 | }
211 |
212 | /**
213 | * @}
214 | */
215 |
216 |
217 | /**
218 | * @}
219 | */
220 |
221 |
222 | /**
223 | * @}
224 | */
225 |
226 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
227 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/diskio.c:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------*/
2 | /* Low level disk I/O module skeleton for FatFs (C)ChaN, 2017 */
3 | /* */
4 | /* Portions COPYRIGHT 2017 STMicroelectronics */
5 | /* Portions Copyright (C) 2017, ChaN, all right reserved */
6 | /*-----------------------------------------------------------------------*/
7 | /* If a working storage control module is available, it should be */
8 | /* attached to the FatFs via a glue function rather than modifying it. */
9 | /* This is an example of glue functions to attach various existing */
10 | /* storage control modules to the FatFs module with a defined API. */
11 | /*-----------------------------------------------------------------------*/
12 |
13 | /* Includes ------------------------------------------------------------------*/
14 | #include "diskio.h"
15 | #include "ff_gen_drv.h"
16 |
17 | #if defined ( __GNUC__ )
18 | #ifndef __weak
19 | #define __weak __attribute__((weak))
20 | #endif
21 | #endif
22 |
23 | /* Private typedef -----------------------------------------------------------*/
24 | /* Private define ------------------------------------------------------------*/
25 | /* Private variables ---------------------------------------------------------*/
26 | extern Disk_drvTypeDef disk;
27 |
28 | /* Private function prototypes -----------------------------------------------*/
29 | /* Private functions ---------------------------------------------------------*/
30 |
31 | /**
32 | * @brief Gets Disk Status
33 | * @param pdrv: Physical drive number (0..)
34 | * @retval DSTATUS: Operation status
35 | */
36 | DSTATUS disk_status (
37 | BYTE pdrv /* Physical drive number to identify the drive */
38 | )
39 | {
40 | DSTATUS stat;
41 |
42 | stat = disk.drv[pdrv]->disk_status(disk.lun[pdrv]);
43 | return stat;
44 | }
45 |
46 | /**
47 | * @brief Initializes a Drive
48 | * @param pdrv: Physical drive number (0..)
49 | * @retval DSTATUS: Operation status
50 | */
51 | DSTATUS disk_initialize (
52 | BYTE pdrv /* Physical drive nmuber to identify the drive */
53 | )
54 | {
55 | DSTATUS stat = RES_OK;
56 |
57 | if(disk.is_initialized[pdrv] == 0)
58 | {
59 | disk.is_initialized[pdrv] = 1;
60 | stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);
61 | }
62 | return stat;
63 | }
64 |
65 | /**
66 | * @brief Reads Sector(s)
67 | * @param pdrv: Physical drive number (0..)
68 | * @param *buff: Data buffer to store read data
69 | * @param sector: Sector address (LBA)
70 | * @param count: Number of sectors to read (1..128)
71 | * @retval DRESULT: Operation result
72 | */
73 | DRESULT disk_read (
74 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
75 | BYTE *buff, /* Data buffer to store read data */
76 | DWORD sector, /* Sector address in LBA */
77 | UINT count /* Number of sectors to read */
78 | )
79 | {
80 | DRESULT res;
81 |
82 | res = disk.drv[pdrv]->disk_read(disk.lun[pdrv], buff, sector, count);
83 | return res;
84 | }
85 |
86 | /**
87 | * @brief Writes Sector(s)
88 | * @param pdrv: Physical drive number (0..)
89 | * @param *buff: Data to be written
90 | * @param sector: Sector address (LBA)
91 | * @param count: Number of sectors to write (1..128)
92 | * @retval DRESULT: Operation result
93 | */
94 | #if _USE_WRITE == 1
95 | DRESULT disk_write (
96 | BYTE pdrv, /* Physical drive nmuber to identify the drive */
97 | const BYTE *buff, /* Data to be written */
98 | DWORD sector, /* Sector address in LBA */
99 | UINT count /* Number of sectors to write */
100 | )
101 | {
102 | DRESULT res;
103 |
104 | res = disk.drv[pdrv]->disk_write(disk.lun[pdrv], buff, sector, count);
105 | return res;
106 | }
107 | #endif /* _USE_WRITE == 1 */
108 |
109 | /**
110 | * @brief I/O control operation
111 | * @param pdrv: Physical drive number (0..)
112 | * @param cmd: Control code
113 | * @param *buff: Buffer to send/receive control data
114 | * @retval DRESULT: Operation result
115 | */
116 | #if _USE_IOCTL == 1
117 | DRESULT disk_ioctl (
118 | BYTE pdrv, /* Physical drive nmuber (0..) */
119 | BYTE cmd, /* Control code */
120 | void *buff /* Buffer to send/receive control data */
121 | )
122 | {
123 | DRESULT res;
124 |
125 | res = disk.drv[pdrv]->disk_ioctl(disk.lun[pdrv], cmd, buff);
126 | return res;
127 | }
128 | #endif /* _USE_IOCTL == 1 */
129 |
130 | /**
131 | * @brief Gets Time from RTC
132 | * @param None
133 | * @retval Time in DWORD
134 | */
135 | __weak DWORD get_fattime (void)
136 | {
137 | return 0;
138 | }
139 |
140 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
141 |
142 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/diskio.h:
--------------------------------------------------------------------------------
1 | /*-----------------------------------------------------------------------/
2 | / Low level disk interface modlue include file (C)ChaN, 2014 /
3 | /-----------------------------------------------------------------------*/
4 |
5 | #ifndef _DISKIO_DEFINED
6 | #define _DISKIO_DEFINED
7 |
8 | #ifdef __cplusplus
9 | extern "C" {
10 | #endif
11 |
12 | #define _USE_WRITE 1 /* 1: Enable disk_write function */
13 | #define _USE_IOCTL 1 /* 1: Enable disk_ioctl function */
14 |
15 | #include "integer.h"
16 |
17 |
18 | /* Status of Disk Functions */
19 | typedef BYTE DSTATUS;
20 |
21 | /* Results of Disk Functions */
22 | typedef enum {
23 | RES_OK = 0, /* 0: Successful */
24 | RES_ERROR, /* 1: R/W Error */
25 | RES_WRPRT, /* 2: Write Protected */
26 | RES_NOTRDY, /* 3: Not Ready */
27 | RES_PARERR /* 4: Invalid Parameter */
28 | } DRESULT;
29 |
30 |
31 | /*---------------------------------------*/
32 | /* Prototypes for disk control functions */
33 |
34 |
35 | DSTATUS disk_initialize (BYTE pdrv);
36 | DSTATUS disk_status (BYTE pdrv);
37 | DRESULT disk_read (BYTE pdrv, BYTE* buff, DWORD sector, UINT count);
38 | DRESULT disk_write (BYTE pdrv, const BYTE* buff, DWORD sector, UINT count);
39 | DRESULT disk_ioctl (BYTE pdrv, BYTE cmd, void* buff);
40 | DWORD get_fattime (void);
41 |
42 | /* Disk Status Bits (DSTATUS) */
43 |
44 | #define STA_NOINIT 0x01 /* Drive not initialized */
45 | #define STA_NODISK 0x02 /* No medium in the drive */
46 | #define STA_PROTECT 0x04 /* Write protected */
47 |
48 |
49 | /* Command code for disk_ioctrl fucntion */
50 |
51 | /* Generic command (Used by FatFs) */
52 | #define CTRL_SYNC 0 /* Complete pending write process (needed at _FS_READONLY == 0) */
53 | #define GET_SECTOR_COUNT 1 /* Get media size (needed at _USE_MKFS == 1) */
54 | #define GET_SECTOR_SIZE 2 /* Get sector size (needed at _MAX_SS != _MIN_SS) */
55 | #define GET_BLOCK_SIZE 3 /* Get erase block size (needed at _USE_MKFS == 1) */
56 | #define CTRL_TRIM 4 /* Inform device that the data on the block of sectors is no longer used (needed at _USE_TRIM == 1) */
57 |
58 | /* Generic command (Not used by FatFs) */
59 | #define CTRL_POWER 5 /* Get/Set power status */
60 | #define CTRL_LOCK 6 /* Lock/Unlock media removal */
61 | #define CTRL_EJECT 7 /* Eject media */
62 | #define CTRL_FORMAT 8 /* Create physical format on the media */
63 |
64 | /* MMC/SDC specific ioctl command */
65 | #define MMC_GET_TYPE 10 /* Get card type */
66 | #define MMC_GET_CSD 11 /* Get CSD */
67 | #define MMC_GET_CID 12 /* Get CID */
68 | #define MMC_GET_OCR 13 /* Get OCR */
69 | #define MMC_GET_SDSTAT 14 /* Get SD status */
70 |
71 | /* ATA/CF specific ioctl command */
72 | #define ATA_GET_REV 20 /* Get F/W revision */
73 | #define ATA_GET_MODEL 21 /* Get model name */
74 | #define ATA_GET_SN 22 /* Get serial number */
75 |
76 | #ifdef __cplusplus
77 | }
78 | #endif
79 |
80 | #endif
81 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/ff_gen_drv.c:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.c
4 | * @author MCD Application Team
5 | * @brief FatFs generic low level driver.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 | /* Includes ------------------------------------------------------------------*/
19 | #include "ff_gen_drv.h"
20 |
21 | /* Private typedef -----------------------------------------------------------*/
22 | /* Private define ------------------------------------------------------------*/
23 | /* Private variables ---------------------------------------------------------*/
24 | Disk_drvTypeDef disk = {{0},{0},{0},0};
25 |
26 | /* Private function prototypes -----------------------------------------------*/
27 | /* Private functions ---------------------------------------------------------*/
28 |
29 | /**
30 | * @brief Links a compatible diskio driver/lun id and increments the number of active
31 | * linked drivers.
32 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits.
33 | * @param drv: pointer to the disk IO Driver structure
34 | * @param path: pointer to the logical drive path
35 | * @param lun : only used for USB Key Disk to add multi-lun management
36 | else the parameter must be equal to 0
37 | * @retval Returns 0 in case of success, otherwise 1.
38 | */
39 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, uint8_t lun)
40 | {
41 | uint8_t ret = 1;
42 | uint8_t DiskNum = 0;
43 |
44 | if(disk.nbr < _VOLUMES)
45 | {
46 | disk.is_initialized[disk.nbr] = 0;
47 | disk.drv[disk.nbr] = drv;
48 | disk.lun[disk.nbr] = lun;
49 | DiskNum = disk.nbr++;
50 | path[0] = DiskNum + '0';
51 | path[1] = ':';
52 | path[2] = '/';
53 | path[3] = 0;
54 | ret = 0;
55 | }
56 |
57 | return ret;
58 | }
59 |
60 | /**
61 | * @brief Links a compatible diskio driver and increments the number of active
62 | * linked drivers.
63 | * @note The number of linked drivers (volumes) is up to 10 due to FatFs limits
64 | * @param drv: pointer to the disk IO Driver structure
65 | * @param path: pointer to the logical drive path
66 | * @retval Returns 0 in case of success, otherwise 1.
67 | */
68 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path)
69 | {
70 | return FATFS_LinkDriverEx(drv, path, 0);
71 | }
72 |
73 | /**
74 | * @brief Unlinks a diskio driver and decrements the number of active linked
75 | * drivers.
76 | * @param path: pointer to the logical drive path
77 | * @param lun : not used
78 | * @retval Returns 0 in case of success, otherwise 1.
79 | */
80 | uint8_t FATFS_UnLinkDriverEx(char *path, uint8_t lun)
81 | {
82 | uint8_t DiskNum = 0;
83 | uint8_t ret = 1;
84 |
85 | if(disk.nbr >= 1)
86 | {
87 | DiskNum = path[0] - '0';
88 | if(disk.drv[DiskNum] != 0)
89 | {
90 | disk.drv[DiskNum] = 0;
91 | disk.lun[DiskNum] = 0;
92 | disk.nbr--;
93 | ret = 0;
94 | }
95 | }
96 |
97 | return ret;
98 | }
99 |
100 | /**
101 | * @brief Unlinks a diskio driver and decrements the number of active linked
102 | * drivers.
103 | * @param path: pointer to the logical drive path
104 | * @retval Returns 0 in case of success, otherwise 1.
105 | */
106 | uint8_t FATFS_UnLinkDriver(char *path)
107 | {
108 | return FATFS_UnLinkDriverEx(path, 0);
109 | }
110 |
111 | /**
112 | * @brief Gets number of linked drivers to the FatFs module.
113 | * @param None
114 | * @retval Number of attached drivers.
115 | */
116 | uint8_t FATFS_GetAttachedDriversNbr(void)
117 | {
118 | return disk.nbr;
119 | }
120 |
121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
122 |
123 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/ff_gen_drv.h:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file ff_gen_drv.h
4 | * @author MCD Application Team
5 | * @brief Header for ff_gen_drv.c module.
6 | *****************************************************************************
7 | * @attention
8 | *
9 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
10 | *
11 | * This software component is licensed by ST under BSD 3-Clause license,
12 | * the "License"; You may not use this file except in compliance with the
13 | * License. You may obtain a copy of the License at:
14 | * opensource.org/licenses/BSD-3-Clause
15 | *
16 | ******************************************************************************
17 | **/
18 |
19 | /* Define to prevent recursive inclusion -------------------------------------*/
20 | #ifndef __FF_GEN_DRV_H
21 | #define __FF_GEN_DRV_H
22 |
23 | #ifdef __cplusplus
24 | extern "C" {
25 | #endif
26 |
27 | /* Includes ------------------------------------------------------------------*/
28 | #include "diskio.h"
29 | #include "ff.h"
30 | #include "stdint.h"
31 |
32 |
33 | /* Exported types ------------------------------------------------------------*/
34 |
35 | /**
36 | * @brief Disk IO Driver structure definition
37 | */
38 | typedef struct
39 | {
40 | DSTATUS (*disk_initialize) (BYTE); /*!< Initialize Disk Drive */
41 | DSTATUS (*disk_status) (BYTE); /*!< Get Disk Status */
42 | DRESULT (*disk_read) (BYTE, BYTE*, DWORD, UINT); /*!< Read Sector(s) */
43 | #if _USE_WRITE == 1
44 | DRESULT (*disk_write) (BYTE, const BYTE*, DWORD, UINT); /*!< Write Sector(s) when _USE_WRITE = 0 */
45 | #endif /* _USE_WRITE == 1 */
46 | #if _USE_IOCTL == 1
47 | DRESULT (*disk_ioctl) (BYTE, BYTE, void*); /*!< I/O control operation when _USE_IOCTL = 1 */
48 | #endif /* _USE_IOCTL == 1 */
49 |
50 | }Diskio_drvTypeDef;
51 |
52 | /**
53 | * @brief Global Disk IO Drivers structure definition
54 | */
55 | typedef struct
56 | {
57 | uint8_t is_initialized[_VOLUMES];
58 | const Diskio_drvTypeDef *drv[_VOLUMES];
59 | uint8_t lun[_VOLUMES];
60 | volatile uint8_t nbr;
61 |
62 | }Disk_drvTypeDef;
63 |
64 | /* Exported constants --------------------------------------------------------*/
65 | /* Exported macro ------------------------------------------------------------*/
66 | /* Exported functions ------------------------------------------------------- */
67 | uint8_t FATFS_LinkDriver(const Diskio_drvTypeDef *drv, char *path);
68 | uint8_t FATFS_UnLinkDriver(char *path);
69 | uint8_t FATFS_LinkDriverEx(const Diskio_drvTypeDef *drv, char *path, BYTE lun);
70 | uint8_t FATFS_UnLinkDriverEx(char *path, BYTE lun);
71 | uint8_t FATFS_GetAttachedDriversNbr(void);
72 |
73 | #ifdef __cplusplus
74 | }
75 | #endif
76 |
77 | #endif /* __FF_GEN_DRV_H */
78 |
79 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
80 |
81 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/integer.h:
--------------------------------------------------------------------------------
1 | /*-------------------------------------------*/
2 | /* Integer type definitions for FatFs module */
3 | /*-------------------------------------------*/
4 |
5 | #ifndef _FF_INTEGER
6 | #define _FF_INTEGER
7 |
8 | #ifdef _WIN32 /* FatFs development platform */
9 |
10 | #include
11 | #include
12 | typedef unsigned __int64 QWORD;
13 |
14 |
15 | #else /* Embedded platform */
16 |
17 | /* These types MUST be 16-bit or 32-bit */
18 | typedef int INT;
19 | typedef unsigned int UINT;
20 |
21 | /* This type MUST be 8-bit */
22 | typedef unsigned char BYTE;
23 |
24 | /* These types MUST be 16-bit */
25 | typedef short SHORT;
26 | typedef unsigned short WORD;
27 | typedef unsigned short WCHAR;
28 |
29 | /* These types MUST be 32-bit */
30 | typedef long LONG;
31 | typedef unsigned long DWORD;
32 |
33 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */
34 | typedef unsigned long long QWORD;
35 |
36 | #endif
37 |
38 | #endif
39 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/Middlewares/Third_Party/FatFs/src/option/syscall.c:
--------------------------------------------------------------------------------
1 | /*------------------------------------------------------------------------*/
2 | /* Sample code of OS dependent controls for FatFs */
3 | /* (C)ChaN, 2014 */
4 | /* Portions COPYRIGHT 2017 STMicroelectronics */
5 | /* Portions Copyright (C) 2014, ChaN, all right reserved */
6 | /*------------------------------------------------------------------------*/
7 |
8 | /**
9 | ******************************************************************************
10 | * @attention
11 | *
12 | * Copyright (c) 2017 STMicroelectronics. All rights reserved.
13 | *
14 | * This software component is licensed by ST under BSD 3-Clause license,
15 | * the "License"; You may not use this file except in compliance with the
16 | * License. You may obtain a copy of the License at:
17 | * opensource.org/licenses/BSD-3-Clause
18 | *
19 | ******************************************************************************
20 | **/
21 |
22 |
23 |
24 | #include "../ff.h"
25 |
26 |
27 | #if _FS_REENTRANT
28 | /*------------------------------------------------------------------------*/
29 | /* Create a Synchronization Object */
30 | /*------------------------------------------------------------------------*/
31 | /* This function is called in f_mount() function to create a new
32 | / synchronization object, such as semaphore and mutex. When a 0 is returned,
33 | / the f_mount() function fails with FR_INT_ERR.
34 | */
35 |
36 | int ff_cre_syncobj ( /* 1:Function succeeded, 0:Could not create the sync object */
37 | BYTE vol, /* Corresponding volume (logical drive number) */
38 | _SYNC_t *sobj /* Pointer to return the created sync object */
39 | )
40 | {
41 |
42 | int ret;
43 | #if _USE_MUTEX
44 |
45 | #if (osCMSIS < 0x20000U)
46 | osMutexDef(MTX);
47 | *sobj = osMutexCreate(osMutex(MTX));
48 | #else
49 | *sobj = osMutexNew(NULL);
50 | #endif
51 |
52 | #else
53 |
54 | #if (osCMSIS < 0x20000U)
55 | osSemaphoreDef(SEM);
56 | *sobj = osSemaphoreCreate(osSemaphore(SEM), 1);
57 | #else
58 | *sobj = osSemaphoreNew(1, 1, NULL);
59 | #endif
60 |
61 | #endif
62 | ret = (*sobj != NULL);
63 |
64 | return ret;
65 | }
66 |
67 |
68 |
69 | /*------------------------------------------------------------------------*/
70 | /* Delete a Synchronization Object */
71 | /*------------------------------------------------------------------------*/
72 | /* This function is called in f_mount() function to delete a synchronization
73 | / object that created with ff_cre_syncobj() function. When a 0 is returned,
74 | / the f_mount() function fails with FR_INT_ERR.
75 | */
76 |
77 | int ff_del_syncobj ( /* 1:Function succeeded, 0:Could not delete due to any error */
78 | _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */
79 | )
80 | {
81 | #if _USE_MUTEX
82 | osMutexDelete (sobj);
83 | #else
84 | osSemaphoreDelete (sobj);
85 | #endif
86 | return 1;
87 | }
88 |
89 |
90 |
91 | /*------------------------------------------------------------------------*/
92 | /* Request Grant to Access the Volume */
93 | /*------------------------------------------------------------------------*/
94 | /* This function is called on entering file functions to lock the volume.
95 | / When a 0 is returned, the file function fails with FR_TIMEOUT.
96 | */
97 |
98 | int ff_req_grant ( /* 1:Got a grant to access the volume, 0:Could not get a grant */
99 | _SYNC_t sobj /* Sync object to wait */
100 | )
101 | {
102 | int ret = 0;
103 | #if (osCMSIS < 0x20000U)
104 |
105 | #if _USE_MUTEX
106 | if(osMutexWait(sobj, _FS_TIMEOUT) == osOK)
107 | #else
108 | if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK)
109 | #endif
110 |
111 | #else
112 |
113 | #if _USE_MUTEX
114 | if(osMutexAcquire(sobj, _FS_TIMEOUT) == osOK)
115 | #else
116 | if(osSemaphoreAcquire(sobj, _FS_TIMEOUT) == osOK)
117 | #endif
118 |
119 | #endif
120 | {
121 | ret = 1;
122 | }
123 |
124 | return ret;
125 | }
126 |
127 |
128 |
129 | /*------------------------------------------------------------------------*/
130 | /* Release Grant to Access the Volume */
131 | /*------------------------------------------------------------------------*/
132 | /* This function is called on leaving file functions to unlock the volume.
133 | */
134 |
135 | void ff_rel_grant (
136 | _SYNC_t sobj /* Sync object to be signaled */
137 | )
138 | {
139 | #if _USE_MUTEX
140 | osMutexRelease(sobj);
141 | #else
142 | osSemaphoreRelease(sobj);
143 | #endif
144 | }
145 |
146 | #endif
147 |
148 |
149 |
150 |
151 | #if _USE_LFN == 3 /* LFN with a working buffer on the heap */
152 | /*------------------------------------------------------------------------*/
153 | /* Allocate a memory block */
154 | /*------------------------------------------------------------------------*/
155 | /* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE.
156 | */
157 |
158 | void* ff_memalloc ( /* Returns pointer to the allocated memory block */
159 | UINT msize /* Number of bytes to allocate */
160 | )
161 | {
162 | return ff_malloc(msize); /* Allocate a new memory block with POSIX API */
163 | }
164 |
165 |
166 | /*------------------------------------------------------------------------*/
167 | /* Free a memory block */
168 | /*------------------------------------------------------------------------*/
169 |
170 | void ff_memfree (
171 | void* mblock /* Pointer to the memory block to free */
172 | )
173 | {
174 | ff_free(mblock); /* Discard the memory block with POSIX API */
175 | }
176 |
177 | #endif
178 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/STM32F412CEUX_FLASH.ld:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file LinkerScript.ld
4 | * @author Auto-generated by STM32CubeIDE
5 | * @brief Linker script for STM32F412CEUx Device from STM32F4 series
6 | * 512Kbytes FLASH
7 | * 256Kbytes RAM
8 | *
9 | * Set heap size, stack size and stack location according
10 | * to application requirements.
11 | *
12 | * Set memory bank area and size if external memory is used
13 | ******************************************************************************
14 | * @attention
15 | *
16 | * © Copyright (c) 2020 STMicroelectronics.
17 | * All rights reserved.
18 | *
19 | * This software component is licensed by ST under BSD 3-Clause license,
20 | * the "License"; You may not use this file except in compliance with the
21 | * License. You may obtain a copy of the License at:
22 | * opensource.org/licenses/BSD-3-Clause
23 | *
24 | ******************************************************************************
25 | */
26 |
27 | /* Entry Point */
28 | ENTRY(Reset_Handler)
29 |
30 | /* Highest address of the user mode stack */
31 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
32 |
33 | _Min_Heap_Size = 0x200 ; /* required amount of heap */
34 | _Min_Stack_Size = 0x400 ; /* required amount of stack */
35 |
36 | /* Memories definition */
37 | MEMORY
38 | {
39 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
40 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
41 | }
42 |
43 | /* Sections */
44 | SECTIONS
45 | {
46 | /* The startup code into "FLASH" Rom type memory */
47 | .isr_vector :
48 | {
49 | . = ALIGN(4);
50 | KEEP(*(.isr_vector)) /* Startup code */
51 | . = ALIGN(4);
52 | } >FLASH
53 |
54 | /* The program code and other data into "FLASH" Rom type memory */
55 | .text :
56 | {
57 | . = ALIGN(4);
58 | *(.text) /* .text sections (code) */
59 | *(.text*) /* .text* sections (code) */
60 | *(.glue_7) /* glue arm to thumb code */
61 | *(.glue_7t) /* glue thumb to arm code */
62 | *(.eh_frame)
63 |
64 | KEEP (*(.init))
65 | KEEP (*(.fini))
66 |
67 | . = ALIGN(4);
68 | _etext = .; /* define a global symbols at end of code */
69 | } >FLASH
70 |
71 | /* Constant data into "FLASH" Rom type memory */
72 | .rodata :
73 | {
74 | . = ALIGN(4);
75 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
76 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
77 | . = ALIGN(4);
78 | } >FLASH
79 |
80 | .ARM.extab : {
81 | . = ALIGN(4);
82 | *(.ARM.extab* .gnu.linkonce.armextab.*)
83 | . = ALIGN(4);
84 | } >FLASH
85 |
86 | .ARM : {
87 | . = ALIGN(4);
88 | __exidx_start = .;
89 | *(.ARM.exidx*)
90 | __exidx_end = .;
91 | . = ALIGN(4);
92 | } >FLASH
93 |
94 | .preinit_array :
95 | {
96 | . = ALIGN(4);
97 | PROVIDE_HIDDEN (__preinit_array_start = .);
98 | KEEP (*(.preinit_array*))
99 | PROVIDE_HIDDEN (__preinit_array_end = .);
100 | . = ALIGN(4);
101 | } >FLASH
102 |
103 | .init_array :
104 | {
105 | . = ALIGN(4);
106 | PROVIDE_HIDDEN (__init_array_start = .);
107 | KEEP (*(SORT(.init_array.*)))
108 | KEEP (*(.init_array*))
109 | PROVIDE_HIDDEN (__init_array_end = .);
110 | . = ALIGN(4);
111 | } >FLASH
112 |
113 | .fini_array :
114 | {
115 | . = ALIGN(4);
116 | PROVIDE_HIDDEN (__fini_array_start = .);
117 | KEEP (*(SORT(.fini_array.*)))
118 | KEEP (*(.fini_array*))
119 | PROVIDE_HIDDEN (__fini_array_end = .);
120 | . = ALIGN(4);
121 | } >FLASH
122 |
123 | /* Used by the startup to initialize data */
124 | _sidata = LOADADDR(.data);
125 |
126 | /* Initialized data sections into "RAM" Ram type memory */
127 | .data :
128 | {
129 | . = ALIGN(4);
130 | _sdata = .; /* create a global symbol at data start */
131 | *(.data) /* .data sections */
132 | *(.data*) /* .data* sections */
133 | *(.RamFunc) /* .RamFunc sections */
134 | *(.RamFunc*) /* .RamFunc* sections */
135 |
136 | . = ALIGN(4);
137 | _edata = .; /* define a global symbol at data end */
138 |
139 | } >RAM AT> FLASH
140 |
141 | /* Uninitialized data section into "RAM" Ram type memory */
142 | . = ALIGN(4);
143 | .bss :
144 | {
145 | /* This is used by the startup in order to initialize the .bss section */
146 | _sbss = .; /* define a global symbol at bss start */
147 | __bss_start__ = _sbss;
148 | *(.bss)
149 | *(.bss*)
150 | *(COMMON)
151 |
152 | . = ALIGN(4);
153 | _ebss = .; /* define a global symbol at bss end */
154 | __bss_end__ = _ebss;
155 | } >RAM
156 |
157 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
158 | ._user_heap_stack :
159 | {
160 | . = ALIGN(8);
161 | PROVIDE ( end = . );
162 | PROVIDE ( _end = . );
163 | . = . + _Min_Heap_Size;
164 | . = . + _Min_Stack_Size;
165 | . = ALIGN(8);
166 | } >RAM
167 |
168 | /* Remove information from the compiler libraries */
169 | /DISCARD/ :
170 | {
171 | libc.a ( * )
172 | libm.a ( * )
173 | libgcc.a ( * )
174 | }
175 |
176 | .ARM.attributes 0 : { *(.ARM.attributes) }
177 | }
178 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/STM32F412CEUX_RAM.ld:
--------------------------------------------------------------------------------
1 | /**
2 | ******************************************************************************
3 | * @file LinkerScript.ld
4 | * @author Auto-generated by STM32CubeIDE
5 | * @brief Linker script for STM32F412CEUx Device from STM32F4 series
6 | * 512Kbytes FLASH
7 | * 256Kbytes RAM
8 | *
9 | * Set heap size, stack size and stack location according
10 | * to application requirements.
11 | *
12 | * Set memory bank area and size if external memory is used
13 | ******************************************************************************
14 | * @attention
15 | *
16 | * © Copyright (c) 2020 STMicroelectronics.
17 | * All rights reserved.
18 | *
19 | * This software component is licensed by ST under BSD 3-Clause license,
20 | * the "License"; You may not use this file except in compliance with the
21 | * License. You may obtain a copy of the License at:
22 | * opensource.org/licenses/BSD-3-Clause
23 | *
24 | ******************************************************************************
25 | */
26 |
27 | /* Entry Point */
28 | ENTRY(Reset_Handler)
29 |
30 | /* Highest address of the user mode stack */
31 | _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
32 |
33 | _Min_Heap_Size = 0x200; /* required amount of heap */
34 | _Min_Stack_Size = 0x400; /* required amount of stack */
35 |
36 | /* Memories definition */
37 | MEMORY
38 | {
39 | RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 256K
40 | FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
41 | }
42 |
43 | /* Sections */
44 | SECTIONS
45 | {
46 | /* The startup code into "RAM" Ram type memory */
47 | .isr_vector :
48 | {
49 | . = ALIGN(4);
50 | KEEP(*(.isr_vector)) /* Startup code */
51 | . = ALIGN(4);
52 | } >RAM
53 |
54 | /* The program code and other data into "RAM" Ram type memory */
55 | .text :
56 | {
57 | . = ALIGN(4);
58 | *(.text) /* .text sections (code) */
59 | *(.text*) /* .text* sections (code) */
60 | *(.glue_7) /* glue arm to thumb code */
61 | *(.glue_7t) /* glue thumb to arm code */
62 | *(.eh_frame)
63 | *(.RamFunc) /* .RamFunc sections */
64 | *(.RamFunc*) /* .RamFunc* sections */
65 |
66 | KEEP (*(.init))
67 | KEEP (*(.fini))
68 |
69 | . = ALIGN(4);
70 | _etext = .; /* define a global symbols at end of code */
71 | } >RAM
72 |
73 | /* Constant data into "RAM" Ram type memory */
74 | .rodata :
75 | {
76 | . = ALIGN(4);
77 | *(.rodata) /* .rodata sections (constants, strings, etc.) */
78 | *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
79 | . = ALIGN(4);
80 | } >RAM
81 |
82 | .ARM.extab : {
83 | . = ALIGN(4);
84 | *(.ARM.extab* .gnu.linkonce.armextab.*)
85 | . = ALIGN(4);
86 | } >RAM
87 |
88 | .ARM : {
89 | . = ALIGN(4);
90 | __exidx_start = .;
91 | *(.ARM.exidx*)
92 | __exidx_end = .;
93 | . = ALIGN(4);
94 | } >RAM
95 |
96 | .preinit_array :
97 | {
98 | . = ALIGN(4);
99 | PROVIDE_HIDDEN (__preinit_array_start = .);
100 | KEEP (*(.preinit_array*))
101 | PROVIDE_HIDDEN (__preinit_array_end = .);
102 | . = ALIGN(4);
103 | } >RAM
104 |
105 | .init_array :
106 | {
107 | . = ALIGN(4);
108 | PROVIDE_HIDDEN (__init_array_start = .);
109 | KEEP (*(SORT(.init_array.*)))
110 | KEEP (*(.init_array*))
111 | PROVIDE_HIDDEN (__init_array_end = .);
112 | . = ALIGN(4);
113 | } >RAM
114 |
115 | .fini_array :
116 | {
117 | . = ALIGN(4);
118 | PROVIDE_HIDDEN (__fini_array_start = .);
119 | KEEP (*(SORT(.fini_array.*)))
120 | KEEP (*(.fini_array*))
121 | PROVIDE_HIDDEN (__fini_array_end = .);
122 | . = ALIGN(4);
123 | } >RAM
124 |
125 | /* Used by the startup to initialize data */
126 | _sidata = LOADADDR(.data);
127 |
128 | /* Initialized data sections into "RAM" Ram type memory */
129 | .data :
130 | {
131 | . = ALIGN(4);
132 | _sdata = .; /* create a global symbol at data start */
133 | *(.data) /* .data sections */
134 | *(.data*) /* .data* sections */
135 |
136 | . = ALIGN(4);
137 | _edata = .; /* define a global symbol at data end */
138 |
139 | } >RAM
140 |
141 | /* Uninitialized data section into "RAM" Ram type memory */
142 | . = ALIGN(4);
143 | .bss :
144 | {
145 | /* This is used by the startup in order to initialize the .bss section */
146 | _sbss = .; /* define a global symbol at bss start */
147 | __bss_start__ = _sbss;
148 | *(.bss)
149 | *(.bss*)
150 | *(COMMON)
151 |
152 | . = ALIGN(4);
153 | _ebss = .; /* define a global symbol at bss end */
154 | __bss_end__ = _ebss;
155 | } >RAM
156 |
157 | /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
158 | ._user_heap_stack :
159 | {
160 | . = ALIGN(8);
161 | PROVIDE ( end = . );
162 | PROVIDE ( _end = . );
163 | . = . + _Min_Heap_Size;
164 | . = . + _Min_Stack_Size;
165 | . = ALIGN(8);
166 | } >RAM
167 |
168 | /* Remove information from the compiler libraries */
169 | /DISCARD/ :
170 | {
171 | libc.a ( * )
172 | libm.a ( * )
173 | libgcc.a ( * )
174 | }
175 |
176 | .ARM.attributes 0 : { *(.ARM.attributes) }
177 | }
178 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/App/usb_device.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usb_device.c
5 | * @version : v1.0_Cube
6 | * @brief : This file implements the USB Device
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 |
24 | #include "usb_device.h"
25 | #include "usbd_core.h"
26 | #include "usbd_desc.h"
27 | #include "usbd_msc.h"
28 | #include "usbd_storage_if.h"
29 |
30 | /* USER CODE BEGIN Includes */
31 |
32 | /* USER CODE END Includes */
33 |
34 | /* USER CODE BEGIN PV */
35 | /* Private variables ---------------------------------------------------------*/
36 |
37 | /* USER CODE END PV */
38 |
39 | /* USER CODE BEGIN PFP */
40 | /* Private function prototypes -----------------------------------------------*/
41 |
42 | /* USER CODE END PFP */
43 |
44 | /* USB Device Core handle declaration. */
45 | USBD_HandleTypeDef hUsbDeviceFS;
46 |
47 | /*
48 | * -- Insert your variables declaration here --
49 | */
50 | /* USER CODE BEGIN 0 */
51 |
52 | /* USER CODE END 0 */
53 |
54 | /*
55 | * -- Insert your external function declaration here --
56 | */
57 | /* USER CODE BEGIN 1 */
58 |
59 | /* USER CODE END 1 */
60 |
61 | /**
62 | * Init USB device Library, add supported class and start the library
63 | * @retval None
64 | */
65 | void MX_USB_DEVICE_Init(void)
66 | {
67 | /* USER CODE BEGIN USB_DEVICE_Init_PreTreatment */
68 |
69 | /* USER CODE END USB_DEVICE_Init_PreTreatment */
70 |
71 | /* Init Device Library, add supported class and start the library. */
72 | if (USBD_Init(&hUsbDeviceFS, &FS_Desc, DEVICE_FS) != USBD_OK)
73 | {
74 | Error_Handler();
75 | }
76 | if (USBD_RegisterClass(&hUsbDeviceFS, &USBD_MSC) != USBD_OK)
77 | {
78 | Error_Handler();
79 | }
80 | if (USBD_MSC_RegisterStorage(&hUsbDeviceFS, &USBD_Storage_Interface_fops_FS) != USBD_OK)
81 | {
82 | Error_Handler();
83 | }
84 | if (USBD_Start(&hUsbDeviceFS) != USBD_OK)
85 | {
86 | Error_Handler();
87 | }
88 |
89 | /* USER CODE BEGIN USB_DEVICE_Init_PostTreatment */
90 |
91 | /* USER CODE END USB_DEVICE_Init_PostTreatment */
92 | }
93 |
94 | /**
95 | * @}
96 | */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
103 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/App/usb_device.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usb_device.h
5 | * @version : v1.0_Cube
6 | * @brief : Header for usb_device.c file.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __USB_DEVICE__H__
24 | #define __USB_DEVICE__H__
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "stm32f4xx.h"
32 | #include "stm32f4xx_hal.h"
33 | #include "usbd_def.h"
34 |
35 | /* USER CODE BEGIN INCLUDE */
36 |
37 | /* USER CODE END INCLUDE */
38 |
39 | /** @addtogroup USBD_OTG_DRIVER
40 | * @{
41 | */
42 |
43 | /** @defgroup USBD_DEVICE USBD_DEVICE
44 | * @brief Device file for Usb otg low level driver.
45 | * @{
46 | */
47 |
48 | /** @defgroup USBD_DEVICE_Exported_Variables USBD_DEVICE_Exported_Variables
49 | * @brief Public variables.
50 | * @{
51 | */
52 |
53 | /* Private variables ---------------------------------------------------------*/
54 | /* USER CODE BEGIN PV */
55 |
56 | /* USER CODE END PV */
57 |
58 | /* Private function prototypes -----------------------------------------------*/
59 | /* USER CODE BEGIN PFP */
60 |
61 | /* USER CODE END PFP */
62 |
63 | /*
64 | * -- Insert your variables declaration here --
65 | */
66 | /* USER CODE BEGIN VARIABLES */
67 |
68 | /* USER CODE END VARIABLES */
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBD_DEVICE_Exported_FunctionsPrototype USBD_DEVICE_Exported_FunctionsPrototype
74 | * @brief Declaration of public functions for Usb device.
75 | * @{
76 | */
77 |
78 | /** USB Device initialization function. */
79 | void MX_USB_DEVICE_Init(void);
80 |
81 | /*
82 | * -- Insert functions declaration here --
83 | */
84 | /* USER CODE BEGIN FD */
85 |
86 | /* USER CODE END FD */
87 | /**
88 | * @}
89 | */
90 |
91 | /**
92 | * @}
93 | */
94 |
95 | /**
96 | * @}
97 | */
98 |
99 | #ifdef __cplusplus
100 | }
101 | #endif
102 |
103 | #endif /* __USB_DEVICE__H__ */
104 |
105 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
106 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/App/usbd_desc.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usbd_desc.c
5 | * @version : v1.0_Cube
6 | * @brief : Header for usbd_conf.c file.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 | /* Define to prevent recursive inclusion -------------------------------------*/
22 | #ifndef __USBD_DESC__C__
23 | #define __USBD_DESC__C__
24 |
25 | #ifdef __cplusplus
26 | extern "C" {
27 | #endif
28 |
29 | /* Includes ------------------------------------------------------------------*/
30 | #include "usbd_def.h"
31 |
32 | /* USER CODE BEGIN INCLUDE */
33 |
34 | /* USER CODE END INCLUDE */
35 |
36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
37 | * @{
38 | */
39 |
40 | /** @defgroup USBD_DESC USBD_DESC
41 | * @brief Usb device descriptors module.
42 | * @{
43 | */
44 |
45 | /** @defgroup USBD_DESC_Exported_Constants USBD_DESC_Exported_Constants
46 | * @brief Constants.
47 | * @{
48 | */
49 | #define DEVICE_ID1 (UID_BASE)
50 | #define DEVICE_ID2 (UID_BASE + 0x4)
51 | #define DEVICE_ID3 (UID_BASE + 0x8)
52 |
53 | #define USB_SIZ_STRING_SERIAL 0x1A
54 |
55 | /* USER CODE BEGIN EXPORTED_CONSTANTS */
56 |
57 | /* USER CODE END EXPORTED_CONSTANTS */
58 |
59 | /**
60 | * @}
61 | */
62 |
63 | /** @defgroup USBD_DESC_Exported_Defines USBD_DESC_Exported_Defines
64 | * @brief Defines.
65 | * @{
66 | */
67 |
68 | /* USER CODE BEGIN EXPORTED_DEFINES */
69 |
70 | /* USER CODE END EXPORTED_DEFINES */
71 |
72 | /**
73 | * @}
74 | */
75 |
76 | /** @defgroup USBD_DESC_Exported_TypesDefinitions USBD_DESC_Exported_TypesDefinitions
77 | * @brief Types.
78 | * @{
79 | */
80 |
81 | /* USER CODE BEGIN EXPORTED_TYPES */
82 |
83 | /* USER CODE END EXPORTED_TYPES */
84 |
85 | /**
86 | * @}
87 | */
88 |
89 | /** @defgroup USBD_DESC_Exported_Macros USBD_DESC_Exported_Macros
90 | * @brief Aliases.
91 | * @{
92 | */
93 |
94 | /* USER CODE BEGIN EXPORTED_MACRO */
95 |
96 | /* USER CODE END EXPORTED_MACRO */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /** @defgroup USBD_DESC_Exported_Variables USBD_DESC_Exported_Variables
103 | * @brief Public variables.
104 | * @{
105 | */
106 |
107 | /** Descriptor for the Usb device. */
108 | extern USBD_DescriptorsTypeDef FS_Desc;
109 |
110 | /* USER CODE BEGIN EXPORTED_VARIABLES */
111 |
112 | /* USER CODE END EXPORTED_VARIABLES */
113 |
114 | /**
115 | * @}
116 | */
117 |
118 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype USBD_DESC_Exported_FunctionsPrototype
119 | * @brief Public functions declaration.
120 | * @{
121 | */
122 |
123 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */
124 |
125 | /* USER CODE END EXPORTED_FUNCTIONS */
126 |
127 | /**
128 | * @}
129 | */
130 |
131 | /**
132 | * @}
133 | */
134 |
135 | /**
136 | * @}
137 | */
138 |
139 | #ifdef __cplusplus
140 | }
141 | #endif
142 |
143 | #endif /* __USBD_DESC__C__ */
144 |
145 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
146 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/App/usbd_storage_if.c:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usbd_storage_if.c
5 | * @version : v1.0_Cube
6 | * @brief : Memory management layer.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Includes ------------------------------------------------------------------*/
23 | #include "usbd_storage_if.h"
24 |
25 | /* USER CODE BEGIN INCLUDE */
26 | #include "bsp_driver_sd.h"
27 | /* USER CODE END INCLUDE */
28 |
29 | /* Private typedef -----------------------------------------------------------*/
30 | /* Private define ------------------------------------------------------------*/
31 | /* Private macro -------------------------------------------------------------*/
32 |
33 | /* USER CODE BEGIN PV */
34 | /* Private variables ---------------------------------------------------------*/
35 |
36 | /* USER CODE END PV */
37 |
38 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
39 | * @brief Usb device.
40 | * @{
41 | */
42 |
43 | /** @defgroup USBD_STORAGE
44 | * @brief Usb mass storage device module
45 | * @{
46 | */
47 |
48 | /** @defgroup USBD_STORAGE_Private_TypesDefinitions
49 | * @brief Private types.
50 | * @{
51 | */
52 |
53 | /* USER CODE BEGIN PRIVATE_TYPES */
54 |
55 | /* USER CODE END PRIVATE_TYPES */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /** @defgroup USBD_STORAGE_Private_Defines
62 | * @brief Private defines.
63 | * @{
64 | */
65 |
66 | #define STORAGE_LUN_NBR 1
67 | #define STORAGE_BLK_NBR 0x10000
68 | #define STORAGE_BLK_SIZ 0x200
69 |
70 | /* USER CODE BEGIN PRIVATE_DEFINES */
71 |
72 | //uint8_t buffer[STORAGE_BLK_NBR*STORAGE_BLK_SIZ];
73 |
74 | /* USER CODE END PRIVATE_DEFINES */
75 |
76 | /**
77 | * @}
78 | */
79 |
80 | /** @defgroup USBD_STORAGE_Private_Macros
81 | * @brief Private macros.
82 | * @{
83 | */
84 |
85 | /* USER CODE BEGIN PRIVATE_MACRO */
86 |
87 | /* USER CODE END PRIVATE_MACRO */
88 |
89 | /**
90 | * @}
91 | */
92 |
93 | /** @defgroup USBD_STORAGE_Private_Variables
94 | * @brief Private variables.
95 | * @{
96 | */
97 |
98 | /* USER CODE BEGIN INQUIRY_DATA_FS */
99 | /** USB Mass storage Standard Inquiry Data. */
100 | const int8_t STORAGE_Inquirydata_FS[] = {/* 36 */
101 |
102 | /* LUN 0 */
103 | 0x00,
104 | 0x80,
105 | 0x02,
106 | 0x02,
107 | (STANDARD_INQUIRY_DATA_LEN - 5),
108 | 0x00,
109 | 0x00,
110 | 0x00,
111 | 'S', 'T', 'M', ' ', ' ', ' ', ' ', ' ', /* Manufacturer : 8 bytes */
112 | 'P', 'r', 'o', 'd', 'u', 'c', 't', ' ', /* Product : 16 Bytes */
113 | ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ',
114 | '0', '.', '0' ,'1' /* Version : 4 Bytes */
115 | };
116 | /* USER CODE END INQUIRY_DATA_FS */
117 |
118 | /* USER CODE BEGIN PRIVATE_VARIABLES */
119 |
120 | /* USER CODE END PRIVATE_VARIABLES */
121 |
122 | /**
123 | * @}
124 | */
125 |
126 | /** @defgroup USBD_STORAGE_Exported_Variables
127 | * @brief Public variables.
128 | * @{
129 | */
130 |
131 | extern USBD_HandleTypeDef hUsbDeviceFS;
132 |
133 | /* USER CODE BEGIN EXPORTED_VARIABLES */
134 |
135 | /* USER CODE END EXPORTED_VARIABLES */
136 |
137 | /**
138 | * @}
139 | */
140 |
141 | /** @defgroup USBD_STORAGE_Private_FunctionPrototypes
142 | * @brief Private functions declaration.
143 | * @{
144 | */
145 |
146 | static int8_t STORAGE_Init_FS(uint8_t lun);
147 | static int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size);
148 | static int8_t STORAGE_IsReady_FS(uint8_t lun);
149 | static int8_t STORAGE_IsWriteProtected_FS(uint8_t lun);
150 | static int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
151 | static int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len);
152 | static int8_t STORAGE_GetMaxLun_FS(void);
153 |
154 | /* USER CODE BEGIN PRIVATE_FUNCTIONS_DECLARATION */
155 |
156 | /* USER CODE END PRIVATE_FUNCTIONS_DECLARATION */
157 |
158 | /**
159 | * @}
160 | */
161 |
162 | USBD_StorageTypeDef USBD_Storage_Interface_fops_FS =
163 | {
164 | STORAGE_Init_FS,
165 | STORAGE_GetCapacity_FS,
166 | STORAGE_IsReady_FS,
167 | STORAGE_IsWriteProtected_FS,
168 | STORAGE_Read_FS,
169 | STORAGE_Write_FS,
170 | STORAGE_GetMaxLun_FS,
171 | (int8_t *)STORAGE_Inquirydata_FS
172 | };
173 |
174 | /* Private functions ---------------------------------------------------------*/
175 | /**
176 | * @brief Initializes over USB FS IP
177 | * @param lun:
178 | * @retval USBD_OK if all operations are OK else USBD_FAIL
179 | */
180 | int8_t STORAGE_Init_FS(uint8_t lun)
181 | {
182 | /* USER CODE BEGIN 2 */
183 | BSP_SD_Init();
184 | return (USBD_OK);
185 | /* USER CODE END 2 */
186 | }
187 |
188 | /**
189 | * @brief .
190 | * @param lun: .
191 | * @param block_num: .
192 | * @param block_size: .
193 | * @retval USBD_OK if all operations are OK else USBD_FAIL
194 | */
195 | int8_t STORAGE_GetCapacity_FS(uint8_t lun, uint32_t *block_num, uint16_t *block_size)
196 | {
197 | /* USER CODE BEGIN 3 */
198 | //*block_num = STORAGE_BLK_NBR;
199 | //*block_size = STORAGE_BLK_SIZ;
200 |
201 |
202 | // *block_num = STORAGE_BLK_NBR - 1;
203 | // *block_size = STORAGE_BLK_SIZ;
204 |
205 | HAL_SD_CardInfoTypeDef CardInfo;
206 | BSP_SD_GetCardInfo(&CardInfo);
207 |
208 | *block_num = CardInfo.LogBlockNbr - 1;
209 | *block_size = CardInfo.LogBlockSize;
210 |
211 | return (USBD_OK);
212 | /* USER CODE END 3 */
213 | }
214 |
215 | /**
216 | * @brief .
217 | * @param lun: .
218 | * @retval USBD_OK if all operations are OK else USBD_FAIL
219 | */
220 | int8_t STORAGE_IsReady_FS(uint8_t lun)
221 | {
222 | /* USER CODE BEGIN 4 */
223 | return (USBD_OK);
224 | /* USER CODE END 4 */
225 | }
226 |
227 | /**
228 | * @brief .
229 | * @param lun: .
230 | * @retval USBD_OK if all operations are OK else USBD_FAIL
231 | */
232 | int8_t STORAGE_IsWriteProtected_FS(uint8_t lun)
233 | {
234 | /* USER CODE BEGIN 5 */
235 | return (USBD_OK);
236 | /* USER CODE END 5 */
237 | }
238 |
239 | /**
240 | * @brief .
241 | * @param lun: .
242 | * @retval USBD_OK if all operations are OK else USBD_FAIL
243 | */
244 | int8_t STORAGE_Read_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
245 | {
246 | /* USER CODE BEGIN 6 */
247 | //memcpy(buf,&buffer[blk_addr*STORAGE_BLK_SIZ],blk_len*STORAGE_BLK_SIZ);
248 |
249 |
250 | if(BSP_SD_ReadBlocks((uint32_t*)buf,(uint32_t) (blk_addr),blk_len, SDMMC_DATATIMEOUT) == MSD_OK){
251 | /* wait until the read operation is finished */
252 | while(BSP_SD_GetCardState()!= MSD_OK)
253 | {
254 | }
255 | return USBD_OK;
256 | }
257 | else
258 | return USBD_FAIL;
259 |
260 | //return (USBD_OK);
261 | /* USER CODE END 6 */
262 | }
263 |
264 | /**
265 | * @brief .
266 | * @param lun: .
267 | * @retval USBD_OK if all operations are OK else USBD_FAIL
268 | */
269 | int8_t STORAGE_Write_FS(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len)
270 | {
271 | /* USER CODE BEGIN 7 */
272 | //memcpy(&buffer[blk_addr*STORAGE_BLK_SIZ],buf,blk_len*STORAGE_BLK_SIZ);
273 |
274 | if(BSP_SD_WriteBlocks((uint32_t*)buf,(uint32_t)(blk_addr),blk_len, SDMMC_DATATIMEOUT) == MSD_OK)
275 | {
276 | /* wait until the Write operation is finished */
277 | while(BSP_SD_GetCardState() != MSD_OK)
278 | {
279 | }
280 | return USBD_OK;
281 | }
282 | else
283 | return USBD_FAIL;
284 | //return (USBD_OK);
285 | /* USER CODE END 7 */
286 | }
287 |
288 | /**
289 | * @brief .
290 | * @param None
291 | * @retval .
292 | */
293 | int8_t STORAGE_GetMaxLun_FS(void)
294 | {
295 | /* USER CODE BEGIN 8 */
296 | return (STORAGE_LUN_NBR - 1);
297 | /* USER CODE END 8 */
298 | }
299 |
300 | /* USER CODE BEGIN PRIVATE_FUNCTIONS_IMPLEMENTATION */
301 |
302 | /* USER CODE END PRIVATE_FUNCTIONS_IMPLEMENTATION */
303 |
304 | /**
305 | * @}
306 | */
307 |
308 | /**
309 | * @}
310 | */
311 |
312 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
313 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/App/usbd_storage_if.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usbd_storage_if.h
5 | * @version : v1.0_Cube
6 | * @brief : Header for usbd_storage_if.c file.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __USBD_STORAGE_IF_H__
24 | #define __USBD_STORAGE_IF_H__
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include "usbd_msc.h"
32 |
33 | /* USER CODE BEGIN INCLUDE */
34 |
35 | /* USER CODE END INCLUDE */
36 |
37 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY
38 | * @brief For Usb device.
39 | * @{
40 | */
41 |
42 | /** @defgroup USBD_STORAGE USBD_STORAGE
43 | * @brief Header file for the usb_storage_if.c file
44 | * @{
45 | */
46 |
47 | /** @defgroup USBD_STORAGE_Exported_Defines USBD_STORAGE_Exported_Defines
48 | * @brief Defines.
49 | * @{
50 | */
51 |
52 | /* USER CODE BEGIN EXPORTED_DEFINES */
53 |
54 | /* USER CODE END EXPORTED_DEFINES */
55 |
56 | /**
57 | * @}
58 | */
59 |
60 | /** @defgroup USBD_STORAGE_Exported_Types USBD_STORAGE_Exported_Types
61 | * @brief Types.
62 | * @{
63 | */
64 |
65 | /* USER CODE BEGIN EXPORTED_TYPES */
66 |
67 | /* USER CODE END EXPORTED_TYPES */
68 |
69 | /**
70 | * @}
71 | */
72 |
73 | /** @defgroup USBD_STORAGE_Exported_Macros USBD_STORAGE_Exported_Macros
74 | * @brief Aliases.
75 | * @{
76 | */
77 |
78 | /* USER CODE BEGIN EXPORTED_MACRO */
79 |
80 | /* USER CODE END EXPORTED_MACRO */
81 |
82 | /**
83 | * @}
84 | */
85 |
86 | /** @defgroup USBD_STORAGE_Exported_Variables USBD_STORAGE_Exported_Variables
87 | * @brief Public variables.
88 | * @{
89 | */
90 |
91 | /** STORAGE Interface callback. */
92 | extern USBD_StorageTypeDef USBD_Storage_Interface_fops_FS;
93 |
94 | /* USER CODE BEGIN EXPORTED_VARIABLES */
95 |
96 | /* USER CODE END EXPORTED_VARIABLES */
97 |
98 | /**
99 | * @}
100 | */
101 |
102 | /** @defgroup USBD_STORAGE_Exported_FunctionsPrototype USBD_STORAGE_Exported_FunctionsPrototype
103 | * @brief Public functions declaration.
104 | * @{
105 | */
106 |
107 | /* USER CODE BEGIN EXPORTED_FUNCTIONS */
108 |
109 | /* USER CODE END EXPORTED_FUNCTIONS */
110 |
111 | /**
112 | * @}
113 | */
114 |
115 | /**
116 | * @}
117 | */
118 |
119 | /**
120 | * @}
121 | */
122 |
123 | #ifdef __cplusplus
124 | }
125 | #endif
126 |
127 | #endif /* __USBD_STORAGE_IF_H__ */
128 |
129 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
130 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/USB_DEVICE/Target/usbd_conf.h:
--------------------------------------------------------------------------------
1 | /* USER CODE BEGIN Header */
2 | /**
3 | ******************************************************************************
4 | * @file : usbd_conf.h
5 | * @version : v1.0_Cube
6 | * @brief : Header for usbd_conf.c file.
7 | ******************************************************************************
8 | * @attention
9 | *
10 | * © Copyright (c) 2021 STMicroelectronics.
11 | * All rights reserved.
12 | *
13 | * This software component is licensed by ST under Ultimate Liberty license
14 | * SLA0044, the "License"; You may not use this file except in compliance with
15 | * the License. You may obtain a copy of the License at:
16 | * www.st.com/SLA0044
17 | *
18 | ******************************************************************************
19 | */
20 | /* USER CODE END Header */
21 |
22 | /* Define to prevent recursive inclusion -------------------------------------*/
23 | #ifndef __USBD_CONF__H__
24 | #define __USBD_CONF__H__
25 |
26 | #ifdef __cplusplus
27 | extern "C" {
28 | #endif
29 |
30 | /* Includes ------------------------------------------------------------------*/
31 | #include
32 | #include
33 | #include
34 | #include "main.h"
35 | #include "stm32f4xx.h"
36 | #include "stm32f4xx_hal.h"
37 |
38 | /* USER CODE BEGIN INCLUDE */
39 |
40 | /* USER CODE END INCLUDE */
41 |
42 | /** @addtogroup USBD_OTG_DRIVER
43 | * @brief Driver for Usb device.
44 | * @{
45 | */
46 |
47 | /** @defgroup USBD_CONF USBD_CONF
48 | * @brief Configuration file for Usb otg low level driver.
49 | * @{
50 | */
51 |
52 | /** @defgroup USBD_CONF_Exported_Variables USBD_CONF_Exported_Variables
53 | * @brief Public variables.
54 | * @{
55 | */
56 |
57 | /**
58 | * @}
59 | */
60 |
61 | /** @defgroup USBD_CONF_Exported_Defines USBD_CONF_Exported_Defines
62 | * @brief Defines for configuration of the Usb device.
63 | * @{
64 | */
65 |
66 | /*---------- -----------*/
67 | #define USBD_MAX_NUM_INTERFACES 1U
68 | /*---------- -----------*/
69 | #define USBD_MAX_NUM_CONFIGURATION 1U
70 | /*---------- -----------*/
71 | #define USBD_MAX_STR_DESC_SIZ 512U
72 | /*---------- -----------*/
73 | #define USBD_DEBUG_LEVEL 0U
74 | /*---------- -----------*/
75 | #define USBD_LPM_ENABLED 1U
76 | /*---------- -----------*/
77 | #define USBD_SELF_POWERED 1U
78 | /*---------- -----------*/
79 | #define MSC_MEDIA_PACKET 512U
80 |
81 | /****************************************/
82 | /* #define for FS and HS identification */
83 | #define DEVICE_FS 0
84 | #define DEVICE_HS 1
85 |
86 | /**
87 | * @}
88 | */
89 |
90 | /** @defgroup USBD_CONF_Exported_Macros USBD_CONF_Exported_Macros
91 | * @brief Aliases.
92 | * @{
93 | */
94 | /* Memory management macros make sure to use static memory allocation */
95 | /** Alias for memory allocation. */
96 |
97 | #define USBD_malloc (void *)USBD_static_malloc
98 |
99 | /** Alias for memory release. */
100 | #define USBD_free USBD_static_free
101 |
102 | /** Alias for memory set. */
103 | #define USBD_memset memset
104 |
105 | /** Alias for memory copy. */
106 | #define USBD_memcpy memcpy
107 |
108 | /** Alias for delay. */
109 | #define USBD_Delay HAL_Delay
110 |
111 | /* DEBUG macros */
112 |
113 | #if (USBD_DEBUG_LEVEL > 0)
114 | #define USBD_UsrLog(...) printf(__VA_ARGS__);\
115 | printf("\n");
116 | #else
117 | #define USBD_UsrLog(...)
118 | #endif
119 |
120 | #if (USBD_DEBUG_LEVEL > 1)
121 |
122 | #define USBD_ErrLog(...) printf("ERROR: ") ;\
123 | printf(__VA_ARGS__);\
124 | printf("\n");
125 | #else
126 | #define USBD_ErrLog(...)
127 | #endif
128 |
129 | #if (USBD_DEBUG_LEVEL > 2)
130 | #define USBD_DbgLog(...) printf("DEBUG : ") ;\
131 | printf(__VA_ARGS__);\
132 | printf("\n");
133 | #else
134 | #define USBD_DbgLog(...)
135 | #endif
136 |
137 | /**
138 | * @}
139 | */
140 |
141 | /** @defgroup USBD_CONF_Exported_Types USBD_CONF_Exported_Types
142 | * @brief Types.
143 | * @{
144 | */
145 |
146 | /**
147 | * @}
148 | */
149 |
150 | /** @defgroup USBD_CONF_Exported_FunctionsPrototype USBD_CONF_Exported_FunctionsPrototype
151 | * @brief Declaration of public functions for Usb device.
152 | * @{
153 | */
154 |
155 | /* Exported functions -------------------------------------------------------*/
156 | void *USBD_static_malloc(uint32_t size);
157 | void USBD_static_free(void *p);
158 |
159 | /**
160 | * @}
161 | */
162 |
163 | /**
164 | * @}
165 | */
166 |
167 | /**
168 | * @}
169 | */
170 |
171 | #ifdef __cplusplus
172 | }
173 | #endif
174 |
175 | #endif /* __USBD_CONF__H__ */
176 |
177 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/
178 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/inc/os_api.h:
--------------------------------------------------------------------------------
1 | #ifndef OS_CM4_API_H
2 | #define OS_CM4_API_H
3 | #include "os_task.h"
4 | #include "os_comm.h"
5 | #include "os_board.h"
6 | #endif
7 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/inc/os_board.h:
--------------------------------------------------------------------------------
1 | #ifndef OS_BOARD_H
2 | #define OS_BOARD_H
3 |
4 | #include "os_config.h"
5 |
6 | void OSBoardInit(void);
7 | void OSEnterCritical(void);
8 | void OSExitCritical(void);
9 | unsigned int OSCntLeadZeros(unsigned int Num);
10 | void OSIntMask(void);
11 | void OSClearIntMask(void);
12 | void *OSRoutCreat(void(*Code)(void *), void *Para, unsigned int Sp);
13 | void OSRoutStart(void **Routi);
14 | void OSRoutTo(void **Routi);
15 |
16 | #define SYSCLK_FREQ 96000000 // 根据芯片运行时钟进行设置
17 |
18 | #endif
19 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/inc/os_comm.h:
--------------------------------------------------------------------------------
1 | #ifndef OS_TASK_COM_H
2 | #define OS_TASK_COM_H
3 | #include "os_config.h"
4 | #define OS_ALWAYS_DELAY 0
5 | #define OS_NO_DELAY 0xffffffff
6 | typedef enum{
7 | TET_SEM_BIN,
8 | TET_SEM_CNT,
9 | TET_MUTEX,
10 | TET_QUEUE
11 | }OS_TASKCOM_EVENT_TYPE;
12 | typedef enum{
13 | TES_IDLE,
14 | TES_BUSY,
15 | TES_EMPTY,
16 | TES_NOT_EMPTY
17 | }OS_TASKCOM_ENENT_STATE;
18 | typedef struct os_event{
19 | OS_TASKCOM_EVENT_TYPE Type;
20 | OS_TASKCOM_ENENT_STATE State;
21 | unsigned short Cnt;
22 | signed int Info;
23 | unsigned short Volume;
24 | unsigned short Front;
25 | unsigned short Rear;
26 | void * *Buf;
27 | volatile unsigned int WaitList[2];
28 | unsigned int *WaitListBitBand;
29 | }OS_EVENT;
30 | void OSSemBinCreat(OS_EVENT *EventHandle,unsigned int State);
31 | void OSSemBinGive(OS_EVENT *EventHandle);
32 | unsigned char OSSemBinTake(OS_EVENT *EventHandle,unsigned int Ticks);
33 | void OSSemCntCreat(OS_EVENT *EventHandle,unsigned int Cnt);
34 | void OSSemCntGive(OS_EVENT *EventHandle);
35 | unsigned char OSSemCntTake(OS_EVENT *EventHandle,unsigned int Ticks);
36 | void OSMutexCreat(OS_EVENT *EventHandle);
37 | void OSMutexGive(OS_EVENT *EventHandle);
38 | void OSMutexTake(OS_EVENT *EventHandle);
39 | void OSQueueCreat(OS_EVENT *EventHandle,unsigned int MaxNum,void * *Buf);
40 | void OSQueueSend(OS_EVENT *EventHandle,void *Msg);
41 | unsigned char OSQueueReceive(OS_EVENT *EventHandle,void * *pMsg,unsigned int Ticks);
42 | #endif
43 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/inc/os_config.h:
--------------------------------------------------------------------------------
1 | #ifndef OS_CONFIG_H
2 | #define OS_CONFIG_H
3 | #define OS_CONFIG_TASK_NUM 4
4 | #define OS_CONFIG_STK_CHECK_EN 1
5 | #define OS_CONFIG_TICK_RATE_HZ 1000
6 |
7 | //#define OS_CONFIG_SUPER_ISR_PRIO 16 //请直接在汇编文件中进行设置
8 | #define OS_CONFIG_PENDSV_PRIO 255
9 | #define OS_CONFIG_SYSTICK_PRIO 255
10 |
11 | #endif
12 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/inc/os_task.h:
--------------------------------------------------------------------------------
1 | #ifndef OS_TASK_H
2 | #define OS_TASK_H
3 | #include "os_config.h"
4 | #include "os_comm.h"
5 | #define NO_TASK_IN_THIS_STATE 0xff
6 | typedef struct{
7 | void *RoutineHandle;
8 | unsigned int DelayTicks;
9 | unsigned int BlockTicks;
10 | OS_EVENT *WaitEvent;
11 | char IfOverTime;
12 | const char *Name;
13 | #if OS_CONFIG_STK_CHECK_EN
14 | void *StkBuf;
15 | unsigned int StkSize;
16 | #endif
17 | void *Msg;
18 | }OS_TCB;
19 | extern OS_TCB OSTaskAllTask[OS_CONFIG_TASK_NUM];
20 | extern volatile unsigned int OSTaskReadyList[2];
21 | extern volatile unsigned int OSTaskDelayList[2];
22 | extern volatile unsigned int OSTaskSuspendList[2];
23 | extern volatile unsigned int OSTaskBlockList[2];
24 | extern volatile unsigned int OSTaskRunList[2];
25 | extern volatile unsigned int OSTaskDelaySuspendList[2];
26 | extern volatile unsigned int OSTaskBlockSuspendList[2];
27 | extern volatile unsigned int *OSTaskReadyListBitBand;
28 | extern volatile unsigned int *OSTaskDelayListBitBand;
29 | extern volatile unsigned int *OSTaskSuspendListBitBand;
30 | extern volatile unsigned int *OSTaskBlockListBitBand;
31 | extern volatile unsigned int *OSTaskRunListBitBand;
32 | extern volatile unsigned int *OSTaskDelaySuspendListBitBand;
33 | extern volatile unsigned int *OSTaskBlockSuspendListBitBand;
34 | #define SET_READY_LIST(TASK_PRIO) do{OSTaskReadyListBitBand[TASK_PRIO]=1;}while(0)
35 | #define CLR_READY_LIST(TASK_PRIO) do{OSTaskReadyListBitBand[TASK_PRIO]=0;}while(0)
36 | #define GET_READY_LIST(TASK_PRIO) OSTaskReadyListBitBand[TASK_PRIO]
37 | #define SET_DELAY_LIST(TASK_PRIO) do{OSTaskDelayListBitBand[TASK_PRIO]=1;}while(0)
38 | #define CLR_DELAY_LIST(TASK_PRIO) do{OSTaskDelayListBitBand[TASK_PRIO]=0;}while(0)
39 | #define GET_DELAY_LIST(TASK_PRIO) OSTaskDelayListBitBand[TASK_PRIO]
40 | #define SET_SUSPEND_LIST(TASK_PRIO) do{OSTaskSuspendListBitBand[TASK_PRIO]=1;}while(0)
41 | #define CLR_SUSPEND_LIST(TASK_PRIO) do{OSTaskSuspendListBitBand[TASK_PRIO]=0;}while(0)
42 | #define GET_SUSPEND_LIST(TASK_PRIO) OSTaskSuspendListBitBand[TASK_PRIO]
43 | #define SET_BLOCK_LIST(TASK_PRIO) do{OSTaskBlockListBitBand[TASK_PRIO]=1;}while(0)
44 | #define CLR_BLOCK_LIST(TASK_PRIO) do{OSTaskBlockListBitBand[TASK_PRIO]=0;}while(0)
45 | #define GET_BLOCK_LIST(TASK_PRIO) OSTaskBlockListBitBand[TASK_PRIO]
46 | #define SET_RUN_LIST(TASK_PRIO) do{OSTaskRunListBitBand[TASK_PRIO]=1;}while(0)
47 | #define CLR_RUN_LIST(TASK_PRIO) do{OSTaskRunListBitBand[TASK_PRIO]=0;}while(0)
48 | #define GET_RUN_LIST(TASK_PRIO) OSTaskRunListBitBand[TASK_PRIO]
49 | #define SET_DELAYSUSPEND_LIST(TASK_PRIO) do{OSTaskDelaySuspendListBitBand[TASK_PRIO]=1;}while(0)
50 | #define CLR_DELAYSUSPEND_LIST(TASK_PRIO) do{OSTaskDelaySuspendListBitBand[TASK_PRIO]=0;}while(0)
51 | #define GET_DELAYSUSPEND_LIST(TASK_PRIO) OSTaskDelaySuspendListBitBand[TASK_PRIO]
52 | #define SET_BLOCKSUSPEND_LIST(TASK_PRIO) do{OSTaskBlockSuspendListBitBand[TASK_PRIO]=1;}while(0)
53 | #define CLR_BLOCKSUSPEND_LIST(TASK_PRIO) do{OSTaskBlockSuspendListBitBand[TASK_PRIO]=0;}while(0)
54 | #define GET_BLOCKSUSPEND_LIST(TASK_PRIO) OSTaskBlockSuspendListBitBand[TASK_PRIO]
55 | typedef enum{
56 | TSCR_SLEEP_TO_READY,
57 | TSCR_READY_TO_RUN,
58 | TSCR_READY_TO_SUSPEND,
59 | TSCR_RUN_TO_BLOCK,
60 | TSCR_RUN_TO_READY,
61 | TSCR_RUN_TO_SUSPEND,
62 | TSCR_RUN_TO_DELAY,
63 | TSCR_DELAY_TO_READY,
64 | TSCR_DELAY_TO_DELAYSUSPEND,
65 | TSCR_SUSPEND_TO_READY,
66 | TSCR_BLOCK_TO_BLOCKSUSPEND,
67 | TSCR_BLOCK_TO_READY,
68 | TSCR_BLOCKSUSPEND_TO_BLOCK,
69 | TSCR_BLOCKSUSPEND_TO_SUSPEND,
70 | TSCR_DELAYSUSPEND_TO_DELAY,
71 | TSCR_DELAYSUSPEND_TO_SUSPEND
72 | }OS_TASK_STATE_CHANGE_ROUTE;
73 | unsigned char OSCreatTask(void (*Code)(void *), void *Para, void *StkBuf,unsigned int StkSize, const char *TaskName,unsigned int Prio);
74 | void OSStart(void);
75 | void OSDelayTask(unsigned int Ticks);
76 | void OSSuspendTask(unsigned int Prio);
77 | void OSResumeTask(unsigned int Prio);
78 | void OSSchedLock(void);
79 | void OSSchedUnlock(void);
80 | unsigned int OSGetCurrentTick(void);
81 | unsigned int OSGetCurrentSysMs(void);
82 | #if OS_CONFIG_STK_CHECK_EN
83 | typedef struct{
84 | unsigned int StkBase;
85 | unsigned int StkSize;
86 | unsigned int StkRem;
87 | }OS_STK_INFO;
88 | void OSStkCheck(unsigned int TaskPrio, OS_STK_INFO *StkInfo);
89 | #endif
90 | void OSTaskStateMachineChangeState(unsigned int TaskPrio,OS_TASK_STATE_CHANGE_ROUTE Route);
91 | unsigned int OSTaskGetPrio(volatile unsigned int *TaskList);
92 | void OSTaskTick(void);
93 | void OSInit(void);
94 | #endif
95 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/src/os_boad.c:
--------------------------------------------------------------------------------
1 | #include "os_config.h"
2 | #include "os_board.h"
3 | #include "os_task.h"
4 | #include "os_comm.h"
5 |
6 | #define OS_CM4_NVIC_ST_CTRL (*((volatile unsigned int *)0xE000E010))
7 | #define OS_CM4_NVIC_ST_RELOAD (*((volatile unsigned int *)0xE000E014))
8 | #define OS_CM4_NVIC_SYS_PRIO (*(volatile unsigned long *) 0xe000ed20 )
9 |
10 | #define OS_CM4_NVIC_ST_CTRL_CLK_SRC 0x00000004
11 | #define OS_CM4_NVIC_ST_CTRL_INTEN 0x00000002
12 | #define OS_CM4_NVIC_ST_CTRL_ENABLE 0x00000001
13 |
14 |
15 | static void OSTickInit(void)
16 | {
17 | OS_CM4_NVIC_ST_RELOAD = (SYSCLK_FREQ/OS_CONFIG_TICK_RATE_HZ - 1);
18 | OS_CM4_NVIC_ST_CTRL |= OS_CM4_NVIC_ST_CTRL_CLK_SRC | OS_CM4_NVIC_ST_CTRL_INTEN | OS_CM4_NVIC_ST_CTRL_ENABLE ;
19 | }
20 |
21 | static void OSIsrPrioInit(void)
22 | {
23 | OS_CM4_NVIC_SYS_PRIO |= ((unsigned long)OS_CONFIG_PENDSV_PRIO<16);
24 | OS_CM4_NVIC_SYS_PRIO |= ((unsigned long)OS_CONFIG_SYSTICK_PRIO<<24);
25 | }
26 |
27 | void OSBoardInit(void)
28 | {
29 | OSTickInit();
30 | OSIsrPrioInit();
31 | }
32 |
33 | void HAL_IncTick(void);
34 | void SysTick_Handler(void)
35 | {
36 | OSTaskTick();
37 | //HAL_IncTick();
38 | }
39 |
40 | static volatile unsigned int OSCriticalNesting = 0;
41 |
42 | void OSEnterCritical( void )
43 | {
44 | OSIntMask();
45 | OSCriticalNesting++;
46 | }
47 |
48 | void OSExitCritical( void )
49 | {
50 | OSCriticalNesting--;
51 | if( OSCriticalNesting == 0 )
52 | OSClearIntMask();
53 | }
54 |
55 |
--------------------------------------------------------------------------------
/Firmware/InfinityGauntlet/kernel/src/os_port.s:
--------------------------------------------------------------------------------
1 | .syntax unified
2 | .cpu cortex-m3
3 | .thumb
4 |
5 | .equ OS_CONFIG_SUPER_ISR_PRIO, 16
6 | .equ NVIC_INT_CTRL, 0xe000ed04
7 | .equ NVIC_SYSPRI2, 0xe000ed20
8 | .equ NVIC_PENDSVSET, 0x10000000
9 | .equ NVIC_PENDSV_PRI, 0x00ff0000
10 |
11 | .global PendSV_Handler
12 | .global SVC_Handler
13 | .global OSIntMask
14 | .global OSClearIntMask
15 | .global OSRoutCreat
16 | .global OSRoutStart
17 | .global OSRoutTo
18 | .global OSCntLeadZeros
19 |
20 | .section .data
21 | OSCurRout:
22 | .word 0
23 | OSRoutRdy:
24 | .word 0
25 |
26 | .section .text.PendSV_Handler
27 | .type PendSV_Handler, %function
28 | PendSV_Handler:
29 | mrs r0, psp
30 | stmdb r0!, {r4-r11}
31 | ldr r1, =OSCurRout
32 | ldr r12, [r1]
33 | str r0, [r12]
34 | ldr r12, =OSRoutRdy
35 | ldr r2,[r12]
36 | ldr r0, [r2]
37 | ldmia r0!, {r4-r11}
38 | str r2 , [r1]
39 | msr psp, r0
40 | bx lr
41 | .size PendSV_Handler, .-PendSV_Handler
42 |
43 | .section .text.SVC_Handler
44 | .type SVC_Handler, %function
45 | SVC_Handler:
46 | ldr r12, =OSRoutRdy
47 | ldr r12, [r12]
48 | ldr r0, [r12]
49 | ldmia r0!,{R4-R11}
50 | msr psp, r0
51 | ldr r12, =NVIC_SYSPRI2
52 | ldr r0, =NVIC_PENDSV_PRI
53 | ldr r1, [r12]
54 | orr r0, r1,r0
55 | str r0, [r12]
56 | ldr r0, =NVIC_INT_CTRL
57 | ldr r1, =NVIC_PENDSVSET
58 | str r1, [r0]
59 | orr lr, lr,#0xd
60 | bx lr
61 | .size SVC_Handler, .-SVC_Handler
62 |
63 | .section .text.OSIntMask
64 | .type OSIntMask, %function
65 | OSIntMask:
66 | push { r0 }
67 | ldr r0, =OS_CONFIG_SUPER_ISR_PRIO
68 | msr basepri, r0
69 | pop { r0 }
70 | bx lr
71 | .size OSIntMask, .-OSIntMask
72 |
73 | .section .text.OSClearIntMask
74 | .type OSClearIntMask, %function
75 | OSClearIntMask:
76 | push { r0 }
77 | mov r0, #0
78 | msr basepri, r0
79 | pop { r0 }
80 | bx lr
81 | .size OSClearIntMask, .-OSClearIntMask
82 |
83 | .section .text.OSRoutCreat
84 | .type OSRoutCreat, %function
85 | OSRoutCreat:
86 | sub r2, #0x40
87 | str r1, [r2,#0x20]
88 | ldr r12, =0xfffffff0
89 | str r12, [r2,#0x34]
90 | str r0, [r2,#0x38]
91 | ldr r12, =0x01000000
92 | str r12, [r2,#0x3c]
93 | mov r0, r2
94 | bx lr
95 | .size OSRoutCreat, .-OSRoutCreat
96 |
97 | .section .text.OSRoutStart
98 | .type OSRoutStart, %function
99 | OSRoutStart:
100 | ldr r12, =OSRoutRdy
101 | str r0, [r12]
102 | ldr r12, =OSCurRout
103 | str r0, [r12]
104 | ldr r12, =0xE000ED08
105 | ldr r12, [r12]
106 | ldr r12, [r12]
107 | msr msp, r12
108 | svc 0
109 | bx lr
110 | .size OSRoutStart, .-OSRoutStart
111 |
112 | .section .text.OSRoutTo
113 | .type OSRoutTo, %function
114 | OSRoutTo:
115 | ldr r12, =OSRoutRdy
116 | str r0, [r12]
117 | ldr r12, =NVIC_INT_CTRL
118 | ldr r1, =NVIC_PENDSVSET
119 | str r1, [r12]
120 | bx lr
121 | .size OSRoutTo, .-OSRoutTo
122 |
123 | .section .text.OSCntLeadZeros
124 | .type OSCntLeadZeros, %function
125 | OSCntLeadZeros:
126 | clz r0, r0
127 | bx lr
128 | .size OSCntLeadZeros, .-OSCntLeadZeros
129 |
--------------------------------------------------------------------------------
/Firmware/NOTE.txt:
--------------------------------------------------------------------------------
1 | # Please open the project in STM32CubeIDE.
2 | # InfinityGauntlet/kernel is an ultra-lightweight RTOS written by myself.
3 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # InfinityGauntlet
2 |
3 | https://user-images.githubusercontent.com/126397459/228130499-61dc367e-9943-49e1-a97a-840ad6c6f14d.mp4
4 |
5 | NOTE: The demo video only demonstrates a rough attack flow, please refer to the paper for details.
6 |
7 | We proposes a novel fingerprint brute-force attack on off-the-shelf smartphones in [InfinityGauntlet: Expose Smartphone Fingerprint Authentication to Brute-force Attack - USENIX Security '23](https://www.usenix.org/conference/usenixsecurity23/presentation/chenyu). We name this new threat model InfinityGauntlet, where Infinity and Gauntlet represent its two core techniques: attempt limit bypassing and fingerprint image hijacking. Adversaries can pass fingerprint authentication with zero knowledge of the victim to unlock the smartphone, log into privacy apps and make payments. We have submitted related vulnerabilities(CAMF and MAL) to seven manufacturers, and all have been confirmed and fixed. In order to fill the gap in the research tools of smartphone fingerprint authentication, we decided to open source the tool in this repository to the academic community. Hope InfinityGauntlet can inspire the industry to improve the security of biometric authentication.
8 |
9 | Some of our other research on the security of biometric authentication:
10 |
11 | 1. https://www.blackhat.com/us-19/briefings/schedule/#biometric-authentication-under-threat-liveness-detection-hacking-16130
12 | 2. https://www.hackread.com/hackers-unlock-smartphone-fingerprints-glass-of-water/
13 | 3. https://threatpost.com/lock-screen-bypass-bug-quietly-patched-in-handsets/139141/
14 |
--------------------------------------------------------------------------------