Changeset eb0dc58 in mainline for uspace/drv/uhci-hcd/uhci_struct/transfer_descriptor.h
- 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
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
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.