Changeset df6ded8 in mainline for uspace/drv/bus/usb/uhci/uhci_batch.h
- Timestamp:
- 2018-02-28T16:37:50Z (6 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b20da0
- Parents:
- f5e5f73 (diff), b2dca8de (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. - git-author:
- Jakub Jermar <jakub@…> (2018-02-28 16:06:42)
- git-committer:
- Jakub Jermar <jakub@…> (2018-02-28 16:37:50)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/uhci_batch.h
rf5e5f73 rdf6ded8 1 1 /* 2 2 * Copyright (c) 2011 Jan Vesely 3 * Copyright (c) 2018 Ondrej Hlavaty 3 4 * All rights reserved. 4 5 * … … 43 44 #include <stddef.h> 44 45 #include <usb/host/usb_transfer_batch.h> 46 #include <usb/host/endpoint.h> 45 47 46 48 #include "hw_struct/queue_head.h" … … 49 51 /** UHCI specific data required for USB transfer */ 50 52 typedef struct uhci_transfer_batch { 53 usb_transfer_batch_t base; 54 51 55 /** Queue head 52 56 * This QH is used to maintain UHCI schedule structure and the element … … 58 62 /** Number of TDs used by the transfer */ 59 63 size_t td_count; 60 /* * Data buffer, must be accessible by the UHCI hw*/61 void *device_buffer;62 /** Generic transfer data*/63 usb_transfer_batch_t *usb_batch;64 /* Setup data */ 65 char *setup_buffer; 66 /** Backing TDs + setup_buffer */ 67 dma_buffer_t uhci_dma_buffer; 64 68 /** List element */ 65 69 link_t link; 66 70 } uhci_transfer_batch_t; 67 71 68 uhci_transfer_batch_t * uhci_transfer_batch_get(usb_transfer_batch_t *batch); 69 void uhci_transfer_batch_finish_dispose(uhci_transfer_batch_t *uhci_batch); 70 bool uhci_transfer_batch_is_complete(const uhci_transfer_batch_t *uhci_batch); 72 uhci_transfer_batch_t *uhci_transfer_batch_create(endpoint_t *); 73 int uhci_transfer_batch_prepare(uhci_transfer_batch_t *); 74 bool uhci_transfer_batch_check_completed(uhci_transfer_batch_t *); 75 void uhci_transfer_batch_destroy(uhci_transfer_batch_t *); 71 76 72 77 /** Get offset to setup buffer accessible to the HC hw. … … 74 79 * @return Pointer to the setup buffer. 75 80 */ 76 static inline void * 81 static inline void *uhci_transfer_batch_setup_buffer( 77 82 const uhci_transfer_batch_t *uhci_batch) 78 83 { 79 84 assert(uhci_batch); 80 assert(uhci_batch->device_buffer); 81 return uhci_batch->device_buffer + sizeof(qh_t) + 85 return uhci_batch->uhci_dma_buffer.virt + sizeof(qh_t) + 82 86 uhci_batch->td_count * sizeof(td_t); 83 87 } … … 87 91 * @return Pointer to the data buffer. 88 92 */ 89 static inline void * 93 static inline void *uhci_transfer_batch_data_buffer( 90 94 const uhci_transfer_batch_t *uhci_batch) 91 95 { 92 96 assert(uhci_batch); 93 assert(uhci_batch->usb_batch); 94 return uhci_transfer_batch_setup_buffer(uhci_batch) + 95 uhci_batch->usb_batch->setup_size; 96 } 97 98 /** Aborts the batch. 99 * Sets error to EINTR and size off transferd data to 0, before finishing the 100 * batch. 101 * @param uhci_batch Batch to abort. 102 */ 103 static inline void uhci_transfer_batch_abort(uhci_transfer_batch_t *uhci_batch) 104 { 105 assert(uhci_batch); 106 assert(uhci_batch->usb_batch); 107 uhci_batch->usb_batch->error = EINTR; 108 uhci_batch->usb_batch->transfered_size = 0; 109 uhci_transfer_batch_finish_dispose(uhci_batch); 97 return uhci_batch->base.dma_buffer.virt; 110 98 } 111 99 … … 120 108 } 121 109 110 static inline uhci_transfer_batch_t *uhci_transfer_batch_get( 111 usb_transfer_batch_t *b) 112 { 113 assert(b); 114 return (uhci_transfer_batch_t *) b; 115 } 116 122 117 #endif 123 118
Note:
See TracChangeset
for help on using the changeset viewer.