libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
|
#include <libopencm3/cm3/common.h>
#include <libopencm3/stm32/rcc.h>
#include <libopencm3/stm32/tools.h>
#include <libopencm3/stm32/st_usbfs.h>
#include <libopencm3/usb/usbd.h>
#include "../../usb/usb_private.h"
#include "st_usbfs_core.h"
Go to the source code of this file.
Functions | |
void | st_usbfs_set_address (usbd_device *dev, uint8_t addr) |
uint16_t | st_usbfs_set_ep_rx_bufsize (usbd_device *dev, uint8_t ep, uint32_t size) |
Set the receive buffer size for a given USB endpoint. More... | |
void | st_usbfs_ep_setup (usbd_device *dev, uint8_t addr, uint8_t type, uint16_t max_size, void(*callback)(usbd_device *usbd_dev, uint8_t ep)) |
void | st_usbfs_endpoints_reset (usbd_device *dev) |
void | st_usbfs_ep_stall_set (usbd_device *dev, uint8_t addr, uint8_t stall) |
uint8_t | st_usbfs_ep_stall_get (usbd_device *dev, uint8_t addr) |
void | st_usbfs_ep_nak_set (usbd_device *dev, uint8_t addr, uint8_t nak) |
uint16_t | st_usbfs_ep_write_packet (usbd_device *dev, uint8_t addr, const void *buf, uint16_t len) |
uint16_t | st_usbfs_ep_read_packet (usbd_device *dev, uint8_t addr, void *buf, uint16_t len) |
void | st_usbfs_poll (usbd_device *dev) |
Variables | |
uint8_t | st_usbfs_force_nak [8] |
struct _usbd_device | st_usbfs_dev |
void st_usbfs_endpoints_reset | ( | usbd_device * | dev | ) |
Definition at line 124 of file st_usbfs_core.c.
References USB_EP_RX_STAT_DISABLED, USB_EP_TX_STAT_DISABLED, USB_SET_EP_RX_STAT, and USB_SET_EP_TX_STAT.
void st_usbfs_ep_nak_set | ( | usbd_device * | dev, |
uint8_t | addr, | ||
uint8_t | nak | ||
) |
Definition at line 183 of file st_usbfs_core.c.
References st_usbfs_force_nak, USB_EP_RX_STAT_NAK, USB_EP_RX_STAT_VALID, and USB_SET_EP_RX_STAT.
uint16_t st_usbfs_ep_read_packet | ( | usbd_device * | dev, |
uint8_t | addr, | ||
void * | buf, | ||
uint16_t | len | ||
) |
Definition at line 217 of file st_usbfs_core.c.
References st_usbfs_copy_from_pm(), st_usbfs_force_nak, USB_CLR_EP_RX_CTR, USB_EP_REG, USB_EP_RX_STAT, USB_EP_RX_STAT_VALID, USB_GET_EP_RX_BUFF, USB_GET_EP_RX_COUNT, and USB_SET_EP_RX_STAT.
Referenced by st_usbfs_poll().
void st_usbfs_ep_setup | ( | usbd_device * | dev, |
uint8_t | addr, | ||
uint8_t | type, | ||
uint16_t | max_size, | ||
void(*)(usbd_device *usbd_dev, uint8_t ep) | callback | ||
) |
Definition at line 80 of file st_usbfs_core.c.
References st_usbfs_set_ep_rx_bufsize(), USB_CLR_EP_RX_DTOG, USB_CLR_EP_TX_DTOG, USB_ENDPOINT_ATTR_BULK, USB_ENDPOINT_ATTR_CONTROL, USB_ENDPOINT_ATTR_INTERRUPT, USB_ENDPOINT_ATTR_ISOCHRONOUS, USB_EP_RX_STAT_VALID, USB_EP_TX_STAT_NAK, USB_EP_TYPE_BULK, USB_EP_TYPE_CONTROL, USB_EP_TYPE_INTERRUPT, USB_EP_TYPE_ISO, USB_SET_EP_ADDR, USB_SET_EP_RX_ADDR, USB_SET_EP_RX_STAT, USB_SET_EP_TX_ADDR, USB_SET_EP_TX_STAT, and USB_SET_EP_TYPE.
uint8_t st_usbfs_ep_stall_get | ( | usbd_device * | dev, |
uint8_t | addr | ||
) |
Definition at line 166 of file st_usbfs_core.c.
References USB_EP_REG, USB_EP_RX_STAT, USB_EP_RX_STAT_STALL, USB_EP_TX_STAT, and USB_EP_TX_STAT_STALL.
void st_usbfs_ep_stall_set | ( | usbd_device * | dev, |
uint8_t | addr, | ||
uint8_t | stall | ||
) |
Definition at line 136 of file st_usbfs_core.c.
References USB_CLR_EP_RX_DTOG, USB_CLR_EP_TX_DTOG, USB_EP_RX_STAT_STALL, USB_EP_RX_STAT_VALID, USB_EP_TX_STAT_NAK, USB_EP_TX_STAT_STALL, USB_SET_EP_RX_STAT, and USB_SET_EP_TX_STAT.
uint16_t st_usbfs_ep_write_packet | ( | usbd_device * | dev, |
uint8_t | addr, | ||
const void * | buf, | ||
uint16_t | len | ||
) |
Definition at line 200 of file st_usbfs_core.c.
References st_usbfs_copy_to_pm(), USB_EP_REG, USB_EP_TX_STAT, USB_EP_TX_STAT_VALID, USB_GET_EP_TX_BUFF, USB_SET_EP_TX_COUNT, and USB_SET_EP_TX_STAT.
void st_usbfs_poll | ( | usbd_device * | dev | ) |
Definition at line 236 of file st_usbfs_core.c.
References _usbd_reset(), st_usbfs_ep_read_packet(), USB_CLR_EP_RX_CTR, USB_CLR_EP_TX_CTR, USB_CLR_ISTR_RESET, USB_CLR_ISTR_SOF, USB_CLR_ISTR_SUSP, USB_CLR_ISTR_WKUP, USB_CNTR_REG, USB_CNTR_SOFM, USB_EP_REG, USB_EP_SETUP, USB_ISTR_CTR, USB_ISTR_DIR, USB_ISTR_EP_ID, USB_ISTR_REG, USB_ISTR_RESET, USB_ISTR_SOF, USB_ISTR_SUSP, and USB_ISTR_WKUP.
void st_usbfs_set_address | ( | usbd_device * | dev, |
uint8_t | addr | ||
) |
Definition at line 33 of file st_usbfs_core.c.
References SET_REG, USB_DADDR_ADDR, USB_DADDR_EF, and USB_DADDR_REG.
uint16_t st_usbfs_set_ep_rx_bufsize | ( | usbd_device * | dev, |
uint8_t | ep, | ||
uint32_t | size | ||
) |
Set the receive buffer size for a given USB endpoint.
dev | the usb device handle returned from usbd_init |
ep | Index of endpoint to configure. |
size | Size in bytes of the RX buffer. Legal sizes : {2,4,6...62}; {64,96,128...992}. |
Definition at line 48 of file st_usbfs_core.c.
References USB_SET_EP_RX_COUNT.
Referenced by st_usbfs_ep_setup().
struct _usbd_device st_usbfs_dev |
Definition at line 31 of file st_usbfs_core.c.
Referenced by st_usbfs_v1_usbd_init().
uint8_t st_usbfs_force_nak[8] |
Definition at line 30 of file st_usbfs_core.c.
Referenced by st_usbfs_ep_nak_set(), and st_usbfs_ep_read_packet().