]> rtime.felk.cvut.cz Git - lincan.git/blobdiff - embedded/app/usbcan/usb/usb_defs.h
Use common USB standard requests handling.
[lincan.git] / embedded / app / usbcan / usb / usb_defs.h
index 48dde4e0fad4905958a42493c95d93700a8917a6..adb531c3ee1c41bd6d1484745b1f4a208ea0060f 100644 (file)
     #define CODE
   #endif
 
-       #ifdef USB_MAX_PACKET
-               #undef USB_MAX_PACKET
-               #define USB_MAX_PACKET 16
-       #endif
+  #ifdef USB_MAX_PACKET
+    #undef USB_MAX_PACKET
+  #endif
+  #define USB_MAX_PACKET 16
+
 /*****************************************************/
 /*** Static data structures for device descriptors ***/
 /*****************************************************/
 #ifndef USB_VENDOR_ID
-  #define USB_VENDOR_ID      0x1669  /* vymyslene cislo ( snad ho nikdo nema ... ;-) */
+  #define USB_VENDOR_ID      0x1669  /* PiKRON.com registered number */
 #endif
 #ifndef USB_PRODUCT_ID
   #define USB_PRODUCT_ID     0x1011  /* test code for ULAD21 */
   };
 
   CODE const char Str1Desc[] = {  /* 1 = manufacturer */
-    48,0x03,
-    'S',0,
-    'm',0,
-    'o',0,
-    'l',0,
+    44,0x03,
+    'K',0,
+    'r',0,
     'i',0,
-    'k',0,
+    'z',0,
     ',',0,
     'B',0,
     'a',0,
   };
 
   CODE const char Str2Desc[] = {  /* 2 = product */
-    38, 0x03,
-    'u',0,
-    'L',0,
-    'a',0,
-    'n',0,
-    '2',0,
-    'u',0,
-    's',0,
-    'b',0,
+    42, 0x03,
+    'C',0,
+    'A',0,
+    'N',0,
+    ' ',0,
+    't',0,
+    'o',0,
+    ' ',0,
+    'U',0,
+    'S',0,
+    'B',0,
     ' ',0,
     'c',0,
     'o',0,
 
   CODE const char Str3Desc[] = {  /* 3 = version */
     26, 0x03,
-    '2',0,
-    '3',0,
-    '.',0,
-    '0',0,
-    '7',0,
+    '1',0,
     '.',0,
+    '1',0,
+    ' ',0,
     '0',0,
-    '4',0,
+    '8',0,
     '-',0,
     '1',0,
-    '.',0,
-    '1',0
+    '1',0,
+    '-',0,
+    '2',0,
+    '3',0
   };
   CODE const char Str4Desc[] = {  /* 4 = configuration */
     34, 0x03,
     '1',0
   };
   CODE const char Str5Desc[] = {  /* 5 = interface */
-    26,0x03,
+    38,0x03,
     'I',0,
     'n',0,
     't',0,
     'e',0,
     ' ',0,
     '#',0,
-    '0',0
+    '0',0,
+    ' ',0,
+    '-',0,
+    ' ',0,
+    'C',0,
+    'A',0,
+    'N',0
   };
 
   CODE const char Str6Desc[] = {  /* EP1 OUT descriptor */
-    136,0x03,
+    48,0x03,
     'E',0,
     'P',0,
     '1',0,
     'n',0,
     'd',0,
     ' ',0,
+    'C',0,
+    'A',0,
+    'N',0,
+    ' ',0,
     'm',0,
     'e',0,
     's',0,
     's',0,
     'a',0,
     'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
+    'e',0
   };
 
-  CODE const char Str7Desc[] = {  /* EP2 IN descriptor */
-    140,0x03,
+  CODE const char Str7Desc[] = {  /* EP1 IN descriptor */
+    52,0x03,
     'E',0,
     'P',0,
     '1',0,
     'v',0,
     'e',0,
     ' ',0,
-    'm',0,
-    'e',0,
-    's',0,
-    's',0,
-    'a',0,
-    'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
-  };
-
-  CODE const char Str8Desc[] = {  /* EP1 OUT descriptor */
-    136,0x03,
-    'E',0,
-    'P',0,
-    '2',0,
-    'O',0,
-    'U',0,
-    'T',0,
-    '-',0,
-    's',0,
-    'e',0,
-    'n',0,
-    'd',0,
+    'C',0,
+    'A',0,
+    'N',0,
     ' ',0,
     'm',0,
     'e',0,
     's',0,
     'a',0,
     'g',0,
-    'e',0,
-    '-',0,
-    'd',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    's',0,
-    'a',0,
-    'd',0,
-    'r',0,
-    ',',0,
-    'c',0,
-    'm',0,
-    'd',0,
-    ',',0,
-    'f',0,
-    'l',0,
-    'g',0,
-    ',',0,
-    's',0,
-    't',0,
-    'a',0,
-    'm',0,
-    'p',0,
-    ',',0,
-    'f',0,
-    'r',0,
-    'e',0,
-    'e',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'l',0,
-    'o',0,
-    ',',0,
-    'l',0,
-    'e',0,
-    'n',0,
-    '-',0,
-    'h',0,
-    'i',0,
-    ',',0,
-    'd',0,
-    'a',0,
-    't',0,
-    'a',0
+    'e',0
   };
 
-  #define CNT_STRINGS 0x09
-
   /* all strings in pointers array */
   CODE const PUSB_STRING_DESCRIPTOR StringDescriptors[] = {
     (PUSB_STRING_DESCRIPTOR) Str0Desc,
     (PUSB_STRING_DESCRIPTOR) Str5Desc,
     (PUSB_STRING_DESCRIPTOR) Str6Desc,
     (PUSB_STRING_DESCRIPTOR) Str7Desc,
-    (PUSB_STRING_DESCRIPTOR) Str8Desc
+  };
+
+  #define CNT_STRINGS (sizeof(StringDescriptors)/sizeof(StringDescriptors[0]))
+
+  CODE const USB_DEVICE_CONFIGURATION_ENTRY usb_devdes_configurations[] = {
+    {
+      .pConfigDescription = &ConfigDescription.configuration,
+      .iConfigTotalLength = CONFIG_DESCRIPTOR_LENGTH
+    }
+  };
+
+  CODE const USB_INTERFACE_DESCRIPTOR *usb_devdes_interfaces[] = {
+    &ConfigDescription.interface
+  };
+
+  CODE const USB_DEVICE_DESCRIPTORS_TABLE usb_devdes_table = {
+    .pDeviceDescription = &DeviceDescription,
+    .pConfigurations = usb_devdes_configurations,
+    .pInterfaceDescriptors = usb_devdes_interfaces,
+    .pStrings = StringDescriptors,
+    .iNumStrings = CNT_STRINGS,
+    .bNumEndpoints = NUM_ENDPOINTS,
+    .bNumConfigurations = 1,
+    .bNumInterfaces = 1
   };
 
 #endif /* USB_DEFS_MODULE */