Changes in uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c [d394f1b8:70d72dd] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
rd394f1b8 r70d72dd 35 35 #include "transfer_descriptor.h" 36 36 37 static unsigned dp[3] = 38 { TD_STATUS_DP_IN, TD_STATUS_DP_OUT, TD_STATUS_DP_SETUP }; 39 static unsigned togg[2] = { TD_STATUS_T_0, TD_STATUS_T_1 }; 37 /** USB direction to OHCI TD values translation table */ 38 static const uint32_t dir[] = { 39 [USB_DIRECTION_IN] = TD_STATUS_DP_IN, 40 [USB_DIRECTION_OUT] = TD_STATUS_DP_OUT, 41 [USB_DIRECTION_BOTH] = TD_STATUS_DP_SETUP, 42 }; 40 43 41 void td_init(td_t *instance, 42 usb_direction_t dir, const void *buffer, size_t size, int toggle) 44 /** 45 * Initialize OHCI TD. 46 * @param instance TD structure to initialize. 47 * @param next Next TD in ED list. 48 * @param direction Used to determine PID, BOTH means setup PID. 49 * @param buffer Pointer to the first byte of transferred data. 50 * @param size Size of the buffer. 51 * @param toggle Toggle bit value, use 0/1 to set explicitly, 52 * any other value means that ED toggle will be used. 53 */ 54 void td_init(td_t *instance, const td_t *next, 55 usb_direction_t direction, const void *buffer, size_t size, int toggle) 43 56 { 44 57 assert(instance); 45 58 bzero(instance, sizeof(td_t)); 59 /* Set PID and Error code */ 46 60 instance->status = 0 47 | ((d p[dir] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT)61 | ((dir[direction] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT) 48 62 | ((CC_NOACCESS2 & TD_STATUS_CC_MASK) << TD_STATUS_CC_SHIFT); 63 49 64 if (toggle == 0 || toggle == 1) { 50 instance->status |= togg[toggle] << TD_STATUS_T_SHIFT; 65 /* Set explicit toggle bit */ 66 instance->status |= TD_STATUS_T_USE_TD_FLAG; 67 instance->status |= toggle ? TD_STATUS_T_FLAG : 0; 51 68 } 69 70 /* Alow less data on input. */ 52 71 if (dir == USB_DIRECTION_IN) { 53 72 instance->status |= TD_STATUS_ROUND_FLAG; 54 73 } 74 55 75 if (buffer != NULL) { 56 76 assert(size != 0); … … 58 78 instance->be = addr_to_phys(buffer + size - 1); 59 79 } 80 81 instance->next = addr_to_phys(next) & TD_NEXT_PTR_MASK; 82 60 83 } 61 84 /**
Note:
See TracChangeset
for help on using the changeset viewer.