diff options
author | Amir Hammad <amir.hammad@hotmail.com> | 2015-04-05 18:54:10 +0200 |
---|---|---|
committer | Amir Hammad <amir.hammad@hotmail.com> | 2015-04-06 19:52:48 +0200 |
commit | f86aacc59c2e1ba483c848f794fce877490ba460 (patch) | |
tree | a5ba2423d05dc4fabfccfd13a2f5957bb32e86d2 /src | |
parent | e31939e22fd87182ef496565eea4c241fb1387f9 (diff) | |
download | secure-hid-f86aacc59c2e1ba483c848f794fce877490ba460.tar.gz secure-hid-f86aacc59c2e1ba483c848f794fce877490ba460.tar.bz2 secure-hid-f86aacc59c2e1ba483c848f794fce877490ba460.zip |
Refactor device drivers: don't use automatic casts
Signed-off-by: Amir Hammad <amir.hammad@hotmail.com>
Diffstat (limited to 'src')
-rw-r--r-- | src/usbh_driver_gp_xbox.c | 10 | ||||
-rw-r--r-- | src/usbh_driver_hid_mouse.c | 10 | ||||
-rw-r--r-- | src/usbh_driver_hub.c | 12 |
3 files changed, 16 insertions, 16 deletions
diff --git a/src/usbh_driver_gp_xbox.c b/src/usbh_driver_gp_xbox.c index 07eab38..9115f0b 100644 --- a/src/usbh_driver_gp_xbox.c +++ b/src/usbh_driver_gp_xbox.c @@ -115,7 +115,7 @@ static void *gp_xbox_init(void *usbh_dev) drvdata->device_id = i; drvdata->endpoint_in_address = 0; drvdata->endpoint_in_toggle = 0; - drvdata->usbh_device = usbh_dev; + drvdata->usbh_device = (usbh_device_t *)usbh_dev; break; } } @@ -128,7 +128,7 @@ static void *gp_xbox_init(void *usbh_dev) */ static bool gp_xbox_analyze_descriptor(void *drvdata, void *descriptor) { - gp_xbox_device_t *gp_xbox = drvdata; + gp_xbox_device_t *gp_xbox = (gp_xbox_device_t *)drvdata; uint8_t desc_type = ((uint8_t *)descriptor)[1]; switch (desc_type) { case USB_DT_CONFIGURATION: @@ -171,7 +171,7 @@ static bool gp_xbox_analyze_descriptor(void *drvdata, void *descriptor) static void parse_data(usbh_device_t *dev) { - gp_xbox_device_t *gp_xbox = dev->drvdata; + gp_xbox_device_t *gp_xbox = (gp_xbox_device_t *)dev->drvdata; uint8_t *packet = gp_xbox->buffer; @@ -266,7 +266,7 @@ static void parse_data(usbh_device_t *dev) static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) { - gp_xbox_device_t *gp_xbox = dev->drvdata; + gp_xbox_device_t *gp_xbox = (gp_xbox_device_t *)dev->drvdata; switch (gp_xbox->state_next) { case STATE_READING_COMPLETE: { @@ -374,7 +374,7 @@ static void gp_xbox_poll(void *drvdata, uint32_t time_curr_us) { (void)time_curr_us; - gp_xbox_device_t *gp_xbox = drvdata; + gp_xbox_device_t *gp_xbox = (gp_xbox_device_t *)drvdata; usbh_device_t *dev = gp_xbox->usbh_device; switch (gp_xbox->state_next) { diff --git a/src/usbh_driver_hid_mouse.c b/src/usbh_driver_hid_mouse.c index 1797cd7..782cac5 100644 --- a/src/usbh_driver_hid_mouse.c +++ b/src/usbh_driver_hid_mouse.c @@ -107,7 +107,7 @@ static void *mouse_init(void *usbh_dev) drvdata->device_id = i; drvdata->endpoint_in_address = 0; drvdata->endpoint_in_toggle = 0; - drvdata->usbh_device = usbh_dev; + drvdata->usbh_device = (usbh_device_t *)usbh_dev; break; } } @@ -120,7 +120,7 @@ static void *mouse_init(void *usbh_dev) */ static bool mouse_analyze_descriptor(void *drvdata, void *descriptor) { - hid_mouse_device_t *mouse = drvdata; + hid_mouse_device_t *mouse = (hid_mouse_device_t *)drvdata; uint8_t desc_type = ((uint8_t *)descriptor)[1]; switch (desc_type) { case USB_DT_CONFIGURATION: @@ -163,7 +163,7 @@ static bool mouse_analyze_descriptor(void *drvdata, void *descriptor) static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) { - hid_mouse_device_t *mouse = dev->drvdata; + hid_mouse_device_t *mouse = (hid_mouse_device_t *)dev->drvdata; switch (mouse->state_next) { case STATE_READING_COMPLETE: { @@ -226,7 +226,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) static void read_mouse_in(void *drvdata) { - hid_mouse_device_t *mouse = drvdata; + hid_mouse_device_t *mouse = (hid_mouse_device_t *)drvdata; usbh_packet_t packet; packet.address = mouse->usbh_device->address; @@ -255,7 +255,7 @@ static void mouse_poll(void *drvdata, uint32_t time_curr_us) { (void)time_curr_us; - hid_mouse_device_t *mouse = drvdata; + hid_mouse_device_t *mouse = (hid_mouse_device_t *)drvdata; usbh_device_t *dev = mouse->usbh_device; switch (mouse->state_next) { case STATE_READING_REQUEST: diff --git a/src/usbh_driver_hub.c b/src/usbh_driver_hub.c index a70e0c0..c8c7ee9 100644 --- a/src/usbh_driver_hub.c +++ b/src/usbh_driver_hub.c @@ -93,7 +93,7 @@ static void *hub_init(void *usbh_dev) drvdata = &hub_device[i];
drvdata->state = 0;
drvdata->ports_num = 0;
- drvdata->device[0] = usbh_dev;
+ drvdata->device[0] = (usbh_device_t *)usbh_dev;
drvdata->busy = 0;
drvdata->endpoint_in_address = 0;
drvdata->endpoint_in_maxpacketsize = 0;
@@ -110,7 +110,7 @@ static void *hub_init(void *usbh_dev) */
static bool hub_analyze_descriptor(void *drvdata, void *descriptor)
{
- hub_device_t *hub = drvdata;
+ hub_device_t *hub = (hub_device_t *)drvdata;
uint8_t desc_type = ((uint8_t *)descriptor)[1];
switch (desc_type) {
case USB_DT_CONFIGURATION:
@@ -165,7 +165,7 @@ static bool hub_analyze_descriptor(void *drvdata, void *descriptor) static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data)
{
//~ usbh_device_t *dev = arg;
- hub_device_t *hub = dev->drvdata;
+ hub_device_t *hub = (hub_device_t *)dev->drvdata;
LOG_PRINTF("\r\nHUB->STATE = %d\r\n", hub->state);
switch (hub->state) {
@@ -744,7 +744,7 @@ static void event(usbh_device_t *dev, usbh_packet_callback_data_t cb_data) static void read_ep1(void *drvdata)
{
- hub_device_t *hub = drvdata;
+ hub_device_t *hub = (hub_device_t *)drvdata;
usbh_packet_t packet;
packet.address = hub->device[0]->address;
@@ -770,7 +770,7 @@ static void read_ep1(void *drvdata) */
static void hub_poll(void *drvdata, uint32_t time_curr_us)
{
- hub_device_t *hub = drvdata;
+ hub_device_t *hub = (hub_device_t *)drvdata;
usbh_device_t *dev = hub->device[0];
hub->time_curr_us = time_curr_us;
@@ -840,7 +840,7 @@ static void hub_poll(void *drvdata, uint32_t time_curr_us) }
static void hub_remove(void *drvdata)
{
- hub_device_t *hub = drvdata;
+ hub_device_t *hub = (hub_device_t *)drvdata;
uint8_t i;
// Call fast... to avoid polling
|