aboutsummaryrefslogtreecommitdiffstats
path: root/os/hal/src/usbh/hal_usbh_ftdi.c
diff options
context:
space:
mode:
authorDiego Ismirlian <dismirlian (at) google's mail.com>2017-06-05 10:18:45 -0300
committerDiego Ismirlian <dismirlian (at) google's mail.com>2017-06-05 10:18:45 -0300
commit5ecaf7722b5f1f9d0c41213fc5c129b451302f99 (patch)
tree4a4e2b746d6db725e3aacf8ff87e1a3a88e3dd4e /os/hal/src/usbh/hal_usbh_ftdi.c
parenteec17ec12e23b7f647d37a8d70df4df34632f8c1 (diff)
downloadChibiOS-Contrib-5ecaf7722b5f1f9d0c41213fc5c129b451302f99.tar.gz
ChibiOS-Contrib-5ecaf7722b5f1f9d0c41213fc5c129b451302f99.tar.bz2
ChibiOS-Contrib-5ecaf7722b5f1f9d0c41213fc5c129b451302f99.zip
USB Host fixes
- Cleaned up alignment macros for GCC & IAR - Corrected EP halt and Clear halt behaviours - Initialization of class drivers by USB Host main driver - Minor cosmetic fixes - Updated USB_HOST testhal app
Diffstat (limited to 'os/hal/src/usbh/hal_usbh_ftdi.c')
-rw-r--r--os/hal/src/usbh/hal_usbh_ftdi.c18
1 files changed, 13 insertions, 5 deletions
diff --git a/os/hal/src/usbh/hal_usbh_ftdi.c b/os/hal/src/usbh/hal_usbh_ftdi.c
index 4bd7296..12ed0f9 100644
--- a/os/hal/src/usbh/hal_usbh_ftdi.c
+++ b/os/hal/src/usbh/hal_usbh_ftdi.c
@@ -16,7 +16,6 @@
*/
#include "hal.h"
-#include "hal_usbh.h"
#if HAL_USBH_USE_FTDI
@@ -114,8 +113,7 @@ static usbh_baseclassdriver_t *_ftdi_load(usbh_device_t *dev, const uint8_t *des
if ((rem < descriptor[0]) || (descriptor[1] != USBH_DT_INTERFACE))
return NULL;
- const usbh_interface_descriptor_t * const ifdesc = (const usbh_interface_descriptor_t * const)descriptor;
- if (ifdesc->bInterfaceNumber != 0) {
+ if (((const usbh_interface_descriptor_t *)descriptor)->bInterfaceNumber != 0) {
uwarn("FTDI: Will allocate driver along with IF #0");
}
@@ -324,7 +322,7 @@ static usbh_urbstatus_t _ftdi_port_control(USBHFTDIPortDriver *ftdipp,
osalDbgCheck(bRequest < sizeof_array(bmRequestType));
osalDbgCheck(bRequest != 1);
- const USBH_DEFINE_BUFFER(usbh_control_request_t, req) = {
+ USBH_DEFINE_BUFFER(const usbh_control_request_t req) = {
bmRequestType[bRequest],
bRequest,
wValue,
@@ -387,7 +385,7 @@ static usbh_urbstatus_t _set_baudrate(USBHFTDIPortDriver *ftdipp, uint32_t baudr
if (ftdipp->ftdip->dev->basicConfigDesc.bNumInterfaces > 1)
wIndex = (wIndex << 8) | (ftdipp->ifnum + 1);
- const USBH_DEFINE_BUFFER(usbh_control_request_t, req) = {
+ USBH_DEFINE_BUFFER(const usbh_control_request_t req) = {
USBH_REQTYPE_VENDOR | USBH_REQTYPE_OUT | USBH_REQTYPE_DEVICE,
FTDI_COMMAND_SETBAUD,
wValue,
@@ -714,4 +712,14 @@ void usbhftdipObjectInit(USBHFTDIPortDriver *ftdipp) {
ftdipp->state = USBHFTDIP_STATE_STOP;
}
+void usbhftdiInit(void) {
+ uint8_t i;
+ for (i = 0; i < HAL_USBHFTDI_MAX_INSTANCES; i++) {
+ usbhftdiObjectInit(&USBHFTDID[i]);
+ }
+ for (i = 0; i < HAL_USBHFTDI_MAX_PORTS; i++) {
+ usbhftdipObjectInit(&FTDIPD[i]);
+ }
+}
+
#endif