<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Servicing CLASS Requests in custom USB Class driver in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/Servicing-CLASS-Requests-in-custom-USB-Class-driver/m-p/263840#M7885</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm implementing one USB device class driver for one device class which is not supported in the MQX USB stack and I need some advise on how I could service one class request that should eventually return a large data block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll explain myself, this is the situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The response for the class request (in this case &lt;STRONG&gt;GET_CLOCK_FREQUENCIES&lt;/STRONG&gt;, &lt;STRONG&gt;CCID&lt;/STRONG&gt; class) must return one buffer (lets say 120 bytes) which is larger than the control endpoint's buffer (64 bytes).&lt;/LI&gt;&lt;LI&gt;I have one local buffer (let's say 64 bytes) for rendering the class requests responses, but in some cases the buffer is not big enough for accommodating the whole response, so I should generate it by fractions (no problem in doing that, it's easy and I did it before with kind of a states machine in another microcontroller).&lt;/LI&gt;&lt;LI&gt;The platform is a custom design with one MK20DN512VLK10. The IDE is CW 10.4, USB Stack 4.0.2, and MQX 4.0.2.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When looking with one USB analyzer at how the drivers return the response for the standard &lt;STRONG&gt;GET_DESCRIPTOR( CONFIGURATION )&lt;/STRONG&gt; request, It can be seen that the response is automatically divided. The total length for the &lt;STRONG&gt;CONFIGURATION&lt;/STRONG&gt; descriptor is 93 bytes (for my application) and is divided in two consecutive &lt;STRONG&gt;IN&lt;/STRONG&gt; transactions (see the picture below, the four transactions involved in the request execution are boxed, NAKed transactions were filtered out).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kinetis-usb-getdesc-01.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/40912i957718E40DA3B31B/image-size/large?v=v2&amp;amp;px=999" role="button" title="kinetis-usb-getdesc-01.png" alt="kinetis-usb-getdesc-01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The question is, How/where could I link my USB class driver into the USB framework so I can get notified of the IN transactions to generate the response to be sent in the DATA packets? My intention is being able to prepare the first part of the response in my local buffer and send it as part of the work in the class's &lt;STRONG&gt;OtherRequests&lt;/STRONG&gt; event handler, then, in the processing of subsequent &lt;STRONG&gt;IN&lt;/STRONG&gt; transactions, continue preparing/sending the rest of the response. I need to avoid using &lt;STRONG&gt;malloc()&lt;/STRONG&gt; and &lt;STRONG&gt;free()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Victor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 04 Oct 2013 05:41:20 GMT</pubDate>
    <dc:creator>VictorLorenzo</dc:creator>
    <dc:date>2013-10-04T05:41:20Z</dc:date>
    <item>
      <title>Servicing CLASS Requests in custom USB Class driver</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/Servicing-CLASS-Requests-in-custom-USB-Class-driver/m-p/263840#M7885</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm implementing one USB device class driver for one device class which is not supported in the MQX USB stack and I need some advise on how I could service one class request that should eventually return a large data block.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'll explain myself, this is the situation:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The response for the class request (in this case &lt;STRONG&gt;GET_CLOCK_FREQUENCIES&lt;/STRONG&gt;, &lt;STRONG&gt;CCID&lt;/STRONG&gt; class) must return one buffer (lets say 120 bytes) which is larger than the control endpoint's buffer (64 bytes).&lt;/LI&gt;&lt;LI&gt;I have one local buffer (let's say 64 bytes) for rendering the class requests responses, but in some cases the buffer is not big enough for accommodating the whole response, so I should generate it by fractions (no problem in doing that, it's easy and I did it before with kind of a states machine in another microcontroller).&lt;/LI&gt;&lt;LI&gt;The platform is a custom design with one MK20DN512VLK10. The IDE is CW 10.4, USB Stack 4.0.2, and MQX 4.0.2.&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When looking with one USB analyzer at how the drivers return the response for the standard &lt;STRONG&gt;GET_DESCRIPTOR( CONFIGURATION )&lt;/STRONG&gt; request, It can be seen that the response is automatically divided. The total length for the &lt;STRONG&gt;CONFIGURATION&lt;/STRONG&gt; descriptor is 93 bytes (for my application) and is divided in two consecutive &lt;STRONG&gt;IN&lt;/STRONG&gt; transactions (see the picture below, the four transactions involved in the request execution are boxed, NAKed transactions were filtered out).&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kinetis-usb-getdesc-01.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/40912i957718E40DA3B31B/image-size/large?v=v2&amp;amp;px=999" role="button" title="kinetis-usb-getdesc-01.png" alt="kinetis-usb-getdesc-01.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The question is, How/where could I link my USB class driver into the USB framework so I can get notified of the IN transactions to generate the response to be sent in the DATA packets? My intention is being able to prepare the first part of the response in my local buffer and send it as part of the work in the class's &lt;STRONG&gt;OtherRequests&lt;/STRONG&gt; event handler, then, in the processing of subsequent &lt;STRONG&gt;IN&lt;/STRONG&gt; transactions, continue preparing/sending the rest of the response. I need to avoid using &lt;STRONG&gt;malloc()&lt;/STRONG&gt; and &lt;STRONG&gt;free()&lt;/STRONG&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks a lot in advance,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;--Victor&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 04 Oct 2013 05:41:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/Servicing-CLASS-Requests-in-custom-USB-Class-driver/m-p/263840#M7885</guid>
      <dc:creator>VictorLorenzo</dc:creator>
      <dc:date>2013-10-04T05:41:20Z</dc:date>
    </item>
  </channel>
</rss>

