Changeset 45f4f19 in mainline
- Timestamp:
- 2012-03-05T20:33:48Z (13 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 1b90e90
- Parents:
- d1ca752
- Location:
- uspace/drv/bus/usb/ohci/hw_struct
- Files:
-
- 1 added
- 4 edited
Legend:
- Unmodified
- Added
- Removed
-
TabularUnified uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.c ¶
rd1ca752 r45f4f19 58 58 /* Mark as dead, used for dummy EDs at the beginning of 59 59 * endpoint lists. */ 60 OHCI_ WR(instance->status, ED_STATUS_K_FLAG);60 OHCI_MEM32_WR(instance->status, ED_STATUS_K_FLAG); 61 61 return; 62 62 } … … 65 65 66 66 /* Status: address, endpoint nr, direction mask and max packet size. */ 67 OHCI_ WR(instance->status,67 OHCI_MEM32_WR(instance->status, 68 68 ((ep->address & ED_STATUS_FA_MASK) << ED_STATUS_FA_SHIFT) 69 69 | ((ep->endpoint & ED_STATUS_EN_MASK) << ED_STATUS_EN_SHIFT) … … 74 74 /* Low speed flag */ 75 75 if (ep->speed == USB_SPEED_LOW) 76 OHCI_ SET(instance->status, ED_STATUS_S_FLAG);76 OHCI_MEM32_SET(instance->status, ED_STATUS_S_FLAG); 77 77 78 78 /* Isochronous format flag */ 79 79 if (ep->transfer_type == USB_TRANSFER_ISOCHRONOUS) 80 OHCI_ SET(instance->status, ED_STATUS_F_FLAG);80 OHCI_MEM32_SET(instance->status, ED_STATUS_F_FLAG); 81 81 82 82 /* Set TD to the list */ 83 83 const uintptr_t pa = addr_to_phys(td); 84 OHCI_ WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK);85 OHCI_ WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);84 OHCI_MEM32_WR(instance->td_head, pa & ED_TDHEAD_PTR_MASK); 85 OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK); 86 86 87 87 /* Set toggle bit */ 88 88 if (ep->toggle) 89 OHCI_ SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);89 OHCI_MEM32_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY); 90 90 91 91 } -
TabularUnified uspace/drv/bus/usb/ohci/hw_struct/endpoint_descriptor.h ¶
rd1ca752 r45f4f19 40 40 #include <usb/host/endpoint.h> 41 41 42 #include "../ohci_regs.h"43 42 #include "../utils/malloc32.h" 44 43 #include "transfer_descriptor.h" 45 44 46 45 #include "completion_codes.h" 46 #include "mem_access.h" 47 47 48 48 /** … … 117 117 { 118 118 assert(instance); 119 return (OHCI_ RD(instance->td_head) & ED_TDHEAD_HALTED_FLAG)120 || (OHCI_ RD(instance->status) & ED_STATUS_K_FLAG);119 return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_HALTED_FLAG) 120 || (OHCI_MEM32_RD(instance->status) & ED_STATUS_K_FLAG); 121 121 } 122 122 … … 124 124 { 125 125 assert(instance); 126 OHCI_ CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);126 OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG); 127 127 } 128 128 … … 135 135 { 136 136 assert(instance); 137 return (OHCI_ RD(instance->td_head) & ED_TDHEAD_PTR_MASK)138 != (OHCI_ RD(instance->td_tail) & ED_TDTAIL_PTR_MASK);137 return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK) 138 != (OHCI_MEM32_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK); 139 139 } 140 140 … … 148 148 assert(instance); 149 149 const uintptr_t pa = addr_to_phys(td); 150 OHCI_ WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK);150 OHCI_MEM32_WR(instance->td_tail, pa & ED_TDTAIL_PTR_MASK); 151 151 } 152 152 … … 154 154 { 155 155 assert(instance); 156 return OHCI_ RD(instance->td_tail) & ED_TDTAIL_PTR_MASK;156 return OHCI_MEM32_RD(instance->td_tail) & ED_TDTAIL_PTR_MASK; 157 157 } 158 158 … … 160 160 { 161 161 assert(instance); 162 return OHCI_ RD(instance->td_head) & ED_TDHEAD_PTR_MASK;162 return OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_PTR_MASK; 163 163 } 164 164 … … 174 174 const uint32_t pa = addr_to_phys(next); 175 175 assert((pa & ED_NEXT_PTR_MASK) << ED_NEXT_PTR_SHIFT == pa); 176 OHCI_ WR(instance->next, pa);176 OHCI_MEM32_WR(instance->next, pa); 177 177 } 178 178 … … 180 180 { 181 181 assert(instance); 182 return OHCI_ RD(instance->next) & ED_NEXT_PTR_MASK;182 return OHCI_MEM32_RD(instance->next) & ED_NEXT_PTR_MASK; 183 183 } 184 184 … … 191 191 { 192 192 assert(instance); 193 return (OHCI_ RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0;193 return (OHCI_MEM32_RD(instance->td_head) & ED_TDHEAD_TOGGLE_CARRY) ? 1 : 0; 194 194 } 195 195 … … 203 203 assert(instance); 204 204 if (toggle) { 205 OHCI_ SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);205 OHCI_MEM32_SET(instance->td_head, ED_TDHEAD_TOGGLE_CARRY); 206 206 } else { 207 207 /* Clear halted flag when reseting toggle TODO: Why? */ 208 OHCI_ CLR(instance->td_head, ED_TDHEAD_TOGGLE_CARRY);209 OHCI_ CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG);208 OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_TOGGLE_CARRY); 209 OHCI_MEM32_CLR(instance->td_head, ED_TDHEAD_HALTED_FLAG); 210 210 } 211 211 } -
TabularUnified uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c ¶
rd1ca752 r45f4f19 60 60 bzero(instance, sizeof(td_t)); 61 61 /* Set PID and Error code */ 62 OHCI_ WR(instance->status,62 OHCI_MEM32_WR(instance->status, 63 63 ((dir[direction] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT) 64 64 | ((CC_NOACCESS2 & TD_STATUS_CC_MASK) << TD_STATUS_CC_SHIFT)); … … 66 66 if (toggle == 0 || toggle == 1) { 67 67 /* Set explicit toggle bit */ 68 OHCI_ SET(instance->status, TD_STATUS_T_USE_TD_FLAG);69 OHCI_ SET(instance->status, toggle ? TD_STATUS_T_FLAG : 0);68 OHCI_MEM32_SET(instance->status, TD_STATUS_T_USE_TD_FLAG); 69 OHCI_MEM32_SET(instance->status, toggle ? TD_STATUS_T_FLAG : 0); 70 70 } 71 71 72 72 /* Alow less data on input. */ 73 73 if (dir == USB_DIRECTION_IN) { 74 OHCI_ SET(instance->status, TD_STATUS_ROUND_FLAG);74 OHCI_MEM32_SET(instance->status, TD_STATUS_ROUND_FLAG); 75 75 } 76 76 77 77 if (buffer != NULL) { 78 78 assert(size != 0); 79 OHCI_ WR(instance->cbp, addr_to_phys(buffer));80 OHCI_ WR(instance->be, addr_to_phys(buffer + size - 1));79 OHCI_MEM32_WR(instance->cbp, addr_to_phys(buffer)); 80 OHCI_MEM32_WR(instance->be, addr_to_phys(buffer + size - 1)); 81 81 } 82 82 83 OHCI_ WR(instance->next, addr_to_phys(next) & TD_NEXT_PTR_MASK);83 OHCI_MEM32_WR(instance->next, addr_to_phys(next) & TD_NEXT_PTR_MASK); 84 84 85 85 } -
TabularUnified uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.h ¶
rd1ca752 r45f4f19 38 38 #include <stdint.h> 39 39 40 #include " ../ohci_regs.h"40 #include "mem_access.h" 41 41 #include "completion_codes.h" 42 42 … … 100 100 { 101 101 assert(instance); 102 const int cc =(OHCI_ RD(instance->status)102 const int cc =(OHCI_MEM32_RD(instance->status) 103 103 >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 104 104 /* This value is changed on transfer completion, … … 119 119 { 120 120 assert(instance); 121 const int cc = (OHCI_ RD(instance->status)121 const int cc = (OHCI_MEM32_RD(instance->status) 122 122 >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 123 123 return cc_to_rc(cc); … … 136 136 return 0; 137 137 /* Buffer end points to the last byte of transfer buffer, so add 1 */ 138 return OHCI_ RD(instance->be) - OHCI_RD(instance->cbp) + 1;138 return OHCI_MEM32_RD(instance->be) - OHCI_MEM32_RD(instance->cbp) + 1; 139 139 } 140 140 #endif
Note:
See TracChangeset
for help on using the changeset viewer.