Changeset a7e2f0d in mainline for uspace/drv/uhci-hcd/transfer_list.c
- Timestamp:
- 2011-03-07T18:57:00Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 18e9eeb
- Parents:
- 0d3167e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/transfer_list.c
r0d3167e ra7e2f0d 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 { … … 48 59 return ENOMEM; 49 60 } 50 queue_head_init(instance->queue_head);51 61 instance->queue_head_pa = addr_to_phys(instance->queue_head); 52 62 … … 57 67 } 58 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 */ 59 75 void transfer_list_set_next(transfer_list_t *instance, transfer_list_t *next) 60 76 { … … 67 83 } 68 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 */ 69 91 void transfer_list_add_batch(transfer_list_t *instance, batch_t *batch) 70 92 { 71 93 assert(instance); 72 94 assert(batch); 73 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); 74 97 75 98 uint32_t pa = (uintptr_t)addr_to_phys(batch->qh); … … 98 121 queue_head_append_qh(last->qh, pa); 99 122 list_append(&batch->link, &instance->batch_list); 123 100 124 usb_log_debug("Batch(%p) added to queue %s last, first is %p.\n", 101 batch, instance->name, first 125 batch, instance->name, first); 102 126 fibril_mutex_unlock(&instance->guard); 103 127 } 104 128 /*----------------------------------------------------------------------------*/ 105 static void transfer_list_remove_batch( 106 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) 107 136 { 108 137 assert(instance); … … 110 139 assert(instance->queue_head); 111 140 assert(batch->qh); 112 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); 113 143 114 /* I'm the first one here */115 144 if (batch->link.prev == &instance->batch_list) { 116 usb_log_debug("Batch(%p) removed (FIRST) from queue %s, next element %x.\n", 117 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); 118 149 instance->queue_head->element = batch->qh->next_queue; 119 150 } else { 120 usb_log_debug("Batch(%p) removed (NOT FIRST) from queue, next element %x.\n", 121 batch, instance->name, batch->qh->next_queue); 122 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); 123 156 prev->qh->next_queue = batch->qh->next_queue; 124 157 } … … 126 159 } 127 160 /*----------------------------------------------------------------------------*/ 161 /** Checks list for finished transfers. 162 * 163 * @param[in] instance List to use. 164 * @return Error code 165 */ 128 166 void transfer_list_remove_finished(transfer_list_t *instance) 129 167 {
Note:
See TracChangeset
for help on using the changeset viewer.