Changeset 5097bed4 in mainline for uspace/drv/usbhub/utils.c
- Timestamp:
- 2011-01-07T15:00:31Z (14 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 44bb20b
- Parents:
- 43c3937
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/drv/usbhub/utils.c
r43c3937 r5097bed4 200 200 201 201 202 /* 203 * method for testing port status bitmap 204 205 static void usb_hub_test_port_status(void) { 206 printf("[usb_hub] -------------port status test---------\n"); 207 usb_port_status_t status = 0; 208 209 //printf("original status %d (should be 0)\n",(uint32_t)status); 210 usb_port_set_bit(&status, 1, 1); 211 //printf("%d =?= 2\n",(uint32_t)status); 212 if (status != 2) { 213 printf("[usb_port_status] test failed: wrong set of bit 1\n"); 214 return; 215 } 216 usb_port_set_bit(&status, 3, 1); 217 if (status != 10) { 218 printf("[usb_port_status] test failed: wrong set of bit 3\n"); 219 return; 220 } 221 222 usb_port_set_bit(&status, 15, 1); 223 if (status != 10 + (1 << 15)) { 224 printf("[usb_port_status] test failed: wrong set of bit 15\n"); 225 return; 226 } 227 usb_port_set_bit(&status, 1, 0); 228 if (status != 8 + (1 << 15)) { 229 printf("[usb_port_status] test failed: wrong unset of bit 1\n"); 230 return; 231 } 232 int i; 233 for (i = 0; i < 32; ++i) { 234 if (i == 3 || i == 15) { 235 if (!usb_port_get_bit(&status, i)) { 236 printf("[usb_port_status] test failed: wrong bit at %d\n", i); 237 } 238 } else { 239 if (usb_port_get_bit(&status, i)) { 240 printf("[usb_port_status] test failed: wrong bit at %d\n", i); 241 } 242 } 243 } 244 245 printf("test ok\n"); 246 247 248 //printf("%d =?= 10\n",(uint32_t)status); 249 250 //printf("this should be 0: %d \n",usb_port_get_bit(&status,0)); 251 //printf("this should be 1: %d \n",usb_port_get_bit(&status,1)); 252 //printf("this should be 0: %d \n",usb_port_get_bit(&status,2)); 253 //printf("this should be 1: %d \n",usb_port_get_bit(&status,3)); 254 //printf("this should be 0: %d \n",usb_port_get_bit(&status,4)); 255 256 } 257 */ 202 258 203 259 204
Note:
See TracChangeset
for help on using the changeset viewer.