<?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>LPC MicrocontrollersのトピックHID ROM API, Documentation?</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/HID-ROM-API-Documentation/m-p/585824#M21321</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mch0 on Sat Jun 07 02:40:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have just implemented a first HID generic project, starting with the sample project in LPCOpen 2.12.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It does work, yet I feel I do not understand all that is going on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have right now three sources for documentation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- the UM, section 26 (USB API)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the LPCOpen v2.12 online documentation (USBD ROM STACK)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the source code of the USB example projects&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an additional documentation I could read? I did look at the FAQ and also did y keyword search at the forums.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sample questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The UM suggest a 2048 byte alignment for the memory area handed to the USB stack.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(Table 592, init).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The source code has a comment about 4096 byte alignment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(File app_usbd_cgf.h)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The UM suggest one should/could use get_memsize() to determine actual memory requirements, the source code never wants to know, it assumes obviously 8192 bytes are sufficient for everything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The source code seems to use the same memory area (0x20000000+) for both hw_init() and hid_init(), although I would have thought these are two different modules wich would require private memory spaces each.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore, in the generic example, the code uses part of this space for its own purpose:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* allocate USB accessable memory space for report data */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;loopback_report =&amp;nbsp; (uint8_t *) hid_param.mem_base;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hid_param.mem_base += 4;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hid_param.mem_size += 4;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* update memory variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*mem_base = hid_param.mem_base;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*mem_size = hid_param.mem_size;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I know from the documentation that the ROM drivers don't miss the space?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The +=4&amp;nbsp; in the code above looks like one would tell the HID driver(s) about the "missing" 4 bytes, now used for the loopback_report, but this really looks suspicious to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Even more, now the size has increased (second line)? It anything, I would have decremented by 4, since I just cut off the first 4 bytes of the original buffer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my first try the HID_Ep_Hdlr() never got called, although the host was sending IN tokens.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually by looking at the mouse-example one has to queue an IN report first and the handler gets called when that report has been sent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK so far, but I would have expected to be notified of NAKIN-events as well. Can I enable these somewhere?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation says the drivers use a zero-copy model. This would be fine, but I get the impression that the function USBD_API-&amp;gt;hw-&amp;gt;WriteEP() actually does not save a pointer but copy data. At least a test suggested that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore I assume there is no queueing of reports, i.e. I can prepare one report only and when that has been sent I get notified (ISR) to copy data for the next event. Hopefully before the host sends the next IN token if I want to avoid performance degrading NAKINs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really do appreciate the ROM drivers, since the last time I built the whole mess (USB enumeration) from scratch which took 6 month. This time it was 2 hours until success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I feel the documentation I have at hand leaves some questions open - I'm willing to read more for a better understanding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 20:26:12 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T20:26:12Z</dc:date>
    <item>
      <title>HID ROM API, Documentation?</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/HID-ROM-API-Documentation/m-p/585824#M21321</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by mch0 on Sat Jun 07 02:40:22 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have just implemented a first HID generic project, starting with the sample project in LPCOpen 2.12.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It does work, yet I feel I do not understand all that is going on.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I have right now three sources for documentation:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;- the UM, section 26 (USB API)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the LPCOpen v2.12 online documentation (USBD ROM STACK)&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;- the source code of the USB example projects&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there an additional documentation I could read? I did look at the FAQ and also did y keyword search at the forums.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sample questions:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The UM suggest a 2048 byte alignment for the memory area handed to the USB stack.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(Table 592, init).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The source code has a comment about 4096 byte alignment.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;(File app_usbd_cgf.h)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The UM suggest one should/could use get_memsize() to determine actual memory requirements, the source code never wants to know, it assumes obviously 8192 bytes are sufficient for everything.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The source code seems to use the same memory area (0x20000000+) for both hw_init() and hid_init(), although I would have thought these are two different modules wich would require private memory spaces each.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore, in the generic example, the code uses part of this space for its own purpose:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/* allocate USB accessable memory space for report data */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;loopback_report =&amp;nbsp; (uint8_t *) hid_param.mem_base;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hid_param.mem_base += 4;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;hid_param.mem_size += 4;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;/* update memory variables */&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*mem_base = hid_param.mem_base;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;*mem_size = hid_param.mem_size;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;How can I know from the documentation that the ROM drivers don't miss the space?&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The +=4&amp;nbsp; in the code above looks like one would tell the HID driver(s) about the "missing" 4 bytes, now used for the loopback_report, but this really looks suspicious to me.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Even more, now the size has increased (second line)? It anything, I would have decremented by 4, since I just cut off the first 4 bytes of the original buffer?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;3. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;In my first try the HID_Ep_Hdlr() never got called, although the host was sending IN tokens.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Actually by looking at the mouse-example one has to queue an IN report first and the handler gets called when that report has been sent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;OK so far, but I would have expected to be notified of NAKIN-events as well. Can I enable these somewhere?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;4. &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation says the drivers use a zero-copy model. This would be fine, but I get the impression that the function USBD_API-&amp;gt;hw-&amp;gt;WriteEP() actually does not save a pointer but copy data. At least a test suggested that.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Furthermore I assume there is no queueing of reports, i.e. I can prepare one report only and when that has been sent I get notified (ISR) to copy data for the next event. Hopefully before the host sends the next IN token if I want to avoid performance degrading NAKINs?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I really do appreciate the ROM drivers, since the last time I built the whole mess (USB enumeration) from scratch which took 6 month. This time it was 2 hours until success.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;But I feel the documentation I have at hand leaves some questions open - I'm willing to read more for a better understanding.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Best regards,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Mike&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 20:26:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/HID-ROM-API-Documentation/m-p/585824#M21321</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T20:26:12Z</dc:date>
    </item>
  </channel>
</rss>

