summaryrefslogtreecommitdiff
path: root/firmware/usbstack/core
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/usbstack/core')
-rw-r--r--firmware/usbstack/core/config.c9
-rw-r--r--firmware/usbstack/core/core.c31
-rw-r--r--firmware/usbstack/core/epsetup.c6
3 files changed, 28 insertions, 18 deletions
diff --git a/firmware/usbstack/core/config.c b/firmware/usbstack/core/config.c
index c49d547..1a9b125 100644
--- a/firmware/usbstack/core/config.c
+++ b/firmware/usbstack/core/config.c
@@ -23,7 +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;
@@ -45,7 +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;
@@ -58,7 +60,8 @@ int usb_stack_configdesc(const struct usb_config_descriptor* config, void* buf,
*cp = *config;
/* then interface/endpoint/class/vendor/... */
- len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (uint8_t*)buf, length - USB_DT_CONFIG_SIZE, desc);
+ len = usb_descriptor_fillbuf(USB_DT_CONFIG_SIZE + (uint8_t*)buf,
+ length - USB_DT_CONFIG_SIZE, desc);
if (len < 0) {
return len;
diff --git a/firmware/usbstack/core/core.c b/firmware/usbstack/core/core.c
index 2fbec5d..0d2cfc6 100644
--- a/firmware/usbstack/core/core.c
+++ b/firmware/usbstack/core/core.c
@@ -99,7 +99,8 @@ void usb_stack_start(void)
* and if it has a device driver bind to it */
logf("check for auto bind");
if (usbcore.active_controller->type == DEVICE) {
- if (usbcore.active_controller->device_driver == NULL && usbcore.device_driver != NULL) {
+ if (usbcore.active_controller->device_driver == NULL &&
+ usbcore.device_driver != NULL) {
/* bind driver */
logf("binding...");
bind_device_driver(usbcore.device_driver);
@@ -130,7 +131,8 @@ void usb_stack_stop(void)
void usb_stack_irq(void)
{
/* simply notify usb controller */
- if (usbcore.active_controller != NULL && usbcore.active_controller->irq != NULL) {
+ if (usbcore.active_controller != NULL &&
+ usbcore.active_controller->irq != NULL) {
usbcore.active_controller->irq();
}
}
@@ -190,7 +192,8 @@ int usb_controller_register(struct usb_controller* ctrl)
* @param ctrl pointer to controller to unregister.
* @return 0 on success else a defined error code.
*/
-int usb_controller_unregister(struct usb_controller* ctrl) {
+int usb_controller_unregister(struct usb_controller* ctrl)
+{
if (ctrl == NULL) {
return EINVAL;
@@ -226,7 +229,8 @@ void usb_controller_select(int type)
struct usb_controller* new = NULL;
/* check if a controller of the wanted type is already loaded */
- if (usbcore.active_controller != NULL && (int)usbcore.active_controller->type == type) {
+ if (usbcore.active_controller != NULL &&
+ (int)usbcore.active_controller->type == type) {
logf("controller already set");
return;
}
@@ -263,7 +267,8 @@ void usb_controller_select(int type)
usbcore.active_controller->init();
}
-int usb_stack_get_mode(void) {
+int usb_stack_get_mode(void)
+{
return usbcore.mode;
}
@@ -296,8 +301,8 @@ int usb_device_driver_register(struct usb_device_driver* driver)
return 0;
}
-int usb_device_driver_bind(const char* name) {
-
+int usb_device_driver_bind(const char* name)
+{
int i;
struct usb_device_driver *tmp = NULL;
struct usb_device_driver *driver = NULL;
@@ -340,8 +345,8 @@ int usb_device_driver_bind(const char* name) {
return 0;
}
-void usb_device_driver_unbind(void) {
-
+void usb_device_driver_unbind(void)
+{
logf("usb_device_driver_unbind");
if (usbcore.active_controller->device_driver != NULL) {
usbcore.active_controller->device_driver->unbind();
@@ -351,8 +356,8 @@ void usb_device_driver_unbind(void) {
usbcore.device_driver = NULL;
}
-static void update_driver_names(unsigned char* result) {
-
+static void update_driver_names(unsigned char* result)
+{
int i;
int pos = 0;
unsigned char terminator = ',';
@@ -376,8 +381,8 @@ static void update_driver_names(unsigned char* result) {
}
}
-static void bind_device_driver(struct usb_device_driver* driver) {
-
+static void bind_device_driver(struct usb_device_driver* driver)
+{
int ret = 0;
/* look if there is an old driver */
diff --git a/firmware/usbstack/core/epsetup.c b/firmware/usbstack/core/epsetup.c
index 969678e..ef98935 100644
--- a/firmware/usbstack/core/epsetup.c
+++ b/firmware/usbstack/core/epsetup.c
@@ -151,13 +151,15 @@ static int ep_matches(struct usb_ep* ep, struct usb_endpoint_descriptor* desc)
switch (type) {
case USB_ENDPOINT_XFER_INT:
/* INT: limit 64 bytes full speed, 1024 high speed */
- if ((usbcore.active_controller->speed != USB_SPEED_HIGH) && (max > 64)) {
+ if ((usbcore.active_controller->speed != USB_SPEED_HIGH) &&
+ (max > 64)) {
return 0;
}
/* FALLTHROUGH */
case USB_ENDPOINT_XFER_ISOC:
- if ((usbcore.active_controller->speed != USB_SPEED_HIGH) && (max > 1023)) {
+ if ((usbcore.active_controller->speed != USB_SPEED_HIGH) &&
+ (max > 1023)) {
return 0;
}
break;