Changeset 1e70157 in mainline
- Timestamp:
- 2011-04-06T19:52:17Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8dc762e0
- Parents:
- fb8927d
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 6 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/endpoint.c
rfb8927d r1e70157 34 34 */ 35 35 36 #include <errno.h> 37 36 38 #include "endpoint.h" 39 #include "utils/malloc32.h" 37 40 38 voidendpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type,41 int endpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type, 39 42 usb_speed_t speed, size_t max_packet_size) 40 43 { … … 45 48 instance->max_packet_size = max_packet_size; 46 49 instance->toggle = 0; 50 instance->qh = malloc32(sizeof(qh_t)); 51 if (instance->qh == NULL) 52 return ENOMEM; 53 return EOK; 47 54 } 48 55 /*----------------------------------------------------------------------------*/ 49 void endpoint_destroy(void * instance)56 void endpoint_destroy(void *ep) 50 57 { 58 endpoint_t *instance = ep; 51 59 assert(instance); 60 list_remove(&instance->same_device_eps); 61 free32(instance->qh); 52 62 free(instance); 63 } 64 /*----------------------------------------------------------------------------*/ 65 void endpoint_toggle_reset(link_t *ep) 66 { 67 endpoint_t *instance = 68 list_get_instance(ep, endpoint_t, same_device_eps); 69 assert(instance); 70 instance->toggle = 0; 53 71 } 54 72 /** -
uspace/drv/uhci-hcd/endpoint.h
rfb8927d r1e70157 41 41 #include <usb/usb.h> 42 42 43 #include "hw_struct/queue_head.h" 44 43 45 typedef struct endpoint { 44 46 link_t same_device_eps; … … 48 50 bool active; 49 51 int toggle:1; 52 qh_t *qh; 50 53 } endpoint_t; 51 54 52 voidendpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type,55 int endpoint_init(endpoint_t *instance, usb_transfer_type_t transfer_type, 53 56 usb_speed_t speed, size_t max_packet_size); 54 57 55 void endpoint_destroy(void *instance); 58 void endpoint_destroy(void *ep); 59 60 void endpoint_toggle_reset(link_t *ep); 56 61 57 62 #endif -
uspace/drv/uhci-hcd/hw_struct/queue_head.h
rfb8927d r1e70157 39 39 40 40 #include "link_pointer.h" 41 #include "utils/malloc32.h"42 41 43 42 typedef struct queue_head { -
uspace/drv/uhci-hcd/iface.c
rfb8927d r1e70157 160 160 usb_device_keeper_get_speed(&hc->manager, address); 161 161 const size_t size = max_packet_size; 162 int ret; 162 163 163 164 endpoint_t *ep = malloc(sizeof(endpoint_t)); 164 165 if (ep == NULL) 165 166 return ENOMEM; 166 endpoint_init(ep, transfer_type, speed, max_packet_size); 167 ret = endpoint_init(ep, transfer_type, speed, max_packet_size); 168 if (ret != EOK) { 169 free(ep); 170 return ret; 171 } 167 172 168 173 usb_log_debug("Register endpoint %d:%d %s %s(%d) %zu(%zu) %u.\n", … … 176 181 0; 177 182 178 intret = usb_endpoint_manager_register_ep(&hc->ep_manager,183 ret = usb_endpoint_manager_register_ep(&hc->ep_manager, 179 184 address, endpoint, direction, ep, endpoint_destroy, bw); 180 185 if (ret != EOK) { 181 186 endpoint_destroy(ep); 187 } else { 188 usb_device_keeper_add_ep(&hc->manager, address, &ep->same_device_eps); 182 189 } 183 190 return ret; … … 345 352 assert(ep->transfer_type == USB_TRANSFER_BULK); 346 353 347 348 354 usb_transfer_batch_t *batch = 349 355 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, … … 394 400 395 401 usb_transfer_batch_t *batch = 396 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, ep->speed, 397 data, size, NULL, 0, callback, NULL, arg, &hc->manager); 402 batch_get(fun, target, ep->transfer_type, ep->max_packet_size, 403 ep->speed, data, size, NULL, 0, callback, NULL, arg, 404 &hc->manager); 398 405 if (!batch) 399 406 return ENOMEM; -
uspace/drv/uhci-hcd/transfer_list.h
rfb8927d r1e70157 39 39 #include "batch.h" 40 40 #include "hw_struct/queue_head.h" 41 #include "utils/malloc32.h" 41 42 42 43 typedef struct transfer_list -
uspace/drv/uhci-hcd/utils/malloc32.h
rfb8927d r1e70157 36 36 37 37 #include <assert.h> 38 #include <errno.h> 38 39 #include <malloc.h> 39 40 #include <mem.h>
Note:
See TracChangeset
for help on using the changeset viewer.