Changeset afcd86e in mainline
- Timestamp:
- 2011-02-01T22:19:15Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c56dbe0
- Parents:
- 7ce0fe3
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 2 deleted
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/callback.c
r7ce0fe3 rafcd86e 1 1 #include <errno.h> 2 2 #include <mem.h> 3 4 #include <usb/debug.h> 3 5 4 6 #include "callback.h" … … 12 14 instance->new_buffer = malloc32(size); 13 15 if (!instance->new_buffer) { 14 u hci_print_error("Failed to allocate device acessible buffer.\n");16 usb_log_error("Failed to allocate device acessible buffer.\n"); 15 17 return ENOMEM; 16 18 } … … 46 48 if (instance->callback_in) { 47 49 assert(instance->callback_out == NULL); 48 u hci_print_verbose("Callback in: %p %x %d.\n",50 usb_log_debug("Callback in: %p %x %d.\n", 49 51 instance->callback_in, outcome, act_size); 50 52 instance->callback_in( … … 53 55 assert(instance->callback_out); 54 56 assert(instance->callback_in == NULL); 55 u hci_print_verbose("Callback out: %p %p %x %p .\n",57 usb_log_debug("Callback out: %p %p %x %p .\n", 56 58 instance->callback_out, instance->dev, outcome, instance->arg); 57 59 instance->callback_out( -
uspace/drv/uhci-hcd/callback.h
r7ce0fe3 rafcd86e 38 38 #include <usb/usb.h> 39 39 40 #include "debug.h"41 40 #include "utils/malloc32.h" 42 41 -
uspace/drv/uhci-hcd/main.c
r7ce0fe3 rafcd86e 28 28 #include <driver.h> 29 29 #include <errno.h> 30 #include <str_error.h>31 30 #include <usb_iface.h> 32 31 33 #include "debug.h" 32 #include <usb/debug.h> 33 34 34 #include "iface.h" 35 #include "name.h"36 35 #include "pci.h" 37 36 #include "root_hub.h" 38 37 #include "uhci.h" 38 39 #define NAME "uhci-hcd" 39 40 40 41 static int usb_iface_get_hc_handle(device_t *dev, devman_handle_t *handle) … … 58 59 static int uhci_add_device(device_t *device) 59 60 { 60 uhci_print_info( "uhci_add_device() called\n" ); 61 assert(device); 62 63 usb_log_info("uhci_add_device() called\n"); 61 64 device->ops = &uhci_ops; 62 65 … … 69 72 70 73 if (rc != EOK) { 71 u hci_print_fatal("failed to get I/O registers addresses: %s.\n",72 str_error(rc));74 usb_log_error("Failed(%d) to get I/O registers addresses for device:.\n", 75 rc, device->handle); 73 76 return rc; 74 77 } 75 78 76 u hci_print_info("I/O regs at 0x%X (size %zu), IRQ %d.\n",79 usb_log_info("I/O regs at 0x%X (size %zu), IRQ %d.\n", 77 80 io_reg_base, io_reg_size, irq); 78 81 … … 80 83 81 84 if (ret != EOK) { 82 u hci_print_error("Failed to init uhci-hcd.\n");85 usb_log_error("Failed to init uhci-hcd.\n"); 83 86 return ret; 84 87 } … … 87 90 88 91 if (ret != EOK) { 89 u hci_print_error("Failed to setup uhci root hub.\n");92 usb_log_error("Failed to setup uhci root hub.\n"); 90 93 /* TODO: destroy uhci here */ 91 94 return ret; … … 94 97 ret = child_device_register(rh, device); 95 98 if (ret != EOK) { 96 u hci_print_error("Failed to register root hub.\n");99 usb_log_error("Failed to register root hub.\n"); 97 100 /* TODO: destroy uhci here */ 98 101 return ret; … … 117 120 */ 118 121 sleep(5); 119 usb_ dprintf_enable(NAME, DEBUG_LEVEL_INFO);122 usb_log_enable(USB_LOG_LEVEL_INFO, NAME); 120 123 121 124 return driver_main(&uhci_driver); -
uspace/drv/uhci-hcd/root_hub.c
r7ce0fe3 rafcd86e 2 2 #include <errno.h> 3 3 #include <stdio.h> 4 4 5 #include <usb_iface.h> 5 6 6 #include "debug.h" 7 #include <usb/debug.h> 8 7 9 #include "root_hub.h" 8 10 /*----------------------------------------------------------------------------*/ … … 27 29 } 28 30 /*----------------------------------------------------------------------------*/ 29 30 31 static usb_iface_t usb_iface = { 31 32 .get_hc_handle = usb_iface_get_hc_handle … … 41 42 device_t *hub = create_device(); 42 43 if (!hub) { 43 u hci_print_error("Failed to create root hub device structure.\n");44 usb_log_error("Failed to create root hub device structure.\n"); 44 45 return ENOMEM; 45 46 } … … 47 48 int ret = asprintf(&name, "UHCI Root Hub"); 48 49 if (ret < 0) { 49 u hci_print_error("Failed to create root hub name.\n");50 usb_log_error("Failed to create root hub name.\n"); 50 51 free(hub); 51 52 return ENOMEM; … … 55 56 ret = asprintf(&match_str, "usb&uhci&root-hub"); 56 57 if (ret < 0) { 57 u hci_print_error("Failed to create root hub match string.\n");58 usb_log_error("Failed to create root hub match string.\n"); 58 59 free(hub); 59 60 free(name); … … 63 64 match_id_t *match_id = create_match_id(); 64 65 if (!match_id) { 65 u hci_print_error("Failed to create root hub match id.\n");66 usb_log_error("Failed to create root hub match id.\n"); 66 67 free(hub); 67 68 free(match_str); -
uspace/drv/uhci-hcd/transfer_list.c
r7ce0fe3 rafcd86e 1 1 #include <errno.h> 2 3 #include <usb/debug.h> 2 4 3 5 #include "transfer_list.h" … … 10 12 instance->queue_head = malloc32(sizeof(queue_head_t)); 11 13 if (!instance->queue_head) { 12 u hci_print_error("Failed to allocate queue head.\n");14 usb_log_error("Failed to allocate queue head.\n"); 13 15 return ENOMEM; 14 16 } … … 46 48 instance->queue_head->element = (pa & LINK_POINTER_ADDRESS_MASK); 47 49 } 48 u hci_print_verbose("Successfully added transfer to the hc queue %p.\n",50 usb_log_debug("Successfully added transfer to the hc queue %p.\n", 49 51 instance); 50 52 return EOK; -
uspace/drv/uhci-hcd/transfer_list.h
r7ce0fe3 rafcd86e 35 35 #define DRV_UHCI_TRANSFER_LIST_H 36 36 37 #include "debug.h"38 37 #include "uhci_struct/queue_head.h" 39 38 #include "uhci_struct/transfer_descriptor.h" -
uspace/drv/uhci-hcd/uhci.c
r7ce0fe3 rafcd86e 1 1 #include <errno.h> 2 2 3 #include <usb/debug.h> 3 4 #include <usb/usb.h> 4 5 5 6 #include "utils/malloc32.h" 6 7 #include "debug.h"8 #include "name.h"9 7 #include "uhci.h" 10 8 … … 16 14 { 17 15 assert(device); 18 u hci_print_info("Initializing device at address %p.\n", device);16 usb_log_info("Initializing device at address %p.\n", device); 19 17 20 18 #define CHECK_RET_FREE_INSTANCE(message...) \ 21 19 if (ret != EOK) { \ 22 u hci_print_error(message); \20 usb_log_error(message); \ 23 21 if (instance) { \ 24 22 free(instance); \ … … 36 34 /* init address keeper(libusb) */ 37 35 usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX); 38 u hci_print_verbose("Initialized address manager.\n");36 usb_log_debug("Initialized address manager.\n"); 39 37 40 38 /* allow access to hc control registers */ … … 44 42 CHECK_RET_FREE_INSTANCE("Failed to gain access to registers at %p.\n", io); 45 43 instance->registers = io; 46 u hci_print_verbose("Device registers accessible.\n");44 usb_log_debug("Device registers accessible.\n"); 47 45 48 46 /* init transfer lists */ 49 47 ret = uhci_init_transfer_lists(instance->transfers); 50 48 CHECK_RET_FREE_INSTANCE("Failed to initialize transfer lists.\n"); 51 u hci_print_verbose("Transfer lists initialized.\n");52 53 54 u hci_print_verbose("Initializing frame list.\n");49 usb_log_debug("Transfer lists initialized.\n"); 50 51 52 usb_log_debug("Initializing frame list.\n"); 55 53 instance->frame_list = get_page(); 56 54 ret = instance ? EOK : ENOMEM; … … 76 74 fibril_add_ready(instance->debug_checker); 77 75 78 u hci_print_verbose("Starting UHCI HC.\n");76 usb_log_debug("Starting UHCI HC.\n"); 79 77 pio_write_16(&instance->registers->usbcmd, UHCI_CMD_RUN_STOP); 80 78 /* … … 96 94 ret = transfer_list_init(&transfers[USB_TRANSFER_BULK], NULL); 97 95 if (ret != EOK) { 98 u hci_print_error("Failed to initialize bulk queue.\n");96 usb_log_error("Failed to initialize bulk queue.\n"); 99 97 return ret; 100 98 } … … 103 101 &transfers[USB_TRANSFER_CONTROL], &transfers[USB_TRANSFER_BULK]); 104 102 if (ret != EOK) { 105 u hci_print_error("Failed to initialize control queue.\n");103 usb_log_error("Failed to initialize control queue.\n"); 106 104 transfer_list_fini(&transfers[USB_TRANSFER_BULK]); 107 105 return ret; … … 111 109 &transfers[USB_TRANSFER_INTERRUPT], &transfers[USB_TRANSFER_CONTROL]); 112 110 if (ret != EOK) { 113 u hci_print_error("Failed to initialize interrupt queue.\n");111 usb_log_error("Failed to initialize interrupt queue.\n"); 114 112 transfer_list_fini(&transfers[USB_TRANSFER_CONTROL]); 115 113 transfer_list_fini(&transfers[USB_TRANSFER_BULK]); … … 144 142 #define CHECK_RET_TRANS_FREE_JOB_TD(message) \ 145 143 if (ret != EOK) { \ 146 u hci_print_error(message); \144 usb_log_error(message); \ 147 145 if (job) { \ 148 146 callback_dispose(job); \ … … 167 165 assert(instance); 168 166 169 u hci_print_verbose("Appending a new transfer to queue.\n");167 usb_log_debug("Appending a new transfer to queue.\n"); 170 168 ret = transfer_list_append(&instance->transfers[transfer_type], td); 171 169 CHECK_RET_TRANS_FREE_JOB_TD("Failed to append transfer descriptor.\n"); … … 176 174 int uhci_clean_finished(void* arg) 177 175 { 178 u hci_print_verbose("Started cleaning fibril.\n");176 usb_log_debug("Started cleaning fibril.\n"); 179 177 uhci_t *instance = (uhci_t*)arg; 180 178 assert(instance); 181 179 182 180 while(1) { 183 u hci_print_verbose("Running cleaning fibril on: %p.\n", instance);181 usb_log_debug("Running cleaning fibril on: %p.\n", instance); 184 182 /* iterate all transfer queues */ 185 183 int i = 0; … … 189 187 volatile transfer_descriptor_t * it = 190 188 instance->transfers[i].first; 191 u hci_print_verbose("Running cleaning fibril on queue: %p (%s).\n",189 usb_log_debug("Running cleaning fibril on queue: %p (%s).\n", 192 190 &instance->transfers[i], it ? "SOMETHING" : "EMPTY"); 193 191 194 192 if (it) 195 u hci_print_verbose("First in queue: %p (%x).\n",193 usb_log_debug("First in queue: %p (%x).\n", 196 194 it, it->status); 197 195 … … 199 197 !(instance->transfers[i].first->status & TD_STATUS_ERROR_ACTIVE)) { 200 198 transfer_descriptor_t *transfer = instance->transfers[i].first; 201 u hci_print_info("Inactive transfer calling callback with status %x.\n",199 usb_log_info("Inactive transfer calling callback with status %x.\n", 202 200 transfer->status); 203 201 instance->transfers[i].first = transfer->next_va; … … 219 217 uint16_t cmd = pio_read_16(&instance->registers->usbcmd); 220 218 uint16_t sts = pio_read_16(&instance->registers->usbsts); 221 u hci_print_verbose("Command register: %X Status register: %X\n", cmd, sts);219 usb_log_debug("Command register: %X Status register: %X\n", cmd, sts); 222 220 /* 223 221 uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd); 224 u hci_print_verbose("Framelist address: %p vs. %p.\n",222 usb_log_debug("Framelist address: %p vs. %p.\n", 225 223 frame_list, addr_to_phys(instance->frame_list)); 226 224 int frnum = pio_read_16(&instance->registers->frnum) & 0x3ff; 227 u hci_print_verbose("Framelist item: %d \n", frnum );225 usb_log_debug("Framelist item: %d \n", frnum ); 228 226 229 227 queue_head_t* qh = instance->transfers[USB_TRANSFER_INTERRUPT].queue_head; 230 u hci_print_verbose("Interrupt QH: %p vs. %p.\n",228 usb_log_debug("Interrupt QH: %p vs. %p.\n", 231 229 instance->frame_list[frnum], addr_to_phys(qh)); 232 230 233 u hci_print_verbose("Control QH: %p vs. %p.\n", qh->next_queue,231 usb_log_debug("Control QH: %p vs. %p.\n", qh->next_queue, 234 232 addr_to_phys(instance->transfers[USB_TRANSFER_CONTROL].queue_head)); 235 233 qh = instance->transfers[USB_TRANSFER_CONTROL].queue_head; 236 234 237 u hci_print_verbose("Bulk QH: %p vs. %p.\n", qh->next_queue,235 usb_log_debug("Bulk QH: %p vs. %p.\n", qh->next_queue, 238 236 addr_to_phys(instance->transfers[USB_TRANSFER_BULK].queue_head)); 239 237 uint16_t cmd = pio_read_16(&instance->registers->usbcmd); -
uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c
r7ce0fe3 rafcd86e 1 #include <usb/debug.h> 2 1 3 #include "transfer_descriptor.h" 2 4 … … 31 33 } 32 34 33 u hci_print_info("Created TD: %X:%X:%X:%X(%p).\n",35 usb_log_info("Created TD: %X:%X:%X:%X(%p).\n", 34 36 instance->next, instance->status, instance->device, 35 37 instance->buffer_ptr, buffer);
Note:
See TracChangeset
for help on using the changeset viewer.