Changes in uspace/lib/usb/include/usb/usb.h [3e6a98c5:fa9d3af] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/usb.h
r3e6a98c5 rfa9d3af 84 84 } usb_speed_t; 85 85 86 static inline bool usb_speed_is_11(const usb_speed_t s) 87 { 88 return (s == USB_SPEED_FULL) || (s == USB_SPEED_LOW); 89 } 90 86 91 const char *usb_str_speed(usb_speed_t); 87 92 … … 110 115 #define USB_ADDRESS_DEFAULT 0 111 116 /** Maximum address number in USB 1.1. */ 112 #define USB11_ADDRESS_MAX 128 117 #define USB11_ADDRESS_MAX 127 118 #define USB_ADDRESS_COUNT (USB11_ADDRESS_MAX + 1) 119 120 /** Check USB address for allowed values. 121 * 122 * @param ep USB address. 123 * @return True, if value is wihtin limits, false otherwise. 124 */ 125 static inline bool usb_address_is_valid(usb_address_t a) 126 { 127 return (a >= USB_ADDRESS_DEFAULT) && (a <= USB11_ADDRESS_MAX); 128 } 113 129 114 130 /** USB endpoint number type. … … 117 133 typedef int16_t usb_endpoint_t; 118 134 119 /** Maximum endpoint number in USB 1.1. 120 */ 135 /** Default control endpoint */ 136 #define USB_ENDPOINT_DEFAULT_CONTROL 0 137 /** Maximum endpoint number in USB 1.1. */ 121 138 #define USB11_ENDPOINT_MAX 16 139 140 /** Check USB endpoint for allowed values. 141 * 142 * @param ep USB endpoint number. 143 * @return True, if value is wihtin limits, false otherwise. 144 */ 145 static inline bool usb_endpoint_is_valid(usb_endpoint_t ep) 146 { 147 return (ep >= USB_ENDPOINT_DEFAULT_CONTROL) && 148 (ep < USB11_ENDPOINT_MAX); 149 } 122 150 123 151 … … 133 161 } usb_target_t; 134 162 163 135 164 /** Check USB target for allowed values (address and endpoint). 136 165 * … … 140 169 static inline bool usb_target_is_valid(usb_target_t target) 141 170 { 142 return !(target.endpoint > 15 || target.endpoint < 0143 || target.address >= USB11_ADDRESS_MAX || target.address < 0);171 return usb_address_is_valid(target.address) && 172 usb_endpoint_is_valid(target.endpoint); 144 173 } 145 174
Note:
See TracChangeset
for help on using the changeset viewer.