MG32F10x Standard Peripherals Firmware Library

函数
usbd_hw.c 文件参考
`#include "usbd_hw.h"`
`#include "usb_def.h"`

## 函数
void | USBD_HW_ReadEP (uint8_t ep_addr, uint8_t *pbuf, uint16_t size)
| Read data from the specified endpoint. 更多...
void | USBD_HW_WriteEP (uint8_t ep_addr, const uint8_t *pdata, uint16_t len)
| Write data to the specified endpoint. 更多...
void | USBD_HW_Transmit (uint8_t ep_addr, const uint8_t *pdata, uint16_t len)
| Transmits data over an IN endpoint. 更多...
uint16_t | USBD_HW_GetRxDataCount (uint8_t ep_addr)
| Get the last received packet size of an OUT endpoint. 更多...
void | USBD_HW_ReadyToReceive (uint8_t ep_addr)
| Ready to receive from an OUT endpoint. 更多...
void | USBD_HW_SetStallEP (uint8_t ep_addr)
| Set Stall condition of a non-control endpoint. 更多...
void | USBD_HW_ClrStallEP (uint8_t ep_addr)
| Clear Stall condition of a non-control endpoint. 更多...
uint8_t | USBD_HW_IsStalled (uint8_t ep_addr)
| Get stall status of non-control endpoint. 更多...

## 详细描述

作者
  megawin Application Team

注意

Copyright (c) 2020 - 2023 megawin Technology (Shenzhen) Corp., Ltd All rights reserved.

THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME. AS A RESULT, MEGAWIN TECHNOLOGY SHALL NOT BE HELD LIABLE FOR ANY DIRECT, INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.

## 函数说明

## ◆ USBD_HW_ClrStallEP()

void USBD_HW_ClrStallEP | ( | uint8_t | ep_addr | ) |

Clear Stall condition of a non-control endpoint.

参数

  ep_addr | endpoint address.

返回
  None

## ◆ USBD_HW_GetRxDataCount()

uint16_t USBD_HW_GetRxDataCount | ( | uint8_t | ep_addr | ) |

Get the last received packet size of an OUT endpoint.

参数

  ep_addr | endpoint address (eg. 0x01).

返回
  The last received packet size of an OUT endpoint.

## ◆ USBD_HW_IsStalled()

uint8_t USBD_HW_IsStalled | ( | uint8_t | ep_addr | ) |

Get stall status of non-control endpoint.

参数

  ep_addr | endpoint address.

返回
  stall status (1: stall, 0: not stall).

## ◆ USBD_HW_ReadEP()

void USBD_HW_ReadEP | ( | uint8_t | ep_addr,
|  | uint8_t * | pbuf,
|  | uint16_t | size
| ) |  |

Read data from the specified endpoint.

参数

  ep_addr | specifies which endpoint read from. This value must be less than or equal to 3.
  pbuf | pointer to data buffer.
  size | length of data to be read.

返回
  None

## ◆ USBD_HW_ReadyToReceive()

void USBD_HW_ReadyToReceive | ( | uint8_t | ep_addr | ) |

Ready to receive from an OUT endpoint.

参数

  ep_addr | endpoint address (eg. 0x01).

返回
  None

## ◆ USBD_HW_SetStallEP()

void USBD_HW_SetStallEP | ( | uint8_t | ep_addr | ) |

Set Stall condition of a non-control endpoint.

参数

  ep_addr | endpoint address.

返回
  None

## ◆ USBD_HW_Transmit()

void USBD_HW_Transmit | ( | uint8_t | ep_addr,
|  | const uint8_t * | pdata,
|  | uint16_t | len
| ) |  |

Transmits data over an IN endpoint.

参数

  ep_addr | endpoint address (eg. 0x81).
  pdata | pointer to the buffer containing the data to be transmitted.
  len | length of data to be transmitted.

返回
  None

## ◆ USBD_HW_WriteEP()

void USBD_HW_WriteEP | ( | uint8_t | ep_addr,
|  | const uint8_t * | pdata,
|  | uint16_t | len
| ) |  |

Write data to the specified endpoint.

参数

  ep_addr | specifies which endpoint to write. This value must be less than or equal to 3.
  pdata | pointer to the buffer containing the data to be written.
  len | length of data to be written.

返回
  None