Modules/USB - Documention/Debugging, and fixed an API use
[tpg/acess2.git] / KernelLand / Modules / USB / Core / usb_poll.c
index b6927fe..6285a11 100644 (file)
@@ -5,9 +5,10 @@
  * usb_poll.c
  * - Endpoint polling
  */
-#define DEBUG  1
+#define DEBUG  0
 #include <usb_core.h>
 #include "usb.h"
+#include <timers.h>
 
 #define POLL_ATOM      25      // 25ms atom
 #define POLL_MAX       256     // Max period that can be nominated
@@ -28,9 +29,14 @@ void USB_StartPollingEndpoint(tUSBInterface *Iface, int Endpoint)
 {
        tUSBEndpoint    *endpt;
 
+       ENTER("pIface iEndpoint", Iface, Endpoint);
+       LEAVE('-');
+
        // Some sanity checks
-       if(Endpoint <= 0 || Endpoint > Iface->nEndpoints)       return ;
+       if(Endpoint <= 0 || Endpoint > Iface->nEndpoints)
+               return ;
        endpt = &Iface->Endpoints[Endpoint-1];
+       LOG("endpt(%p)->PollingPeriod = %i", endpt, endpt->PollingPeriod);
        if(endpt->PollingPeriod > POLL_MAX || endpt->PollingPeriod <= 0)
                return ;
 
@@ -41,6 +47,7 @@ void USB_StartPollingEndpoint(tUSBInterface *Iface, int Endpoint)
        // Determine polling period in atoms
        endpt->PollingAtoms = (endpt->PollingPeriod + POLL_ATOM-1) / POLL_ATOM;
        if(endpt->PollingAtoms > POLL_SLOTS)    endpt->PollingAtoms = POLL_SLOTS;
+       LOG("endpt(%p)->PollingAtoms = %i", endpt, endpt->PollingAtoms);
        // Add to poll queue
        // TODO: Locking
        {
@@ -80,7 +87,7 @@ int USB_PollThread(void *unused)
                for( ep = gUSB_PollQueues[giUSB_PollPosition]; ep; prev = ep, ep = ep->Next )
                {
                         int    period_in_atoms = ep->PollingAtoms;
-//                     LOG("%i: ep = %p", giUSB_PollPosition, ep);
+                       LOG("%i: ep = %p", giUSB_PollPosition, ep);
 
                        // Check for invalid entries
                        if(period_in_atoms < 0 || period_in_atoms > POLL_ATOM)

UCC git Repository :: git.ucc.asn.au