你的浏览器版本过低,可能导致网站不能正常访问!
为了你能正常使用网站功能,请使用这些浏览器。

【经验分享】STM32 -- Multiple USB CDC (USB IAD)

[复制链接]
STMCU小助手 发布时间:2022-2-6 22:31
One CDC function requires 2 IN / 1 OUT endpoints (interrupt IN/ bulk IN/ bulk OUT), other than the default EP.0 C) e. |  d( s: s7 Z1 I% q6 W# j
Available endpoints of each STM32F family are,
( V! b8 ~! J& }4 L
, r$ C: r2 ~; W  E8 p, T6 dSTM32F102/103 - FS Device core: 7 IN / 7 OUT
, L, U$ w' M6 ?) T1 VSTM32F105/107 - OTG_FS: 3 IN / 3 OUT6 D+ Z& L" X1 d0 J0 E/ }& V
STM32F2xx/4xx - OTG_FS: 3 IN / 3 OUT1 _8 Q2 ]! V# b/ [6 q: n
STM32F2xx/4xx - OTG_HS: 5 IN / 5 OUT

; z5 _- o  h( \! s8 V* G; p1 ESTM32F102/103 - 3x CDC composite [ 6 IN - 3 OUT ]$ {7 G/ Z$ ?2 ?& D/ ]
STM32F105/107 - just one CDC [ 2 IN - 1 OUT ]
8 o# `& D4 q+ lSTM32F2xx/4xx - 2x CDC composite on OTG_HS [ 4 IN - 2 OUT ]
6 Z) l8 \6 h7 Z
080100415652602.png

7 _% b) Q* e$ aStarting from ST's example, it isn't so hard, to make them a CDC composite device,
if you would know where and how to touch on the source code :-)
OK, then let's start here on this thread.
( E* h7 R4 A. f1 j2 G5 h0 D9 p+ {2 a& w! z+ Z. f
The agenda of modification is,
0 v& ^2 H9 y) @" B1) Descriptors and INF file
* ^2 H2 }( v, N. r  Q2) Bulk IN/OUT endpoints
$ w7 e1 t4 I9 e4 ?4 P. N2 S3) Class requests' Z; ~$ G$ Y8 y! X
7 g" X# U: i0 A0 P5 z
The base ST example is STM32F10x and STM32L1xx USB full-speed device library v3.4.0
. G- L1 R: w! O8 E
+ O- x8 Y1 D: y\STM32_USB-FS-Device_Lib_V3.4.0\Project\Virtual_COM_Port
) ^2 E- V. Y6 `$ j5 i, L5 d  X+ O* o* G) |: u& J: B0 v$ _7 z) M4 i
We'll make 3x CDC composite device.# A+ k( B& k% N
8 M+ G& p/ I+ M4 A
1) Descriptors
3 F: m* m! `  ?8 \
9 D" ~' M" Y6 X) XFirst the device descriptor is modified at class/subclass/protocol and VID/PID (idVendor/idProduct) fields.
$ p( v8 q4 m8 ]6 R% i% q0 \! ^, SWe assign temporary VID/PID just for this development. Get official VID/PID afterward.
8 x9 H: T7 k3 X5 {. z4 ^0 V) GVirtual_Com_Port_DeviceDescriptor() is replaced, as follows.
( T* E/ @$ p2 p4 A$ h; }8 w/ s! g; ~& R( U' t' Z; W
usb_desc.c
  1. /* USB Standard Device Descriptor */+ G( s- i  e) e- k

  2. 9 i  L7 d# a) X" s
  3. const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
    - c2 s$ ?& n# s6 l6 Z
  4.   {
    2 u  {7 y. t& [! s0 r
  5.     0x12,   /* bLength */4 z8 C: c1 |6 b  M& E0 ?: B' P
  6.     USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */! `4 k( t- R3 ~: [7 F
  7.     0x00,
    / w* X' [7 V5 I
  8.     0x02,   /* bcdUSB = 2.00 */
    8 M' p3 @$ G3 w3 W
  9.     0xEF,   /* bDeviceClass    (Misc)   */
    7 s0 T4 S0 e( x+ P6 b
  10.     0x02,   /* bDeviceSubClass (common) */2 `& b6 |' I/ L+ B) Y- K- Y7 ?$ y
  11.     0x01,   /* bDeviceProtocol (IAD)    */( a& F; S, |  f% S
  12.     0x40,   /* bMaxPacketSize0 */8 h2 s5 R7 M& I+ e7 J
  13.     0x83,5 W% y+ K5 h6 F" [
  14.     0x02,   /* idVendor = 0xFF02 */
    . {5 f) N5 A- ]- U: s: \8 y
  15.     0xFF,
    ' N( p; M) W& {! Z$ D
  16.     0x01,   /* idProduct = 0x0001 */) v' |  r$ C0 m# p! c* P7 z6 \# ]
  17.     0x00,5 i* W6 i( S- V/ J' X! _" w+ J
  18.     0x02,   /* bcdDevice = 2.00 */
    / j( U+ N) V4 g1 \
  19.     1,              /* Index of string descriptor describing manufacturer */
    " [! S0 J% F% |# ?" T
  20.     2,              /* Index of string descriptor describing product */8 Q% S& j9 p7 A4 E/ C  Q7 {& k
  21.     3,              /* Index of string descriptor describing the device's serial number */
    3 }1 y( K  t8 g" L& N) D' I
  22.     0x01    /* bNumConfigurations */
    + i2 s' L+ l, ]
  23.   };
复制代码
: b: H- o. Z/ H, `! \  Q+ l
Next, the Configuration descriptor set is heavy, because we have to repeat three sets of IAD / CDC interfaces. We make them macros
  1. #define WBVAL(x) (x & 0xFF),((x >> 8) & 0xFF)" p& E+ A9 v! p- i, [# @% \

  2. * x8 I, w! r6 N. O" }  Z  [
  3. #define USB_CONFIGUARTION_DESC_SIZE             9- r: W2 }9 h; N2 }* W' ]9 W
  4. #define USB_INTERFACE_DESC_SIZE                 9
    + ]  c% V3 Y. S8 w# ]+ X
  5. #define USB_ENDPOINT_DESC_SIZE                  75 x4 y4 F' W+ v& X
  6. #define USB_ENDPOINT_TYPE_BULK                  0x02
    9 e, K& d/ {% Y' f
  7. #define USB_ENDPOINT_TYPE_INTERRUPT             0x03
    ) e9 l; q) E3 V' a8 u0 I

  8. % {# ?% E# Z. G/ q1 f
  9. #define USB_CONFIG_BUS_POWERED                 0x80. b+ }$ z1 u1 g5 E/ o
  10. #define USB_CONFIG_SELF_POWERED                0xC04 m9 }7 X7 @9 Q
  11. #define USB_CONFIG_POWER_MA(mA)                ((mA)/2)7 c4 D) H/ h+ O. @1 U
  12. 1 J- _5 u7 D- X6 |/ Z! _# w! G
  13. #define CDC_COMMUNICATION_INTERFACE_CLASS       0x026 E0 X2 d. Y6 X6 b' Q' ^
  14. #define CDC_DATA_INTERFACE_CLASS                0x0A
    , B0 u1 B2 V5 a3 q8 U
  15. #define CDC_ABSTRACT_CONTROL_MODEL              0x02
    , A, T% J' z  y7 p) _1 K  H
  16. #define CDC_CS_INTERFACE                        0x24
    8 b" T; Y+ Z, ~
  17. #define CDC_HEADER                              0x00* s4 |( n0 q* w. v) I! h
  18. #define CDC_CALL_MANAGEMENT                     0x01
    1 G( S2 F& A' k; K$ {
  19. #define CDC_ABSTRACT_CONTROL_MANAGEMENT         0x020 v# f8 B) G$ s. h. x$ m7 w: h# U
  20. #define CDC_UNION                               0x067 P, Q( Z2 {( g% P' n  `7 i
  21. - g$ X6 U6 I7 [+ Z
  22. #define CDC_IF_DESC_SET_SIZE                    \( USB_INTERFACE_DESC_SIZE + 0x05 + 0x05 + 0x04 + 0x05 + USB_ENDPOINT_DESC_SIZE + USB_INTERFACE_DESC_SIZE + 2 * USB_ENDPOINT_DESC_SIZE )
    . u' h9 b% U) V- {2 X

  23. * ?3 n: c; P% a
  24. #define CDC_IF_DESC_SET( comIfNum, datIfNum, comInEp, datOutEp, datInEp )   \
    5 c" r( u" T. f% n" w7 b
  25. /* CDC Communication Interface Descriptor */                            \
    , V& A; s2 i& v2 B/ x
  26.     USB_INTERFACE_DESC_SIZE,                /* bLength */               \+ X1 V) k! R4 e
  27.     USB_INTERFACE_DESCRIPTOR_TYPE,          /* bDescriptorType */       \6 x6 M; Z7 n4 [/ m6 b2 B
  28.     comIfNum,                               /* bInterfaceNumber */      \8 i; H5 |2 X7 I, }$ w
  29.     0x00,                                   /* bAlternateSetting */     \! K6 \2 v1 ^: G4 \. C& [3 }9 c4 R
  30.     0x01,                                   /* bNumEndpoints */         \
    . ]5 }& S1 b  C/ F! t3 p& ?
  31.     CDC_COMMUNICATION_INTERFACE_CLASS,      /* bInterfaceClass */       \7 T- u% A6 z! p4 m4 i
  32.     CDC_ABSTRACT_CONTROL_MODEL,             /* bInterfaceSubClass */    \
    4 ^2 j* E1 |. t3 x
  33.     0x01,                                   /* bInterfaceProtocol */    \: r$ \" K; P: C( ?
  34.     0x00,                                   /* iInterface */            \5 r$ V0 j4 E9 K" O
  35. /* Header Functional Descriptor */                                      \
    * `# B/ B- |4 n1 K0 z
  36.     0x05,                                   /* bLength */               \
    % w5 n! Q) l: e9 H
  37.     CDC_CS_INTERFACE,                       /* bDescriptorType */       \
    ( |0 h, n. M, `1 W$ p" _
  38.     CDC_HEADER,                             /* bDescriptorSubtype */    \
    3 m* @/ l* T0 t0 `
  39.     WBVAL(CDC_V1_10), /* 1.10 */            /* bcdCDC */                \3 ?8 O: \$ B) ^- `+ D
  40. /* Call Management Functional Descriptor */                             \
    $ D; A7 t4 _0 d; D2 G7 t  A; {; @
  41.     0x05,                                   /* bFunctionLength */       \
    * f1 N7 n+ M+ |
  42.     CDC_CS_INTERFACE,                       /* bDescriptorType */       \9 L; {' `$ U: M$ O" {
  43.     CDC_CALL_MANAGEMENT,                    /* bDescriptorSubtype */    \
    ( b- T% n# ~) E, t) Q* e* L
  44.     0x03,                                   /* bmCapabilities */        \
    / c6 ?  ~- N& |/ m. n
  45.     datIfNum,                               /* bDataInterface */        \
    : `' T5 ^: y1 U: K
  46. /* Abstract Control Management Functional Descriptor */                 \: a; n7 l) Q/ G" {6 e- q
  47.     0x04,                                   /* bFunctionLength */       \* }% d: x0 |7 M5 [3 B6 S: ?
  48.     CDC_CS_INTERFACE,                       /* bDescriptorType */       \% i0 W3 x/ y  d4 t- a6 c- k
  49.     CDC_ABSTRACT_CONTROL_MANAGEMENT,        /* bDescriptorSubtype */    \
    % P! I5 m+ U! U& G
  50.     0x02,                                   /* bmCapabilities */        \: D. b8 t7 v$ |( B: r% O1 o
  51. /* Union Functional Descriptor */                                       \8 G% c# i- |% C4 g! Q* f8 H
  52.     0x05,                                   /* bFunctionLength */       \7 J" `, Q3 P) A* M, d
  53.     CDC_CS_INTERFACE,                       /* bDescriptorType */       \  u) ^* I- W. N4 q+ e8 X) K/ m
  54.     CDC_UNION,                              /* bDescriptorSubtype */    \9 A6 E0 l( Q6 @7 N9 ^
  55.     comIfNum,                               /* bMasterInterface */      \$ _2 S; R+ F, X2 a
  56.     datIfNum,                               /* bSlaveInterface0 */      \
    ; P% r- `- t& n2 b. B' V* h* s
  57. /* Endpoint, Interrupt IN */                /* event notification */    \4 R1 B5 D5 @  l
  58.     USB_ENDPOINT_DESC_SIZE,                 /* bLength */               \
    / Q) u6 X3 B3 w
  59.     USB_ENDPOINT_DESCRIPTOR_TYPE,           /* bDescriptorType */       \: O) }1 W. \# C, j4 H4 t) e! s
  60.     comInEp,                                /* bEndpointAddress */      \
    : r. c4 Y% ~* L) d2 }
  61.     USB_ENDPOINT_TYPE_INTERRUPT,            /* bmAttributes */          \
    " V5 U: e7 Z1 p/ `6 v3 Q$ P
  62.     WBVAL(0x000A),                          /* wMaxPacketSize */        \5 _2 I3 M  K2 Q: c) k3 E4 U
  63.     0x01,                                   /* bInterval */             \
    ) l. f$ V* m. _3 u6 F8 j' m# y
  64.                                                                         \( B1 U8 ~+ Q) O! l; w
  65. /* CDC Data Interface Descriptor */                                     \
    2 ~5 T6 M) c; k7 \1 G
  66.     USB_INTERFACE_DESC_SIZE,                /* bLength */               \3 i6 Z6 u# e2 l& q9 {( T! ~5 D! e
  67.     USB_INTERFACE_DESCRIPTOR_TYPE,          /* bDescriptorType */       \5 {; a3 l  f; \* R3 ?
  68.     datIfNum,                               /* bInterfaceNumber */      \  Y1 N8 |/ [& P
  69.     0x00,                                   /* bAlternateSetting */     \
    % T% w. W. c" z. L5 E; D2 _6 w
  70.     0x02,                                   /* bNumEndpoints */         \
    2 n; W& G2 F+ q" R5 x4 [
  71.     CDC_DATA_INTERFACE_CLASS,               /* bInterfaceClass */       \; D2 M, R  n% _
  72.     0x00,                                   /* bInterfaceSubClass */    \1 n' a0 z2 U& G- J* d/ a5 `. K
  73.     0x00,                                   /* bInterfaceProtocol */    \$ h8 I5 D& R( ]% H# p& e+ Q1 h
  74.     0x00,                                   /* iInterface */            \1 V" G, n3 z/ I% r5 D
  75. /* Endpoint, Bulk OUT */                                                \; f+ O9 {% |5 k# d4 [4 s: X5 {
  76.     USB_ENDPOINT_DESC_SIZE,                 /* bLength */               \/ D: J+ Y  N4 x, J; {
  77.     USB_ENDPOINT_DESCRIPTOR_TYPE,           /* bDescriptorType */       \1 f# Z+ E4 T! d' c. K% p1 u
  78.     datOutEp,                               /* bEndpointAddress */      \$ D5 k1 A# P/ H  ^( Q; L$ F
  79.     USB_ENDPOINT_TYPE_BULK,                 /* bmAttributes */          \0 q6 k2 `) a* ]+ C% p& A
  80.     WBVAL(VIRTUAL_COM_PORT_DATA_SIZE),      /* wMaxPacketSize */        \$ |/ I6 s6 T! B9 M
  81.     0x00,                                   /* bInterval */             \) ~  [" A/ B5 l* t- a
  82. /* Endpoint, Bulk IN */                                                 \
    ( F/ [7 ^# x2 p3 `; s# t
  83.     USB_ENDPOINT_DESC_SIZE,                 /* bLength */               \
    7 C: W0 y' O4 k' ^
  84.     USB_ENDPOINT_DESCRIPTOR_TYPE,           /* bDescriptorType */       \3 Q8 k# u7 _! `/ B) `) _  u
  85.     datInEp,                                /* bEndpointAddress */      \; s) n* J' r! _1 A, j
  86.     USB_ENDPOINT_TYPE_BULK,                 /* bmAttributes */          \
    $ m1 f! l$ W" r5 }
  87.     WBVAL(VIRTUAL_COM_PORT_DATA_SIZE),      /* wMaxPacketSize */        \
    6 ~4 }6 e* X: g% Y8 L
  88.     0x00                                    /* bInterval */
    0 h) |( m! C" l% Q& |: h
  89. , e5 S% {% o# F' t0 q

  90. 6 o8 R* ^# ~, c% ?7 z
  91. #define IAD_CDC_IF_DESC_SET_SIZE    ( 8 + CDC_IF_DESC_SET_SIZE )
    7 R% @" u3 }: O3 X+ a% K7 O$ _& Y1 f
  92. 0 m* G* M& Y2 c9 o" R0 Z
  93. #define IAD_CDC_IF_DESC_SET( comIfNum, datIfNum, comInEp, datOutEp, datInEp )   \- f6 Y0 f) K+ c) d( p
  94. /* Interface Association Descriptor */                                  \
    # e1 ?- `7 E; H: {
  95.     0x08,                                   /* bLength */               \
    4 D4 r3 X- U. G2 L! l: \
  96.     0x0B,                                   /* bDescriptorType */       \
    / p( h6 C* }1 c3 X% Y6 u
  97.     comIfNum,                               /* bFirstInterface */       \
    3 P0 A2 d) t- V" T( v9 c; q
  98.     0x02,                                   /* bInterfaceCount */       \/ A0 j* S, z+ W3 e9 F4 n
  99.     CDC_COMMUNICATION_INTERFACE_CLASS,      /* bFunctionClass */        \
      h8 r7 X) B9 K( F9 R- ]6 ?
  100.     CDC_ABSTRACT_CONTROL_MODEL,             /* bFunctionSubClass */     \
    ; W2 j6 c5 m" Z( z7 n
  101.     0x01,                                   /* bFunctionProcotol */     \
    $ w; A  {9 a& L; N
  102.     0x00,                                   /* iInterface */            \
    ) I* C& Y6 b( T3 G: Q' x% e. ?
  103. /* CDC Interface descriptor set */                                      \% ?/ _$ @& m+ I2 u+ Z$ Q  ~
  104.     CDC_IF_DESC_SET( comIfNum, datIfNum, comInEp, datOutEp, datInEp )
复制代码

* Y/ y5 N3 ]' r& E- o$ d2 ~: E* u' W4 [. y: X2 z4 b/ U# e
Now that the configuration descriptor set is simplified. Virtual_Com_Port_ConfigDescriptor[] is replaced as follows,
$ r  E" E6 B0 c( r! ]
# f. j, T; K, C0 B' U2 x5 h0 qusb_desc.c
  1. // Interface numbers
    6 L/ d% p) @  `. a
  2. enum {) h5 g- D3 Z& m. O1 P9 T
  3.     USB_CDC_CIF_NUM0,
    4 X5 N. X# m  _+ S! S7 x$ C
  4.     USB_CDC_DIF_NUM0,& p* C& }; t% C
  5.     USB_CDC_CIF_NUM1,
    9 _" ?. X; b3 b1 m2 w1 L
  6.     USB_CDC_DIF_NUM1,$ x8 U7 i% ^4 t3 a0 r; v% V
  7.     USB_CDC_CIF_NUM2,4 U! |2 \5 `8 p! k  h) G, |
  8.     USB_CDC_DIF_NUM2,
    & E* N! F2 w+ H: D& \
  9.     8 f9 N& M) W$ C( ?" P0 B  c2 d
  10.     USB_NUM_INTERFACES        // number of interfaces4 b  W5 _+ o7 X
  11. };, R' i6 `/ m3 c  K1 k  p  a
  12. 6 `" B; N$ G5 r
  13. const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
    3 i' l: U/ V# \/ [9 ]: E  E; Q0 v
  14.   {6 ~4 u. g( P  c  j  o% s' M
  15. /* Configuration 1 */
    / y/ _2 `+ f5 H" m$ I( m4 y4 v
  16.   USB_CONFIGUARTION_DESC_SIZE,       /* bLength */$ ?2 [% m2 q* D& U$ g4 D
  17.   USB_CONFIGURATION_DESCRIPTOR_TYPE, /* bDescriptorType */
    9 I' H5 X/ p% C' x, F- o3 ~
  18.   WBVAL(                             /* wTotalLength */+ R. I8 Z# \' m7 `
  19.       USB_CONFIGUARTION_DESC_SIZE7 D7 _- V, w  f
  20.     + 3 * IAD_CDC_IF_DESC_SET_SIZE+ n/ g( E% V2 Y6 R
  21.   ),
    5 i, {2 Y; L9 T0 v  H
  22.   USB_NUM_INTERFACES,                /* bNumInterfaces */% z5 q% a# S) s, M
  23.   0x01,                              /* bConfigurationValue: 0x01 is used to select this configuration */6 ?5 T8 b3 a5 z. Q5 K+ {
  24.   0x00,                              /* iConfiguration: no string to describe this configuration */
    - M2 Y2 p2 J' b! O8 B! F& k" G
  25.   USB_CONFIG_BUS_POWERED /*|*/       /* bmAttributes USB_CONFIG_REMOTE_WAKEUP*/,
    * D' k% S8 j6 C
  26.   USB_CONFIG_POWER_MA(100),          /* bMaxPower, device power consumption is 100 mA */
    8 a( m4 d. r( l! H; U: T5 G
  27. 9 y1 _) B* h5 E' s0 s( s" w" w
  28.   IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM0, USB_CDC_DIF_NUM0, USB_ENDPOINT_IN(1), USB_ENDPOINT_OUT(2), USB_ENDPOINT_IN(2) ),
    * f9 ?5 S" D3 [1 C
  29.   IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM1, USB_CDC_DIF_NUM1, USB_ENDPOINT_IN(3), USB_ENDPOINT_OUT(4), USB_ENDPOINT_IN(4) ),
    # |  K2 J6 }! f3 d$ d7 R
  30.   IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM2, USB_CDC_DIF_NUM2, USB_ENDPOINT_IN(5), USB_ENDPOINT_OUT(6), USB_ENDPOINT_IN(6) ),
    7 u5 D; D7 d% ]& `. g
  31. };
复制代码
9 L1 y, ^+ p) M( J/ C
8 w5 H8 x# b4 [. p
Auu, I remember that the packet buffer of STM32F102/103 is limited to 512 bytes.
To pack all of endpoint packet buffers into this size,
we have to shrink EP0 bMaxPacketSize0 on the Device Descriptor from 0x40 to 0x08 (minimum)
  1. /* USB Standard Device Descriptor */9 b& q0 R* P. }% ]8 |

  2. ! l5 O- s: G6 p& U; t
  3. const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
    . M. f% e6 Q% J4 I6 k% y3 l
  4.   {, _6 G' Y) h* w6 k1 ?& ^
  5.     0x12,   /* bLength */: p# c: l( l5 g' w
  6.     USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */
    0 T! ]2 w/ z: s4 a  T( b
  7.     0x00,
    4 {# S+ f8 Y$ o/ ^) c" a
  8.     0x02,   /* bcdUSB = 2.00 */5 h2 D- J' F% }5 y
  9.     0xEF,   /* bDeviceClass    (Misc)   */& J. F# ~! S& H
  10.     0x02,   /* bDeviceSubClass (common) */; e# z1 N: S- M& D
  11.     0x01,   /* bDeviceProtocol (IAD)    */. a9 m; P7 A8 |* Q$ l9 i
  12.     0x08,   /* bMaxPacketSize0 */        // <-----------
    $ D3 {; v% B" A) O) m# ?$ K# v
  13.     0x83,
    ; x% t3 n  {# t) _' e6 j/ Z2 o, |  [
  14.     0x02,   /* idVendor = 0xFF02 */: A! }6 K7 J  `5 e) r
  15.     0xFF,3 ^$ @7 W  n7 U" s3 y
  16.     0x01,   /* idProduct = 0x0001 */
    ! a! x3 O, o0 f- u( }6 F, _* l
  17.     0x00,! L3 Z( d1 W; c1 C; C
  18.     0x02,   /* bcdDevice = 2.00 */, [, j9 O  ^* N* P! q
  19.     1,              /* Index of string descriptor describing manufacturer */
    1 r. P6 c# F$ q" ^- K
  20.     2,              /* Index of string descriptor describing product *// I( k: F' f/ t7 o0 G
  21.     3,              /* Index of string descriptor describing the device's serial number */; b8 A, D; U* u; w* B
  22.     0x01    /* bNumConfigurations */$ j0 t3 X- ?& [/ [" b6 g1 d! n' p+ s
  23.   };
复制代码

+ I" |* ?/ J+ S9 t# d0 W1 R
Next, enable all endpoints in Virtual_Com_Port_Reset() Here, packet buffer is allocated for each endpoint.
\inc\usb_conf.h
  1. /*-------------------------------------------------------------*/* [, ]4 z: R  J: Q
  2. /* --------------   Buffer Description Table  -----------------*/5 z! t. u' {0 k1 h6 u- F+ @
  3. /*-------------------------------------------------------------*/
    . s' L: v7 h, Z- F! f2 n+ u% x" s
  4. /* buffer table base address */
    * U' U/ x4 E5 I; E1 ^
  5. /* buffer table base address */- w3 g% B& S6 w3 `: Z# d! O
  6. #define BTABLE_ADDRESS      (0x00)# j' X( P: W1 f- D$ z9 k
  7. 2 [& W% N5 M0 X7 j$ `' K
  8. /* EP0  */
    $ o5 y5 _6 m7 ?1 h1 m
  9. /* rx/tx buffer base address */
    3 _8 F9 e  Z7 P  u1 r+ }  c' d1 v( N" l
  10. #define ENDP0_RXADDR        (0x40)
    2 X5 m$ @3 l* `
  11. #define ENDP0_TXADDR        (0x48)* W5 D) O6 X. g* `- E) f

  12. 9 F8 O2 ]" y& J/ a1 O2 n# d
  13. /* EP1  */
    # P2 N* {& ]. b# ]' o  f
  14. /* tx buffer base address */- H, W7 G9 Q2 H& k$ A
  15. #define ENDP1_TXADDR        (0x50)) e' \6 K, t: N* G8 u# m% v# |
  16. #define ENDP2_TXADDR        (0x60)
    $ g9 X* q% O$ J' W1 x
  17. #define ENDP2_RXADDR        (0xA0)
    " z+ l+ J) w+ _$ x
  18. #define ENDP3_TXADDR        (0xE0)
    & ~: R1 L( _& ^$ z
  19. #define ENDP4_TXADDR        (0xF0)
    ) Y" v( Z' F6 H( ~9 F; B
  20. #define ENDP4_RXADDR        (0x130)
      B1 `6 M6 _/ O* z4 q. J* b/ K
  21. #define ENDP5_TXADDR        (0x170)
    ! [0 {0 D6 J$ ]8 v: {
  22. #define ENDP6_TXADDR        (0x180)  ~) C% O, R2 H  @  w
  23. #define ENDP6_RXADDR        (0x1C0)
复制代码

0 Y5 a7 K; A5 X$ z3 B' V
usb_prop.c
  1. /*******************************************************************************# ~; Y- g4 T3 S
  2. * Function Name  : Virtual_Com_Port_Reset
    ) Q! P- `9 Z/ M( X; i3 [3 q
  3. * Description    : Virtual_Com_Port Mouse reset routine% e, C5 x- e9 S7 R1 Z0 F% F% _8 m2 z
  4. * Input          : None.7 f2 k6 d; @9 p8 ~6 G, `% e
  5. * Output         : None.5 s& ^3 ]6 `1 R5 g& _/ {
  6. * Return         : None.
    ) X+ j  m0 h& [" H# J& @; \6 K$ M( i6 m
  7. *******************************************************************************/
      r# [" x, ^5 |9 [
  8. void Virtual_Com_Port_Reset(void)0 N& e3 s: Q8 t( t
  9. {+ f$ N$ n1 x: C( k$ K* V6 m8 f
  10.   /* Set Virtual_Com_Port DEVICE as not configured */
    4 v5 J7 q6 v) Q) \6 i) ?
  11.   pInformation->Current_Configuration = 0;  Q" g# B( G' I

  12. 5 ^; a5 [  \& d+ K" _
  13.   /* Current Feature initialization */
    ' K& N% N" {- E' U
  14.   pInformation->Current_Feature = Virtual_Com_Port_ConfigDescriptor[7];0 v6 A& N( q7 T# n: j
  15. 5 g( _1 B1 l2 U3 I
  16.   /* Set Virtual_Com_Port DEVICE with the default Interface*/
    # s9 f* m& H- \+ f7 i
  17.   pInformation->Current_Interface = 0;6 z! t3 A1 l1 d. h
  18. * l- n3 L# s# }! t) T0 f
  19.   SetBTABLE(BTABLE_ADDRESS);/ K" J* k/ f+ ~# [& C. g" V
  20. ! Q1 r1 C$ p9 X3 i
  21.   /* Initialize Endpoint 0 */
    4 s* r  o' Q! m- w, J9 i7 z2 W
  22.   SetEPType(ENDP0, EP_CONTROL);
    + D7 p0 s  M/ Q  O
  23.   SetEPTxStatus(ENDP0, EP_TX_STALL);  g5 i; T6 l  W: L
  24.   SetEPRxAddr(ENDP0, ENDP0_RXADDR);! c# {! t, E  X' G* l
  25.   SetEPTxAddr(ENDP0, ENDP0_TXADDR);  K; }' J2 Y0 @/ N( H
  26.   Clear_Status_Out(ENDP0);
    8 J/ m* @' h$ G- j/ r* S" w$ |
  27.   SetEPRxCount(ENDP0, Device_Property.MaxPacketSize);
    . k! X) e* N, @* C. E# O9 h
  28.   SetEPRxValid(ENDP0);
    8 H, U$ ?6 D) g# e! }7 Z

  29. 8 J. Q4 A8 b# ~# h6 C4 K
  30.   /* Initialize Endpoint 1 */& l" ~, h) a: D- k
  31.   SetEPType(ENDP1, EP_INTERRUPT);+ o1 C8 C0 D) Y" t: m' z' ?/ @; Q" U
  32.   SetEPTxAddr(ENDP1, ENDP1_TXADDR);
    3 J" i5 R; s$ o3 j, e* O$ @' b5 x
  33.   SetEPTxStatus(ENDP1, EP_TX_NAK);
    : D1 Y$ `. Y7 V: H6 T
  34.   SetEPRxStatus(ENDP1, EP_RX_DIS);
    ; k6 b) E# ~# p6 R

  35. 7 x+ @6 G+ h* O7 r% {6 D
  36.   /* Initialize Endpoint 2 */
    1 y- C( V4 L2 \) q, S9 z
  37.   SetEPType(ENDP2, EP_BULK);" B2 h( y$ N7 w! t9 R2 R$ b" |
  38.   SetEPTxAddr(ENDP2, ENDP2_TXADDR);1 \% a- k8 Y+ b! c( {) _6 g6 A+ I1 b  T
  39.   SetEPTxStatus(ENDP2, EP_TX_NAK);# z% s) J2 ^" ^0 D9 r; q8 \) Y
  40.   SetEPRxAddr(ENDP2, ENDP2_RXADDR);- z; k  p  C* w, p" P
  41.   SetEPRxCount(ENDP2, VIRTUAL_COM_PORT_DATA_SIZE);
    / T- }2 [7 o* Q& I& R* E5 M+ X
  42.   SetEPRxStatus(ENDP2, EP_RX_VALID);
    " g# ]5 B2 I9 E6 `

  43. 2 w6 b6 v7 P" l9 S
  44.   /* Initialize Endpoint 3 */
    % m# X/ {4 j( X2 f8 b( c8 l' d
  45.   SetEPType(ENDP3, EP_INTERRUPT);
    $ w5 ?4 {  @5 H& ~* Z: O2 Q
  46.   SetEPTxAddr(ENDP3, ENDP3_TXADDR);: y3 J+ v) r. u- u( a& g
  47.   SetEPTxStatus(ENDP3, EP_TX_NAK);7 l+ U4 m; Z( m, c7 Y- q: Y. c2 Y
  48.   SetEPRxStatus(ENDP3, EP_RX_DIS);% g# S( F3 e; l1 ]/ W  K" ^8 u
  49. 9 \  }* K( Y# C" r' k
  50.   /* Initialize Endpoint 4 */
    9 R* M2 z5 b; ^/ l3 Y
  51.   SetEPType(ENDP4, EP_BULK);1 @, m% D* b( ~$ `" j$ w& z
  52.   SetEPTxAddr(ENDP4, ENDP4_TXADDR);  V0 ~- P. }1 ?
  53.   SetEPTxStatus(ENDP4, EP_TX_NAK);  F/ v3 e/ g( D1 o0 Y! ^
  54.   SetEPRxAddr(ENDP4, ENDP4_RXADDR);
    $ g3 L: e0 a' }) l' ?* b2 T' o5 H7 `
  55.   SetEPRxCount(ENDP4, VIRTUAL_COM_PORT_DATA_SIZE);
    0 e6 g. e: r* `* P. q; o- W! N
  56.   SetEPRxStatus(ENDP4, EP_RX_VALID);
    2 ~3 {; g7 M4 e  e
  57. 1 B" L1 c- ~6 z; m* ]0 d
  58.   /* Initialize Endpoint 5 */
    ! N0 v7 o" g$ n. F. [" ?
  59.   SetEPType(ENDP5, EP_INTERRUPT);
    3 ~# A' p1 }6 x: W
  60.   SetEPTxAddr(ENDP5, ENDP5_TXADDR);0 H. H5 \1 g* d; Q- A, Q- Z
  61.   SetEPTxStatus(ENDP5, EP_TX_NAK);
    0 i( K, A4 s6 h( |# C1 I
  62.   SetEPRxStatus(ENDP5, EP_RX_DIS);
    $ Z% i- E5 _4 l( ]  }
  63. 1 v9 Y0 S4 S, D6 A5 g
  64.   /* Initialize Endpoint 6 */4 O( N4 l5 Z8 ?* ^: m
  65.   SetEPType(ENDP6, EP_BULK);2 d4 p: y1 U4 K% n/ t4 [- p
  66.   SetEPTxAddr(ENDP6, ENDP6_TXADDR);5 u, d  m! a* J5 g& h9 v7 t- u9 t, ~. w
  67.   SetEPTxStatus(ENDP6, EP_TX_NAK);
    - h' i6 A  d2 C3 F( R# `
  68.   SetEPRxAddr(ENDP6, ENDP6_RXADDR);' h; J7 Z' Q$ N
  69.   SetEPRxCount(ENDP6, VIRTUAL_COM_PORT_DATA_SIZE);
    3 p8 Y8 c, T5 ]) l
  70.   SetEPRxStatus(ENDP6, EP_RX_VALID);; ?% {  F/ E0 i6 G  c0 u8 \: ^

  71. 7 R) A2 W* d2 K$ k, ^
  72.   /* Set this device to response on default address */
    3 J8 X3 R+ n* M' q- r1 A
  73.   SetDeviceAddress(0);& K  v3 G+ x6 X& i  X7 m
  74. # m) i. ~3 v6 p* n1 @
  75.   bDeviceState = ATTACHED;
    5 E2 q& \$ L$ `% h( g$ v9 p* D! f
  76. }
复制代码
, V3 W+ _+ c' P. E9 [$ f3 n
And the last of this section, INF file for windows. Now that our device should appear on Windows. :-)
STM32-CDC-Composite.inf
  1. ;
    ) ^& m5 Q* D: H' j' Y6 c
  2. ; STM32-CDC-Composite.inf  Communication Device Class driver installation file8 I5 i) g3 i/ x: D2 r; P5 C
  3. ;0 ?+ J1 T' b! h
  4. . P' I4 Y# u+ K. N/ r
  5. [Version]
    / o% \% w" E+ b4 v& @. Y  B7 C' r
  6. Signature="$Windows NT$"$ `5 U1 l' H& j6 \* w1 ~
  7. Class=Ports
    0 m0 p) _. f4 R+ {  H) i8 _
  8. ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}& D( y& ]) Z4 G5 m5 f1 ?" X1 `, s
  9. Provider=%MICHELE%& B, i8 S# N8 d; \4 W
  10. ;;; LayoutFile=layout.inf ;; not supported in Vista and later
    & l9 K* s, c0 u0 G7 m
  11. DriverVer =04/14/2008, 5.1.2600.5512
    & o/ w' i% c$ Q) s! |# E
  12. ; CatalogFile=STM32-CDC-Composite.cat
    . @& v+ W0 F2 i( Q9 w: P; F8 U* g
  13. 2 _; @) u& J, f) c. r1 P
  14. [Manufacturer]
    % R1 J( j$ V5 U0 P+ U& J, V
  15. %MICHELE%=DeviceList,ntamd64. s9 N5 g3 x# ^  d* i
  16. ( c3 Y  S0 X' }& P  G
  17. ;------------------------------------------------------------------------------
    1 L! X. u  a7 G. B. {' R; U* g
  18. ;  Device list* ]8 U8 W* a5 l
  19. ;------------------------------------------------------------------------------
    ( u! h, q/ C  s$ c& {! h& F
  20. 5 w. z/ L! e1 w9 j
  21. [DeviceList]
    2 |- m, u) }) P4 k2 |" E& q
  22. %DESCRIPTION1% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_00
    & e8 n  Y! S& B# ^
  23. %DESCRIPTION2% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_02. n" {; v+ B& j7 K7 E7 g
  24. %DESCRIPTION3% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_04; v+ S6 q; e  {& O' x  f* I5 v8 g
  25. ; h* h: i7 T9 v. C
  26. [DeviceList.ntamd64]4 \; P  N( s7 N9 |" ^
  27. %DESCRIPTION1% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_00
    % r) m- m8 c1 r4 c
  28. %DESCRIPTION2% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_02
    1 p! _7 k$ D! T$ N- ~- |# R7 F) q
  29. %DESCRIPTION3% = STM32CDCCMP, USB¥VID_FF02&PID_0001&MI_04
    $ k' w4 P% D- n9 D9 w% F' k1 m
  30. 5 F$ o) [6 C# n! s/ ]
  31. ;------------------------------------------------------------------------------
    ) o* W2 t. M4 H
  32. ;  Installation& q( U" e% W0 f( Y1 G
  33. ;------------------------------------------------------------------------------
    6 q; Q7 m. Y, t- M+ T
  34. 9 J# j* l/ L( i/ z. f3 T: N6 S9 B6 W
  35. [SourceDisksNames]+ h2 `1 {2 e8 U
  36. ;;; this blank section satisfies chkinf, G$ b" f" Q  ?& u0 e' K
  37. [SourceDisksFiles]
    2 [! g& {( s6 |; u. g
  38. ;;; this blank section satisfies chkinf/ w3 X' e. h% \' q% f6 D4 A
  39. ) @, A$ h+ |0 E% s; i
  40. [DestinationDirs]
    0 A( S% n+ k+ _' U+ p
  41. FakeModemCopyFileSection=12
    0 B, W* x6 K3 _% S& t9 H. ~
  42. DefaultDestDir = 12
    + k3 W7 u5 z! R

  43. , z, M! g) t0 ~# _( ^
  44. [STM32CDCCMP]4 s5 h2 I* s; E2 i0 X' O5 D# t
  45. include=mdmcpq.inf
    9 g1 M% B" Q4 C- s% N1 L
  46. CopyFiles=FakeModemCopyFileSection( k' b" _% d2 D! L, j0 r, `
  47. AddReg= STM32CDCCMP.AddReg
    ' z, B1 r, P* ?8 T. W/ K+ R! ?
  48. 5 P& {1 A; A, M8 d$ B1 y
  49. [STM32CDCCMP.AddReg]
    ) U3 y8 [, K1 h; o" Q
  50. HKR,,DevLoader,,*ntkern
    1 Z8 N- g4 d, g  f
  51. HKR,,NTMPDriver,,usbser.sys5 E) I) Z- v, ?+ G
  52. HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"+ |# E$ f& W3 ~8 v

  53. ) {( x5 ?- `) Q9 `2 d: s, g9 M# `4 B
  54. [STM32CDCCMP.Services]
    8 q1 Y0 S% b0 S' [. l! b1 n
  55. AddService=usbser, 0x00000002, DriverService) _$ X. ?. ]0 W6 c  W8 J4 N9 c
  56. 6 @9 o; Z9 T( {. J& J
  57. [DriverService]
    ( f3 O$ z* I% v& u# L( m' L6 r
  58. DisplayName=%DRIVER.SVC%
    ) ^5 u6 ~$ Z1 N* a. |
  59. ServiceType=1
    * w; a( Y$ o2 s# A6 `9 Q
  60. StartType=3  P, G& m  R2 E' b: L, z
  61. ErrorControl=1
    % L, l" v6 I3 ~. @4 D& O0 G; r/ T; N+ x
  62. ServiceBinary=%12%¥usbser.sys
    " C  x2 M; ?/ ]4 Z: w: g6 D
  63. 1 Q- i4 x' e" J7 V, F; l
  64. ;------------------------------------------------------------------------------
    5 G$ N1 ]# b( t# F: s7 z
  65. ;  String Definitions
    % J' R5 I* ^' o$ ~
  66. ;------------------------------------------------------------------------------
    8 y( d- y% B6 l+ q

  67. 9 Q/ |8 D9 f0 r! t
  68. [Strings]
    2 r2 Y6 t: W) y$ Y$ t- \$ o
  69. MICHELE     = "Michele"
    , F# V8 p2 h' L9 Q6 O* Q  o/ ^; m
  70. DRIVER.SVC  = "STM32 CDC Composite Driver"
    - `$ I" @( u+ A; P
  71. DESCRIPTION1= "STM32 CDC Composite Port 1"
    . c4 h  v+ s4 A: T  X) ?
  72. DESCRIPTION2= "STM32 CDC Composite Port 2"' j5 T3 s$ R( c$ E, X* F
  73. DESCRIPTION3= "STM32 CDC Composite Port 3"
复制代码

3 A& k4 R; w$ j2 L  n. m
I have a test today.Set the Virtual_Com_Port_ConfigDescriptor EP like:

3 ?& L$ i/ z$ y  IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM0, USB_CDC_DIF_NUM0, USB_ENDPOINT_IN(2), USB_ENDPOINT_OUT(1), USB_ENDPOINT_IN(1) ),8 z6 F# b( B+ @9 m+ p7 \2 }/ b
  IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM1, USB_CDC_DIF_NUM1, USB_ENDPOINT_IN(2), USB_ENDPOINT_OUT(3), USB_ENDPOINT_IN(3) ),
  IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM2, USB_CDC_DIF_NUM2, USB_ENDPOINT_IN(2), USB_ENDPOINT_OUT(4), USB_ENDPOINT_IN(4) ),
0 a8 J; U: T4 P- u. q  IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM3, USB_CDC_DIF_NUM3, USB_ENDPOINT_IN(2), USB_ENDPOINT_OUT(5), USB_ENDPOINT_IN(5) ),
& o8 B5 P* H7 K/ j) @: O4 l  IAD_CDC_IF_DESC_SET( USB_CDC_CIF_NUM4, USB_CDC_DIF_NUM4, USB_ENDPOINT_IN(2), USB_ENDPOINT_OUT(6), USB_ENDPOINT_IN(6) ),
9 W" B0 N' a5 m3 E0 ]6 y( _7 D! @8 n" v  J5 W* |8 C
Then the PC can detector the virtual coms like:
) _/ l+ i: W6 ~$ ~! P7 L) |8 h
080101068625039.jpg

5 n. ?: x; C: W
Transfer data as the style of demo.
I tested the first two coms,they worked ok.
I will test the others,and change the transfer style to improve the transfer speed.
As all coms will work at the same time.
The way upon is not conform the CDC rules,but can be used by some special application.
Maybe the test way is not entire. What is your comment, or  some good methods?
Yangfeng
! p* b+ \+ Q! v
STM32F103 Dual CDC
080059466594342.png
5 ?& w# O  W- @3 Y3 ?0 J* K
STM32F105实现的USB转双串口
4 c/ W4 I2 z/ ZUSB转双串口,核心技术就在于组合设备(USB Composite)的实现,组合设备的实现,其核心技术在于描述符的实现,下面我们先给出描述符:(出处: 嵌入式以太网社区)
  1. __ALIGN_BEGIN uint8_t USBD_DeviceDesc[USB_SIZ_DEVICE_DESC] __ALIGN_END =* u& f+ l5 D) V7 u6 O
  2.   {
    / o4 Q/ @3 W4 U- ?9 a
  3.     0x12,                       /*bLength */, u' U3 l1 U7 z' S( B$ g) W
  4.     USB_DEVICE_DESCRIPTOR_TYPE, /*bDescriptorType*/1 O( v- q% `0 }" `
  5.     0x00,                       /*bcdUSB */
    3 ?+ s8 e- j1 N" s/ p# s
  6.     0x02,/ x5 c, K- m: ~! D% X8 d
  7. #ifdef DUAL_COM+ }! U! J" p3 }/ C# q- {
  8.     0xEF,                       /*bDeviceClass*/
    . L! {9 j# D, K% S1 W9 d( k
  9.     0x02,                       /*bDeviceSubClass*/
    . D. {, l- b' h: T$ r
  10.     0x01,                       /*bDeviceProtocol*/
    & r& @5 k  O( `+ O! t
  11. #else
      g* V! s) }8 W* u! a+ |
  12.     0x00,                       /*bDeviceClass*/
    7 R, e- r: `6 M: l+ H$ D
  13.     0x00,                       /*bDeviceSubClass*/
    1 y. h( b2 V9 o2 L! A
  14.     0x00,                       /*bDeviceProtocol*/       ( N2 |! d5 \( c
  15. #endif
    3 @' O3 L' \  R* q9 `' s. Q6 \
  16.     USB_OTG_MAX_EP0_SIZE,      /*bMaxPacketSize*/- Y+ v" G' d) ^/ w7 l/ w+ F/ [" n
  17.     LOBYTE(USBD_VID),           /*idVendor*/
    9 o; X' p9 \. J# R# y. L
  18.     HIBYTE(USBD_VID),           /*idVendor*/
    ! T2 ~9 D, S. N6 g9 F
  19.     LOBYTE(USBD_PID),           /*idVendor*/
    % Q7 V5 y" @1 a; F- V
  20.     HIBYTE(USBD_PID),           /*idVendor*/
    9 [( B! ~  m  `" L: r: r" c* m$ \4 R) B3 m
  21.     0x00,                       /*bcdDevice rel. 2.00*/
    / Y. g# i3 ~$ x% T
  22.     0x02,
    ! f/ Y8 H& b4 @  B
  23.     USBD_IDX_MFC_STR,           /*Index of manufacturer  string*/
    5 {5 R& W' c! r1 Z+ o6 e$ R
  24.     USBD_IDX_PRODUCT_STR,       /*Index of product string*/8 _, J; n) C9 r* O
  25.     USBD_IDX_SERIAL_STR,        /*Index of serial number string*/9 Y. R) [7 h  J- L
  26.     USBD_CFG_MAX_NUM            /*bNumConfigurations*/
    : k3 i8 C) _( t) g& q; M1 I5 d  `6 d
  27.   } ; /* USB_DeviceDescriptor */
复制代码
5 I& D1 x$ e! W9 i. y- R! e
注意:双串口需要全局定义DUAL_COM宏 配置描述符是重中之重
  1. __ALIGN_BEGIN uint8_t usbd_cdc_CfgDesc[USB_CDC_CONFIG_DESC_SIZ]  __ALIGN_END =7 e2 A3 a' K7 W- R3 G1 E. s3 U
  2. {2 K3 O4 v, S9 B
  3.   /*Configuration Descriptor*/3 x5 d. B& K$ ?* F0 R" l
  4.   0x09,   /* bLength: Configuration Descriptor size */* p: k* r/ S* _1 K# W4 c
  5.   USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */+ h2 U. z  j2 K4 t# d% e# E
  6.   USB_CDC_CONFIG_DESC_SIZ,                /* wTotalLength:no of returned bytes */
    # p; d5 \0 j2 a( }
  7.   0x00,
    . \9 n4 c' ~. r- I) s, F
  8. #ifdef DUAL_COM
    , D- t# O9 L6 ^1 s. ^0 Z8 N, }5 w
  9.   0x04,   /* bNumInterfaces: 4 interface */$ O5 o% r& R8 V$ h6 a8 A7 p
  10. #else: G6 R! |- d  s% D* c: X
  11.   0x02,   /* bNumInterfaces: 2 interface */: A9 E, E) r4 H& C+ `
  12. #endif
    ) P8 u7 g, I+ G4 U
  13.   0x01,   /* bConfigurationValue: Configuration value */8 {0 m. Q) q/ X5 g3 |
  14.   0x00,   /* iConfiguration: Index of string descriptor describing the configuration */
    ) z; b: Y9 B6 D; F
  15.   0x60,   /* bmAttributes: self powered */, n9 T  h) g  e5 H- l
  16.   0xFA,   /* MaxPower 0 mA */0 v8 {7 h; q- ^1 O# g& d" H
  17.    
    : P* n# ]: f5 l5 N( l6 F/ A
  18.   /*---------------------------------------------------------------------------*/5 F# }: n0 ^$ C: [
  19. #ifdef DUAL_COM3 `% C/ Q# i" {7 }$ h6 k
  20.         // IAD2 G3 U8 }7 V; W! U  ]) I8 I
  21.         0x08,        // bLength: Interface Descriptor size3 E; b( ^" G! e
  22.         0x0B,        // bDescriptorType: IAD! ^1 q- S$ v' u6 J/ A* [5 G
  23.         0x00,        // bFirstInterface5 m+ e4 m/ R: n- d2 l5 S/ N
  24.         0x02,        // bInterfaceCount. j* }; Q: u# f
  25.         0x02,        // bFunctionClass: CDC
    5 B' G9 ~3 H! L
  26.         0x02,        // bFunctionSubClass
    4 f+ J7 r$ ]1 I& }3 u0 R8 [
  27.         0x01,        // bFunctionProtocol
    9 ~" |5 T$ V; F/ X2 J2 Z* o
  28.         0x02,        // iFunction
    & m& K8 V% c6 d% a7 `4 O% ~# y# f# G
  29. #endif
    1 n# s7 S# T5 E% {; G$ J0 o3 w& x
  30.   /*Interface Descriptor */2 F. ?( L2 N+ b6 R" }
  31.   0x09,   /* bLength: Interface Descriptor size */
    7 d6 F9 O6 K1 T: G/ e0 h
  32.   USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */+ K% U3 S( \  _! G8 t' C
  33.   /* Interface descriptor type */- z" h! ?6 O) ^9 q" E
  34.   0x00,   /* bInterfaceNumber: Number of Interface */: v% E, U" o" s& P* ~+ r
  35.   0x00,   /* bAlternateSetting: Alternate setting */# u* y% H! ?+ }0 L6 J! G: J
  36.   0x01,   /* bNumEndpoints: One endpoints used */4 u0 I$ K0 u! ^4 g$ |3 a
  37.   0x02,   /* bInterfaceClass: Communication Interface Class */' W/ Z+ e3 N/ A, j8 t; Z
  38.   0x02,   /* bInterfaceSubClass: Abstract Control Model */5 n- ]+ V# a# V7 ]; n
  39.   0x01,   /* bInterfaceProtocol: Common AT commands */+ J1 @6 R$ n" ]4 P# `
  40.   0x00,   /* iInterface: */
    * H5 T+ E3 V, _1 `
  41.    
    , A( J* l, k' R8 X
  42.   /*Header Functional Descriptor*/
    , q! W" i. W4 I6 l" r1 \
  43.   0x05,   /* bLength: Endpoint Descriptor size */) t5 j6 F3 X/ W
  44.   0x24,   /* bDescriptorType: CS_INTERFACE */8 {6 d2 w9 q: h( i4 d: c
  45.   0x00,   /* bDescriptorSubtype: Header Func Desc */) l# L8 a- c" |
  46.   0x10,   /* bcdCDC: spec release number */
    2 T; W& f) K6 @5 K6 w0 \; W: ]! U) p
  47.   0x01,% ?! m9 M$ I  N
  48.      `8 d2 ~$ A  p+ g( j
  49.   /*Call Management Functional Descriptor*/6 N! d# }5 [. I) S7 {: T2 i- m
  50.   0x05,   /* bFunctionLength */# S2 [' ?- x' _; f1 C
  51.   0x24,   /* bDescriptorType: CS_INTERFACE */
    % r' e$ F" b& H' L* b5 L
  52.   0x01,   /* bDescriptorSubtype: Call Management Func Desc */" Y6 o; w! \# b0 J
  53.   0x00,   /* bmCapabilities: D0+D1 */
    7 |" p/ k0 m! y) Z
  54.   0x01,   /* bDataInterface: 1 */$ Q2 H: }+ e! d) W4 D; U
  55.    
    % t& ~1 _4 U3 w' d9 P( n
  56.   /*ACM Functional Descriptor*/
    4 G; u% I% w2 P& F6 f
  57.   0x04,   /* bFunctionLength */
    , {# `- b0 r+ [$ o+ S! w  o, H9 ]
  58.   0x24,   /* bDescriptorType: CS_INTERFACE */
    5 w# J) C( ^/ Q. F: l4 ?; t
  59.   0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
    + n8 i% g+ X8 b2 A
  60.   0x02,   /* bmCapabilities */
      j3 R9 r/ O  A6 \( a- L5 x4 h7 }
  61.    
    # d* I& g9 E  B  g3 v
  62.   /*Union Functional Descriptor*/
    $ b5 i7 J; T7 y. p# w6 }3 @9 a
  63.   0x05,   /* bFunctionLength */( V* m6 a3 Y/ o  z3 N% T1 e  q
  64.   0x24,   /* bDescriptorType: CS_INTERFACE */
    # G& u( m% [, y  J- }8 c3 D5 S
  65.   0x06,   /* bDescriptorSubtype: Union func desc */# `, b+ x9 M* ~+ b0 {
  66.   0x00,   /* bMasterInterface: Communication class interface */
    4 I! p- i8 u' E( h5 \
  67.   0x01,   /* bSlaveInterface0: Data Class Interface */
    ; ~5 k. Y- J+ s) B( D
  68.    
    , G0 r5 L+ r+ O7 o; _7 e
  69.   /*Endpoint 2 Descriptor*/0 K2 t* _) E; T9 L7 c- u
  70.   0x07,                           /* bLength: Endpoint Descriptor size */: A5 T8 a% _* b
  71.   USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */) ]% u3 l! O9 V4 x
  72.   CDC_CMD_EP,                     /* bEndpointAddress */7 W8 j' Z( S. X! M
  73.   0x03,                           /* bmAttributes: Interrupt */$ h$ Z' U$ s1 i
  74.   LOBYTE(CDC_CMD_PACKET_SZE),     /* wMaxPacketSize: */: _& j  F7 V. P, i; D5 z" W3 W" x
  75.   HIBYTE(CDC_CMD_PACKET_SZE),9 B  d/ d7 S! [& d" D% |
  76.   0xFF,                           /* bInterval: */
    ; F  r1 y& B! C- }! c* N
  77.    ( P4 Y" C$ W9 j- t/ T
  78.   /*---------------------------------------------------------------------------*/6 Z3 O" d" S/ C: L& _
  79.    
    3 p; {9 N4 ?; J; E  h4 p' I5 J, |
  80.   /*Data class interface descriptor*/
    , J" [* c: d1 I2 \/ P
  81.   0x09,   /* bLength: Endpoint Descriptor size */
    : a9 K8 N7 ]5 b( `) c% t/ E
  82.   USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */" n. x6 n, s7 E. B
  83.   0x01,   /* bInterfaceNumber: Number of Interface */
    % e" o: F' @5 b
  84.   0x00,   /* bAlternateSetting: Alternate setting */
    % j5 s* Y) e+ a0 D/ U9 B
  85.   0x02,   /* bNumEndpoints: Two endpoints used */5 n% y5 z: B; [+ }- Y
  86.   0x0A,   /* bInterfaceClass: CDC */( u# d' r) G% V  l7 K+ J
  87.   0x00,   /* bInterfaceSubClass: */8 n0 W# }0 V' w, H' G5 K
  88.   0x00,   /* bInterfaceProtocol: */
    $ r- m- f/ z7 e3 w  d+ z0 r
  89.   0x00,   /* iInterface: */
    7 }4 X! c8 I$ C/ f0 q8 U
  90.    7 B+ c& P) h4 E' t& q: D
  91.   /*Endpoint OUT Descriptor*// `7 y* M( b6 [! X2 g
  92.   0x07,   /* bLength: Endpoint Descriptor size */
    + B2 T# A8 I# F
  93.   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
    4 i, D% g$ f% Y% u2 _4 \6 r9 |
  94.   CDC_OUT_EP,                        /* bEndpointAddress */
    / M5 W- M5 O" T. v2 E
  95.   0x02,                              /* bmAttributes: Bulk */# d! R# v: h5 I( d: F. G! r
  96.   LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */" W/ u0 r* ?, J  m3 x/ C% z+ a; A
  97.   HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
    8 g8 i( d( B" p  Y7 j  Z
  98.   0x00,                              /* bInterval: ignore for Bulk transfer */
    . H$ V" [% H1 N: @. C
  99.    
    & V# Z9 D( m1 y3 E: b% h
  100.   /*Endpoint IN Descriptor*/
    + m3 N7 I# v  U2 k$ g! ?
  101.   0x07,   /* bLength: Endpoint Descriptor size */
    0 T" ^6 `( M1 Y  o6 t( S: B" ?1 j3 r0 Y% l
  102.   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */: ?5 x- K. Z- p. I) a
  103.   CDC_IN_EP,                         /* bEndpointAddress */- T) G; {5 d& e* _+ j. G3 M# A. p
  104.   0x02,                              /* bmAttributes: Bulk */+ ^: ]6 a' Z- y0 R  J( M
  105.   LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */2 i+ A0 c) z5 W
  106.   HIBYTE(CDC_DATA_MAX_PACKET_SIZE),4 h# g, f/ R3 T6 \7 z" ~
  107.   0x00,                              /* bInterval: ignore for Bulk transfer */
    5 s% x# G3 a" \! j1 V$ N4 [
  108.          
    # s9 N3 O( I( @) s6 P0 \
  109. #ifdef DUAL_COM
    , X$ Y+ y9 r/ i2 p
  110.         // IAD
    1 s1 P( ~6 e1 s0 r% U6 ]8 {
  111.         0x08,        // bLength: Interface Descriptor size" ]; N& _0 u. t6 A: z
  112.         0x0B,        // bDescriptorType: IAD7 }, w: ]; b  F5 J$ V+ I+ \/ W
  113.         0x02,        // bFirstInterface
    / W* U% V' U7 s/ I3 {; s" ^9 Q
  114.         0x02,        // bInterfaceCount) c% C! E7 r  {! O, I* g+ ]# q7 `
  115.         0x02,        // bFunctionClass: CDC6 b6 q& {3 |; T% u7 y1 \0 n
  116.         0x02,        // bFunctionSubClass6 J" q* O. x. p. B
  117.         0x01,        // bFunctionProtocol
    1 n+ \4 E3 k/ i0 Z* J  T
  118.         0x02,        // iFunction
    1 c4 Y! B1 w, M% t* b  }
  119.   /*Interface Descriptor */
    1 x1 ^- z! x" S! `( e$ s
  120.   0x09,   /* bLength: Interface Descriptor size */& K5 }( ^; F* ], ^+ h6 t$ O
  121.   USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */9 Q, b0 b5 N7 Z1 g
  122.   /* Interface descriptor type */" R( r" p+ J+ b8 O
  123.   0x02,   /* bInterfaceNumber: Number of Interface */
    3 l  M- q" O6 U" ~; \/ W' u$ {- t! J
  124.   0x00,   /* bAlternateSetting: Alternate setting */
    8 }3 A+ G# }6 K$ u) Y6 j7 \  T
  125.   0x01,   /* bNumEndpoints: One endpoints used */
    - i+ b- g5 ]9 E
  126.   0x02,   /* bInterfaceClass: Communication Interface Class */, T6 N9 \2 {8 U
  127.   0x02,   /* bInterfaceSubClass: Abstract Control Model */
    $ H1 ]" j6 C. p0 V  A# C
  128.   0x01,   /* bInterfaceProtocol: Common AT commands */# ^6 {& Y2 t; p1 E8 {
  129.   0x00,   /* iInterface: */
    / c* ^+ z5 ?5 f3 j2 d
  130.    ! {- y9 V  h- z7 o% f. f; m
  131.   /*Header Functional Descriptor*/
    3 u6 ^; R' J+ ^; ]' a4 d
  132.   0x05,   /* bLength: Endpoint Descriptor size */3 a& R/ z% N. {2 }9 x
  133.   0x24,   /* bDescriptorType: CS_INTERFACE */. U+ L+ q0 H4 w1 M" |8 Y
  134.   0x00,   /* bDescriptorSubtype: Header Func Desc */- o- u& C6 l1 d1 `
  135.   0x10,   /* bcdCDC: spec release number */: N  T! A) |- E2 Y) }0 l9 `8 a
  136.   0x01,! i( ^7 ]8 a4 G) ^+ J: ?: p9 x* U; L
  137.    5 q) Y  E  a4 n4 u
  138.   /*Call Management Functional Descriptor*/
    9 `% B, x4 f, j% z1 ~
  139.   0x05,   /* bFunctionLength */+ k4 P: }* @0 V) _2 O
  140.   0x24,   /* bDescriptorType: CS_INTERFACE */3 ?% D- `) c! I& M
  141.   0x01,   /* bDescriptorSubtype: Call Management Func Desc */0 g: ^, P: F5 m. |$ ^+ t8 k
  142.   0x00,   /* bmCapabilities: D0+D1 */
    ; b$ A; L: ~: d. M" Y
  143.   0x01,   /* bDataInterface: 1 */
      o% r4 g; S6 `) n% |
  144.    5 Y8 A) A6 D  A) N$ v
  145.   /*ACM Functional Descriptor*/. Q# m! v2 `! _' X
  146.   0x04,   /* bFunctionLength */
    5 ^$ @& t  n! @3 l
  147.   0x24,   /* bDescriptorType: CS_INTERFACE */
    2 \( h& V5 Y1 h4 t5 {4 b+ J
  148.   0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
    : q9 T. S- {5 v* w+ j+ k/ |
  149.   0x02,   /* bmCapabilities */4 r: O" k' |( Q. z4 {
  150.    1 e7 ]+ S/ Y, E& L) }' i
  151.   /*Union Functional Descriptor*/
      |; j2 l! ~3 [+ {) N, K
  152.   0x05,   /* bFunctionLength */
    " F+ [, D; g& }" y( H
  153.   0x24,   /* bDescriptorType: CS_INTERFACE */
    8 M8 ^. t$ v) Q& H0 d0 g
  154.   0x06,   /* bDescriptorSubtype: Union func desc */4 B* K! p' g6 ~
  155.   0x00,   /* bMasterInterface: Communication class interface */, |6 X5 N" d4 K; Q# d
  156.   0x01,   /* bSlaveInterface0: Data Class Interface */0 x, e, n. j: G; a. H
  157.    
    5 l+ c5 e7 w, x' x5 \' G
  158.   /*Endpoint 2 Descriptor*/
    ; T& n) E5 f0 \$ |7 m
  159.   0x07,                           /* bLength: Endpoint Descriptor size *// N9 {: {( Z: N2 P
  160.   USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    * p& n: \7 J- {' H/ k1 L% U! z2 x
  161.   CDC_CMD_EP,                  /* bEndpointAddress */
    7 K" b$ ^( T) Z: V$ q) ]% z
  162.   0x03,                           /* bmAttributes: Interrupt */
    : Z- r" M! X0 n1 a
  163.   LOBYTE(CDC_CMD_PACKET_SZE),     /* wMaxPacketSize: */; m3 k! F1 B% W# G3 E* g
  164.   HIBYTE(CDC_CMD_PACKET_SZE),+ }2 h, [, w% [$ {, D/ g9 F7 {1 U
  165.   0xFF,                           /* bInterval: */; Y2 B( C6 G2 l- ?5 _
  166.    
    / j( S) s3 h7 c3 N! K3 p- K/ J/ S
  167.   /*---------------------------------------------------------------------------*/% c0 y* O4 \* }3 K: Z
  168.    ' e; }" t' h0 |9 n& R0 y) l3 I
  169.   /*Data class interface descriptor*/5 G% U5 P7 T6 |' T7 n
  170.   0x09,   /* bLength: Endpoint Descriptor size */
    * G* x6 C+ {: E; e8 P& ?
  171.   USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
    9 Q) c5 i& T0 s' ]
  172.   0x03,   /* bInterfaceNumber: Number of Interface */) N! c1 Z* z7 ?+ {4 H$ f# J& y- `
  173.   0x00,   /* bAlternateSetting: Alternate setting */
    " S+ b$ ~# }% m6 r" n
  174.   0x02,   /* bNumEndpoints: Two endpoints used */9 ?9 ~9 E3 j7 z% z, I
  175.   0x0A,   /* bInterfaceClass: CDC */
    ) t6 j( a& i  X& |" ^) C6 i+ ^5 f
  176.   0x00,   /* bInterfaceSubClass: */
    7 j( ?: T/ h/ k, @" t6 Z' q/ y
  177.   0x00,   /* bInterfaceProtocol: */
      ^0 F' g- U- W4 ]0 _2 X) ]
  178.   0x00,   /* iInterface: */" N& {- Z0 M* J& z* s: I
  179.    
    + |- p6 S4 Z1 q
  180.   /*Endpoint OUT Descriptor*/5 w: K- \" l# f' M
  181.   0x07,   /* bLength: Endpoint Descriptor size */6 [- R) I3 A5 y: A/ d# A4 \) v
  182.   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
    3 v, p6 _0 @7 o8 a& G4 y4 n
  183.   CDC_OUT_EP_EX,                     /* bEndpointAddress */
    . D7 X" a; q3 h
  184.   0x02,                              /* bmAttributes: Bulk */, e0 q( X" M7 F/ k2 n' B/ _8 j. j
  185.   LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */
    . a8 x7 \  i. {" j9 W( F
  186.   HIBYTE(CDC_DATA_MAX_PACKET_SIZE),( z- a" `8 z& m4 E
  187.   0x00,                              /* bInterval: ignore for Bulk transfer */3 z( @( {6 v3 ?4 M
  188.    
    , U) l2 {! ?( A' v4 m3 B& G( x
  189.   /*Endpoint IN Descriptor*/
      \: w; d: @$ k* l8 D
  190.   0x07,   /* bLength: Endpoint Descriptor size */
    & z. w& G8 ^7 x7 }6 ~3 S* w
  191.   USB_ENDPOINT_DESCRIPTOR_TYPE,      /* bDescriptorType: Endpoint */
      Y  W4 \3 G( G: X% b
  192.   CDC_IN_EP_EX,                      /* bEndpointAddress */6 o- U& }  u0 J: k* D. V# T+ ?
  193.   0x02,                              /* bmAttributes: Bulk */
    8 y- {% [1 E9 U
  194.   LOBYTE(CDC_DATA_MAX_PACKET_SIZE),  /* wMaxPacketSize: */* o! a; P, o% u& |" u# z: d6 I6 _
  195.   HIBYTE(CDC_DATA_MAX_PACKET_SIZE),
    4 B5 s+ c7 H, H9 t1 k7 Y) d4 y; b
  196.   0x00                               /* bInterval: ignore for Bulk transfer */
      N# T% m, k( Q+ u+ n8 ^1 d! b* d0 d7 ]
  197. #endif7 Q+ [% t6 S1 G! i1 A
  198. } ;
复制代码
, z4 ?  T/ v, K
080116040026558.jpg
  1. 1 /******************** (C) COPYRIGHT 2010 STMicroelectronics ********************
    - E; ^& I8 V6 m
  2.   2 * File Name          : usb_desc.c
    " f9 G0 N/ G1 ?7 x6 C2 ^- a7 H! q
  3.   3 * Author             : MCD Application Team! Y; v7 o5 |% A2 J. \9 X1 s1 I( z& m
  4.   4 * Version            : V3.1.1& ?; Q; O! G' J# o( i
  5.   5 * Date               : 04/07/2010
      Y8 P9 i5 |) f* s
  6.   6 * Description        : Descriptors for Virtual Com Port Demo, H+ m4 {! C  ^* r2 p
  7.   7 ********************************************************************************
    : J3 V, v# a- G
  8.   8 * THE PRESENT FIRMWARE WHICH IS FOR GUIDANCE ONLY AIMS AT PROVIDING CUSTOMERS, x" s7 N1 E) m1 @- j6 W3 V0 J
  9.   9 * WITH CODING INFORMATION REGARDING THEIR PRODUCTS IN ORDER FOR THEM TO SAVE TIME.
    ) a  W. K2 Q# K+ M0 n2 r
  10. 10 * AS A RESULT, STMICROELECTRONICS SHALL NOT BE HELD LIABLE FOR ANY DIRECT,
    " k& t& L/ |7 L+ n& F2 ]
  11. 11 * INDIRECT OR CONSEQUENTIAL DAMAGES WITH RESPECT TO ANY CLAIMS ARISING FROM THE
    ( K# l5 J8 B9 U/ c3 x5 m. M
  12. 12 * CONTENT OF SUCH FIRMWARE AND/OR THE USE MADE BY CUSTOMERS OF THE CODING: A, N3 [$ I0 f* L: F' t
  13. 13 * INFORMATION CONTAINED HEREIN IN CONNECTION WITH THEIR PRODUCTS.3 l6 z* [6 C7 `% u" I6 O" [1 [
  14. 14 *******************************************************************************/! i5 v8 ?7 Q' }4 i
  15. 15
    # @- T. `6 _& z1 F7 Q* _: w! ~% |
  16. 16 /* Includes ------------------------------------------------------------------*/$ B" a# ^+ c6 A
  17. 17 #include "usb_lib.h"& [; S8 @* O# H! c' Z$ D+ X
  18. 18 #include "usb_desc.h"  }: N# H. y4 t* o: A5 |4 ~! h
  19. 19 * w; t  a) x' ?5 o% k
  20. 20 /* USB Standard Device Descriptor */2 A- l% ]! o$ f$ Y6 l0 n
  21. 21 const uint8_t Virtual_Com_Port_DeviceDescriptor[] =
    - `' W" F2 R; a" Q3 k% g
  22. 22   {
    4 d: Y/ v2 o, ~
  23. 23     0x12,   /* bLength */
    2 q  E+ M! ]: |1 }
  24. 24     USB_DEVICE_DESCRIPTOR_TYPE,     /* bDescriptorType */" E( B$ H, A* G- c4 G/ ~2 h
  25. 25     0x00,
    ' }+ O% x: A& c% x+ \, O
  26. 26     0x02,   /* bcdUSB = 2.00 */
    1 e0 b* b* {2 X9 Z7 y0 J" N3 ~
  27. 27             /* Multi-Interface Function Class Code : 0xEF 0x02 0x01 */   : K4 Z+ ^: U- d- ?6 @
  28. 28     0xEF,   /* bDeviceClass    : Miscellaneous Device Class : CDC */; b. L1 v+ i6 @6 D2 T/ R& A
  29. 29     0x02,   /* bDeviceSubClass : Common Class */
    ! [( o1 n: }+ G3 E" Z& w- _# y
  30. 30     0x01,   /* bDeviceProtocol : IAD : Interface Association Descriptor */- _3 w1 W$ o7 s  a
  31. 31 1 a+ S0 O3 c2 _- A& `
  32. 32     0x40,   /* bMaxPacketSize0 */
    , J1 F, v( M" i" H; V- r
  33. 33     0xEB,' E, d$ i& \8 t
  34. 34     0x03,   /* idVendor = 0x03EB */
    6 b7 Z+ C# f& ]2 g" l4 ]) N8 H9 g8 x
  35. 35     0x33,
    6 r/ o# E7 Q/ Y# w! j/ D$ d
  36. 36     0x61,   /* idProduct = 0x6133 */
    # d" ?; ?/ A, j, b1 X5 x
  37. 37     
    / C* h$ A2 N8 M
  38. 38     0x00,4 ^- E; @/ a+ \3 V' P3 S* E
  39. 39     0x02,   /* bcdDevice = 2.00 */
    ' Y4 q) N' O9 `6 X' M$ _
  40. 40     1,      /* Index of string descriptor describing manufacturer */
    9 U! t8 u: L& V
  41. 41     2,      /* Index of string descriptor describing product */
    1 s) V1 I- J& ?
  42. 42     3,      /* Index of string descriptor describing the device's serial number */: T7 \, v) y3 d; g' @4 ~( b% u
  43. 43     0x01    /* bNumConfigurations */
    0 n+ v2 H/ V! N1 ]0 \
  44. 44   };
    . E4 ~: N' h# H/ `% a
  45. 45
    - N: C- X1 r" ~! b$ I, `
  46. 46 const uint8_t Virtual_Com_Port_ConfigDescriptor[] =
    ! d$ G+ |& A1 c5 g+ o% D
  47. 47   {
    . J1 [7 g  ^) G- b$ S0 l
  48. 48     /*Configuation Descriptor*/
    4 `: j& Z+ w$ l) Q- M( G
  49. 49     0x09,   /* bLength: Configuation Descriptor size */4 Y% v0 ?1 b( I3 `) T! z* y' G
  50. 50     USB_CONFIGURATION_DESCRIPTOR_TYPE,      /* bDescriptorType: Configuration */. P" L- }& S- [2 [, ^
  51. 51     VIRTUAL_COM_PORT_SIZ_CONFIG_DESC,       /* wTotalLength:no of returned bytes */1 S5 t2 g' K- {" Q6 e7 W
  52. 52     0x00,5 N5 Z( d! E! `/ |  b' T
  53. 53     0x04,   /* bNumInterfaces: 4 interface */
    6 |( I( n- k# _" I3 F* A
  54. 54     0x01,   /* bConfigurationValue: Configuration value */
    $ s4 n# j% B2 q; k* [; t; p0 M, z7 O, s
  55. 55     0x00,   /* iConfiguration: Index of string descriptor describing the configuration */* K* d0 H7 `. K# n5 W7 }
  56. 56     0xC0,   /* bmAttributes: self powered *// V: F8 s$ j( C0 ^6 [
  57. 57     0x32,   /* MaxPower 100 mA */, y3 J! Y: q0 {
  58. 58 ( K& ~/ G; {" F! r& T
  59. 59     // IAD& X# j- D9 q0 f# A' l0 l9 o- K
  60. 60     0x08,    // bLength: Interface Descriptor size
    6 [6 N; f2 M0 Q' ~' ~2 Q0 p
  61. 61     0x0B,        // bDescriptorType: IAD
    - x, ?. r6 y3 P
  62. 62     0x00,    // bFirstInterface
    ( K$ ^% \: M6 M* z. J
  63. 63     0x02,    // bInterfaceCount8 Z) S: p' i% b( L! n& \$ K6 O
  64. 64     0x02,    // bFunctionClass: CDC. D# l4 G6 B; @5 E
  65. 65     0x02,    // bFunctionSubClass
    # O2 G! P2 s# x: H$ g* n
  66. 66     0x01,    // bFunctionProtocol $ J0 u+ j# G; g; l
  67. 67     0x02,    // iFunction
    ' |! u- W( o8 e& m* C. z0 P
  68. 68     . Y  J: h" p$ k
  69. 69     /*Interface Descriptor*/
    / x, X) c3 w& E6 O, o
  70. 70     0x09,   /* bLength: Interface Descriptor size */
    ! ^6 Y& a3 s6 X* `0 Z: x  p1 N
  71. 71     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
    $ n% p4 }& K1 p8 a  B. Z
  72. 72     /* Interface descriptor type */
    % F) L( ?% u1 W$ W. C# Y/ `9 C, e; _
  73. 73     0x00,   /* bInterfaceNumber: Number of Interface */, q& k) v8 j" \2 x* m1 b
  74. 74     0x00,   /* bAlternateSetting: Alternate setting */
      c8 o: X9 N3 E/ g. _  u
  75. 75     0x01,   /* bNumEndpoints: One endpoints used */% V& s5 J: z( V, x  W6 }, J
  76. 76     0x02,   /* bInterfaceClass: Communication Interface Class */' q; o  e1 K: r9 \  X2 ]' |
  77. 77     0x02,   /* bInterfaceSubClass: Abstract Control Model */
    4 a+ d0 o4 V* C+ C' a
  78. 78     0x01,   /* bInterfaceProtocol: Common AT commands */4 O; X: {1 ^" u& p9 q7 N# X
  79. 79     0x00,   /* iInterface: */' d$ Y9 Y" F) O# O: \9 U2 Z
  80. 80     /*Header Functional Descriptor*/( L# n" x' W- @+ C
  81. 81     0x05,   /* bLength: Endpoint Descriptor size */
    # U2 U# P6 H- I/ t$ ~, w0 Q
  82. 82     0x24,   /* bDescriptorType: CS_INTERFACE */4 B# b( L9 d& o  d. ~
  83. 83     0x00,   /* bDescriptorSubtype: Header Func Desc */# c' m# l# ~; c& a! P
  84. 84     0x10,   /* bcdCDC: spec release number */, e- l$ H# O6 |- p0 y+ T2 ]+ t
  85. 85     0x01,
    % E5 |- Y7 h! k" |( u% \1 D1 G1 g
  86. 86     /*Call Managment Functional Descriptor*/
    1 t2 @# k5 J1 P( _
  87. 87     0x05,   /* bFunctionLength */( A5 H4 e; ?# y
  88. 88     0x24,   /* bDescriptorType: CS_INTERFACE */
    - T! u( w4 X/ I" ]. E) I/ ^) ]
  89. 89     0x01,   /* bDescriptorSubtype: Call Management Func Desc */- _0 ~! d7 D% H5 K+ J8 ?! b( o
  90. 90     0x00,   /* bmCapabilities: D0+D1 */
    $ L6 u  ]1 j- g' }1 o) D
  91. 91     0x01,   /* bDataInterface: 1 */ 92     /*ACM Functional Descriptor*/
    9 s+ l9 r* ~  e! G
  92. 93     0x04,   /* bFunctionLength */
    2 u# l1 Y. X0 v- B
  93. 94     0x24,   /* bDescriptorType: CS_INTERFACE */
    . K1 [4 y1 ]) h0 G
  94. 95     0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
    , A; f! t7 q% V) h9 C& f
  95. 96     0x02,   /* bmCapabilities */  r- w) |3 r+ x) |6 H$ n6 W; i
  96. 97     /*Union Functional Descriptor*/, K- Y3 r# G3 b. J& j9 E! Y+ U
  97. 98     0x05,   /* bFunctionLength */3 l1 b3 ^9 H' F! d: x7 J" D
  98. 99     0x24,   /* bDescriptorType: CS_INTERFACE */* t$ K) e4 _  G. m! m+ C. I
  99. 100     0x06,   /* bDescriptorSubtype: Union func desc */
    ) H! z/ C, `$ ^& K1 s5 r/ w
  100. 101     0x00,   /* bMasterInterface: Communication class interface */3 V1 e* k4 R! p. ^: c
  101. 102     0x01,   /* bSlaveInterface0: Data Class Interface */103     /*Endpoint 2 Descriptor*/9 F+ P5 p) `  P8 E8 o
  102. 104     0x07,   /* bLength: Endpoint Descriptor size */( |! e+ t+ K& c/ O3 ?
  103. 105     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    5 N( b2 P1 y8 i! w. p$ B
  104. 106     0x82,   /* bEndpointAddress: (IN2) */% X7 l7 R, R3 a
  105. 107     0x03,   /* bmAttributes: Interrupt */; c, J* `  s7 E
  106. 108     VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */& m3 a; O  D8 D
  107. 109     0x00,
    6 \) y, L* b; X1 g0 k7 r- A
  108. 110     0xFF,   /* bInterval: */+ E2 @0 q* M2 H- B% W
  109. 111     /*Data class interface descriptor*/
    / e6 N7 `, S- V: a
  110. 112     0x09,   /* bLength: Endpoint Descriptor size */" q, F; I% ?2 X; n/ A
  111. 113     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
    ; M* C, \0 y8 K" {
  112. 114     0x01,   /* bInterfaceNumber: Number of Interface */! h1 h" e9 F) `/ R, o
  113. 115     0x00,   /* bAlternateSetting: Alternate setting */+ p+ c8 ^  a& D  v; }( s4 N
  114. 116     0x02,   /* bNumEndpoints: Two endpoints used */; n7 J; T/ u! N
  115. 117     0x0A,   /* bInterfaceClass: CDC */
    8 C& C' |7 ]# Q6 {5 d
  116. 118     0x00,   /* bInterfaceSubClass: */
    / s% G9 M8 K5 \: }
  117. 119     0x00,   /* bInterfaceProtocol: */# I  c2 I! u; L( X8 ~
  118. 120     0x00,   /* iInterface: */
    3 S! m6 k7 L/ ^; s6 _5 A
  119. 121     /*Endpoint 3 Descriptor*/' D$ \3 N- H9 q. c3 v! f
  120. 122     0x07,   /* bLength: Endpoint Descriptor size */
    , Q+ Q7 c3 p# o; k
  121. 123     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */# ~! R7 y5 D5 e$ ~' P
  122. 124     0x03,   /* bEndpointAddress: (OUT3) */
    9 U: b; Q8 U4 A( h
  123. 125     0x02,   /* bmAttributes: Bulk */
    ' E: U- O% v2 P: R; ]
  124. 126     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    9 m( {7 \& A* k$ ]+ M! k# D! y$ d+ f% b
  125. 127     0x00,- y4 x/ q" ^  b$ k# T+ j. A
  126. 128     0x00,   /* bInterval: ignore for Bulk transfer */129     /*Endpoint 1 Descriptor*/
    ; o* d7 Z0 P9 o: V, C0 ~/ [8 N
  127. 130     0x07,   /* bLength: Endpoint Descriptor size */
    ; t5 T' Q. u7 `( t, e& r* p8 f
  128. 131     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    + S" \3 D( H2 s8 F5 j! b
  129. 132     0x81,   /* bEndpointAddress: (IN1) */
    " u# X6 w! o; b
  130. 133     0x02,   /* bmAttributes: Bulk */* o8 `  P0 \4 f  K+ l- V
  131. 134     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    $ Q5 a. J+ r' @6 U
  132. 135     0x00,
    & V4 k) X1 ]6 }3 }5 W: v
  133. 136     0x00,    /* bInterval */( u+ w: A+ k+ w% t2 ]
  134. 137
    - J: J4 y. e, _0 Q! A" @
  135. 138     // IAD
    6 p3 X) O) k' M' t) r
  136. 139     0x08,    // bLength: Interface Descriptor size5 ~5 D2 _2 Y$ ?$ e" L
  137. 140     0x0B,        // bDescriptorType: IAD% y7 t" h3 f- w! {. C( P- O1 I
  138. 141     0x02,    // bFirstInterface/ _3 t. O9 j4 [% W
  139. 142     0x02,    // bInterfaceCount- P( o) v, Q! o  C( F  i7 _
  140. 143     0x02,    // bFunctionClass: CDC) O9 O! [" x& l! ?$ g2 W
  141. 144     0x02,    // bFunctionSubClass. a5 y7 W# ^8 x6 p
  142. 145     0x01,    // bFunctionProtocol1460x02,    // iFunction147     /*Interface Descriptor*/3 I) k$ T0 r4 A- U7 C2 V9 y
  143. 148     0x09,   /* bLength: Interface Descriptor size */+ i. g+ W. C: Q2 [+ |
  144. 149     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: Interface */
    1 `. r, S2 \0 s2 {
  145. 150     /* Interface descriptor type */
    3 p: E/ v" P2 i# q. ^
  146. 151     0x02,   /* bInterfaceNumber: Number of Interface */
    % t" S4 |8 s9 i5 H% i
  147. 152     0x00,   /* bAlternateSetting: Alternate setting */
    + N0 m+ \  A2 B4 d
  148. 153     0x01,   /* bNumEndpoints: One endpoints used */
    7 l* _7 y# @/ N8 p
  149. 154     0x02,   /* bInterfaceClass: Communication Interface Class */
    # ]' M# @% E* ?1 F% K/ ]
  150. 155     0x02,   /* bInterfaceSubClass: Abstract Control Model */+ y% _8 p# E8 y- i7 `
  151. 156     0x01,   /* bInterfaceProtocol: Common AT commands */
    ( ^$ X  h' o' q; h
  152. 157     0x00,   /* iInterface: */158     /*Header Functional Descriptor*/
    : f6 |$ m" N# s- X6 B6 D; `  R
  153. 159     0x05,   /* bLength: Endpoint Descriptor size */' U* R9 x* X* C" t7 O( ~" s
  154. 160     0x24,   /* bDescriptorType: CS_INTERFACE */
    , m$ k) p& r5 W6 R
  155. 161     0x00,   /* bDescriptorSubtype: Header Func Desc */
    , v) u$ u  y" s! I+ t
  156. 162     0x10,   /* bcdCDC: spec release number */
    & a# B( z  A8 r" W& r2 G
  157. 163     0x01,
    ( M( X) Q0 r5 ~" ~
  158. 164     /*Call Managment Functional Descriptor*/
    + M2 q$ o. |* o: T* b
  159. 165     0x05,   /* bFunctionLength */
    : @+ h. |& L+ [! I
  160. 166     0x24,   /* bDescriptorType: CS_INTERFACE */
    ! z$ O5 w0 j0 s( T& j1 e: K  c
  161. 167     0x01,   /* bDescriptorSubtype: Call Management Func Desc */* E( J4 y* ]$ V3 v/ d7 R1 e3 v
  162. 168     0x00,   /* bmCapabilities: D0+D1 */
    : K( j2 I6 {7 A, |. g% K
  163. 169     0x03,   /* !! bDataInterface: */170     /*ACM Functional Descriptor*/) j7 |% o1 t( e! T/ u* P
  164. 171     0x04,   /* bFunctionLength */* \5 q( q( s/ J" m
  165. 172     0x24,   /* bDescriptorType: CS_INTERFACE */
    2 \3 I1 P* ]5 h* [, ^  K
  166. 173     0x02,   /* bDescriptorSubtype: Abstract Control Management desc */
    9 }+ X7 G6 N- a; A! H- o
  167. 174     0x02,   /* bmCapabilities */175     /*Union Functional Descriptor*/
    - M- ?0 _3 F- z- t7 V6 C
  168. 176     0x05,   /* bFunctionLength */
    / s9 D* C" ]& f: Z6 p3 e* d+ o3 N
  169. 177     0x24,   /* bDescriptorType: CS_INTERFACE */; C) x% x2 b4 ^% \7 f4 h/ M% y1 `) H
  170. 178     0x06,   /* bDescriptorSubtype: Union func desc */
    / o: G) X8 u  F
  171. 179     0x02,   /* !! bMasterInterface: Communication class interface */
    , t2 B2 l* M/ @/ g3 y8 n
  172. 180     0x03,   /* !! bSlaveInterface0: Data Class Interface */181     /*Endpoint 2 Descriptor*/) I8 E5 W  p' u$ A6 A9 a  Q
  173. 182     0x07,   /* bLength: Endpoint Descriptor size */
    ' x7 w* [9 W. o( ~
  174. 183     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */1 f9 x) y" V! u% O- K0 _( x) L
  175. 184     0x85,   /* bEndpointAddress: (IN2) */
    6 p, s) e, i. [0 c5 y; Q
  176. 185     0x03,   /* bmAttributes: Interrupt */1 Q1 P0 m/ N! u  h
  177. 186     VIRTUAL_COM_PORT_INT_SIZE,      /* wMaxPacketSize: */
    , o+ `0 ~. ~$ X+ q
  178. 187     0x00,
    ( L. V. M1 F; ~
  179. 188     0xFF,   /* bInterval: */
    $ \( S/ A: O1 E# h2 j
  180. 189
    ; |0 Y0 b5 A$ ~* D5 V- c
  181. 190     /*Data class interface descriptor*/- K5 _3 j0 t: P+ d7 {% e0 l# M
  182. 191     0x09,   /* bLength: Endpoint Descriptor size */
    & `" }% C6 D' t! E7 B6 @4 |/ k% e
  183. 192     USB_INTERFACE_DESCRIPTOR_TYPE,  /* bDescriptorType: */
    ; j  |4 z. o0 x# {# F$ \# o5 y" M
  184. 193     0x03,   /* bInterfaceNumber: Number of Interface */
    2 e9 S% ]$ B1 l$ E6 C
  185. 194     0x00,   /* bAlternateSetting: Alternate setting */
    % W  Z+ D" o& ~7 ^% O( r
  186. 195     0x02,   /* bNumEndpoints: Two endpoints used */( A# J. K( ^; j5 m, |
  187. 196     0x0A,   /* bInterfaceClass: CDC */" Q" W  ^( ?% R$ P2 c5 W
  188. 197     0x00,   /* bInterfaceSubClass: */6 M2 b. c) O- q( r' V5 Y
  189. 198     0x00,   /* bInterfaceProtocol: */
    5 @" ~0 {: V. D# C
  190. 199     0x00,   /* iInterface: */200     /*Endpoint 3 Descriptor*/
    * ~% f4 L" S. \4 w- p- R$ {
  191. 201     0x07,   /* bLength: Endpoint Descriptor size */
    8 f; v$ ?6 O# r; P
  192. 202     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */
    / A8 d' ?3 c  P+ X9 d
  193. 203     0x06,   /* bEndpointAddress: (OUT3) */. F0 }( f. g- p2 z% ^8 i9 v& v
  194. 204     0x02,   /* bmAttributes: Bulk */' M% K: u1 S0 H' G- j
  195. 205     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    5 d. Q* b1 W$ D. M: t: p. o" x5 e
  196. 206     0x00,
    9 ^" `! }) ?3 G
  197. 207     0x00,   /* bInterval: ignore for Bulk transfer */208     /*Endpoint 1 Descriptor*/
    % {: Z5 ~* r" [. X
  198. 209     0x07,   /* bLength: Endpoint Descriptor size */: {3 P/ T- a. [+ o! o
  199. 210     USB_ENDPOINT_DESCRIPTOR_TYPE,   /* bDescriptorType: Endpoint */- l- @$ c) G' K( u2 k+ V  O3 x5 O
  200. 211     0x84,   /* bEndpointAddress: (IN1) */
    / u' b) [& v; W' L5 S. ~
  201. 212     0x02,   /* bmAttributes: Bulk */  p+ Q: F* R3 `; L# x" {2 c# V: K
  202. 213     VIRTUAL_COM_PORT_DATA_SIZE,             /* wMaxPacketSize: */
    $ \% t& B, p% x& n, o* r
  203. 214     0x00,
    6 o* b! }; k. T
  204. 215     0x00    /* bInterval */) X1 }8 p, b0 q' Y0 `" d
  205. 216   };
    ' h  l2 r0 v- A. L. {) o8 ~
  206. 217 , E6 F! \# i* `3 Y/ D# m
  207. 218 /* USB String Descriptors */
    # s. j1 n" V7 q9 t! G5 ^
  208. 219 const uint8_t Virtual_Com_Port_StringLangID[VIRTUAL_COM_PORT_SIZ_STRING_LANGID] =2 y$ M! a( ?0 ~
  209. 220   {
    1 x( V5 \. M/ V* p0 S
  210. 221     VIRTUAL_COM_PORT_SIZ_STRING_LANGID,
    9 `( V# T/ `' i5 N% A2 S, i, N
  211. 222     USB_STRING_DESCRIPTOR_TYPE,
    9 u# A1 O3 N- t
  212. 223     0x09,
    % G% T. _/ \9 R( {7 ?  W% ]
  213. 224     0x04 /* LangID = 0x0409: U.S. English */
    - l9 V% i" @" I! Z
  214. 225   };
    $ O+ D/ m! {6 ]% D" L1 j% m
  215. 226 + L; U, ]& k, L8 g! }3 ], t
  216. 227 const uint8_t Virtual_Com_Port_StringVendor[VIRTUAL_COM_PORT_SIZ_STRING_VENDOR] =
    ' E7 \8 Y+ A. u+ k) p( @
  217. 228   {7 j$ w( Q  Q1 o3 P+ n: o
  218. 229     VIRTUAL_COM_PORT_SIZ_STRING_VENDOR,     /* Size of Vendor string */
    5 d9 ?7 X4 E5 {1 \+ q2 L
  219. 230     USB_STRING_DESCRIPTOR_TYPE,             /* bDescriptorType*/
    * i, }! b, u* ], g
  220. 231     /* Manufacturer: "STMicroelectronics" */
    ) @2 ~. L  w' N- k* T9 Q3 G
  221. 232     'S', 0, 'T', 0, 'M', 0, 'i', 0, 'c', 0, 'r', 0, 'o', 0, 'e', 0,; P; t3 y3 D. R) o4 H5 b
  222. 233     'l', 0, 'e', 0, 'c', 0, 't', 0, 'r', 0, 'o', 0, 'n', 0, 'i', 0,
    / d6 F6 O# U: f5 a
  223. 234     'c', 0, 's', 0
    3 T+ o  `4 e5 D! E, {
  224. 235   };
    , ]+ ^8 U* S7 O6 L
  225. 236
    , ?) z7 u0 h0 O7 o
  226. 237 const uint8_t Virtual_Com_Port_StringProduct[VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT] =
    * r0 I3 B3 r. Q9 y
  227. 238   {. ]- j( m6 b& k, D  n+ Y* f
  228. 239     VIRTUAL_COM_PORT_SIZ_STRING_PRODUCT,          /* bLength */) a( f6 f: d0 A
  229. 240     USB_STRING_DESCRIPTOR_TYPE,        /* bDescriptorType */% b: d8 P4 M# z
  230. 241     /* Product name: "STM32 Virtual COM Port" */
      T% B  l! s7 }. O: E8 P! e
  231. 242     'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, ' ', 0, 'V', 0, 'i', 0,
      Q. L& ]! D& _) @2 `0 y
  232. 243     'r', 0, 't', 0, 'u', 0, 'a', 0, 'l', 0, ' ', 0, 'C', 0, 'O', 0,
    + ]- v& ^0 J- R! F" `9 u7 L' d  T4 T
  233. 244     'M', 0, ' ', 0, 'P', 0, 'o', 0, 'r', 0, 't', 0, ' ', 0, ' ', 0
    + |) ]& ^3 a$ z: o4 _
  234. 245   };
    - x& E; M& M7 E& }- w: |3 G0 a- `
  235. 246 ; b. G& X+ d! G
  236. 247 uint8_t Virtual_Com_Port_StringSerial[VIRTUAL_COM_PORT_SIZ_STRING_SERIAL] =8 Q( s/ o! k/ K
  237. 248   {
    - X; K; q! B6 u% X" P6 M
  238. 249     VIRTUAL_COM_PORT_SIZ_STRING_SERIAL,           /* bLength */
    8 K) d' T, W& f
  239. 250     USB_STRING_DESCRIPTOR_TYPE,                   /* bDescriptorType */
    ( N9 x5 m( k0 [* u6 g5 p" g2 L
  240. 251     'S', 0, 'T', 0, 'M', 0, '3', 0, '2', 0, '1', 0, '0', 01 M& ?3 r/ K" }
  241. 252   };
    ( J0 D4 T3 A/ H; s: R# O
  242. 253 $ ~6 Y$ Y3 F' ^4 |- v; g
  243. 254 /******************* (C) COPYRIGHT 2010 STMicroelectronics *****END OF FILE****/
复制代码

1 f4 _( E0 x: z! m8 A
9 o, |- H% ?5 B7 I
  1. ;
    6 \  R: s: ?7 R1 `
  2. ; STMicroelectronics Comunication Device Class driver instalation file
    1 T  Q. y9 T! g% A! t: f
  3. ; (C)2006 Copyright STMicroelectronics
    4 y) J/ Q' ]1 n8 [1 Y& X
  4. ;
    - C( V4 t8 l4 }; K- W  |

  5. + U% u* a. P' x& I; e7 U
  6. [Version], M) D. D; H9 ^8 C# Y, A% [' A' A. e9 t
  7. Signature="$Windows NT$"4 L$ A) `4 ~7 F1 e- r# Y
  8. Class=Ports
    / I. \; w9 V) Q% K! K
  9. ClassGuid={4D36E978-E325-11CE-BFC1-08002BE10318}( V1 T: L, `6 Q' _$ M/ p
  10. Provider=%STM%
    1 F" m0 N( P8 }% z+ u
  11. LayoutFile=layout.inf
    4 [/ X) `5 U2 A* }
  12. DriverVer=10/02/062 k  f% z  _/ J) H
  13. % q! a' ?+ y; Y- }- [( x& f
  14. [Manufacturer]
    # ]% f1 B. h; i# {2 a2 g" ?# E
  15. %STM%=DeviceList- L! u7 K: D6 e! q, J5 G& N& P9 _
  16. 2 i, {  N: J9 x! ^
  17. [DestinationDirs]
    4 h/ Q- {& Y4 u
  18. DefaultDestDir=12: U. D( Z' Y6 m
  19. 1 }, Y' ~' G  H9 Z  }
  20. [SourceDisksFiles]1 S2 A" o1 m$ Z0 n# G+ T' l

  21. ; a) D$ l( c. {, y/ r4 [+ Y
  22. [SourceDisksNames]
      x' D2 _% a* q4 O3 r
  23. * O/ b+ b% O7 T
  24. [DeviceList]
    $ u; C, A* l( U2 p
  25. %DESCRIPTION%=STMUSB, USB\VID_03EB&PID_6133&MI_00
    % d1 t8 I: u# g8 u
  26. %DESCRIPTION%=STMUSB, USB\VID_03EB&PID_6133&MI_02
    % ~  C, }$ b- I
  27. ;------------------------------------------------------------------------------
    ; Z+ b1 R$ v4 l6 F: Z' t2 v6 P- ]
  28. ;  Windows 2000/XP Sections
    " C# @) v* v6 T9 ?# A
  29. ;------------------------------------------------------------------------------' `8 M6 o2 c0 p0 |

  30. + t/ X8 R. Z! _% Q( u3 N3 K& t
  31. [STMUSB.nt]
    2 c5 Y7 ?6 C7 y3 J  H, m
  32. include=mdmcpq.inf
    & c9 [6 [% V7 i  o! k
  33. CopyFiles=DriverCopyFiles
    2 h, z! J8 B( X6 X: n3 R9 k* {
  34. AddReg=STMUSB.nt.AddReg) ^* }- ?7 Q4 }& @2 Y  F5 A8 a5 a

  35. # G9 e, f% k/ w6 g6 w
  36. [DriverCopyFiles]6 O9 w1 F" h& C/ G( c2 A9 {* ?
  37. usbser.sys,,,0x20
    9 ~& A( X- D! C( a1 d+ F  L" ?  M

  38. . @0 ]- A0 N) e* G/ ~- m- P+ Z
  39. [STMUSB.nt.AddReg]7 i$ Y0 C/ ~6 J: A
  40. HKR,,DevLoader,,*ntkern
    / S5 _: g: Q; k1 e( P, m/ R
  41. HKR,,NTMPDriver,,usbser.sys
    $ c6 W: g7 j9 ]  p' N* a! E9 D
  42. HKR,,EnumPropPages32,,"MsPorts.dll,SerialPortPropPageProvider"
    4 Z4 [. ^# V: \

  43. 1 d9 W- F& i8 T
  44. [STMUSB.nt.Services]
    7 M- @1 }& |  D% X' f, n
  45. AddService=usbser, 0x00000002, DriverService
    * o4 O$ x% R5 {% y# R7 t* |8 O
  46. ' `- V5 `! f; u5 h* l& i+ Y& g' T' }
  47. 4 g  _5 E# Y- Y3 D! C  q( O% g
  48. [STMUSB.nt.HW]2 \& U8 Y  U" t& p" o  M% P* F
  49. include=mdmcpq.inf
    : s# B) C% C5 J) K7 w; J
  50. * J* X7 m6 K" L7 k/ b
  51. [DriverService]4 m$ [2 a7 ?- m9 t  r- n
  52. DisplayName=%DESCRIPTION%. ^8 ]4 C5 P, \( S1 @# p! g$ t7 K. h
  53. ServiceType=15 z- Q4 ^& `2 y7 \- ^* d* b( U/ r
  54. StartType=3# z8 D! e  z; r6 E( M
  55. ErrorControl=1  ^. y8 L9 e0 L; R
  56. ServiceBinary=%12%\usbser.sys
    * ~) b3 |- x3 S9 P: O

  57. 6 e# k# W0 v+ E4 X  |3 Y' M0 v( V6 Y  u
  58. ;------------------------------------------------------------------------------. ~% [. F9 V; q1 Y2 K- V7 b: s
  59. ;  String Definitions
    0 I6 d! ~: s& |8 `* H( r+ H/ [3 n
  60. ;------------------------------------------------------------------------------
    5 E9 D! P7 R3 V& v& o

  61. : N# ~; \2 R4 T- O5 \& Z
  62. [Strings]
    5 C2 S7 Y: E6 m  a/ j, |9 ~
  63. STM="STMicroelectronics"
    , m5 x0 F# y  ?. Y) h
  64. DESCRIPTION="STM32F10x DUAL CDC"
复制代码
& Z* T( t% @* Z5 w
- V: _8 ], B6 c1 E# E7 G2 X& d6 ^$ ?
' t! j* K3 r9 p/ @. X

- E9 B# m3 r) M. t9 p4 |
赞 收藏 评论0 发布时间:2022-2-6 22:31

举报

0个回答

所属标签

相似技术帖

官网相关资源

关于
我们是谁
投资者关系
意法半导体可持续发展举措
创新与技术
意法半导体官网
联系我们
联系ST分支机构
寻找销售人员和分销渠道
社区
媒体中心
活动与培训
隐私策略
隐私策略
Cookies管理
行使您的权利
官方最新发布
人形机器人运动控制、感知与智能配电
半导体创新技术与应用方向
EE架构与软件定义汽车
12V/48V 汽车智能配电(SPD)
区域控制单元(ZCU)与分区架构
关注我们
st-img 微信公众号
st-img 手机版