AnsweredAssumed Answered

Possible BUG in USB 5.0 Stack (yes, another one)

Question asked by John Strohm on Nov 13, 2014
Latest reply on Nov 18, 2014 by John Strohm

In file usb_dev.c, lines 276-278, I find the following:

 

            if((event->direction == USB_RECV) && (event->buffer_ptr != NULL))

                OS_dcache_invalidate_mlines((void*)event->buffer_ptr,event->len);

            service_ptr->service(event,service_ptr->arg);

 

In file adapter_bm.h, line 64, I find the following:

 

#define OS_dcache_invalidate_mlines(p,n)

 

The combination of these lines looks, to me, suspiciously like one of those old-time cartoon bombs, with the big,black sphere, and the fuse sizzling away.  The hapless customer who attempts to use the library on bare metal, without MQX, is likely to find himself chasing an interesting problem.  Once the preprocessor does its thing, the compiler will see:

 

            if((event->direction == USB_RECV) && (event->buffer_ptr != NULL))

                service_ptr->service(event,service_ptr->arg);  /* indentation added to emphasize issue */


which is probably not exactly what is wanted, if the direction happened to be USB_SEND.

 

May I respectfully suggest the following modification?

 

            if((event->direction == USB_RECV) && (event->buffer_ptr != NULL))

            {

                OS_dcache_invalidate_mlines((void*)event->buffer_ptr,event->len);

            }

            service_ptr->service(event,service_ptr->arg);

Outcomes