STM32F439xx HAL User Manual
Defines | Functions
stm32f4xx_hal_pcd.c File Reference

PCD HAL module driver. This file provides firmware functions to manage the following functionalities of the USB Peripheral Controller: + Initialization and de-initialization functions + IO operation functions + Peripheral Control functions + Peripheral State functions. More...

#include "stm32f4xx_hal.h"

Go to the source code of this file.

Defines

#define PCD_MIN(a, b)   (((a) < (b)) ? (a) : (b))
#define PCD_MAX(a, b)   (((a) > (b)) ? (a) : (b))

Functions

static HAL_StatusTypeDef PCD_WriteEmptyTxFifo (PCD_HandleTypeDef *hpcd, uint32_t epnum)
 Check FIFO for the next packet to be loaded.
HAL_StatusTypeDef HAL_PCD_Init (PCD_HandleTypeDef *hpcd)
 Initializes the PCD according to the specified parameters in the PCD_InitTypeDef and initialize the associated handle.
HAL_StatusTypeDef HAL_PCD_DeInit (PCD_HandleTypeDef *hpcd)
 DeInitializes the PCD peripheral.
__weak void HAL_PCD_MspInit (PCD_HandleTypeDef *hpcd)
 Initializes the PCD MSP.
__weak void HAL_PCD_MspDeInit (PCD_HandleTypeDef *hpcd)
 DeInitializes PCD MSP.
HAL_StatusTypeDef HAL_PCD_Start (PCD_HandleTypeDef *hpcd)
 Start The USB OTG Device.
HAL_StatusTypeDef HAL_PCD_Stop (PCD_HandleTypeDef *hpcd)
 Stop The USB OTG Device.
void HAL_PCD_IRQHandler (PCD_HandleTypeDef *hpcd)
 Handles PCD interrupt request.
__weak void HAL_PCD_DataOutStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Data OUT stage callback.
__weak void HAL_PCD_DataInStageCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Data IN stage callback.
__weak void HAL_PCD_SetupStageCallback (PCD_HandleTypeDef *hpcd)
 Setup stage callback.
__weak void HAL_PCD_SOFCallback (PCD_HandleTypeDef *hpcd)
 USB Start Of Frame callback.
__weak void HAL_PCD_ResetCallback (PCD_HandleTypeDef *hpcd)
 USB Reset callback.
__weak void HAL_PCD_SuspendCallback (PCD_HandleTypeDef *hpcd)
 Suspend event callback.
__weak void HAL_PCD_ResumeCallback (PCD_HandleTypeDef *hpcd)
 Resume event callback.
__weak void HAL_PCD_ISOOUTIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Incomplete ISO OUT callback.
__weak void HAL_PCD_ISOINIncompleteCallback (PCD_HandleTypeDef *hpcd, uint8_t epnum)
 Incomplete ISO IN callback.
__weak void HAL_PCD_ConnectCallback (PCD_HandleTypeDef *hpcd)
 Connection event callback.
__weak void HAL_PCD_DisconnectCallback (PCD_HandleTypeDef *hpcd)
 Disconnection event callback.
HAL_StatusTypeDef HAL_PCD_DevConnect (PCD_HandleTypeDef *hpcd)
 Connect the USB device.
HAL_StatusTypeDef HAL_PCD_DevDisconnect (PCD_HandleTypeDef *hpcd)
 Disconnect the USB device.
HAL_StatusTypeDef HAL_PCD_SetAddress (PCD_HandleTypeDef *hpcd, uint8_t address)
 Set the USB Device address.
HAL_StatusTypeDef HAL_PCD_EP_Open (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type)
 Open and configure an endpoint.
HAL_StatusTypeDef HAL_PCD_EP_Close (PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
 Deactivate an endpoint.
HAL_StatusTypeDef HAL_PCD_EP_Receive (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
 Receive an amount of data.
uint16_t HAL_PCD_EP_GetRxCount (PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
 Get Received Data Size.
HAL_StatusTypeDef HAL_PCD_EP_Transmit (PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
 Send an amount of data.
HAL_StatusTypeDef HAL_PCD_EP_SetStall (PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
 Set a STALL condition over an endpoint.
HAL_StatusTypeDef HAL_PCD_EP_ClrStall (PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
 Clear a STALL condition over in an endpoint.
HAL_StatusTypeDef HAL_PCD_EP_Flush (PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
 Flush an endpoint.
HAL_StatusTypeDef HAL_PCD_ActivateRemoteWakeup (PCD_HandleTypeDef *hpcd)
 Activate remote wakeup signalling.
HAL_StatusTypeDef HAL_PCD_DeActivateRemoteWakeup (PCD_HandleTypeDef *hpcd)
 De-activate remote wakeup signalling.
PCD_StateTypeDef HAL_PCD_GetState (PCD_HandleTypeDef *hpcd)
 Return the PCD handle state.

Detailed Description

PCD HAL module driver. This file provides firmware functions to manage the following functionalities of the USB Peripheral Controller: + Initialization and de-initialization functions + IO operation functions + Peripheral Control functions + Peripheral State functions.

Author:
MCD Application Team
  ==============================================================================
                    ##### How to use this driver #####
  ==============================================================================
    [..]
      The PCD HAL driver can be used as follows:

     (#) Declare a PCD_HandleTypeDef handle structure, for example:
         PCD_HandleTypeDef  hpcd;
        
     (#) Fill parameters of Init structure in HCD handle
  
     (#) Call HAL_PCD_Init() API to initialize the PCD peripheral (Core, Device core, ...) 

     (#) Initialize the PCD low level resources through the HAL_PCD_MspInit() API:
         (##) Enable the PCD/USB Low Level interface clock using 
              (+++) __HAL_RCC_USB_OTG_FS_CLK_ENABLE();
              (+++) __HAL_RCC_USB_OTG_HS_CLK_ENABLE(); (For High Speed Mode)
           
         (##) Initialize the related GPIO clocks
         (##) Configure PCD pin-out
         (##) Configure PCD NVIC interrupt
    
     (#)Associate the Upper USB device stack to the HAL PCD Driver:
         (##) hpcd.pData = pdev;

     (#)Enable PCD transmission and reception:
         (##) HAL_PCD_Start();

  
Attention:

© COPYRIGHT(c) 2017 STMicroelectronics

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: 1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. 2. 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. 3. Neither the name of STMicroelectronics nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER 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.

Definition in file stm32f4xx_hal_pcd.c.