Changeset 563ead9 in mainline
- Timestamp:
- 2011-05-23T14:51:41Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fcbcaae9
- Parents:
- e247d83
- Location:
- uspace/drv
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.h
re247d83 r563ead9 35 35 #define DRV_UHCI_BATCH_H 36 36 37 #include <usbhc_iface.h>38 #include <usb/usb.h>39 #include <usb/host/device_keeper.h>40 #include <usb/host/endpoint.h>41 37 #include <usb/host/batch.h> 42 38 -
uspace/drv/uhci-hcd/hc.c
re247d83 r563ead9 39 39 #include <usb/debug.h> 40 40 #include <usb/usb.h> 41 #include <usb/ddfiface.h>42 #include <usb_iface.h>43 41 44 42 #include "hc.h" -
uspace/drv/uhci-hcd/hc.h
re247d83 r563ead9 37 37 38 38 #include <fibril.h> 39 #include <fibril_synch.h>40 #include <adt/list.h>41 39 #include <ddi.h> 42 40 43 #include <usbhc_iface.h>44 41 #include <usb/host/device_keeper.h> 45 42 #include <usb/host/usb_endpoint_manager.h> 43 #include <usb/host/batch.h> 46 44 47 #include "batch.h"48 45 #include "transfer_list.h" 49 46 -
uspace/drv/uhci-hcd/iface.c
re247d83 r563ead9 39 39 40 40 #include "iface.h" 41 #include "batch.h" 41 42 #include "hc.h" 42 43 … … 122 123 return EOK; 123 124 } 124 125 /*----------------------------------------------------------------------------*/ 125 126 /** Find device handle by address interface function. 126 127 * … … 136 137 hc_t *hc = fun_to_hc(fun); 137 138 assert(hc); 138 bool found =139 const bool found = 139 140 usb_device_keeper_find_by_address(&hc->manager, address, handle); 140 141 return found ? EOK : ENOENT; 141 142 } 142 143 143 /*----------------------------------------------------------------------------*/ 144 144 /** Release address interface function … … 164 164 size_t max_packet_size, unsigned int interval) 165 165 { 166 assert(fun); 166 167 hc_t *hc = fun_to_hc(fun); 167 168 assert(hc); … … 183 184 usb_endpoint_t endpoint, usb_direction_t direction) 184 185 { 186 assert(fun); 185 187 hc_t *hc = fun_to_hc(fun); 186 188 assert(hc); … … 211 213 if (ret != EOK) 212 214 return ret; 215 assert(batch); 216 assert(hc); 213 217 batch_interrupt_out(batch); 214 218 ret = hc_schedule(hc, batch); … … 239 243 if (ret != EOK) 240 244 return ret; 245 assert(batch); 246 assert(hc); 241 247 batch_interrupt_in(batch); 242 248 ret = hc_schedule(hc, batch); … … 267 273 if (ret != EOK) 268 274 return ret; 275 assert(batch); 276 assert(hc); 269 277 batch_bulk_out(batch); 270 278 ret = hc_schedule(hc, batch); … … 295 303 if (ret != EOK) 296 304 return ret; 305 assert(batch); 306 assert(hc); 297 307 batch_bulk_in(batch); 298 308 ret = hc_schedule(hc, batch); … … 327 337 if (ret != EOK) 328 338 return ret; 339 assert(batch); 340 assert(hc); 329 341 usb_endpoint_manager_reset_if_need(&hc->ep_manager, target, setup_data); 330 342 batch_control_write(batch); … … 360 372 if (ret != EOK) 361 373 return ret; 374 assert(batch); 375 assert(hc); 362 376 batch_control_read(batch); 363 377 ret = hc_schedule(hc, batch); -
uspace/drv/uhci-hcd/root_hub.h
re247d83 r563ead9 43 43 /** List of resources available to the root hub. */ 44 44 hw_resource_list_t resource_list; 45 /** The only resource in the above list */45 /** The only resource in the RH resource list */ 46 46 hw_resource_t io_regs; 47 47 } rh_t; -
uspace/drv/uhci-hcd/transfer_list.c
re247d83 r563ead9 36 36 #include <arch/barrier.h> 37 37 38 38 39 #include "transfer_list.h" 40 #include "batch.h" 39 41 40 42 static void transfer_list_remove_batch( -
uspace/drv/uhci-hcd/transfer_list.h
re247d83 r563ead9 36 36 37 37 #include <fibril_synch.h> 38 #include <usb/host/batch.h> 38 39 39 #include "batch.h"40 40 #include "hw_struct/queue_head.h" 41 41 -
uspace/drv/uhci-hcd/utils/malloc32.h
re247d83 r563ead9 59 59 uintptr_t result; 60 60 const int ret = as_get_physical_mapping(addr, &result); 61 assert(ret == EOK);62 63 61 if (ret != EOK) 64 62 return 0; … … 98 96 { 99 97 void *free_address = as_get_mappable_page(UHCI_REQUIRED_PAGE_SIZE); 100 assert(free_address); /* TODO: remove this assert */101 98 if (free_address == 0) 102 99 return NULL; -
uspace/drv/uhci-rhd/main.c
re247d83 r563ead9 37 37 #include <errno.h> 38 38 #include <str_error.h> 39 39 40 #include <usb_iface.h> 40 41 #include <usb/ddfiface.h> … … 45 46 #define NAME "uhci-rhd" 46 47 47 static int hc_get_my_registers( ddf_dev_t *dev,48 static int hc_get_my_registers(const ddf_dev_t *dev, 48 49 uintptr_t *io_reg_address, size_t *io_reg_size); 49 50 /*----------------------------------------------------------------------------*/ … … 130 131 */ 131 132 int hc_get_my_registers( 132 ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size)133 const ddf_dev_t *dev, uintptr_t *io_reg_address, size_t *io_reg_size) 133 134 { 134 assert(dev != NULL);135 assert(dev); 135 136 136 int parent_phone = devman_parent_device_connect(dev->handle,137 const int parent_phone = devman_parent_device_connect(dev->handle, 137 138 IPC_FLAG_BLOCKING); 138 139 if (parent_phone < 0) { … … 141 142 142 143 hw_resource_list_t hw_resources; 143 int ret = hw_res_get_resource_list(parent_phone, &hw_resources);144 const int ret = hw_res_get_resource_list(parent_phone, &hw_resources); 144 145 if (ret != EOK) { 145 146 async_hangup(parent_phone); -
uspace/drv/uhci-rhd/port.c
re247d83 r563ead9 36 36 #include <errno.h> 37 37 #include <str_error.h> 38 #include <time.h>39 38 #include <async.h> 40 39 … … 82 81 * @param[in] number Port number. 83 82 * @param[in] usec Polling interval. 84 * @param[in] rh Pointer to ddf instance fothe root hub driver.83 * @param[in] rh Pointer to ddf instance of the root hub driver. 85 84 * @return Error code. 86 85 * … … 91 90 { 92 91 assert(port); 93 asprintf(&port->id_string, "Port (%p - %u)", port, number); 94 if (port->id_string == NULL) { 92 char *id_string; 93 asprintf(&id_string, "Port (%p - %u)", port, number); 94 if (id_string == NULL) { 95 95 return ENOMEM; 96 96 } 97 97 98 port->id_string = id_string; 98 99 port->address = address; 99 100 port->number = number; … … 105 106 usb_hc_connection_initialize_from_device(&port->hc_connection, rh); 106 107 if (ret != EOK) { 107 usb_log_error("Failed to initialize connection to HC."); 108 usb_log_error("%s: failed to initialize connection to HC.", 109 port->id_string); 110 free(id_string); 108 111 return ret; 109 112 } … … 113 116 usb_log_error("%s: failed to create polling fibril.", 114 117 port->id_string); 118 free(id_string); 115 119 return ENOMEM; 116 120 } … … 132 136 assert(port); 133 137 free(port->id_string); 134 / * TODO: Kill fibril here */138 // TODO: Kill fibril here 135 139 return; 136 140 } … … 150 154 151 155 /* Read register value */ 152 port_status_t port_status = uhci_port_read_status(instance); 156 const port_status_t port_status = 157 uhci_port_read_status(instance); 153 158 154 159 /* Print the value if it's interesting */ … … 161 166 usb_log_debug("%s: Connected change detected: %x.\n", 162 167 instance->id_string, port_status); 163 164 int rc =165 usb_hc_connection_open(&instance->hc_connection);166 if (rc != EOK) {167 usb_log_error("%s: Failed to connect to HC.",168 instance->id_string);169 continue;170 }171 168 172 169 /* Remove any old device */ … … 175 172 instance->id_string); 176 173 uhci_port_remove_device(instance); 174 } 175 176 int ret = 177 usb_hc_connection_open(&instance->hc_connection); 178 if (ret != EOK) { 179 usb_log_error("%s: Failed to connect to HC.", 180 instance->id_string); 181 continue; 177 182 } 178 183 … … 190 195 } 191 196 192 r c= usb_hc_connection_close(&instance->hc_connection);193 if (r c!= EOK) {197 ret = usb_hc_connection_close(&instance->hc_connection); 198 if (ret != EOK) { 194 199 usb_log_error("%s: Failed to disconnect.", 195 200 instance->id_string); … … 210 215 { 211 216 uhci_port_t *port = arg; 217 assert(port); 212 218 213 219 usb_log_debug2("%s: new_device_enable_port.\n", port->id_string); … … 283 289 usb_log_error("%s: Don't know how to remove device %" PRIun ".\n", 284 290 port->id_string, port->attached_device); 291 port->attached_device = 0; 285 292 return ENOTSUP; 286 293 } -
uspace/drv/uhci-rhd/port.h
re247d83 r563ead9 57 57 typedef struct uhci_port 58 58 { 59 c har *id_string;59 const char *id_string; 60 60 port_status_t *address; 61 61 unsigned number;
Note:
See TracChangeset
for help on using the changeset viewer.