mirror of
https://github.com/hathach/tinyusb.git
synced 2025-01-31 05:52:55 +08:00
start to add msc host, fix dangerous problem with unstable device when plugged --> 200 ms delay. 50ms delay after each port reset
This commit is contained in:
parent
52ae0afeb6
commit
f8f398a681
@ -62,9 +62,9 @@ void board_init(void)
|
||||
|
||||
// TODO Device only USB0
|
||||
// 1.5Kohm pull-up resistor is needed on the USB DP data signal. GPIO28 (base), P9_5 (LPC4357) controls
|
||||
scu_pinmux(0x9, 5, MD_PUP|MD_EZI|MD_ZI, FUNC4); // GPIO5[18]
|
||||
GPIO_SetDir(5, BIT_(18), 1); // output
|
||||
GPIO_ClearValue(5, BIT_(18));
|
||||
// scu_pinmux(0x9, 5, MD_PUP|MD_EZI|MD_ZI, FUNC4); // GPIO5[18]
|
||||
// GPIO_SetDir(5, BIT_(18), 1); // output
|
||||
// GPIO_ClearValue(5, BIT_(18));
|
||||
|
||||
|
||||
//------------- I2C (required by LED) -------------//
|
||||
|
@ -66,8 +66,8 @@
|
||||
|
||||
#include "oem_base_board/pca9532.h" // LEDs
|
||||
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
|
||||
//#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
//#define CFG_PRINTF_TARGET PRINTF_TARGET_SWO
|
||||
#define CFG_PRINTF_TARGET PRINTF_TARGET_UART
|
||||
|
||||
/*=========================================================================
|
||||
HARDWARE MAC ADDRESS
|
||||
|
@ -165,12 +165,17 @@
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>usbh_devices</ItemText>
|
||||
</Ww>
|
||||
<Ww>
|
||||
<count>1</count>
|
||||
<WinNumber>1</WinNumber>
|
||||
<ItemText>msch_data</ItemText>
|
||||
</Ww>
|
||||
</WatchWindow1>
|
||||
<DebugFlag>
|
||||
<trace>0</trace>
|
||||
<periodic>1</periodic>
|
||||
<aLwin>1</aLwin>
|
||||
<aCover>1</aCover>
|
||||
<aCover>0</aCover>
|
||||
<aSer1>0</aSer1>
|
||||
<aSer2>0</aSer2>
|
||||
<aPa>0</aPa>
|
||||
@ -184,7 +189,7 @@
|
||||
<aSer3>0</aSer3>
|
||||
<eProf>0</eProf>
|
||||
<aLa>0</aLa>
|
||||
<aPa1>1</aPa1>
|
||||
<aPa1>0</aPa1>
|
||||
<AscS4>0</AscS4>
|
||||
<aSer4>1</aSer4>
|
||||
<StkLoc>0</StkLoc>
|
||||
@ -197,6 +202,12 @@
|
||||
</Tracepoint>
|
||||
<LintExecutable></LintExecutable>
|
||||
<LintConfigFile></LintConfigFile>
|
||||
<SystemViewers>
|
||||
<Entry>
|
||||
<Name>System Viewer\USB0</Name>
|
||||
<WinId>35905</WinId>
|
||||
</Entry>
|
||||
</SystemViewers>
|
||||
</TargetOption>
|
||||
</Target>
|
||||
|
||||
@ -392,10 +403,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>54</ColumnNumber>
|
||||
<ColumnNumber>43</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>171</TopLine>
|
||||
<CurrentLine>191</CurrentLine>
|
||||
<TopLine>164</TopLine>
|
||||
<CurrentLine>171</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\main.c</PathWithFileName>
|
||||
<FilenameWithoutPath>main.c</FilenameWithoutPath>
|
||||
@ -424,10 +435,10 @@
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>20</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>120</TopLine>
|
||||
<CurrentLine>129</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\keyboard_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>keyboard_app.c</FilenameWithoutPath>
|
||||
@ -442,8 +453,8 @@
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>122</TopLine>
|
||||
<CurrentLine>131</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\mouse_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>mouse_app.c</FilenameWithoutPath>
|
||||
@ -466,6 +477,22 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>1</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>0</TopLine>
|
||||
<CurrentLine>0</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\src\msc_app.c</PathWithFileName>
|
||||
<FilenameWithoutPath>msc_app.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@ -476,7 +503,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>6</FileNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -492,13 +519,13 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>7</FileNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>2</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>139</TopLine>
|
||||
<TopLine>140</TopLine>
|
||||
<CurrentLine>146</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\boards\embedded_artists\board_ea4357.c</PathWithFileName>
|
||||
@ -508,13 +535,13 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>8</FileNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>1</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>101</TopLine>
|
||||
<TopLine>102</TopLine>
|
||||
<CurrentLine>106</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\boards\printf_retarget.c</PathWithFileName>
|
||||
@ -524,7 +551,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>9</FileNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -540,7 +567,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>10</FileNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -556,7 +583,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>11</FileNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -572,7 +599,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>12</FileNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -588,7 +615,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>13</FileNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -604,7 +631,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>14</FileNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -620,7 +647,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>2</GroupNumber>
|
||||
<FileNumber>15</FileNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -638,20 +665,20 @@
|
||||
|
||||
<Group>
|
||||
<GroupName>tinyusb</GroupName>
|
||||
<tvExp>0</tvExp>
|
||||
<tvExp>1</tvExp>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<cbSel>0</cbSel>
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>16</FileNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>57</TopLine>
|
||||
<CurrentLine>76</CurrentLine>
|
||||
<CurrentLine>69</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\tusb.c</PathWithFileName>
|
||||
<FilenameWithoutPath>tusb.c</FilenameWithoutPath>
|
||||
@ -660,7 +687,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>17</FileNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -676,7 +703,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>18</FileNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -692,7 +719,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>19</FileNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -708,14 +735,14 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>20</FileNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<TopLine>370</TopLine>
|
||||
<CurrentLine>375</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\usbh.c</PathWithFileName>
|
||||
<FilenameWithoutPath>usbh.c</FilenameWithoutPath>
|
||||
@ -724,14 +751,14 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>21</FileNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>47</ColumnNumber>
|
||||
<ColumnNumber>25</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>4</TopLine>
|
||||
<CurrentLine>13</CurrentLine>
|
||||
<TopLine>141</TopLine>
|
||||
<CurrentLine>147</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\host\ehci\ehci.c</PathWithFileName>
|
||||
<FilenameWithoutPath>ehci.c</FilenameWithoutPath>
|
||||
@ -740,7 +767,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>22</FileNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -756,7 +783,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>23</FileNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -772,14 +799,14 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>24</FileNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>8</ColumnNumber>
|
||||
<ColumnNumber>7</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>68</TopLine>
|
||||
<CurrentLine>77</CurrentLine>
|
||||
<TopLine>101</TopLine>
|
||||
<CurrentLine>112</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\hal\hal_lpc43xx.c</PathWithFileName>
|
||||
<FilenameWithoutPath>hal_lpc43xx.c</FilenameWithoutPath>
|
||||
@ -788,7 +815,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>25</FileNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -804,7 +831,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>26</FileNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -820,7 +847,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>27</FileNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -836,14 +863,14 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>28</FileNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>28</ColumnNumber>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>23</TopLine>
|
||||
<CurrentLine>32</CurrentLine>
|
||||
<TopLine>1</TopLine>
|
||||
<CurrentLine>1</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\class\cdc_host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>cdc_host.c</FilenameWithoutPath>
|
||||
@ -852,7 +879,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>29</FileNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -868,7 +895,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>30</FileNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -882,6 +909,22 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>3</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>15</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>86</TopLine>
|
||||
<CurrentLine>90</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\..\tinyusb\class\msc_host.c</PathWithFileName>
|
||||
<FilenameWithoutPath>msc_host.c</FilenameWithoutPath>
|
||||
<RteFlg>0</RteFlg>
|
||||
<bShared>0</bShared>
|
||||
</File>
|
||||
</Group>
|
||||
|
||||
<Group>
|
||||
@ -892,7 +935,7 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>31</FileNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -908,7 +951,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>32</FileNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -924,7 +967,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>33</FileNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -940,7 +983,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>34</FileNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -956,7 +999,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>35</FileNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -972,7 +1015,7 @@
|
||||
</File>
|
||||
<File>
|
||||
<GroupNumber>4</GroupNumber>
|
||||
<FileNumber>36</FileNumber>
|
||||
<FileNumber>38</FileNumber>
|
||||
<FileType>1</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
@ -996,14 +1039,14 @@
|
||||
<RteFlg>0</RteFlg>
|
||||
<File>
|
||||
<GroupNumber>5</GroupNumber>
|
||||
<FileNumber>37</FileNumber>
|
||||
<FileNumber>39</FileNumber>
|
||||
<FileType>2</FileType>
|
||||
<tvExp>0</tvExp>
|
||||
<Focus>0</Focus>
|
||||
<ColumnNumber>0</ColumnNumber>
|
||||
<tvExpOptDlg>0</tvExpOptDlg>
|
||||
<TopLine>146</TopLine>
|
||||
<CurrentLine>151</CurrentLine>
|
||||
<TopLine>145</TopLine>
|
||||
<CurrentLine>146</CurrentLine>
|
||||
<bDave2>0</bDave2>
|
||||
<PathWithFileName>..\..\bsp\lpc43xx\startup_keil\startup_LPC43xx.s</PathWithFileName>
|
||||
<FilenameWithoutPath>startup_LPC43xx.s</FilenameWithoutPath>
|
||||
|
@ -416,6 +416,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\rndis_app.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msc_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\msc_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@ -551,6 +556,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\tinyusb\class\hid_host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msc_host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\tinyusb\class\msc_host.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@ -1010,6 +1020,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\rndis_app.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msc_app.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\src\msc_app.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
@ -1185,6 +1200,11 @@
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\tinyusb\class\hid_host.c</FilePath>
|
||||
</File>
|
||||
<File>
|
||||
<FileName>msc_host.c</FileName>
|
||||
<FileType>1</FileType>
|
||||
<FilePath>..\..\..\tinyusb\class\msc_host.c</FilePath>
|
||||
</File>
|
||||
</Files>
|
||||
</Group>
|
||||
<Group>
|
||||
|
@ -135,5 +135,14 @@ OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para)
|
||||
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
#else
|
||||
|
||||
// dummy implementation to remove #ifdef in main.c
|
||||
void cdc_serial_app_init(void) { }
|
||||
OSAL_TASK_FUNCTION( cdc_serial_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -178,4 +178,13 @@ static inline uint8_t keycode_to_ascii(uint8_t modifier, uint8_t keycode)
|
||||
hid_keycode_to_ascii_tbl [modifier & (KEYBOARD_MODIFIER_LEFTSHIFT | KEYBOARD_MODIFIER_RIGHTSHIFT) ? 1 : 0] [keycode];
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// dummy implementation to remove #ifdef in main.c
|
||||
void keyboard_app_init(void) { }
|
||||
OSAL_TASK_FUNCTION( keyboard_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
#endif
|
||||
|
@ -55,7 +55,7 @@
|
||||
#include "cdc_serial_app.h"
|
||||
#include "rndis_app.h"
|
||||
|
||||
#if defined(__CODE_RED)
|
||||
#if defined(__CODE_RED) // TODO to be removed
|
||||
#include <cr_section_macros.h>
|
||||
#include <NXP/crp.h>
|
||||
// Variable to store CRP value in. Will be placed automatically
|
||||
@ -104,10 +104,13 @@ void os_none_start_scheduler(void)
|
||||
while (1)
|
||||
{
|
||||
tusb_task_runner();
|
||||
led_blinking_task(NULL);
|
||||
|
||||
keyboard_app_task(NULL);
|
||||
mouse_app_task(NULL);
|
||||
msc_app_task(NULL);
|
||||
cdc_serial_app_task(NULL);
|
||||
led_blinking_task(NULL);
|
||||
rndis_app_task(NULL);
|
||||
}
|
||||
}
|
||||
#endif
|
||||
@ -123,21 +126,11 @@ int main(void)
|
||||
//------------- application task init -------------//
|
||||
(void) osal_task_create( OSAL_TASK_REF(led_blinking_task) );
|
||||
|
||||
#if TUSB_CFG_HOST_HID_KEYBOARD
|
||||
keyboard_app_init();
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_HOST_HID_MOUSE
|
||||
mouse_app_init();
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_HOST_CDC
|
||||
msc_app_init();
|
||||
cdc_serial_app_init();
|
||||
|
||||
#if TUSB_CFG_HOST_CDC_RNDIS
|
||||
rndis_app_init();
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//------------- start OS scheduler (never return) -------------//
|
||||
#if TUSB_CFG_OS == TUSB_OS_FREERTOS
|
||||
|
@ -156,5 +156,14 @@ static inline void process_mouse_report(tusb_mouse_report_t const * p_report)
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// dummy implementation to remove #ifdef in main.c
|
||||
void mouse_app_init(void) { }
|
||||
OSAL_TASK_FUNCTION( mouse_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
|
||||
#endif
|
||||
|
90
demos/host/src/msc_app.c
Normal file
90
demos/host/src/msc_app.c
Normal file
@ -0,0 +1,90 @@
|
||||
/**************************************************************************/
|
||||
/*!
|
||||
@file msc_app.c
|
||||
@author hathach (tinyusb.org)
|
||||
|
||||
@section LICENSE
|
||||
|
||||
Software License Agreement (BSD License)
|
||||
|
||||
Copyright (c) 2013, hathach (tinyusb.org)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
modification, are permitted provided that the following conditions are met:
|
||||
1. Redistributions of source code must retain the above copyright
|
||||
notice, this list of conditions and the following disclaimer.
|
||||
2. Redistributions in binary form must reproduce the above copyright
|
||||
notice, this list of conditions and the following disclaimer in the
|
||||
documentation and/or other materials provided with the distribution.
|
||||
3. Neither the name of the copyright holders nor the
|
||||
names of its contributors may be used to endorse or promote products
|
||||
derived from this software without specific prior written permission.
|
||||
|
||||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS ''AS IS'' AND ANY
|
||||
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
|
||||
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
|
||||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER BE LIABLE FOR ANY
|
||||
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
|
||||
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
|
||||
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
|
||||
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
|
||||
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
|
||||
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
This file is part of the tinyusb stack.
|
||||
*/
|
||||
/**************************************************************************/
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INCLUDE
|
||||
//--------------------------------------------------------------------+
|
||||
#include "mouse_app.h"
|
||||
|
||||
#if TUSB_CFG_OS != TUSB_OS_NONE
|
||||
#include "app_os_prio.h"
|
||||
#endif
|
||||
|
||||
#if TUSB_CFG_HOST_MSC
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// tinyusb callback (ISR context)
|
||||
//--------------------------------------------------------------------+
|
||||
void tusbh_msc_mounted_cb(uint8_t dev_addr)
|
||||
{
|
||||
printf("an msc device is mounted\n");
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
void msc_app_init(void)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
//------------- main task -------------//
|
||||
OSAL_TASK_FUNCTION( msc_app_task ) (void* p_task_para)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
#else
|
||||
// dummy implementation to remove #ifdef in main.c
|
||||
void msc_app_init(void) { }
|
||||
OSAL_TASK_FUNCTION( msc_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
|
||||
|
||||
#endif
|
@ -69,5 +69,20 @@ void rndis_app_init(void)
|
||||
|
||||
}
|
||||
|
||||
OSAL_TASK_FUNCTION( rndis_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// dummy implementation to remove #ifdef in main.c
|
||||
void rndis_app_init(void) { }
|
||||
OSAL_TASK_FUNCTION( rndis_app_task ) (void* p_task_para)
|
||||
{
|
||||
OSAL_TASK_LOOP_BEGIN
|
||||
OSAL_TASK_LOOP_END
|
||||
}
|
||||
|
||||
#endif
|
||||
|
@ -76,7 +76,7 @@
|
||||
#define TUSB_CFG_HOST_HID_KEYBOARD 1
|
||||
#define TUSB_CFG_HOST_HID_MOUSE 1
|
||||
#define TUSB_CFG_HOST_HID_GENERIC 0
|
||||
#define TUSB_CFG_HOST_MSC 0
|
||||
#define TUSB_CFG_HOST_MSC 1
|
||||
#define TUSB_CFG_HOST_CDC 1
|
||||
#define TUSB_CFG_HOST_CDC_RNDIS 1
|
||||
|
||||
|
@ -56,7 +56,7 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
//--------------------------------------------------------------------+
|
||||
/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX];
|
||||
/*STATIC_*/ cdch_data_t cdch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static
|
||||
|
||||
STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr) ATTR_PURE ATTR_ALWAYS_INLINE ATTR_WARN_UNUSED_RESULT;
|
||||
STATIC_ INLINE_ bool tusbh_cdc_is_mounted(uint8_t dev_addr)
|
||||
@ -193,7 +193,7 @@ tusb_error_t cdch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t con
|
||||
for(uint32_t i=0; i<2; i++)
|
||||
{
|
||||
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) p_desc;
|
||||
ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_CDCH_DESCRIPTOR_CORRUPTED);
|
||||
ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);
|
||||
|
||||
pipe_handle_t * p_pipe_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK ) ?
|
||||
&p_cdc->pipe_in : &p_cdc->pipe_out;
|
||||
|
@ -83,12 +83,8 @@ static inline tusb_error_t hidh_interface_open(uint8_t dev_addr, uint8_t interfa
|
||||
static inline void hidh_interface_close(uint8_t dev_addr, hidh_interface_info_t *p_hid) ATTR_ALWAYS_INLINE;
|
||||
static inline void hidh_interface_close(uint8_t dev_addr, hidh_interface_info_t *p_hid)
|
||||
{
|
||||
pipe_handle_t pipe_hdl = p_hid->pipe_hdl;
|
||||
if ( pipehandle_is_valid(pipe_hdl) )
|
||||
{
|
||||
memclr_(p_hid, sizeof(hidh_interface_info_t));
|
||||
ASSERT_INT( TUSB_ERROR_NONE, hcd_pipe_close(pipe_hdl), VOID_RETURN );
|
||||
}
|
||||
(void) hcd_pipe_close(p_hid->pipe_hdl);
|
||||
memclr_(p_hid, sizeof(hidh_interface_info_t));
|
||||
}
|
||||
|
||||
// called from public API need to validate parameters
|
||||
|
@ -71,6 +71,11 @@ enum {
|
||||
MSC_PROTOCOL_BOT = 0x50
|
||||
};
|
||||
|
||||
enum {
|
||||
MSC_REQUEST_GET_MAX_LUN = 254,
|
||||
MSC_REQUEST_RESET = 255
|
||||
};
|
||||
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// SCSI Primary Command (SPC-4)
|
||||
|
@ -51,6 +51,16 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// MACRO CONSTANT TYPEDEF
|
||||
//--------------------------------------------------------------------+
|
||||
typedef struct {
|
||||
pipe_handle_t bulk_in, bulk_out;
|
||||
uint8_t interface_number;
|
||||
uint8_t max_lun;
|
||||
}msch_interface_t;
|
||||
|
||||
/*STATIC_*/ msch_interface_t msch_data[TUSB_CFG_HOST_DEVICE_MAX]; // TODO to be static
|
||||
|
||||
// TODO rename this
|
||||
STATIC_ uint8_t msch_buffer[10] TUSB_CFG_ATTR_USBRAM;
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// INTERNAL OBJECT & FUNCTION DECLARATION
|
||||
@ -59,13 +69,61 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// IMPLEMENTATION
|
||||
//--------------------------------------------------------------------+
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// CLASS-USBH API (don't require to verify parameters)
|
||||
//--------------------------------------------------------------------+
|
||||
void msch_init(void)
|
||||
{
|
||||
|
||||
memclr_(msch_data, sizeof(msch_interface_t)*TUSB_CFG_HOST_DEVICE_MAX);
|
||||
}
|
||||
|
||||
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length)
|
||||
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length)
|
||||
{
|
||||
tusb_error_t error;
|
||||
|
||||
OSAL_SUBTASK_BEGIN
|
||||
|
||||
if (! ( MSC_SUBCLASS_SCSI == p_interface_desc->bInterfaceSubClass &&
|
||||
MSC_PROTOCOL_BOT == p_interface_desc->bInterfaceProtocol ) )
|
||||
{
|
||||
return TUSB_ERROR_MSCH_UNSUPPORTED_PROTOCOL;
|
||||
}
|
||||
|
||||
//------------- Open Data Pipe -------------//
|
||||
tusb_descriptor_endpoint_t const *p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( p_interface_desc );
|
||||
for(uint32_t i=0; i<2; i++)
|
||||
{
|
||||
ASSERT_INT(TUSB_DESC_TYPE_ENDPOINT, p_endpoint->bDescriptorType, TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED);
|
||||
|
||||
pipe_handle_t * p_pipe_hdl = ( p_endpoint->bEndpointAddress & TUSB_DIR_DEV_TO_HOST_MASK ) ?
|
||||
&msch_data[dev_addr-1].bulk_in : &msch_data[dev_addr-1].bulk_out;
|
||||
|
||||
(*p_pipe_hdl) = hcd_pipe_open(dev_addr, p_endpoint, TUSB_CLASS_MSC);
|
||||
ASSERT ( pipehandle_is_valid(*p_pipe_hdl), TUSB_ERROR_HCD_OPEN_PIPE_FAILED );
|
||||
|
||||
p_endpoint = (tusb_descriptor_endpoint_t const *) descriptor_next( p_endpoint );
|
||||
}
|
||||
|
||||
msch_data[dev_addr-1].interface_number = p_interface_desc->bInterfaceNumber;
|
||||
(*p_length) += sizeof(tusb_descriptor_interface_t) + 2*sizeof(tusb_descriptor_endpoint_t);
|
||||
|
||||
OSAL_SUBTASK_INVOKED_AND_WAIT(
|
||||
usbh_control_xfer_subtask( dev_addr, bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQUEST_TYPE_CLASS, TUSB_REQUEST_RECIPIENT_INTERFACE),
|
||||
MSC_REQUEST_GET_MAX_LUN, 0, msch_data[dev_addr-1].interface_number,
|
||||
1, msch_buffer ),
|
||||
error
|
||||
);
|
||||
|
||||
if(TUSB_ERROR_NONE == error /* TODO STALL means zero */)
|
||||
{
|
||||
msch_data[dev_addr-1].max_lun = msch_buffer[0];
|
||||
|
||||
tusbh_msc_mounted_cb(dev_addr);
|
||||
}
|
||||
|
||||
OSAL_SUBTASK_END
|
||||
|
||||
return TUSB_ERROR_NONE;
|
||||
}
|
||||
|
||||
@ -76,7 +134,10 @@ void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event)
|
||||
|
||||
void msch_close(uint8_t dev_addr)
|
||||
{
|
||||
(void) hcd_pipe_close(msch_data[dev_addr-1].bulk_in);
|
||||
(void) hcd_pipe_close(msch_data[dev_addr-1].bulk_out);
|
||||
|
||||
memclr_(&msch_data[dev_addr-1], sizeof(msch_interface_t));
|
||||
}
|
||||
|
||||
|
||||
|
@ -58,14 +58,17 @@
|
||||
//--------------------------------------------------------------------+
|
||||
// MASS STORAGE Application API
|
||||
//--------------------------------------------------------------------+
|
||||
bool tusbh_msc_scsi_is_supported(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_msc_scsi_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
bool tusbh_msc_is_supported(uint8_t dev_addr) ATTR_PURE ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_interface_status_t tusbh_msc_status(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
tusb_error_t tusbh_msc_inquiry(uint8_t dev_addr, uint8_t instance_num, msc_scsi_inquiry_t * p_inquiry_data) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_test_unit_ready(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_read_capacity10(uint8_t dev_addr, uint8_t instance_num, msc_scsi_read_capacity10_t * p_buffer) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_read10(uint8_t dev_addr, uint8_t instance_num, void * p_buffer, uint32_t length) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_write10(uint8_t dev_addr, uint8_t instance_num, void const * p_data, uint32_t length) ATTR_WARN_UNUSED_RESULT;
|
||||
//------------- Application Callback -------------//
|
||||
void tusbh_msc_mounted_cb(uint8_t dev_addr);
|
||||
|
||||
tusb_error_t tusbh_msc_scsi_inquiry(uint8_t dev_addr, uint8_t instance_num, msc_scsi_inquiry_t * p_inquiry_data) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_scsi_test_unit_ready(uint8_t dev_addr, uint8_t instance_num) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_scsi_read_capacity10(uint8_t dev_addr, uint8_t instance_num, msc_scsi_read_capacity10_t * p_buffer) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_scsi_read10(uint8_t dev_addr, uint8_t instance_num, void * p_buffer, uint32_t length) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t tusbh_msc_scsi_write10(uint8_t dev_addr, uint8_t instance_num, void const * p_data, uint32_t length) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
//--------------------------------------------------------------------+
|
||||
// USBH-CLASS DRIVER API
|
||||
@ -73,7 +76,7 @@ tusb_error_t tusbh_msc_scsi_write10(uint8_t dev_addr, uint8_t instance_num, voi
|
||||
#ifdef _TINY_USB_SOURCE_FILE_
|
||||
|
||||
void msch_init(void);
|
||||
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *descriptor, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t msch_open_subtask(uint8_t dev_addr, tusb_descriptor_interface_t const *p_interface_desc, uint16_t *p_length) ATTR_WARN_UNUSED_RESULT;
|
||||
void msch_isr(pipe_handle_t pipe_hdl, tusb_event_t event);
|
||||
void msch_close(uint8_t dev_addr);
|
||||
#endif
|
||||
|
@ -68,6 +68,7 @@
|
||||
ENTRY(TUSB_ERROR_HCD_OPEN_PIPE_FAILED )\
|
||||
ENTRY(TUSB_ERROR_USBH_MOUNT_DEVICE_NOT_RESPOND )\
|
||||
ENTRY(TUSB_ERROR_USBH_MOUNT_CONFIG_DESC_TOO_LONG )\
|
||||
ENTRY(TUSB_ERROR_USBH_DESCRIPTOR_CORRUPTED )\
|
||||
ENTRY(TUSB_ERROR_OSAL_TIMEOUT )\
|
||||
ENTRY(TUSB_ERROR_OSAL_WAITING ) /* only used by OSAL_NONE in the subtask */ \
|
||||
ENTRY(TUSB_ERROR_OSAL_TASK_FAILED )\
|
||||
@ -80,10 +81,10 @@
|
||||
ENTRY(TUSB_ERROR_HIDD_DESCRIPTOR_INTERFACE )\
|
||||
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_PROTOCOL )\
|
||||
ENTRY(TUSB_ERROR_HIDH_NOT_SUPPORTED_SUBCLASS )\
|
||||
ENTRY(TUSB_ERROR_CDCH_DESCRIPTOR_CORRUPTED )\
|
||||
ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_SUBCLASS )\
|
||||
ENTRY(TUSB_ERROR_CDCH_UNSUPPORTED_PROTOCOL )\
|
||||
ENTRY(TUSB_ERROR_CDCH_DEVICE_NOT_MOUNTED )\
|
||||
ENTRY(TUSB_ERROR_MSCH_UNSUPPORTED_PROTOCOL )\
|
||||
ENTRY(TUSB_ERROR_NOT_SUPPORTED_YET )\
|
||||
ENTRY(TUSB_ERROR_FAILED )\
|
||||
|
||||
|
@ -613,6 +613,7 @@ static void qhd_xfer_error_isr(ehci_qhd_t * p_qhd)
|
||||
tusb_xfer_type_t const xfer_type = qhd_get_xfer_type(p_qhd);
|
||||
tusb_event_t error_event;
|
||||
|
||||
// TODO allow stall with control pipe
|
||||
// no error bits are set, endpoint is halted due to STALL
|
||||
error_event = ( !(p_qhd->qtd_overlay.buffer_err || p_qhd->qtd_overlay.babble_err ||
|
||||
p_qhd->qtd_overlay.xact_err) ) ? TUSB_EVENT_XFER_STALLED : TUSB_EVENT_XFER_ERROR;
|
||||
|
@ -96,7 +96,7 @@ tusb_error_t hcd_pipe_control_close(uint8_t dev_addr) ATTR_WARN_UNUSED_RESULT;
|
||||
|
||||
pipe_handle_t hcd_pipe_open(uint8_t dev_addr, tusb_descriptor_endpoint_t const * endpoint_desc, uint8_t class_code) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t hcd_pipe_xfer(pipe_handle_t pipe_hdl, uint8_t buffer[], uint16_t total_bytes, bool int_on_complete) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) ATTR_WARN_UNUSED_RESULT;
|
||||
tusb_error_t hcd_pipe_close(pipe_handle_t pipe_hdl) /*ATTR_WARN_UNUSED_RESULT*/;
|
||||
bool hcd_pipe_is_idle(pipe_handle_t pipe_hdl);
|
||||
|
||||
#if 0
|
||||
|
@ -345,17 +345,15 @@ tusb_error_t enumeration_body_subtask(void)
|
||||
usbh_devices[0].hub_addr = enum_entry.hub_addr;
|
||||
usbh_devices[0].hub_port = enum_entry.hub_port;
|
||||
|
||||
osal_task_delay(200); // wait for device is stable
|
||||
|
||||
hcd_port_reset( usbh_devices[0].core_id ); // port must be reset to have correct speed operation
|
||||
osal_task_delay(50); // reset is recommended to last 50 ms
|
||||
usbh_devices[0].speed = hcd_port_speed_get( usbh_devices[0].core_id );
|
||||
|
||||
SUBTASK_ASSERT_STATUS( usbh_pipe_control_open(0, 8) );
|
||||
usbh_devices[0].state = TUSB_DEVICE_STATE_ADDRESSED;
|
||||
|
||||
#ifndef _TEST_
|
||||
// TODO hack delay 20 ms for slow device (use retry on the 1st xfer instead later)
|
||||
osal_task_delay(50);
|
||||
#endif
|
||||
|
||||
//------------- Get first 8 bytes of device descriptor to get Control Endpoint Size -------------//
|
||||
OSAL_SUBTASK_INVOKED_AND_WAIT(
|
||||
usbh_control_xfer_subtask( 0, bm_request_type(TUSB_DIR_DEV_TO_HOST, TUSB_REQUEST_TYPE_STANDARD, TUSB_REQUEST_RECIPIENT_DEVICE),
|
||||
@ -363,10 +361,10 @@ tusb_error_t enumeration_body_subtask(void)
|
||||
8, enum_data_buffer ),
|
||||
error
|
||||
);
|
||||
|
||||
SUBTASK_ASSERT_STATUS(error); // TODO some slow device is observed to fail the very fist controler xfer, can try more times
|
||||
SUBTASK_ASSERT_STATUS(error); // TODO some slow device is observed to fail the very fist controller xfer, can try more times
|
||||
|
||||
hcd_port_reset( usbh_devices[0].core_id ); // reset port after 8 byte descriptor
|
||||
osal_task_delay(50); // reset is recommended to last 50 ms
|
||||
|
||||
//------------- Set new address -------------//
|
||||
new_addr = get_new_address();
|
||||
|
Loading…
x
Reference in New Issue
Block a user