Patch for USB

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

Patch for USB

Postby etmatrix » Thu May 02, 2013 5:15 pm

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

Postby Dmytro » Thu May 02, 2013 6:37 pm

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: 14496
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1090 times
Been thanked: 932 times
Contact:

Re: Patch for USB

Postby Giovanni » Thu May 02, 2013 7:12 pm

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

Postby Dmytro » Thu May 02, 2013 8:00 pm

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

Postby Dmytro » Thu May 02, 2013 8:29 pm

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: 14496
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1090 times
Been thanked: 932 times
Contact:

Re: Patch for USB

Postby Giovanni » Thu May 02, 2013 9:30 pm

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

Postby Dmytro » Thu May 02, 2013 9:47 pm

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: 14496
Joined: Wed May 27, 2009 8:48 am
Location: Salerno, Italy
Has thanked: 1090 times
Been thanked: 932 times
Contact:

Re: Patch for USB

Postby Giovanni » Fri May 03, 2013 7:41 am

Thanks, fixed.

Giovanni


Return to “MIPS32 Support”

Who is online

Users browsing this forum: No registered users and 1 guest