Changeset 1a93bb0 in mainline
- Timestamp:
- 2011-02-25T23:27:26Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- c3ae877
- Parents:
- 5f183dc
- Location:
- uspace/drv
- Files:
-
- 9 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/Makefile
r5f183dc r1a93bb0 39 39 uhci.c \ 40 40 uhci_struct/transfer_descriptor.c \ 41 utils/device_keeper.c \ 41 42 pci.c \ 42 43 batch.c -
uspace/drv/uhci-hcd/batch.c
r5f183dc r1a93bb0 53 53 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 54 54 usb_transfer_type_t transfer_type, size_t max_packet_size, 55 dev_speed_t speed, char *buffer, size_t size,55 usb_speed_t speed, char *buffer, size_t size, 56 56 char* setup_buffer, size_t setup_size, 57 57 usbhc_iface_transfer_in_callback_t func_in, -
uspace/drv/uhci-hcd/batch.h
r5f183dc r1a93bb0 43 43 #include "uhci_struct/queue_head.h" 44 44 45 typedef enum {46 LOW_SPEED,47 FULL_SPEED,48 } dev_speed_t;49 50 45 typedef struct batch 51 46 { 52 47 link_t link; 53 dev_speed_t speed;48 usb_speed_t speed; 54 49 usb_target_t target; 55 50 usb_transfer_type_t transfer_type; … … 76 71 batch_t * batch_get(ddf_fun_t *fun, usb_target_t target, 77 72 usb_transfer_type_t transfer_type, size_t max_packet_size, 78 dev_speed_t speed, char *buffer, size_t size,73 usb_speed_t speed, char *buffer, size_t size, 79 74 char *setup_buffer, size_t setup_size, 80 75 usbhc_iface_transfer_in_callback_t func_in, -
uspace/drv/uhci-hcd/iface.c
r5f183dc r1a93bb0 41 41 #include "iface.h" 42 42 #include "uhci.h" 43 44 #define DEFAULT_SPEED FULL_SPEED 43 #include "utils/device_keeper.h" 45 44 46 45 /*----------------------------------------------------------------------------*/ … … 50 49 uhci_t *hc = fun_to_uhci(fun); 51 50 assert(hc); 52 usb_address_keeping_reserve_default(&hc->address_manager); 51 usb_log_debug("Default address request with speed %d.\n", speed); 52 device_keeper_reserve_default(&hc->device_manager, speed); 53 53 return EOK; 54 54 } … … 59 59 uhci_t *hc = fun_to_uhci(fun); 60 60 assert(hc); 61 usb_address_keeping_release_default(&hc->address_manager); 61 usb_log_debug("Default address release.\n"); 62 device_keeper_release_default(&hc->device_manager); 62 63 return EOK; 63 64 } … … 69 70 uhci_t *hc = fun_to_uhci(fun); 70 71 assert(hc); 71 *address = usb_address_keeping_request(&hc->address_manager); 72 assert(address); 73 74 usb_log_debug("Address request with speed %d.\n", speed); 75 *address = device_keeper_request(&hc->device_manager, speed); 76 usb_log_debug("Address request with result: %d.\n", *address); 72 77 if (*address <= 0) 73 78 return *address; … … 81 86 uhci_t *hc = fun_to_uhci(fun); 82 87 assert(hc); 83 usb_address_keeping_devman_bind(&hc->address_manager, address, handle); 88 usb_log_debug("Address bind %d-%d.\n", address, handle); 89 device_keeper_bind(&hc->device_manager, address, handle); 84 90 return EOK; 85 91 } … … 90 96 uhci_t *hc = fun_to_uhci(fun); 91 97 assert(hc); 92 usb_address_keeping_release_default(&hc->address_manager); 98 usb_log_debug("Address release %d.\n", address); 99 device_keeper_release(&hc->device_manager, address); 93 100 return EOK; 94 101 } 95 102 /*----------------------------------------------------------------------------*/ 96 103 static int interrupt_out(ddf_fun_t *fun, usb_target_t target, 97 size_t max_packet_size, 98 void *data, size_t size, 104 size_t max_packet_size, void *data, size_t size, 99 105 usbhc_iface_transfer_out_callback_t callback, void *arg) 100 106 { 101 dev_speed_t speed = DEFAULT_SPEED; 107 assert(fun); 108 uhci_t *hc = fun_to_uhci(fun); 109 assert(hc); 110 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 102 111 103 112 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, … … 114 123 usbhc_iface_transfer_in_callback_t callback, void *arg) 115 124 { 116 dev_speed_t speed = DEFAULT_SPEED; 125 assert(fun); 126 uhci_t *hc = fun_to_uhci(fun); 127 assert(hc); 128 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 117 129 118 130 batch_t *batch = batch_get(fun, target, USB_TRANSFER_INTERRUPT, … … 129 141 usbhc_iface_transfer_out_callback_t callback, void *arg) 130 142 { 131 dev_speed_t speed = DEFAULT_SPEED; 143 assert(fun); 144 uhci_t *hc = fun_to_uhci(fun); 145 assert(hc); 146 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 132 147 133 148 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, … … 145 160 usbhc_iface_transfer_in_callback_t callback, void *arg) 146 161 { 147 dev_speed_t speed = DEFAULT_SPEED; 162 assert(fun); 163 uhci_t *hc = fun_to_uhci(fun); 164 assert(hc); 165 usb_speed_t speed = device_keeper_speed(&hc->device_manager, target.address); 148 166 149 167 batch_t *batch = batch_get(fun, target, USB_TRANSFER_CONTROL, -
uspace/drv/uhci-hcd/main.c
r5f183dc r1a93bb0 82 82 usb_log_info("uhci_add_device() called\n"); 83 83 84 85 84 uintptr_t io_reg_base = 0; 86 85 size_t io_reg_size = 0; … … 96 95 io_reg_size = 32; 97 96 98 //ret = pci_enable_interrupts(device);99 //CHECK_RET_RETURN(ret, "Failed(%d) to get enable interrupts:\n", ret);97 ret = pci_enable_interrupts(device); 98 CHECK_RET_RETURN(ret, "Failed(%d) to get enable interrupts:\n", ret); 100 99 101 100 uhci_t *uhci_hc = malloc(sizeof(uhci_t)); -
uspace/drv/uhci-hcd/root_hub.c
r5f183dc r1a93bb0 64 64 assert(hc); 65 65 66 usb_address_t addr = usb_address_keeping_find(&hc->address_manager,66 usb_address_t addr = device_keeper_find(&hc->device_manager, 67 67 handle); 68 68 if (addr < 0) { -
uspace/drv/uhci-hcd/uhci.c
r5f183dc r1a93bb0 69 69 assert(hc); 70 70 71 usb_address_t addr = usb_address_keeping_find(&hc->address_manager, 71 // usb_address_t addr = usb_address_keeping_find(&hc->address_manager, 72 // handle); 73 usb_address_t addr = device_keeper_find(&hc->device_manager, 72 74 handle); 73 75 if (addr < 0) { … … 141 143 142 144 instance->cleaner = fibril_create(uhci_interrupt_emulator, instance); 143 fibril_add_ready(instance->cleaner);145 // fibril_add_ready(instance->cleaner); 144 146 145 147 instance->debug_checker = fibril_create(uhci_debug_checker, instance); … … 161 163 162 164 /* enable all interrupts, but resume interrupt */ 163 //pio_write_16(&instance->registers->usbintr,164 //UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET);165 pio_write_16(&instance->registers->usbintr, 166 UHCI_INTR_CRC | UHCI_INTR_COMPLETE | UHCI_INTR_SHORT_PACKET); 165 167 166 168 /* Start the hc with large(64B) packet FSBR */ … … 207 209 208 210 /* init address keeper(libusb) */ 209 usb_address_keeping_init(&instance->address_manager, USB11_ADDRESS_MAX);210 usb_log_debug("Initialized addressmanager.\n");211 device_keeper_init(&instance->device_manager); 212 usb_log_debug("Initialized device manager.\n"); 211 213 212 214 return EOK; … … 259 261 assert(instance); 260 262 assert(batch); 261 const int low_speed = (batch->speed == LOW_SPEED);263 const int low_speed = (batch->speed == USB_SPEED_LOW); 262 264 if (!allowed_usb_packet( 263 265 low_speed, batch->transfer_type, batch->max_packet_size)) { -
uspace/drv/uhci-hcd/uhci.h
r5f183dc r1a93bb0 41 41 #include <ddi.h> 42 42 43 #include <usb/addrkeep.h>44 43 #include <usbhc_iface.h> 45 44 45 #include "batch.h" 46 46 #include "transfer_list.h" 47 #include " batch.h"47 #include "utils/device_keeper.h" 48 48 49 49 typedef struct uhci_regs { … … 82 82 83 83 typedef struct uhci { 84 usb_address_keeping_t address_manager; 84 device_keeper_t device_manager; 85 85 86 volatile regs_t *registers; 86 87 -
uspace/drv/uhci-rhd/main.c
r5f183dc r1a93bb0 116 116 int main(int argc, char *argv[]) 117 117 { 118 usb_log_enable(USB_LOG_LEVEL_ DEBUG, NAME);118 usb_log_enable(USB_LOG_LEVEL_INFO, NAME); 119 119 return ddf_driver_main(&uhci_rh_driver); 120 120 }
Note:
See TracChangeset
for help on using the changeset viewer.