Changeset f58154c5 in mainline for uspace/drv/uhci-hcd
- Timestamp:
- 2011-05-18T10:59:50Z (15 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 17fc40c
- Parents:
- b2995c3 (diff), aeca5a3 (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. - Location:
- uspace/drv/uhci-hcd
- Files:
-
- 3 edited
-
batch.c (modified) (3 diffs)
-
transfer_list.c (modified) (4 diffs)
-
utils/malloc32.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
rb2995c3 rf58154c5 45 45 #define DEFAULT_ERROR_COUNT 3 46 46 47 /** UHCI specific data required for USB transfer */ 47 48 typedef struct uhci_transfer_batch { 49 /** Queue head 50 * This QH is used to maintain UHCI schedule structure and the element 51 * pointer points to the first TD of this batch. 52 */ 48 53 qh_t *qh; 54 /** List of TDs needed for the transfer */ 49 55 td_t *tds; 56 /** Number of TDs used by the transfer */ 57 size_t td_count; 58 /** Data buffer, must be accessible by the UHCI hw */ 50 59 void *device_buffer; 51 size_t td_count;52 60 } uhci_transfer_batch_t; 53 61 /*----------------------------------------------------------------------------*/ 54 static void uhci_transfer_batch_dispose(void *uhci_batch)55 {56 uhci_transfer_batch_t *instance = uhci_batch;57 assert(instance);58 free32(instance->device_buffer);59 free(instance);60 }61 /*----------------------------------------------------------------------------*/62 63 62 static void batch_control(usb_transfer_batch_t *instance, 64 63 usb_packet_id data_stage, usb_packet_id status_stage); 65 64 static void batch_data(usb_transfer_batch_t *instance, usb_packet_id pid); 66 65 /*----------------------------------------------------------------------------*/ 66 /** Safely destructs uhci_transfer_batch_t structure 67 * 68 * @param[in] uhci_batch Instance to destroy. 69 */ 70 static void uhci_transfer_batch_dispose(void *uhci_batch) 71 { 72 uhci_transfer_batch_t *instance = uhci_batch; 73 assert(instance); 74 free32(instance->device_buffer); 75 free(instance); 76 } 77 /*----------------------------------------------------------------------------*/ 67 78 /** Allocate memory and initialize internal data structure. 68 79 * … … 173 184 instance->error = td_status(&data->tds[i]); 174 185 if (instance->error != EOK) { 175 usb_log_debug("Batch(%p) found error TD(%zu):%" PRIx32 ".\n",176 instance, i, data->tds[i].status);186 usb_log_debug("Batch(%p) found error TD(%zu):%" 187 PRIx32 ".\n", instance, i, data->tds[i].status); 177 188 td_print_status(&data->tds[i]); 178 189 … … 397 408 /*----------------------------------------------------------------------------*/ 398 409 /** Provides access to QH data structure. 410 * 399 411 * @param[in] instance Batch pointer to use. 400 412 * @return Pointer to the QH used by the batch. -
uspace/drv/uhci-hcd/transfer_list.c
rb2995c3 rf58154c5 34 34 #include <errno.h> 35 35 #include <usb/debug.h> 36 #include <arch/barrier.h> 36 37 37 38 #include "transfer_list.h" … … 71 72 * @param[in] instance Memory place to use. 72 73 * 73 * Frees memory forinternal qh_t structure.74 * Frees memory of the internal qh_t structure. 74 75 */ 75 76 void transfer_list_fini(transfer_list_t *instance) … … 126 127 assert((pa & LINK_POINTER_ADDRESS_MASK) == pa); 127 128 129 /* Make sure all data in the batch are written */ 130 write_barrier(); 131 128 132 /* keep link */ 129 133 batch_qh(batch)->next = last_qh->next; 130 134 qh_set_next_qh(last_qh, batch_qh(batch)); 131 135 132 asm volatile ("": : :"memory"); 136 /* Make sure the pointer is updated */ 137 write_barrier(); 133 138 134 139 /* Add to the driver list */ … … 222 227 == addr_to_phys(batch_qh(batch))); 223 228 prev_qh->next = batch_qh(batch)->next; 224 asm volatile ("": : :"memory"); 229 230 /* Make sure the pointer is updated */ 231 write_barrier(); 232 225 233 /* Remove from the batch list */ 226 234 list_remove(&batch->link); -
uspace/drv/uhci-hcd/utils/malloc32.h
rb2995c3 rf58154c5 74 74 if (size <= SLAB_ELEMENT_SIZE) 75 75 return slab_malloc_g(); 76 assert(false); 76 usb_log_warning("Requested %zu bytes, current allocator can't handle " 77 "that amount, pray that the standard malloc will suffice.", size); 77 78 return memalign(UHCI_STRCUTURES_ALIGNMENT, size); 78 79 }
Note:
See TracChangeset
for help on using the changeset viewer.
