Mainly analyze some other files:
usb_core.c,
usb_init.c,
usb_int.c,
usb_mem.c,
usb_reg.c
usb_sil.c
1,
usb_core.c -- As the name suggests, this is the core file of USB. This file mainly contains some functional functions of USB during enumeration, such as various standard request functions for control transmission establishment phase, data phase, status phase, and processing functions for each phase.
uint8_t Setup0_Process(void); uint8_t Post0_Process(void); uint8_t Out0_Process(void); uint8_t In0_Process(void); RESULT Standard_SetEndPointFeature(void); RESULT Standard_SetDeviceFeature(void); uint8_t*Standard_GetConfiguration(uint16_t Length); Standard_SetConfiguration(void); uint8_t *Standard_GetInterface(uint16_t Length); RESULT Standard_SetInterface(void); uint8_t *Standard_GetDescriptorData(uint16_t Length, PONE_DESCRIPTOR pDesc); uint8_t *Standard_GetStatus(uint16_t Length); RESULT Standard_ClearFeature(void); void SetDeviceAddress (uint8_t); void NOP_Process(void);
2,
usb_init.c - file. This file is very simple, with only one function: void USB_Init(void). This function is also very simple, just registering the basic information of the USB device:
/******************************************************************************* * Function Name : USB_Init * Description : USB system initialization * Input : None. * Output : None. * Return : None. *******************************************************************************/ void USB_Init(void) { pInformation = &Device_Info; //Register device information structure pInformation->ControlState = 2; //Control state is IN_DATA pProperty = &Device_Property; //Register some common function structures of the device pUser_Standard_Requests = &User_Standard_Requests; /* Initialize devices one by one */ pProperty->Init(); //Register initialization function }
As for the writing of pProperty->Init(), it executes the function pointed to by the Init function pointer of the pProperty structure. We have registered the initialization function CustomHID_init() in DEVICE_PROP Device_Property of usb_prop.c.
3.
usb_int.c - file, this file defines two interrupt service routines: low priority endpoint correct transmission interrupt service routine void CTR_LP (void) and high priority endpoint correct transmission interrupt service routine void CTR_HP (void). Our project only uses the void CTR_LP (void) function. CTR_LP will be called in the interrupt service routine USB_Istr of the ISTR interrupt event in the usb.istr.c file if the data or request is correctly transmitted.
4.
usb_mem.c - There are two main memory data movement functions: one is to copy data from the PMA buffer to the user-specified memory space PMAToUserBufferCopy(). Obviously, this function will only be used after the endpoint receives data; the other is to copy data from user space to the PMA buffer. It will be called only when the endpoint wants to send data.
5.
usb_reg.c - file, which is the code related to the USB related registers of stm32. To read this code, you need to read the stm32 registers. This function defines how to set and read the value of each register or the value of a certain bit. See the code for details.
6.
usb_sil.c - file. The endpoint specific data transmission and reception functions are defined here. This file is also very simple, with only three functions: USB_SIL_Init() initializes the USB device IP and endpoints; USB_SIL_Write() writes data to the selected endpoint; USB_SIL_Read() reads data from the selected endpoint
Previous article:Analysis and use of STM32 official library files
Next article:STM32F0 creates a new project in IAR
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Download from the Internet--ARM Getting Started Notes
- Learn ARM development(22)
- Learn ARM development(21)
- Learn ARM development(20)
- Learn ARM development(19)
- Learn ARM development(14)
- Learn ARM development(15)
- Analysis of the application of several common contact parts in high-voltage connectors of new energy vehicles
- How to manage IAR network licenses?
- The list of national competitions has been released. Have you bought all the equipment?
- GD32L233C-START Evaluation——06.LPUART+DMA+MCU Sleep Wake-up——Comprehensive Test 1
- PCB engineers all know the design skills, you will lose a lot if you don’t read it!
- Understanding of some parameters in DCDC chip?
- [Zero-knowledge ESP8266 tutorial] Quick Start 14-Three IOs control 8 LED lights
- LTE Cat 1 STM32 4G EC200S
- Single-ended to balanced conversion, the actual situation is so different from the simulation, why?
- [NXP Rapid IoT Review] + Preliminary Study on Power Consumption of Some Devices
- Embedded Linux Learning Route Planning