Changeset eb0dc58 in mainline
- Timestamp:
- 2011-03-13T13:59:19Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6143ce3
- Parents:
- 67352d2
- Location:
- uspace/drv/uhci-hcd
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/uhci-hcd/batch.c
r67352d2 reb0dc58 319 319 ++packet; 320 320 } 321 instance->tds[packet - 1].status |= TD_STATUS_IOC_FLAG;321 td_set_ioc(&instance->tds[packet - 1]); 322 322 device_keeper_set_toggle(instance->manager, instance->target, toggle); 323 323 } … … 371 371 0, 1, false, low_speed, instance->target, status_stage, NULL, NULL); 372 372 373 374 instance->tds[packet].status |= TD_STATUS_IOC_FLAG; 373 td_set_ioc(&instance->tds[packet]); 375 374 usb_log_debug2("Control last TD status: %x.\n", 376 375 instance->tds[packet].status); -
uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.c
r67352d2 reb0dc58 44 44 * @param[in] size Size of data source. 45 45 * @param[in] toggle Value of toggle bit. 46 * @param[in] iso True if TD is forIsochronous transfer.46 * @param[in] iso True if TD represents Isochronous transfer. 47 47 * @param[in] low_speed Target device's speed. 48 48 * @param[in] target Address and endpoint receiving the transfer. … … 51 51 * @param[in] next Net TD in transaction. 52 52 * @return Error code. 53 * 54 * Uses a mix of supplied and default values. 55 * Implicit values: 56 * - all TDs have vertical flag set (makes transfers to endpoints atomic) 57 * - in the error field only active it is set 58 * - if the packet uses PID_IN and is not isochronous SPD is set 59 * 60 * Dumps 8 bytes of buffer if PID_SETUP is used. 53 61 */ 54 62 void td_init(td_t *instance, int err_count, size_t size, bool toggle, bool iso, … … 94 102 if (pid == USB_PID_SETUP) { 95 103 usb_log_debug("SETUP BUFFER: %s\n", 96 104 usb_debug_str_buffer(buffer, 8, 8)); 97 105 } 98 106 } … … 128 136 } 129 137 /*----------------------------------------------------------------------------*/ 138 /** Print values in status field (dw1) in a human readable way. 139 * 140 * @param[in] instance TD structure to use. 141 */ 130 142 void td_print_status(td_t *instance) 131 143 { -
uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h
r67352d2 reb0dc58 45 45 46 46 volatile uint32_t status; 47 48 47 #define TD_STATUS_RESERVED_MASK 0xc000f800 49 48 #define TD_STATUS_SPD_FLAG ( 1 << 29 ) … … 70 69 71 70 volatile uint32_t device; 72 73 71 #define TD_DEVICE_MAXLEN_POS 21 74 72 #define TD_DEVICE_MAXLEN_MASK ( 0x7ff ) … … 85 83 86 84 /* there is 16 bytes of data available here, according to UHCI 87 * Design guide, according to linux kernel the hardware does not care 88 * we don't use it anyway85 * Design guide, according to linux kernel the hardware does not care, 86 * it just needs to be aligned, we don't use it anyway 89 87 */ 90 88 } __attribute__((packed)) td_t; … … 97 95 int td_status(td_t *instance); 98 96 97 void td_print_status(td_t *instance); 98 /*----------------------------------------------------------------------------*/ 99 /** Helper function for parsing actual size out of TD. 100 * 101 * @param[in] instance TD structure to use. 102 * @return Parsed actual size. 103 */ 99 104 static inline size_t td_act_size(td_t *instance) 100 105 { 101 106 assert(instance); 102 return 103 ((instance->status >> TD_STATUS_ACTLEN_POS) + 1) 104 & TD_STATUS_ACTLEN_MASK; 107 const uint32_t s = instance->status; 108 return ((s >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK; 105 109 } 106 110 /*----------------------------------------------------------------------------*/ 111 /** Checks whether less than max data were recieved and packet is marked as SPD. 112 * 113 * @param[in] instance TD structure to use. 114 * @return True if packet is short (less than max bytes and SPD set), false 115 * otherwise. 116 */ 107 117 static inline bool td_is_short(td_t *instance) 108 118 { … … 114 124 (instance->status | TD_STATUS_SPD_FLAG) && act_size < max_size; 115 125 } 116 126 /*----------------------------------------------------------------------------*/ 127 /** Helper function for parsing value of toggle bit. 128 * 129 * @param[in] instance TD structure to use. 130 * @return Toggle bit value. 131 */ 117 132 static inline int td_toggle(td_t *instance) 118 133 { 119 134 assert(instance); 120 return ((instance->device & TD_DEVICE_DATA_TOGGLE_ONE_FLAG) != 0) 121 ? 1 : 0; 135 return (instance->device & TD_DEVICE_DATA_TOGGLE_ONE_FLAG) ? 1 : 0; 122 136 } 123 137 /*----------------------------------------------------------------------------*/ 138 /** Helper function for parsing value of active bit 139 * 140 * @param[in] instance TD structure to use. 141 * @return Active bit value. 142 */ 124 143 static inline bool td_is_active(td_t *instance) 125 144 { … … 127 146 return (instance->status & TD_STATUS_ERROR_ACTIVE) != 0; 128 147 } 129 130 void td_print_status(td_t *instance); 148 /*----------------------------------------------------------------------------*/ 149 /** Helper function for setting IOC bit. 150 * 151 * @param[in] instance TD structure to use. 152 */ 153 static inline void td_set_ioc(td_t *instance) 154 { 155 assert(instance); 156 instance->status |= TD_STATUS_IOC_FLAG; 157 } 158 /*----------------------------------------------------------------------------*/ 131 159 #endif 132 160 /**
Note:
See TracChangeset
for help on using the changeset viewer.