Changes in uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c [70d72dd:d394f1b8] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/bus/usb/ohci/hw_struct/transfer_descriptor.c
r70d72dd rd394f1b8 35 35 #include "transfer_descriptor.h" 36 36 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 }; 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 }; 43 40 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) 41 void td_init(td_t *instance, 42 usb_direction_t dir, const void *buffer, size_t size, int toggle) 56 43 { 57 44 assert(instance); 58 45 bzero(instance, sizeof(td_t)); 59 /* Set PID and Error code */60 46 instance->status = 0 61 | ((d ir[direction] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT)47 | ((dp[dir] & TD_STATUS_DP_MASK) << TD_STATUS_DP_SHIFT) 62 48 | ((CC_NOACCESS2 & TD_STATUS_CC_MASK) << TD_STATUS_CC_SHIFT); 63 64 49 if (toggle == 0 || toggle == 1) { 65 /* Set explicit toggle bit */ 66 instance->status |= TD_STATUS_T_USE_TD_FLAG; 67 instance->status |= toggle ? TD_STATUS_T_FLAG : 0; 50 instance->status |= togg[toggle] << TD_STATUS_T_SHIFT; 68 51 } 69 70 /* Alow less data on input. */71 52 if (dir == USB_DIRECTION_IN) { 72 53 instance->status |= TD_STATUS_ROUND_FLAG; 73 54 } 74 75 55 if (buffer != NULL) { 76 56 assert(size != 0); … … 78 58 instance->be = addr_to_phys(buffer + size - 1); 79 59 } 80 81 instance->next = addr_to_phys(next) & TD_NEXT_PTR_MASK;82 83 60 } 84 61 /**
Note:
See TracChangeset
for help on using the changeset viewer.