@@ -36,7 +36,6 @@ USBHost::USBHost() : bmHubPre(0) {
36
36
uint32_t USBHost::Init () {
37
37
// devConfigIndex = 0;
38
38
// Init host stack
39
- init ();
40
39
bmHubPre = 0 ;
41
40
UHD_Init ();
42
41
return 0 ;
@@ -124,7 +123,7 @@ uint32_t USBHost::SetPipeAddress(uint32_t addr, uint32_t ep, EpInfo **ppep, uint
124
123
/* 01-0f = non-zero HRSLT */
125
124
uint32_t USBHost::ctrlReq (uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t bRequest, uint8_t wValLo, uint8_t wValHi,
126
125
uint16_t wInd, uint16_t total, uint32_t nbytes, uint8_t * dataptr, USBReadParser *p) {
127
-
126
+
128
127
uint32_t direction = 0 ; // Request direction, IN or OUT
129
128
uint32_t rcode;
130
129
SETUP_PKT setup_pkt;
@@ -143,7 +142,7 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t
143
142
if (rcode)
144
143
{
145
144
TRACE_USBHOST (printf (" /!\\ USBHost::ctrlReq : EP0 allocation error: %lu\r\n " , rcode);)
146
- // USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
145
+ // USBTRACE2("\n\rUSBHost::ctrlReq : EP0 allocation error: ", rcode");
147
146
return rcode;
148
147
}
149
148
@@ -195,14 +194,14 @@ uint32_t USBHost::ctrlReq(uint32_t addr, uint32_t ep, uint8_t bmReqType, uint8_t
195
194
((USBReadParser*)p)->Parse (read, dataptr, total - left);
196
195
}
197
196
else // OUT transfer
198
- {
197
+ {
199
198
pep->bmSndToggle = 1 ; // bmSNDTOG1;
200
199
rcode = OutTransfer (pep, nak_limit, nbytes, dataptr);
201
200
}
202
201
if (rcode) // return error
203
202
return (rcode);
204
203
}
205
-
204
+
206
205
// Status stage
207
206
UHD_Pipe_CountZero (pep->epAddr );
208
207
USB->HOST .HostPipe [pep->epAddr ].PSTATUSSET .reg = USB_HOST_PSTATUSSET_DTGL;
@@ -268,11 +267,11 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
268
267
}
269
268
/* check for RCVDAVIRQ and generate error if not present */
270
269
/* the only case when absence of RCVDAVIRQ makes sense is when toggle error occurred. Need to add handling for that */
271
-
270
+
272
271
pktsize = uhd_byte_count (pep->epAddr ); // Number of received bytes
273
-
272
+
274
273
USB->HOST .HostPipe [pep->epAddr ].PSTATUSCLR .reg = USB_HOST_PSTATUSCLR_BK0RDY;
275
-
274
+
276
275
// printf("Got %i bytes \r\n", pktsize);
277
276
// This would be OK, but...
278
277
// assert(pktsize <= nbytes);
@@ -297,7 +296,7 @@ uint32_t USBHost::InTransfer(EpInfo *pep, uint32_t nak_limit, uint8_t *nbytesptr
297
296
/* 1. The device sent a short packet (L.T. maxPacketSize) */
298
297
/* 2. 'nbytes' have been transferred. */
299
298
if ((pktsize < maxpktsize) || (*nbytesptr >= nbytes)) // have we transferred 'nbytes' bytes?
300
- {
299
+ {
301
300
// Save toggle value
302
301
pep->bmRcvToggle = USB_HOST_DTGL (pep->epAddr );
303
302
// printf("\r\n");
@@ -494,8 +493,7 @@ void USBHost::Task(void) //USB state machine
494
493
TRACE_USBHOST (printf (" + USB_DETACHED_SUBSTATE_INITIALIZE\r\n " );)
495
494
496
495
// Init USB stack and driver
497
- UHD_Init ();
498
- init ();
496
+ Init ();
499
497
500
498
// Free all USB resources
501
499
for (uint32_t i = 0 ; i < USB_NUMDEVICES; ++i)
0 commit comments