USB_Host_Shield_2.0/_usb_8h_source.html

385 lines
62 KiB
HTML
Raw Normal View History

2013-01-30 22:00:18 +01:00
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.3.1"/>
<title>USB_Host_Shield_2.0: /Users/Lauszus/GitHub/USB_Host_Shield_2.0/Usb.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
$(document).ready(function() { searchBox.OnSelectItem(0); });
</script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td style="padding-left: 0.5em;">
<div id="projectname">USB_Host_Shield_2.0
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.3.1 -->
<script type="text/javascript">
var searchBox = new SearchBox("searchBox", "search",false,'Search');
</script>
<div id="navrow1" class="tabs">
<ul class="tablist">
<li><a href="index.html"><span>Main&#160;Page</span></a></li>
<li><a href="pages.html"><span>Related&#160;Pages</span></a></li>
<li><a href="annotated.html"><span>Classes</span></a></li>
<li class="current"><a href="files.html"><span>Files</span></a></li>
<li>
<div id="MSearchBox" class="MSearchBoxInactive">
<span class="left">
<img id="MSearchSelect" src="search/mag_sel.png"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
alt=""/>
<input type="text" id="MSearchField" value="Search" accesskey="S"
onfocus="searchBox.OnSearchFieldFocus(true)"
onblur="searchBox.OnSearchFieldFocus(false)"
onkeyup="searchBox.OnSearchFieldChange(event)"/>
</span><span class="right">
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
</span>
</div>
</li>
</ul>
</div>
<div id="navrow2" class="tabs2">
<ul class="tablist">
<li><a href="files.html"><span>File&#160;List</span></a></li>
<li><a href="globals.html"><span>File&#160;Members</span></a></li>
</ul>
</div>
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark">&#160;</span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark">&#160;</span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark">&#160;</span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark">&#160;</span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark">&#160;</span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark">&#160;</span>Typedefs</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark">&#160;</span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark">&#160;</span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(8)"><span class="SelectionMark">&#160;</span>Macros</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(9)"><span class="SelectionMark">&#160;</span>Pages</a></div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div id="nav-path" class="navpath">
<ul>
<li class="navelem"><a class="el" href="dir_c8a8870798f18a14afbce47230dc4059.html">GitHub</a></li><li class="navelem"><a class="el" href="dir_8d22a5dfb299d0b3a2bdc551c5cdbd10.html">USB_Host_Shield_2.0</a></li> </ul>
</div>
</div><!-- top -->
<div class="header">
<div class="headertitle">
<div class="title">Usb.h</div> </div>
</div><!--header-->
<div class="contents">
<a href="_usb_8h.html">Go to the documentation of this file.</a><div class="fragment"><div class="line"><a name="l00001"></a><span class="lineno"> 1</span>&#160;<span class="comment">/* Copyright (C) 2011 Circuits At Home, LTD. All rights reserved.</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">This software may be distributed and modified under the terms of the GNU</span></div>
<div class="line"><a name="l00004"></a><span class="lineno"> 4</span>&#160;<span class="comment">General Public License version 2 (GPL2) as published by the Free Software</span></div>
<div class="line"><a name="l00005"></a><span class="lineno"> 5</span>&#160;<span class="comment">Foundation and appearing in the file GPL2.TXT included in the packaging of</span></div>
<div class="line"><a name="l00006"></a><span class="lineno"> 6</span>&#160;<span class="comment">this file. Please note that GPL2 Section 2[b] requires that all works based</span></div>
<div class="line"><a name="l00007"></a><span class="lineno"> 7</span>&#160;<span class="comment">on this software must also be made publicly available under the terms of</span></div>
<div class="line"><a name="l00008"></a><span class="lineno"> 8</span>&#160;<span class="comment">the GPL2 (&quot;Copyleft&quot;).</span></div>
<div class="line"><a name="l00009"></a><span class="lineno"> 9</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00010"></a><span class="lineno"> 10</span>&#160;<span class="comment">Contact information</span></div>
<div class="line"><a name="l00011"></a><span class="lineno"> 11</span>&#160;<span class="comment">-------------------</span></div>
<div class="line"><a name="l00012"></a><span class="lineno"> 12</span>&#160;<span class="comment"></span></div>
<div class="line"><a name="l00013"></a><span class="lineno"> 13</span>&#160;<span class="comment">Circuits At Home, LTD</span></div>
<div class="line"><a name="l00014"></a><span class="lineno"> 14</span>&#160;<span class="comment">Web : http://www.circuitsathome.com</span></div>
<div class="line"><a name="l00015"></a><span class="lineno"> 15</span>&#160;<span class="comment">e-mail : support@circuitsathome.com</span></div>
<div class="line"><a name="l00016"></a><span class="lineno"> 16</span>&#160;<span class="comment">*/</span></div>
<div class="line"><a name="l00017"></a><span class="lineno"> 17</span>&#160;<span class="comment">/* USB functions */</span></div>
<div class="line"><a name="l00018"></a><span class="lineno"> 18</span>&#160;<span class="preprocessor">#ifndef _usb_h_</span></div>
<div class="line"><a name="l00019"></a><span class="lineno"> 19</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define _usb_h_</span></div>
<div class="line"><a name="l00020"></a><span class="lineno"> 20</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00021"></a><span class="lineno"> 21</span>&#160;</div>
<div class="line"><a name="l00022"></a><span class="lineno"> 22</span>&#160;<span class="comment">//#define BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00023"></a><span class="lineno"> 23</span>&#160;</div>
<div class="line"><a name="l00024"></a><span class="lineno"> 24</span>&#160;</div>
<div class="line"><a name="l00025"></a><span class="lineno"><a class="code" href="_usb_8h.html#a59c611df6811225e1cca2d1ce5a09cfb"> 25</a></span>&#160;<span class="preprocessor">#define USB_METHODS_INLINE</span></div>
<div class="line"><a name="l00026"></a><span class="lineno"> 26</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00027"></a><span class="lineno"> 27</span>&#160;<span class="preprocessor">#include &lt;inttypes.h&gt;</span></div>
<div class="line"><a name="l00028"></a><span class="lineno"> 28</span>&#160;</div>
<div class="line"><a name="l00029"></a><span class="lineno"> 29</span>&#160;<span class="preprocessor">#include &lt;assert.h&gt;</span></div>
<div class="line"><a name="l00030"></a><span class="lineno"> 30</span>&#160;</div>
<div class="line"><a name="l00031"></a><span class="lineno"> 31</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="avrpins_8h.html">avrpins.h</a>&quot;</span></div>
<div class="line"><a name="l00032"></a><span class="lineno"> 32</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="max3421e_8h.html">max3421e.h</a>&quot;</span></div>
<div class="line"><a name="l00033"></a><span class="lineno"> 33</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="usbhost_8h.html">usbhost.h</a>&quot;</span></div>
<div class="line"><a name="l00034"></a><span class="lineno"> 34</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="usb__ch9_8h.html">usb_ch9.h</a>&quot;</span></div>
<div class="line"><a name="l00035"></a><span class="lineno"> 35</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="address_8h.html">address.h</a>&quot;</span></div>
<div class="line"><a name="l00036"></a><span class="lineno"> 36</span>&#160;</div>
<div class="line"><a name="l00037"></a><span class="lineno"> 37</span>&#160;<span class="preprocessor">#if defined(ARDUINO) &amp;&amp; ARDUINO &gt;=100</span></div>
<div class="line"><a name="l00038"></a><span class="lineno"> 38</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &quot;Arduino.h&quot;</span></div>
<div class="line"><a name="l00039"></a><span class="lineno"> 39</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00040"></a><span class="lineno"> 40</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#include &lt;WProgram.h&gt;</span></div>
<div class="line"><a name="l00041"></a><span class="lineno"> 41</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00042"></a><span class="lineno"> 42</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00043"></a><span class="lineno"> 43</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="printhex_8h.html">printhex.h</a>&quot;</span></div>
<div class="line"><a name="l00044"></a><span class="lineno"> 44</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="hexdump_8h.html">hexdump.h</a>&quot;</span></div>
<div class="line"><a name="l00045"></a><span class="lineno"> 45</span>&#160;<span class="preprocessor">#include &quot;<a class="code" href="message_8h.html">message.h</a>&quot;</span></div>
<div class="line"><a name="l00046"></a><span class="lineno"> 46</span>&#160;</div>
<div class="line"><a name="l00047"></a><span class="lineno"> 47</span>&#160;</div>
<div class="line"><a name="l00048"></a><span class="lineno"> 48</span>&#160;<span class="comment">/* shield pins. First parameter - SS pin, second parameter - INT pin */</span></div>
<div class="line"><a name="l00049"></a><span class="lineno"> 49</span>&#160;</div>
<div class="line"><a name="l00050"></a><span class="lineno"> 50</span>&#160;<span class="preprocessor">#if defined(__AVR_AT90USB646__) || defined(__AVR_AT90USB1286__)</span></div>
<div class="line"><a name="l00051"></a><span class="lineno"> 51</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define BOARD_TEENSY_PLUS_PLUS</span></div>
<div class="line"><a name="l00052"></a><span class="lineno"> 52</span>&#160;<span class="preprocessor"></span><span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00053"></a><span class="lineno"> 53</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00054"></a><span class="lineno"> 54</span>&#160;<span class="preprocessor">#ifdef BOARD_BLACK_WIDDOW</span></div>
<div class="line"><a name="l00055"></a><span class="lineno"> 55</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P6, P3&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Black Widow</span></div>
<div class="line"><a name="l00056"></a><span class="lineno"> 56</span>&#160;<span class="preprocessor">#elif defined(BOARD_TEENSY_PLUS_PLUS)</span></div>
<div class="line"><a name="l00057"></a><span class="lineno"> 57</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P9, P8&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Teensy++ 2.0 &amp; 1.0</span></div>
<div class="line"><a name="l00058"></a><span class="lineno"> 58</span>&#160;<span class="preprocessor">#elif defined(BOARD_MEGA_ADK)</span></div>
2013-02-05 20:02:12 +01:00
<div class="line"><a name="l00059"></a><span class="lineno"> 59</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P53, P54&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Arduino Mega ADK</span></div>
<div class="line"><a name="l00060"></a><span class="lineno"> 60</span>&#160;<span class="preprocessor">#elif defined(BOARD_BALANDUINO)</span></div>
<div class="line"><a name="l00061"></a><span class="lineno"> 61</span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P20, P19&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Balanduino</span></div>
<div class="line"><a name="l00062"></a><span class="lineno"> 62</span>&#160;<span class="preprocessor">#else</span></div>
<div class="line"><a name="l00063"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb"> 63</a></span>&#160;<span class="preprocessor"></span><span class="keyword">typedef</span> <a class="code" href="class_m_a_x3421e.html">MAX3421e&lt;P10, P9&gt;</a> <a class="code" href="_usb_8h.html#ae8ea2a106e94f5bb20be2fcbd4e402fb">MAX3421E</a>; <span class="comment">// Official Arduinos (UNO, Duemilanove, Mega, 2560, Leonardo etc.)</span></div>
<div class="line"><a name="l00064"></a><span class="lineno"> 64</span>&#160;<span class="preprocessor">#endif</span></div>
<div class="line"><a name="l00065"></a><span class="lineno"> 65</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00066"></a><span class="lineno"> 66</span>&#160;<span class="comment">//Debug macros. In 1.0 it is possible to move strings to PROGMEM by defining USBTRACE (Serial.print(F(s)))</span></div>
<div class="line"><a name="l00067"></a><span class="lineno"><a class="code" href="_usb_8h.html#afc6fe7f947af35317a49a4dcfc8189fd"> 67</a></span>&#160;<span class="preprocessor">#define USBTRACE(s) (Serial.print((s)))</span></div>
<div class="line"><a name="l00068"></a><span class="lineno"><a class="code" href="_usb_8h.html#adbe3f00986df48a9254f8bf0992041d3"> 68</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USBTRACE2(s,r) (Serial.print((s)), Serial.println((r),HEX))</span></div>
<div class="line"><a name="l00069"></a><span class="lineno"> 69</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00070"></a><span class="lineno"> 70</span>&#160;</div>
<div class="line"><a name="l00071"></a><span class="lineno"> 71</span>&#160;</div>
<div class="line"><a name="l00072"></a><span class="lineno"> 72</span>&#160;<span class="comment">/* Common setup data constant combinations */</span></div>
<div class="line"><a name="l00073"></a><span class="lineno"><a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285"> 73</a></span>&#160;<span class="preprocessor">#define bmREQ_GET_DESCR USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //get descriptor request type</span></div>
<div class="line"><a name="l00074"></a><span class="lineno"><a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da"> 74</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_SET USB_SETUP_HOST_TO_DEVICE|USB_SETUP_TYPE_STANDARD|USB_SETUP_RECIPIENT_DEVICE //set request type for all but &#39;set feature&#39; and &#39;set interface&#39;</span></div>
<div class="line"><a name="l00075"></a><span class="lineno"><a class="code" href="_usb_8h.html#a9495c8ffdb784e111e8174e1541676f0"> 75</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define bmREQ_CL_GET_INTF USB_SETUP_DEVICE_TO_HOST|USB_SETUP_TYPE_CLASS|USB_SETUP_RECIPIENT_INTERFACE //get interface request type</span></div>
<div class="line"><a name="l00076"></a><span class="lineno"> 76</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00077"></a><span class="lineno"> 77</span>&#160;<span class="comment">// D7 data transfer direction (0 - host-to-device, 1 - device-to-host)</span></div>
<div class="line"><a name="l00078"></a><span class="lineno"> 78</span>&#160;<span class="comment">// D6-5 Type (0- standard, 1 - class, 2 - vendor, 3 - reserved)</span></div>
<div class="line"><a name="l00079"></a><span class="lineno"> 79</span>&#160;<span class="comment">// D4-0 Recipient (0 - device, 1 - interface, 2 - endpoint, 3 - other, 4..31 - reserved)</span></div>
<div class="line"><a name="l00080"></a><span class="lineno"> 80</span>&#160;</div>
<div class="line"><a name="l00081"></a><span class="lineno"> 81</span>&#160;<span class="comment">// USB Device Classes</span></div>
<div class="line"><a name="l00082"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae157c9a62665e9ca41bf765518077f40"> 82</a></span>&#160;<span class="preprocessor">#define USB_CLASS_USE_CLASS_INFO 0x00 // Use Class Info in the Interface Descriptors</span></div>
<div class="line"><a name="l00083"></a><span class="lineno"><a class="code" href="_usb_8h.html#a8785f84db1be6b0b5da34cd91a1b6138"> 83</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_AUDIO 0x01 // Audio</span></div>
<div class="line"><a name="l00084"></a><span class="lineno"><a class="code" href="_usb_8h.html#abb99f6b1f38ff79ec678cd957ac86758"> 84</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_COM_AND_CDC_CTRL 0x02 // Communications and CDC Control</span></div>
<div class="line"><a name="l00085"></a><span class="lineno"><a class="code" href="_usb_8h.html#af062e949014bed74a8b5fedcf1705602"> 85</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HID 0x03 // HID</span></div>
<div class="line"><a name="l00086"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa5f3153d014b6267ba8da243b6b46443"> 86</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PHYSICAL 0x05 // Physical</span></div>
<div class="line"><a name="l00087"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1cddf36a39f1299fcf654628c40eaafe"> 87</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_IMAGE 0x06 // Image</span></div>
<div class="line"><a name="l00088"></a><span class="lineno"><a class="code" href="_usb_8h.html#ab3e03403111b64480ba298d2641cf92f"> 88</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PRINTER 0x07 // Printer</span></div>
<div class="line"><a name="l00089"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa99b73e335df09e6545fc44798a3c1f2"> 89</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MASS_STORAGE 0x08 // Mass Storage</span></div>
<div class="line"><a name="l00090"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac5a936a2d1a6e3403798b031294992a"> 90</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_HUB 0x09 // Hub</span></div>
<div class="line"><a name="l00091"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7dae7df3ce2685f96775f2a0fb8658ae"> 91</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CDC_DATA 0x0a // CDC-Data</span></div>
<div class="line"><a name="l00092"></a><span class="lineno"><a class="code" href="_usb_8h.html#a823e1d95a677968ba93d6bb1968c48db"> 92</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_SMART_CARD 0x0b // Smart-Card</span></div>
<div class="line"><a name="l00093"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311fda5cdf4960e05a892084c1b11288"> 93</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_CONTENT_SECURITY 0x0d // Content Security</span></div>
<div class="line"><a name="l00094"></a><span class="lineno"><a class="code" href="_usb_8h.html#a42a579e1be399e32a495b82634411449"> 94</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VIDEO 0x0e // Video</span></div>
<div class="line"><a name="l00095"></a><span class="lineno"><a class="code" href="_usb_8h.html#aef502b63c6eb8229ba4d67224f19fb84"> 95</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_PERSONAL_HEALTH 0x0f // Personal Healthcare</span></div>
<div class="line"><a name="l00096"></a><span class="lineno"><a class="code" href="_usb_8h.html#aa31549c5c0d9e18f310dddaeab27068b"> 96</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_DIAGNOSTIC_DEVICE 0xdc // Diagnostic Device</span></div>
<div class="line"><a name="l00097"></a><span class="lineno"><a class="code" href="_usb_8h.html#afce880b09049d7105f8e68ff36d9ad17"> 97</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_WIRELESS_CTRL 0xe0 // Wireless Controller</span></div>
<div class="line"><a name="l00098"></a><span class="lineno"><a class="code" href="_usb_8h.html#a02fb07e20ad6d1af64439f40093bc80f"> 98</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_MISC 0xef // Miscellaneous</span></div>
<div class="line"><a name="l00099"></a><span class="lineno"><a class="code" href="_usb_8h.html#a47087a6e244a02251b650921ea3b71db"> 99</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_APP_SPECIFIC 0xfe // Application Specific</span></div>
<div class="line"><a name="l00100"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7c6212a5385ca1b4af75eeff62f7a871"> 100</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_CLASS_VENDOR_SPECIFIC 0xff // Vendor Specific</span></div>
<div class="line"><a name="l00101"></a><span class="lineno"> 101</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00102"></a><span class="lineno"> 102</span>&#160;<span class="comment">// Additional Error Codes</span></div>
<div class="line"><a name="l00103"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae9e139d0fd29bb0b3e7afad2f76cd589"> 103</a></span>&#160;<span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_NOT_SUPPORTED 0xD1</span></div>
<div class="line"><a name="l00104"></a><span class="lineno"><a class="code" href="_usb_8h.html#a7cb7070e699b7815e3c45dc8f7dd67f1"> 104</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DEV_CONFIG_ERROR_DEVICE_INIT_INCOMPLETE 0xD2</span></div>
<div class="line"><a name="l00105"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0"> 105</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS 0xD3</span></div>
<div class="line"><a name="l00106"></a><span class="lineno"><a class="code" href="_usb_8h.html#a15370eb665cdded5514e69ca58d9f39d"> 106</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_OUT_OF_ADDRESS_SPACE_IN_POOL 0xD4</span></div>
<div class="line"><a name="l00107"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada55913b93ef46c430ed6979022c31b1"> 107</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_HUB_ADDRESS_OVERFLOW 0xD5</span></div>
<div class="line"><a name="l00108"></a><span class="lineno"><a class="code" href="_usb_8h.html#afe2fedb4b0ccc89a688c0b4b59691ce0"> 108</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_ADDRESS_NOT_FOUND_IN_POOL 0xD6</span></div>
<div class="line"><a name="l00109"></a><span class="lineno"><a class="code" href="_usb_8h.html#af192c59cafe2192ad802b22e6dbc077d"> 109</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EPINFO_IS_NULL 0xD7</span></div>
<div class="line"><a name="l00110"></a><span class="lineno"><a class="code" href="_usb_8h.html#a52c379fe7e22f53d3e3d47d65735fa3b"> 110</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_ARGUMENT 0xD8</span></div>
<div class="line"><a name="l00111"></a><span class="lineno"><a class="code" href="_usb_8h.html#a44416ff64fc0e3691f98addac13d4595"> 111</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_CLASS_INSTANCE_ALREADY_IN_USE 0xD9</span></div>
<div class="line"><a name="l00112"></a><span class="lineno"><a class="code" href="_usb_8h.html#a272428aaee5fccec4661bd5457d1928f"> 112</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_INVALID_MAX_PKT_SIZE 0xDA</span></div>
<div class="line"><a name="l00113"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad55f0079a95df5e4a9bb22e88a7395f5"> 113</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_EP_NOT_FOUND_IN_TBL 0xDB</span></div>
<div class="line"><a name="l00114"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae691ccb027b8e281ac87522a0e66aaa7"> 114</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ERROR_TRANSFER_TIMEOUT 0xFF</span></div>
<div class="line"><a name="l00115"></a><span class="lineno"> 115</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00116"></a><span class="lineno"><a class="code" href="class_u_s_b_device_config.html"> 116</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a></div>
<div class="line"><a name="l00117"></a><span class="lineno"> 117</span>&#160;{</div>
<div class="line"><a name="l00118"></a><span class="lineno"> 118</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00119"></a><span class="lineno"> 119</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a391dc824a3271671890cebeb829b35ed">Init</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed) = 0;</div>
<div class="line"><a name="l00120"></a><span class="lineno"> 120</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a74c06c5fe641b20faeeebd39e33248b3">Release</a>() = 0;</div>
<div class="line"><a name="l00121"></a><span class="lineno"> 121</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#a4961e92df3e75c38e6953fb08b11f8b6">Poll</a>() = 0;</div>
<div class="line"><a name="l00122"></a><span class="lineno"> 122</span>&#160; <span class="keyword">virtual</span> uint8_t <a class="code" href="class_u_s_b_device_config.html#aae3130517514c902bad5f153849b3811">GetAddress</a>() = 0;</div>
<div class="line"><a name="l00123"></a><span class="lineno"> 123</span>&#160;};</div>
<div class="line"><a name="l00124"></a><span class="lineno"> 124</span>&#160;</div>
<div class="line"><a name="l00125"></a><span class="lineno"><a class="code" href="_usb_8h.html#ad8686abbfa0d98547d450fe2a105a588"> 125</a></span>&#160;<span class="preprocessor">#define USB_XFER_TIMEOUT 5000 //USB transfer timeout in milliseconds, per section 9.2.6.1 of USB 2.0 spec</span></div>
<div class="line"><a name="l00126"></a><span class="lineno"> 126</span>&#160;<span class="preprocessor"></span><span class="comment">//#define USB_NAK_LIMIT 32000 //NAK limit for a transfer. 0 means NAKs are not counted</span></div>
<div class="line"><a name="l00127"></a><span class="lineno"><a class="code" href="_usb_8h.html#a857a9899ad4f277faf074c3012e14ffa"> 127</a></span>&#160;<span class="preprocessor">#define USB_RETRY_LIMIT 3 //retry limit for a transfer</span></div>
<div class="line"><a name="l00128"></a><span class="lineno"><a class="code" href="_usb_8h.html#a1b082667723b29243b021a1829bdd8d6"> 128</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_SETTLE_DELAY 200 //settle delay in milliseconds</span></div>
<div class="line"><a name="l00129"></a><span class="lineno"> 129</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00130"></a><span class="lineno"><a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5"> 130</a></span>&#160;<span class="preprocessor">#define USB_NUMDEVICES 16 //number of USB devices</span></div>
<div class="line"><a name="l00131"></a><span class="lineno"> 131</span>&#160;<span class="preprocessor"></span><span class="comment">//#define HUB_MAX_HUBS 7 // maximum number of hubs that can be attached to the host controller</span></div>
<div class="line"><a name="l00132"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae843af5aa0de74b17c3d8c8f8fab4c00"> 132</a></span>&#160;<span class="preprocessor">#define HUB_PORT_RESET_DELAY 20 // hub port reset delay 10 ms recomended, can be up to 20 ms</span></div>
<div class="line"><a name="l00133"></a><span class="lineno"> 133</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00134"></a><span class="lineno"> 134</span>&#160;<span class="comment">/* USB state machine states */</span></div>
<div class="line"><a name="l00135"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3168cf67661a2716677b9830f30b880c"> 135</a></span>&#160;<span class="preprocessor">#define USB_STATE_MASK 0xf0</span></div>
<div class="line"><a name="l00136"></a><span class="lineno"> 136</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00137"></a><span class="lineno"><a class="code" href="_usb_8h.html#ae7fd7c5bb6dc87f44724dde2ad57df87"> 137</a></span>&#160;<span class="preprocessor">#define USB_STATE_DETACHED 0x10</span></div>
<div class="line"><a name="l00138"></a><span class="lineno"><a class="code" href="_usb_8h.html#a60a744d0f1386e4b28053a41bd6a958f"> 138</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_INITIALIZE 0x11 </span></div>
<div class="line"><a name="l00139"></a><span class="lineno"><a class="code" href="_usb_8h.html#a3708f4e8166d5d099e1982aa956eacce"> 139</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_WAIT_FOR_DEVICE 0x12</span></div>
<div class="line"><a name="l00140"></a><span class="lineno"><a class="code" href="_usb_8h.html#aff6ab2376cd29385b20c2b63d4ddd26d"> 140</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_DETACHED_SUBSTATE_ILLEGAL 0x13</span></div>
<div class="line"><a name="l00141"></a><span class="lineno"><a class="code" href="_usb_8h.html#aaadb20392558e23e3eba073e358a4493"> 141</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_SETTLE 0x20</span></div>
<div class="line"><a name="l00142"></a><span class="lineno"><a class="code" href="_usb_8h.html#ada22633d6de30155a60cb19f6e6452fe"> 142</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_RESET_DEVICE 0x30 </span></div>
<div class="line"><a name="l00143"></a><span class="lineno"><a class="code" href="_usb_8h.html#a311f11b79c4020d771cd6930e0a3223d"> 143</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_RESET_COMPLETE 0x40</span></div>
<div class="line"><a name="l00144"></a><span class="lineno"><a class="code" href="_usb_8h.html#a2d69537e663e7d5f188004f0d25ec0cc"> 144</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_WAIT_SOF 0x50</span></div>
<div class="line"><a name="l00145"></a><span class="lineno"><a class="code" href="_usb_8h.html#a23ebcbb956f600e06435b28ae0c855d4"> 145</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_ATTACHED_SUBSTATE_GET_DEVICE_DESCRIPTOR_SIZE 0x60</span></div>
<div class="line"><a name="l00146"></a><span class="lineno"><a class="code" href="_usb_8h.html#a474a95baaeb99abd17538c2a1364bf96"> 146</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ADDRESSING 0x70</span></div>
<div class="line"><a name="l00147"></a><span class="lineno"><a class="code" href="_usb_8h.html#aac8c844e6a20f42298d70e4438a029e5"> 147</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_CONFIGURING 0x80</span></div>
<div class="line"><a name="l00148"></a><span class="lineno"><a class="code" href="_usb_8h.html#a138c40c59f628eefbe273a8db0a96753"> 148</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_RUNNING 0x90</span></div>
<div class="line"><a name="l00149"></a><span class="lineno"><a class="code" href="_usb_8h.html#a6fef5305841ac36f67d8ddb0bd9127d4"> 149</a></span>&#160;<span class="preprocessor"></span><span class="preprocessor">#define USB_STATE_ERROR 0xa0</span></div>
<div class="line"><a name="l00150"></a><span class="lineno"> 150</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00151"></a><span class="lineno"> 151</span>&#160;<span class="comment">/* USB Setup Packet Structure */</span></div>
<div class="line"><a name="l00152"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html"> 152</a></span>&#160;<span class="keyword">typedef</span> <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00153"></a><span class="lineno"> 153</span>&#160; <span class="keyword">union </span>{ <span class="comment">// offset description</span></div>
<div class="line"><a name="l00154"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5"> 154</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a9bbd6cf5a93a6433d2eb97c59b9102d5">bmRequestType</a>; <span class="comment">// 0 Bit-map of request type</span></div>
<div class="line"><a name="l00155"></a><span class="lineno"> 155</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00156"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a690a55f65b2ce4e69c426b92004a1cc6"> 156</a></span>&#160; uint8_t recipient: 5; <span class="comment">// Recipient of the request</span></div>
<div class="line"><a name="l00157"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ad9346ba7b7a4da6829142e23e3ba8a2f"> 157</a></span>&#160; uint8_t type: 2; <span class="comment">// Type of request</span></div>
<div class="line"><a name="l00158"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#ab50c95fb951cdebc78c3e024de1d6d65"> 158</a></span>&#160; uint8_t direction: 1; <span class="comment">// Direction of data X-fer</span></div>
<div class="line"><a name="l00159"></a><span class="lineno"> 159</span>&#160; };</div>
<div class="line"><a name="l00160"></a><span class="lineno"> 160</span>&#160; }ReqType_u;</div>
<div class="line"><a name="l00161"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016"> 161</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a321b931277d6ce278416dc5d74059016">bRequest</a>; <span class="comment">// 1 Request</span></div>
<div class="line"><a name="l00162"></a><span class="lineno"> 162</span>&#160; <span class="keyword">union </span>{</div>
<div class="line"><a name="l00163"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52"> 163</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1382f4a10a9b0774f803d1125dd9bb52">wValue</a>; <span class="comment">// 2 Depends on bRequest</span></div>
<div class="line"><a name="l00164"></a><span class="lineno"> 164</span>&#160; <span class="keyword">struct </span>{</div>
<div class="line"><a name="l00165"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9"> 165</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a68c9436c00560f96e044052c3fb681e9">wValueLo</a>;</div>
<div class="line"><a name="l00166"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443"> 166</a></span>&#160; uint8_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a04ea2d151f9edb6575fc159a58f1e443">wValueHi</a>;</div>
<div class="line"><a name="l00167"></a><span class="lineno"> 167</span>&#160; };</div>
<div class="line"><a name="l00168"></a><span class="lineno"> 168</span>&#160; }wVal_u;</div>
<div class="line"><a name="l00169"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e"> 169</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a299d9f88d294369ea88b48b5026f4c7e">wIndex</a>; <span class="comment">// 4 Depends on bRequest</span></div>
<div class="line"><a name="l00170"></a><span class="lineno"><a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537"> 170</a></span>&#160; uint16_t <a class="code" href="struct_s_e_t_u_p___p_k_t.html#a1ec9b19c0ed1e66e399ad9cf3c4a6537">wLength</a>; <span class="comment">// 6 Depends on bRequest</span></div>
<div class="line"><a name="l00171"></a><span class="lineno"> 171</span>&#160;} <a class="code" href="struct_s_e_t_u_p___p_k_t.html">SETUP_PKT</a>, *<a class="code" href="_usb_8h.html#af36716855ff65599786d9bdf6e4c11f9">PSETUP_PKT</a>;</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00172"></a><span class="lineno"> 172</span>&#160;</div>
2013-02-05 20:02:12 +01:00
<div class="line"><a name="l00173"></a><span class="lineno"> 173</span>&#160;</div>
<div class="line"><a name="l00174"></a><span class="lineno"> 174</span>&#160;</div>
<div class="line"><a name="l00175"></a><span class="lineno"> 175</span>&#160;<span class="comment">// Base class for incomming data parser</span></div>
<div class="line"><a name="l00176"></a><span class="lineno"><a class="code" href="class_u_s_b_read_parser.html"> 176</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a></div>
<div class="line"><a name="l00177"></a><span class="lineno"> 177</span>&#160;{</div>
<div class="line"><a name="l00178"></a><span class="lineno"> 178</span>&#160;<span class="keyword">public</span>:</div>
<div class="line"><a name="l00179"></a><span class="lineno"> 179</span>&#160; <span class="keyword">virtual</span> <span class="keywordtype">void</span> <a class="code" href="class_u_s_b_read_parser.html#afdb9cea2a2fe18d26f4ec595b86a7f7c">Parse</a>(<span class="keyword">const</span> uint16_t len, <span class="keyword">const</span> uint8_t *pbuf, <span class="keyword">const</span> uint16_t &amp;offset) = 0;</div>
<div class="line"><a name="l00180"></a><span class="lineno"> 180</span>&#160;};</div>
<div class="line"><a name="l00181"></a><span class="lineno"> 181</span>&#160;</div>
<div class="line"><a name="l00182"></a><span class="lineno"> 182</span>&#160;</div>
<div class="line"><a name="l00183"></a><span class="lineno"><a class="code" href="class_u_s_b.html"> 183</a></span>&#160;<span class="keyword">class </span><a class="code" href="class_u_s_b.html">USB</a> : <span class="keyword">public</span> <a class="code" href="class_m_a_x3421e.html">MAX3421E</a></div>
<div class="line"><a name="l00184"></a><span class="lineno"> 184</span>&#160;{</div>
<div class="line"><a name="l00185"></a><span class="lineno"> 185</span>&#160; <a class="code" href="class_address_pool_impl.html">AddressPoolImpl&lt;USB_NUMDEVICES&gt;</a> addrPool;</div>
<div class="line"><a name="l00186"></a><span class="lineno"> 186</span>&#160; <a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a>* devConfig[<a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>];</div>
<div class="line"><a name="l00187"></a><span class="lineno"> 187</span>&#160; uint8_t devConfigIndex;</div>
<div class="line"><a name="l00188"></a><span class="lineno"> 188</span>&#160; uint8_t bmHubPre;</div>
<div class="line"><a name="l00189"></a><span class="lineno"> 189</span>&#160;</div>
<div class="line"><a name="l00190"></a><span class="lineno"> 190</span>&#160; <span class="keyword">public</span>:</div>
<div class="line"><a name="l00191"></a><span class="lineno"> 191</span>&#160; <a class="code" href="class_u_s_b.html#a8ff8cd03496bdcb0ca26f18878ad299d">USB</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00192"></a><span class="lineno"> 192</span>&#160;</div>
<div class="line"><a name="l00193"></a><span class="lineno"><a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4"> 193</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aedcc6c06badd14b6fd3b0dda94269ad4">SetHubPreMask</a>() { bmHubPre |= <a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>; };</div>
<div class="line"><a name="l00194"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1"> 194</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a5b4de045ea7fefe0fab967ddf44c39b1">ResetHubPreMask</a>() { bmHubPre &amp;= (~<a class="code" href="max3421e_8h.html#a8816c259368604d0de57f31bcb6c1674">bmHUBPRE</a>); };</div>
<div class="line"><a name="l00195"></a><span class="lineno"> 195</span>&#160;</div>
<div class="line"><a name="l00196"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4"> 196</a></span>&#160; <a class="code" href="class_address_pool.html">AddressPool</a>&amp; <a class="code" href="class_u_s_b.html#a66ab8f5eda239e761d5a48741ea1f9d4">GetAddressPool</a>()</div>
<div class="line"><a name="l00197"></a><span class="lineno"> 197</span>&#160; {</div>
<div class="line"><a name="l00198"></a><span class="lineno"> 198</span>&#160; <span class="keywordflow">return</span> (<a class="code" href="class_address_pool.html">AddressPool</a>&amp;)addrPool;</div>
<div class="line"><a name="l00199"></a><span class="lineno"> 199</span>&#160; };</div>
<div class="line"><a name="l00200"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2"> 200</a></span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3f66bf622590413ef2e1864f93a3e0d2">RegisterDeviceClass</a>(<a class="code" href="class_u_s_b_device_config.html">USBDeviceConfig</a> *pdev)</div>
<div class="line"><a name="l00201"></a><span class="lineno"> 201</span>&#160; {</div>
<div class="line"><a name="l00202"></a><span class="lineno"> 202</span>&#160; <span class="keywordflow">for</span> (uint8_t i=0; i&lt;<a class="code" href="_usb_8h.html#a0282f9f7a0313f957e02449d7313b7b5">USB_NUMDEVICES</a>; i++)</div>
<div class="line"><a name="l00203"></a><span class="lineno"> 203</span>&#160; {</div>
<div class="line"><a name="l00204"></a><span class="lineno"> 204</span>&#160; <span class="keywordflow">if</span> (!devConfig[i])</div>
<div class="line"><a name="l00205"></a><span class="lineno"> 205</span>&#160; {</div>
<div class="line"><a name="l00206"></a><span class="lineno"> 206</span>&#160; devConfig[i] = pdev;</div>
<div class="line"><a name="l00207"></a><span class="lineno"> 207</span>&#160; <span class="keywordflow">return</span> 0;</div>
<div class="line"><a name="l00208"></a><span class="lineno"> 208</span>&#160; }</div>
<div class="line"><a name="l00209"></a><span class="lineno"> 209</span>&#160; }</div>
<div class="line"><a name="l00210"></a><span class="lineno"> 210</span>&#160; <span class="keywordflow">return</span> <a class="code" href="_usb_8h.html#ad4929f74079f3bc22b00936ae84d18b0">USB_ERROR_UNABLE_TO_REGISTER_DEVICE_CLASS</a>;</div>
<div class="line"><a name="l00211"></a><span class="lineno"> 211</span>&#160; };</div>
<div class="line"><a name="l00212"></a><span class="lineno"><a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42"> 212</a></span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8346db8f2219f65257d735834940bc42">ForEachUsbDevice</a>(<a class="code" href="address_8h.html#a90edb051235924cb5280032df397f393">UsbDeviceHandleFunc</a> pfunc)</div>
<div class="line"><a name="l00213"></a><span class="lineno"> 213</span>&#160; {</div>
<div class="line"><a name="l00214"></a><span class="lineno"> 214</span>&#160; addrPool.<a class="code" href="class_address_pool_impl.html#a09e6dc797f82543eba0879369116182e">ForEachUsbDevice</a>(pfunc);</div>
<div class="line"><a name="l00215"></a><span class="lineno"> 215</span>&#160; };</div>
<div class="line"><a name="l00216"></a><span class="lineno"> 216</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a1c1aad8269403bf488e3bc4c79886ce4">getUsbTaskState</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00217"></a><span class="lineno"> 217</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#a8ff697d334dc611720419374acd1e5fb">setUsbTaskState</a>( uint8_t state );</div>
<div class="line"><a name="l00218"></a><span class="lineno"> 218</span>&#160;</div>
<div class="line"><a name="l00219"></a><span class="lineno"> 219</span>&#160; <a class="code" href="struct_ep_info.html">EpInfo</a>* <a class="code" href="class_u_s_b.html#a59ee57083ba492d87ff2947547848d58">getEpInfoEntry</a>( uint8_t addr, uint8_t ep );</div>
<div class="line"><a name="l00220"></a><span class="lineno"> 220</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a6c3ba3f7e6dccb450267011ce783d7ea">setEpInfoEntry</a>( uint8_t addr, uint8_t epcount, <a class="code" href="struct_ep_info.html">EpInfo</a>* eprecord_ptr );</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00221"></a><span class="lineno"> 221</span>&#160;</div>
2013-02-05 20:02:12 +01:00
<div class="line"><a name="l00222"></a><span class="lineno"> 222</span>&#160; <span class="comment">//uint8_t ctrlReq( uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, uint16_t wInd, uint16_t nbytes, uint8_t* dataptr);</span></div>
<div class="line"><a name="l00223"></a><span class="lineno"> 223</span>&#160;</div>
<div class="line"><a name="l00224"></a><span class="lineno"> 224</span>&#160; <span class="comment">/* Control requests */</span></div>
<div class="line"><a name="l00225"></a><span class="lineno"> 225</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">getDevDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr );</div>
<div class="line"><a name="l00226"></a><span class="lineno"> 226</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr );</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00227"></a><span class="lineno"> 227</span>&#160;</div>
2013-02-05 20:02:12 +01:00
<div class="line"><a name="l00228"></a><span class="lineno"> 228</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">getConfDescr</a>( uint8_t addr, uint8_t ep, uint8_t conf, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p );</div>
<div class="line"><a name="l00229"></a><span class="lineno"> 229</span>&#160;</div>
<div class="line"><a name="l00230"></a><span class="lineno"> 230</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">getStrDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t index, uint16_t langid, uint8_t* dataptr );</div>
<div class="line"><a name="l00231"></a><span class="lineno"> 231</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">setAddr</a>( uint8_t oldaddr, uint8_t ep, uint8_t newaddr );</div>
<div class="line"><a name="l00232"></a><span class="lineno"> 232</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">setConf</a>( uint8_t addr, uint8_t ep, uint8_t conf_value );</div>
<div class="line"><a name="l00233"></a><span class="lineno"> 233</span>&#160; </div>
<div class="line"><a name="l00234"></a><span class="lineno"> 234</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a994f9488ac6f91040c42d9b816d202c6">ctrlData</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr, <span class="keywordtype">boolean</span> direction );</div>
<div class="line"><a name="l00235"></a><span class="lineno"> 235</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ab18915ffbd8a70ac5bd6abc3e0f3c66a">ctrlStatus</a>( uint8_t ep, <span class="keywordtype">boolean</span> direction, uint16_t nak_limit );</div>
<div class="line"><a name="l00236"></a><span class="lineno"> 236</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ad75d64f648b102fab2bd75e53e1324a4">inTransfer</a>( uint8_t addr, uint8_t ep, uint16_t *nbytesptr, uint8_t* data );</div>
<div class="line"><a name="l00237"></a><span class="lineno"> 237</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#affbc018973a588995457d535b0ac7ee7">outTransfer</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* data );</div>
<div class="line"><a name="l00238"></a><span class="lineno"> 238</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a343d4b321cf8e99f0504cb04c7ce8b10">dispatchPkt</a>( uint8_t token, uint8_t ep, uint16_t nak_limit );</div>
2013-01-30 22:00:18 +01:00
<div class="line"><a name="l00239"></a><span class="lineno"> 239</span>&#160;</div>
2013-02-05 20:02:12 +01:00
<div class="line"><a name="l00240"></a><span class="lineno"> 240</span>&#160; <span class="keywordtype">void</span> <a class="code" href="class_u_s_b.html#aff8d1b2009c760bc27fb12762bd3c9b6">Task</a>( <span class="keywordtype">void</span> );</div>
<div class="line"><a name="l00241"></a><span class="lineno"> 241</span>&#160;</div>
<div class="line"><a name="l00242"></a><span class="lineno"> 242</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a5eb0d31372d26f0015a0d7be0b9ff4e1">DefaultAddressing</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00243"></a><span class="lineno"> 243</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#af4008dfc1c2d15c23cf8a7815cc17765">Configuring</a>(uint8_t parent, uint8_t port, <span class="keywordtype">bool</span> lowspeed);</div>
<div class="line"><a name="l00244"></a><span class="lineno"> 244</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#ac681c6c98e1641f705bc14d670a2663a">ReleaseDevice</a>(uint8_t addr);</div>
<div class="line"><a name="l00245"></a><span class="lineno"> 245</span>&#160; </div>
<div class="line"><a name="l00246"></a><span class="lineno"> 246</span>&#160; uint8_t <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( uint8_t addr, uint8_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi, </div>
<div class="line"><a name="l00247"></a><span class="lineno"> 247</span>&#160; uint16_t wInd, uint16_t total, uint16_t nbytes, uint8_t* dataptr, <a class="code" href="class_u_s_b_read_parser.html">USBReadParser</a> *p);</div>
<div class="line"><a name="l00248"></a><span class="lineno"> 248</span>&#160;</div>
<div class="line"><a name="l00249"></a><span class="lineno"> 249</span>&#160; <span class="keyword">private</span>:</div>
<div class="line"><a name="l00250"></a><span class="lineno"> 250</span>&#160; <span class="keywordtype">void</span> init();</div>
<div class="line"><a name="l00251"></a><span class="lineno"> 251</span>&#160; uint8_t SetAddress(uint8_t addr, uint8_t ep, <a class="code" href="struct_ep_info.html">EpInfo</a> **ppep, uint16_t &amp;nak_limit);</div>
<div class="line"><a name="l00252"></a><span class="lineno"> 252</span>&#160; uint8_t OutTransfer(<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t nbytes, uint8_t *data);</div>
<div class="line"><a name="l00253"></a><span class="lineno"> 253</span>&#160; uint8_t InTransfer (<a class="code" href="struct_ep_info.html">EpInfo</a> *pep, uint16_t nak_limit, uint16_t *nbytesptr, uint8_t *data);</div>
<div class="line"><a name="l00254"></a><span class="lineno"> 254</span>&#160;};</div>
<div class="line"><a name="l00255"></a><span class="lineno"> 255</span>&#160;</div>
<div class="line"><a name="l00256"></a><span class="lineno"> 256</span>&#160;<span class="preprocessor">#if 0 //defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00257"></a><span class="lineno"> 257</span>&#160;<span class="preprocessor"></span><span class="comment">//get device descriptor</span></div>
<div class="line"><a name="l00258"></a><span class="lineno"> 258</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a193e63c149fad46adabd77ceb09b2b24" title="defined(USB_METHODS_INLINE)">USB::getDevDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t* dataptr ) </div>
<div class="line"><a name="l00259"></a><span class="lineno"> 259</span>&#160;{</div>
<div class="line"><a name="l00260"></a><span class="lineno"> 260</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, 0x00, <a class="code" href="usb__ch9_8h.html#ac6d0566773ed4549fe1a7a932e6c46de">USB_DESCRIPTOR_DEVICE</a>, 0x0000, nbytes, dataptr ));</div>
<div class="line"><a name="l00261"></a><span class="lineno"> 261</span>&#160;}</div>
<div class="line"><a name="l00262"></a><span class="lineno"> 262</span>&#160;<span class="comment">//get configuration descriptor </span></div>
<div class="line"><a name="l00263"></a><span class="lineno"> 263</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a618eedabc161d8315be45cae0c8b6f89">USB::getConfDescr</a>( uint8_t addr, uint8_t ep, uint16_t nbytes, uint8_t conf, uint8_t* dataptr ) </div>
<div class="line"><a name="l00264"></a><span class="lineno"> 264</span>&#160;{</div>
<div class="line"><a name="l00265"></a><span class="lineno"> 265</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, conf, <a class="code" href="usb__ch9_8h.html#aa17b365c4eb8bd2f6a4d4e4fb5f881c7">USB_DESCRIPTOR_CONFIGURATION</a>, 0x0000, nbytes, dataptr ));</div>
<div class="line"><a name="l00266"></a><span class="lineno"> 266</span>&#160;}</div>
<div class="line"><a name="l00267"></a><span class="lineno"> 267</span>&#160;<span class="comment">//get string descriptor</span></div>
<div class="line"><a name="l00268"></a><span class="lineno"> 268</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a372ecbe1d23955e8b04b5e95e0e4a833">USB::getStrDescr</a>( uint8_t addr, uint8_t ep, uint16_t nuint8_ts, uint8_t index, uint16_t langid, uint8_t* dataptr ) </div>
<div class="line"><a name="l00269"></a><span class="lineno"> 269</span>&#160;{</div>
<div class="line"><a name="l00270"></a><span class="lineno"> 270</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#a060f3a6423f1e3640aa7b14d5ce72285">bmREQ_GET_DESCR</a>, <a class="code" href="usb__ch9_8h.html#a3572226ee2137c7fbf7487a02b0f560f">USB_REQUEST_GET_DESCRIPTOR</a>, index, <a class="code" href="usb__ch9_8h.html#abbad38caa1ca9c52f47adccd3a850aed">USB_DESCRIPTOR_STRING</a>, langid, nuint8_ts, dataptr ));</div>
<div class="line"><a name="l00271"></a><span class="lineno"> 271</span>&#160;}</div>
<div class="line"><a name="l00272"></a><span class="lineno"> 272</span>&#160;<span class="comment">//set address </span></div>
<div class="line"><a name="l00273"></a><span class="lineno"> 273</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a3aea534daed66b5606fa798df7ad3c47">USB::setAddr</a>( uint8_t oldaddr, uint8_t ep, uint8_t newaddr ) </div>
<div class="line"><a name="l00274"></a><span class="lineno"> 274</span>&#160;{</div>
<div class="line"><a name="l00275"></a><span class="lineno"> 275</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( oldaddr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#ac87659819bfd6491120c819fae2d46bc">USB_REQUEST_SET_ADDRESS</a>, newaddr, 0x00, 0x0000, 0x0000, NULL ));</div>
<div class="line"><a name="l00276"></a><span class="lineno"> 276</span>&#160;}</div>
<div class="line"><a name="l00277"></a><span class="lineno"> 277</span>&#160;<span class="comment">//set configuration</span></div>
<div class="line"><a name="l00278"></a><span class="lineno"> 278</span>&#160;<span class="keyword">inline</span> uint8_t <a class="code" href="class_u_s_b.html#a31e2c132ec32ffdde94dff72be87c378">USB::setConf</a>( uint8_t addr, uint8_t ep, uint8_t conf_value ) </div>
<div class="line"><a name="l00279"></a><span class="lineno"> 279</span>&#160;{</div>
<div class="line"><a name="l00280"></a><span class="lineno"> 280</span>&#160; <span class="keywordflow">return</span>( <a class="code" href="class_u_s_b.html#a636695a5c3d35cd6b9e31c54edfacd7c">ctrlReq</a>( addr, ep, <a class="code" href="_usb_8h.html#af4965e768593007eacde7644979f56da">bmREQ_SET</a>, <a class="code" href="usb__ch9_8h.html#aadef005acc40340955d34d9767ef297c">USB_REQUEST_SET_CONFIGURATION</a>, conf_value, 0x00, 0x0000, 0x0000, NULL )); </div>
<div class="line"><a name="l00281"></a><span class="lineno"> 281</span>&#160;}</div>
<div class="line"><a name="l00282"></a><span class="lineno"> 282</span>&#160;</div>
<div class="line"><a name="l00283"></a><span class="lineno"> 283</span>&#160;<span class="preprocessor">#endif // defined(USB_METHODS_INLINE)</span></div>
<div class="line"><a name="l00284"></a><span class="lineno"> 284</span>&#160;<span class="preprocessor"></span></div>
<div class="line"><a name="l00285"></a><span class="lineno"> 285</span>&#160;<span class="preprocessor">#endif //_usb_h_</span></div>
2013-01-30 22:00:18 +01:00
</div><!-- fragment --></div><!-- contents -->
<!-- start footer part -->
<hr class="footer"/><address class="footer"><small>
2013-02-05 20:02:12 +01:00
Generated on Tue Feb 5 2013 19:53:22 for USB_Host_Shield_2.0 by &#160;<a href="http://www.doxygen.org/index.html">
2013-01-30 22:00:18 +01:00
<img class="footer" src="doxygen.png" alt="doxygen"/>
</a> 1.8.3.1
</small></address>
</body>
</html>