forked from len0rd/rockbox
Cosmetic changes only - tab, whitespace and brace policing
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@14484 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
a6d52a8305
commit
03745f4ed3
13 changed files with 558 additions and 555 deletions
|
@ -118,14 +118,15 @@ timer_expired(struct timer * timer)
|
|||
/* gets called by usb_stack_init() to register
|
||||
* this arcotg device conrtollder driver in the
|
||||
* stack. */
|
||||
void usb_dcd_init(void) {
|
||||
void usb_dcd_init(void)
|
||||
{
|
||||
usb_controller_register(&arcotg_dcd);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
void usb_arcotg_dcd_init(void) {
|
||||
|
||||
void usb_arcotg_dcd_init(void)
|
||||
{
|
||||
struct timer t;
|
||||
int i, ep_num = 0;
|
||||
|
||||
|
@ -187,12 +188,13 @@ void usb_arcotg_dcd_init(void) {
|
|||
UDC_ENDPOINTLISTADDR = (unsigned int)dev_qh;
|
||||
}
|
||||
|
||||
void usb_arcotg_dcd_shutdown(void) {
|
||||
void usb_arcotg_dcd_shutdown(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
void usb_arcotg_dcd_start(void) {
|
||||
|
||||
void usb_arcotg_dcd_start(void)
|
||||
{
|
||||
logf("start");
|
||||
|
||||
if (arcotg_dcd.device_driver != NULL) {
|
||||
|
@ -207,8 +209,8 @@ void usb_arcotg_dcd_start(void) {
|
|||
UDC_USBCMD |= USB_CMD_RUN;
|
||||
}
|
||||
|
||||
void usb_arcotg_dcd_stop(void) {
|
||||
|
||||
void usb_arcotg_dcd_stop(void)
|
||||
{
|
||||
logf("stop");
|
||||
|
||||
/* set stopped bit */
|
||||
|
@ -217,8 +219,8 @@ void usb_arcotg_dcd_stop(void) {
|
|||
UDC_USBCMD &= ~USB_CMD_RUN;
|
||||
}
|
||||
|
||||
void usb_arcotg_dcd_irq(void) {
|
||||
|
||||
void usb_arcotg_dcd_irq(void)
|
||||
{
|
||||
if (dcd_controller.stopped == true) {
|
||||
return;
|
||||
}
|
||||
|
@ -269,8 +271,8 @@ void usb_arcotg_dcd_irq(void) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* interrupt handlers */
|
||||
|
||||
static void setup_received_int(struct usb_ctrlrequest* request) {
|
||||
|
||||
static void setup_received_int(struct usb_ctrlrequest* request)
|
||||
{
|
||||
int error = 0;
|
||||
uint8_t address = 0;
|
||||
int handled = 0; /* set to zero if we do not handle the message, */
|
||||
|
@ -358,8 +360,8 @@ static void setup_received_int(struct usb_ctrlrequest* request) {
|
|||
}
|
||||
}
|
||||
|
||||
static void port_change_int(void) {
|
||||
|
||||
static void port_change_int(void)
|
||||
{
|
||||
//logf("port_change_int");
|
||||
uint32_t tmp;
|
||||
enum usb_device_speed speed = USB_SPEED_UNKNOWN;
|
||||
|
@ -398,8 +400,8 @@ static void port_change_int(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void suspend_int(void) {
|
||||
|
||||
static void suspend_int(void)
|
||||
{
|
||||
//logf("suspend_int");
|
||||
dcd_controller.resume_state = dcd_controller.usb_state;
|
||||
dcd_controller.usb_state = USB_STATE_SUSPENDED;
|
||||
|
@ -410,8 +412,8 @@ static void suspend_int(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void resume_int(void) {
|
||||
|
||||
static void resume_int(void)
|
||||
{
|
||||
//logf("resume_int");
|
||||
dcd_controller.usb_state = dcd_controller.resume_state;
|
||||
dcd_controller.resume_state = USB_STATE_NOTATTACHED;
|
||||
|
@ -422,8 +424,8 @@ static void resume_int(void) {
|
|||
}
|
||||
}
|
||||
|
||||
static void reset_int(void) {
|
||||
|
||||
static void reset_int(void)
|
||||
{
|
||||
//logf("reset_int");
|
||||
struct timer t;
|
||||
|
||||
|
@ -459,8 +461,8 @@ static void reset_int(void) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* usb controller ops */
|
||||
|
||||
int usb_arcotg_dcd_enable(struct usb_ep* ep) {
|
||||
|
||||
int usb_arcotg_dcd_enable(struct usb_ep* ep)
|
||||
{
|
||||
unsigned short max = 0;
|
||||
unsigned char mult = 0, zlt = 0;
|
||||
int retval = 0;
|
||||
|
@ -643,8 +645,8 @@ int usb_arcotg_dcd_enable(struct usb_ep* ep) {
|
|||
return retval;
|
||||
}
|
||||
|
||||
int usb_arcotg_dcd_set_halt(struct usb_ep* ep, bool halt) {
|
||||
|
||||
int usb_arcotg_dcd_set_halt(struct usb_ep* ep, bool halt)
|
||||
{
|
||||
int status = -EOPNOTSUPP; /* operation not supported */
|
||||
unsigned char dir = 0;
|
||||
unsigned int tmp_epctrl = 0;
|
||||
|
@ -688,8 +690,8 @@ out:
|
|||
return status;
|
||||
}
|
||||
|
||||
int usb_arcotg_dcd_send(struct usb_ep* ep, struct usb_response* res) {
|
||||
|
||||
int usb_arcotg_dcd_send(struct usb_ep* ep, struct usb_response* res)
|
||||
{
|
||||
char* ptr;
|
||||
int todo, error, size, done = 0;
|
||||
int index = 1; /* use as default ep0 tx qh and td */
|
||||
|
@ -750,8 +752,8 @@ int usb_arcotg_dcd_send(struct usb_ep* ep, struct usb_response* res) {
|
|||
return done;
|
||||
}
|
||||
|
||||
int usb_arcotg_dcd_receive(struct usb_ep* ep, struct usb_response* res) {
|
||||
|
||||
int usb_arcotg_dcd_receive(struct usb_ep* ep, struct usb_response* res)
|
||||
{
|
||||
char* ptr;
|
||||
int todo, error, size, done = 0;
|
||||
int index = 0; /* use as default ep0 rx qh and td */
|
||||
|
@ -812,8 +814,8 @@ int usb_arcotg_dcd_receive(struct usb_ep* ep, struct usb_response* res) {
|
|||
/* lifecylce */
|
||||
|
||||
static void qh_init(unsigned char ep_num, unsigned char dir, unsigned char ep_type,
|
||||
unsigned int max_pkt_len, unsigned int zlt, unsigned char mult) {
|
||||
|
||||
unsigned int max_pkt_len, unsigned int zlt, unsigned char mult)
|
||||
{
|
||||
struct dqh *qh = &dev_qh[2 * ep_num + dir];
|
||||
uint32_t tmp = 0;
|
||||
memset(qh, 0, sizeof(struct dqh));
|
||||
|
@ -856,8 +858,8 @@ static void qh_init(unsigned char ep_num, unsigned char dir, unsigned char ep_ty
|
|||
logf("qh: init %d", (2 * ep_num + dir));
|
||||
}
|
||||
|
||||
static void td_init(struct dtd* td, void* buffer, uint32_t todo) {
|
||||
|
||||
static void td_init(struct dtd* td, void* buffer, uint32_t todo)
|
||||
{
|
||||
/* see 32.14.5.2 Building a Transfer Descriptor */
|
||||
|
||||
/* init first 7 dwords with 0 */
|
||||
|
@ -878,8 +880,8 @@ static void td_init(struct dtd* td, void* buffer, uint32_t todo) {
|
|||
td->buf_ptr0 = (uint32_t)buffer;
|
||||
}
|
||||
|
||||
static void ep_setup(unsigned char ep_num, unsigned char dir, unsigned char ep_type) {
|
||||
|
||||
static void ep_setup(unsigned char ep_num, unsigned char dir, unsigned char ep_type)
|
||||
{
|
||||
unsigned int tmp_epctrl = 0;
|
||||
struct timer t;
|
||||
|
||||
|
@ -916,8 +918,8 @@ static void ep_setup(unsigned char ep_num, unsigned char dir, unsigned char ep_t
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* helpers for sending/receiving */
|
||||
|
||||
static int td_enqueue(struct dtd* td, struct dqh* qh, unsigned int mask) {
|
||||
|
||||
static int td_enqueue(struct dtd* td, struct dqh* qh, unsigned int mask)
|
||||
{
|
||||
struct timer t;
|
||||
|
||||
qh->dtd_ovrl.next_dtd = (unsigned int)td;
|
||||
|
@ -940,8 +942,8 @@ static int td_enqueue(struct dtd* td, struct dqh* qh, unsigned int mask) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int td_wait(struct dtd* td, unsigned int mask) {
|
||||
|
||||
static int td_wait(struct dtd* td, unsigned int mask)
|
||||
{
|
||||
struct timer t;
|
||||
timer_set(&t, TRANSFER_TIMER);
|
||||
|
||||
|
@ -960,8 +962,8 @@ static int td_wait(struct dtd* td, unsigned int mask) {
|
|||
}
|
||||
}
|
||||
|
||||
static int usb_ack(struct usb_ctrlrequest * s, int error) {
|
||||
|
||||
static int usb_ack(struct usb_ctrlrequest * s, int error)
|
||||
{
|
||||
if (error) {
|
||||
logf("STALLing ep0");
|
||||
UDC_ENDPTCTRL0 |= 1 << 16; /* stall */
|
||||
|
|
|
@ -23,8 +23,8 @@
|
|||
#include <string.h>
|
||||
#include "usbstack/core.h"
|
||||
|
||||
static int usb_descriptor_fillbuf(void* buf, unsigned buflen, struct usb_descriptor_header** src) {
|
||||
|
||||
static int usb_descriptor_fillbuf(void* buf, unsigned buflen, struct usb_descriptor_header** src)
|
||||
{
|
||||
uint8_t* dest = buf;
|
||||
|
||||
if (!src) {
|
||||
|
@ -46,8 +46,8 @@ static int usb_descriptor_fillbuf(void* buf, unsigned buflen, struct usb_descrip
|
|||
return dest - (uint8_t *)buf;
|
||||
}
|
||||
|
||||
int usb_stack_configdesc(const struct usb_config_descriptor* config, void* buf, unsigned length, struct usb_descriptor_header** desc) {
|
||||
|
||||
int usb_stack_configdesc(const struct usb_config_descriptor* config, void* buf, unsigned length, struct usb_descriptor_header** desc)
|
||||
{
|
||||
struct usb_config_descriptor* cp = buf;
|
||||
int len;
|
||||
|
||||
|
|
|
@ -39,8 +39,8 @@ static void bind_device_driver(struct usb_device_driver* driver);
|
|||
/**
|
||||
* Initialize usb stack.
|
||||
*/
|
||||
void usb_stack_init(void) {
|
||||
|
||||
void usb_stack_init(void)
|
||||
{
|
||||
int i;
|
||||
logf("usb_stack_init");
|
||||
|
||||
|
@ -77,8 +77,8 @@ void usb_stack_init(void) {
|
|||
* Start processing of usb stack. This function init
|
||||
* active usb controller.
|
||||
*/
|
||||
void usb_stack_start(void) {
|
||||
|
||||
void usb_stack_start(void)
|
||||
{
|
||||
/* are we allready running? */
|
||||
if (usbcore.running) {
|
||||
logf("allready running!");
|
||||
|
@ -111,8 +111,8 @@ void usb_stack_start(void) {
|
|||
* Stop processing of usb stack. This function shutsdown
|
||||
* active usb controller.
|
||||
*/
|
||||
void usb_stack_stop(void) {
|
||||
|
||||
void usb_stack_stop(void)
|
||||
{
|
||||
/* are we allready stopped? */
|
||||
if (usbcore.running == false) {
|
||||
return;
|
||||
|
@ -127,8 +127,8 @@ void usb_stack_stop(void) {
|
|||
* Gets called by upper layers to indicate that there is
|
||||
* an interrupt waiting for the controller.
|
||||
*/
|
||||
void usb_stack_irq(void) {
|
||||
|
||||
void usb_stack_irq(void)
|
||||
{
|
||||
/* simply notify usb controller */
|
||||
if (usbcore.active_controller != NULL && usbcore.active_controller->irq != NULL) {
|
||||
usbcore.active_controller->irq();
|
||||
|
@ -140,7 +140,8 @@ void usb_stack_irq(void) {
|
|||
* to call for maintanence. We need to check if a new device has connected,
|
||||
* find suitable drivers for new devices.
|
||||
*/
|
||||
void usb_stack_work(void) {
|
||||
void usb_stack_work(void)
|
||||
{
|
||||
/* TODO will be used with host device controllers
|
||||
* and needs to be called in a loop (thread) */
|
||||
}
|
||||
|
@ -153,8 +154,8 @@ void usb_stack_work(void) {
|
|||
* @param ctrl pointer to controller to register.
|
||||
* @return 0 on success else a defined error code.
|
||||
*/
|
||||
int usb_controller_register(struct usb_controller* ctrl) {
|
||||
|
||||
int usb_controller_register(struct usb_controller* ctrl)
|
||||
{
|
||||
if (ctrl == NULL) {
|
||||
return EINVAL;
|
||||
}
|
||||
|
@ -220,8 +221,8 @@ int usb_controller_unregister(struct usb_controller* ctrl) {
|
|||
*
|
||||
* @param type of controller to activate.
|
||||
*/
|
||||
void usb_controller_select(int type) {
|
||||
|
||||
void usb_controller_select(int type)
|
||||
{
|
||||
struct usb_controller* new = NULL;
|
||||
|
||||
/* check if a controller of the wanted type is already loaded */
|
||||
|
@ -272,8 +273,8 @@ int usb_stack_get_mode(void) {
|
|||
* @param driver pointer to an usb_device_driver struct.
|
||||
* @return 0 on success, else a defined error code.
|
||||
*/
|
||||
int usb_device_driver_register(struct usb_device_driver* driver) {
|
||||
|
||||
int usb_device_driver_register(struct usb_device_driver* driver)
|
||||
{
|
||||
int i;
|
||||
|
||||
if (driver == NULL) {
|
||||
|
|
|
@ -36,8 +36,8 @@
|
|||
*/
|
||||
static int ep_matches(struct usb_ep* ep, struct usb_endpoint_descriptor* desc);
|
||||
|
||||
void usb_ep_autoconfig_reset(void) {
|
||||
|
||||
void usb_ep_autoconfig_reset(void)
|
||||
{
|
||||
struct usb_ep* ep = NULL;
|
||||
if (usbcore.active_controller == NULL) {
|
||||
return;
|
||||
|
@ -55,8 +55,8 @@ void usb_ep_autoconfig_reset(void) {
|
|||
* @param desc usb descritpro to use for seraching.
|
||||
* @return NULL or a valid endpoint.
|
||||
*/
|
||||
struct usb_ep* usb_ep_autoconfig(struct usb_endpoint_descriptor* desc) {
|
||||
|
||||
struct usb_ep* usb_ep_autoconfig(struct usb_endpoint_descriptor* desc)
|
||||
{
|
||||
struct usb_ep* ep = NULL;
|
||||
if (usbcore.active_controller == NULL) {
|
||||
logf("active controller NULL");
|
||||
|
@ -72,8 +72,8 @@ struct usb_ep* usb_ep_autoconfig(struct usb_endpoint_descriptor* desc) {
|
|||
return NULL;
|
||||
}
|
||||
|
||||
static int ep_matches(struct usb_ep* ep, struct usb_endpoint_descriptor* desc) {
|
||||
|
||||
static int ep_matches(struct usb_ep* ep, struct usb_endpoint_descriptor* desc)
|
||||
{
|
||||
uint8_t type;
|
||||
const char* tmp;
|
||||
uint16_t max;
|
||||
|
|
|
@ -20,8 +20,8 @@
|
|||
#include <string.h>
|
||||
#include "usbstack/core.h"
|
||||
|
||||
void into_usb_ctrlrequest(struct usb_ctrlrequest* request) {
|
||||
|
||||
void into_usb_ctrlrequest(struct usb_ctrlrequest* request)
|
||||
{
|
||||
char* type = "";
|
||||
char* req = "";
|
||||
char* extra = 0;
|
||||
|
|
|
@ -137,16 +137,16 @@ static struct device dev;
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
void usb_serial_driver_init(void) {
|
||||
|
||||
void usb_serial_driver_init(void)
|
||||
{
|
||||
logf("usb serial: register");
|
||||
usb_device_driver_register(&usb_serial_driver);
|
||||
}
|
||||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
void usb_serial_driver_bind(void* controler_ops) {
|
||||
|
||||
void usb_serial_driver_bind(void* controler_ops)
|
||||
{
|
||||
logf("usb serial: bind");
|
||||
ops = controler_ops;
|
||||
|
||||
|
@ -183,8 +183,8 @@ autoconf_fail:
|
|||
logf("failed to find endpoiunts");
|
||||
}
|
||||
|
||||
int usb_serial_driver_request(struct usb_ctrlrequest* request) {
|
||||
|
||||
int usb_serial_driver_request(struct usb_ctrlrequest* request)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
logf("usb serial: request");
|
||||
|
||||
|
@ -249,8 +249,8 @@ int usb_serial_driver_request(struct usb_ctrlrequest* request) {
|
|||
return ret;
|
||||
}
|
||||
|
||||
void usb_serial_driver_speed(enum usb_device_speed speed) {
|
||||
|
||||
void usb_serial_driver_speed(enum usb_device_speed speed)
|
||||
{
|
||||
switch (speed) {
|
||||
case USB_SPEED_LOW:
|
||||
case USB_SPEED_FULL:
|
||||
|
@ -268,8 +268,8 @@ void usb_serial_driver_speed(enum usb_device_speed speed) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* helper functions */
|
||||
|
||||
static int config_buf(uint8_t *buf, uint8_t type, unsigned index) {
|
||||
|
||||
static int config_buf(uint8_t *buf, uint8_t type, unsigned index)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* TODO check index*/
|
||||
|
@ -282,8 +282,8 @@ static int config_buf(uint8_t *buf, uint8_t type, unsigned index) {
|
|||
return len;
|
||||
}
|
||||
|
||||
static int set_config(int config) {
|
||||
|
||||
static int set_config(int config)
|
||||
{
|
||||
/* TODO check config*/
|
||||
|
||||
/* enable endpoints */
|
||||
|
|
|
@ -128,8 +128,8 @@ static int set_config(int config);
|
|||
|
||||
/*-------------------------------------------------------------------------*/
|
||||
|
||||
void usb_storage_driver_init(void) {
|
||||
|
||||
void usb_storage_driver_init(void)
|
||||
{
|
||||
logf("usb storage: register");
|
||||
usb_device_driver_register(&usb_storage_driver);
|
||||
}
|
||||
|
@ -137,8 +137,8 @@ void usb_storage_driver_init(void) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* device driver ops */
|
||||
|
||||
void usb_storage_driver_bind(void* controler_ops) {
|
||||
|
||||
void usb_storage_driver_bind(void* controler_ops)
|
||||
{
|
||||
ops = controler_ops;
|
||||
|
||||
/* serach and asign endpoints */
|
||||
|
@ -164,8 +164,8 @@ autoconf_fail:
|
|||
logf("failed to find endpoints");
|
||||
}
|
||||
|
||||
int usb_storage_driver_request(struct usb_ctrlrequest* request) {
|
||||
|
||||
int usb_storage_driver_request(struct usb_ctrlrequest* request)
|
||||
{
|
||||
int ret = -EOPNOTSUPP;
|
||||
logf("usb storage: request");
|
||||
|
||||
|
@ -237,8 +237,8 @@ int usb_storage_driver_request(struct usb_ctrlrequest* request) {
|
|||
/*-------------------------------------------------------------------------*/
|
||||
/* S/GET CONFIGURATION helpers */
|
||||
|
||||
static int config_buf(uint8_t *buf, uint8_t type, unsigned index) {
|
||||
|
||||
static int config_buf(uint8_t *buf, uint8_t type, unsigned index)
|
||||
{
|
||||
int len;
|
||||
|
||||
/* only one configuration */
|
||||
|
@ -254,8 +254,8 @@ static int config_buf(uint8_t *buf, uint8_t type, unsigned index) {
|
|||
return len;
|
||||
}
|
||||
|
||||
static int set_config(int config) {
|
||||
|
||||
static int set_config(int config)
|
||||
{
|
||||
/* enable endpoints */
|
||||
logf("setup %s", dev.in->name);
|
||||
ops->enable(dev.in);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue