Changeset 9d9ffdd in mainline for uspace/drv/uhci-hcd/transfer_list.c
- Timestamp:
- 2011-03-11T15:42:43Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 0bd4810c
- Parents:
- 60a228f (diff), a8def7d (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/transfer_list.c
r60a228f r9d9ffdd 38 38 #include "transfer_list.h" 39 39 40 static void transfer_list_remove_batch( 41 transfer_list_t *instance, batch_t *batch); 42 /*----------------------------------------------------------------------------*/ 43 /** Initializes transfer list structures. 44 * 45 * @param[in] instance Memory place to use. 46 * @param[in] name Name of te new list. 47 * @return Error code 48 * 49 * Allocates memory for internat queue_head_t structure. 50 */ 40 51 int transfer_list_init(transfer_list_t *instance, const char *name) 41 52 { … … 43 54 instance->next = NULL; 44 55 instance->name = name; 45 instance->queue_head = queue_head_get();56 instance->queue_head = malloc32(sizeof(queue_head_t)); 46 57 if (!instance->queue_head) { 47 58 usb_log_error("Failed to allocate queue head.\n"); 48 59 return ENOMEM; 49 60 } 50 instance->queue_head_pa = (uintptr_t)addr_to_phys(instance->queue_head);61 instance->queue_head_pa = addr_to_phys(instance->queue_head); 51 62 52 63 queue_head_init(instance->queue_head); … … 56 67 } 57 68 /*----------------------------------------------------------------------------*/ 69 /** Set the next list in chain. 70 * 71 * @param[in] instance List to lead. 72 * @param[in] next List to append. 73 * @return Error code 74 */ 58 75 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next) 59 76 { … … 66 83 } 67 84 /*----------------------------------------------------------------------------*/ 85 /** Submits a new transfer batch to list and queue. 86 * 87 * @param[in] instance List to use. 88 * @param[in] batch Transfer batch to submit. 89 * @return Error code 90 */ 68 91 void transfer_list_add_batch(transfer_list_t *instance, batch_t *batch) 69 92 { 70 93 assert(instance); 71 94 assert(batch); 72 usb_log_debug2("Adding batch(%p) to queue %s.\n", batch, instance->name); 95 usb_log_debug2( 96 "Adding batch(%p) to queue %s.\n", batch, instance->name); 73 97 74 98 uint32_t pa = (uintptr_t)addr_to_phys(batch->qh); … … 97 121 queue_head_append_qh(last->qh, pa); 98 122 list_append(&batch->link, &instance->batch_list); 123 99 124 usb_log_debug("Batch(%p) added to queue %s last, first is %p.\n", 100 batch, instance->name, first 125 batch, instance->name, first); 101 126 fibril_mutex_unlock(&instance->guard); 102 127 } 103 128 /*----------------------------------------------------------------------------*/ 104 static void transfer_list_remove_batch( 105 transfer_list_t *instance, batch_t *batch) 129 /** Removes a transfer batch from list and queue. 130 * 131 * @param[in] instance List to use. 132 * @param[in] batch Transfer batch to remove. 133 * @return Error code 134 */ 135 void transfer_list_remove_batch(transfer_list_t *instance, batch_t *batch) 106 136 { 107 137 assert(instance); … … 109 139 assert(instance->queue_head); 110 140 assert(batch->qh); 111 usb_log_debug2("Removing batch(%p) from queue %s.\n", batch, instance->name); 141 usb_log_debug2( 142 "Removing batch(%p) from queue %s.\n", batch, instance->name); 112 143 113 /* I'm the first one here */114 144 if (batch->link.prev == &instance->batch_list) { 115 usb_log_debug("Batch(%p) removed (FIRST) from queue %s, next element %x.\n", 116 batch, instance->name, batch->qh->next_queue); 145 /* I'm the first one here */ 146 usb_log_debug( 147 "Batch(%p) removed (FIRST) from %s, next element %x.\n", 148 batch, instance->name, batch->qh->next_queue); 117 149 instance->queue_head->element = batch->qh->next_queue; 118 150 } else { 119 usb_log_debug("Batch(%p) removed (NOT FIRST) from queue, next element %x.\n", 120 batch, instance->name, batch->qh->next_queue); 121 batch_t *prev = list_get_instance(batch->link.prev, batch_t, link); 151 usb_log_debug( 152 "Batch(%p) removed (FIRST:NO) from %s, next element %x.\n", 153 batch, instance->name, batch->qh->next_queue); 154 batch_t *prev = 155 list_get_instance(batch->link.prev, batch_t, link); 122 156 prev->qh->next_queue = batch->qh->next_queue; 123 157 } … … 125 159 } 126 160 /*----------------------------------------------------------------------------*/ 161 /** Checks list for finished transfers. 162 * 163 * @param[in] instance List to use. 164 * @return Error code 165 */ 127 166 void transfer_list_remove_finished(transfer_list_t *instance) 128 167 {
Note:
See TracChangeset
for help on using the changeset viewer.