BeRTOS
Functions
usb_stm32.c File Reference

STM32 USB driver. More...

#include "cfg/cfg_usb.h"
#include <cfg/log.h>
#include <cfg/debug.h>
#include <cfg/macros.h>
#include <cfg/module.h>
#include <cpu/irq.h>
#include <cpu/power.h>
#include <drv/irq_cm3.h>
#include <drv/gpio_stm32.h>
#include <drv/clock_stm32.h>
#include <drv/timer.h>
#include <drv/usb.h>
#include <mware/event.h>
#include <string.h>
#include "usb_stm32.h"

Go to the source code of this file.

Functions

ssize_t usb_endpointReadTimeout (int ep, void *buffer, ssize_t size, ticks_t timeout)
 Read up to size bytes from the USB endpoint identified by the address ep and store them in buffer.
ssize_t usb_endpointWriteTimeout (int ep, const void *buffer, ssize_t size, ticks_t timeout)
 Write up to size bytes from the buffer pointed buffer to the USB endpoint identified by the address ep.
int usb_deviceRegister (UsbDevice *dev)
 Register a generic USB device driver dev in the USB controller.

Detailed Description

STM32 USB driver.

Author:
Andrea Righi <arighi@develer.com>

Definition in file usb_stm32.c.


Function Documentation

ssize_t usb_endpointReadTimeout ( int  ep,
void *  buffer,
ssize_t  size,
ticks_t  timeout 
)

Read up to size bytes from the USB endpoint identified by the address ep and store them in buffer.

The timeout is an upper bound on the amount of time (in ticks) elapsed before returns. If timeout is zero, the the function returns immediatly and it basically works in non-blocking fashion. A negative value for timeout means that the function can block indefinitely.

Returns:
number of bytes actually read, or a negative value in case of errors.

Definition at line 1120 of file usb_stm32.c.

ssize_t usb_endpointWriteTimeout ( int  ep,
const void *  buffer,
ssize_t  size,
ticks_t  timeout 
)

Write up to size bytes from the buffer pointed buffer to the USB endpoint identified by the address ep.

The timeout is an upper bound on the amount of time (in ticks) elapsed before returns. If timeout is zero, the the function returns immediatly and it basically works in non-blocking fashion. A negative value for timeout means that the function can block indefinitely.

Returns:
number of bytes actually wrote, or a negative value in case of errors.

Definition at line 1179 of file usb_stm32.c.