Changes in / [4046c1ea:44d8853] in mainline
- Location:
- uspace/drv/uhci
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci/debug.h
r4046c1ea r44d8853 60 60 usb_dprintf( NAME, DEBUG_LEVEL_VERBOSE, fmt, ##args ) 61 61 62 #define UHCI_GET_STR_FLAG(reg, flag, msg_set, msg_unset) \63 ((((reg) & (flag)) > 0) ? (msg_set) : (msg_unset))64 65 66 62 #endif 67 63 /** -
uspace/drv/uhci/root_hub/port.c
r4046c1ea r44d8853 1 1 2 2 #include <errno.h> 3 #include <str_error.h>4 3 //#include <usb/devreq.h> /* for usb_device_request_setup_packet_t */ 5 4 #include <usb/usb.h> … … 23 22 24 23 while (1) { 25 /* Read port status. */ 24 uhci_print_info("Port(%d) status address %p:\n", 25 port_instance->number, port_instance->address); 26 27 /* read register value */ 26 28 port_status_t port_status = 27 29 port_status_read(port_instance->address); 28 30 29 uhci_print_info("Port %d: %04X (@ 0x%x) = " \ 30 "%s,%s,%s,%s,[%s,%s],%s,%s,%s,%s\n", 31 port_instance->number, port_status, port_instance->address, 32 UHCI_GET_STR_FLAG(port_status, STATUS_SUSPEND, "suspend", "up"), 33 UHCI_GET_STR_FLAG(port_status, STATUS_IN_RESET, "in reset", "-"), 34 UHCI_GET_STR_FLAG(port_status, STATUS_LOW_SPEED, "lowsp", "fullsp"), 35 UHCI_GET_STR_FLAG(port_status, STATUS_RESUME, "resume", "k-state"), 36 UHCI_GET_STR_FLAG(port_status, STATUS_LINE_D_MINUS, "D- on", "D- off"), 37 UHCI_GET_STR_FLAG(port_status, STATUS_LINE_D_PLUS, "D+ on", "D+ off"), 38 UHCI_GET_STR_FLAG(port_status, STATUS_ENABLED_CHANGED, "enblchg", "-"), 39 UHCI_GET_STR_FLAG(port_status, STATUS_ENABLED, "enabled", "disabled"), 40 UHCI_GET_STR_FLAG(port_status, STATUS_CONNECTED_CHANGED, "connchg", "-"), 41 UHCI_GET_STR_FLAG(port_status, STATUS_CONNECTED, "hasdev", "nodev")); 31 /* debug print */ 32 uhci_print_info("Port(%d) status %#.4x:\n", 33 port_instance->number, port_status); 34 print_port_status(port_status); 42 35 43 36 if (port_status & STATUS_CONNECTED_CHANGED) { … … 99 92 100 93 if (ret != EOK) { /* address assigning went wrong */ 101 uhci_print_error("Failed to assign address (port %d): %s.\n", 102 port->number, str_error(ret)); 94 uhci_print_error("Failed(%d) to assign address to the device.\n", ret); 103 95 uhci_port_set_enabled(port, false); 104 96 usb_address_keeping_release_default(&uhci_instance->address_manager); -
uspace/drv/uhci/uhci.c
r4046c1ea r44d8853 219 219 return EOK; 220 220 } 221 222 221 /*---------------------------------------------------------------------------*/ 223 222 int uhci_debug_checker(void *arg) … … 229 228 reg = pio_read_16(&instance->registers->usbcmd); 230 229 uhci_print_info("Command register: %X\n", reg); 231 232 230 reg = pio_read_16(&instance->registers->usbsts); 233 uhci_print_info("Status register: %X (%s,%s,%s,%s,%s,%s)\n", 234 reg, 235 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_HALTED, "halted", "-"), 236 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_PROCESS_ERROR, "prerr", "-"), 237 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_SYSTEM_ERROR, "syserr", "-"), 238 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_RESUME, "res", "-"), 239 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_ERROR_INTERRUPT, "errintr", "-"), 240 UHCI_GET_STR_FLAG(reg, UHCI_STATUS_INTERRUPT, "intr", "-")); 231 uhci_print_info("Status register: %X\n", reg); 241 232 /* 242 233 uintptr_t frame_list = pio_read_32(&instance->registers->flbaseadd); -
uspace/drv/uhci/uhci.h
r4046c1ea r44d8853 56 56 57 57 uint16_t usbsts; 58 #define UHCI_STATUS_HALTED (1 << 5)59 #define UHCI_STATUS_PROCESS_ERROR (1 << 4)60 #define UHCI_STATUS_SYSTEM_ERROR (1 << 3)61 #define UHCI_STATUS_RESUME (1 << 2)62 #define UHCI_STATUS_ERROR_INTERRUPT (1 << 1)63 #define UHCI_STATUS_INTERRUPT (1 << 0)64 65 58 uint16_t usbintr; 66 59 uint16_t frnum; -
uspace/drv/uhci/uhci_struct/transfer_descriptor.c
r4046c1ea r44d8853 1 #include <stdio.h>2 1 #include "transfer_descriptor.h" 3 4 #define BUFFER_LEN 105 6 static void buffer_to_str(char *str, size_t str_size,7 uint8_t *buffer, size_t buffer_size)8 {9 if (buffer_size == 0) {10 *str = 0;11 return;12 }13 while (str_size >= 4) {14 snprintf(str, 4, " %02X", (int) *buffer);15 str += 3;16 str_size -= 3;17 buffer++;18 buffer_size--;19 if (buffer_size == 0) {20 break;21 }22 }23 }24 2 25 3 void transfer_descriptor_init(transfer_descriptor_t *instance, … … 41 19 uhci_print_verbose("Creating status field: %x.\n", instance->status); 42 20 43 uint32_t maxlen_field = (size == 0) ? 0x7FF : ((uint32_t) size - 1);44 maxlen_field = (maxlen_field & TD_DEVICE_MAXLEN_MASK)45 << TD_DEVICE_MAXLEN_POS;46 21 instance->device = 0 47 | ( maxlen_field)22 | (((size - 1) & TD_DEVICE_MAXLEN_MASK) << TD_DEVICE_MAXLEN_POS) 48 23 | ((target.address & TD_DEVICE_ADDRESS_MASK) << TD_DEVICE_ADDRESS_POS) 49 24 | ((target.endpoint & TD_DEVICE_ENDPOINT_MASK) << TD_DEVICE_ENDPOINT_POS) … … 52 27 uhci_print_verbose("Creating device field: %x.\n", instance->device); 53 28 54 char buffer_dump[BUFFER_LEN];55 buffer_to_str(buffer_dump, BUFFER_LEN, buffer, size);56 uhci_print_verbose("Buffer dump (%zuB): %s.\n", size, buffer_dump);57 58 29 if (size) { 59 30 instance->buffer_ptr = (uintptr_t)addr_to_phys(buffer); … … 61 32 uhci_print_verbose("Creating buffer field: %p(%p).\n", 62 33 buffer, instance->buffer_ptr); 34 35 if (size >= 8) { 36 char * buff = buffer; 37 38 uhci_print_verbose("Buffer dump(8B): %x %x %x %x %x %x %x %x.\n", 39 buff[0], buff[1], buff[2], buff[3], buff[4], buff[5], buff[6], buff[7]); 40 } 63 41 } else { 64 42 instance->buffer_ptr = 0; 65 43 } 66 67 44 68 45 instance->next_va = NULL; -
uspace/drv/uhci/utils/malloc32.h
r4046c1ea r44d8853 53 53 static inline void * malloc32(size_t size) 54 54 /* TODO: this is ugly */ 55 { return memalign( 16, size); }55 { return memalign(size, 16); } 56 56 57 57 static inline void * get_page()
Note:
See TracChangeset
for help on using the changeset viewer.