Changeset 71450c8 in mainline
- Timestamp:
- 2012-08-09T05:41:00Z (12 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 05f5fbf
- Parents:
- c54f5d0
- Location:
- uspace
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
uspace/app/bithenge/script.c
rc54f5d0 r71450c8 537 537 static bithenge_expression_t *parse_postfix_expression(state_t *state) 538 538 { 539 int rc; 539 540 bithenge_expression_t *expr = parse_term(state); 540 541 while (state->error == EOK) { 541 if (state->token == '[') { 542 if (state->token == '.') { 543 next_token(state); 544 545 const char *id = expect_identifier(state); 546 547 if (state->error != EOK) { 548 free((char *)id); 549 bithenge_expression_dec_ref(expr); 550 return NULL; 551 } 552 553 bithenge_node_t *key = NULL; 554 rc = bithenge_new_string_node(&key, id, true); 555 if (rc != EOK) { 556 error_errno(state, rc); 557 bithenge_expression_dec_ref(expr); 558 return NULL; 559 } 560 561 rc = bithenge_member_expression(&expr, expr, key); 562 if (rc != EOK) { 563 error_errno(state, rc); 564 return NULL; 565 } 566 } else if (state->token == '[') { 542 567 next_token(state); 543 568 bithenge_expression_t *start = parse_expression(state); … … 563 588 return NULL; 564 589 } 565 int rc = bithenge_subblob_expression(&expr, expr,566 start,limit, absolute_limit);590 rc = bithenge_subblob_expression(&expr, expr, start, 591 limit, absolute_limit); 567 592 if (rc != EOK) { 568 593 error_errno(state, rc); -
uspace/dist/src/bithenge/usbdesc.bh
rc54f5d0 r71450c8 7 7 # Originally by Vojtech Horky. 8 8 9 # Block prefixed with a byte length 10 transform block = (in.data) <- struct { 11 .bLength <- uint8; 12 .data <- known_length(.bLength - 1); 13 }; 14 9 15 # USB configuration descriptor 10 16 # This is not the full configuration descriptor (i.e. with interface 11 17 # and endpoint descriptors included) but only the header. 12 18 transform usb_configuration_descriptor_bare = struct { 13 .bLength <- uint8; # assert bLength = 914 .bDescriptorType <- uint8; # assert: bDescriptorType == 215 19 .wTotalLength <- uint16le; 16 20 .bNumInterfaces <- uint8; … … 23 27 # USB interface descriptor 24 28 transform usb_interface_descriptor = struct { 25 .bLength <- uint8; # assert bLength = 926 .bDescriptorType <- uint8; # assert: bDescriptorType == 427 29 .bInterfaceNumber <- uint8; 28 30 .bAlternateSetting <- uint8; … … 36 38 # USB endpoint descriptor 37 39 transform usb_endpoint_descriptor = struct { 38 .bLength <- uint8; # assert bLength = 739 .bDescriptorType <- uint8; # assert: bDescriptorType == 540 40 .bEndpointAddress <- uint8; 41 41 .bmAttributes <- uint8; … … 46 46 # USB HID descriptor 47 47 transform usb_hid_descriptor = struct { 48 .bLength <- uint8;49 .bDescriptorType <- uint8; # assert: bDescriptorType == 3350 48 .bcdHID <- uint16le; 51 49 .bCountryCode <- uint8; 52 50 .bNumDescriptors <- uint8; 53 # Following is repeated bNumDescriptors times 54 .bDescriptorType <- uint8; 55 .wDescriptorLength <- uint16le; 51 <- repeat(.bNumDescriptors) { struct { 52 .bDescriptorType <- uint8; 53 .wDescriptorLength <- uint16le; 54 } }; 56 55 }; 57 56 58 # Fixed configuration for QEMU USB keyboard. 59 transform qemu_usb_keyboard = struct { 60 .configuration_descriptor <- usb_configuration_descriptor_bare; 61 .interface_descriptor <- usb_interface_descriptor; 62 .hid_descriptor <- usb_hid_descriptor; 63 .endpoint_descriptor <- usb_endpoint_descriptor; 64 }; 57 # USB descriptor 58 transform usb_descriptor = struct { 59 .bDescriptorType <- uint8; 60 <- switch (.bDescriptorType) { 61 2: usb_configuration_descriptor_bare; 62 4: usb_interface_descriptor; 63 5: usb_endpoint_descriptor; 64 33: usb_hid_descriptor; 65 }; 66 } <- block; 65 67 66 transform main = qemu_usb_keyboard;68 transform main = repeat { usb_descriptor };
Note:
See TracChangeset
for help on using the changeset viewer.