acassis opened a new pull request, #20905:
URL: https://github.com/apache/nuttx/pull/20905

   ## Summary
   
   The MAX3421E driver did not build with assertions disabled and, once built, 
could not enumerate a device.  These issues were found bringing it up on a 
stm32f103-minimum board with a Logitech Unifying receiver:
   
   - Make the "locked" debug field unconditional: DEBUGASSERT() still 
references it when CONFIG_DEBUG_ASSERTIONS is disabled.
   - Fix the inverted DEBUGASSERT in max3421e_chan_wakeup(): a transfer in 
progress has result == EBUSY.
   - Check the "locked" flag only after taking the SPI lock and clear it before 
releasing the lock, otherwise threads racing for the bus trigger false 
assertions.
   - Release the SPI lock on the getspeed() error path of enumerate() and drop 
the extra mutex unlock in getspeed().
   - CONNIRQ is also raised by our own bus resets.  Sample the bus and only act 
on a real attach/detach instead of resetting the bus again, which looped 
forever, and discard the CONNIRQ caused by the bus reset.
   - Register the waiter in the control status stages, and complete the HS-IN 
handshake on HXFRDNIRQ: a zero length packet never asserts RCVDAVIRQ.
   - Clear RCVDAVIRQ only after reading the RCVFIFO.  Clearing it releases the 
buffer and switches the double-buffered FIFO to the next packet.
   - Data toggles: start every control DATA stage with DATA1, save the toggles 
from HRSL (the HCTL bits are write-only strobes), restore them with a plain 
write (a read-modify-write of HCTL can re-trigger other strobes) and also 
restore them before IN transfers.
   - Clear a stale HXFRDNIRQ before launching a transfer, otherwise it is taken 
as the completion of the new transfer, HXFRDNIE gets disabled and the transfer 
never completes.
   - Reserve channel 0 for EP0 of the root hub so that max3421e_epalloc() does 
not hand it out and redirect control transfers to another endpoint.
   - Do not spin forever waiting for OSCOKIRQ during initialization.
   
   ## Impact
   
   Users will be able to use MAX3421E on boards without USB to get USB 
functionality.
   
   ## Testing
   
   Used with a wireless Logitech mouse (M510)
   
   ```
   nsh> tc
   tc_main: nsamples: 0
   tc_main: Opening /dev/mouse0
   Sample     :
      buttons : 00
            x : 313
            y : 21
   Sample     :
      buttons : 00
            x : 320
            y : 9
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 318                                                             
     
            y : 26                                                              
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 316                                                             
     
            y : 47                                                              
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 315                                                             
     
            y : 65                                                              
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 314                                                             
     
            y : 87                                                              
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 314                                                             
     
            y : 100                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 315                                                             
     
            y : 120                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 319                                                             
     
            y : 136                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 155                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 169                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 187                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 200                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 216                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 234                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 218                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 201                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 187                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 170                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 320                                                             
     
            y : 157                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 308                                                             
     
            y : 152                                                             
     
   Sample     :                                                                 
     
      buttons : 02                                                              
     
            x : 297                                                             
     
            y : 158                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 01                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 04                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 01                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 02                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 01                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 297                                                             
     
            y : 159                                                             
     
   Sample     :                                                                 
     
      buttons : 00                                                              
     
            x : 283                                                             
     
            y : 151
   ```


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to