STAR
Cal STAR — firmware, DAQ server, and engine design
Loading...
Searching...
No Matches
usbd_conf.c File Reference

: This file implements the board support package for the USB device library More...

#include "stm32h7xx.h"
#include "stm32h7xx_hal.h"
#include "usbd_def.h"
#include "usbd_core.h"
#include "usbd_cdc.h"
#include <stdbool.h>
Include dependency graph for usbd_conf.c:

Go to the source code of this file.

Functions

void Error_Handler (void)
 This function is executed in case of error occurrence.
USBD_StatusTypeDef USBD_Get_USB_Status (HAL_StatusTypeDef hal_status)
 Returns the USB status depending on the HAL status:
void HAL_PCD_MspInit (PCD_HandleTypeDef *pcdHandle)
void HAL_PCD_MspDeInit (PCD_HandleTypeDef *pcdHandle)
void HAL_PCD_SetupStageCallback (PCD_HandleTypeDef *hpcd)
 Setup stage callback.
void HAL_PCD_DataOutStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Data Out stage callback.
void HAL_PCD_DataInStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Data In stage callback.
void HAL_PCD_SOFCallback (PCD_HandleTypeDef *hpcd)
 SOF callback.
void HAL_PCD_ResetCallback (PCD_HandleTypeDef *hpcd)
 Reset callback.
void HAL_PCD_SuspendCallback (PCD_HandleTypeDef *hpcd)
 Suspend callback.
void HAL_PCD_ResumeCallback (PCD_HandleTypeDef *hpcd)
 Resume callback.
void HAL_PCD_ISOOUTIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 ISOOUTIncomplete callback.
void HAL_PCD_ISOINIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 ISOINIncomplete callback.
void HAL_PCD_ConnectCallback (PCD_HandleTypeDef *hpcd)
 Connect callback.
void HAL_PCD_DisconnectCallback (PCD_HandleTypeDef *hpcd)
 Disconnect callback.
USBD_StatusTypeDef USBD_LL_Init (USBD_HandleTypeDef *pdev)
 Initializes the low level portion of the device driver.
USBD_StatusTypeDef USBD_LL_DeInit (USBD_HandleTypeDef *pdev)
 De-Initializes the low level portion of the device driver.
USBD_StatusTypeDef USBD_LL_Start (USBD_HandleTypeDef *pdev)
 Starts the low level portion of the device driver.
USBD_StatusTypeDef USBD_LL_Stop (USBD_HandleTypeDef *pdev)
 Stops the low level portion of the device driver.
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.
USBD_StatusTypeDef USBD_LL_CloseEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Closes an endpoint of the low level driver.
USBD_StatusTypeDef USBD_LL_FlushEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Flushes an endpoint of the Low Level Driver.
USBD_StatusTypeDef USBD_LL_StallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Sets a Stall condition on an endpoint of the Low Level Driver.
USBD_StatusTypeDef USBD_LL_ClearStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Clears a Stall condition on an endpoint of the Low Level Driver.
uint8_t USBD_LL_IsStallEP (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Returns Stall condition.
USBD_StatusTypeDef USBD_LL_SetUSBAddress (USBD_HandleTypeDef *pdev, uint8_t dev_addr)
 Assigns a USB address to the device.
USBD_StatusTypeDef USBD_LL_Transmit (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint32_t size)
 Transmits data over an endpoint.
USBD_StatusTypeDef USBD_LL_PrepareReceive (USBD_HandleTypeDef *pdev, uint8_t ep_addr, uint8_t *pbuf, uint32_t size)
 Prepares an endpoint for reception.
uint32_t USBD_LL_GetRxDataSize (USBD_HandleTypeDef *pdev, uint8_t ep_addr)
 Returns the last transferred packet size.
void * USBD_static_malloc (uint32_t size)
 Static single allocation.
void USBD_static_free (void *p)
 Dummy memory free.
void USBD_LL_Delay (uint32_t Delay)
 Delays routine for the USB device library.

Variables

volatile bool g_usb_terminal_connected
PCD_HandleTypeDef hpcd_USB_OTG_HS

Detailed Description

: This file implements the board support package for the USB device library

Version
: v1.0_Cube
Attention

Copyright (c) 2026 STMicroelectronics. All rights reserved.

This software is licensed under terms that can be found in the LICENSE file in the root directory of this software component. If no LICENSE file comes with this software, it is provided AS-IS.

Definition in file usbd_conf.c.

Function Documentation

◆ Error_Handler()

void Error_Handler ( void )

◆ HAL_PCD_ConnectCallback()

void HAL_PCD_ConnectCallback ( PCD_HandleTypeDef * hpcd)

Connect callback.

Parameters
hpcdPCD handle
Return values
None

Definition at line 294 of file usbd_conf.c.

References USBD_LL_DevConnected().

◆ HAL_PCD_DataInStageCallback()

void HAL_PCD_DataInStageCallback ( PCD_HandleTypeDef * hpcd,
uint8_t epnum )

Data In stage callback.

Parameters
hpcdPCD handle
epnumEndpoint number
Return values
None

Definition at line 161 of file usbd_conf.c.

References USBD_LL_DataInStage().

◆ HAL_PCD_DataOutStageCallback()

void HAL_PCD_DataOutStageCallback ( PCD_HandleTypeDef * hpcd,
uint8_t epnum )

Data Out stage callback.

Parameters
hpcdPCD handle
epnumEndpoint number
Return values
None

Definition at line 146 of file usbd_conf.c.

References USBD_LL_DataOutStage().

◆ HAL_PCD_DisconnectCallback()

void HAL_PCD_DisconnectCallback ( PCD_HandleTypeDef * hpcd)

Disconnect callback.

Parameters
hpcdPCD handle
Return values
None

Definition at line 308 of file usbd_conf.c.

References USBD_LL_DevDisconnected().

◆ HAL_PCD_ISOINIncompleteCallback()

void HAL_PCD_ISOINIncompleteCallback ( PCD_HandleTypeDef * hpcd,
uint8_t epnum )

ISOINIncomplete callback.

Parameters
hpcdPCD handle
epnumEndpoint number
Return values
None

Definition at line 280 of file usbd_conf.c.

References USBD_LL_IsoINIncomplete().

◆ HAL_PCD_ISOOUTIncompleteCallback()

void HAL_PCD_ISOOUTIncompleteCallback ( PCD_HandleTypeDef * hpcd,
uint8_t epnum )

ISOOUTIncomplete callback.

Parameters
hpcdPCD handle
epnumEndpoint number
Return values
None

Definition at line 265 of file usbd_conf.c.

References USBD_LL_IsoOUTIncomplete().

◆ HAL_PCD_MspDeInit()

void HAL_PCD_MspDeInit ( PCD_HandleTypeDef * pcdHandle)

Definition at line 102 of file usbd_conf.c.

References HAL_NVIC_DisableIRQ(), OTG_HS_EP1_IN_IRQn, OTG_HS_IRQn, and USB_OTG_HS.

◆ HAL_PCD_MspInit()

◆ HAL_PCD_ResetCallback()

void HAL_PCD_ResetCallback ( PCD_HandleTypeDef * hpcd)

Reset callback.

Parameters
hpcdPCD handle
Return values
None

Definition at line 189 of file usbd_conf.c.

References Error_Handler(), USBD_LL_Reset(), USBD_LL_SetSpeed(), USBD_SPEED_FULL, and USBD_SPEED_HIGH.

◆ 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
hpcdPCD handle
Return values
None

Definition at line 247 of file usbd_conf.c.

References USBD_LL_Resume().

◆ HAL_PCD_SetupStageCallback()

void HAL_PCD_SetupStageCallback ( PCD_HandleTypeDef * hpcd)

Setup stage callback.

Parameters
hpcdPCD handle
Return values
None

Definition at line 131 of file usbd_conf.c.

References USBD_LL_SetupStage().

◆ HAL_PCD_SOFCallback()

void HAL_PCD_SOFCallback ( PCD_HandleTypeDef * hpcd)

SOF callback.

Parameters
hpcdPCD handle
Return values
None

Definition at line 175 of file usbd_conf.c.

References USBD_LL_SOF().

◆ 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
hpcdPCD handle
Return values
None

Definition at line 222 of file usbd_conf.c.

References SCB, SCB_SCR_SLEEPDEEP_Msk, SCB_SCR_SLEEPONEXIT_Msk, and USBD_LL_Suspend().

◆ USBD_Get_USB_Status()

USBD_StatusTypeDef USBD_Get_USB_Status ( HAL_StatusTypeDef hal_status)

Returns the USB status depending on the HAL status:

Parameters
hal_statusHAL status
Return values
USBstatus

Definition at line 655 of file usbd_conf.c.

References HAL_BUSY, HAL_ERROR, HAL_OK, HAL_TIMEOUT, USBD_BUSY, USBD_FAIL, and USBD_OK.

Referenced by USBD_LL_ClearStallEP(), USBD_LL_CloseEP(), USBD_LL_DeInit(), USBD_LL_FlushEP(), USBD_LL_OpenEP(), USBD_LL_PrepareReceive(), USBD_LL_SetUSBAddress(), USBD_LL_StallEP(), USBD_LL_Start(), USBD_LL_Stop(), and USBD_LL_Transmit().

Variable Documentation

◆ hpcd_USB_OTG_HS

PCD_HandleTypeDef hpcd_USB_OTG_HS

Definition at line 41 of file usbd_conf.c.

Referenced by OTG_HS_EP1_IN_IRQHandler(), OTG_HS_IRQHandler(), and USBD_LL_Init().