Changes in uspace/lib/usb/include/usb/usb.h [fa9d3af:3e6a98c5] in mainline
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/usb.h
rfa9d3af r3e6a98c5 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 91 86 const char *usb_str_speed(usb_speed_t); 92 87 … … 115 110 #define USB_ADDRESS_DEFAULT 0 116 111 /** Maximum address number in USB 1.1. */ 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 } 112 #define USB11_ADDRESS_MAX 128 129 113 130 114 /** USB endpoint number type. … … 133 117 typedef int16_t usb_endpoint_t; 134 118 135 /** Default control endpoint */ 136 #define USB_ENDPOINT_DEFAULT_CONTROL 0 137 /** Maximum endpoint number in USB 1.1. */ 119 /** Maximum endpoint number in USB 1.1. 120 */ 138 121 #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 }150 122 151 123 … … 161 133 } usb_target_t; 162 134 163 164 135 /** Check USB target for allowed values (address and endpoint). 165 136 * … … 169 140 static inline bool usb_target_is_valid(usb_target_t target) 170 141 { 171 return usb_address_is_valid(target.address) &&172 usb_endpoint_is_valid(target.endpoint);142 return !(target.endpoint > 15 || target.endpoint < 0 143 || target.address >= USB11_ADDRESS_MAX || target.address < 0); 173 144 } 174 145
Note:
See TracChangeset
for help on using the changeset viewer.