Device drivers: Refactor: Move driver declaration to the end of file

forward declarations are not needed

Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
This commit is contained in:
Amir Hammad 2015-04-08 08:04:27 +02:00
parent ba197f8007
commit 6625cda9f3
3 changed files with 57 additions and 72 deletions

View file

@ -28,30 +28,6 @@
#include <stdint.h>
#include <libopencm3/usb/usbstd.h>
static void *gp_xbox_init(void *usbh_dev);
static bool gp_xbox_analyze_descriptor(void *drvdata, void *descriptor);
static void gp_xbox_poll(void *drvdata, uint32_t time_curr_us);
static void gp_xbox_remove(void *drvdata);
static const usbh_dev_driver_info_t usbh_gp_xbox_driver_info = {
.deviceClass = 0xff,
.deviceSubClass = 0xff,
.deviceProtocol = 0xff,
.idVendor = 0x045e,
.idProduct = 0x028e,
.ifaceClass = 0xff,
.ifaceSubClass = 93,
.ifaceProtocol = 0x01
};
const usbh_dev_driver_t usbh_gp_xbox_driver = {
.init = gp_xbox_init,
.analyze_descriptor = gp_xbox_analyze_descriptor,
.poll = gp_xbox_poll,
.remove = gp_xbox_remove,
.info = &usbh_gp_xbox_driver_info
};
enum STATES {
STATE_INACTIVE,
STATE_READING_COMPLETE,
@ -419,3 +395,22 @@ static void gp_xbox_remove(void *drvdata)
gp_xbox->state_next = STATE_INACTIVE;
gp_xbox->endpoint_in_address = 0;
}
static const usbh_dev_driver_info_t usbh_gp_xbox_driver_info = {
.deviceClass = 0xff,
.deviceSubClass = 0xff,
.deviceProtocol = 0xff,
.idVendor = 0x045e,
.idProduct = 0x028e,
.ifaceClass = 0xff,
.ifaceSubClass = 93,
.ifaceProtocol = 0x01
};
const usbh_dev_driver_t usbh_gp_xbox_driver = {
.init = gp_xbox_init,
.analyze_descriptor = gp_xbox_analyze_descriptor,
.poll = gp_xbox_poll,
.remove = gp_xbox_remove,
.info = &usbh_gp_xbox_driver_info
};

View file

@ -27,30 +27,6 @@
#include <libopencm3/usb/usbstd.h>
static void *mouse_init(void *usbh_dev);
static bool mouse_analyze_descriptor(void *drvdata, void *descriptor);
static void mouse_poll(void *drvdata, uint32_t time_curr_us);
static void mouse_remove(void *drvdata);
static const usbh_dev_driver_info_t usbh_hid_mouse_driver_info = {
.deviceClass = -1,
.deviceSubClass = -1,
.deviceProtocol = -1,
.idVendor = -1,
.idProduct = -1,
.ifaceClass = 0x03,
.ifaceSubClass = -1,
.ifaceProtocol = 0x02
};
const usbh_dev_driver_t usbh_hid_mouse_driver = {
.init = mouse_init,
.analyze_descriptor = mouse_analyze_descriptor,
.poll = mouse_poll,
.remove = mouse_remove,
.info = &usbh_hid_mouse_driver_info
};
enum STATES {
STATE_INACTIVE,
STATE_READING_COMPLETE,
@ -292,3 +268,22 @@ static void mouse_remove(void *drvdata)
mouse->state_next = STATE_INACTIVE;
mouse->endpoint_in_address = 0;
}
static const usbh_dev_driver_info_t usbh_hid_mouse_driver_info = {
.deviceClass = -1,
.deviceSubClass = -1,
.deviceProtocol = -1,
.idVendor = -1,
.idProduct = -1,
.ifaceClass = 0x03,
.ifaceSubClass = -1,
.ifaceProtocol = 0x02
};
const usbh_dev_driver_t usbh_hid_mouse_driver = {
.init = mouse_init,
.analyze_descriptor = mouse_analyze_descriptor,
.poll = mouse_poll,
.remove = mouse_remove,
.info = &usbh_hid_mouse_driver_info
};

View file

@ -29,31 +29,7 @@
static hub_device_t hub_device[USBH_MAX_HUBS];
static void *hub_init(void *usbh_dev);
static bool hub_analyze_descriptor(void *drvdata, void *descriptor);
static void hub_poll(void *drvdata, uint32_t time_curr_us);
static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data);
static void hub_remove(void *drvdata);
static const usbh_dev_driver_info_t usbh_hub_driver_info = {
.deviceClass = 0x09,
.deviceSubClass = -1,
.deviceProtocol = -1,
.idVendor = -1,
.idProduct = -1,
.ifaceClass = 0x09,
.ifaceSubClass = -1,
.ifaceProtocol = -1
};
const usbh_dev_driver_t usbh_hub_driver = {
.init = hub_init,
.analyze_descriptor = hub_analyze_descriptor,
.poll = hub_poll,
.remove = hub_remove,
.info = &usbh_hub_driver_info
};
@ -863,3 +839,22 @@ static void hub_remove(void *drvdata)
}
}
static const usbh_dev_driver_info_t usbh_hub_driver_info = {
.deviceClass = 0x09,
.deviceSubClass = -1,
.deviceProtocol = -1,
.idVendor = -1,
.idProduct = -1,
.ifaceClass = 0x09,
.ifaceSubClass = -1,
.ifaceProtocol = -1
};
const usbh_dev_driver_t usbh_hub_driver = {
.init = hub_init,
.analyze_descriptor = hub_analyze_descriptor,
.poll = hub_poll,
.remove = hub_remove,
.info = &usbh_hub_driver_info
};