Changeset 711f5fb8 in mainline
- Timestamp:
- 2013-02-08T15:48:41Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 81da273b
- Parents:
- af4e464e
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/lib/usb/include/usb/usb.h
raf4e464e r711f5fb8 112 112 #define USB11_ADDRESS_MAX 128 113 113 114 /** Check USB address for allowed values. 115 * 116 * @param ep USB address. 117 * @return True, if value is wihtin limits, false otherwise. 118 */ 119 static inline bool usb_address_is_valid(usb_address_t a) 120 { 121 return (a >= USB_ADDRESS_DEFAULT) && (a < USB11_ADDRESS_MAX); 122 } 123 114 124 /** USB endpoint number type. 115 125 * Negative values could be used to indicate error. … … 117 127 typedef int16_t usb_endpoint_t; 118 128 119 /** Maximum endpoint number in USB 1.1. 120 */ 129 /** Default control endpoint */ 130 #define USB_ENDPOINT_DEFAULT_CONTROL 0 131 /** Maximum endpoint number in USB 1.1. */ 121 132 #define USB11_ENDPOINT_MAX 16 133 134 /** Check USB endpoint for allowed values. 135 * 136 * @param ep USB endpoint number. 137 * @return True, if value is wihtin limits, false otherwise. 138 */ 139 static inline bool usb_endpoint_is_valid(usb_endpoint_t ep) 140 { 141 return (ep >= USB_ENDPOINT_DEFAULT_CONTROL) && 142 (ep < USB11_ENDPOINT_MAX); 143 } 122 144 123 145 … … 133 155 } usb_target_t; 134 156 157 135 158 /** Check USB target for allowed values (address and endpoint). 136 159 * … … 140 163 static inline bool usb_target_is_valid(usb_target_t target) 141 164 { 142 return !(target.endpoint > 15 || target.endpoint < 0143 || target.address >= USB11_ADDRESS_MAX || target.address < 0);165 return usb_address_is_valid(target.address) && 166 usb_endpoint_is_valid(target.endpoint); 144 167 } 145 168
Note:
See TracChangeset
for help on using the changeset viewer.