Prusa MINI Firmware overview
|
: This file implements the board support package for the USB device library
More...
#include "stm32f4xx.h"
#include "stm32f4xx_hal.h"
#include "usbd_def.h"
#include "usbd_core.h"
|
void | Error_Handler (void) |
| This function is executed in case of error occurrence. More...
|
|
void | SystemClock_Config (void) |
| System Clock Configuration. More...
|
|
void | HAL_PCD_MspInit (PCD_HandleTypeDef *pcdHandle) |
|
void | HAL_PCD_MspDeInit (PCD_HandleTypeDef *pcdHandle) |
|
void | HAL_PCD_SetupStageCallback (PCD_HandleTypeDef *hpcd) |
| Setup stage callback. More...
|
|
void | HAL_PCD_DataOutStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum) |
| Data Out stage callback. More...
|
|
void | HAL_PCD_DataInStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum) |
| Data In stage callback. More...
|
|
void | HAL_PCD_SOFCallback (PCD_HandleTypeDef *hpcd) |
| SOF callback. More...
|
|
void | HAL_PCD_ResetCallback (PCD_HandleTypeDef *hpcd) |
| Reset callback. More...
|
|
void | HAL_PCD_SuspendCallback (PCD_HandleTypeDef *hpcd) |
| Suspend callback. When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) More...
|
|
void | HAL_PCD_ResumeCallback (PCD_HandleTypeDef *hpcd) |
| Resume callback. When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it) More...
|
|
void | HAL_PCD_ISOOUTIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum) |
| ISOOUTIncomplete callback. More...
|
|
void | HAL_PCD_ISOINIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum) |
| ISOINIncomplete callback. More...
|
|
void | HAL_PCD_ConnectCallback (PCD_HandleTypeDef *hpcd) |
| Connect callback. More...
|
|
void | HAL_PCD_DisconnectCallback (PCD_HandleTypeDef *hpcd) |
| Disconnect callback. More...
|
|
USBD_StatusTypeDef | USBD_LL_Init (USBD_HandleTypeDef *pdev) |
| Initializes the low level portion of the device driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_DeInit (USBD_HandleTypeDef *pdev) |
| De-Initializes the low level portion of the device driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_Start (USBD_HandleTypeDef *pdev) |
| Starts the low level portion of the device driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_Stop (USBD_HandleTypeDef *pdev) |
| Stops the low level portion of the device driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_OpenEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t ep_type, uint16_t ep_mps) |
| Opens an endpoint of the low level driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Closes an endpoint of the low level driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Flushes an endpoint of the Low Level Driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Sets a Stall condition on an endpoint of the Low Level Driver. More...
|
|
USBD_StatusTypeDef | USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Clears a Stall condition on an endpoint of the Low Level Driver. More...
|
|
uint8_t | USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Returns Stall condition. More...
|
|
USBD_StatusTypeDef | USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr) |
| Assigns a USB address to the device. More...
|
|
USBD_StatusTypeDef | USBD_LL_Transmit (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) |
| Transmits data over an endpoint. More...
|
|
USBD_StatusTypeDef | USBD_LL_PrepareReceive (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint16_t size) |
| Prepares an endpoint for reception. More...
|
|
uint32_t | USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr) |
| Returns the last transfered packet size. More...
|
|
void | USBD_LL_Delay (uint32_t Delay) |
| Delays routine for the USB Device Library. More...
|
|
: This file implements the board support package for the USB device library
- Version
- : v1.0_Cube This notice applies to any and all portions of this file that are not between comment pairs USER CODE BEGIN and USER CODE END. Other portions of this file, whether inserted by the user or by software development tools are owned by their respective copyright owners.
Copyright (c) 2019 STMicroelectronics International N.V. All rights reserved.
Redistribution and use in source and binary forms, with or without modification, are permitted, provided that the following conditions are met:
- Redistribution of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
- Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
- Neither the name of STMicroelectronics nor the names of other contributors to this software may be used to endorse or promote products derived from this software without specific written permission.
- This software, including modifications and/or derivative works of this software, must execute solely and exclusively on microcontroller or microprocessor devices manufactured by or for STMicroelectronics.
- Redistribution and use of this software other than as permitted under this license is void and will automatically terminate your rights under this license.
THIS SOFTWARE IS PROVIDED BY STMICROELECTRONICS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS, IMPLIED OR STATUTORY WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT OF THIRD PARTY INTELLECTUAL PROPERTY RIGHTS ARE DISCLAIMED TO THE FULLEST EXTENT PERMITTED BY LAW. IN NO EVENT SHALL STMICROELECTRONICS OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
◆ Error_Handler()
This function is executed in case of error occurrence.
- Return values
-
◆ SystemClock_Config()
System Clock Configuration.
- Parameters
-
- Return values
-
Configure the main internal regulator output voltage
Initializes the CPU, AHB and APB busses clocks
Initializes the CPU, AHB and APB busses clocks
Configure the Systick interrupt time
Configure the Systick
Configure the main internal regulator output voltage
Initializes the CPU, AHB and APB busses clocks
Initializes the CPU, AHB and APB busses clocks
Configure the Systick interrupt time
Configure the Systick
Configure the main internal regulator output voltage
Initializes the CPU, AHB and APB busses clocks
Initializes the CPU, AHB and APB busses clocks
225 RCC_OscInitStruct.
PLL.
PLLM = 8;
226 RCC_OscInitStruct.
PLL.
PLLN = 336;
228 RCC_OscInitStruct.
PLL.
PLLQ = 7;
230 _Error_Handler(__FILE__, __LINE__);
243 _Error_Handler(__FILE__, __LINE__);
◆ HAL_PCD_MspInit()
void HAL_PCD_MspInit |
( |
PCD_HandleTypeDef * |
pcdHandle | ) |
|
USB_OTG_FS GPIO Configuration PA11 ---—> USB_OTG_FS_DM PA12 ---—> USB_OTG_FS_DP
97 if (pcdHandle->Instance == USB_OTG_FS) {
110 GPIO_InitStruct.
Alternate = GPIO_AF10_OTG_FS;
114 __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
◆ HAL_PCD_MspDeInit()
void HAL_PCD_MspDeInit |
( |
PCD_HandleTypeDef * |
pcdHandle | ) |
|
USB_OTG_FS GPIO Configuration PA11 ---—> USB_OTG_FS_DM PA12 ---—> USB_OTG_FS_DP
126 if (pcdHandle->Instance == USB_OTG_FS) {
131 __HAL_RCC_USB_OTG_FS_CLK_DISABLE();
◆ HAL_PCD_SetupStageCallback()
void HAL_PCD_SetupStageCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Setup stage callback.
- Parameters
-
- Return values
-
◆ HAL_PCD_DataOutStageCallback()
void HAL_PCD_DataOutStageCallback |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
epnum |
|
) |
| |
Data Out stage callback.
- Parameters
-
hpcd | PCD handle |
epnum | Endpoint number |
- Return values
-
◆ HAL_PCD_DataInStageCallback()
void HAL_PCD_DataInStageCallback |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
epnum |
|
) |
| |
Data In stage callback.
- Parameters
-
hpcd | PCD handle |
epnum | Endpoint number |
- Return values
-
◆ HAL_PCD_SOFCallback()
void HAL_PCD_SOFCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
SOF callback.
- Parameters
-
- Return values
-
◆ HAL_PCD_ResetCallback()
void HAL_PCD_ResetCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Reset callback.
- Parameters
-
- Return values
-
195 switch (hpcd->Init.speed) {
◆ HAL_PCD_SuspendCallback()
void HAL_PCD_SuspendCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Suspend callback. When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
- Parameters
-
- Return values
-
222 __HAL_PCD_GATE_PHYCLOCK(hpcd);
225 if (hpcd->Init.low_power_enable) {
227 SCB->SCR |= (uint32_t)((uint32_t)(SCB_SCR_SLEEPDEEP_Msk | SCB_SCR_SLEEPONEXIT_Msk));
◆ HAL_PCD_ResumeCallback()
void HAL_PCD_ResumeCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Resume callback. When Low power mode is enabled the debug cannot be used (IAR, Keil doesn't support it)
- Parameters
-
- Return values
-
◆ HAL_PCD_ISOOUTIncompleteCallback()
void HAL_PCD_ISOOUTIncompleteCallback |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
epnum |
|
) |
| |
ISOOUTIncomplete callback.
- Parameters
-
hpcd | PCD handle |
epnum | Endpoint number |
- Return values
-
◆ HAL_PCD_ISOINIncompleteCallback()
void HAL_PCD_ISOINIncompleteCallback |
( |
PCD_HandleTypeDef * |
hpcd, |
|
|
uint8_t |
epnum |
|
) |
| |
ISOINIncomplete callback.
- Parameters
-
hpcd | PCD handle |
epnum | Endpoint number |
- Return values
-
◆ HAL_PCD_ConnectCallback()
void HAL_PCD_ConnectCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Connect callback.
- Parameters
-
- Return values
-
◆ HAL_PCD_DisconnectCallback()
void HAL_PCD_DisconnectCallback |
( |
PCD_HandleTypeDef * |
hpcd | ) |
|
Disconnect callback.
- Parameters
-
- Return values
-
◆ hpcd_USB_OTG_FS
PCD_HandleTypeDef hpcd_USB_OTG_FS |
#define RCC_PLLP_DIV2
Definition: stm32f4xx_hal_rcc.h:186
#define GPIO_MODE_AF_PP
Definition: stm32f4xx_hal_gpio.h:138
Definition: usbd_def.h:189
#define USB_FS_N_Pin
Definition: main.h:161
Definition: stm32f4xx_hal_def.h:57
uint32_t HAL_RCC_GetHCLKFreq(void)
#define RCC_HCLK_DIV2
Definition: stm32f4xx_hal_rcc.h:260
uint32_t PLLP
Definition: stm32f4xx_hal_rcc_ex.h:78
RCC System, AHB and APB busses clock configuration structure definition.
Definition: stm32f4xx_hal_rcc.h:93
HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)
uint32_t Mode
Definition: stm32f4xx_hal_gpio.h:68
uint32_t SYSCLKSource
Definition: stm32f4xx_hal_rcc.h:98
void app_error(void)
Definition: appmain.cpp:145
uint32_t Alternate
Definition: stm32f4xx_hal_gpio.h:77
#define RCC_HSE_ON
Definition: stm32f4xx_hal_rcc.h:137
USBD_StatusTypeDef USBD_LL_DataInStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata)
USBD_DataInStage Handle data in stage.
Definition: usbd_core.c:343
#define RCC_CLOCKTYPE_PCLK2
Definition: stm32f4xx_hal_rcc.h:209
uint32_t Pull
Definition: stm32f4xx_hal_gpio.h:71
#define RCC_CLOCKTYPE_PCLK1
Definition: stm32f4xx_hal_rcc.h:208
void HAL_GPIO_DeInit(GPIO_TypeDef *GPIOx, uint32_t GPIO_Pin)
uint32_t PLLQ
Definition: stm32f4xx_hal_rcc_ex.h:81
uint32_t PLLSource
Definition: stm32f4xx_hal_rcc_ex.h:68
uint32_t OscillatorType
Definition: stm32f4xx_hal_rcc.h:69
uint32_t PLLM
Definition: stm32f4xx_hal_rcc_ex.h:71
uint32_t HSEState
Definition: stm32f4xx_hal_rcc.h:72
#define __HAL_PWR_VOLTAGESCALING_CONFIG(__REGULATOR__)
macros configure the main internal regulator output voltage.
Definition: stm32f4xx_hal_pwr_ex.h:153
#define RCC_PLLSOURCE_HSE
Definition: stm32f4xx_hal_rcc.h:198
#define RCC_PLL_ON
Definition: stm32f4xx_hal_rcc.h:178
USBD_StatusTypeDef USBD_LL_Resume(USBD_HandleTypeDef *pdev)
USBD_Resume Handle Resume event.
Definition: usbd_core.c:478
#define RCC_HCLK_DIV4
Definition: stm32f4xx_hal_rcc.h:261
USBD_StatusTypeDef USBD_LL_DataOutStage(USBD_HandleTypeDef *pdev, uint8_t epnum, uint8_t *pdata)
USBD_DataOutStage Handle data OUT stage.
Definition: usbd_core.c:299
Definition: usbd_def.h:225
RCC_PLLInitTypeDef PLL
Definition: stm32f4xx_hal_rcc.h:87
#define RCC_CLOCKTYPE_SYSCLK
Definition: stm32f4xx_hal_rcc.h:206
uint32_t HAL_SYSTICK_Config(uint32_t TicksNumb)
void HAL_GPIO_Init(GPIO_TypeDef *GPIOx, GPIO_InitTypeDef *GPIO_Init)
uint32_t PLLState
Definition: stm32f4xx_hal_rcc_ex.h:65
uint32_t APB1CLKDivider
Definition: stm32f4xx_hal_rcc.h:104
USBD_StatusTypeDef USBD_LL_SOF(USBD_HandleTypeDef *pdev)
USBD_SOF Handle SOF event.
Definition: usbd_core.c:491
void HAL_NVIC_SetPriority(IRQn_Type IRQn, uint32_t PreemptPriority, uint32_t SubPriority)
#define GPIO_NOPULL
Definition: stm32f4xx_hal_gpio.h:170
#define GPIO_SPEED_FREQ_VERY_HIGH
Definition: stm32f4xx_hal_gpio.h:161
USBD_StatusTypeDef USBD_LL_Reset(USBD_HandleTypeDef *pdev)
USBD_LL_Reset Handle Reset event.
Definition: usbd_core.c:415
Definition: usbd_def.h:188
const uint8_t[]
Definition: 404_html.c:3
#define RCC_CLOCKTYPE_HCLK
Definition: stm32f4xx_hal_rcc.h:207
void HAL_NVIC_EnableIRQ(IRQn_Type IRQn)
uint32_t AHBCLKDivider
Definition: stm32f4xx_hal_rcc.h:101
#define RCC_OSCILLATORTYPE_HSE
Definition: stm32f4xx_hal_rcc.h:125
#define RCC_SYSCLK_DIV1
Definition: stm32f4xx_hal_rcc.h:243
#define USB_FS_P_Pin
Definition: main.h:163
USBD_StatusTypeDef USBD_LL_DevDisconnected(USBD_HandleTypeDef *pdev)
USBD_DevDisconnected Handle device disconnection event.
Definition: usbd_core.c:542
uint32_t Pin
Definition: stm32f4xx_hal_gpio.h:65
uint32_t ClockType
Definition: stm32f4xx_hal_rcc.h:95
#define __HAL_RCC_PWR_CLK_ENABLE()
Definition: stm32f4xx_hal_rcc.h:528
uint32_t Speed
Definition: stm32f4xx_hal_gpio.h:74
void HAL_NVIC_DisableIRQ(IRQn_Type IRQn)
#define RCC_SYSCLKSOURCE_PLLCLK
Definition: stm32f4xx_hal_rcc.h:221
USBD_StatusTypeDef USBD_LL_SetSpeed(USBD_HandleTypeDef *pdev, USBD_SpeedTypeDef speed)
USBD_LL_Reset Handle Reset event.
Definition: usbd_core.c:451
#define SYSTICK_CLKSOURCE_HCLK
Definition: stm32f4xx_hal_cortex.h:129
HAL_StatusTypeDef HAL_RCC_ClockConfig(RCC_ClkInitTypeDef *RCC_ClkInitStruct, uint32_t FLatency)
USBD_SpeedTypeDef
Definition: usbd_def.h:186
uint32_t APB2CLKDivider
Definition: stm32f4xx_hal_rcc.h:107
RCC Internal/External Oscillator (HSE, HSI, LSE and LSI) configuration structure definition.
Definition: stm32f4xx_hal_rcc.h:67
USBD_StatusTypeDef USBD_LL_IsoOUTIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_IsoOUTIncomplete Handle iso out incomplete event.
Definition: usbd_core.c:520
void HAL_SYSTICK_CLKSourceConfig(uint32_t CLKSource)
#define PWR_REGULATOR_VOLTAGE_SCALE1
Definition: stm32f4xx_hal_pwr_ex.h:90
uint32_t PLLN
Definition: stm32f4xx_hal_rcc_ex.h:74
USBD_StatusTypeDef USBD_LL_IsoINIncomplete(USBD_HandleTypeDef *pdev, uint8_t epnum)
USBD_IsoINIncomplete Handle iso in incomplete event.
Definition: usbd_core.c:509
USBD_StatusTypeDef USBD_LL_SetupStage(USBD_HandleTypeDef *pdev, uint8_t *psetup)
USBD_SetupStage Handle the setup stage.
Definition: usbd_core.c:263
GPIO Init structure definition.
Definition: stm32f4xx_hal_gpio.h:63
USBD_StatusTypeDef USBD_LL_Suspend(USBD_HandleTypeDef *pdev)
USBD_Suspend Handle Suspend event.
Definition: usbd_core.c:464
USBD_StatusTypeDef USBD_LL_DevConnected(USBD_HandleTypeDef *pdev)
USBD_DevConnected Handle device connection event.
Definition: usbd_core.c:531