Changeset c6394aa in mainline for uspace/drv/ohci/hw_struct/transfer_descriptor.h
- Timestamp:
- 2011-04-09T16:56:51Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 77223f8
- Parents:
- b6c9e1e (diff), 5410c04 (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
rb6c9e1e rc6394aa 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 { … … 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) 54 61 #define TD_STATUS_EC_MASK (0x3) /* error count */ 55 62 #define TD_STATUS_EC_SHIFT (26) … … 64 71 volatile uint32_t be; /* buffer end, address of the last byte */ 65 72 } __attribute__((packed)) td_t; 73 74 void td_init( 75 td_t *instance, usb_direction_t dir, void *buffer, size_t size, int toggle); 76 77 inline static void td_set_next(td_t *instance, td_t *next) 78 { 79 assert(instance); 80 instance->next = addr_to_phys(next) & TD_NEXT_PTR_MASK; 81 } 82 83 inline static bool td_is_finished(td_t *instance) 84 { 85 assert(instance); 86 int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 87 /* something went wrong, error code is set */ 88 if (cc != CC_NOACCESS1 && cc != CC_NOACCESS2 && cc != CC_NOERROR) { 89 return true; 90 } 91 /* everything done */ 92 if (cc == CC_NOERROR && instance->cbp == 0) { 93 return true; 94 } 95 return false; 96 } 97 98 static inline int td_error(td_t *instance) 99 { 100 assert(instance); 101 int cc = (instance->status >> TD_STATUS_CC_SHIFT) & TD_STATUS_CC_MASK; 102 return cc_to_rc(cc); 103 } 66 104 #endif 67 105 /**
Note:
See TracChangeset
for help on using the changeset viewer.