├── .gitattributes ├── User ├── main.c ├── GlobalDef.h ├── stm32f4xx.h ├── BOARD_IR_V40.h ├── Board_IR_V02.h ├── stm32f4xx_conf.h ├── MyType.h ├── board_version.h ├── stm32f4xx_it.h ├── ALL_Includes.h └── stm32f4xx_it.c ├── My_Lib ├── AD │ ├── AD.c │ └── AD.h ├── DMA │ ├── dma.c │ └── dma.h ├── LCD │ ├── 16x8.h │ ├── LCD.c │ ├── LCD.h │ ├── bmp.c │ ├── bmp.h │ ├── tft_core.c │ ├── tft_config.h │ └── tft_core.h ├── MEM │ ├── CCM.h │ └── CCM.c ├── SYSTEM │ ├── sys.c │ └── sys.h ├── USART │ ├── USART.c │ └── USART.h ├── delay │ ├── delay.c │ └── delay.h ├── EEPROM │ ├── EEPROM.c │ └── EEPROM.h ├── SPI_DMA │ └── spi_dma.h ├── IIC │ ├── MLX90640_SWI2C_Driver.c │ └── MLX90640_SWI2C_Driver.h ├── KEY │ └── KEY.h ├── FLASH │ ├── sd_card_interface.h │ ├── rom_flash_interface.h │ ├── spi_flash_interface.h │ └── rom_flash_interface.c ├── ImageHandle │ └── ImageHandle.h └── MLX90640 │ └── MLX90640_API.h ├── proj ├── test.plg ├── List │ └── IR_Cam.bin ├── RTE │ └── RTE_Components.h ├── DebugConfig │ └── Target_1_STM32F407VE.dbgconf ├── EventRecorderStub.scvd └── JLinkSettings.ini ├── SI ├── 1_MLX_F407.IAB ├── 1_MLX_F407.IAD ├── 1_MLX_F407.IMB ├── 1_MLX_F407.IMD ├── 1_MLX_F407.PFI ├── 1_MLX_F407.PO ├── 1_MLX_F407.PR ├── 1_MLX_F407.PRI ├── 1_MLX_F407.PS ├── 1_MLX_F407.WK3 └── 1_MLX_F407.SearchResults ├── Component ├── USB_F4.7z ├── RegLib │ └── reglib.h ├── USB_F4 │ ├── USB_APP │ │ ├── usb_bsp.c │ │ ├── usb_conf.h │ │ ├── usbd_conf.h │ │ ├── usbd_storage_msd.c │ │ ├── usb_app.h │ │ ├── usb_app.c │ │ ├── usbd_usr.c │ │ └── usbd_desc.h │ ├── STM32_USB_Device_Library │ │ ├── Class │ │ │ ├── msc │ │ │ │ ├── src │ │ │ │ │ ├── usbd_msc_scsi.c │ │ │ │ │ └── usbd_msc_data.c │ │ │ │ └── inc │ │ │ │ │ ├── usbd_msc_core.h │ │ │ │ │ ├── usbd_msc_data.h │ │ │ │ │ ├── usbd_msc_mem.h │ │ │ │ │ └── usbd_msc_bot.h │ │ │ ├── cdc │ │ │ │ └── inc │ │ │ │ │ ├── usbd_cdc_if_template.h │ │ │ │ │ ├── usbd_cdc_core_loopback.h │ │ │ │ │ └── usbd_cdc_core.h │ │ │ ├── dfu │ │ │ │ ├── inc │ │ │ │ │ ├── usbd_otp_if.h │ │ │ │ │ ├── usbd_mem_if_template.h │ │ │ │ │ ├── usbd_flash_if.h │ │ │ │ │ └── usbd_dfu_mal.h │ │ │ │ └── src │ │ │ │ │ ├── usbd_otp_if.c │ │ │ │ │ └── usbd_mem_if_template.c │ │ │ ├── hid_cdc_wrapper │ │ │ │ └── inc │ │ │ │ │ └── usbd_hid_cdc_wrapper.h │ │ │ ├── hid_msc_wrapper │ │ │ │ └── inc │ │ │ │ │ └── usbd_msc_hid_core.h │ │ │ ├── hid │ │ │ │ └── inc │ │ │ │ │ └── usbd_hid_core.h │ │ │ ├── audio │ │ │ │ └── inc │ │ │ │ │ └── usbd_audio_out_if.h │ │ │ └── customhid │ │ │ │ └── inc │ │ │ │ └── usbd_customhid_core.h │ │ └── Core │ │ │ └── inc │ │ │ ├── usbd_conf_template.h │ │ │ ├── usbd_req.h │ │ │ ├── usbd_core.h │ │ │ ├── usbd_ioreq.h │ │ │ └── usbd_usr.h │ ├── STM32_USB_OTG_Driver │ │ └── inc │ │ │ ├── usb_otg.h │ │ │ ├── usb_bsp.h │ │ │ ├── usb_hcd.h │ │ │ ├── usb_dcd_int.h │ │ │ ├── usb_hcd_int.h │ │ │ └── usb_dcd.h │ └── STM32_USB_HOST_Library │ │ ├── Core │ │ └── inc │ │ │ ├── usbh_conf_template.h │ │ │ ├── usbh_hcs.h │ │ │ ├── usbh_ioreq.h │ │ │ └── usbh_stdreq.h │ │ └── Class │ │ ├── HID │ │ ├── inc │ │ │ ├── usbh_hid_mouse.h │ │ │ ├── usbh_hid_keybd.h │ │ │ └── usbh_hid_core.h │ │ └── src │ │ │ └── usbh_hid_mouse.c │ │ └── MSC │ │ └── inc │ │ ├── usbh_msc_core.h │ │ └── usbh_msc_scsi.h ├── SFUD-master │ ├── others │ │ ├── sfud_demo.h │ │ ├── types.h │ │ ├── bsp.h │ │ └── sfud_demo.c │ └── sfud │ │ └── inc │ │ ├── sfud_cfg.h │ │ └── sfud.h └── fatfs │ ├── option │ ├── unicode.c │ └── syscall.c │ └── inc │ ├── FatFs_Demo.h │ ├── integer.h │ └── diskio.h ├── OS ├── inc │ └── os_global.h └── src │ └── os_global.c ├── libaray ├── src │ ├── stm32f4xx_rcc.c │ ├── stm32f4xx_flash.c │ └── stm32f4xx_crc.c └── inc │ ├── stm32f4xx_crc.h │ ├── stm32f4xx_wwdg.h │ ├── stm32f4xx_rng.h │ ├── stm32f4xx_dbgmcu.h │ └── stm32f4xx_iwdg.h ├── IR_MLX_BAT_V3.0-bak-190326.pdf ├── MLX90640-Datasheet-Melexis.pdf ├── README.md └── CMSIS └── system_stm32f4xx.h /.gitattributes: -------------------------------------------------------------------------------- 1 | # Auto detect text files and perform LF normalization 2 | * text=auto 3 | -------------------------------------------------------------------------------- /User/main.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/main.c -------------------------------------------------------------------------------- /My_Lib/AD/AD.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/AD/AD.c -------------------------------------------------------------------------------- /proj/test.plg: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/proj/test.plg -------------------------------------------------------------------------------- /My_Lib/DMA/dma.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/DMA/dma.c -------------------------------------------------------------------------------- /My_Lib/DMA/dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/DMA/dma.h -------------------------------------------------------------------------------- /My_Lib/LCD/16x8.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/16x8.h -------------------------------------------------------------------------------- /My_Lib/LCD/LCD.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/LCD.c -------------------------------------------------------------------------------- /My_Lib/LCD/LCD.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/LCD.h -------------------------------------------------------------------------------- /My_Lib/LCD/bmp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/bmp.c -------------------------------------------------------------------------------- /My_Lib/LCD/bmp.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/bmp.h -------------------------------------------------------------------------------- /My_Lib/MEM/CCM.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/MEM/CCM.h -------------------------------------------------------------------------------- /SI/1_MLX_F407.IAB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.IAB -------------------------------------------------------------------------------- /SI/1_MLX_F407.IAD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.IAD -------------------------------------------------------------------------------- /SI/1_MLX_F407.IMB: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.IMB -------------------------------------------------------------------------------- /SI/1_MLX_F407.IMD: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.IMD -------------------------------------------------------------------------------- /SI/1_MLX_F407.PFI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.PFI -------------------------------------------------------------------------------- /SI/1_MLX_F407.PO: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.PO -------------------------------------------------------------------------------- /SI/1_MLX_F407.PR: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.PR -------------------------------------------------------------------------------- /SI/1_MLX_F407.PRI: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.PRI -------------------------------------------------------------------------------- /SI/1_MLX_F407.PS: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.PS -------------------------------------------------------------------------------- /SI/1_MLX_F407.WK3: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/SI/1_MLX_F407.WK3 -------------------------------------------------------------------------------- /User/GlobalDef.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/GlobalDef.h -------------------------------------------------------------------------------- /User/stm32f4xx.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/stm32f4xx.h -------------------------------------------------------------------------------- /Component/USB_F4.7z: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4.7z -------------------------------------------------------------------------------- /My_Lib/SYSTEM/sys.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/SYSTEM/sys.c -------------------------------------------------------------------------------- /My_Lib/SYSTEM/sys.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/SYSTEM/sys.h -------------------------------------------------------------------------------- /My_Lib/USART/USART.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/USART/USART.c -------------------------------------------------------------------------------- /My_Lib/delay/delay.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/delay/delay.c -------------------------------------------------------------------------------- /OS/inc/os_global.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/OS/inc/os_global.h -------------------------------------------------------------------------------- /OS/src/os_global.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/OS/src/os_global.c -------------------------------------------------------------------------------- /User/BOARD_IR_V40.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/BOARD_IR_V40.h -------------------------------------------------------------------------------- /User/Board_IR_V02.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/Board_IR_V02.h -------------------------------------------------------------------------------- /proj/List/IR_Cam.bin: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/proj/List/IR_Cam.bin -------------------------------------------------------------------------------- /My_Lib/EEPROM/EEPROM.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/EEPROM/EEPROM.c -------------------------------------------------------------------------------- /My_Lib/LCD/tft_core.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/tft_core.c -------------------------------------------------------------------------------- /User/stm32f4xx_conf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/User/stm32f4xx_conf.h -------------------------------------------------------------------------------- /Component/RegLib/reglib.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/RegLib/reglib.h -------------------------------------------------------------------------------- /My_Lib/LCD/tft_config.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/LCD/tft_config.h -------------------------------------------------------------------------------- /My_Lib/SPI_DMA/spi_dma.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/SPI_DMA/spi_dma.h -------------------------------------------------------------------------------- /proj/RTE/RTE_Components.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/proj/RTE/RTE_Components.h -------------------------------------------------------------------------------- /libaray/src/stm32f4xx_rcc.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/libaray/src/stm32f4xx_rcc.c -------------------------------------------------------------------------------- /IR_MLX_BAT_V3.0-bak-190326.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/IR_MLX_BAT_V3.0-bak-190326.pdf -------------------------------------------------------------------------------- /MLX90640-Datasheet-Melexis.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/MLX90640-Datasheet-Melexis.pdf -------------------------------------------------------------------------------- /libaray/src/stm32f4xx_flash.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/libaray/src/stm32f4xx_flash.c -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usb_bsp.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4/USB_APP/usb_bsp.c -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usb_conf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4/USB_APP/usb_conf.h -------------------------------------------------------------------------------- /My_Lib/IIC/MLX90640_SWI2C_Driver.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/My_Lib/IIC/MLX90640_SWI2C_Driver.c -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usbd_conf.h: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4/USB_APP/usbd_conf.h -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usbd_storage_msd.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4/USB_APP/usbd_storage_msd.c -------------------------------------------------------------------------------- /proj/DebugConfig/Target_1_STM32F407VE.dbgconf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/proj/DebugConfig/Target_1_STM32F407VE.dbgconf -------------------------------------------------------------------------------- /User/MyType.h: -------------------------------------------------------------------------------- 1 | #ifndef _MyType_H 2 | #define _MyType_H 3 | 4 | #ifndef BIT 5 | #define BIT(x) (1 << (x)) 6 | #endif 7 | 8 | 9 | 10 | #endif 11 | 12 | 13 | -------------------------------------------------------------------------------- /My_Lib/MEM/CCM.c: -------------------------------------------------------------------------------- 1 | 2 | #include "CCM.h" 3 | 4 | 5 | 6 | 7 | ALIGN_32 uint8_t ccm_buf[CCM_BUF_SIZE] 8 | #if USE_CCM_RAM 9 | CCM_ATTR 10 | #endif 11 | ; 12 | 13 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/sfud_demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __SFUD_DEMO_H__ 3 | #define __SFUD_DEMO_H__ 4 | 5 | 6 | 7 | 8 | void sfud_demo_task(void); 9 | 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usb_app.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __USB_APP_DEF_H 3 | #define __USB_APP_DEF_H 4 | 5 | 6 | 7 | 8 | 9 | 10 | void USB_Init(void); 11 | 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /My_Lib/LCD/tft_core.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __TFT_CORE_H_ 3 | #define __TFT_CORE_H_ 4 | 5 | #include "stm32f4xx_conf.h" 6 | 7 | 8 | void LCD_Snapshot(void); 9 | 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /My_Lib/AD/AD.h: -------------------------------------------------------------------------------- 1 | #ifndef _AD_H 2 | #define _AD_H 3 | 4 | #include "ALL_Includes.h" 5 | 6 | 7 | void ADC1_Init(void); 8 | u16 ADC1_GetVal(void); 9 | 10 | 11 | 12 | #endif 13 | 14 | -------------------------------------------------------------------------------- /User/board_version.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __BOARD_VERSION_H__ 3 | #define __BOARD_VERSION_H__ 4 | 5 | #include "Board_IR_V02.h" 6 | 7 | //#include "BOARD_IR_V40.h" 8 | 9 | 10 | #endif 11 | 12 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/SaberOnGo/JM-Thermal-Camera/HEAD/Component/USB_F4/STM32_USB_Device_Library/Class/msc/src/usbd_msc_scsi.c -------------------------------------------------------------------------------- /My_Lib/delay/delay.h: -------------------------------------------------------------------------------- 1 | #ifndef __DELAY_H 2 | #define __DELAY_H 3 | 4 | #include "stm32f4xx_conf.h" 5 | 6 | 7 | void delay_ms(uint32_t mSecs); 8 | void delay_us(uint32_t uSecs); 9 | 10 | 11 | 12 | 13 | #endif 14 | 15 | -------------------------------------------------------------------------------- /My_Lib/USART/USART.h: -------------------------------------------------------------------------------- 1 | #ifndef __USART_H 2 | #define __USART_H 3 | 4 | #include "ALL_Includes.h" 5 | 6 | extern u8 UsartModule; 7 | 8 | void uart_init(u32 bound); 9 | void USART_SendBye(u8 data); 10 | 11 | #endif 12 | 13 | -------------------------------------------------------------------------------- /SI/1_MLX_F407.SearchResults: -------------------------------------------------------------------------------- 1 | ---- PowerOFF Matches (3 in 3 files) ---- 2 | Board_IR_V02.h (user):#define PowerOFF IO_L(Power_Port, Power_Pin) 3 | BOARD_IR_V40.h (user):#define PowerOFF IO_L(Power_Port, Power_Pin) 4 | ImageHandle.c (my_lib\imagehandle): PowerOFF; 5 | -------------------------------------------------------------------------------- /proj/EventRecorderStub.scvd: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /Component/fatfs/option/unicode.c: -------------------------------------------------------------------------------- 1 | #include "../ff.h" 2 | 3 | #if _USE_LFN != 0 4 | 5 | #if _CODE_PAGE == 932 /* Japanese Shift_JIS */ 6 | #include "cc932.c" 7 | #elif _CODE_PAGE == 936 /* Simplified Chinese GBK */ 8 | #include "cc936.c" 9 | #elif _CODE_PAGE == 949 /* Korean */ 10 | #include "cc949.c" 11 | #elif _CODE_PAGE == 950 /* Traditional Chinese Big5 */ 12 | #include "cc950.c" 13 | #else /* Single Byte Character-Set */ 14 | #include "ccsbcs.c" 15 | #endif 16 | 17 | #endif 18 | -------------------------------------------------------------------------------- /User/stm32f4xx_it.h: -------------------------------------------------------------------------------- 1 | //V1.0.0 2 | #ifndef __STM32F4xx_IT_H 3 | #define __STM32F4xx_IT_H 4 | 5 | #ifdef __cplusplus 6 | extern "C" { 7 | #endif 8 | 9 | #include "stm32f4xx.h" 10 | 11 | 12 | void NMI_Handler(void); 13 | void HardFault_Handler(void); 14 | void MemManage_Handler(void); 15 | void BusFault_Handler(void); 16 | void UsageFault_Handler(void); 17 | void SVC_Handler(void); 18 | void DebugMon_Handler(void); 19 | void PendSV_Handler(void); 20 | void SysTick_Handler(void); 21 | 22 | #ifdef __cplusplus 23 | } 24 | #endif 25 | 26 | #endif 27 | 28 | -------------------------------------------------------------------------------- /User/ALL_Includes.h: -------------------------------------------------------------------------------- 1 | #ifndef _ALL_Includes_H 2 | #define _ALL_Includes_H 3 | 4 | 5 | #include "stm32f4xx_conf.h" 6 | #include "delay.h" 7 | #include "MyType.h" 8 | 9 | #include "GlobalDef.h" 10 | #include "os_global.h" 11 | #include "board_version.h" 12 | #include "tft_config.h" 13 | #include "tft_core.h" 14 | 15 | #include "lcd.h" 16 | #include "MLX90640_SWI2C_Driver.h" 17 | #include "MLX90640_API.h" 18 | #include "ImageHandle.h" 19 | #include "KEY.h" 20 | #include "AD.h" 21 | #include "EEPROM.h" 22 | #include "USART.h" 23 | #include "dma.h" 24 | #include "spi_dma.h" 25 | 26 | 27 | #endif 28 | 29 | 30 | -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usb_app.c: -------------------------------------------------------------------------------- 1 | 2 | #include "usb_app.h" 3 | #include "usbd_core.h" 4 | #include "usbd_desc.h" 5 | 6 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 7 | #if defined ( __ICCARM__ ) /* !< IAR Compiler */ 8 | #pragma data_alignment=4 9 | #endif 10 | #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ 11 | 12 | __ALIGN_BEGIN USB_OTG_CORE_HANDLE USB_OTG_dev __ALIGN_END; 13 | 14 | 15 | 16 | extern USBD_Class_cb_TypeDef USBD_MSC_cb; 17 | extern USBD_Usr_cb_TypeDef USR_cb; 18 | 19 | void USB_Init(void) 20 | { 21 | USBD_Init(&USB_OTG_dev,USB_OTG_FS_CORE_ID,&USR_desc,&USBD_MSC_cb,&USR_cb); 22 | } 23 | 24 | 25 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/types.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef TYPES_H_ 3 | #define TYPES_H_ 4 | 5 | #include 6 | #include 7 | typedef int bool_t; /**< boolean type */ 8 | 9 | #ifndef TRUE 10 | #define TRUE 1 11 | #endif 12 | 13 | #ifndef FALSE 14 | #define FALSE 0 15 | #endif 16 | 17 | #ifndef NULL 18 | #define NULL 0 19 | #endif 20 | 21 | #define success 0 22 | #define fail 1 23 | 24 | 25 | #ifndef disable 26 | #define disable 0 27 | #endif 28 | 29 | #ifndef enable 30 | #define enable 1 31 | #endif 32 | 33 | #endif /* TYPES_H_ */ 34 | 35 | -------------------------------------------------------------------------------- /My_Lib/KEY/KEY.h: -------------------------------------------------------------------------------- 1 | #ifndef __KEY_H 2 | #define __KEY_H 3 | 4 | #include "ALL_Includes.h" 5 | 6 | //extern u8 DispState; 7 | extern u8 emissivity; 8 | extern u8 RuleAuto; 9 | 10 | 11 | 12 | #define KeySetOn 0x00 13 | #define KeyDownOn 0x01 14 | #define KeyUpOn 0x02 15 | #define KeyPowerOn 0x03 16 | #define NoKeyOn 0xff 17 | 18 | 19 | void KeyScan(void); 20 | void MX_GPIO_Init(void); 21 | u8 GetKeyBit(void); 22 | void SetTemp(void); 23 | void KeyAction(void); 24 | void SetDownTemp(void); 25 | void SetUpTemp(void); 26 | void SetEmissivityUp(void); 27 | void SetEmissivityDown(void); 28 | void SetAutoRuleUpDown(void); 29 | 30 | #endif 31 | 32 | -------------------------------------------------------------------------------- /proj/JLinkSettings.ini: -------------------------------------------------------------------------------- 1 | [BREAKPOINTS] 2 | ShowInfoWin = 1 3 | EnableFlashBP = 2 4 | BPDuringExecution = 0 5 | [CFI] 6 | CFISize = 0x00 7 | CFIAddr = 0x00 8 | [CPU] 9 | OverrideMemMap = 0 10 | AllowSimulation = 1 11 | ScriptFile="" 12 | [FLASH] 13 | MinNumBytesFlashDL = 64 14 | SkipProgOnCRCMatch = 1 15 | VerifyDownload = 1 16 | AllowCaching = 1 17 | EnableFlashDL = 2 18 | Override = 0 19 | Device="AD7160" 20 | [GENERAL] 21 | WorkRAMSize = 0x00 22 | WorkRAMAddr = 0x00 23 | [SWO] 24 | SWOLogFile="" 25 | [MEM] 26 | RdOverrideOrMask = 0x00 27 | RdOverrideAndMask = 0xFFFFFFFF 28 | RdOverrideAddr = 0xFFFFFFFF 29 | WrOverrideOrMask = 0x00 30 | WrOverrideAndMask = 0xFFFFFFFF 31 | WrOverrideAddr = 0xFFFFFFFF 32 | -------------------------------------------------------------------------------- /My_Lib/EEPROM/EEPROM.h: -------------------------------------------------------------------------------- 1 | #ifndef _EEPROM_H 2 | 3 | 4 | #include "ALL_Includes.h" 5 | 6 | #define EEP_BaseAddr 0x8060000 7 | #define TempFlagAddr 0 8 | #define HightTempAddr 1 9 | #define LowTempAddr 2 10 | #define EmissivityAddr 3 11 | #define AutoRuleAddr 4 12 | #define EepWrFlag 0xD5A5 13 | 14 | void EEP_Wirte(u16 *EEP_Buf, u16 EEP_Length); 15 | u16 EEP_ReadWord(u32 EEP_Addr); 16 | void ReSerialNumberFromEEP(u8 * SerNumber); 17 | void ReadDataFromEEP(u16 addr, u8 *data, u16 length); 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | #endif 43 | 44 | -------------------------------------------------------------------------------- /My_Lib/IIC/MLX90640_SWI2C_Driver.h: -------------------------------------------------------------------------------- 1 | #ifndef __MLX90640_SWI2C_Driver_H 2 | #define __MLX90640_SWI2C_Driver_H 3 | 4 | #include "ALL_Includes.h" 5 | 6 | 7 | 8 | int I2CSendByte(int8_t); 9 | void I2CReadBytes(int, char *); 10 | void I2CStart(void); 11 | void I2CStop(void); 12 | void I2CRepeatedStart(void); 13 | void I2CSendACK(void); 14 | void I2CSendNack(void); 15 | int I2CReceiveAck(void); 16 | void Wait(int); 17 | //void IIC_SDA_OUT(void); 18 | //void IIC_SDA_IN(void); 19 | void IIC_GPIO_Init(void); 20 | int MLX90640_I2CRead(uint8_t slaveAddr, uint16_t startAddress,uint16_t nMemAddressRead, uint16_t *data); 21 | int MLX90640_I2CWrite(uint8_t slaveAddr, uint16_t writeAddress, uint16_t data); 22 | 23 | #endif 24 | 25 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # JM Thermal Camera 2 | an Open Source ML90640 Thermal Camera 3 | 4 | 5 | Hardware: 6 | 7 | STM32F407xx 8 | 9 | 700 mAh Battery 10 | 11 | TP4056 charger chip 12 | 13 | MLX90640 thermal chip ... 14 | 15 | 16 | Functions: 17 | 18 | 1 Thermal imaging of objects 19 | 20 | 2 Take photos and save them in BMP format 21 | 22 | 3 Virtual U disk function, can be connected to a computer 23 | 24 | 4 Data serial port sending function, real-time display of thermal imaging on the computer 25 | 26 | 5 Low power automatic shutdown 27 | 28 | 6 Can set thermal imaging parameters such as reflectance, color, temperature range, time, etc. 29 | 30 | 7 With WIN operating system desktop software, can analyze thermal imaging data 31 | -------------------------------------------------------------------------------- /Component/fatfs/inc/FatFs_Demo.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef __FATFS_DEMO_H__ 3 | #define __FATFS_DEMO_H__ 4 | 5 | #include 6 | #include "ff.h" 7 | #include "GlobalDef.h" 8 | 9 | 10 | 11 | 12 | 13 | // 磁盘信息 14 | typedef struct 15 | { 16 | uint8_t mount; // 挂载是否成功; 0: 成功; 非0: 失败 17 | uint32_t total; // 总容量, KB 18 | uint32_t free; // 剩余容量, KB 19 | }DiskInfo; 20 | 21 | extern DiskInfo diskInfo[]; 22 | 23 | extern long strtol(const char *str, char **endptr, int base); 24 | 25 | FRESULT FILE_Open(FIL * pFileFIL, char * path, char * file_name); 26 | void FatFs_Demo(void); 27 | void FILE_FormatDisk(FATFS * disk, const char * diskPath, uint8_t format); 28 | void FILE_SearchUpdateBinFile(const char * diskPath); 29 | 30 | uint16_t FILE_GetDiskFree(uint8_t disk_index); 31 | 32 | 33 | 34 | #endif //end of file 35 | 36 | -------------------------------------------------------------------------------- /Component/fatfs/inc/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 | typedef unsigned __int64 QWORD; 12 | 13 | #else /* Embedded platform */ 14 | 15 | /* These types MUST be 16-bit or 32-bit */ 16 | typedef int INT; 17 | typedef unsigned int UINT; 18 | 19 | /* This type MUST be 8-bit */ 20 | typedef unsigned char BYTE; 21 | 22 | /* These types MUST be 16-bit */ 23 | typedef short SHORT; 24 | typedef unsigned short WORD; 25 | typedef unsigned short WCHAR; 26 | 27 | /* These types MUST be 32-bit */ 28 | typedef long LONG; 29 | typedef unsigned long DWORD; 30 | 31 | /* This type MUST be 64-bit (Remove this for ANSI C (C89) compatibility) */ 32 | typedef unsigned long long QWORD; 33 | 34 | #endif 35 | 36 | #endif 37 | -------------------------------------------------------------------------------- /My_Lib/FLASH/sd_card_interface.h: -------------------------------------------------------------------------------- 1 | 2 | /***************************** SD CARD 存储接口访问头文件 ****************************************************/ 3 | #ifndef __SD_CARD_INTERFACE_H__ 4 | #define __SD_CARD_INTERFACE_H__ 5 | 6 | #include 7 | 8 | #include "diskio.h" 9 | #include "Integer.h" 10 | 11 | #define SD_CARD_DISK_SIZE ((uint64_t)((uint64_t)2 * 1024 * 1024 * 1024)) // 2GB SD 卡 12 | #define SD_CARD_SECTOR_SIZE 512 // 扇区大小 13 | #define SD_CARD_BLOCK_SIZE 512 // 块大小 14 | 15 | int32_t sd_initialize(void); 16 | DRESULT sd_ioctl(BYTE lun, BYTE cmd, void *buff); 17 | DRESULT sd_disk_read(BYTE lun, BYTE * buff, DWORD sector, UINT count); 18 | DRESULT sd_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count); 19 | DRESULT sd_get_init_status(void); 20 | 21 | 22 | uint16_t sd_mal_read(uint8_t lun, uint64_t mem_offset, uint32_t * buff, uint16_t len); 23 | uint16_t sd_mal_write(uint8_t lun, uint64_t mem_offset, uint32_t * buff, uint16_t len); 24 | 25 | #include "sdcard_include.h" 26 | //DRESULT SD_ReadDisk(BYTE lun, const BYTE * buff, DWORD sector, UINT cnt); 27 | //DRESULT SD_WriteDisk(BYTE lun, const BYTE * buf, DWORD sector, UINT cnt); 28 | 29 | #endif 30 | 31 | -------------------------------------------------------------------------------- /My_Lib/FLASH/rom_flash_interface.h: -------------------------------------------------------------------------------- 1 | 2 | /* ******************************MCU FLASH 存储接口访问头文件 ********************************************/ 3 | #ifndef __ROM_FLASH_INTERFACE_H__ 4 | #define __ROM_FLASH_INTERFACE_H__ 5 | 6 | #include 7 | 8 | #include "diskio.h" 9 | #include "Integer.h" 10 | 11 | 12 | // MCU 内部 FLASH 的块定义 13 | #define ROM_FLASH_SIZE (32 * 1024L) // 32 K 14 | #define ROM_FLASH_START_ADDR (0x08000000 + MCU_ROM_SIZE - ROM_FLASH_SIZE) // Flash start address 15 | #define ROM_FLASH_PAGE_SIZE 0x400 // 1K per page 16 | #define ROM_FLASH_SECTOR_SIZE ROM_FLASH_PAGE_SIZE 17 | #define ROM_FLASH_WAIT_TIMEOUT 100000 18 | 19 | 20 | 21 | int32_t rom_flash_initialize(void); 22 | DRESULT rom_flash_ioctl(BYTE lun, BYTE cmd, void *buff); 23 | DRESULT rom_flash_disk_read(BYTE lun, BYTE * buff, DWORD sector, UINT count); 24 | DRESULT rom_flash_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count); 25 | 26 | uint16_t rom_flash_mal_write(uint8_t lun, uint32_t Memory_Offset, uint32_t * Writebuff, uint16_t Transfer_Length); 27 | uint16_t rom_flash_mal_read(uint8_t lun, uint32_t Memory_Offset, uint32_t * Readbuff, uint16_t Transfer_Length); 28 | 29 | 30 | 31 | 32 | 33 | #endif 34 | 35 | 36 | -------------------------------------------------------------------------------- /My_Lib/ImageHandle/ImageHandle.h: -------------------------------------------------------------------------------- 1 | #ifndef __ImageHandle_H 2 | #define __ImageHandle_H 3 | 4 | #include "ALL_Includes.h" 5 | 6 | #define BackgroundColor BLACK 7 | #define IR_Resolution 768 8 | #define IR_ResolutionX 24 9 | #define IR_ResolutionY 32 10 | 11 | extern s16 TmpH; 12 | extern s16 TmpL; 13 | extern u16 POINT_COLOR; 14 | extern s16 StorageTmpH,StorageTmpL; 15 | extern u16 MinPoniter; 16 | extern float MaxTemp,MinTemp; 17 | 18 | 19 | int Tmp2Color(float Tmps); 20 | void SetSmoothingCoefficient(void); 21 | void DispRul(void); 22 | uint16_t swap16(uint16_t a); 23 | void Dispbackground(void); 24 | void SetDispBuf(float *Temp); 25 | void Disp_BigFloatNum(int x,int y,float num,unsigned int color,unsigned int b_color); 26 | void Disp_SmallFloatNum(int x,int y,float num,unsigned int color,unsigned int b_color); 27 | void DispPowerShape(void); 28 | void FindMaxMinTemp(float *Temp); 29 | void DispMaxMinTemp(void); 30 | void DispReflectRate(void); 31 | void DispOneGridPower(u16 color); 32 | void DispTwoGridPower(u16 color); 33 | void DispThreeGridPower(u16 color); 34 | void DispFourGridPower(u16 color); 35 | void DispBatPower(void); 36 | void DispCross(unsigned int x,unsigned int y,unsigned int color); 37 | void AverageFilter(float *Temp); 38 | 39 | 40 | #endif 41 | 42 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/bsp.h: -------------------------------------------------------------------------------- 1 | 2 | #ifndef BSP_PRESENT 3 | #define BSP_PRESENT 4 | 5 | /* 6 | ********************************************************************************************************* 7 | * EXTERNS 8 | ********************************************************************************************************* 9 | */ 10 | 11 | 12 | /* 13 | ********************************************************************************************************* 14 | * INCLUDE FILES 15 | ********************************************************************************************************* 16 | */ 17 | 18 | 19 | 20 | #include "stm32f4xx_conf.h" 21 | 22 | 23 | 24 | 25 | 26 | 27 | /* 28 | ********************************************************************************************************* 29 | * FUNCTION PROTOTYPES 30 | ********************************************************************************************************* 31 | */ 32 | 33 | 34 | void delay(uint32_t nCount); 35 | 36 | 37 | 38 | /* 39 | ********************************************************************************************************* 40 | * INTERRUPT SERVICES 41 | ********************************************************************************************************* 42 | */ 43 | 44 | 45 | #endif /* End of module include. */ 46 | 47 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_if_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_if_template.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header for dfu_mal.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CDC_IF_TEMPLATE_H 24 | #define __USBD_CDC_IF_TEMPLATE_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | #include "usbd_conf.h" 29 | #include "usbd_cdc_core.h" 30 | 31 | /* Exported types ------------------------------------------------------------*/ 32 | /* Exported constants --------------------------------------------------------*/ 33 | 34 | extern CDC_IF_Prop_TypeDef TEMPLATE_fops; 35 | 36 | /* Exported macro ------------------------------------------------------------*/ 37 | /* Exported functions ------------------------------------------------------- */ 38 | #endif /* __USBD_CDC_IF_TEMPLATE_H */ 39 | 40 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 41 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/inc/usbd_otp_if.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_otp_if.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header for usbd_otp_if.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __OTP_IF_MAL_H 24 | #define __OTP_IF_MAL_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbd_dfu_mal.h" 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | #define OTP_START_ADD 0x1FFF7800 32 | #define OTP_END_ADD (uint32_t)(OTP_START_ADD + 528) 33 | 34 | #define OTP_IF_STRING (uint8_t*)"@OTP Area /0x1FFF7800/01*512 g,01*016 g" 35 | 36 | extern DFU_MAL_Prop_TypeDef DFU_Otp_cb; 37 | 38 | /* Exported macro ------------------------------------------------------------*/ 39 | /* Exported functions ------------------------------------------------------- */ 40 | 41 | #endif /* __OTP_IF_MAL_H */ 42 | 43 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 44 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/msc/inc/usbd_msc_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_msc_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header for the usbd_msc_core.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef _USB_MSC_CORE_H_ 24 | #define _USB_MSC_CORE_H_ 25 | 26 | #include "usbd_ioreq.h" 27 | 28 | /** @addtogroup USBD_MSC_BOT 29 | * @{ 30 | */ 31 | 32 | /** @defgroup USBD_MSC 33 | * @brief This file is the Header file for USBD_msc.c 34 | * @{ 35 | */ 36 | 37 | 38 | /** @defgroup USBD_BOT_Exported_Defines 39 | * @{ 40 | */ 41 | 42 | 43 | #define BOT_GET_MAX_LUN 0xFE 44 | #define BOT_RESET 0xFF 45 | #define USB_MSC_CONFIG_DESC_SIZ 32 46 | 47 | #define MSC_EPIN_SIZE MSC_MAX_PACKET 48 | #define MSC_EPOUT_SIZE MSC_MAX_PACKET 49 | 50 | /** 51 | * @} 52 | */ 53 | 54 | /** @defgroup USB_CORE_Exported_Types 55 | * @{ 56 | */ 57 | 58 | extern USBD_Class_cb_TypeDef USBD_MSC_cb; 59 | /** 60 | * @} 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | #endif /* _USB_MSC_CORE_H_ */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 72 | -------------------------------------------------------------------------------- /User/stm32f4xx_it.c: -------------------------------------------------------------------------------- 1 | //V1.0.0 2 | #include "stm32f4xx_it.h" 3 | #include "GlobalDef.h" 4 | 5 | //NMI exception handler 6 | void NMI_Handler(void) 7 | { 8 | } 9 | 10 | //Hard Fault exception handler 11 | void HardFault_Handler(void) 12 | { 13 | while (1) 14 | { 15 | } 16 | } 17 | 18 | //Memory Manage exception handler 19 | void MemManage_Handler(void) 20 | { 21 | while (1) 22 | { 23 | } 24 | } 25 | 26 | //Bus Fault exception handler 27 | void BusFault_Handler(void) 28 | { 29 | while (1) 30 | { 31 | } 32 | } 33 | 34 | //Usage Fault exception handler 35 | void UsageFault_Handler(void) 36 | { 37 | while (1) 38 | { 39 | } 40 | } 41 | 42 | //SVCall exception handler 43 | void SVC_Handler(void) 44 | { 45 | } 46 | 47 | //Debug Monitor exception handler 48 | void DebugMon_Handler(void) 49 | { 50 | } 51 | 52 | //PendSVC exception handler 53 | void PendSV_Handler(void) 54 | { 55 | } 56 | 57 | extern void SysTick_Increment(void); 58 | 59 | void SysTick_Handler(void) 60 | { 61 | SysTick_Increment(); 62 | } 63 | 64 | 65 | 66 | //#ifndef USE_STM3210C_EVAL 67 | /** 68 | * @brief This function handles SDIO global interrupt request. 69 | * @param None 70 | * @retval None 71 | */ 72 | //void SDIO_IRQHandler(void) 73 | //{ 74 | /* Process All SDIO Interrupt Sources */ 75 | // SD_ProcessIRQSrc(); 76 | //} 77 | //#endif 78 | 79 | /******************************************************************************/ 80 | /* STM32Fxxx Peripherals Interrupt Handlers */ 81 | /* Add here the Interrupt Handler for the used peripheral(s) (PPP), for the */ 82 | /* available peripheral interrupt handler's name please refer to the startup */ 83 | /* file (startup_stm32fxxx.s). */ 84 | /******************************************************************************/ 85 | 86 | /** 87 | * @brief This function handles PPP interrupt request. 88 | * @param None 89 | * @retval None 90 | */ 91 | /* void PPP_IRQHandler(void) { } */ 92 | 93 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 94 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/inc/usbd_mem_if_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_mem_if_template.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header for usbd_mem_if_template.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __MEM_IF_MAL_H 24 | #define __MEM_IF_MAL_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | 29 | #include "usbd_dfu_mal.h" 30 | 31 | /* Exported types ------------------------------------------------------------*/ 32 | /* Exported constants --------------------------------------------------------*/ 33 | #define MEM_START_ADD 0x00000000 /* Dummy start address */ 34 | #define MEM_END_ADD (uint32_t)(MEM_START_ADD + (5 * 1024)) /* Dummy Size = 5KB */ 35 | 36 | #define MEM_IF_STRING "@Dummy Memory /0x00000000/01*002Kg,03*001Kg" 37 | 38 | extern DFU_MAL_Prop_TypeDef DFU_Mem_cb; 39 | 40 | /* Exported macro ------------------------------------------------------------*/ 41 | /* Exported functions ------------------------------------------------------- */ 42 | 43 | #endif /* __MEM_IF_MAL_H */ 44 | 45 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 46 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Core/inc/usbd_conf_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_conf_template.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 30-June-2015 7 | * @brief usb device configuration template file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CONF__H__ 24 | #define __USBD_CONF__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | 29 | /** @defgroup USB_CONF_Exported_Defines 30 | * @{ 31 | */ 32 | #define USE_USB_OTG_HS 33 | 34 | #define USBD_CFG_MAX_NUM 1 35 | #define USB_MAX_STR_DESC_SIZ 64 36 | #define USBD_EP0_MAX_PACKET_SIZE 64 37 | 38 | /** 39 | * @} 40 | */ 41 | 42 | 43 | /** @defgroup USB_CONF_Exported_Types 44 | * @{ 45 | */ 46 | /** 47 | * @} 48 | */ 49 | 50 | 51 | /** @defgroup USB_CONF_Exported_Macros 52 | * @{ 53 | */ 54 | /** 55 | * @} 56 | */ 57 | 58 | /** @defgroup USB_CONF_Exported_Variables 59 | * @{ 60 | */ 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup USB_CONF_Exported_FunctionsPrototype 66 | * @{ 67 | */ 68 | /** 69 | * @} 70 | */ 71 | 72 | 73 | #endif //__USBD_CONF__H__ 74 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 76 | 77 | -------------------------------------------------------------------------------- /Component/SFUD-master/sfud/inc/sfud_cfg.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Serial Flash Universal Driver Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is the configure head file for this library. 26 | * Created on: 2016-04-23 27 | */ 28 | 29 | #ifndef _SFUD_CFG_H_ 30 | #define _SFUD_CFG_H_ 31 | 32 | //#define SFUD_DEBUG_MODE 33 | 34 | #define SFUD_USING_SFDP 35 | 36 | #define SFUD_USING_FLASH_INFO_TABLE 37 | 38 | enum { 39 | SFUD_W25Q16JV_DEVICE_INDEX = 0, 40 | }; 41 | 42 | //#define C99 // 是否使用C99, added by pi 2017-5-18 43 | 44 | #ifdef C99 45 | #define SFUD_FLASH_DEVICE_TABLE \ 46 | {\ 47 | [SFUD_W25Q16JV_DEVICE_INDEX] = {.name = "W25Q16JV", .spi.name = "SPIx"}, \ 48 | } 49 | #else 50 | #define SFUD_DEVICE_INDEX_0_NAME "W25Q16JV" 51 | #define SFUD_DEVICE_INDEX_0_SPI "SPIx" 52 | #endif 53 | 54 | 55 | 56 | 57 | 58 | 59 | #endif /* _SFUD_CFG_H_ */ 60 | 61 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/hid_cdc_wrapper/inc/usbd_hid_cdc_wrapper.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_hid_cdc_wrapper.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_hid_cdc_wrapper.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_HID_CDC_WRAPPER_H_ 25 | #define __USB_HID_CDC_WRAPPER_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USBD_HID_CDC 34 | * @brief This file is the Header file for usbd_msc_cdc_wrapper.c 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup USBD_HID_MSC_Exported_Defines 40 | * @{ 41 | */ 42 | 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 50 | * @{ 51 | */ 52 | 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | 60 | /** @defgroup USBD_CORE_Exported_Macros 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBD_CORE_Exported_Variables 69 | * @{ 70 | */ 71 | 72 | extern USBD_Class_cb_TypeDef USBD_HID_CDC_cb; 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | #endif /* __USB_MSC_CDC_WRAPPER_H_ */ 82 | /** 83 | * @} 84 | */ 85 | 86 | /** 87 | * @} 88 | */ 89 | 90 | /******************* (C) COPYRIGHT 2015 STMicroelectronics *****END OF FILE****/ 91 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_otg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_otg.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief OTG Core Header 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_OTG__ 24 | #define __USB_OTG__ 25 | 26 | 27 | /** @addtogroup USB_OTG_DRIVER 28 | * @{ 29 | */ 30 | 31 | /** @defgroup USB_OTG 32 | * @brief This file is the 33 | * @{ 34 | */ 35 | 36 | 37 | /** @defgroup USB_OTG_Exported_Defines 38 | * @{ 39 | */ 40 | 41 | 42 | void USB_OTG_InitiateSRP(void); 43 | void USB_OTG_InitiateHNP(uint8_t state , uint8_t mode); 44 | void USB_OTG_Switchback (USB_OTG_CORE_DEVICE *pdev); 45 | uint32_t USB_OTG_GetCurrentState (USB_OTG_CORE_DEVICE *pdev); 46 | 47 | /** 48 | * @} 49 | */ 50 | 51 | 52 | /** @defgroup USB_OTG_Exported_Types 53 | * @{ 54 | */ 55 | /** 56 | * @} 57 | */ 58 | 59 | 60 | /** @defgroup USB_OTG_Exported_Macros 61 | * @{ 62 | */ 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup USB_OTG_Exported_Variables 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USB_OTG_Exported_FunctionsPrototype 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | 82 | #endif //__USB_OTG__ 83 | 84 | 85 | /** 86 | * @} 87 | */ 88 | 89 | /** 90 | * @} 91 | */ 92 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 93 | 94 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/hid_msc_wrapper/inc/usbd_msc_hid_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_msc_hid_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_msc_hid_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_MSC_HID_CORE_H_ 25 | #define __USB_MSC_HID_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USBD_HID 34 | * @brief This file is the Header file for USBD_msc.c 35 | * @{ 36 | */ 37 | #define HID_INTERFACE 0x0 38 | #define MSC_INTERFACE 0x1 39 | 40 | /** @defgroup USBD_HID_Exported_Defines 41 | * @{ 42 | */ 43 | #define USB_MSC_HID_CONFIG_DESC_SIZ (USB_HID_CONFIG_DESC_SIZ -9 + USB_MSC_CONFIG_DESC_SIZ) 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 50 | * @{ 51 | */ 52 | 53 | 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | 60 | /** @defgroup USBD_CORE_Exported_Macros 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @defgroup USBD_CORE_Exported_Variables 69 | * @{ 70 | */ 71 | 72 | extern USBD_Class_cb_TypeDef USBD_MSC_HID_cb; 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USB_CORE_Exported_Functions 78 | * @{ 79 | */ 80 | 81 | /** 82 | * @} 83 | */ 84 | 85 | #endif /* __USB_HID_CORE_H_ */ 86 | /** 87 | * @} 88 | */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 95 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Core/inc/usbh_conf_template.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_conf_template 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief General USB Host library configuration 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBH_CONF__H__ 24 | #define __USBH_CONF__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | 28 | /** @addtogroup USBH_OTG_DRIVER 29 | * @{ 30 | */ 31 | 32 | /** @defgroup USBH_CONF 33 | * @brief usb otg low level driver configuration file 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USBH_CONF_Exported_Defines 38 | * @{ 39 | */ 40 | 41 | #define USBH_MAX_NUM_ENDPOINTS 2 42 | #define USBH_MAX_NUM_INTERFACES 2 43 | #ifdef USE_USB_OTG_FS 44 | #define USBH_MSC_MPS_SIZE 0x40 45 | #else 46 | #define USBH_MSC_MPS_SIZE 0x200 47 | #endif 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USBH_CONF_Exported_Types 55 | * @{ 56 | */ 57 | /** 58 | * @} 59 | */ 60 | 61 | 62 | /** @defgroup USBH_CONF_Exported_Macros 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USBH_CONF_Exported_Variables 70 | * @{ 71 | */ 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @defgroup USBH_CONF_Exported_FunctionsPrototype 77 | * @{ 78 | */ 79 | /** 80 | * @} 81 | */ 82 | 83 | 84 | #endif //__USBH_CONF__H__ 85 | 86 | 87 | /** 88 | * @} 89 | */ 90 | 91 | /** 92 | * @} 93 | */ 94 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 95 | 96 | -------------------------------------------------------------------------------- /Component/USB_F4/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 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header for the usbd_msc_data.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef _USBD_MSC_DATA_H_ 25 | #define _USBD_MSC_DATA_H_ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_conf.h" 29 | 30 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_INFO 35 | * @brief general defines for the usb device library file 36 | * @{ 37 | */ 38 | 39 | /** @defgroup USB_INFO_Exported_Defines 40 | * @{ 41 | */ 42 | #define MODE_SENSE6_LEN 8 43 | #define MODE_SENSE10_LEN 8 44 | #define LENGTH_INQUIRY_PAGE00 7 45 | #define LENGTH_FORMAT_CAPACITIES 20 46 | 47 | /** 48 | * @} 49 | */ 50 | 51 | 52 | /** @defgroup USBD_INFO_Exported_TypesDefinitions 53 | * @{ 54 | */ 55 | /** 56 | * @} 57 | */ 58 | 59 | 60 | 61 | /** @defgroup USBD_INFO_Exported_Macros 62 | * @{ 63 | */ 64 | 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USBD_INFO_Exported_Variables 70 | * @{ 71 | */ 72 | extern const uint8_t MSC_Page00_Inquiry_Data[]; 73 | extern const uint8_t MSC_Mode_Sense6_data[]; 74 | extern const uint8_t MSC_Mode_Sense10_data[] ; 75 | 76 | /** 77 | * @} 78 | */ 79 | 80 | /** @defgroup USBD_INFO_Exported_FunctionsPrototypes 81 | * @{ 82 | */ 83 | 84 | /** 85 | * @} 86 | */ 87 | 88 | #endif /* _USBD_MSC_DATA_H_ */ 89 | 90 | /** 91 | * @} 92 | */ 93 | 94 | /** 95 | * @} 96 | */ 97 | 98 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 99 | -------------------------------------------------------------------------------- /CMSIS/system_stm32f4xx.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file system_stm32f4xx.h 4 | * @author MCD Application Team 5 | * @version V1.0.0RC1 6 | * @date 25-August-2011 7 | * @brief CMSIS Cortex-M4 Device System Source File for STM32F4xx devices. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /** @addtogroup CMSIS 23 | * @{ 24 | */ 25 | 26 | /** @addtogroup stm32f4xx_system 27 | * @{ 28 | */ 29 | 30 | /** 31 | * @brief Define to prevent recursive inclusion 32 | */ 33 | #ifndef __SYSTEM_STM32F4XX_H 34 | #define __SYSTEM_STM32F4XX_H 35 | 36 | #ifdef __cplusplus 37 | extern "C" { 38 | #endif 39 | 40 | /** @addtogroup STM32F4xx_System_Includes 41 | * @{ 42 | */ 43 | 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @addtogroup STM32F4xx_System_Exported_types 50 | * @{ 51 | */ 52 | 53 | extern uint32_t SystemCoreClock; /*!< System Clock Frequency (Core Clock) */ 54 | 55 | 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @addtogroup STM32F4xx_System_Exported_Constants 61 | * @{ 62 | */ 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** @addtogroup STM32F4xx_System_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | /** @addtogroup STM32F4xx_System_Exported_Functions 77 | * @{ 78 | */ 79 | 80 | extern void SystemInit(void); 81 | extern void SystemCoreClockUpdate(void); 82 | /** 83 | * @} 84 | */ 85 | 86 | #ifdef __cplusplus 87 | } 88 | #endif 89 | 90 | #endif /*__SYSTEM_STM32F4XX_H */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 100 | -------------------------------------------------------------------------------- /libaray/inc/stm32f4xx_crc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the CRC firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_CRC_H 25 | #define __STM32F4xx_CRC_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup CRC 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup CRC_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** 50 | * @} 51 | */ 52 | 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions --------------------------------------------------------*/ 55 | 56 | void CRC_ResetDR(void); 57 | uint32_t CRC_CalcCRC(uint32_t Data); 58 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength); 59 | uint32_t CRC_GetCRC(void); 60 | void CRC_SetIDRegister(uint8_t IDValue); 61 | uint8_t CRC_GetIDRegister(void); 62 | 63 | #ifdef __cplusplus 64 | } 65 | #endif 66 | 67 | #endif /* __STM32F4xx_CRC_H */ 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** 74 | * @} 75 | */ 76 | 77 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 78 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/inc/usbd_flash_if.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_flash_if.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header for usbd_flash_if.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __FLASH_IF_MAL_H 24 | #define __FLASH_IF_MAL_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbd_dfu_mal.h" 28 | 29 | /* Exported types ------------------------------------------------------------*/ 30 | /* Exported constants --------------------------------------------------------*/ 31 | #define FLASH_START_ADD 0x08000000 32 | 33 | #ifdef STM32F2XX 34 | #define FLASH_END_ADD 0x08100000 35 | #define FLASH_IF_STRING (unsigned char *)"@Internal Flash /0x08000000/03*016Ka,01*016Kg,01*064Kg,07*128Kg" 36 | #elif defined(STM32F40_41xxx) 37 | #define FLASH_END_ADD 0x08100000 38 | #define FLASH_IF_STRING (unsigned char *) "@Internal Flash /0x08000000/03*016Ka,01*016Kg,01*064Kg,07*128Kg" 39 | 40 | #elif defined(STM32F429_439xx) 41 | #define FLASH_END_ADD 0x08200000 42 | #define FLASH_IF_STRING (unsigned char *) "@Internal Flash /0x08000000/03*016Ka,01*016Kg,01*064Kg,07*128Kg,04*016Kg,01*064Kg,07*128Kg" 43 | 44 | 45 | #elif defined(STM32F10X_CL) 46 | #define FLASH_END_ADD 0x08040000 47 | #define FLASH_IF_STRING (unsigned char *) "@Internal Flash /0x08000000/06*002Ka,122*002Kg" 48 | #endif /* STM32F2XX */ 49 | 50 | 51 | extern DFU_MAL_Prop_TypeDef DFU_Flash_cb; 52 | 53 | /* Exported macro ------------------------------------------------------------*/ 54 | /* Exported functions ------------------------------------------------------- */ 55 | 56 | #endif /* __FLASH_IF_MAL_H */ 57 | 58 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 59 | -------------------------------------------------------------------------------- /My_Lib/MLX90640/MLX90640_API.h: -------------------------------------------------------------------------------- 1 | /** 2 | * @copyright (C) 2017 Melexis N.V. 3 | * 4 | * Licensed under the Apache License, Version 2.0 (the "License"); 5 | * you may not use this file except in compliance with the License. 6 | * You may obtain a copy of the License at 7 | * 8 | * http://www.apache.org/licenses/LICENSE-2.0 9 | * 10 | * Unless required by applicable law or agreed to in writing, software 11 | * distributed under the License is distributed on an "AS IS" BASIS, 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | * See the License for the specific language governing permissions and 14 | * limitations under the License. 15 | * 16 | */ 17 | #ifndef _MLX640_API_H_ 18 | #define _MLX640_API_H_ 19 | 20 | typedef struct 21 | { 22 | int16_t kVdd; 23 | int16_t vdd25; 24 | float KvPTAT; 25 | float KtPTAT; 26 | uint16_t vPTAT25; 27 | float alphaPTAT; 28 | int16_t gainEE; 29 | float tgc; 30 | float cpKv; 31 | float cpKta; 32 | uint8_t resolutionEE; 33 | uint8_t calibrationModeEE; 34 | float KsTa; 35 | float ksTo[4]; 36 | int16_t ct[4]; 37 | float alpha[768]; 38 | int16_t offset[768]; 39 | float kta[768]; 40 | float kv[768]; 41 | float cpAlpha[2]; 42 | int16_t cpOffset[2]; 43 | float ilChessC[3]; 44 | uint16_t brokenPixels[5]; 45 | uint16_t outlierPixels[5]; 46 | } paramsMLX90640; 47 | 48 | int MLX90640_DumpEE(uint8_t slaveAddr, uint16_t *eeData); 49 | int MLX90640_GetFrameData(uint8_t slaveAddr, uint16_t *frameData); 50 | int MLX90640_ExtractParameters(uint16_t *eeData, paramsMLX90640 *mlx90640); 51 | float MLX90640_GetVdd(uint16_t *frameData, const paramsMLX90640 *params); 52 | float MLX90640_GetTa(uint16_t *frameData, const paramsMLX90640 *params); 53 | void MLX90640_GetImage(uint16_t *frameData, const paramsMLX90640 *params, float *result); 54 | void MLX90640_CalculateTo(uint16_t *frameData, const paramsMLX90640 *params, float emissivity, float tr, float *result); 55 | int MLX90640_SetResolution(uint8_t slaveAddr, uint8_t resolution); 56 | int MLX90640_GetCurResolution(uint8_t slaveAddr); 57 | int MLX90640_SetRefreshRate(uint8_t slaveAddr, uint8_t refreshRate); 58 | int MLX90640_GetRefreshRate(uint8_t slaveAddr); 59 | int MLX90640_GetSubPageNumber(uint16_t *frameData); 60 | int MLX90640_GetCurMode(uint8_t slaveAddr); 61 | int MLX90640_SetInterleavedMode(uint8_t slaveAddr); 62 | int MLX90640_SetChessMode(uint8_t slaveAddr); 63 | void MLX90640_BadPixelsCorrection(uint16_t *pixels, float *to, int mode, paramsMLX90640 *params); 64 | 65 | #endif 66 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_core_loopback.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_cdc_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_CDC_CORE_H_ 25 | #define __USB_CDC_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup usbd_cdc 34 | * @brief This file is the Header file for USBD_cdc.c 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup usbd_cdc_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_CDC_CONFIG_DESC_SIZ (67) 43 | #define USB_CDC_DESC_SIZ (67-9) 44 | 45 | #define DEVICE_CLASS_CDC 0x02 46 | #define DEVICE_SUBCLASS_CDC 0x00 47 | 48 | #define CDC_DATA_IN_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 49 | 50 | #define CDC_DATA_OUT_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 51 | 52 | /** 53 | * @} 54 | */ 55 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 56 | * @{ 57 | */ 58 | typedef struct _CDC_IF_PROP 59 | { 60 | uint16_t (*pIf_DataTx) (void); 61 | uint16_t (*pIf_DataRx) (uint32_t Len); 62 | } 63 | CDC_IF_Prop_TypeDef; 64 | /** 65 | * @} 66 | */ 67 | 68 | 69 | 70 | /** @defgroup USBD_CORE_Exported_Macros 71 | * @{ 72 | */ 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USBD_CORE_Exported_Variables 79 | * @{ 80 | */ 81 | 82 | extern USBD_Class_cb_TypeDef USBD_CDC_cb; 83 | /** 84 | * @} 85 | */ 86 | 87 | /** @defgroup USB_CORE_Exported_Functions 88 | * @{ 89 | */ 90 | /** 91 | * @} 92 | */ 93 | 94 | #endif /* __USB_CDC_CORE_H_ */ 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_bsp.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_bsp.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Specific api's relative to the used hardware platform 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_BSP__H__ 24 | #define __USB_BSP__H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_core.h" 28 | 29 | /** @addtogroup USB_OTG_DRIVER 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USB_BSP 34 | * @brief This file is the 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup USB_BSP_Exported_Defines 40 | * @{ 41 | */ 42 | /** 43 | * @} 44 | */ 45 | 46 | 47 | /** @defgroup USB_BSP_Exported_Types 48 | * @{ 49 | */ 50 | /** 51 | * @} 52 | */ 53 | 54 | 55 | /** @defgroup USB_BSP_Exported_Macros 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | /** @defgroup USB_BSP_Exported_Variables 63 | * @{ 64 | */ 65 | /** 66 | * @} 67 | */ 68 | 69 | /** @defgroup USB_BSP_Exported_FunctionsPrototype 70 | * @{ 71 | */ 72 | void BSP_Init(void); 73 | 74 | void USB_OTG_BSP_Init (USB_OTG_CORE_HANDLE *pdev); 75 | void USB_OTG_BSP_uDelay (const uint32_t usec); 76 | void USB_OTG_BSP_mDelay (const uint32_t msec); 77 | void USB_OTG_BSP_EnableInterrupt (USB_OTG_CORE_HANDLE *pdev); 78 | void USB_OTG_BSP_TimerIRQ (void); 79 | #ifdef USE_HOST_MODE 80 | void USB_OTG_BSP_ConfigVBUS(USB_OTG_CORE_HANDLE *pdev); 81 | void USB_OTG_BSP_DriveVBUS(USB_OTG_CORE_HANDLE *pdev,uint8_t state); 82 | void USB_OTG_BSP_Resume(USB_OTG_CORE_HANDLE *pdev) ; 83 | void USB_OTG_BSP_Suspend(USB_OTG_CORE_HANDLE *pdev); 84 | 85 | #endif /* USE_HOST_MODE */ 86 | /** 87 | * @} 88 | */ 89 | 90 | #endif /* __USB_BSP__H__ */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** 97 | * @} 98 | */ 99 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 100 | 101 | -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usbd_usr.c: -------------------------------------------------------------------------------- 1 | 2 | #include "usbd_usr.h" 3 | #include "usb_dcd_int.h" 4 | #include 5 | #include "GlobalDef.h" 6 | 7 | // connect status: 0: no conn; 1: connected 8 | vu8 bDeviceState = 0; // default: no connect 9 | 10 | 11 | 12 | extern USB_OTG_CORE_HANDLE USB_OTG_dev; 13 | 14 | extern uint32_t USBD_OTG_ISR_Handler(USB_OTG_CORE_HANDLE * pdev); 15 | 16 | #ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED 17 | extern uint32_t USBD_OTG_EP1IN_ISR_Handler(USB_OTG_CORE_HANDLE * pdev); 18 | extern uint32_t USBD_OTG_EP1OUT_ISR_Handler(USB_OTG_CORE_HANDLE * pdev); 19 | #endif 20 | 21 | 22 | #ifdef USE_USB_OTG_FS 23 | void OTG_FS_IRQHandler(void) 24 | { 25 | USBD_OTG_ISR_Handler(&USB_OTG_dev); 26 | } 27 | #endif 28 | #ifdef USB_OTG_HS_DEDICATED_EP1_ENABLED 29 | /** 30 | * @brief This function handles EP1_IN Handler. 31 | * @param None 32 | * @retval None 33 | */ 34 | void OTG_HS_EP1_IN_IRQHandler(void) 35 | { 36 | USBD_OTG_EP1IN_ISR_Handler(&USB_OTG_dev); 37 | } 38 | 39 | /** 40 | * @brief This function handles EP1_OUT Handler. 41 | * @param None 42 | * @retval None 43 | */ 44 | void OTG_HS_EP1_OUT_IRQHandler(void) 45 | { 46 | USBD_OTG_EP1OUT_ISR_Handler(&USB_OTG_dev); 47 | } 48 | #endif 49 | 50 | 51 | USBD_Usr_cb_TypeDef USR_cb = 52 | { 53 | USBD_USR_Init, 54 | USBD_USR_DeviceReset, 55 | USBD_USR_DeviceConfigured, 56 | USBD_USR_DeviceSuspended, 57 | USBD_USR_DeviceResumed, 58 | USBD_USR_DeviceConnected, 59 | USBD_USR_DeviceDisconnected, 60 | }; 61 | 62 | void USBD_USR_Init(void) 63 | { 64 | 65 | } 66 | 67 | //USB Device Reset 68 | //speed: 0: high speed; 1: full speed; >1: others 69 | void USBD_USR_DeviceReset (uint8_t speed) 70 | { 71 | switch (speed) 72 | { 73 | case USB_OTG_SPEED_HIGH: 74 | os_printf("USB Device Library v1.2.1 [HS]\r\n"); 75 | break; 76 | case USB_OTG_SPEED_FULL: 77 | os_printf("USB Device Library v1.2.1 [FS]\r\n"); 78 | break; 79 | default: 80 | os_printf("USB Device Library v1.2.1 [??]\r\n"); 81 | break; 82 | } 83 | } 84 | 85 | void USBD_USR_DeviceConfigured (void) 86 | { 87 | os_printf("MSC Interface started.\r\n"); 88 | } 89 | 90 | void USBD_USR_DeviceSuspended(void) 91 | { 92 | os_printf("Device In suspend mode.\r\n"); 93 | } 94 | 95 | void USBD_USR_DeviceResumed(void) 96 | { 97 | os_printf("Device Resumed\r\n"); 98 | } 99 | 100 | 101 | void USBD_USR_DeviceConnected (void) 102 | { 103 | bDeviceState = 1; 104 | os_printf("USB Device Connected.\r\n"); 105 | } 106 | 107 | void USBD_USR_DeviceDisconnected (void) 108 | { 109 | bDeviceState = 0; 110 | os_printf("USB Device Disconnected.\r\n"); 111 | } 112 | 113 | 114 | 115 | 116 | 117 | 118 | 119 | 120 | 121 | 122 | 123 | 124 | 125 | 126 | 127 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Core/inc/usbd_req.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_req.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_req.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USB_REQUEST_H_ 25 | #define __USB_REQUEST_H_ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | #include "usbd_core.h" 30 | #include "usbd_conf.h" 31 | 32 | 33 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USBD_REQ 38 | * @brief header file for the usbd_ioreq.c file 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBD_REQ_Exported_Defines 43 | * @{ 44 | */ 45 | /** 46 | * @} 47 | */ 48 | 49 | 50 | /** @defgroup USBD_REQ_Exported_Types 51 | * @{ 52 | */ 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | 59 | /** @defgroup USBD_REQ_Exported_Macros 60 | * @{ 61 | */ 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup USBD_REQ_Exported_Variables 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup USBD_REQ_Exported_FunctionsPrototype 74 | * @{ 75 | */ 76 | 77 | USBD_Status USBD_StdDevReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 78 | USBD_Status USBD_StdItfReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 79 | USBD_Status USBD_StdEPReq (USB_OTG_CORE_HANDLE *pdev, USB_SETUP_REQ *req); 80 | void USBD_ParseSetupRequest( USB_OTG_CORE_HANDLE *pdev, 81 | USB_SETUP_REQ *req); 82 | 83 | void USBD_CtlError( USB_OTG_CORE_HANDLE *pdev, 84 | USB_SETUP_REQ *req); 85 | 86 | void USBD_GetString(uint8_t *desc, uint8_t *unicode, uint16_t *len); 87 | /** 88 | * @} 89 | */ 90 | 91 | #endif /* __USB_REQUEST_H_ */ 92 | 93 | /** 94 | * @} 95 | */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | 102 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 103 | -------------------------------------------------------------------------------- /Component/USB_F4/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 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief This file provides all the vital inquiry pages and sense data. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usbd_msc_data.h" 24 | 25 | 26 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 27 | * @{ 28 | */ 29 | 30 | 31 | /** @defgroup MSC_DATA 32 | * @brief Mass storage info/data module 33 | * @{ 34 | */ 35 | 36 | /** @defgroup MSC_DATA_Private_TypesDefinitions 37 | * @{ 38 | */ 39 | /** 40 | * @} 41 | */ 42 | 43 | 44 | /** @defgroup MSC_DATA_Private_Defines 45 | * @{ 46 | */ 47 | /** 48 | * @} 49 | */ 50 | 51 | 52 | /** @defgroup MSC_DATA_Private_Macros 53 | * @{ 54 | */ 55 | /** 56 | * @} 57 | */ 58 | 59 | 60 | /** @defgroup MSC_DATA_Private_Variables 61 | * @{ 62 | */ 63 | 64 | 65 | /* USB Mass storage Page 0 Inquiry Data */ 66 | const uint8_t MSC_Page00_Inquiry_Data[] = {//7 67 | 0x00, 68 | 0x00, 69 | 0x00, 70 | (LENGTH_INQUIRY_PAGE00 - 4), 71 | 0x00, 72 | 0x80, 73 | 0x83 74 | }; 75 | /* USB Mass storage sense 6 Data */ 76 | const uint8_t MSC_Mode_Sense6_data[] = { 77 | 0x00, 78 | 0x00, 79 | 0x00, 80 | 0x00, 81 | 0x00, 82 | 0x00, 83 | 0x00, 84 | 0x00 85 | }; 86 | /* USB Mass storage sense 10 Data */ 87 | const uint8_t MSC_Mode_Sense10_data[] = { 88 | 0x00, 89 | 0x06, 90 | 0x00, 91 | 0x00, 92 | 0x00, 93 | 0x00, 94 | 0x00, 95 | 0x00 96 | }; 97 | /** 98 | * @} 99 | */ 100 | 101 | 102 | /** @defgroup MSC_DATA_Private_FunctionPrototypes 103 | * @{ 104 | */ 105 | /** 106 | * @} 107 | */ 108 | 109 | 110 | /** @defgroup MSC_DATA_Private_Functions 111 | * @{ 112 | */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | 124 | /** 125 | * @} 126 | */ 127 | 128 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 129 | -------------------------------------------------------------------------------- /Component/fatfs/inc/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 fucntion */ 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 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Core/inc/usbd_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbd_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_CORE_H 24 | #define __USBD_CORE_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_dcd.h" 28 | #include "usbd_def.h" 29 | #include "usbd_conf.h" 30 | 31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USBD_CORE 36 | * @brief This file is the Header file for usbd_core.c file 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USBD_CORE_Exported_Defines 42 | * @{ 43 | */ 44 | 45 | typedef enum { 46 | USBD_OK = 0, 47 | USBD_BUSY, 48 | USBD_FAIL, 49 | }USBD_Status; 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 | 78 | /** 79 | * @} 80 | */ 81 | 82 | /** @defgroup USBD_CORE_Exported_FunctionsPrototype 83 | * @{ 84 | */ 85 | void USBD_Init(USB_OTG_CORE_HANDLE *pdev, 86 | USB_OTG_CORE_ID_TypeDef coreID, 87 | USBD_DEVICE *pDevice, 88 | USBD_Class_cb_TypeDef *class_cb, 89 | USBD_Usr_cb_TypeDef *usr_cb); 90 | 91 | USBD_Status USBD_DeInit(USB_OTG_CORE_HANDLE *pdev); 92 | 93 | USBD_Status USBD_ClrCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 94 | 95 | USBD_Status USBD_SetCfg(USB_OTG_CORE_HANDLE *pdev, uint8_t cfgidx); 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | #endif /* __USBD_CORE_H */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 112 | 113 | 114 | 115 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/HID/inc/usbh_hid_mouse.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_mouse.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief This file contains all the prototypes for the usbh_hid_mouse.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | 23 | /* Define to prevent recursive ----------------------------------------------*/ 24 | #ifndef __USBH_HID_MOUSE_H 25 | #define __USBH_HID_MOUSE_H 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbh_hid_core.h" 29 | 30 | /** @addtogroup USBH_LIB 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup USBH_CLASS 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup USBH_HID_CLASS 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBH_HID_MOUSE 43 | * @brief This file is the Header file for USBH_HID_MOUSE.c 44 | * @{ 45 | */ 46 | 47 | 48 | /** @defgroup USBH_HID_MOUSE_Exported_Types 49 | * @{ 50 | */ 51 | typedef struct _HID_MOUSE_Data 52 | { 53 | uint8_t x; 54 | uint8_t y; 55 | uint8_t z; /* Not Supported */ 56 | uint8_t button; 57 | } 58 | HID_MOUSE_Data_TypeDef; 59 | 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup USBH_HID_MOUSE_Exported_Defines 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USBH_HID_MOUSE_Exported_Macros 72 | * @{ 73 | */ 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USBH_HID_MOUSE_Exported_Variables 79 | * @{ 80 | */ 81 | 82 | extern HID_cb_TypeDef HID_MOUSE_cb; 83 | extern HID_MOUSE_Data_TypeDef HID_MOUSE_Data; 84 | /** 85 | * @} 86 | */ 87 | 88 | /** @defgroup USBH_HID_MOUSE_Exported_FunctionsPrototype 89 | * @{ 90 | */ 91 | void USR_MOUSE_Init (void); 92 | void USR_MOUSE_ProcessData (HID_MOUSE_Data_TypeDef *data); 93 | /** 94 | * @} 95 | */ 96 | 97 | #endif /* __USBH_HID_MOUSE_H */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** 104 | * @} 105 | */ 106 | 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/hid/inc/usbd_hid_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_hid_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_hid_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_HID_CORE_H_ 25 | #define __USB_HID_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup USBD_HID 34 | * @brief This file is the Header file for USBD_msc.c 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup USBD_HID_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_HID_CONFIG_DESC_SIZ 34 43 | #define USB_HID_DESC_SIZ 9 44 | #define HID_MOUSE_REPORT_DESC_SIZE 74 45 | 46 | #define HID_DESCRIPTOR_TYPE 0x21 47 | #define HID_REPORT_DESC 0x22 48 | 49 | #define HID_HS_BINTERVAL 0x07 50 | #define HID_FS_BINTERVAL 0x0A 51 | 52 | #define HID_REQ_SET_PROTOCOL 0x0B 53 | #define HID_REQ_GET_PROTOCOL 0x03 54 | 55 | #define HID_REQ_SET_IDLE 0x0A 56 | #define HID_REQ_GET_IDLE 0x02 57 | 58 | #define HID_REQ_SET_REPORT 0x09 59 | #define HID_REQ_GET_REPORT 0x01 60 | /** 61 | * @} 62 | */ 63 | 64 | 65 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 66 | * @{ 67 | */ 68 | 69 | 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | 76 | /** @defgroup USBD_CORE_Exported_Macros 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBD_CORE_Exported_Variables 85 | * @{ 86 | */ 87 | 88 | extern USBD_Class_cb_TypeDef USBD_HID_cb; 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup USB_CORE_Exported_Functions 94 | * @{ 95 | */ 96 | uint8_t USBD_HID_SendReport (USB_OTG_CORE_HANDLE *pdev, 97 | uint8_t *report, 98 | uint16_t len); 99 | 100 | uint32_t USBD_HID_GetPollingInterval (USB_OTG_CORE_HANDLE *pdev); 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | #endif /* __USB_HID_CORE_H_ */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** 112 | * @} 113 | */ 114 | 115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_hcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Host layer Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USB_HCD_H__ 24 | #define __USB_HCD_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_regs.h" 28 | #include "usb_core.h" 29 | 30 | 31 | /** @addtogroup USB_OTG_DRIVER 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USB_HCD 36 | * @brief This file is the 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USB_HCD_Exported_Defines 42 | * @{ 43 | */ 44 | /** 45 | * @} 46 | */ 47 | 48 | 49 | /** @defgroup USB_HCD_Exported_Types 50 | * @{ 51 | */ 52 | /** 53 | * @} 54 | */ 55 | 56 | 57 | /** @defgroup USB_HCD_Exported_Macros 58 | * @{ 59 | */ 60 | /** 61 | * @} 62 | */ 63 | 64 | /** @defgroup USB_HCD_Exported_Variables 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USB_HCD_Exported_FunctionsPrototype 72 | * @{ 73 | */ 74 | uint32_t HCD_Init (USB_OTG_CORE_HANDLE *pdev , 75 | USB_OTG_CORE_ID_TypeDef coreID); 76 | uint32_t HCD_HC_Init (USB_OTG_CORE_HANDLE *pdev , 77 | uint8_t hc_num); 78 | uint32_t HCD_SubmitRequest (USB_OTG_CORE_HANDLE *pdev , 79 | uint8_t hc_num) ; 80 | uint32_t HCD_GetCurrentSpeed (USB_OTG_CORE_HANDLE *pdev); 81 | uint32_t HCD_ResetPort (USB_OTG_CORE_HANDLE *pdev); 82 | uint32_t HCD_IsDeviceConnected (USB_OTG_CORE_HANDLE *pdev); 83 | uint32_t HCD_IsPortEnabled (USB_OTG_CORE_HANDLE *pdev); 84 | 85 | uint32_t HCD_GetCurrentFrame (USB_OTG_CORE_HANDLE *pdev) ; 86 | URB_STATE HCD_GetURB_State (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 87 | uint32_t HCD_GetXferCnt (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num); 88 | HC_STATUS HCD_GetHCState (USB_OTG_CORE_HANDLE *pdev, uint8_t ch_num) ; 89 | /** 90 | * @} 91 | */ 92 | 93 | #endif //__USB_HCD_H__ 94 | 95 | 96 | /** 97 | * @} 98 | */ 99 | 100 | /** 101 | * @} 102 | */ 103 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 104 | 105 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/msc/inc/usbd_msc_mem.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_msc_mem.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header for the STORAGE DISK file file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© COPYRIGHT 2015 STMicroelectronics

12 | * 13 | * Licensed under MCD-ST Liberty SW License Agreement V2, (the "License"); 14 | * You may not use this file except in compliance with the License. 15 | * You may obtain a copy of the License at: 16 | * 17 | * http://www.st.com/software_license_agreement_liberty_v2 18 | * 19 | * Unless required by applicable law or agreed to in writing, software 20 | * distributed under the License is distributed on an "AS IS" BASIS, 21 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 22 | * See the License for the specific language governing permissions and 23 | * limitations under the License. 24 | * 25 | ****************************************************************************** 26 | */ 27 | 28 | /* Define to prevent recursive inclusion -------------------------------------*/ 29 | 30 | #ifndef __USBD_MEM_H 31 | #define __USBD_MEM_H 32 | /* Includes ------------------------------------------------------------------*/ 33 | #include "usbd_def.h" 34 | 35 | 36 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USBD_MEM 41 | * @brief header file for the storage disk file 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USBD_MEM_Exported_Defines 46 | * @{ 47 | */ 48 | #define USBD_STD_INQUIRY_LENGTH 36 49 | /** 50 | * @} 51 | */ 52 | 53 | 54 | /** @defgroup USBD_MEM_Exported_TypesDefinitions 55 | * @{ 56 | */ 57 | 58 | typedef struct _USBD_STORAGE 59 | { 60 | int8_t (* Init) (uint8_t lun); 61 | int8_t (* GetCapacity) (uint8_t lun, uint32_t *block_num, uint32_t *block_size); 62 | int8_t (* IsReady) (uint8_t lun); 63 | int8_t (* IsWriteProtected) (uint8_t lun); 64 | int8_t (* Read) (uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); 65 | int8_t (* Write)(uint8_t lun, uint8_t *buf, uint32_t blk_addr, uint16_t blk_len); 66 | int8_t (* GetMaxLun)(void); 67 | int8_t *pInquiry; 68 | 69 | }USBD_STORAGE_cb_TypeDef; 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | 76 | /** @defgroup USBD_MEM_Exported_Macros 77 | * @{ 78 | */ 79 | 80 | /** 81 | * @} 82 | */ 83 | 84 | /** @defgroup USBD_MEM_Exported_Variables 85 | * @{ 86 | */ 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup USBD_MEM_Exported_FunctionsPrototype 93 | * @{ 94 | */ 95 | extern USBD_STORAGE_cb_TypeDef *USBD_STORAGE_fops; 96 | /** 97 | * @} 98 | */ 99 | 100 | #endif /* __USBD_MEM_H */ 101 | /** 102 | * @} 103 | */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** 110 | * @} 111 | */ 112 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 113 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/audio/inc/usbd_audio_out_if.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_audio_out_if.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_audio_out_if.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_AUDIO_OUT_IF_H_ 25 | #define __USB_AUDIO_OUT_IF_H_ 26 | 27 | #ifdef STM32F2XX 28 | #include "stm322xg_usb_audio_codec.h" 29 | #elif defined(STM32F4XX) 30 | #include "stm324xg_usb_audio_codec.h" 31 | #elif defined(STM32F10X_CL) 32 | #include "stm3210c_usb_audio_codec.h" 33 | #endif /* STM32F2XX */ 34 | 35 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 36 | * @{ 37 | */ 38 | 39 | /** @defgroup usbd_audio 40 | * @brief This file is the Header file for USBD_audio.c 41 | * @{ 42 | */ 43 | 44 | 45 | /** @defgroup usbd_audio_Exported_Defines 46 | * @{ 47 | */ 48 | /* Audio Commands enumeration */ 49 | typedef enum 50 | { 51 | AUDIO_CMD_PLAY = 1, 52 | AUDIO_CMD_PAUSE, 53 | AUDIO_CMD_STOP, 54 | }AUDIO_CMD_TypeDef; 55 | 56 | /* Mute commands */ 57 | #define AUDIO_MUTE 0x01 58 | #define AUDIO_UNMUTE 0x00 59 | 60 | /* Functions return value */ 61 | #define AUDIO_OK 0x00 62 | #define AUDIO_FAIL 0xFF 63 | 64 | /* Audio Machine States */ 65 | #define AUDIO_STATE_INACTIVE 0x00 66 | #define AUDIO_STATE_ACTIVE 0x01 67 | #define AUDIO_STATE_PLAYING 0x02 68 | #define AUDIO_STATE_PAUSED 0x03 69 | #define AUDIO_STATE_STOPPED 0x04 70 | #define AUDIO_STATE_ERROR 0x05 71 | 72 | /** 73 | * @} 74 | */ 75 | 76 | 77 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 78 | * @{ 79 | */ 80 | /** 81 | * @} 82 | */ 83 | 84 | 85 | 86 | /** @defgroup USBD_CORE_Exported_Macros 87 | * @{ 88 | */ 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup USBD_CORE_Exported_Variables 94 | * @{ 95 | */ 96 | 97 | extern AUDIO_FOPS_TypeDef AUDIO_OUT_fops; 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /** @defgroup USB_CORE_Exported_Functions 104 | * @{ 105 | */ 106 | /** 107 | * @} 108 | */ 109 | 110 | #endif /* __USB_AUDIO_OUT_IF_H_ */ 111 | /** 112 | * @} 113 | */ 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Core/inc/usbd_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_ioreq.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_ioreq.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USBD_IOREQ_H_ 25 | #define __USBD_IOREQ_H_ 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | #include "usbd_core.h" 30 | 31 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USBD_IOREQ 36 | * @brief header file for the usbd_ioreq.c file 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USBD_IOREQ_Exported_Defines 41 | * @{ 42 | */ 43 | /** 44 | * @} 45 | */ 46 | 47 | 48 | /** @defgroup USBD_IOREQ_Exported_Types 49 | * @{ 50 | */ 51 | 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | 59 | /** @defgroup USBD_IOREQ_Exported_Macros 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup USBD_IOREQ_Exported_Variables 68 | * @{ 69 | */ 70 | 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USBD_IOREQ_Exported_FunctionsPrototype 76 | * @{ 77 | */ 78 | 79 | USBD_Status USBD_CtlSendData (USB_OTG_CORE_HANDLE *pdev, 80 | uint8_t *buf, 81 | uint16_t len); 82 | 83 | USBD_Status USBD_CtlContinueSendData (USB_OTG_CORE_HANDLE *pdev, 84 | uint8_t *pbuf, 85 | uint16_t len); 86 | 87 | USBD_Status USBD_CtlPrepareRx (USB_OTG_CORE_HANDLE *pdev, 88 | uint8_t *pbuf, 89 | uint16_t len); 90 | 91 | USBD_Status USBD_CtlContinueRx (USB_OTG_CORE_HANDLE *pdev, 92 | uint8_t *pbuf, 93 | uint16_t len); 94 | 95 | USBD_Status USBD_CtlSendStatus (USB_OTG_CORE_HANDLE *pdev); 96 | 97 | USBD_Status USBD_CtlReceiveStatus (USB_OTG_CORE_HANDLE *pdev); 98 | 99 | uint16_t USBD_GetRxCount (USB_OTG_CORE_HANDLE *pdev , 100 | uint8_t epnum); 101 | 102 | /** 103 | * @} 104 | */ 105 | 106 | #endif /* __USBD_IOREQ_H_ */ 107 | 108 | /** 109 | * @} 110 | */ 111 | 112 | /** 113 | * @} 114 | */ 115 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 116 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/HID/inc/usbh_hid_keybd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_keybd.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief This file contains all the prototypes for the usbh_hid_keybd.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive -----------------------------------------------*/ 23 | #ifndef __USBH_HID_KEYBD_H 24 | #define __USBH_HID_KEYBD_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | #include "usbh_hid_core.h" 29 | 30 | /** @addtogroup USBH_LIB 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup USBH_CLASS 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup USBH_HID_CLASS 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBH_HID_KEYBD 43 | * @brief This file is the Header file for USBH_HID_KEYBD.c 44 | * @{ 45 | */ 46 | 47 | 48 | /** @defgroup USBH_HID_KEYBD_Exported_Types 49 | * @{ 50 | */ 51 | 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | /** @defgroup USBH_HID_KEYBD_Exported_Defines 58 | * @{ 59 | */ 60 | //#define QWERTY_KEYBOARD 61 | #define AZERTY_KEYBOARD 62 | 63 | #define KBD_LEFT_CTRL 0x01 64 | #define KBD_LEFT_SHIFT 0x02 65 | #define KBD_LEFT_ALT 0x04 66 | #define KBD_LEFT_GUI 0x08 67 | #define KBD_RIGHT_CTRL 0x10 68 | #define KBD_RIGHT_SHIFT 0x20 69 | #define KBD_RIGHT_ALT 0x40 70 | #define KBD_RIGHT_GUI 0x80 71 | 72 | #define KBR_MAX_NBR_PRESSED 6 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USBH_HID_KEYBD_Exported_Macros 79 | * @{ 80 | */ 81 | /** 82 | * @} 83 | */ 84 | 85 | /** @defgroup USBH_HID_KEYBD_Exported_Variables 86 | * @{ 87 | */ 88 | 89 | extern HID_cb_TypeDef HID_KEYBRD_cb; 90 | /** 91 | * @} 92 | */ 93 | 94 | /** @defgroup USBH_HID_KEYBD_Exported_FunctionsPrototype 95 | * @{ 96 | */ 97 | void USR_KEYBRD_Init (void); 98 | void USR_KEYBRD_ProcessData (uint8_t pbuf); 99 | /** 100 | * @} 101 | */ 102 | 103 | #endif /* __USBH_HID_KEYBD_H */ 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | 123 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/inc/usbd_dfu_mal.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_dfu_mal.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header for usbd_dfu_mal.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __DFU_MAL_H 24 | #define __DFU_MAL_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | 29 | #include "usbd_conf.h" 30 | #include "usbd_dfu_core.h" 31 | 32 | /* Exported types ------------------------------------------------------------*/ 33 | typedef struct _DFU_MAL_PROP 34 | { 35 | const uint8_t* pStrDesc; 36 | uint16_t (*pMAL_Init) (void); 37 | uint16_t (*pMAL_DeInit) (void); 38 | uint16_t (*pMAL_Erase) (uint32_t Add); 39 | uint16_t (*pMAL_Write) (uint32_t Add, uint32_t Len); 40 | uint8_t *(*pMAL_Read) (uint32_t Add, uint32_t Len); 41 | uint16_t (*pMAL_CheckAdd) (uint32_t Add); 42 | const uint32_t EraseTiming; 43 | const uint32_t WriteTiming; 44 | } 45 | DFU_MAL_Prop_TypeDef; 46 | 47 | 48 | /* Exported constants --------------------------------------------------------*/ 49 | #define MAL_OK 0 50 | #define MAL_FAIL 1 51 | 52 | /* useful macro ---------------------------------------------------------------*/ 53 | #define _1st_BYTE(x) (uint8_t)((x)&0xFF) /* 1st addressing cycle */ 54 | #define _2nd_BYTE(x) (uint8_t)(((x)&0xFF00)>>8) /* 2nd addressing cycle */ 55 | #define _3rd_BYTE(x) (uint8_t)(((x)&0xFF0000)>>16) /* 3rd addressing cycle */ 56 | #define _4th_BYTE(x) (uint8_t)(((x)&0xFF000000)>>24) /* 4th addressing cycle */ 57 | 58 | /* Exported macro ------------------------------------------------------------*/ 59 | #define SET_POLLING_TIMING(x) buffer[1] = _1st_BYTE(x);\ 60 | buffer[2] = _2nd_BYTE(x);\ 61 | buffer[3] = _3rd_BYTE(x); 62 | 63 | /* Exported functions ------------------------------------------------------- */ 64 | 65 | uint16_t MAL_Init (void); 66 | uint16_t MAL_DeInit (void); 67 | uint16_t MAL_Erase (uint32_t SectorAddress); 68 | uint16_t MAL_Write (uint32_t SectorAddress, uint32_t DataLength); 69 | uint8_t *MAL_Read (uint32_t SectorAddress, uint32_t DataLength); 70 | uint16_t MAL_GetStatus(uint32_t SectorAddress ,uint8_t Cmd, uint8_t *buffer); 71 | 72 | extern uint8_t MAL_Buffer[XFERSIZE]; /* RAM Buffer for Downloaded Data */ 73 | #endif /* __DFU_MAL_H */ 74 | 75 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 76 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Core/inc/usbh_hcs.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hcs.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbh_hcs.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_HCS_H 24 | #define __USBH_HCS_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbh_core.h" 28 | 29 | /** @addtogroup USBH_LIB 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup USBH_LIB_CORE 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USBH_HCS 38 | * @brief This file is the header file for usbh_hcs.c 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBH_HCS_Exported_Defines 43 | * @{ 44 | */ 45 | #define HC_MAX 8 46 | 47 | #define HC_OK 0x0000 48 | #define HC_USED 0x8000 49 | #define HC_ERROR 0xFFFF 50 | #define HC_USED_MASK 0x7FFF 51 | /** 52 | * @} 53 | */ 54 | 55 | /** @defgroup USBH_HCS_Exported_Types 56 | * @{ 57 | */ 58 | /** 59 | * @} 60 | */ 61 | 62 | 63 | /** @defgroup USBH_HCS_Exported_Macros 64 | * @{ 65 | */ 66 | /** 67 | * @} 68 | */ 69 | 70 | /** @defgroup USBH_HCS_Exported_Variables 71 | * @{ 72 | */ 73 | /** 74 | * @} 75 | */ 76 | 77 | /** @defgroup USBH_HCS_Exported_FunctionsPrototype 78 | * @{ 79 | */ 80 | 81 | uint8_t USBH_Alloc_Channel(USB_OTG_CORE_HANDLE *pdev, uint8_t ep_addr); 82 | 83 | uint8_t USBH_Free_Channel (USB_OTG_CORE_HANDLE *pdev, uint8_t idx); 84 | 85 | uint8_t USBH_DeAllocate_AllChannel (USB_OTG_CORE_HANDLE *pdev); 86 | 87 | uint8_t USBH_Open_Channel (USB_OTG_CORE_HANDLE *pdev, 88 | uint8_t ch_num, 89 | uint8_t dev_address, 90 | uint8_t speed, 91 | uint8_t ep_type, 92 | uint16_t mps); 93 | 94 | uint8_t USBH_Modify_Channel (USB_OTG_CORE_HANDLE *pdev, 95 | uint8_t hc_num, 96 | uint8_t dev_address, 97 | uint8_t speed, 98 | uint8_t ep_type, 99 | uint16_t mps); 100 | /** 101 | * @} 102 | */ 103 | 104 | 105 | 106 | #endif /* __USBH_HCS_H */ 107 | 108 | 109 | /** 110 | * @} 111 | */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | 123 | 124 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/MSC/inc/usbh_msc_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_msc_core.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief This file contains all the prototypes for the usbh_msc_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_MSC_CORE_H 24 | #define __USBH_MSC_CORE_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbh_core.h" 28 | #include "usbh_stdreq.h" 29 | #include "usb_bsp.h" 30 | #include "usbh_ioreq.h" 31 | #include "usbh_hcs.h" 32 | #include "usbh_msc_core.h" 33 | #include "usbh_msc_scsi.h" 34 | #include "usbh_msc_bot.h" 35 | 36 | /** @addtogroup USBH_LIB 37 | * @{ 38 | */ 39 | 40 | /** @addtogroup USBH_CLASS 41 | * @{ 42 | */ 43 | 44 | /** @addtogroup USBH_MSC_CLASS 45 | * @{ 46 | */ 47 | 48 | /** @defgroup USBH_MSC_CORE 49 | * @brief This file is the Header file for usbh_msc_core.c 50 | * @{ 51 | */ 52 | 53 | 54 | /** @defgroup USBH_MSC_CORE_Exported_Types 55 | * @{ 56 | */ 57 | 58 | 59 | /* Structure for MSC process */ 60 | typedef struct _MSC_Process 61 | { 62 | uint8_t hc_num_in; 63 | uint8_t hc_num_out; 64 | uint8_t MSBulkOutEp; 65 | uint8_t MSBulkInEp; 66 | uint16_t MSBulkInEpSize; 67 | uint16_t MSBulkOutEpSize; 68 | uint8_t buff[USBH_MSC_MPS_SIZE]; 69 | uint8_t maxLun; 70 | } 71 | MSC_Machine_TypeDef; 72 | 73 | 74 | /** 75 | * @} 76 | */ 77 | 78 | 79 | 80 | /** @defgroup USBH_MSC_CORE_Exported_Defines 81 | * @{ 82 | */ 83 | 84 | #define USB_REQ_BOT_RESET 0xFF 85 | #define USB_REQ_GET_MAX_LUN 0xFE 86 | 87 | 88 | /** 89 | * @} 90 | */ 91 | 92 | /** @defgroup USBH_MSC_CORE_Exported_Macros 93 | * @{ 94 | */ 95 | /** 96 | * @} 97 | */ 98 | 99 | /** @defgroup USBH_MSC_CORE_Exported_Variables 100 | * @{ 101 | */ 102 | extern USBH_Class_cb_TypeDef USBH_MSC_cb; 103 | extern MSC_Machine_TypeDef MSC_Machine; 104 | extern uint8_t MSCErrorCount; 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @defgroup USBH_MSC_CORE_Exported_FunctionsPrototype 111 | * @{ 112 | */ 113 | 114 | 115 | 116 | /** 117 | * @} 118 | */ 119 | 120 | #endif /* __USBH_MSC_CORE_H */ 121 | 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /** 136 | * @} 137 | */ 138 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 139 | 140 | 141 | 142 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Core/inc/usbd_usr.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_usr.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbd_usr.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __USBD_USR_H__ 24 | #define __USBD_USR_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup USBD_USER 30 | * @{ 31 | */ 32 | 33 | /** @addtogroup USBD_MSC_DEMO_USER_CALLBACKS 34 | * @{ 35 | */ 36 | 37 | /** @defgroup USBD_USR 38 | * @brief This file is the Header file for usbd_usr.c 39 | * @{ 40 | */ 41 | 42 | 43 | /** @defgroup USBD_USR_Exported_Types 44 | * @{ 45 | */ 46 | 47 | extern USBD_Usr_cb_TypeDef USR_cb; 48 | extern USBD_Usr_cb_TypeDef USR_FS_cb; 49 | extern USBD_Usr_cb_TypeDef USR_HS_cb; 50 | 51 | 52 | 53 | /** 54 | * @} 55 | */ 56 | 57 | 58 | 59 | /** @defgroup USBD_USR_Exported_Defines 60 | * @{ 61 | */ 62 | 63 | /** 64 | * @} 65 | */ 66 | 67 | /** @defgroup USBD_USR_Exported_Macros 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | /** @defgroup USBD_USR_Exported_Variables 75 | * @{ 76 | */ 77 | 78 | void USBD_USR_Init(void); 79 | void USBD_USR_DeviceReset (uint8_t speed); 80 | void USBD_USR_DeviceConfigured (void); 81 | void USBD_USR_DeviceSuspended(void); 82 | void USBD_USR_DeviceResumed(void); 83 | 84 | void USBD_USR_DeviceConnected(void); 85 | void USBD_USR_DeviceDisconnected(void); 86 | 87 | void USBD_USR_FS_Init(void); 88 | void USBD_USR_FS_DeviceReset (uint8_t speed); 89 | void USBD_USR_FS_DeviceConfigured (void); 90 | void USBD_USR_FS_DeviceSuspended(void); 91 | void USBD_USR_FS_DeviceResumed(void); 92 | 93 | void USBD_USR_FS_DeviceConnected(void); 94 | void USBD_USR_FS_DeviceDisconnected(void); 95 | 96 | void USBD_USR_HS_Init(void); 97 | void USBD_USR_HS_DeviceReset (uint8_t speed); 98 | void USBD_USR_HS_DeviceConfigured (void); 99 | void USBD_USR_HS_DeviceSuspended(void); 100 | void USBD_USR_HS_DeviceResumed(void); 101 | 102 | void USBD_USR_HS_DeviceConnected(void); 103 | void USBD_USR_HS_DeviceDisconnected(void); 104 | 105 | /** 106 | * @} 107 | */ 108 | 109 | /** @defgroup USBD_USR_Exported_FunctionsPrototype 110 | * @{ 111 | */ 112 | /** 113 | * @} 114 | */ 115 | 116 | #endif /*__USBD_USR_H__*/ 117 | 118 | /** 119 | * @} 120 | */ 121 | 122 | /** 123 | * @} 124 | */ 125 | 126 | /** 127 | * @} 128 | */ 129 | 130 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 131 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_dcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef USB_DCD_INT_H__ 24 | #define USB_DCD_INT_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_dcd.h" 28 | 29 | 30 | 31 | /** @addtogroup USB_OTG_DRIVER 32 | * @{ 33 | */ 34 | 35 | /** @defgroup USB_DCD_INT 36 | * @brief This file is the 37 | * @{ 38 | */ 39 | 40 | 41 | /** @defgroup USB_DCD_INT_Exported_Defines 42 | * @{ 43 | */ 44 | 45 | typedef struct _USBD_DCD_INT 46 | { 47 | uint8_t (* DataOutStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 48 | uint8_t (* DataInStage) (USB_OTG_CORE_HANDLE *pdev , uint8_t epnum); 49 | uint8_t (* SetupStage) (USB_OTG_CORE_HANDLE *pdev); 50 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 51 | uint8_t (* Reset) (USB_OTG_CORE_HANDLE *pdev); 52 | uint8_t (* Suspend) (USB_OTG_CORE_HANDLE *pdev); 53 | uint8_t (* Resume) (USB_OTG_CORE_HANDLE *pdev); 54 | uint8_t (* IsoINIncomplete) (USB_OTG_CORE_HANDLE *pdev); 55 | uint8_t (* IsoOUTIncomplete) (USB_OTG_CORE_HANDLE *pdev); 56 | 57 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 58 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 59 | 60 | }USBD_DCD_INT_cb_TypeDef; 61 | 62 | extern USBD_DCD_INT_cb_TypeDef *USBD_DCD_INT_fops; 63 | /** 64 | * @} 65 | */ 66 | 67 | 68 | /** @defgroup USB_DCD_INT_Exported_Types 69 | * @{ 70 | */ 71 | /** 72 | * @} 73 | */ 74 | 75 | /** @defgroup USB_DCD_INT_Exported_Macros 76 | * @{ 77 | */ 78 | 79 | #define CLEAR_IN_EP_INTR(epnum,intr) \ 80 | diepint.d32=0; \ 81 | diepint.b.intr = 1; \ 82 | USB_OTG_WRITE_REG32(&pdev->regs.INEP_REGS[epnum]->DIEPINT,diepint.d32); 83 | 84 | #define CLEAR_OUT_EP_INTR(epnum,intr) \ 85 | doepint.d32=0; \ 86 | doepint.b.intr = 1; \ 87 | USB_OTG_WRITE_REG32(&pdev->regs.OUTEP_REGS[(epnum)]->DOEPINT,doepint.d32); 88 | 89 | /** 90 | * @} 91 | */ 92 | 93 | /** @defgroup USB_DCD_INT_Exported_Variables 94 | * @{ 95 | */ 96 | /** 97 | * @} 98 | */ 99 | 100 | /** @defgroup USB_DCD_INT_Exported_FunctionsPrototype 101 | * @{ 102 | */ 103 | 104 | uint32_t USBD_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 105 | uint32_t USBD_OTG_EP1OUT_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 106 | uint32_t USBD_OTG_EP1IN_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 107 | /** 108 | * @} 109 | */ 110 | 111 | 112 | #endif /* USB_DCD_INT_H__ */ 113 | 114 | /** 115 | * @} 116 | */ 117 | 118 | /** 119 | * @} 120 | */ 121 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 122 | 123 | -------------------------------------------------------------------------------- /Component/SFUD-master/others/sfud_demo.c: -------------------------------------------------------------------------------- 1 | 2 | #include "sfud_demo.h" 3 | #include "GlobalDef.h" 4 | 5 | #include 6 | #include 7 | #include 8 | #include 9 | 10 | #define SFUD_DEMO_TEST_BUFFER_SIZE 1024 11 | 12 | #ifdef SFUD_DEBUG_MODE 13 | static void sfud_demo(uint32_t addr, size_t size, uint8_t *data); 14 | 15 | static uint8_t sfud_demo_test_buf[SFUD_DEMO_TEST_BUFFER_SIZE]; 16 | #endif 17 | 18 | void sfud_demo_task(void) 19 | { 20 | #ifdef SFUD_DEBUG_MODE 21 | bsp_init(); 22 | 23 | /* SFUD initialize */ 24 | if (sfud_init() == SFUD_SUCCESS) { 25 | sfud_demo(0, sizeof(sfud_demo_test_buf), sfud_demo_test_buf); 26 | } 27 | 28 | #if 0 29 | while (1) { 30 | LED_RUN_ON; 31 | delay(6000000); 32 | LED_RUN_OFF; 33 | delay(6000000); 34 | } 35 | #endif 36 | 37 | #endif 38 | } 39 | 40 | /** 41 | * SFUD demo for the first flash device test. 42 | * 43 | * @param addr flash start address 44 | * @param size test flash size 45 | * @param size test flash data buffer 46 | */ 47 | #ifdef SFUD_DEBUG_MODE 48 | void flash_reset(void) 49 | { 50 | const sfud_flash *flash = sfud_get_device_table() + 0; 51 | 52 | sfud_chip_erase(flash); 53 | } 54 | 55 | static void sfud_demo(uint32_t addr, size_t size, uint8_t *data) { 56 | 57 | sfud_err result = SFUD_SUCCESS; 58 | const sfud_flash *flash = sfud_get_device_table() + 0; 59 | size_t i; 60 | /* prepare write data */ 61 | for (i = 0; i < size; i++) { 62 | data[i] = i; 63 | } 64 | /* erase test */ 65 | result = sfud_erase(flash, addr, size); 66 | if (result == SFUD_SUCCESS) { 67 | os_printf("Erase the %s flash data finish. Start from 0x%08X, size is %ld.\r\n", flash->name, addr, 68 | size); 69 | } else { 70 | os_printf("Erase the %s flash data failed.\r\n", flash->name); 71 | return; 72 | } 73 | /* write test */ 74 | result = sfud_write(flash, addr, size, data); 75 | if (result == SFUD_SUCCESS) { 76 | os_printf("Write the %s flash data finish. Start from 0x%08X, size is %ld.\r\n", flash->name, addr, 77 | size); 78 | } else { 79 | os_printf("Write the %s flash data failed.\r\n", flash->name); 80 | return; 81 | } 82 | /* read test */ 83 | result = sfud_read(flash, addr, size, data); 84 | if (result == SFUD_SUCCESS) { 85 | os_printf("Read the %s flash data success. Start from 0x%08X, size is %ld. The data is:\r\n", flash->name, addr, 86 | size); 87 | os_printf("Offset (h) 00 01 02 03 04 05 06 07 08 09 0A 0B 0C 0D 0E 0F\r\n"); 88 | for (i = 0; i < size; i++) { 89 | if (i % 16 == 0) { 90 | os_printf("[%08X] ", addr + i); 91 | } 92 | os_printf("%02X ", data[i]); 93 | if (((i + 1) % 16 == 0) || i == size - 1) { 94 | os_printf("\r\n"); 95 | } 96 | } 97 | os_printf("\r\n"); 98 | } else { 99 | os_printf("Read the %s flash data failed.\r\n", flash->name); 100 | } 101 | /* data check */ 102 | for (i = 0; i < size; i++) { 103 | if (data[i] != i % 256) { 104 | os_printf("Read and check write data has an error. Write the %s flash data failed.\r\n", flash->name); 105 | break; 106 | } 107 | } 108 | 109 | flash_reset(); 110 | 111 | if (i == size) { 112 | os_printf("The %s flash test is success.\r\n", flash->name); 113 | } 114 | } 115 | #endif 116 | 117 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/HID/src/usbh_hid_mouse.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_mouse.c 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief This file is the application layer for USB Host HID Mouse Handling. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usbh_hid_mouse.h" 24 | 25 | 26 | /** @addtogroup USBH_LIB 27 | * @{ 28 | */ 29 | 30 | /** @addtogroup USBH_CLASS 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup USBH_HID_CLASS 35 | * @{ 36 | */ 37 | 38 | /** @defgroup USBH_HID_MOUSE 39 | * @brief This file includes HID Layer Handlers for USB Host HID class. 40 | * @{ 41 | */ 42 | 43 | /** @defgroup USBH_HID_MOUSE_Private_TypesDefinitions 44 | * @{ 45 | */ 46 | /** 47 | * @} 48 | */ 49 | 50 | 51 | /** @defgroup USBH_HID_MOUSE_Private_Defines 52 | * @{ 53 | */ 54 | /** 55 | * @} 56 | */ 57 | 58 | 59 | /** @defgroup USBH_HID_MOUSE_Private_Macros 60 | * @{ 61 | */ 62 | /** 63 | * @} 64 | */ 65 | 66 | /** @defgroup USBH_HID_MOUSE_Private_FunctionPrototypes 67 | * @{ 68 | */ 69 | static void MOUSE_Init (void); 70 | static void MOUSE_Decode(uint8_t *data); 71 | /** 72 | * @} 73 | */ 74 | 75 | 76 | /** @defgroup USBH_HID_MOUSE_Private_Variables 77 | * @{ 78 | */ 79 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 80 | #if defined (__CC_ARM) /*!< ARM Compiler */ 81 | __align(4) 82 | #elif defined ( __ICCARM__ ) /*!< IAR Compiler */ 83 | #pragma data_alignment=4 84 | #elif defined (__GNUC__) /*!< GNU Compiler */ 85 | #pragma pack(4) 86 | #endif /* __CC_ARM */ 87 | #endif 88 | 89 | 90 | HID_MOUSE_Data_TypeDef HID_MOUSE_Data; 91 | HID_cb_TypeDef HID_MOUSE_cb = 92 | { 93 | MOUSE_Init, 94 | MOUSE_Decode, 95 | }; 96 | /** 97 | * @} 98 | */ 99 | 100 | 101 | /** @defgroup USBH_HID_MOUSE_Private_Functions 102 | * @{ 103 | */ 104 | 105 | /** 106 | * @brief MOUSE_Init 107 | * Init Mouse State. 108 | * @param None 109 | * @retval None 110 | */ 111 | static void MOUSE_Init ( void) 112 | { 113 | /* Call User Init*/ 114 | USR_MOUSE_Init(); 115 | } 116 | 117 | /** 118 | * @brief MOUSE_Decode 119 | * Decode Mouse data 120 | * @param data : Pointer to Mouse HID data buffer 121 | * @retval None 122 | */ 123 | static void MOUSE_Decode(uint8_t *data) 124 | { 125 | HID_MOUSE_Data.button = data[0]; 126 | 127 | HID_MOUSE_Data.x = data[1]; 128 | HID_MOUSE_Data.y = data[2]; 129 | 130 | USR_MOUSE_ProcessData(&HID_MOUSE_Data); 131 | 132 | } 133 | /** 134 | * @} 135 | */ 136 | 137 | /** 138 | * @} 139 | */ 140 | 141 | /** 142 | * @} 143 | */ 144 | 145 | /** 146 | * @} 147 | */ 148 | 149 | 150 | /** 151 | * @} 152 | */ 153 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 154 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/customhid/inc/usbd_customhid_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_customhid_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_customhid_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_CUSTOMHID_CORE_H_ 25 | #define __USB_CUSTOMHID_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 29 | * @{ 30 | */ 31 | 32 | /** @defgroup USBD_CUSTOMHID 33 | * @brief This file is the Header file for usbd_customhid_core.c 34 | * @{ 35 | */ 36 | 37 | 38 | /** @defgroup USBD_CUSTOMHID_Exported_Defines 39 | * @{ 40 | */ 41 | #define USBD_CUSTOM_HID_REPORT_DESC_SIZE 163 42 | 43 | #define USB_CUSTOM_HID_CONFIG_DESC_SIZ 41 44 | #define USB_CUSTOM_HID_DESC_SIZ 9 45 | 46 | #define CUSTOM_HID_DESCRIPTOR_TYPE 0x21 47 | #define CUSTOM_HID_REPORT_DESC 0x22 48 | 49 | 50 | #define CUSTOM_HID_REQ_SET_PROTOCOL 0x0B 51 | #define CUSTOM_HID_REQ_GET_PROTOCOL 0x03 52 | 53 | #define CUSTOM_HID_REQ_SET_IDLE 0x0A 54 | #define CUSTOM_HID_REQ_GET_IDLE 0x02 55 | 56 | #define CUSTOM_HID_REQ_SET_REPORT 0x09 57 | #define CUSTOM_HID_REQ_GET_REPORT 0x01 58 | 59 | #define LED1_REPORT_ID 0x01 60 | #define LED1_REPORT_COUNT 0x01 61 | 62 | #define LED2_REPORT_ID 0x02 63 | #define LED2_REPORT_COUNT 0x01 64 | 65 | #define LED3_REPORT_ID 0x03 66 | #define LED3_REPORT_COUNT 0x01 67 | 68 | #define LED4_REPORT_ID 0x04 69 | #define LED4_REPORT_COUNT 0x01 70 | 71 | #define KEY_REPORT_ID 0x05 72 | #define TAMPER_REPORT_ID 0x06 73 | #define ADC_REPORT_ID 0x07 74 | /** 75 | * @} 76 | */ 77 | 78 | 79 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 80 | * @{ 81 | */ 82 | /** 83 | * @} 84 | */ 85 | 86 | 87 | 88 | /** @defgroup USBD_CORE_Exported_Macros 89 | * @{ 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /** @defgroup USBD_CORE_Exported_Variables 97 | * @{ 98 | */ 99 | extern USBD_Class_cb_TypeDef USBD_CUSTOMHID_cb; 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup USB_CORE_Exported_Functions 105 | * @{ 106 | */ 107 | uint8_t USBD_CUSTOM_HID_SendReport (USB_OTG_CORE_HANDLE *pdev, 108 | uint8_t *report, 109 | uint16_t len); 110 | /** 111 | * @} 112 | */ 113 | 114 | #endif /* __USB_CUSTOMHID_CORE_H_ */ 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 124 | -------------------------------------------------------------------------------- /libaray/inc/stm32f4xx_wwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_wwdg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the WWDG firmware 8 | * library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_WWDG_H 25 | #define __STM32F4xx_WWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup WWDG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup WWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup WWDG_Prescaler 50 | * @{ 51 | */ 52 | 53 | #define WWDG_Prescaler_1 ((uint32_t)0x00000000) 54 | #define WWDG_Prescaler_2 ((uint32_t)0x00000080) 55 | #define WWDG_Prescaler_4 ((uint32_t)0x00000100) 56 | #define WWDG_Prescaler_8 ((uint32_t)0x00000180) 57 | #define IS_WWDG_PRESCALER(PRESCALER) (((PRESCALER) == WWDG_Prescaler_1) || \ 58 | ((PRESCALER) == WWDG_Prescaler_2) || \ 59 | ((PRESCALER) == WWDG_Prescaler_4) || \ 60 | ((PRESCALER) == WWDG_Prescaler_8)) 61 | #define IS_WWDG_WINDOW_VALUE(VALUE) ((VALUE) <= 0x7F) 62 | #define IS_WWDG_COUNTER(COUNTER) (((COUNTER) >= 0x40) && ((COUNTER) <= 0x7F)) 63 | 64 | /** 65 | * @} 66 | */ 67 | 68 | /** 69 | * @} 70 | */ 71 | 72 | /* Exported macro ------------------------------------------------------------*/ 73 | /* Exported functions --------------------------------------------------------*/ 74 | 75 | /* Function used to set the WWDG configuration to the default reset state ****/ 76 | void WWDG_DeInit(void); 77 | 78 | /* Prescaler, Refresh window and Counter configuration functions **************/ 79 | void WWDG_SetPrescaler(uint32_t WWDG_Prescaler); 80 | void WWDG_SetWindowValue(uint8_t WindowValue); 81 | void WWDG_EnableIT(void); 82 | void WWDG_SetCounter(uint8_t Counter); 83 | 84 | /* WWDG activation function ***************************************************/ 85 | void WWDG_Enable(uint8_t Counter); 86 | 87 | /* Interrupts and flags management functions **********************************/ 88 | FlagStatus WWDG_GetFlagStatus(void); 89 | void WWDG_ClearFlag(void); 90 | 91 | #ifdef __cplusplus 92 | } 93 | #endif 94 | 95 | #endif /* __STM32F4xx_WWDG_H */ 96 | 97 | /** 98 | * @} 99 | */ 100 | 101 | /** 102 | * @} 103 | */ 104 | 105 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 106 | -------------------------------------------------------------------------------- /libaray/src/stm32f4xx_crc.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_crc.c 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file provides all the CRC firmware functions. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "stm32f4xx_crc.h" 24 | 25 | /** @addtogroup STM32F4xx_StdPeriph_Driver 26 | * @{ 27 | */ 28 | 29 | /** @defgroup CRC 30 | * @brief CRC driver modules 31 | * @{ 32 | */ 33 | 34 | /* Private typedef -----------------------------------------------------------*/ 35 | /* Private define ------------------------------------------------------------*/ 36 | /* Private macro -------------------------------------------------------------*/ 37 | /* Private variables ---------------------------------------------------------*/ 38 | /* Private function prototypes -----------------------------------------------*/ 39 | /* Private functions ---------------------------------------------------------*/ 40 | 41 | /** @defgroup CRC_Private_Functions 42 | * @{ 43 | */ 44 | 45 | /** 46 | * @brief Resets the CRC Data register (DR). 47 | * @param None 48 | * @retval None 49 | */ 50 | void CRC_ResetDR(void) 51 | { 52 | /* Reset CRC generator */ 53 | CRC->CR = CRC_CR_RESET; 54 | } 55 | 56 | /** 57 | * @brief Computes the 32-bit CRC of a given data word(32-bit). 58 | * @param Data: data word(32-bit) to compute its CRC 59 | * @retval 32-bit CRC 60 | */ 61 | uint32_t CRC_CalcCRC(uint32_t Data) 62 | { 63 | CRC->DR = Data; 64 | 65 | return (CRC->DR); 66 | } 67 | 68 | /** 69 | * @brief Computes the 32-bit CRC of a given buffer of data word(32-bit). 70 | * @param pBuffer: pointer to the buffer containing the data to be computed 71 | * @param BufferLength: length of the buffer to be computed 72 | * @retval 32-bit CRC 73 | */ 74 | uint32_t CRC_CalcBlockCRC(uint32_t pBuffer[], uint32_t BufferLength) 75 | { 76 | uint32_t index = 0; 77 | 78 | for(index = 0; index < BufferLength; index++) 79 | { 80 | CRC->DR = pBuffer[index]; 81 | } 82 | return (CRC->DR); 83 | } 84 | 85 | /** 86 | * @brief Returns the current CRC value. 87 | * @param None 88 | * @retval 32-bit CRC 89 | */ 90 | uint32_t CRC_GetCRC(void) 91 | { 92 | return (CRC->DR); 93 | } 94 | 95 | /** 96 | * @brief Stores a 8-bit data in the Independent Data(ID) register. 97 | * @param IDValue: 8-bit value to be stored in the ID register 98 | * @retval None 99 | */ 100 | void CRC_SetIDRegister(uint8_t IDValue) 101 | { 102 | CRC->IDR = IDValue; 103 | } 104 | 105 | /** 106 | * @brief Returns the 8-bit data stored in the Independent Data(ID) register 107 | * @param None 108 | * @retval 8-bit value of the ID register 109 | */ 110 | uint8_t CRC_GetIDRegister(void) 111 | { 112 | return (CRC->IDR); 113 | } 114 | 115 | /** 116 | * @} 117 | */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | 127 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 128 | -------------------------------------------------------------------------------- /My_Lib/FLASH/spi_flash_interface.h: -------------------------------------------------------------------------------- 1 | 2 | /*********************************** SPI FLASH 存储接口访问头文件 ********************************************/ 3 | #ifndef __SPI_FLASH_INTERFACE_H__ 4 | #define __SPI_FLASH_INTERFACE_H__ 5 | 6 | #include 7 | #include "diskio.h" 8 | #include "Integer.h" 9 | 10 | #include "Ffconf.h" 11 | #include "GlobalDef.h" 12 | 13 | //Flash相关参数 14 | /************************************************************************************************************************************************************ 15 | spi flash 物理扇区大小为4KB, 物理总扇区数为512, 容量 2MB 16 | 其中 260KB 空间 为 应用程序和系统环境变量存储区 17 | | <---sector 0 - sector 31---> | <-----------sector 32 ~ 63-----------> | <--sector 64 ----- > |<-sector 65 ~ sector 511--------> | 18 | | <-----128 KB -----------> | <--------128 KB--------------------> | <------4KB------->|---------文件系统---------- -| 19 | | APP1 备份区(新程序) | APP2 备份区(上一个版本程序) | 系统参数区 |---------文件系统----------- | 20 | |-------------------------- 260 KB (65个物理扇区) --------------------------------|--1788 KB FatFs 文件系统区---| 21 | *************************************************************************************************************************************************************/ 22 | #define FL_SIZE_KB(count) (((uint32_t)count) * 1024L ) // 表示有多少KB 23 | 24 | 25 | // SPI FLASH 物理大小实际定义 26 | extern uint32_t flash_get_total_capacity(void); 27 | 28 | // SPI FLASH 物理大小实际定义 29 | #if 1 30 | #define FL_TOTAL_SIZE flash_get_total_capacity() 31 | #else 32 | #define FL_TOTAL_SIZE FL_SIZE_KB(4096) // W25Q32 33 | #endif 34 | 35 | #define FL_SECTOR_SIZE (4096L) // 物理扇区实际大小 36 | #define FL_PAGE_SIZE 256L // 可编程的最小单位: 页, 的大小, Unit: B 37 | #define FL_PAGES_PER_SECTOR (FL_SECTOR_SIZE / FL_PAGE_SIZE) // 每扇区的页数 38 | 39 | 40 | // FAT 逻辑扇区相关定义 41 | #if (_MAX_SS == 4096) 42 | #define SPI_FLASH_SECTOR_SIZE (4096L) // FatFs 扇区大小: 4KB, 与 SPI FLASH 的扇区大小一致(4KB) 43 | #elif (_MAX_SS == 512) 44 | #define SPI_FLASH_SECTOR_SIZE (512L) // FatFs扇区大小: 512B, 与 SPI FLASH的扇区(4KB)大小不同 45 | #else 46 | #define "flash macro define error" 47 | #endif 48 | 49 | /************************************************************************************************************************************************************ 50 | spi flash 物理扇区大小为4KB, 物理总扇区数为512, 容量 2MB 51 | 其中 260KB 空间 为 应用程序和系统环境变量存储区 52 | | <---sector 0 - sector 31---> | <-----------sector 32 ~ 63-----------> | <--sector 64 ----- > |<-sector 65 ~ sector 511--------> | 53 | | <-----128 KB -----------> | <--------128 KB--------------------> | <------4KB------->|---------文件系统---------- -| 54 | | APP1 备份区(新程序) | APP2 备份区(上一个版本程序) | 系统参数区 |---------文件系统----------- | 55 | |-------------------------- 260 KB (65个物理扇区) --------------------------------|--1788 KB FatFs 文件系统区---| 56 | *************************************************************************************************************************************************************/ 57 | 58 | #define SPI_FLASH_BLOCK_SIZE FL_SECTOR_SIZE // 65536 // 块大小: 64 KB, Block Size in Bytes 59 | #define SPI_FLASH_START_ADDR (FLASH_FATFS_START_SECTOR * FL_SECTOR_SIZE) // FATFS系统起始地址, 从第65物理扇区开始 60 | #define SPI_FLASH_SECTOR_COUNT ((FL_TOTAL_SIZE - SPI_FLASH_START_ADDR) / SPI_FLASH_SECTOR_SIZE) // SPI FLASH 中的FatFs可用总扇区数 61 | 62 | 63 | 64 | 65 | 66 | extern /* volatile */ uint8_t spi_flash_buf[4096]; 67 | 68 | void flash_reset(void); 69 | 70 | int32_t flash_initialize(void); 71 | DRESULT flash_ioctl(BYTE lun, BYTE cmd, void *buff); 72 | DRESULT flash_disk_read(BYTE lun, BYTE *buff, DWORD sector, UINT count); 73 | DRESULT flash_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count); 74 | 75 | uint16_t flash_mal_write(uint8_t lun, uint32_t addr, uint32_t * buffer, uint16_t bytes); 76 | uint16_t flash_mal_read(uint8_t lun, uint32_t addr, uint32_t * buffer, uint16_t bytes); 77 | 78 | void flash_set_total_capacity(uint32_t capacity); 79 | uint32_t flash_get_total_capacity(void); 80 | 81 | 82 | #endif // end of file 83 | 84 | -------------------------------------------------------------------------------- /Component/USB_F4/USB_APP/usbd_desc.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_desc.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_desc.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #ifndef __USB_DESC_H 25 | #define __USB_DESC_H 26 | 27 | /* Includes ------------------------------------------------------------------*/ 28 | #include "usbd_def.h" 29 | #include "usbd_req.h" 30 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_DESC 35 | * @brief general defines for the usb device library file 36 | * @{ 37 | */ 38 | 39 | /** @defgroup USB_DESC_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 43 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 44 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 45 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 46 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 47 | #define USB_SIZ_DEVICE_DESC 18 48 | #define USB_SIZ_STRING_LANGID 4 49 | 50 | #if !defined (USE_STM3210C_EVAL) 51 | #define DEVICE_ID1 (0x1FFF7A10) 52 | #define DEVICE_ID2 (0x1FFF7A14) 53 | #define DEVICE_ID3 (0x1FFF7A18) 54 | 55 | #else 56 | #define DEVICE_ID1 (0x1FFFF7E8) 57 | #define DEVICE_ID2 (0x1FFFF7EA) 58 | #define DEVICE_ID3 (0x1FFFF7EC) 59 | #endif 60 | 61 | #define USB_SIZ_STRING_SERIAL 0x1A 62 | /** 63 | * @} 64 | */ 65 | 66 | 67 | /** @defgroup USBD_DESC_Exported_TypesDefinitions 68 | * @{ 69 | */ 70 | /** 71 | * @} 72 | */ 73 | 74 | 75 | 76 | /** @defgroup USBD_DESC_Exported_Macros 77 | * @{ 78 | */ 79 | /** 80 | * @} 81 | */ 82 | 83 | /** @defgroup USBD_DESC_Exported_Variables 84 | * @{ 85 | */ 86 | extern uint8_t USBD_DeviceDesc [USB_SIZ_DEVICE_DESC]; 87 | extern uint8_t USBD_StrDesc[USB_MAX_STR_DESC_SIZ]; 88 | extern uint8_t USBD_OtherSpeedCfgDesc[USB_LEN_CFG_DESC]; 89 | extern uint8_t USBD_DeviceQualifierDesc[USB_LEN_DEV_QUALIFIER_DESC]; 90 | extern uint8_t USBD_LangIDDesc[USB_SIZ_STRING_LANGID]; 91 | extern USBD_DEVICE USR_desc; 92 | /** 93 | * @} 94 | */ 95 | 96 | /** @defgroup USBD_DESC_Exported_FunctionsPrototype 97 | * @{ 98 | */ 99 | 100 | 101 | uint8_t * USBD_USR_DeviceDescriptor( uint8_t speed , uint16_t *length); 102 | uint8_t * USBD_USR_LangIDStrDescriptor( uint8_t speed , uint16_t *length); 103 | uint8_t * USBD_USR_ManufacturerStrDescriptor ( uint8_t speed , uint16_t *length); 104 | uint8_t * USBD_USR_ProductStrDescriptor ( uint8_t speed , uint16_t *length); 105 | uint8_t * USBD_USR_SerialStrDescriptor( uint8_t speed , uint16_t *length); 106 | uint8_t * USBD_USR_ConfigStrDescriptor( uint8_t speed , uint16_t *length); 107 | uint8_t * USBD_USR_InterfaceStrDescriptor( uint8_t speed , uint16_t *length); 108 | 109 | #ifdef USB_SUPPORT_USER_STRING_DESC 110 | uint8_t * USBD_USR_USRStringDesc (uint8_t speed, uint8_t idx , uint16_t *length); 111 | #endif /* USB_SUPPORT_USER_STRING_DESC */ 112 | 113 | /** 114 | * @} 115 | */ 116 | 117 | #endif /* __USBD_DESC_H */ 118 | 119 | /** 120 | * @} 121 | */ 122 | 123 | /** 124 | * @} 125 | */ 126 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 127 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/src/usbd_otp_if.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_otp_if.c 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Specific media access Layer for OTP (One Time Programming) memory. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | #include "usbd_otp_if.h" 24 | #include "usbd_dfu_mal.h" 25 | 26 | /* Private typedef -----------------------------------------------------------*/ 27 | /* Private define ------------------------------------------------------------*/ 28 | /* Private macro -------------------------------------------------------------*/ 29 | 30 | /* Private function prototypes -----------------------------------------------*/ 31 | uint16_t OTP_If_Write (uint32_t Add, uint32_t Len); 32 | uint8_t *OTP_If_Read (uint32_t Add, uint32_t Len); 33 | uint16_t OTP_If_CheckAdd(uint32_t Add); 34 | 35 | 36 | /* Private variables ---------------------------------------------------------*/ 37 | DFU_MAL_Prop_TypeDef DFU_Otp_cb = 38 | { 39 | OTP_IF_STRING, 40 | NULL, /* Init not supported*/ 41 | NULL, /* DeInit not supported */ 42 | NULL, /* Erase not supported */ 43 | OTP_If_Write, 44 | OTP_If_Read, 45 | OTP_If_CheckAdd, 46 | 1, /* Erase Time in ms */ 47 | 10 /* Programming Time in ms */ 48 | }; 49 | 50 | /* Private functions ---------------------------------------------------------*/ 51 | 52 | /** 53 | * @brief OTP_If_Write 54 | * Memory write routine. 55 | * @param Add: Address to be written to. 56 | * @param Len: Number of data to be written (in bytes). 57 | * @retval MAL_OK if operation is successful, MAL_FAIL else. 58 | */ 59 | uint16_t OTP_If_Write(uint32_t Add, uint32_t Len) 60 | { 61 | uint32_t idx = 0; 62 | 63 | if (Len & 0x3) /* Not an aligned data */ 64 | { 65 | for (idx = Len; idx < ((Len & 0xFFFC) + 4); idx++) 66 | { 67 | MAL_Buffer[idx] = 0xFF; 68 | } 69 | } 70 | 71 | /* Data received are Word multiple */ 72 | for (idx = 0; idx < Len; idx = idx + 4) 73 | { 74 | FLASH_ProgramWord(Add, *(uint32_t *)(MAL_Buffer + idx)); 75 | Add += 4; 76 | } 77 | return MAL_OK; 78 | } 79 | 80 | /** 81 | * @brief OTP_If_Read 82 | * Memory read routine. 83 | * @param Add: Address to be read from. 84 | * @param Len: Number of data to be read (in bytes). 85 | * @retval Pointer to the physical address where data should be read. 86 | */ 87 | uint8_t *OTP_If_Read (uint32_t Add, uint32_t Len) 88 | { 89 | #ifdef USB_OTG_HS_INTERNAL_DMA_ENABLED 90 | uint32_t idx = 0; 91 | for (idx = 0; idx < Len; idx += 4) 92 | { 93 | *(uint32_t*)(MAL_Buffer + idx) = *(uint32_t *)(Add + idx); 94 | } 95 | return (uint8_t*)(MAL_Buffer); 96 | #else 97 | return (uint8_t*)(Add); 98 | #endif /* USB_OTG_HS_INTERNAL_DMA_ENABLED */ 99 | } 100 | 101 | /** 102 | * @brief OTP_If_CheckAdd 103 | * Check if the address is an allowed address for this memory. 104 | * @param Add: Address to be checked. 105 | * @param Len: Number of data to be read (in bytes). 106 | * @retval MAL_OK if the address is allowed, MAL_FAIL else. 107 | */ 108 | uint16_t OTP_If_CheckAdd(uint32_t Add) 109 | { 110 | if ((Add >= OTP_START_ADD) && (Add < OTP_END_ADD)) 111 | { 112 | return MAL_OK; 113 | } 114 | else 115 | { 116 | return MAL_FAIL; 117 | } 118 | } 119 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 120 | -------------------------------------------------------------------------------- /libaray/inc/stm32f4xx_rng.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_rng.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the Random 8 | * Number Generator(RNG) firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_RNG_H 25 | #define __STM32F4xx_RNG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup RNG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup RNG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup RNG_flags_definition 50 | * @{ 51 | */ 52 | #define RNG_FLAG_DRDY ((uint8_t)0x0001) /*!< Data ready */ 53 | #define RNG_FLAG_CECS ((uint8_t)0x0002) /*!< Clock error current status */ 54 | #define RNG_FLAG_SECS ((uint8_t)0x0004) /*!< Seed error current status */ 55 | 56 | #define IS_RNG_GET_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_DRDY) || \ 57 | ((RNG_FLAG) == RNG_FLAG_CECS) || \ 58 | ((RNG_FLAG) == RNG_FLAG_SECS)) 59 | #define IS_RNG_CLEAR_FLAG(RNG_FLAG) (((RNG_FLAG) == RNG_FLAG_CECS) || \ 60 | ((RNG_FLAG) == RNG_FLAG_SECS)) 61 | /** 62 | * @} 63 | */ 64 | 65 | /** @defgroup RNG_interrupts_definition 66 | * @{ 67 | */ 68 | #define RNG_IT_CEI ((uint8_t)0x20) /*!< Clock error interrupt */ 69 | #define RNG_IT_SEI ((uint8_t)0x40) /*!< Seed error interrupt */ 70 | 71 | #define IS_RNG_IT(IT) ((((IT) & (uint8_t)0x9F) == 0x00) && ((IT) != 0x00)) 72 | #define IS_RNG_GET_IT(RNG_IT) (((RNG_IT) == RNG_IT_CEI) || ((RNG_IT) == RNG_IT_SEI)) 73 | /** 74 | * @} 75 | */ 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Exported macro ------------------------------------------------------------*/ 82 | /* Exported functions --------------------------------------------------------*/ 83 | 84 | /* Function used to set the RNG configuration to the default reset state *****/ 85 | void RNG_DeInit(void); 86 | 87 | /* Configuration function *****************************************************/ 88 | void RNG_Cmd(FunctionalState NewState); 89 | 90 | /* Get 32 bit Random number function ******************************************/ 91 | uint32_t RNG_GetRandomNumber(void); 92 | 93 | /* Interrupts and flags management functions **********************************/ 94 | void RNG_ITConfig(FunctionalState NewState); 95 | FlagStatus RNG_GetFlagStatus(uint8_t RNG_FLAG); 96 | void RNG_ClearFlag(uint8_t RNG_FLAG); 97 | ITStatus RNG_GetITStatus(uint8_t RNG_IT); 98 | void RNG_ClearITPendingBit(uint8_t RNG_IT); 99 | 100 | #ifdef __cplusplus 101 | } 102 | #endif 103 | 104 | #endif /*__STM32F4xx_RNG_H */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** 111 | * @} 112 | */ 113 | 114 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 115 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_hcd_int.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_hcd_int.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Peripheral Device Interface Layer 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __HCD_INT_H__ 24 | #define __HCD_INT_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_hcd.h" 28 | 29 | 30 | /** @addtogroup USB_OTG_DRIVER 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_HCD_INT 35 | * @brief This file is the 36 | * @{ 37 | */ 38 | 39 | 40 | /** @defgroup USB_HCD_INT_Exported_Defines 41 | * @{ 42 | */ 43 | /** 44 | * @} 45 | */ 46 | 47 | 48 | /** @defgroup USB_HCD_INT_Exported_Types 49 | * @{ 50 | */ 51 | 52 | typedef struct _USBH_HCD_INT 53 | { 54 | uint8_t (* SOF) (USB_OTG_CORE_HANDLE *pdev); 55 | uint8_t (* DevConnected) (USB_OTG_CORE_HANDLE *pdev); 56 | uint8_t (* DevDisconnected) (USB_OTG_CORE_HANDLE *pdev); 57 | uint8_t (* DevPortEnabled) (USB_OTG_CORE_HANDLE *pdev); 58 | uint8_t (* DevPortDisabled) (USB_OTG_CORE_HANDLE *pdev); 59 | 60 | }USBH_HCD_INT_cb_TypeDef; 61 | 62 | extern USBH_HCD_INT_cb_TypeDef *USBH_HCD_INT_fops; 63 | /** 64 | * @} 65 | */ 66 | 67 | 68 | /** @defgroup USB_HCD_INT_Exported_Macros 69 | * @{ 70 | */ 71 | 72 | #define CLEAR_HC_INT(HC_REGS, intr) \ 73 | {\ 74 | USB_OTG_HCINTn_TypeDef hcint_clear; \ 75 | hcint_clear.d32 = 0; \ 76 | hcint_clear.b.intr = 1; \ 77 | USB_OTG_WRITE_REG32(&((HC_REGS)->HCINT), hcint_clear.d32);\ 78 | }\ 79 | 80 | #define MASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 81 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 82 | INTMSK.b.chhltd = 0; \ 83 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 84 | 85 | #define UNMASK_HOST_INT_CHH(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 86 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 87 | INTMSK.b.chhltd = 1; \ 88 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 89 | 90 | #define MASK_HOST_INT_ACK(hc_num) { USB_OTG_HCINTMSK_TypeDef INTMSK; \ 91 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 92 | INTMSK.b.ack = 0; \ 93 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, GINTMSK.d32);} 94 | 95 | #define UNMASK_HOST_INT_ACK(hc_num) { USB_OTG_HCGINTMSK_TypeDef INTMSK; \ 96 | INTMSK.d32 = USB_OTG_READ_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK); \ 97 | INTMSK.b.ack = 1; \ 98 | USB_OTG_WRITE_REG32(&pdev->regs.HC_REGS[hc_num]->HCINTMSK, INTMSK.d32);} 99 | 100 | /** 101 | * @} 102 | */ 103 | 104 | /** @defgroup USB_HCD_INT_Exported_Variables 105 | * @{ 106 | */ 107 | /** 108 | * @} 109 | */ 110 | 111 | /** @defgroup USB_HCD_INT_Exported_FunctionsPrototype 112 | * @{ 113 | */ 114 | /* Callbacks handler */ 115 | void ConnectCallback_Handler(USB_OTG_CORE_HANDLE *pdev); 116 | void Disconnect_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 117 | void Overcurrent_Callback_Handler(USB_OTG_CORE_HANDLE *pdev); 118 | uint32_t USBH_OTG_ISR_Handler (USB_OTG_CORE_HANDLE *pdev); 119 | 120 | /** 121 | * @} 122 | */ 123 | 124 | 125 | 126 | #endif //__HCD_INT_H__ 127 | 128 | 129 | /** 130 | * @} 131 | */ 132 | 133 | /** 134 | * @} 135 | */ 136 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 137 | 138 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/cdc/inc/usbd_cdc_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_cdc_core.h 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header file for the usbd_cdc_core.c file. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Includes ------------------------------------------------------------------*/ 23 | 24 | #ifndef __USB_CDC_CORE_H_ 25 | #define __USB_CDC_CORE_H_ 26 | 27 | #include "usbd_ioreq.h" 28 | 29 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 30 | * @{ 31 | */ 32 | 33 | /** @defgroup usbd_cdc 34 | * @brief This file is the Header file for USBD_cdc.c 35 | * @{ 36 | */ 37 | 38 | 39 | /** @defgroup usbd_cdc_Exported_Defines 40 | * @{ 41 | */ 42 | #define USB_CDC_CONFIG_DESC_SIZ (67) 43 | #define USB_CDC_DESC_SIZ (67-9) 44 | 45 | #define DEVICE_CLASS_CDC 0x02 46 | #define DEVICE_SUBCLASS_CDC 0x00 47 | 48 | 49 | #define USB_DEVICE_DESCRIPTOR_TYPE 0x01 50 | #define USB_CONFIGURATION_DESCRIPTOR_TYPE 0x02 51 | #define USB_STRING_DESCRIPTOR_TYPE 0x03 52 | #define USB_INTERFACE_DESCRIPTOR_TYPE 0x04 53 | #define USB_ENDPOINT_DESCRIPTOR_TYPE 0x05 54 | 55 | #define STANDARD_ENDPOINT_DESC_SIZE 0x09 56 | 57 | #define CDC_DATA_IN_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 58 | 59 | #define CDC_DATA_OUT_PACKET_SIZE CDC_DATA_MAX_PACKET_SIZE 60 | 61 | /*---------------------------------------------------------------------*/ 62 | /* CDC definitions */ 63 | /*---------------------------------------------------------------------*/ 64 | 65 | /**************************************************/ 66 | /* CDC Requests */ 67 | /**************************************************/ 68 | #define SEND_ENCAPSULATED_COMMAND 0x00 69 | #define GET_ENCAPSULATED_RESPONSE 0x01 70 | #define SET_COMM_FEATURE 0x02 71 | #define GET_COMM_FEATURE 0x03 72 | #define CLEAR_COMM_FEATURE 0x04 73 | #define SET_LINE_CODING 0x20 74 | #define GET_LINE_CODING 0x21 75 | #define SET_CONTROL_LINE_STATE 0x22 76 | #define SEND_BREAK 0x23 77 | #define NO_CMD 0xFF 78 | 79 | /** 80 | * @} 81 | */ 82 | 83 | 84 | /** @defgroup USBD_CORE_Exported_TypesDefinitions 85 | * @{ 86 | */ 87 | typedef struct _CDC_IF_PROP 88 | { 89 | uint16_t (*pIf_Init) (void); 90 | uint16_t (*pIf_DeInit) (void); 91 | uint16_t (*pIf_Ctrl) (uint32_t Cmd, uint8_t* Buf, uint32_t Len); 92 | uint16_t (*pIf_DataTx) (void); 93 | uint16_t (*pIf_DataRx) (uint8_t* Buf, uint32_t Len); 94 | } 95 | CDC_IF_Prop_TypeDef; 96 | /** 97 | * @} 98 | */ 99 | 100 | 101 | 102 | /** @defgroup USBD_CORE_Exported_Macros 103 | * @{ 104 | */ 105 | 106 | /** 107 | * @} 108 | */ 109 | 110 | /** @defgroup USBD_CORE_Exported_Variables 111 | * @{ 112 | */ 113 | 114 | extern USBD_Class_cb_TypeDef USBD_CDC_cb; 115 | /** 116 | * @} 117 | */ 118 | 119 | /** @defgroup USB_CORE_Exported_Functions 120 | * @{ 121 | */ 122 | /** 123 | * @} 124 | */ 125 | 126 | #endif /* __USB_CDC_CORE_H_ */ 127 | /** 128 | * @} 129 | */ 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 136 | -------------------------------------------------------------------------------- /Component/fatfs/option/syscall.c: -------------------------------------------------------------------------------- 1 | /*------------------------------------------------------------------------*/ 2 | /* Sample code of OS dependent controls for FatFs */ 3 | /* (C)ChaN, 2014 */ 4 | /*------------------------------------------------------------------------*/ 5 | 6 | #include /* ANSI memory controls */ 7 | #include "ff.h" 8 | 9 | #if _FS_REENTRANT 10 | /*----------------------------------------------------------------------- 11 | Create a Synchronization Object 12 | ------------------------------------------------------------------------ 13 | This function is called in f_mount function to create a new 14 | synchronization object, such as semaphore and mutex. When a zero is 15 | returned, the f_mount function fails with FR_INT_ERR. 16 | */ 17 | 18 | int ff_cre_syncobj ( /* TRUE:Function succeeded, FALSE:Could not create due to any error */ 19 | BYTE vol, /* Corresponding logical drive being processed */ 20 | _SYNC_t *sobj /* Pointer to return the created sync object */ 21 | ) 22 | { 23 | int ret; 24 | 25 | osSemaphoreDef(SEM); 26 | *sobj = osSemaphoreCreate(osSemaphore(SEM), 1); 27 | ret = (*sobj != NULL); 28 | 29 | return ret; 30 | } 31 | 32 | 33 | 34 | /*------------------------------------------------------------------------*/ 35 | /* Delete a Synchronization Object */ 36 | /*------------------------------------------------------------------------*/ 37 | /* This function is called in f_mount function to delete a synchronization 38 | / object that created with ff_cre_syncobj function. When a zero is 39 | / returned, the f_mount function fails with FR_INT_ERR. 40 | */ 41 | 42 | int ff_del_syncobj ( /* TRUE:Function succeeded, FALSE:Could not delete due to any error */ 43 | _SYNC_t sobj /* Sync object tied to the logical drive to be deleted */ 44 | ) 45 | { 46 | osSemaphoreDelete (sobj); 47 | return 1; 48 | } 49 | 50 | 51 | 52 | /*------------------------------------------------------------------------*/ 53 | /* Request Grant to Access the Volume */ 54 | /*------------------------------------------------------------------------*/ 55 | /* This function is called on entering file functions to lock the volume. 56 | / When a zero is returned, the file function fails with FR_TIMEOUT. 57 | */ 58 | 59 | int ff_req_grant ( /* TRUE:Got a grant to access the volume, FALSE:Could not get a grant */ 60 | _SYNC_t sobj /* Sync object to wait */ 61 | ) 62 | { 63 | int ret = 0; 64 | 65 | if(osSemaphoreWait(sobj, _FS_TIMEOUT) == osOK) 66 | { 67 | ret = 1; 68 | } 69 | 70 | return ret; 71 | } 72 | 73 | 74 | 75 | /*------------------------------------------------------------------------*/ 76 | /* Release Grant to Access the Volume */ 77 | /*------------------------------------------------------------------------*/ 78 | /* This function is called on leaving file functions to unlock the volume. 79 | */ 80 | 81 | void ff_rel_grant ( 82 | _SYNC_t sobj /* Sync object to be signaled */ 83 | ) 84 | { 85 | osSemaphoreRelease(sobj); 86 | } 87 | 88 | #endif 89 | 90 | 91 | 92 | 93 | #if _USE_LFN == 3 /* LFN with a working buffer on the heap */ 94 | /*------------------------------------------------------------------------*/ 95 | /* Allocate a memory block */ 96 | /*------------------------------------------------------------------------*/ 97 | /* If a NULL is returned, the file function fails with FR_NOT_ENOUGH_CORE. 98 | */ 99 | 100 | void* ff_memalloc ( /* Returns pointer to the allocated memory block */ 101 | UINT msize /* Number of bytes to allocate */ 102 | ) 103 | { 104 | return malloc(msize); /* Allocate a new memory block with POSIX API */ 105 | } 106 | 107 | 108 | /*------------------------------------------------------------------------*/ 109 | /* Free a memory block */ 110 | /*------------------------------------------------------------------------*/ 111 | 112 | void ff_memfree ( 113 | void* mblock /* Pointer to the memory block to free */ 114 | ) 115 | { 116 | free(mblock); /* Discard the memory block with POSIX API */ 117 | } 118 | 119 | #endif 120 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/MSC/inc/usbh_msc_scsi.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_msc_scsi.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbh_msc_scsi.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_MSC_SCSI_H__ 24 | #define __USBH_MSC_SCSI_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbh_stdreq.h" 28 | 29 | 30 | /** @addtogroup USBH_LIB 31 | * @{ 32 | */ 33 | 34 | /** @addtogroup USBH_CLASS 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup USBH_MSC_CLASS 39 | * @{ 40 | */ 41 | 42 | /** @defgroup USBH_MSC_SCSI 43 | * @brief This file is the Header file for usbh_msc_scsi.c 44 | * @{ 45 | */ 46 | 47 | 48 | /** @defgroup USBH_MSC_SCSI_Exported_Types 49 | * @{ 50 | */ 51 | typedef enum { 52 | USBH_MSC_OK = 0, 53 | USBH_MSC_FAIL = 1, 54 | USBH_MSC_PHASE_ERROR = 2, 55 | USBH_MSC_BUSY = 3 56 | }USBH_MSC_Status_TypeDef; 57 | 58 | typedef enum { 59 | CMD_UNINITIALIZED_STATE =0, 60 | CMD_SEND_STATE, 61 | CMD_WAIT_STATUS 62 | } CMD_STATES_TypeDef; 63 | 64 | 65 | 66 | typedef struct __MassStorageParameter 67 | { 68 | uint32_t MSCapacity; 69 | uint32_t MSSenseKey; 70 | uint16_t MSPageLength; 71 | uint8_t MSBulkOutEp; 72 | uint8_t MSBulkInEp; 73 | uint8_t MSWriteProtect; 74 | } MassStorageParameter_TypeDef; 75 | /** 76 | * @} 77 | */ 78 | 79 | 80 | 81 | /** @defgroup USBH_MSC_SCSI_Exported_Defines 82 | * @{ 83 | */ 84 | 85 | 86 | 87 | #define OPCODE_TEST_UNIT_READY 0X00 88 | #define OPCODE_READ_CAPACITY10 0x25 89 | #define OPCODE_MODE_SENSE6 0x1A 90 | #define OPCODE_READ10 0x28 91 | #define OPCODE_WRITE10 0x2A 92 | #define OPCODE_REQUEST_SENSE 0x03 93 | 94 | #define DESC_REQUEST_SENSE 0X00 95 | #define ALLOCATION_LENGTH_REQUEST_SENSE 63 96 | #define XFER_LEN_READ_CAPACITY10 8 97 | #define XFER_LEN_MODE_SENSE6 63 98 | 99 | #define MASK_MODE_SENSE_WRITE_PROTECT 0x80 100 | #define MODE_SENSE_PAGE_CONTROL_FIELD 0x00 101 | #define MODE_SENSE_PAGE_CODE 0x3F 102 | #define DISK_WRITE_PROTECTED 0x01 103 | /** 104 | * @} 105 | */ 106 | 107 | /** @defgroup USBH_MSC_SCSI_Exported_Macros 108 | * @{ 109 | */ 110 | /** 111 | * @} 112 | */ 113 | 114 | /** @defgroup _Exported_Variables 115 | * @{ 116 | */ 117 | extern MassStorageParameter_TypeDef USBH_MSC_Param; 118 | /** 119 | * @} 120 | */ 121 | 122 | /** @defgroup USBH_MSC_SCSI_Exported_FunctionsPrototype 123 | * @{ 124 | */ 125 | uint8_t USBH_MSC_TestUnitReady(USB_OTG_CORE_HANDLE *pdev); 126 | uint8_t USBH_MSC_ReadCapacity10(USB_OTG_CORE_HANDLE *pdev); 127 | uint8_t USBH_MSC_ModeSense6(USB_OTG_CORE_HANDLE *pdev); 128 | uint8_t USBH_MSC_RequestSense(USB_OTG_CORE_HANDLE *pdev); 129 | uint8_t USBH_MSC_Write10(USB_OTG_CORE_HANDLE *pdev, 130 | uint8_t *, 131 | uint32_t , 132 | uint32_t ); 133 | uint8_t USBH_MSC_Read10(USB_OTG_CORE_HANDLE *pdev, 134 | uint8_t *, 135 | uint32_t , 136 | uint32_t ); 137 | void USBH_MSC_StateMachine(USB_OTG_CORE_HANDLE *pdev); 138 | 139 | /** 140 | * @} 141 | */ 142 | 143 | #endif //__USBH_MSC_SCSI_H__ 144 | 145 | 146 | /** 147 | * @} 148 | */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163 | 164 | -------------------------------------------------------------------------------- /Component/USB_F4/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 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief header for the usbd_msc_bot.c file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | 24 | #include "usbd_core.h" 25 | 26 | /* Define to prevent recursive inclusion -------------------------------------*/ 27 | #ifndef __USBD_MSC_BOT_H 28 | #define __USBD_MSC_BOT_H 29 | 30 | /** @addtogroup STM32_USB_OTG_DEVICE_LIBRARY 31 | * @{ 32 | */ 33 | 34 | /** @defgroup MSC_BOT 35 | * @brief This file is the Header file for usbd_bot.c 36 | * @{ 37 | */ 38 | 39 | 40 | /** @defgroup USBD_CORE_Exported_Defines 41 | * @{ 42 | */ 43 | #define BOT_IDLE 0 /* Idle state */ 44 | #define BOT_DATA_OUT 1 /* Data Out state */ 45 | #define BOT_DATA_IN 2 /* Data In state */ 46 | #define BOT_LAST_DATA_IN 3 /* Last Data In Last */ 47 | #define BOT_SEND_DATA 4 /* Send Immediate data */ 48 | 49 | #define BOT_CBW_SIGNATURE 0x43425355 50 | #define BOT_CSW_SIGNATURE 0x53425355 51 | #define BOT_CBW_LENGTH 31 52 | #define BOT_CSW_LENGTH 13 53 | 54 | /* CSW Status Definitions */ 55 | #define CSW_CMD_PASSED 0x00 56 | #define CSW_CMD_FAILED 0x01 57 | #define CSW_PHASE_ERROR 0x02 58 | 59 | /* BOT Status */ 60 | #define BOT_STATE_NORMAL 0 61 | #define BOT_STATE_RECOVERY 1 62 | #define BOT_STATE_ERROR 2 63 | 64 | 65 | #define DIR_IN 0 66 | #define DIR_OUT 1 67 | #define BOTH_DIR 2 68 | 69 | /** 70 | * @} 71 | */ 72 | 73 | /** @defgroup MSC_CORE_Private_TypesDefinitions 74 | * @{ 75 | */ 76 | 77 | typedef struct _MSC_BOT_CBW 78 | { 79 | uint32_t dSignature; 80 | uint32_t dTag; 81 | uint32_t dDataLength; 82 | uint8_t bmFlags; 83 | uint8_t bLUN; 84 | uint8_t bCBLength; 85 | uint8_t CB[16]; 86 | } 87 | MSC_BOT_CBW_TypeDef; 88 | 89 | 90 | typedef struct _MSC_BOT_CSW 91 | { 92 | uint32_t dSignature; 93 | uint32_t dTag; 94 | uint32_t dDataResidue; 95 | uint8_t bStatus; 96 | } 97 | MSC_BOT_CSW_TypeDef; 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | 104 | /** @defgroup USBD_CORE_Exported_Types 105 | * @{ 106 | */ 107 | 108 | extern uint8_t MSC_BOT_Data[]; 109 | extern uint16_t MSC_BOT_DataLen; 110 | extern uint8_t MSC_BOT_State; 111 | extern uint8_t MSC_BOT_BurstMode; 112 | extern MSC_BOT_CBW_TypeDef MSC_BOT_cbw; 113 | extern MSC_BOT_CSW_TypeDef MSC_BOT_csw; 114 | /** 115 | * @} 116 | */ 117 | /** @defgroup USBD_CORE_Exported_FunctionsPrototypes 118 | * @{ 119 | */ 120 | void MSC_BOT_Init (USB_OTG_CORE_HANDLE *pdev); 121 | void MSC_BOT_Reset (USB_OTG_CORE_HANDLE *pdev); 122 | void MSC_BOT_DeInit (USB_OTG_CORE_HANDLE *pdev); 123 | void MSC_BOT_DataIn (USB_OTG_CORE_HANDLE *pdev, 124 | uint8_t epnum); 125 | 126 | void MSC_BOT_DataOut (USB_OTG_CORE_HANDLE *pdev, 127 | uint8_t epnum); 128 | 129 | void MSC_BOT_SendCSW (USB_OTG_CORE_HANDLE *pdev, 130 | uint8_t CSW_Status); 131 | 132 | void MSC_BOT_CplClrFeature (USB_OTG_CORE_HANDLE *pdev, 133 | uint8_t epnum); 134 | /** 135 | * @} 136 | */ 137 | 138 | #endif /* __USBD_MSC_BOT_H */ 139 | /** 140 | * @} 141 | */ 142 | 143 | /** 144 | * @} 145 | */ 146 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 147 | 148 | -------------------------------------------------------------------------------- /libaray/inc/stm32f4xx_dbgmcu.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_dbgmcu.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the DBGMCU firmware library. 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 12 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 13 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 14 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 15 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 16 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 17 | * 18 | *

© COPYRIGHT 2011 STMicroelectronics

19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __STM32F4xx_DBGMCU_H 24 | #define __STM32F4xx_DBGMCU_H 25 | 26 | #ifdef __cplusplus 27 | extern "C" { 28 | #endif 29 | 30 | /* Includes ------------------------------------------------------------------*/ 31 | #include "stm32f4xx.h" 32 | 33 | /** @addtogroup STM32F4xx_StdPeriph_Driver 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup DBGMCU 38 | * @{ 39 | */ 40 | 41 | /* Exported types ------------------------------------------------------------*/ 42 | /* Exported constants --------------------------------------------------------*/ 43 | 44 | /** @defgroup DBGMCU_Exported_Constants 45 | * @{ 46 | */ 47 | #define DBGMCU_SLEEP ((uint32_t)0x00000001) 48 | #define DBGMCU_STOP ((uint32_t)0x00000002) 49 | #define DBGMCU_STANDBY ((uint32_t)0x00000004) 50 | #define IS_DBGMCU_PERIPH(PERIPH) ((((PERIPH) & 0xFFFFFFF8) == 0x00) && ((PERIPH) != 0x00)) 51 | 52 | #define DBGMCU_TIM2_STOP ((uint32_t)0x00000001) 53 | #define DBGMCU_TIM3_STOP ((uint32_t)0x00000002) 54 | #define DBGMCU_TIM4_STOP ((uint32_t)0x00000004) 55 | #define DBGMCU_TIM5_STOP ((uint32_t)0x00000008) 56 | #define DBGMCU_TIM6_STOP ((uint32_t)0x00000010) 57 | #define DBGMCU_TIM7_STOP ((uint32_t)0x00000020) 58 | #define DBGMCU_TIM12_STOP ((uint32_t)0x00000040) 59 | #define DBGMCU_TIM13_STOP ((uint32_t)0x00000080) 60 | #define DBGMCU_TIM14_STOP ((uint32_t)0x00000100) 61 | #define DBGMCU_RTC_STOP ((uint32_t)0x00000400) 62 | #define DBGMCU_WWDG_STOP ((uint32_t)0x00000800) 63 | #define DBGMCU_IWDG_STOP ((uint32_t)0x00001000) 64 | #define DBGMCU_I2C1_SMBUS_TIMEOUT ((uint32_t)0x00200000) 65 | #define DBGMCU_I2C2_SMBUS_TIMEOUT ((uint32_t)0x00400000) 66 | #define DBGMCU_I2C3_SMBUS_TIMEOUT ((uint32_t)0x00800000) 67 | #define DBGMCU_CAN1_STOP ((uint32_t)0x02000000) 68 | #define DBGMCU_CAN2_STOP ((uint32_t)0x04000000) 69 | #define IS_DBGMCU_APB1PERIPH(PERIPH) ((((PERIPH) & 0xF91FE200) == 0x00) && ((PERIPH) != 0x00)) 70 | 71 | #define DBGMCU_TIM1_STOP ((uint32_t)0x00000001) 72 | #define DBGMCU_TIM8_STOP ((uint32_t)0x00000002) 73 | #define DBGMCU_TIM9_STOP ((uint32_t)0x00010000) 74 | #define DBGMCU_TIM10_STOP ((uint32_t)0x00020000) 75 | #define DBGMCU_TIM11_STOP ((uint32_t)0x00040000) 76 | #define IS_DBGMCU_APB2PERIPH(PERIPH) ((((PERIPH) & 0xFFF8FFFC) == 0x00) && ((PERIPH) != 0x00)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /* Exported macro ------------------------------------------------------------*/ 82 | /* Exported functions --------------------------------------------------------*/ 83 | uint32_t DBGMCU_GetREVID(void); 84 | uint32_t DBGMCU_GetDEVID(void); 85 | void DBGMCU_Config(uint32_t DBGMCU_Periph, FunctionalState NewState); 86 | void DBGMCU_APB1PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 87 | void DBGMCU_APB2PeriphConfig(uint32_t DBGMCU_Periph, FunctionalState NewState); 88 | 89 | #ifdef __cplusplus 90 | } 91 | #endif 92 | 93 | #endif /* __STM32F4xx_DBGMCU_H */ 94 | 95 | /** 96 | * @} 97 | */ 98 | 99 | /** 100 | * @} 101 | */ 102 | 103 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 104 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_Device_Library/Class/dfu/src/usbd_mem_if_template.c: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbd_mem_if_template.c 4 | * @author MCD Application Team 5 | * @version V1.2.1 6 | * @date 17-March-2018 7 | * @brief Specific media access Layer for a template memory. This file is 8 | provided as template example showing how to implement a new memory 9 | interface based on pre-defined API. 10 | ****************************************************************************** 11 | * @attention 12 | * 13 | *

© Copyright (c) 2015 STMicroelectronics. 14 | * All rights reserved.

15 | * 16 | * This software component is licensed by ST under Ultimate Liberty license 17 | * SLA0044, the "License"; You may not use this file except in compliance with 18 | * the License. You may obtain a copy of the License at: 19 | * 20 | * 21 | ****************************************************************************** 22 | */ 23 | 24 | /* Includes ------------------------------------------------------------------*/ 25 | #include "usbd_mem_if_template.h" 26 | #include "usbd_dfu_mal.h" 27 | 28 | /* Private typedef -----------------------------------------------------------*/ 29 | /* Private define ------------------------------------------------------------*/ 30 | /* Private macro -------------------------------------------------------------*/ 31 | 32 | /* Private function prototypes -----------------------------------------------*/ 33 | uint16_t MEM_If_Init(void); 34 | uint16_t MEM_If_Erase (uint32_t Add); 35 | uint16_t MEM_If_Write (uint32_t Add, uint32_t Len); 36 | uint8_t *MEM_If_Read (uint32_t Add, uint32_t Len); 37 | uint16_t MEM_If_DeInit(void); 38 | uint16_t MEM_If_CheckAdd(uint32_t Add); 39 | 40 | 41 | /* Private variables ---------------------------------------------------------*/ 42 | DFU_MAL_Prop_TypeDef DFU_Mem_cb = 43 | { 44 | MEM_IF_STRING, 45 | MEM_If_Init, 46 | MEM_If_DeInit, 47 | MEM_If_Erase, 48 | MEM_If_Write, 49 | MEM_If_Read, 50 | MEM_If_CheckAdd, 51 | 10, /* Erase Time in ms */ 52 | 10 /* Programming Time in ms */ 53 | }; 54 | 55 | /* Private functions ---------------------------------------------------------*/ 56 | 57 | /** 58 | * @brief MEM_If_Init 59 | * Memory initialization routine. 60 | * @param None 61 | * @retval MAL_OK if operation is successful, MAL_FAIL else. 62 | */ 63 | uint16_t MEM_If_Init(void) 64 | { 65 | return MAL_OK; 66 | } 67 | 68 | /** 69 | * @brief MEM_If_DeInit 70 | * Memory deinitialization routine. 71 | * @param None 72 | * @retval MAL_OK if operation is successful, MAL_FAIL else. 73 | */ 74 | uint16_t MEM_If_DeInit(void) 75 | { 76 | return MAL_OK; 77 | } 78 | 79 | /** 80 | * @brief MEM_If_Erase 81 | * Erase sector. 82 | * @param Add: Address of sector to be erased. 83 | * @retval MAL_OK if operation is successful, MAL_FAIL else. 84 | */ 85 | uint16_t MEM_If_Erase(uint32_t Add) 86 | { 87 | return MAL_OK; 88 | } 89 | 90 | /** 91 | * @brief MEM_If_Write 92 | * Memory write routine. 93 | * @param Add: Address to be written to. 94 | * @param Len: Number of data to be written (in bytes). 95 | * @retval MAL_OK if operation is successful, MAL_FAIL else. 96 | */ 97 | uint16_t MEM_If_Write(uint32_t Add, uint32_t Len) 98 | { 99 | return MAL_OK; 100 | } 101 | 102 | /** 103 | * @brief MEM_If_Read 104 | * Memory read routine. 105 | * @param Add: Address to be read from. 106 | * @param Len: Number of data to be read (in bytes). 107 | * @retval Pointer to the physical address where data should be read. 108 | */ 109 | uint8_t *MEM_If_Read (uint32_t Add, uint32_t Len) 110 | { 111 | /* Return a valid address to avoid HardFault */ 112 | return (uint8_t*)(MAL_Buffer); 113 | } 114 | 115 | /** 116 | * @brief MEM_If_CheckAdd 117 | * Check if the address is an allowed address for this memory. 118 | * @param Add: Address to be checked. 119 | * @param Len: Number of data to be read (in bytes). 120 | * @retval MAL_OK if the address is allowed, MAL_FAIL else. 121 | */ 122 | uint16_t MEM_If_CheckAdd(uint32_t Add) 123 | { 124 | if ((Add >= MEM_START_ADD) && (Add < MEM_END_ADD)) 125 | { 126 | return MAL_OK; 127 | } 128 | else 129 | { 130 | return MAL_FAIL; 131 | } 132 | } 133 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 134 | -------------------------------------------------------------------------------- /My_Lib/FLASH/rom_flash_interface.c: -------------------------------------------------------------------------------- 1 | 2 | #include "rom_flash_interface.h" 3 | #include "stm32f10x.h" 4 | #include "GlobalDef.h" 5 | 6 | int32_t rom_flash_initialize(void) 7 | { 8 | FLASH_Unlock(); 9 | return 0; 10 | } 11 | 12 | 13 | DRESULT rom_flash_ioctl(BYTE lun, BYTE cmd, void *buff) 14 | { 15 | DRESULT res = RES_ERROR; 16 | 17 | switch (cmd) 18 | { 19 | /* Make sure that no pending write process */ 20 | case CTRL_SYNC: 21 | res = RES_OK; 22 | break; 23 | 24 | /* Get number of sectors on the disk (DWORD) */ 25 | case GET_SECTOR_COUNT : 26 | *(DWORD*)buff = ROM_FLASH_SIZE / ROM_FLASH_SECTOR_SIZE; 27 | res = RES_OK; 28 | break; 29 | 30 | /* Get R/W sector size (WORD) */ 31 | case GET_SECTOR_SIZE : 32 | *(WORD*)buff = ROM_FLASH_SECTOR_SIZE; 33 | res = RES_OK; 34 | break; 35 | 36 | /* Get erase block size in unit of sector (DWORD) */ 37 | case GET_BLOCK_SIZE : 38 | *(DWORD*)buff = ROM_FLASH_SECTOR_SIZE; 39 | break; 40 | 41 | default: 42 | res = RES_PARERR; 43 | } 44 | 45 | return res; 46 | } 47 | 48 | uint16_t rom_flash_mal_write_ex(uint8_t lun, uint32_t Memory_Offset, uint32_t * Writebuff, uint16_t Transfer_Length) 49 | { 50 | uint16_t i; 51 | 52 | os_printf("2 w: ad = 0x%x, len = %d\r\n", Memory_Offset, Transfer_Length); //测试用 53 | 54 | for( i = 0; i < Transfer_Length; i += ROM_FLASH_PAGE_SIZE ) 55 | { 56 | if( FLASH_WaitForLastOperation(ROM_FLASH_WAIT_TIMEOUT) != FLASH_TIMEOUT ) 57 | { 58 | FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_PGERR|FLASH_FLAG_WRPRTERR); 59 | } 60 | FLASH_ErasePage(ROM_FLASH_START_ADDR + Memory_Offset + i); 61 | } 62 | 63 | for( i = 0; i < Transfer_Length; i += 4 ) 64 | { 65 | if( FLASH_WaitForLastOperation(ROM_FLASH_WAIT_TIMEOUT) != FLASH_TIMEOUT ) 66 | { 67 | FLASH_ClearFlag(FLASH_FLAG_EOP|FLASH_FLAG_PGERR|FLASH_FLAG_WRPRTERR); 68 | } 69 | FLASH_ProgramWord(ROM_FLASH_START_ADDR + Memory_Offset + i , Writebuff[i >> 2]); 70 | } 71 | 72 | return 0; 73 | } 74 | 75 | 76 | #include "os_global.h" 77 | uint16_t rom_flash_mal_write(uint8_t lun, uint32_t Memory_Offset, uint32_t *Writebuff, uint16_t Transfer_Length) 78 | { 79 | uint16_t i; 80 | 81 | os_printf("0 w: ad = 0x%x, len = %d\r\n", Memory_Offset, Transfer_Length); //测试用 82 | for( i = 0; i < Transfer_Length; i += ROM_FLASH_PAGE_SIZE ) 83 | { 84 | if( FLASH_WaitForLastOperation(ROM_FLASH_WAIT_TIMEOUT) != FLASH_TIMEOUT ) 85 | { 86 | FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); 87 | } 88 | FLASH_ErasePage(ROM_FLASH_START_ADDR + Memory_Offset + i); 89 | } 90 | 91 | for(i = 0; i < Transfer_Length; i += 4 ) 92 | { 93 | if( FLASH_WaitForLastOperation(ROM_FLASH_WAIT_TIMEOUT) != FLASH_TIMEOUT ) 94 | { 95 | FLASH_ClearFlag(FLASH_FLAG_EOP | FLASH_FLAG_PGERR | FLASH_FLAG_WRPRTERR); 96 | } 97 | FLASH_ProgramWord(ROM_FLASH_START_ADDR + Memory_Offset + i, Writebuff[i >> 2]); 98 | } 99 | return 0; 100 | } 101 | 102 | uint16_t rom_flash_mal_read(uint8_t lun, uint32_t Memory_Offset, uint32_t * Readbuff, uint16_t Transfer_Length) 103 | { 104 | uint16_t i; 105 | 106 | os_printf("0 r: ad = 0x%x, len = %d\r\n", Memory_Offset, Transfer_Length); //测试用 107 | for(i = 0; i < Transfer_Length; i += 4) 108 | { 109 | Readbuff[i >> 2] = ((vu32*)(ROM_FLASH_START_ADDR + Memory_Offset))[i >> 2]; 110 | } 111 | return 0; 112 | } 113 | 114 | 115 | /** 116 | * @brief Reads Sector(s) 117 | * @param lun : not used 118 | * @param *buff: Data buffer to store read data 119 | * @param sector: Sector address (LBA), 扇区号: 0-N 120 | * @param count: Number of sectors to read (1..128) 121 | * @retval DRESULT: Operation result 122 | */ 123 | DRESULT rom_flash_disk_read(BYTE lun, BYTE * buff, DWORD sector, UINT count) 124 | { 125 | uint16_t i; 126 | 127 | for(i = 0; i < count; i++) 128 | { 129 | rom_flash_mal_read(lun, (sector + i) * ROM_FLASH_SECTOR_SIZE, (uint32_t *)buff, ROM_FLASH_SECTOR_SIZE); 130 | buff += ROM_FLASH_SECTOR_SIZE; 131 | } 132 | return RES_OK; 133 | } 134 | 135 | // 功能: 提供给 fatfs 的disk write 写数据接口 136 | // DWORD sector: 起始扇区号, 0-N 137 | // UINT count: 需要写入的扇区总数 138 | DRESULT rom_flash_disk_write(BYTE lun, const BYTE *buff, DWORD sector, UINT count) 139 | { 140 | uint16_t i; 141 | 142 | for(i = 0; i < count; i++) 143 | { 144 | rom_flash_mal_write(lun, (sector + i) * ROM_FLASH_SECTOR_SIZE, (uint32_t *)buff, ROM_FLASH_SECTOR_SIZE); 145 | buff += ROM_FLASH_SECTOR_SIZE; 146 | } 147 | return RES_OK; 148 | } 149 | 150 | -------------------------------------------------------------------------------- /Component/SFUD-master/sfud/inc/sfud.h: -------------------------------------------------------------------------------- 1 | /* 2 | * This file is part of the Serial Flash Universal Driver Library. 3 | * 4 | * Copyright (c) 2016, Armink, 5 | * 6 | * Permission is hereby granted, free of charge, to any person obtaining 7 | * a copy of this software and associated documentation files (the 8 | * 'Software'), to deal in the Software without restriction, including 9 | * without limitation the rights to use, copy, modify, merge, publish, 10 | * distribute, sublicense, and/or sell copies of the Software, and to 11 | * permit persons to whom the Software is furnished to do so, subject to 12 | * the following conditions: 13 | * 14 | * The above copyright notice and this permission notice shall be 15 | * included in all copies or substantial portions of the Software. 16 | * 17 | * THE SOFTWARE IS PROVIDED 'AS IS', WITHOUT WARRANTY OF ANY KIND, 18 | * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF 19 | * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 20 | * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY 21 | * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, 22 | * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE 23 | * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 24 | * 25 | * Function: It is an head file for this library. You can see all of the functions which can be called by user. 26 | * Created on: 2016-04-23 27 | */ 28 | 29 | #ifndef _SFUD_H_ 30 | #define _SFUD_H_ 31 | 32 | #include "sfud_def.h" 33 | 34 | #ifdef __cplusplus 35 | extern "C" { 36 | #endif 37 | 38 | /* ../src/sfup.c */ 39 | /** 40 | * SFUD library initialize. 41 | * 42 | * @return result 43 | */ 44 | sfud_err sfud_init(void); 45 | 46 | bool sfud_read_sfdp(sfud_flash *flash); 47 | 48 | /** 49 | * get flash device by its index which in the flash information table 50 | * 51 | * @param index the index which in the flash information table @see flash_table 52 | * 53 | * @return flash device 54 | */ 55 | sfud_flash *sfud_get_device(size_t index); 56 | 57 | /** 58 | * get flash device total number on flash device information table @see flash_table 59 | * 60 | * @return flash device total number 61 | */ 62 | size_t sfud_get_device_num(void); 63 | 64 | /** 65 | * get flash device information table @see flash_table 66 | * 67 | * @return flash device table pointer 68 | */ 69 | const sfud_flash *sfud_get_device_table(void); 70 | 71 | /** 72 | * read flash data 73 | * 74 | * @param flash flash device 75 | * @param addr start address 76 | * @param size read size 77 | * @param data read data pointer 78 | * 79 | * @return result 80 | */ 81 | sfud_err sfud_read(const sfud_flash *flash, uint32_t addr, size_t size, uint8_t *data); 82 | 83 | /** 84 | * erase flash data 85 | * 86 | * @note It will erase align by erase granularity. 87 | * 88 | * @param flash flash device 89 | * @param addr start address 90 | * @param size erase size 91 | * 92 | * @return result 93 | */ 94 | sfud_err sfud_erase(const sfud_flash *flash, uint32_t addr, size_t size); 95 | 96 | /** 97 | * write flash data (no erase operate) 98 | * 99 | * @param flash flash device 100 | * @param addr start address 101 | * @param data write data 102 | * @param size write size 103 | * 104 | * @return result 105 | */ 106 | sfud_err sfud_write(const sfud_flash *flash, uint32_t addr, size_t size, const uint8_t *data); 107 | 108 | /** 109 | * erase and write flash data 110 | * 111 | * @param flash flash device 112 | * @param addr start address 113 | * @param size write size 114 | * @param data write data 115 | * 116 | * @return result 117 | */ 118 | sfud_err sfud_erase_write(const sfud_flash *flash, uint32_t addr, size_t size, const uint8_t *data); 119 | 120 | /** 121 | * erase all flash data 122 | * 123 | * @param flash flash device 124 | * 125 | * @return result 126 | */ 127 | sfud_err sfud_chip_erase(const sfud_flash *flash); 128 | 129 | /** 130 | * read flash register status 131 | * 132 | * @param flash flash device 133 | * @param status register status 134 | * 135 | * @return result 136 | */ 137 | sfud_err sfud_read_status(const sfud_flash *flash, uint8_t *status); 138 | 139 | /** 140 | * write status register 141 | * 142 | * @param flash flash device 143 | * @param is_volatile true: volatile mode, false: non-volatile mode 144 | * @param status register status 145 | * 146 | * @return result 147 | */ 148 | sfud_err sfud_write_status(const sfud_flash *flash, bool is_volatile, uint8_t status); 149 | 150 | #ifdef __cplusplus 151 | } 152 | #endif 153 | 154 | #endif /* _SFUD_H_ */ 155 | -------------------------------------------------------------------------------- /libaray/inc/stm32f4xx_iwdg.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file stm32f4xx_iwdg.h 4 | * @author MCD Application Team 5 | * @version V1.0.0 6 | * @date 30-September-2011 7 | * @brief This file contains all the functions prototypes for the IWDG 8 | * firmware library. 9 | ****************************************************************************** 10 | * @attention 11 | * 12 | * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS 13 | * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE 14 | * TIME. AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY 15 | * DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING 16 | * FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE 17 | * CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS. 18 | * 19 | *

© COPYRIGHT 2011 STMicroelectronics

20 | ****************************************************************************** 21 | */ 22 | 23 | /* Define to prevent recursive inclusion -------------------------------------*/ 24 | #ifndef __STM32F4xx_IWDG_H 25 | #define __STM32F4xx_IWDG_H 26 | 27 | #ifdef __cplusplus 28 | extern "C" { 29 | #endif 30 | 31 | /* Includes ------------------------------------------------------------------*/ 32 | #include "stm32f4xx.h" 33 | 34 | /** @addtogroup STM32F4xx_StdPeriph_Driver 35 | * @{ 36 | */ 37 | 38 | /** @addtogroup IWDG 39 | * @{ 40 | */ 41 | 42 | /* Exported types ------------------------------------------------------------*/ 43 | /* Exported constants --------------------------------------------------------*/ 44 | 45 | /** @defgroup IWDG_Exported_Constants 46 | * @{ 47 | */ 48 | 49 | /** @defgroup IWDG_WriteAccess 50 | * @{ 51 | */ 52 | #define IWDG_WriteAccess_Enable ((uint16_t)0x5555) 53 | #define IWDG_WriteAccess_Disable ((uint16_t)0x0000) 54 | #define IS_IWDG_WRITE_ACCESS(ACCESS) (((ACCESS) == IWDG_WriteAccess_Enable) || \ 55 | ((ACCESS) == IWDG_WriteAccess_Disable)) 56 | /** 57 | * @} 58 | */ 59 | 60 | /** @defgroup IWDG_prescaler 61 | * @{ 62 | */ 63 | #define IWDG_Prescaler_4 ((uint8_t)0x00) 64 | #define IWDG_Prescaler_8 ((uint8_t)0x01) 65 | #define IWDG_Prescaler_16 ((uint8_t)0x02) 66 | #define IWDG_Prescaler_32 ((uint8_t)0x03) 67 | #define IWDG_Prescaler_64 ((uint8_t)0x04) 68 | #define IWDG_Prescaler_128 ((uint8_t)0x05) 69 | #define IWDG_Prescaler_256 ((uint8_t)0x06) 70 | #define IS_IWDG_PRESCALER(PRESCALER) (((PRESCALER) == IWDG_Prescaler_4) || \ 71 | ((PRESCALER) == IWDG_Prescaler_8) || \ 72 | ((PRESCALER) == IWDG_Prescaler_16) || \ 73 | ((PRESCALER) == IWDG_Prescaler_32) || \ 74 | ((PRESCALER) == IWDG_Prescaler_64) || \ 75 | ((PRESCALER) == IWDG_Prescaler_128)|| \ 76 | ((PRESCALER) == IWDG_Prescaler_256)) 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup IWDG_Flag 82 | * @{ 83 | */ 84 | #define IWDG_FLAG_PVU ((uint16_t)0x0001) 85 | #define IWDG_FLAG_RVU ((uint16_t)0x0002) 86 | #define IS_IWDG_FLAG(FLAG) (((FLAG) == IWDG_FLAG_PVU) || ((FLAG) == IWDG_FLAG_RVU)) 87 | #define IS_IWDG_RELOAD(RELOAD) ((RELOAD) <= 0xFFF) 88 | /** 89 | * @} 90 | */ 91 | 92 | /** 93 | * @} 94 | */ 95 | 96 | /* Exported macro ------------------------------------------------------------*/ 97 | /* Exported functions --------------------------------------------------------*/ 98 | 99 | /* Prescaler and Counter configuration functions ******************************/ 100 | void IWDG_WriteAccessCmd(uint16_t IWDG_WriteAccess); 101 | void IWDG_SetPrescaler(uint8_t IWDG_Prescaler); 102 | void IWDG_SetReload(uint16_t Reload); 103 | void IWDG_ReloadCounter(void); 104 | 105 | /* IWDG activation function ***************************************************/ 106 | void IWDG_Enable(void); 107 | 108 | /* Flag management function ***************************************************/ 109 | FlagStatus IWDG_GetFlagStatus(uint16_t IWDG_FLAG); 110 | 111 | #ifdef __cplusplus 112 | } 113 | #endif 114 | 115 | #endif /* __STM32F4xx_IWDG_H */ 116 | 117 | /** 118 | * @} 119 | */ 120 | 121 | /** 122 | * @} 123 | */ 124 | 125 | /******************* (C) COPYRIGHT 2011 STMicroelectronics *****END OF FILE****/ 126 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Core/inc/usbh_ioreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_ioreq.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbh_ioreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_IOREQ_H 24 | #define __USBH_IOREQ_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | #include "usbh_core.h" 29 | #include "usbh_def.h" 30 | 31 | /** @addtogroup USBH_LIB 32 | * @{ 33 | */ 34 | 35 | /** @addtogroup USBH_LIB_CORE 36 | * @{ 37 | */ 38 | 39 | /** @defgroup USBH_IOREQ 40 | * @brief This file is the header file for usbh_ioreq.c 41 | * @{ 42 | */ 43 | 44 | 45 | /** @defgroup USBH_IOREQ_Exported_Defines 46 | * @{ 47 | */ 48 | #define USBH_SETUP_PKT_SIZE 8 49 | #define USBH_EP0_EP_NUM 0 50 | #define USBH_MAX_PACKET_SIZE 0x40 51 | /** 52 | * @} 53 | */ 54 | 55 | 56 | /** @defgroup USBH_IOREQ_Exported_Types 57 | * @{ 58 | */ 59 | /** 60 | * @} 61 | */ 62 | 63 | 64 | /** @defgroup USBH_IOREQ_Exported_Macros 65 | * @{ 66 | */ 67 | /** 68 | * @} 69 | */ 70 | 71 | /** @defgroup USBH_IOREQ_Exported_Variables 72 | * @{ 73 | */ 74 | /** 75 | * @} 76 | */ 77 | 78 | /** @defgroup USBH_IOREQ_Exported_FunctionsPrototype 79 | * @{ 80 | */ 81 | USBH_Status USBH_CtlSendSetup ( USB_OTG_CORE_HANDLE *pdev, 82 | uint8_t *buff, 83 | uint8_t hc_num); 84 | 85 | USBH_Status USBH_CtlSendData ( USB_OTG_CORE_HANDLE *pdev, 86 | uint8_t *buff, 87 | uint16_t length, 88 | uint8_t hc_num); 89 | 90 | USBH_Status USBH_CtlReceiveData( USB_OTG_CORE_HANDLE *pdev, 91 | uint8_t *buff, 92 | uint16_t length, 93 | uint8_t hc_num); 94 | 95 | USBH_Status USBH_BulkReceiveData( USB_OTG_CORE_HANDLE *pdev, 96 | uint8_t *buff, 97 | uint16_t length, 98 | uint8_t hc_num); 99 | 100 | USBH_Status USBH_BulkSendData ( USB_OTG_CORE_HANDLE *pdev, 101 | uint8_t *buff, 102 | uint16_t length, 103 | uint8_t hc_num); 104 | 105 | USBH_Status USBH_InterruptReceiveData( USB_OTG_CORE_HANDLE *pdev, 106 | uint8_t *buff, 107 | uint8_t length, 108 | uint8_t hc_num); 109 | 110 | USBH_Status USBH_InterruptSendData( USB_OTG_CORE_HANDLE *pdev, 111 | uint8_t *buff, 112 | uint8_t length, 113 | uint8_t hc_num); 114 | 115 | USBH_Status USBH_CtlReq (USB_OTG_CORE_HANDLE *pdev, 116 | USBH_HOST *phost, 117 | uint8_t *buff, 118 | uint16_t length); 119 | 120 | USBH_Status USBH_IsocReceiveData( USB_OTG_CORE_HANDLE *pdev, 121 | uint8_t *buff, 122 | uint32_t length, 123 | uint8_t hc_num); 124 | 125 | 126 | USBH_Status USBH_IsocSendData( USB_OTG_CORE_HANDLE *pdev, 127 | uint8_t *buff, 128 | uint32_t length, 129 | uint8_t hc_num); 130 | /** 131 | * @} 132 | */ 133 | 134 | #endif /* __USBH_IOREQ_H */ 135 | 136 | /** 137 | * @} 138 | */ 139 | 140 | /** 141 | * @} 142 | */ 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 149 | 150 | 151 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_OTG_Driver/inc/usb_dcd.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usb_dcd.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Peripheral Driver Header file 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive inclusion -------------------------------------*/ 23 | #ifndef __DCD_H__ 24 | #define __DCD_H__ 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_core.h" 28 | 29 | 30 | /** @addtogroup USB_OTG_DRIVER 31 | * @{ 32 | */ 33 | 34 | /** @defgroup USB_DCD 35 | * @brief This file is the 36 | * @{ 37 | */ 38 | 39 | 40 | /** @defgroup USB_DCD_Exported_Defines 41 | * @{ 42 | */ 43 | #define USB_OTG_EP_CONTROL 0 44 | #define USB_OTG_EP_ISOC 1 45 | #define USB_OTG_EP_BULK 2 46 | #define USB_OTG_EP_INT 3 47 | #define USB_OTG_EP_MASK 3 48 | 49 | /* Device Status */ 50 | #define USB_OTG_DEFAULT 1 51 | #define USB_OTG_ADDRESSED 2 52 | #define USB_OTG_CONFIGURED 3 53 | #define USB_OTG_SUSPENDED 4 54 | 55 | /** 56 | * @} 57 | */ 58 | 59 | 60 | /** @defgroup USB_DCD_Exported_Types 61 | * @{ 62 | */ 63 | /******************************************************************************** 64 | Data structure type 65 | ********************************************************************************/ 66 | typedef struct 67 | { 68 | uint8_t bLength; 69 | uint8_t bDescriptorType; 70 | uint8_t bEndpointAddress; 71 | uint8_t bmAttributes; 72 | uint16_t wMaxPacketSize; 73 | uint8_t bInterval; 74 | } 75 | EP_DESCRIPTOR , *PEP_DESCRIPTOR; 76 | 77 | /** 78 | * @} 79 | */ 80 | 81 | 82 | /** @defgroup USB_DCD_Exported_Macros 83 | * @{ 84 | */ 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USB_DCD_Exported_Variables 90 | * @{ 91 | */ 92 | /** 93 | * @} 94 | */ 95 | 96 | /** @defgroup USB_DCD_Exported_FunctionsPrototype 97 | * @{ 98 | */ 99 | /******************************************************************************** 100 | EXPORTED FUNCTION FROM THE USB-OTG LAYER 101 | ********************************************************************************/ 102 | void DCD_Init(USB_OTG_CORE_HANDLE *pdev , 103 | USB_OTG_CORE_ID_TypeDef coreID); 104 | 105 | void DCD_DevConnect (USB_OTG_CORE_HANDLE *pdev); 106 | void DCD_DevDisconnect (USB_OTG_CORE_HANDLE *pdev); 107 | void DCD_EP_SetAddress (USB_OTG_CORE_HANDLE *pdev, 108 | uint8_t address); 109 | uint32_t DCD_EP_Open(USB_OTG_CORE_HANDLE *pdev , 110 | uint8_t ep_addr, 111 | uint16_t ep_mps, 112 | uint8_t ep_type); 113 | 114 | uint32_t DCD_EP_Close (USB_OTG_CORE_HANDLE *pdev, 115 | uint8_t ep_addr); 116 | 117 | 118 | uint32_t DCD_EP_PrepareRx ( USB_OTG_CORE_HANDLE *pdev, 119 | uint8_t ep_addr, 120 | uint8_t *pbuf, 121 | uint16_t buf_len); 122 | 123 | uint32_t DCD_EP_Tx (USB_OTG_CORE_HANDLE *pdev, 124 | uint8_t ep_addr, 125 | uint8_t *pbuf, 126 | uint32_t buf_len); 127 | uint32_t DCD_EP_Stall (USB_OTG_CORE_HANDLE *pdev, 128 | uint8_t epnum); 129 | uint32_t DCD_EP_ClrStall (USB_OTG_CORE_HANDLE *pdev, 130 | uint8_t epnum); 131 | uint32_t DCD_EP_Flush (USB_OTG_CORE_HANDLE *pdev, 132 | uint8_t epnum); 133 | uint32_t DCD_Handle_ISR(USB_OTG_CORE_HANDLE *pdev); 134 | 135 | uint32_t DCD_GetEPStatus(USB_OTG_CORE_HANDLE *pdev , 136 | uint8_t epnum); 137 | 138 | void DCD_SetEPStatus (USB_OTG_CORE_HANDLE *pdev , 139 | uint8_t epnum , 140 | uint32_t Status); 141 | 142 | /** 143 | * @} 144 | */ 145 | 146 | 147 | #endif /* __DCD_H__ */ 148 | 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 158 | 159 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Core/inc/usbh_stdreq.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_stdreq.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief Header file for usbh_stdreq.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_STDREQ_H 24 | #define __USBH_STDREQ_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usb_conf.h" 28 | #include "usb_hcd.h" 29 | #include "usbh_core.h" 30 | #include "usbh_def.h" 31 | 32 | /** @addtogroup USBH_LIB 33 | * @{ 34 | */ 35 | 36 | /** @addtogroup USBH_LIB_CORE 37 | * @{ 38 | */ 39 | 40 | /** @defgroup USBH_STDREQ 41 | * @brief This file is the 42 | * @{ 43 | */ 44 | 45 | 46 | /** @defgroup USBH_STDREQ_Exported_Defines 47 | * @{ 48 | */ 49 | /*Standard Feature Selector for clear feature command*/ 50 | #define FEATURE_SELECTOR_ENDPOINT 0X00 51 | #define FEATURE_SELECTOR_DEVICE 0X01 52 | 53 | 54 | #define INTERFACE_DESC_TYPE 0x04 55 | #define ENDPOINT_DESC_TYPE 0x05 56 | #define INTERFACE_DESC_SIZE 0x09 57 | 58 | 59 | #define USBH_HID_CLASS 0x03 60 | 61 | /** 62 | * @} 63 | */ 64 | 65 | 66 | /** @defgroup USBH_STDREQ_Exported_Types 67 | * @{ 68 | */ 69 | /** 70 | * @} 71 | */ 72 | 73 | 74 | /** @defgroup USBH_STDREQ_Exported_Macros 75 | * @{ 76 | */ 77 | /** 78 | * @} 79 | */ 80 | 81 | /** @defgroup USBH_STDREQ_Exported_Variables 82 | * @{ 83 | */ 84 | extern uint8_t USBH_CfgDesc[512]; 85 | /** 86 | * @} 87 | */ 88 | 89 | /** @defgroup USBH_STDREQ_Exported_FunctionsPrototype 90 | * @{ 91 | */ 92 | USBH_Status USBH_GetDescriptor(USB_OTG_CORE_HANDLE *pdev, 93 | USBH_HOST *phost, 94 | uint8_t req_type, 95 | uint16_t value_idx, 96 | uint8_t* buff, 97 | uint16_t length ); 98 | 99 | USBH_Status USBH_Get_DevDesc(USB_OTG_CORE_HANDLE *pdev, 100 | USBH_HOST *phost, 101 | uint8_t length); 102 | 103 | USBH_Status USBH_Get_StringDesc(USB_OTG_CORE_HANDLE *pdev, 104 | USBH_HOST *phost, 105 | uint8_t string_index, 106 | uint8_t *buff, 107 | uint16_t length); 108 | 109 | USBH_Status USBH_SetCfg(USB_OTG_CORE_HANDLE *pdev, 110 | USBH_HOST *phost, 111 | uint16_t configuration_value); 112 | 113 | USBH_Status USBH_Get_CfgDesc(USB_OTG_CORE_HANDLE *pdev, 114 | USBH_HOST *phost, 115 | uint16_t length); 116 | 117 | USBH_Status USBH_SetAddress(USB_OTG_CORE_HANDLE *pdev, 118 | USBH_HOST *phost, 119 | uint8_t DeviceAddress); 120 | 121 | USBH_Status USBH_ClrFeature(USB_OTG_CORE_HANDLE *pdev, 122 | USBH_HOST *phost, 123 | uint8_t ep_num, uint8_t hc_num); 124 | 125 | USBH_Status USBH_SetInterface(USB_OTG_CORE_HANDLE *pdev, 126 | USBH_HOST *phost, 127 | uint8_t ep_num, uint8_t altSetting); 128 | 129 | USBH_Status USBH_Issue_ClrFeature(USB_OTG_CORE_HANDLE *pdev, 130 | USBH_HOST *phost, 131 | uint8_t ep_num); 132 | 133 | USBH_DescHeader_t *USBH_GetNextDesc (uint8_t *pbuf, 134 | uint16_t *ptr); 135 | 136 | USBH_Status USBH_SetDeviceFeature(USB_OTG_CORE_HANDLE *pdev, 137 | USBH_HOST *phost, 138 | uint8_t FeatureSelector, uint16_t wIndex); 139 | 140 | USBH_Status USBH_ClearDeviceFeature(USB_OTG_CORE_HANDLE *pdev, 141 | USBH_HOST *phost, 142 | uint8_t FeatureSelector, uint16_t wIndex); 143 | 144 | /** 145 | * @} 146 | */ 147 | 148 | #endif /* __USBH_STDREQ_H */ 149 | 150 | /** 151 | * @} 152 | */ 153 | 154 | /** 155 | * @} 156 | */ 157 | 158 | /** 159 | * @} 160 | */ 161 | 162 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 163 | 164 | 165 | -------------------------------------------------------------------------------- /Component/USB_F4/STM32_USB_HOST_Library/Class/HID/inc/usbh_hid_core.h: -------------------------------------------------------------------------------- 1 | /** 2 | ****************************************************************************** 3 | * @file usbh_hid_core.h 4 | * @author MCD Application Team 5 | * @version V2.2.1 6 | * @date 17-March-2018 7 | * @brief This file contains all the prototypes for the usbh_hid_core.c 8 | ****************************************************************************** 9 | * @attention 10 | * 11 | *

© Copyright (c) 2015 STMicroelectronics. 12 | * All rights reserved.

13 | * 14 | * This software component is licensed by ST under Ultimate Liberty license 15 | * SLA0044, the "License"; You may not use this file except in compliance with 16 | * the License. You may obtain a copy of the License at: 17 | * 18 | * 19 | ****************************************************************************** 20 | */ 21 | 22 | /* Define to prevent recursive ----------------------------------------------*/ 23 | #ifndef __USBH_HID_CORE_H 24 | #define __USBH_HID_CORE_H 25 | 26 | /* Includes ------------------------------------------------------------------*/ 27 | #include "usbh_core.h" 28 | #include "usbh_stdreq.h" 29 | #include "usb_bsp.h" 30 | #include "usbh_ioreq.h" 31 | #include "usbh_hcs.h" 32 | 33 | /** @addtogroup USBH_LIB 34 | * @{ 35 | */ 36 | 37 | /** @addtogroup USBH_CLASS 38 | * @{ 39 | */ 40 | 41 | /** @addtogroup USBH_HID_CLASS 42 | * @{ 43 | */ 44 | 45 | /** @defgroup USBH_HID_CORE 46 | * @brief This file is the Header file for USBH_HID_CORE.c 47 | * @{ 48 | */ 49 | 50 | 51 | /** @defgroup USBH_HID_CORE_Exported_Types 52 | * @{ 53 | */ 54 | 55 | #define HID_MIN_POLL 10 56 | 57 | /* States for HID State Machine */ 58 | typedef enum 59 | { 60 | HID_IDLE= 0, 61 | HID_SEND_DATA, 62 | HID_BUSY, 63 | HID_GET_DATA, 64 | HID_SYNC, 65 | HID_POLL, 66 | HID_ERROR, 67 | } 68 | HID_State; 69 | 70 | typedef enum 71 | { 72 | HID_REQ_IDLE = 0, 73 | HID_REQ_GET_REPORT_DESC, 74 | HID_REQ_GET_HID_DESC, 75 | HID_REQ_SET_IDLE, 76 | HID_REQ_SET_PROTOCOL, 77 | HID_REQ_SET_REPORT, 78 | 79 | } 80 | HID_CtlState; 81 | 82 | typedef struct HID_cb 83 | { 84 | void (*Init) (void); 85 | void (*Decode) (uint8_t *data); 86 | 87 | } HID_cb_TypeDef; 88 | 89 | typedef struct _HID_Report 90 | { 91 | uint8_t ReportID; 92 | uint8_t ReportType; 93 | uint16_t UsagePage; 94 | uint32_t Usage[2]; 95 | uint32_t NbrUsage; 96 | uint32_t UsageMin; 97 | uint32_t UsageMax; 98 | int32_t LogMin; 99 | int32_t LogMax; 100 | int32_t PhyMin; 101 | int32_t PhyMax; 102 | int32_t UnitExp; 103 | uint32_t Unit; 104 | uint32_t ReportSize; 105 | uint32_t ReportCnt; 106 | uint32_t Flag; 107 | uint32_t PhyUsage; 108 | uint32_t AppUsage; 109 | uint32_t LogUsage; 110 | } 111 | HID_Report_TypeDef; 112 | 113 | /* Structure for HID process */ 114 | typedef struct _HID_Process 115 | { 116 | uint8_t buff[64]; 117 | uint8_t hc_num_in; 118 | uint8_t hc_num_out; 119 | HID_State state; 120 | uint8_t HIDIntOutEp; 121 | uint8_t HIDIntInEp; 122 | HID_CtlState ctl_state; 123 | uint16_t length; 124 | uint8_t ep_addr; 125 | uint16_t poll; 126 | __IO uint16_t timer; 127 | HID_cb_TypeDef *cb; 128 | } 129 | HID_Machine_TypeDef; 130 | 131 | /** 132 | * @} 133 | */ 134 | 135 | /** @defgroup USBH_HID_CORE_Exported_Defines 136 | * @{ 137 | */ 138 | 139 | #define USB_HID_REQ_GET_REPORT 0x01 140 | #define USB_HID_GET_IDLE 0x02 141 | #define USB_HID_GET_PROTOCOL 0x03 142 | #define USB_HID_SET_REPORT 0x09 143 | #define USB_HID_SET_IDLE 0x0A 144 | #define USB_HID_SET_PROTOCOL 0x0B 145 | /** 146 | * @} 147 | */ 148 | 149 | /** @defgroup USBH_HID_CORE_Exported_Macros 150 | * @{ 151 | */ 152 | /** 153 | * @} 154 | */ 155 | 156 | /** @defgroup USBH_HID_CORE_Exported_Variables 157 | * @{ 158 | */ 159 | extern USBH_Class_cb_TypeDef HID_cb; 160 | /** 161 | * @} 162 | */ 163 | 164 | /** @defgroup USBH_HID_CORE_Exported_FunctionsPrototype 165 | * @{ 166 | */ 167 | 168 | USBH_Status USBH_Set_Report (USB_OTG_CORE_HANDLE *pdev, 169 | USBH_HOST *phost, 170 | uint8_t reportType, 171 | uint8_t reportId, 172 | uint8_t reportLen, 173 | uint8_t* reportBuff); 174 | /** 175 | * @} 176 | */ 177 | 178 | 179 | #endif /* __USBH_HID_CORE_H */ 180 | 181 | /** 182 | * @} 183 | */ 184 | 185 | /** 186 | * @} 187 | */ 188 | 189 | /** 190 | * @} 191 | */ 192 | 193 | /** 194 | * @} 195 | */ 196 | /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/ 197 | 198 | --------------------------------------------------------------------------------