Changeset e50cd7f in mainline for uspace/drv/ohci/hw_struct/transfer_descriptor.h
- Timestamp:
- 2011-04-17T19:17:55Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 63517c2, cfbbe1d3
- Parents:
- ef354b6 (diff), 8595577b (diff)
Note: this is a merge changeset, the changes displayed below correspond to the merge itself.
Use the(diff)
links above to see all the changes relative to each parent. - File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/ohci/hw_struct/transfer_descriptor.h
ref354b6 re50cd7f 35 35 #define DRV_OHCI_HW_STRUCT_TRANSFER_DESCRIPTOR_H 36 36 37 #include <bool.h> 37 38 #include <stdint.h> 39 #include "utils/malloc32.h" 38 40 39 41 #include "completion_codes.h" 42 43 /* OHCI TDs can handle up to 8KB buffers */ 44 #define OHCI_TD_MAX_TRANSFER (8 * 1024) 40 45 41 46 typedef struct td { … … 45 50 #define TD_STATUS_DP_SHIFT (19) 46 51 #define TD_STATUS_DP_SETUP (0x0) 47 #define TD_STATUS_DP_ IN(0x1)48 #define TD_STATUS_DP_ OUT(0x2)52 #define TD_STATUS_DP_OUT (0x1) 53 #define TD_STATUS_DP_IN (0x2) 49 54 #define TD_STATUS_DI_MASK (0x7) /* delay interrupt, wait DI frames before int */ 50 55 #define TD_STATUS_DI_SHIFT (21) … … 52 57 #define TD_STATUS_T_MASK (0x3) /* data toggle 1x = use ED toggle carry */ 53 58 #define TD_STATUS_T_SHIFT (24) 59 #define TD_STATUS_T_0 (0x2) 60 #define TD_STATUS_T_1 (0x3) 61 #define TD_STATUS_T_ED (0) 54 62 #define TD_STATUS_EC_MASK (0x3) /* error count */ 55 63 #define TD_STATUS_EC_SHIFT (26) … … 64 72 volatile uint32_t be; /* buffer end, address of the last byte */ 65 73 } __attribute__((packed)) td_t; 74 75 void td_init( 76 td_t *instance, usb_direction_t dir, void *buffer, size_t size, int toggle); 77 78 inline static void td_set_next(td_t *instance, td_t *next) 79 { 80 assert(instance); 81 instance->next = addr_to_phys(next) & TD_NEXT_PTR_MASK; 82 } 83 84 inline static bool td_is_finished(td_t *instance) 85 { 86 assert(instance); 87 int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 88 /* something went wrong, error code is set */ 89 if (cc != CC_NOACCESS1 && cc != CC_NOACCESS2) { 90 return true; 91 } 92 /* everything done */ 93 if (cc == CC_NOERROR && instance->cbp == 0) { 94 return true; 95 } 96 return false; 97 } 98 99 static inline int td_error(td_t *instance) 100 { 101 assert(instance); 102 int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 103 return cc_to_rc(cc); 104 } 105 106 static inline size_t td_remain_size(td_t *instance) 107 { 108 assert(instance); 109 if (instance->cbp == 0) 110 return 0; 111 return instance->be - instance->cbp + 1; 112 } 66 113 #endif 67 114 /**
Note:
See TracChangeset
for help on using the changeset viewer.