Fork us on GitHub Follow us on Facebook Follow us on Twitter

Changeset 947d788 in mainline


Ignore:
Timestamp:
2010-12-08T14:30:49Z (11 years ago)
Author:
Vojtech Horky <vojtechhorky@…>
Branches:
lfn, master
Children:
9501cced
Parents:
bb95594
Message:

Virtual HC uses unified usb_dprintf function

Location:
uspace/drv
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • uspace/drv/uhci/main.c

    rbb95594 r947d788  
    2727 */
    2828#include <usb/hcdhubd.h>
     29#include <usb/debug.h>
    2930#include <errno.h>
    3031#include "uhci.h"
     
    3637static int uhci_add_device(device_t *device)
    3738{
     39        usb_dprintf(NAME, 1, "uhci_add_device() called\n");
    3840        device->ops = &uhci_ops;
    3941
     
    4143         * We need to announce the presence of our root hub.
    4244         */
     45        usb_dprintf(NAME, 2, "adding root hub\n");
    4346        usb_hcd_add_root_hub(device);
    4447
     
    6164         */
    6265        sleep(5);
     66        usb_dprintf_enable(NAME, 5);
    6367
    6468        return driver_main(&uhci_driver);
  • uspace/drv/vhc/debug.c

    rbb95594 r947d788  
    3535#include <stdio.h>
    3636#include <ipc/ipc.h>
     37#include <usb/debug.h>
    3738
    3839#include "vhcd.h"
    3940
    40 /** Current debug level. */
    41 int debug_level = 0;
    42 
    43 /** Debugging printf.
    44  * This function is intended for single-line messages as it
    45  * automatically prints debugging prefix at the beginning of the
    46  * line.
    47  *
    48  * @see printf
    49  * @param level Debugging level.
    50  */
    51 void dprintf(int level, const char *format, ...)
    52 {
    53         if (level > debug_level) {
    54                 return;
    55         }
    56        
    57         printf("%s(%d): ", NAME, level);
    58         va_list args;
    59         va_start(args, format);
    60         vprintf(format, args);
    61         va_end(args);
    62         printf("\n");
    63 }
    6441
    6542/** Debug print informing of invalid call.
  • uspace/drv/vhc/hcd.c

    rbb95594 r947d788  
    111111        printf("%s: virtual USB host controller driver.\n", NAME);
    112112
    113         debug_level = 10;
     113        usb_dprintf_enable(NAME, 10);
    114114
    115115        fid_t fid = fibril_create(hc_manager_fibril, NULL);
  • uspace/drv/vhc/vhcd.h

    rbb95594 r947d788  
    3636#define VHCD_VHCD_H_
    3737
     38#include <usb/debug.h>
     39
    3840#define NAME "vhc"
    3941#define NAME_DEV "hcd-virt-dev"
     
    4345#define DEVMAP_PATH_DEV NAMESPACE "/" NAME_DEV
    4446
    45 extern int debug_level;
    46 void dprintf(int, const char *, ...);
     47#define dprintf(level, format, ...) \
     48        usb_dprintf(NAME, (level), format "\n", ##__VA_ARGS__)
    4749void dprintf_inval_call(int, ipc_call_t, ipcarg_t);
    4850
Note: See TracChangeset for help on using the changeset viewer.