Patch for USB

ChibiOS public support forum for topics related to the micro-controllers based on MIPS32 cores.
Post Reply
etmatrix
Posts: 46
Joined: Sun Oct 21, 2012 10:05 pm

Patch for USB

Post by etmatrix »

Hi Dmytro

Giovanni help me to resolve a problem with my project Dual USB CDC, with some patches. One patch has changed the usb_lld template and his test archictecture STM32. I replicated it on MIPS-PIC32. Could you submit in your repository?

Code: Select all

diff --git a/os/hal/platforms/MIPS-PIC32MX/usb_lld.h b/os/hal/platforms/MIPS-PIC32MX/usb_lld.h
index 1d88784..b855762 100644
--- a/os/hal/platforms/MIPS-PIC32MX/usb_lld.h
+++ b/os/hal/platforms/MIPS-PIC32MX/usb_lld.h
@@ -274,6 +274,20 @@ struct USBDriver {
    */
   const USBEndpointConfig       *epc[USB_MAX_ENDPOINTS + 1];
   /**
+   * @brief   Fields available to user, it can be used to associate an
+   *          application-defined handler to an IN endpoint.
+   * @note    The base index is one, the endpoint zero does not have a
+   *          reserved element in this array.
+   */
+  void                          *in_params[USB_MAX_ENDPOINTS];
+  /**
+   * @brief   Fields available to user, it can be used to associate an
+   *          application-defined handler to an OUT endpoint.
+   * @note    The base index is one, the endpoint zero does not have a
+   *          reserved element in this array.
+   */
+  void                          *out_params[USB_MAX_ENDPOINTS];
+  /**
    * @brief   Endpoint 0 state.
    */
   usbep0state_t                 ep0state;


Thank you
Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: Patch for USB

Post by Dmytro »

Hi Etmatrix,
It's clear that current HAL infrastructure is suffering from code duplication =/. Hope this gonna change with 3.0.
Anyway, I'll submit the patch, np.

regards,
~ dmytro
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Patch for USB

Post by Giovanni »

Code duplication? do you mean the common part of the driver structures?

Giovanni
Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: Patch for USB

Post by Dmytro »

Hi Giovanni,
Giovanni wrote:Code duplication? do you mean the common part of the driver structures?

Yes, exactly. I tried to solve it in a non-intrusive way within current infrastructure. You may take a look at DMA driver.

cheers,
~ dmytro
Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: Patch for USB

Post by Dmytro »

I merged the master and pushed correction for usb LLD.
BTW, seems likes os/hal/platforms/STM32/USBv1/usb_lld.h was not updated correctly. Also I see that most of the demos push USB driver instance to sduConfigureHookI.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Patch for USB

Post by Giovanni »

That's odd, I see them all updated and that low level driver has the new fields, revision 5657.

Giovanni
Dmytro
Posts: 98
Joined: Sun Oct 07, 2012 11:49 am

Re: Patch for USB

Post by Dmytro »

Giovanni wrote:That's odd, I see them all updated and that low level driver has the new fields, revision 5657.

Giovanni

They all have new fields but os/hal/platforms/STM32/USBv1/usb_lld.h still has obsolete 'param' field.
Also demos/ARMCM4-STM32F407-DISCOVERY-MEMS/usbcfg.c and testhal/STM32F1xx/RTC_FATTIME/main.c still push usbp to sduConfigureHookI.
User avatar
Giovanni
Site Admin
Posts: 14891
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: Patch for USB

Post by Giovanni »

Thanks, fixed.

Giovanni
Post Reply