a00062_source.html 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  2. <html xmlns="http://www.w3.org/1999/xhtml">
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
  5. <meta http-equiv="X-UA-Compatible" content="IE=9"/>
  6. <meta name="generator" content="Doxygen 1.8.13"/>
  7. <meta name="viewport" content="width=device-width, initial-scale=1"/>
  8. <title>Lightweight USB stack: usb_dfu.h Source File</title>
  9. <link href="../../tabs.css" rel="stylesheet" type="text/css"/>
  10. <script type="text/javascript" src="../../jquery.js"></script>
  11. <script type="text/javascript" src="../../dynsections.js"></script>
  12. <link href="../../navtree.css" rel="stylesheet" type="text/css"/>
  13. <script type="text/javascript" src="../../resize.js"></script>
  14. <script type="text/javascript" src="../../navtreedata.js"></script>
  15. <script type="text/javascript" src="../../navtree.js"></script>
  16. <script type="text/javascript">
  17. $(document).ready(initResizable);
  18. </script>
  19. <link href="../../search/search.css" rel="stylesheet" type="text/css"/>
  20. <script type="text/javascript" src="../../search/searchdata.js"></script>
  21. <script type="text/javascript" src="../../search/search.js"></script>
  22. <link href="../../doxygen.css" rel="stylesheet" type="text/css" />
  23. </head>
  24. <body>
  25. <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
  26. <div id="titlearea">
  27. <table cellspacing="0" cellpadding="0">
  28. <tbody>
  29. <tr style="height: 56px;">
  30. <td id="projectalign" style="padding-left: 0.5em;">
  31. <div id="projectname">Lightweight USB stack
  32. &#160;<span id="projectnumber">1.0</span>
  33. </div>
  34. </td>
  35. </tr>
  36. </tbody>
  37. </table>
  38. </div>
  39. <!-- end header part -->
  40. <!-- Generated by Doxygen 1.8.13 -->
  41. <script type="text/javascript">
  42. var searchBox = new SearchBox("searchBox", "../../search",false,'Search');
  43. </script>
  44. <script type="text/javascript" src="../../menudata.js"></script>
  45. <script type="text/javascript" src="../../menu.js"></script>
  46. <script type="text/javascript">
  47. $(function() {
  48. initMenu('../../',true,false,'search.php','Search');
  49. $(document).ready(function() { init_search(); });
  50. });
  51. </script>
  52. <div id="main-nav"></div>
  53. </div><!-- top -->
  54. <div id="side-nav" class="ui-resizable side-nav-resizable">
  55. <div id="nav-tree">
  56. <div id="nav-tree-contents">
  57. <div id="nav-sync" class="sync"></div>
  58. </div>
  59. </div>
  60. <div id="splitbar" style="-moz-user-select:none;"
  61. class="ui-resizable-handle">
  62. </div>
  63. </div>
  64. <script type="text/javascript">
  65. $(document).ready(function(){initNavTree('df/d03/a00062_source.html','../../');});
  66. </script>
  67. <div id="doc-content">
  68. <!-- window showing the filter options -->
  69. <div id="MSearchSelectWindow"
  70. onmouseover="return searchBox.OnSearchSelectShow()"
  71. onmouseout="return searchBox.OnSearchSelectHide()"
  72. onkeydown="return searchBox.OnSearchSelectKey(event)">
  73. </div>
  74. <!-- iframe showing the search results (closed by default) -->
  75. <div id="MSearchResultsWindow">
  76. <iframe src="javascript:void(0)" frameborder="0"
  77. name="MSearchResults" id="MSearchResults">
  78. </iframe>
  79. </div>
  80. <div class="header">
  81. <div class="headertitle">
  82. <div class="title">usb_dfu.h</div> </div>
  83. </div><!--header-->
  84. <div class="contents">
  85. <div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers</span></div><div class="line"><a name="l00002"></a><span class="lineno"> 2</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00003"></a><span class="lineno"> 3</span>&#160;<span class="comment"> * Copyright ©2016 Dmitry Filimonchuk &lt;dmitrystu[at]gmail[dot]com&gt;</span></div><div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment"> *</span></div><div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment"> * Licensed under the Apache License, Version 2.0 (the &quot;License&quot;);</span></div><div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment"> * you may not use this file except in compliance with the License.</span></div><div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment"> * You may obtain a copy of the License at</span></div><div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment"> * http://www.apache.org/licenses/LICENSE-2.0</span></div><div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"> * Unless required by applicable law or agreed to in writing, software</span></div><div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment"> * distributed under the License is distributed on an &quot;AS IS&quot; BASIS,</span></div><div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment"> * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.</span></div><div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"> * See the License for the specific language governing permissions and</span></div><div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment"> * limitations under the License.</span></div><div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment"> */</span></div><div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;</div><div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="preprocessor">#ifndef _USB_DFU_H_</span></div><div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="preprocessor">#define _USB_DFU_H_</span></div><div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;</div><div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor">#if defined(__cplusplus)</span></div><div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160; <span class="keyword">extern</span> <span class="stringliteral">&quot;C&quot;</span> {</div><div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;</div><div class="line"><a name="l00032"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga2cc8ab485b0707e0a207199b41b2b26f"> 32</a></span>&#160;<span class="preprocessor">#define USB_CLASS_DFU 0xFE </span></div><div class="line"><a name="l00033"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga6f5150400e9777bce9fde0e2265780b7"> 33</a></span>&#160;<span class="preprocessor">#define USB_DFU_SUBCLASS_DFU 0x01 </span></div><div class="line"><a name="l00034"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga16484515b518007fc7bff87f4a722359"> 34</a></span>&#160;<span class="preprocessor">#define USB_DFU_PROTO_RUNTIME 0x01 </span></div><div class="line"><a name="l00035"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga0d4aebf6881d083cfb358e142861cb08"> 35</a></span>&#160;<span class="preprocessor">#define USB_DFU_PROTO_DFU 0x02 </span></div><div class="line"><a name="l00039"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga00c1235b376fe41401faac08a2afc1e5"> 39</a></span>&#160;<span class="preprocessor">#define USB_DTYPE_DFU_FUNCTIONAL 0x21 </span></div><div class="line"><a name="l00043"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#gab76be710887a0f98892183e2373afaa2"> 43</a></span>&#160;<span class="preprocessor">#define USB_DFU_DETACH 0x00 </span></div><div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="preprocessor">#define USB_DFU_DNLOAD 0x01 </span></div><div class="line"><a name="l00046"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga88abf5a9495158487fe4940e4aac1c92"> 46</a></span>&#160;<span class="preprocessor">#define USB_DFU_UPLOAD 0x02 </span></div><div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="preprocessor">#define USB_DFU_GETSTATUS 0x03 </span></div><div class="line"><a name="l00050"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga1c8d801bcbef1f29e958b5a6325af5bd"> 50</a></span>&#160;<span class="preprocessor">#define USB_DFU_CLRSTATUS 0x04 </span></div><div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor">#define USB_DFU_GETSTATE 0x05 </span></div><div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor">#define USB_DFU_ABORT 0x06 </span></div><div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="preprocessor">#define USB_DFU_ATTR_WILL_DETACH 0x08 </span></div><div class="line"><a name="l00063"></a><span class="lineno"> 63</span>&#160;<span class="preprocessor">#define USB_DFU_ATTR_MANIF_TOL 0x04 </span></div><div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor">#define USB_DFU_ATTR_CAN_UPLOAD 0x02 </span></div><div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="preprocessor">#define USB_DFU_ATTR_CAN_DNLOAD 0x01 </span></div><div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_OK 0x00 </span></div><div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_TARGET 0x01 </span></div><div class="line"><a name="l00073"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga40264d92194b790a6b285c1aefa0cc3c"> 73</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_FILE 0x02 </span></div><div class="line"><a name="l00075"></a><span class="lineno"> 75</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_WRITE 0x03 </span></div><div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_ERASE 0x04 </span></div><div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_CHECK_ERASED 0x05 </span></div><div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_PROG 0x06 </span></div><div class="line"><a name="l00079"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga16ed86c3a720e4bf14b14c79e4ab6cdd"> 79</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_VERIFY 0x07 </span></div><div class="line"><a name="l00080"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#gaca68ab323ffb52c795400920565aef28"> 80</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_ADDRESS 0x08 </span></div><div class="line"><a name="l00082"></a><span class="lineno"> 82</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_NOTDONE 0x09 </span></div><div class="line"><a name="l00084"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga8c1d9d09df3abd90ac4b272b54418210"> 84</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_FIRMWARE 0x0A </span></div><div class="line"><a name="l00086"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga6216f8f7f7668499ef5543f7787d3a23"> 86</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_VENDOR 0x0B </span></div><div class="line"><a name="l00087"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga153a41805e584facfa693129c8b94daa"> 87</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_USBR 0x0C </span></div><div class="line"><a name="l00088"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga8163fb309be9b5067939e67255b933c3"> 88</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_POR 0x0D </span></div><div class="line"><a name="l00089"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga8e4f99bb43e010ad679904facc3eac98"> 89</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_UNKNOWN 0x0E </span></div><div class="line"><a name="l00091"></a><span class="lineno"> 91</span>&#160;<span class="preprocessor">#define USB_DFU_STATUS_ERR_STALLEDPKT 0x0F </span></div><div class="line"><a name="l00096"></a><span class="lineno"> 96</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_APP_IDLE 0x00 </span></div><div class="line"><a name="l00097"></a><span class="lineno"> 97</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_APP_DETACH 0x01 </span></div><div class="line"><a name="l00100"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga30076dc69e9f56923f80a74825dd98b6"> 100</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_IDLE 0x02 </span></div><div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_DNLOADSYNC 0x03 </span></div><div class="line"><a name="l00104"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga71af18d43b974eb66624496751c36502"> 104</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_DNBUSY 0x04 </span></div><div class="line"><a name="l00106"></a><span class="lineno"> 106</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_DNLOADIDLE 0x05 </span></div><div class="line"><a name="l00108"></a><span class="lineno"> 108</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_MANIFESTSYNC 0x06 </span></div><div class="line"><a name="l00116"></a><span class="lineno"> 116</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_MANIFEST 0x07 </span></div><div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_MANIFESTWR 0x08 </span></div><div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_UPLOADIDLE 0x09 </span></div><div class="line"><a name="l00124"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga5d637f374efc1721191bacd858f374a3"> 124</a></span>&#160;<span class="preprocessor">#define USB_DFU_STATE_DFU_ERROR 0x0A </span></div><div class="line"><a name="l00128"></a><span class="lineno"> 128</span>&#160;<span class="preprocessor">struct usb_dfu_func_desc {</span></div><div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160; uint8_t bLength; </div><div class="line"><a name="l00130"></a><span class="lineno"> 130</span>&#160; uint8_t bDescriptorType; </div><div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160; uint8_t bmAttributes; </div><div class="line"><a name="l00132"></a><span class="lineno"> 132</span>&#160; uint16_t wDetachTimeout; </div><div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160; uint16_t wTransferSize; </div><div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160; uint16_t bcdDFUVersion; </div><div class="line"><a name="l00135"></a><span class="lineno"> 135</span>&#160;}__attribute__((packed));</div><div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;</div><div class="line"><a name="l00138"></a><span class="lineno"> 138</span>&#160;<span class="keyword">struct </span><a class="code" href="../../dc/d31/a00208.html">usb_dfu_status</a> {</div><div class="line"><a name="l00139"></a><span class="lineno"> 139</span>&#160; uint8_t <a class="code" href="../../dc/d31/a00208.html#ad0ba799466a81ce8b879947b7daadf44">bStatus</a>; </div><div class="line"><a name="l00141"></a><span class="lineno"> 141</span>&#160; uint8_t <a class="code" href="../../dc/d31/a00208.html#a7cc72cb082f9a807d664583f963a4d1b">bPollTimeout</a>; </div><div class="line"><a name="l00143"></a><span class="lineno"> 143</span>&#160; uint16_t <a class="code" href="../../dc/d31/a00208.html#a5eb86c5861af3fa2682043c66593ea80">wPollTimeout</a>; </div><div class="line"><a name="l00145"></a><span class="lineno"> 145</span>&#160; uint8_t <a class="code" href="../../dc/d31/a00208.html#a825bc771b0a80cc19a38f7315941500a">bState</a>; </div><div class="line"><a name="l00147"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga49900bfec6a38db33895480875c6edc4"> 147</a></span>&#160; uint8_t <a class="code" href="../../dc/d31/a00208.html#a3fc2826fc009f5871bdb20685870c256">iString</a>; </div><div class="line"><a name="l00148"></a><span class="lineno"> 148</span>&#160;};</div><div class="line"><a name="l00149"></a><span class="lineno"> 149</span>&#160;</div><div class="line"><a name="l00152"></a><span class="lineno"> 152</span>&#160;<span class="preprocessor">#if defined(__cplusplus)</span></div><div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; }</div><div class="line"><a name="l00154"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#gab9c8b19dde5938faf48f6f5536da0c87"> 154</a></span>&#160;<span class="preprocessor">#endif</span></div><div class="line"><a name="l00155"></a><span class="lineno"><a class="line" href="../../d1/d84/a00097.html#ga126a63d05acda3823f910888f1d45475"> 155</a></span>&#160;<span class="preprocessor">#endif </span><span class="comment">/* _USB_DFU_H_ */</span><span class="preprocessor"></span></div><div class="ttc" id="a00208_html_ad0ba799466a81ce8b879947b7daadf44"><div class="ttname"><a href="../../dc/d31/a00208.html#ad0ba799466a81ce8b879947b7daadf44">usb_dfu_status::bStatus</a></div><div class="ttdeci">uint8_t bStatus</div><div class="ttdoc">An indication of the status resulting from the execution of the most recent request. </div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00170">usb_dfu.h:170</a></div></div>
  86. <div class="ttc" id="a00208_html_a3fc2826fc009f5871bdb20685870c256"><div class="ttname"><a href="../../dc/d31/a00208.html#a3fc2826fc009f5871bdb20685870c256">usb_dfu_status::iString</a></div><div class="ttdeci">uint8_t iString</div><div class="ttdoc">Index of the status string descriptor. </div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00178">usb_dfu.h:178</a></div></div>
  87. <div class="ttc" id="a00208_html_a5eb86c5861af3fa2682043c66593ea80"><div class="ttname"><a href="../../dc/d31/a00208.html#a5eb86c5861af3fa2682043c66593ea80">usb_dfu_status::wPollTimeout</a></div><div class="ttdeci">uint16_t wPollTimeout</div><div class="ttdoc">Minimum time (MSB) in ms, that the host should wait before sending a subsequent DFU_GETSTATUS request...</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00174">usb_dfu.h:174</a></div></div>
  88. <div class="ttc" id="a00208_html_a825bc771b0a80cc19a38f7315941500a"><div class="ttname"><a href="../../dc/d31/a00208.html#a825bc771b0a80cc19a38f7315941500a">usb_dfu_status::bState</a></div><div class="ttdeci">uint8_t bState</div><div class="ttdoc">An indication of the state that the device is going to enter immediately following transmission of th...</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00176">usb_dfu.h:176</a></div></div>
  89. <div class="ttc" id="a00208_html_a7cc72cb082f9a807d664583f963a4d1b"><div class="ttname"><a href="../../dc/d31/a00208.html#a7cc72cb082f9a807d664583f963a4d1b">usb_dfu_status::bPollTimeout</a></div><div class="ttdeci">uint8_t bPollTimeout</div><div class="ttdoc">Minimum time (LSB) in ms, that the host should wait before sending a subsequent DFU_GETSTATUS request...</div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00172">usb_dfu.h:172</a></div></div>
  90. <div class="ttc" id="a00208_html"><div class="ttname"><a href="../../dc/d31/a00208.html">usb_dfu_status</a></div><div class="ttdoc">Payload packet to response in DFU_GETSTATUS request. </div><div class="ttdef"><b>Definition:</b> <a href="../../df/d03/a00062_source.html#l00169">usb_dfu.h:169</a></div></div>
  91. </div><!-- fragment --></div><!-- contents -->
  92. </div><!-- doc-content -->
  93. <!-- start footer part -->
  94. <div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  95. <ul>
  96. <li class="navelem"><a class="el" href="../../dir_bfccd401955b95cf8c75461437045ac0.html">inc</a></li><li class="navelem"><b>usb_dfu.h</b></li>
  97. <li class="footer">Generated by
  98. <a href="http://www.doxygen.org/index.html">
  99. <img class="footer" src="../../doxygen.png" alt="doxygen"/></a> 1.8.13 </li>
  100. </ul>
  101. </div>
  102. </body>
  103. </html>