libopencm3
A free/libre/open-source firmware library for various ARM Cortex-M3 microcontrollers.
st_usbfs_core.c File Reference
#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"
Include dependency graph for st_usbfs_core.c:

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
 

Function Documentation

◆ st_usbfs_endpoints_reset()

void st_usbfs_endpoints_reset ( usbd_device dev)

◆ st_usbfs_ep_nak_set()

void st_usbfs_ep_nak_set ( usbd_device dev,
uint8_t  addr,
uint8_t  nak 
)

◆ st_usbfs_ep_read_packet()

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().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ st_usbfs_ep_setup()

◆ st_usbfs_ep_stall_get()

uint8_t st_usbfs_ep_stall_get ( usbd_device dev,
uint8_t  addr 
)

◆ st_usbfs_ep_stall_set()

void st_usbfs_ep_stall_set ( usbd_device dev,
uint8_t  addr,
uint8_t  stall 
)

◆ st_usbfs_ep_write_packet()

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.

Here is the call graph for this function:

◆ st_usbfs_poll()

◆ st_usbfs_set_address()

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.

◆ st_usbfs_set_ep_rx_bufsize()

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.

Parameters
devthe usb device handle returned from usbd_init
epIndex of endpoint to configure.
sizeSize in bytes of the RX buffer. Legal sizes : {2,4,6...62}; {64,96,128...992}.
Returns
(uint16) Actual size set

Definition at line 48 of file st_usbfs_core.c.

References USB_SET_EP_RX_COUNT.

Referenced by st_usbfs_ep_setup().

Here is the caller graph for this function:

Variable Documentation

◆ st_usbfs_dev

struct _usbd_device st_usbfs_dev

Definition at line 31 of file st_usbfs_core.c.

Referenced by st_usbfs_v1_usbd_init().

◆ st_usbfs_force_nak

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().