summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAmir Hammad <amir.hammad@hotmail.com>2016-07-08 23:20:16 +0200
committerAmir Hammad <amir.hammad@hotmail.com>2016-07-08 23:22:53 +0200
commite61ed66174df0bf889586c757aa6a9d23d9401c0 (patch)
tree7b7b2d030f94fa2967d8ac960ae450e4fe8bfc5f /src
parent27fe98f2d60d28153dfc10452b40664fc1e2ac66 (diff)
downloadsecure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.tar.gz
secure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.tar.bz2
secure-hid-e61ed66174df0bf889586c757aa6a9d23d9401c0.zip
refactor: use enum instead of #define: USBH_ENDPOINT_TYPE and USBH_SPEED
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/usbh_driver_ac_midi.c4
-rw-r--r--src/usbh_driver_gp_xbox.c2
-rw-r--r--src/usbh_driver_hid_mouse.c2
-rw-r--r--src/usbh_driver_hub.c2
-rw-r--r--src/usbh_hubbed.c4
-rw-r--r--src/usbh_lld_stm32f4.c24
6 files changed, 19 insertions, 19 deletions
diff --git a/src/usbh_driver_ac_midi.c b/src/usbh_driver_ac_midi.c
index 65c7617..c5403d2 100644
--- a/src/usbh_driver_ac_midi.c
+++ b/src/usbh_driver_ac_midi.c
@@ -246,7 +246,7 @@ static void read_midi_in(void *drvdata, const uint8_t nextstate)
packet.datalen = midi->endpoint_in_maxpacketsize;
packet.endpoint_address = midi->endpoint_in_address;
packet.endpoint_size_max = midi->endpoint_in_maxpacketsize;
- packet.endpoint_type = USBH_EPTYP_BULK;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_BULK;
packet.speed = midi->usbh_device->speed;
packet.callback = event;
packet.callback_arg = midi->usbh_device;
@@ -367,7 +367,7 @@ void usbh_midi_write(uint8_t device_id, const void *data, uint32_t length, midi_
midi->write_packet.address = dev->address;
midi->write_packet.endpoint_address = midi->endpoint_out_address;
midi->write_packet.endpoint_size_max = midi->endpoint_out_maxpacketsize;
- midi->write_packet.endpoint_type = USBH_EPTYP_BULK;
+ midi->write_packet.endpoint_type = USBH_ENDPOINT_TYPE_BULK;
midi->write_packet.speed = dev->speed;
midi->write_packet.callback = write_callback;
midi->write_packet.callback_arg = midi->usbh_device;
diff --git a/src/usbh_driver_gp_xbox.c b/src/usbh_driver_gp_xbox.c
index ae478ad..d8bb1b2 100644
--- a/src/usbh_driver_gp_xbox.c
+++ b/src/usbh_driver_gp_xbox.c
@@ -330,7 +330,7 @@ static void read_gp_xbox_in(gp_xbox_device_t *gp_xbox)
packet.datalen = gp_xbox->endpoint_in_maxpacketsize;
packet.endpoint_address = gp_xbox->endpoint_in_address;
packet.endpoint_size_max = gp_xbox->endpoint_in_maxpacketsize;
- packet.endpoint_type = USBH_EPTYP_INTERRUPT;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_INTERRUPT;
packet.speed = gp_xbox->usbh_device->speed;
packet.callback = event;
packet.callback_arg = gp_xbox->usbh_device;
diff --git a/src/usbh_driver_hid_mouse.c b/src/usbh_driver_hid_mouse.c
index 56278ef..8324999 100644
--- a/src/usbh_driver_hid_mouse.c
+++ b/src/usbh_driver_hid_mouse.c
@@ -218,7 +218,7 @@ static void read_mouse_in(void *drvdata)
packet.datalen = mouse->endpoint_in_maxpacketsize;
packet.endpoint_address = mouse->endpoint_in_address;
packet.endpoint_size_max = mouse->endpoint_in_maxpacketsize;
- packet.endpoint_type = USBH_EPTYP_INTERRUPT;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_INTERRUPT;
packet.speed = mouse->usbh_device->speed;
packet.callback = event;
packet.callback_arg = mouse->usbh_device;
diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c
index 305a8f3..eaaf896 100644
--- a/src/usbh_driver_hub.c
+++ b/src/usbh_driver_hub.c
@@ -751,7 +751,7 @@ static void read_ep1(void *drvdata)
packet.datalen = hub->endpoint_in_maxpacketsize;
packet.endpoint_address = hub->endpoint_in_address;
packet.endpoint_size_max = hub->endpoint_in_maxpacketsize;
- packet.endpoint_type = USBH_EPTYP_INTERRUPT;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_INTERRUPT;
packet.speed = hub->device[0]->speed;
packet.callback = event;
packet.callback_arg = hub->device[0];
diff --git a/src/usbh_hubbed.c b/src/usbh_hubbed.c
index 7391232..b631263 100644
--- a/src/usbh_hubbed.c
+++ b/src/usbh_hubbed.c
@@ -207,7 +207,7 @@ void device_xfer_control_write(void *data, uint16_t datalen, usbh_packet_callbac
packet.address = dev->address;
packet.endpoint_address = 0;
packet.endpoint_size_max = dev->packet_size_max0;
- packet.endpoint_type = USBH_EPTYP_CONTROL;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_CONTROL;
packet.speed = dev->speed;
packet.callback = callback;
packet.callback_arg = dev;
@@ -226,7 +226,7 @@ void device_xfer_control_read(void *data, uint16_t datalen, usbh_packet_callback
packet.address = dev->address;
packet.endpoint_address = 0;
packet.endpoint_size_max = dev->packet_size_max0;
- packet.endpoint_type = USBH_EPTYP_CONTROL;
+ packet.endpoint_type = USBH_ENDPOINT_TYPE_CONTROL;
packet.speed = dev->speed;
packet.callback = callback;
packet.callback_arg = dev;
diff --git a/src/usbh_lld_stm32f4.c b/src/usbh_lld_stm32f4.c
index 49f6cc2..271943a 100644
--- a/src/usbh_lld_stm32f4.c
+++ b/src/usbh_lld_stm32f4.c
@@ -153,18 +153,18 @@ static void stm32f4_usbh_port_channel_setup(
// TODO: maybe to function
switch (eptyp) {
- case USBH_EPTYP_CONTROL:
+ case USBH_ENDPOINT_TYPE_CONTROL:
eptyp = OTG_HCCHAR_EPTYP_CONTROL;
break;
- case USBH_EPTYP_BULK:
+ case USBH_ENDPOINT_TYPE_BULK:
eptyp = OTG_HCCHAR_EPTYP_BULK;
break;
- case USBH_EPTYP_INTERRUPT:
+ case USBH_ENDPOINT_TYPE_INTERRUPT:
// Use bulk transfer also for interrupt, since no difference is on protocol layer
// Except different behaviour of the core
eptyp = OTG_HCCHAR_EPTYP_BULK;
break;
- case USBH_EPTYP_ISOCHRONOUS:
+ case USBH_ENDPOINT_TYPE_ISOCHRONOUS:
eptyp = OTG_HCCHAR_EPTYP_ISOCHRONOUS;
break;
default:
@@ -260,16 +260,16 @@ static void write(void *drvdata, const usbh_packet_t *packet)
channels[channel].packet = *packet;
uint32_t dpid;
- if (packet->endpoint_type == USBH_EPTYP_CONTROL) {
+ if (packet->endpoint_type == USBH_ENDPOINT_TYPE_CONTROL) {
dpid = OTG_HCTSIZ_DPID_MDATA;
packet->toggle[0] = 0;
- } else if(packet->endpoint_type == USBH_EPTYP_INTERRUPT) {
+ } else if(packet->endpoint_type == USBH_ENDPOINT_TYPE_INTERRUPT) {
if (packet->toggle[0]) {
dpid = OTG_HCTSIZ_DPID_DATA1;
} else {
dpid = OTG_HCTSIZ_DPID_DATA0;
}
- } else if (packet->endpoint_type == USBH_EPTYP_BULK) {
+ } else if (packet->endpoint_type == USBH_ENDPOINT_TYPE_BULK) {
if (packet->toggle[0]) {
dpid = OTG_HCTSIZ_DPID_DATA1;
} else {
@@ -295,8 +295,8 @@ static void write(void *drvdata, const usbh_packet_t *packet)
OTG_HCCHAR_EPDIR_OUT,
packet->endpoint_size_max);
- if (packet->endpoint_type == USBH_EPTYP_CONTROL ||
- packet->endpoint_type == USBH_EPTYP_BULK) {
+ if (packet->endpoint_type == USBH_ENDPOINT_TYPE_CONTROL ||
+ packet->endpoint_type == USBH_ENDPOINT_TYPE_BULK) {
volatile uint32_t *fifo = &REBASE_CH(OTG_FIFO, channel) + RX_FIFO_SIZE;
const uint32_t * buf32 = packet->data;
@@ -517,7 +517,7 @@ static enum USBH_POLL_STATUS poll_run(usbh_lld_stm32f4_driver_data_t *dev)
if (hcint & OTG_HCINT_ACK) {
REBASE_CH(OTG_HCINT, channel) = OTG_HCINT_ACK;
LOG_PRINTF("ACK");
- if (eptyp == USBH_EPTYP_CONTROL) {
+ if (eptyp == USBH_ENDPOINT_TYPE_CONTROL) {
channels[channel].packet.toggle[0] = 1;
} else {
channels[channel].packet.toggle[0] ^= 1;
@@ -597,7 +597,7 @@ static enum USBH_POLL_STATUS poll_run(usbh_lld_stm32f4_driver_data_t *dev)
if (hcint & OTG_HCINT_NAK) {
REBASE_CH(OTG_HCINT, channel) = OTG_HCINT_NAK;
- if (eptyp == USBH_EPTYP_CONTROL) {
+ if (eptyp == USBH_ENDPOINT_TYPE_CONTROL) {
LOG_PRINTF("NAK");
}
@@ -972,7 +972,7 @@ static void channels_init(void *drvdata)
* Get speed of connected device
*
*/
-static uint8_t root_speed(void *drvdata)
+static enum USBH_SPEED root_speed(void *drvdata)
{
usbh_lld_stm32f4_driver_data_t *dev = drvdata;
(void)dev;