Stile fixes run, 80 char boundry.
This commit is contained in:
@@ -137,7 +137,8 @@ void usbd_disconnect(usbd_device *usbd_dev, bool disconnected)
|
||||
}
|
||||
}
|
||||
|
||||
void usbd_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type, uint16_t max_size,
|
||||
void usbd_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
|
||||
uint16_t max_size,
|
||||
void (*callback)(usbd_device *usbd_dev, uint8_t ep))
|
||||
{
|
||||
usbd_dev->driver->ep_setup(usbd_dev, addr, type, max_size, callback);
|
||||
@@ -149,7 +150,8 @@ uint16_t usbd_ep_write_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
return usbd_dev->driver->ep_write_packet(usbd_dev, addr, buf, len);
|
||||
}
|
||||
|
||||
uint16_t usbd_ep_read_packet(usbd_device *usbd_dev, uint8_t addr, void *buf, uint16_t len)
|
||||
uint16_t usbd_ep_read_packet(usbd_device *usbd_dev, uint8_t addr, void *buf,
|
||||
uint16_t len)
|
||||
{
|
||||
return usbd_dev->driver->ep_read_packet(usbd_dev, addr, buf, len);
|
||||
}
|
||||
|
||||
@@ -40,7 +40,8 @@ LGPL License Terms @ref lgpl_license
|
||||
#include "usb_private.h"
|
||||
|
||||
/* Register application callback function for handling USB control requests. */
|
||||
int usbd_register_control_callback(usbd_device *usbd_dev, uint8_t type, uint8_t type_mask,
|
||||
int usbd_register_control_callback(usbd_device *usbd_dev, uint8_t type,
|
||||
uint8_t type_mask,
|
||||
usbd_control_callback callback)
|
||||
{
|
||||
int i;
|
||||
|
||||
@@ -26,17 +26,20 @@
|
||||
|
||||
static usbd_device *stm32f103_usbd_init(void);
|
||||
static void stm32f103_set_address(usbd_device *usbd_dev, uint8_t addr);
|
||||
static void stm32f103_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
|
||||
uint16_t max_size,
|
||||
void (*callback) (usbd_device *usbd_dev, uint8_t ep));
|
||||
static void stm32f103_ep_setup(usbd_device *usbd_dev, uint8_t addr,
|
||||
uint8_t type, uint16_t max_size,
|
||||
void (*callback) (usbd_device *usbd_dev,
|
||||
uint8_t ep));
|
||||
static void stm32f103_endpoints_reset(usbd_device *usbd_dev);
|
||||
static void stm32f103_ep_stall_set(usbd_device *usbd_dev, uint8_t addr, uint8_t stall);
|
||||
static void stm32f103_ep_stall_set(usbd_device *usbd_dev, uint8_t addr,
|
||||
uint8_t stall);
|
||||
static uint8_t stm32f103_ep_stall_get(usbd_device *usbd_dev, uint8_t addr);
|
||||
static void stm32f103_ep_nak_set(usbd_device *usbd_dev, uint8_t addr, uint8_t nak);
|
||||
static void stm32f103_ep_nak_set(usbd_device *usbd_dev, uint8_t addr,
|
||||
uint8_t nak);
|
||||
static uint16_t stm32f103_ep_write_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
const void *buf, uint16_t len);
|
||||
static uint16_t stm32f103_ep_read_packet(usbd_device *usbd_dev, uint8_t addr, void *buf,
|
||||
uint16_t len);
|
||||
static uint16_t stm32f103_ep_read_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
void *buf, uint16_t len);
|
||||
static void stm32f103_poll(usbd_device *usbd_dev);
|
||||
|
||||
static uint8_t force_nak[8];
|
||||
@@ -100,7 +103,8 @@ static void usb_set_ep_rx_bufsize(usbd_device *dev, uint8_t ep, uint32_t size)
|
||||
|
||||
static void stm32f103_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 (*callback) (usbd_device *usbd_dev,
|
||||
uint8_t ep))
|
||||
{
|
||||
/* Translate USB standard type codes to STM32. */
|
||||
const uint16_t typelookup[] = {
|
||||
@@ -152,7 +156,8 @@ static void stm32f103_endpoints_reset(usbd_device *dev)
|
||||
dev->pm_top = 0x40 + (2 * dev->desc->bMaxPacketSize0);
|
||||
}
|
||||
|
||||
static void stm32f103_ep_stall_set(usbd_device *dev, uint8_t addr, uint8_t stall)
|
||||
static void stm32f103_ep_stall_set(usbd_device *dev, uint8_t addr,
|
||||
uint8_t stall)
|
||||
{
|
||||
(void)dev;
|
||||
if (addr == 0) {
|
||||
@@ -269,8 +274,8 @@ static void usb_copy_from_pm(void *buf, const volatile void *vPM, uint16_t len)
|
||||
}
|
||||
}
|
||||
|
||||
static uint16_t stm32f103_ep_read_packet(usbd_device *dev, uint8_t addr, void *buf,
|
||||
uint16_t len)
|
||||
static uint16_t stm32f103_ep_read_packet(usbd_device *dev, uint8_t addr,
|
||||
void *buf, uint16_t len)
|
||||
{
|
||||
(void)dev;
|
||||
if ((*USB_EP_REG(addr) & USB_EP_RX_STAT) == USB_EP_RX_STAT_VALID) {
|
||||
|
||||
@@ -31,15 +31,17 @@
|
||||
* according to the selected cores base address. */
|
||||
#define dev_base_address (usbd_dev->driver->base_address)
|
||||
#define REBASE(x) MMIO32((x)+(dev_base_address))
|
||||
#define REBASE_FIFO(x) ((volatile uint32_t*)((dev_base_address) + (OTG_FIFO(x))))
|
||||
#define REBASE_FIFO(x) ((volatile uint32_t*)((dev_base_address) \
|
||||
+ (OTG_FIFO(x))))
|
||||
|
||||
void stm32fx07_set_address(usbd_device *usbd_dev, uint8_t addr)
|
||||
{
|
||||
REBASE(OTG_DCFG) = (REBASE(OTG_DCFG) & ~OTG_FS_DCFG_DAD) | (addr << 4);
|
||||
}
|
||||
|
||||
void stm32fx07_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type, uint16_t max_size,
|
||||
void (*callback) (usbd_device *usbd_dev, uint8_t ep))
|
||||
void stm32fx07_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
|
||||
uint16_t max_size,
|
||||
void (*callback) (usbd_device *usbd_dev, uint8_t ep))
|
||||
{
|
||||
/*
|
||||
* Configure endpoint address and type. Allocate FIFO memory for
|
||||
@@ -204,7 +206,8 @@ uint16_t stm32fx07_ep_write_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
return len;
|
||||
}
|
||||
|
||||
uint16_t stm32fx07_ep_read_packet(usbd_device *usbd_dev, uint8_t addr, void *buf, uint16_t len)
|
||||
uint16_t stm32fx07_ep_read_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
void *buf, uint16_t len)
|
||||
{
|
||||
int i;
|
||||
uint32_t *buf32 = buf;
|
||||
@@ -294,7 +297,8 @@ void stm32fx07_poll(usbd_device *usbd_dev)
|
||||
for (i = 0; i < 4; i++) { /* Iterate over endpoints. */
|
||||
if (REBASE(OTG_DIEPINT(i)) & OTG_FS_DIEPINTX_XFRC) {
|
||||
/* Transfer complete. */
|
||||
if (usbd_dev->user_callback_ctr[i][USB_TRANSACTION_IN]) {
|
||||
if (usbd_dev->user_callback_ctr[i]
|
||||
[USB_TRANSACTION_IN]) {
|
||||
usbd_dev->user_callback_ctr[i]
|
||||
[USB_TRANSACTION_IN](usbd_dev, i);
|
||||
}
|
||||
|
||||
@@ -21,16 +21,17 @@
|
||||
#define __USB_FX07_COMMON_H_
|
||||
|
||||
void stm32fx07_set_address(usbd_device *usbd_dev, uint8_t addr);
|
||||
void stm32fx07_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type, uint16_t max_size,
|
||||
void (*callback)(usbd_device *usbd_dev, uint8_t ep));
|
||||
void stm32fx07_ep_setup(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
|
||||
uint16_t max_size,
|
||||
void (*callback)(usbd_device *usbd_dev, uint8_t ep));
|
||||
void stm32fx07_endpoints_reset(usbd_device *usbd_dev);
|
||||
void stm32fx07_ep_stall_set(usbd_device *usbd_dev, uint8_t addr, uint8_t stall);
|
||||
uint8_t stm32fx07_ep_stall_get(usbd_device *usbd_dev, uint8_t addr);
|
||||
void stm32fx07_ep_nak_set(usbd_device *usbd_dev, uint8_t addr, uint8_t nak);
|
||||
uint16_t stm32fx07_ep_write_packet(usbd_device *usbd_dev, uint8_t addr, const void *buf,
|
||||
uint16_t len);
|
||||
uint16_t stm32fx07_ep_read_packet(usbd_device *usbd_dev, uint8_t addr, void *buf,
|
||||
uint16_t len);
|
||||
uint16_t stm32fx07_ep_write_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
const void *buf, uint16_t len);
|
||||
uint16_t stm32fx07_ep_read_packet(usbd_device *usbd_dev, uint8_t addr,
|
||||
void *buf, uint16_t len);
|
||||
void stm32fx07_poll(usbd_device *usbd_dev);
|
||||
void stm32fx07_disconnect(usbd_device *usbd_dev, bool disconnected);
|
||||
|
||||
|
||||
@@ -6,7 +6,8 @@
|
||||
|
||||
@version 1.0.0
|
||||
|
||||
@author @htmlonly © @endhtmlonly 2010 Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
@author @htmlonly © @endhtmlonly 2010
|
||||
Gareth McMullin <gareth@blacksphere.co.nz>
|
||||
|
||||
@date 10 March 2013
|
||||
|
||||
@@ -84,7 +85,8 @@ struct _usbd_device {
|
||||
void (*user_callback_ctr[8][3])(usbd_device *usbd_dev, uint8_t ea);
|
||||
|
||||
/* User callback function for some standard USB function hooks */
|
||||
void (*user_callback_set_config)(usbd_device *usbd_dev, uint16_t wValue);
|
||||
void (*user_callback_set_config)(usbd_device *usbd_dev,
|
||||
uint16_t wValue);
|
||||
|
||||
const struct _usbd_driver *driver;
|
||||
|
||||
@@ -137,16 +139,18 @@ void _usbd_reset(usbd_device *usbd_dev);
|
||||
struct _usbd_driver {
|
||||
usbd_device *(*init)(void);
|
||||
void (*set_address)(usbd_device *usbd_dev, uint8_t addr);
|
||||
void (*ep_setup)(usbd_device *usbd_dev, uint8_t addr, uint8_t type, uint16_t max_size,
|
||||
void (*ep_setup)(usbd_device *usbd_dev, uint8_t addr, uint8_t type,
|
||||
uint16_t max_size,
|
||||
void (*cb)(usbd_device *usbd_dev, uint8_t ep));
|
||||
void (*ep_reset)(usbd_device *usbd_dev);
|
||||
void (*ep_stall_set)(usbd_device *usbd_dev, uint8_t addr, uint8_t stall);
|
||||
void (*ep_stall_set)(usbd_device *usbd_dev, uint8_t addr,
|
||||
uint8_t stall);
|
||||
void (*ep_nak_set)(usbd_device *usbd_dev, uint8_t addr, uint8_t nak);
|
||||
uint8_t (*ep_stall_get)(usbd_device *usbd_dev, uint8_t addr);
|
||||
uint16_t (*ep_write_packet)(usbd_device *usbd_dev, uint8_t addr, const void *buf,
|
||||
uint16_t len);
|
||||
uint16_t (*ep_read_packet)(usbd_device *usbd_dev, uint8_t addr, void *buf,
|
||||
uint16_t len);
|
||||
uint16_t (*ep_write_packet)(usbd_device *usbd_dev, uint8_t addr,
|
||||
const void *buf, uint16_t len);
|
||||
uint16_t (*ep_read_packet)(usbd_device *usbd_dev, uint8_t addr,
|
||||
void *buf, uint16_t len);
|
||||
void (*poll)(usbd_device *usbd_dev);
|
||||
void (*disconnect)(usbd_device *usbd_dev, bool disconnected);
|
||||
uint32_t base_address;
|
||||
|
||||
@@ -377,8 +377,8 @@ int _usbd_standard_request_device(usbd_device *usbd_dev,
|
||||
struct usb_setup_data *req, uint8_t **buf,
|
||||
uint16_t *len)
|
||||
{
|
||||
int (*command)(usbd_device *usbd_dev, struct usb_setup_data *req, uint8_t
|
||||
**buf, uint16_t *len) = NULL;
|
||||
int (*command)(usbd_device *usbd_dev, struct usb_setup_data *req,
|
||||
uint8_t **buf, uint16_t *len) = NULL;
|
||||
|
||||
switch (req->bRequest) {
|
||||
case USB_REQ_CLEAR_FEATURE:
|
||||
@@ -494,8 +494,8 @@ int _usbd_standard_request_endpoint(usbd_device *usbd_dev,
|
||||
return command(usbd_dev, req, buf, len);
|
||||
}
|
||||
|
||||
int _usbd_standard_request(usbd_device *usbd_dev,
|
||||
struct usb_setup_data *req, uint8_t **buf, uint16_t *len)
|
||||
int _usbd_standard_request(usbd_device *usbd_dev, struct usb_setup_data *req,
|
||||
uint8_t **buf, uint16_t *len)
|
||||
{
|
||||
/* FIXME: Have class/vendor requests as well. */
|
||||
if ((req->bmRequestType & USB_REQ_TYPE_TYPE) != USB_REQ_TYPE_STANDARD) {
|
||||
|
||||
Reference in New Issue
Block a user