usb: disable USB_LOG_TR() when no log is configured
For some reason this has a *massive* impact on read performance, like 78 ms -> 20 ms on a full-screen read (177 kB) on the CG-50.
This commit is contained in:
parent
3a2a194693
commit
1423f40a96
|
@ -391,6 +391,8 @@ void usb_read_cancel(int pipe);
|
|||
|
||||
/* usb_set_log(): Set the logging function for the USB driver */
|
||||
void usb_set_log(void (*logger)(char const *format, va_list args));
|
||||
/* usb_get_log(): Get the logging function */
|
||||
void (*usb_get_log(void))(char const *format, va_list args);
|
||||
/* usb_log(): Send a message to the USB log */
|
||||
void usb_log(char const *format, ...);
|
||||
|
||||
|
@ -398,6 +400,8 @@ void usb_log(char const *format, ...);
|
|||
The function is called atomically, thus cannot be interrupted, therefore it
|
||||
is safe to call usb_trace() in interrupt handlers. */
|
||||
void usb_set_trace(void (*tracer)(char const *message));
|
||||
/* usb_get_trace(): Get the tracing function */
|
||||
void (*usb_get_trace(void))(char const *message);
|
||||
/* usb_trace(): Trace the current state of the driver */
|
||||
void usb_trace(char const *message);
|
||||
|
||||
|
|
|
@ -529,6 +529,9 @@ void usb_pipe_write_bemp(int pipe)
|
|||
#ifdef GINT_USB_DEBUG
|
||||
static void USB_LOG_TR(char const *p, asyncio_op_t *t, char const *fmt, ...)
|
||||
{
|
||||
if(!usb_get_log())
|
||||
return;
|
||||
|
||||
int E = USB.INTENB0.BRDYE;
|
||||
USB.INTENB0.BRDYE = 0;
|
||||
|
||||
|
|
|
@ -40,6 +40,11 @@ void usb_set_log(void (*logger)(char const *format, va_list args))
|
|||
usb_logger = logger;
|
||||
}
|
||||
|
||||
void (*usb_get_log(void))(char const *format, va_list args)
|
||||
{
|
||||
return usb_logger;
|
||||
}
|
||||
|
||||
void usb_log(char const *format, ...)
|
||||
{
|
||||
if(!usb_logger) return;
|
||||
|
@ -54,6 +59,11 @@ void usb_set_trace(void (*tracer)(char const *message))
|
|||
usb_tracer = tracer;
|
||||
}
|
||||
|
||||
void (*usb_get_trace(void))(char const *message)
|
||||
{
|
||||
return usb_tracer;
|
||||
}
|
||||
|
||||
void usb_trace(char const *message)
|
||||
{
|
||||
if(usb_tracer) {
|
||||
|
|
Loading…
Reference in New Issue