2
0

usb_desc.conf 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. # -*- perl -*-
  2. #
  3. # Invoked from usbdescgen.pl
  4. #
  5. usb_languages('en_US', 'sv_SE');
  6. my $vendor_id = word(0x1d50);
  7. my $device_id = word(0x6149);
  8. my $version_id = word(0x0100);
  9. my $serial = usb_serial('_serial_str_');
  10. my $manufacturer = usb_string('' => 'Peter & Per');
  11. my $product = usb_string('' => 'MAX80 I/O card for ABC');
  12. sub acm_channels($$) {
  13. my($channel_count,$ep_base) = @_;
  14. my @d;
  15. for (my $c = 0; $c < $channel_count; $c++) {
  16. my $ep_data = $ep_base + ($c << 1);
  17. my $ep_intr = $ep_data + 1;
  18. my $mgmt_if, $data_if;
  19. push(@d,
  20. # Interface association descriptor
  21. usb_desc('interface_association',
  22. byte(\$mgmt_if), # First interface index
  23. byte(2), # Interface count
  24. # USB spec says to copy the first interface class
  25. usb_class('cdc','acm','v25ter'),
  26. usb_string()),
  27. # Management interface
  28. usb_dset {
  29. usb_desc('interface',
  30. byte($mgmt_if = usb_index),
  31. byte(0), # No alternate settings
  32. byte(1), # Endpoint count
  33. usb_class('cdc','acm','v25ter'),
  34. usb_string()),
  35. usb_desc('cs_interface.header',
  36. word(0x120)), # CDC spec version 1.20
  37. usb_desc('cs_interface.call_management',
  38. byte(0x03), # AT commands over setup or data
  39. byte(\$data_if)), # Which data interface
  40. usb_desc('cs_interface.acm',
  41. byte(0x04)), # Supports SEND_BREAK
  42. usb_desc('cs_interface.union',
  43. byte(\$mgmt_if), # Controlling interface
  44. byte(\$data_if)), # Data interface
  45. # Notification endpoint (input)
  46. usb_desc('endpoint',
  47. ep_i($ep_intr),
  48. byte(3), # Interrupt, data
  49. word(64), # Max packet size
  50. byte(2)), # Interval
  51. },
  52. # Data interface
  53. usb_dset {
  54. usb_desc('interface',
  55. byte($data_if = usb_index),
  56. byte(0), # No alternate settings
  57. byte(2), # Endpoint count
  58. usb_class('cdc_data'),
  59. usb_string()),
  60. # Data endpoint (input)
  61. usb_desc('endpoint',
  62. ep_i($ep_data),
  63. byte(2), # Bulk, data
  64. word(64), # Max packet size
  65. byte(0)), # Interval
  66. # Data endpoint (output)
  67. usb_desc('endpoint',
  68. ep_o($ep_data),
  69. byte(2), # Bulk, data
  70. word(64), # Max packet size
  71. byte(0)) # Interval
  72. });
  73. }
  74. return @d;
  75. }
  76. usb_device {
  77. usb_desc('device',
  78. word(0x101), # USB version
  79. usb_class('multi'), # Device with multiple interfaces
  80. byte(8), # Max packet size on endpoint 0
  81. $vendor_id, $device_id, $version_id,
  82. $manufacturer, $product, $serial,
  83. byte(usb_children) # Number of configurations
  84. ),
  85. usb_dset {
  86. usb_desc('configuration',
  87. word(usb_totallen), # Total length for this dset
  88. byte(usb_children), # Number of interfaces
  89. byte(usb_index,1), # This configuration index
  90. usb_string(), # Text description (empty)
  91. byte(0xc0), # Self or bus powered
  92. byte(500 >> 1)), # Up to 500 mA
  93. # Descriptors for each ACM channel
  94. acm_channels(1,1) # 1 channel starting at EP 1
  95. },
  96. };
  97. usb_additional_data {
  98. # Line state structure
  99. dword(115200), # Baud rate
  100. byte(0), # 1 stop bit
  101. byte(0), # No parity
  102. byte(8) # 8 data bits
  103. };