Changeset 5d915b7 in mainline for uspace/drv/bus/usb/uhci/hw_struct
- Timestamp:
- 2011-09-14T14:25:07Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 8e3d17f
- Parents:
- 1e647c7d
- Location:
- uspace/drv/bus/usb/uhci/hw_struct
- Files:
-
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/uhci/hw_struct/link_pointer.h
r1e647c7d r5d915b7 35 35 #define DRV_UHCI_HW_STRUCT_LINK_POINTER_H 36 36 37 /* UHCI link pointer, used by many data structures */37 /** UHCI link pointer, used by many data structures */ 38 38 typedef uint32_t link_pointer_t; 39 39 -
uspace/drv/bus/usb/uhci/hw_struct/queue_head.h
r1e647c7d r5d915b7 58 58 assert(instance); 59 59 60 instance->element = 0 | LINK_POINTER_TERMINATE_FLAG;61 instance->next = 0 | LINK_POINTER_TERMINATE_FLAG;60 instance->element = LINK_POINTER_TERM; 61 instance->next = LINK_POINTER_TERM; 62 62 } 63 63 /*----------------------------------------------------------------------------*/ … … 71 71 static inline void qh_set_next_qh(qh_t *instance, qh_t *next) 72 72 { 73 uint32_t pa = addr_to_phys(next); 73 /* Physical address has to be below 4GB, 74 * it is an UHCI limitation and malloc32 75 * should guarantee this */ 76 const uint32_t pa = addr_to_phys(next); 74 77 if (pa) { 75 78 instance->next = LINK_POINTER_QH(pa); … … 88 91 static inline void qh_set_element_td(qh_t *instance, td_t *td) 89 92 { 90 uint32_t pa = addr_to_phys(td); 93 /* Physical address has to be below 4GB, 94 * it is an UHCI limitation and malloc32 95 * should guarantee this */ 96 const uint32_t pa = addr_to_phys(td); 91 97 if (pa) { 92 98 instance->element = LINK_POINTER_TD(pa); -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.c
r1e647c7d r5d915b7 113 113 * @return Error code. 114 114 */ 115 int td_status( td_t *instance)115 int td_status(const td_t *instance) 116 116 { 117 117 assert(instance); … … 119 119 /* This is hc internal error it should never be reported. */ 120 120 if ((instance->status & TD_STATUS_ERROR_BIT_STUFF) != 0) 121 return E AGAIN;121 return EIO; 122 122 123 123 /* CRC or timeout error, like device not present or bad data, … … 150 150 * @param[in] instance TD structure to use. 151 151 */ 152 void td_print_status( td_t *instance)152 void td_print_status(const td_t *instance) 153 153 { 154 154 assert(instance); -
uspace/drv/bus/usb/uhci/hw_struct/transfer_descriptor.h
r1e647c7d r5d915b7 69 69 #define TD_STATUS_ACTLEN_MASK 0x7ff 70 70 71 /* double word with USB device specific info */71 /** Double word with USB device specific info */ 72 72 volatile uint32_t device; 73 73 #define TD_DEVICE_MAXLEN_POS 21 … … 87 87 /* According to UHCI design guide, there is 16 bytes of 88 88 * data available here. 89 * According to linux kernel the hardware does not care,90 * itjust needs to be aligned. We don't use it anyway.89 * According to Linux kernel the hardware does not care, 90 * memory just needs to be aligned. We don't use it anyway. 91 91 */ 92 92 } __attribute__((packed)) td_t; … … 97 97 const void *buffer, const td_t *next); 98 98 99 int td_status( td_t *instance);99 int td_status(const td_t *instance); 100 100 101 void td_print_status( td_t *instance);101 void td_print_status(const td_t *instance); 102 102 /*----------------------------------------------------------------------------*/ 103 103 /** Helper function for parsing actual size out of TD. … … 106 106 * @return Parsed actual size. 107 107 */ 108 static inline size_t td_act_size( td_t *instance)108 static inline size_t td_act_size(const td_t *instance) 109 109 { 110 110 assert(instance); 111 111 const uint32_t s = instance->status; 112 /* Actual size is encoded as n-1 (UHCI design guide p. 23) */ 112 113 return ((s >> TD_STATUS_ACTLEN_POS) + 1) & TD_STATUS_ACTLEN_MASK; 113 114 } … … 119 120 * false otherwise. 120 121 */ 121 static inline bool td_is_short( td_t *instance)122 static inline bool td_is_short(const td_t *instance) 122 123 { 123 124 const size_t act_size = td_act_size(instance); … … 134 135 * @return Toggle bit value. 135 136 */ 136 static inline int td_toggle( td_t *instance)137 static inline int td_toggle(const td_t *instance) 137 138 { 138 139 assert(instance); … … 145 146 * @return Active bit value. 146 147 */ 147 static inline bool td_is_active( td_t *instance)148 static inline bool td_is_active(const td_t *instance) 148 149 { 149 150 assert(instance);
Note:
See TracChangeset
for help on using the changeset viewer.