usbd_stm32f446_otgfs.c 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467
  1. /* This file is the part of the Lightweight USB device Stack for STM32 microcontrollers
  2. *
  3. * Copyright ©2016 Dmitry Filimonchuk <dmitrystu[at]gmail[dot]com>
  4. *
  5. * Licensed under the Apache License, Version 2.0 (the "License");
  6. * you may not use this file except in compliance with the License.
  7. * You may obtain a copy of the License at
  8. * http://www.apache.org/licenses/LICENSE-2.0
  9. * Unless required by applicable law or agreed to in writing, software
  10. * distributed under the License is distributed on an "AS IS" BASIS,
  11. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  12. * See the License for the specific language governing permissions and
  13. * limitations under the License.
  14. */
  15. #include <stdint.h>
  16. #include <stdbool.h>
  17. #include "stm32_compat.h"
  18. #include "usb.h"
  19. #if defined(USBD_STM32F446FS)
  20. #define MAX_EP 6
  21. #define MAX_RX_PACKET 128
  22. #define MAX_CONTROL_EP 1
  23. #define MAX_FIFO_SZ 320 /*in 32-bit chunks */
  24. #define RX_FIFO_SZ ((4 * MAX_CONTROL_EP + 6) + ((MAX_RX_PACKET / 4) + 1) + (MAX_EP * 2) + 1)
  25. #define STATUS_VAL(x) (USBD_HW_ADDRFST | (x))
  26. static USB_OTG_GlobalTypeDef * const OTG = (void*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_GLOBAL_BASE);
  27. static USB_OTG_DeviceTypeDef * const OTGD = (void*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_DEVICE_BASE);
  28. static volatile uint32_t * const OTGPCTL = (void*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_PCGCCTL_BASE);
  29. inline static uint32_t* EPFIFO(uint32_t ep) {
  30. return (uint32_t*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_FIFO_BASE + (ep << 12));
  31. }
  32. inline static USB_OTG_INEndpointTypeDef* EPIN(uint32_t ep) {
  33. return (void*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_IN_ENDPOINT_BASE + (ep << 5));
  34. }
  35. inline static USB_OTG_OUTEndpointTypeDef* EPOUT(uint32_t ep) {
  36. return (void*)(USB_OTG_FS_PERIPH_BASE + USB_OTG_OUT_ENDPOINT_BASE + (ep << 5));
  37. }
  38. inline static void Flush_RX(void) {
  39. _BST(OTG->GRSTCTL, USB_OTG_GRSTCTL_RXFFLSH);
  40. _WBC(OTG->GRSTCTL, USB_OTG_GRSTCTL_RXFFLSH);
  41. }
  42. inline static void Flush_TX(uint8_t ep) {
  43. _BMD(OTG->GRSTCTL, USB_OTG_GRSTCTL_TXFNUM,
  44. _VAL2FLD(USB_OTG_GRSTCTL_TXFNUM, ep) | USB_OTG_GRSTCTL_TXFFLSH);
  45. _WBC(OTG->GRSTCTL, USB_OTG_GRSTCTL_TXFFLSH);
  46. }
  47. static uint32_t getinfo(void) {
  48. if (!(RCC->AHB2ENR & RCC_AHB2ENR_OTGFSEN)) return STATUS_VAL(0);
  49. if (!(OTGD->DCTL & USB_OTG_DCTL_SDIS)) return STATUS_VAL(USBD_HW_ENABLED | USBD_HW_SPEED_FS);
  50. return STATUS_VAL(USBD_HW_ENABLED);
  51. }
  52. static void ep_setstall(uint8_t ep, bool stall) {
  53. if (ep & 0x80) {
  54. ep &= 0x7F;
  55. uint32_t _t = EPIN(ep)->DIEPCTL;
  56. if (_t & USB_OTG_DIEPCTL_USBAEP) {
  57. if (stall) {
  58. _BST(_t, USB_OTG_DIEPCTL_STALL);
  59. } else {
  60. _BMD(_t, USB_OTG_DIEPCTL_STALL,
  61. USB_OTG_DIEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_SNAK);
  62. }
  63. EPIN(ep)->DIEPCTL = _t;
  64. }
  65. } else {
  66. uint32_t _t = EPOUT(ep)->DOEPCTL;
  67. if (_t & USB_OTG_DOEPCTL_USBAEP) {
  68. if (stall) {
  69. _BST(_t, USB_OTG_DOEPCTL_STALL);
  70. } else {
  71. _BMD(_t, USB_OTG_DOEPCTL_STALL,
  72. USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_CNAK);
  73. }
  74. EPOUT(ep)->DOEPCTL = _t;
  75. }
  76. }
  77. }
  78. static bool ep_isstalled(uint8_t ep) {
  79. if (ep & 0x80) {
  80. ep &= 0x7F;
  81. return (EPIN(ep)->DIEPCTL & USB_OTG_DIEPCTL_STALL) ? true : false;
  82. } else {
  83. return (EPOUT(ep)->DOEPCTL & USB_OTG_DOEPCTL_STALL) ? true : false;
  84. }
  85. }
  86. static void enable(bool enable) {
  87. if (enable) {
  88. /* enabling USB_OTG in RCC */
  89. _BST(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);
  90. _WBS(OTG->GRSTCTL, USB_OTG_GRSTCTL_AHBIDL);
  91. /* configure OTG as device */
  92. OTG->GUSBCFG = USB_OTG_GUSBCFG_FDMOD | USB_OTG_GUSBCFG_PHYSEL |
  93. _VAL2FLD(USB_OTG_GUSBCFG_TRDT, 0x06);
  94. /* configuring Vbus sense and powerup PHY */
  95. #if defined(USBD_VBUS_DETECT)
  96. OTG->GCCFG |= USB_OTG_GCCFG_VBDEN | USB_OTG_GCCFG_PWRDWN;
  97. #else
  98. OTG->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN | USB_OTG_GOTGCTL_BVALOVAL;
  99. OTG->GCCFG = USB_OTG_GCCFG_PWRDWN;
  100. #endif
  101. /* restart PHY*/
  102. *OTGPCTL = 0;
  103. /* soft disconnect device */
  104. _BST(OTGD->DCTL, USB_OTG_DCTL_SDIS);
  105. /* Setup USB FS speed and frame interval */
  106. _BMD(OTGD->DCFG, USB_OTG_DCFG_PERSCHIVL | USB_OTG_DCFG_DSPD,
  107. _VAL2FLD(USB_OTG_DCFG_PERSCHIVL, 0) | _VAL2FLD(USB_OTG_DCFG_DSPD, 0x03));
  108. /* unmask EP interrupts */
  109. OTGD->DIEPMSK = USB_OTG_DIEPMSK_XFRCM;
  110. /* unmask core interrupts */
  111. OTG->GINTMSK = USB_OTG_GINTMSK_USBRST | USB_OTG_GINTMSK_ENUMDNEM |
  112. #if !defined(USBD_SOF_DISABLED)
  113. USB_OTG_GINTMSK_SOFM |
  114. #endif
  115. USB_OTG_GINTMSK_USBSUSPM | USB_OTG_GINTMSK_WUIM |
  116. USB_OTG_GINTMSK_IEPINT | USB_OTG_GINTMSK_RXFLVLM;
  117. /* clear pending interrupts */
  118. OTG->GINTSTS = 0xFFFFFFFF;
  119. /* unmask global interrupt */
  120. OTG->GAHBCFG = USB_OTG_GAHBCFG_GINT;
  121. /* setting max RX FIFO size */
  122. OTG->GRXFSIZ = RX_FIFO_SZ;
  123. /* setting up EP0 TX FIFO SZ as 64 byte */
  124. OTG->DIEPTXF0_HNPTXFSIZ = RX_FIFO_SZ | (0x10 << 16);
  125. } else {
  126. if (RCC->AHB2ENR & RCC_AHB2ENR_OTGFSEN) {
  127. _BST(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST);
  128. _BCL(RCC->AHB2RSTR, RCC_AHB2RSTR_OTGFSRST);
  129. _BCL(RCC->AHB2ENR, RCC_AHB2ENR_OTGFSEN);
  130. }
  131. }
  132. }
  133. static uint8_t connect(bool connect) {
  134. if (connect) {
  135. _BCL(OTGD->DCTL, USB_OTG_DCTL_SDIS);
  136. } else {
  137. _BST(OTGD->DCTL, USB_OTG_DCTL_SDIS);
  138. }
  139. return usbd_lane_unk;
  140. }
  141. static void setaddr (uint8_t addr) {
  142. _BMD(OTGD->DCFG, USB_OTG_DCFG_DAD, addr << 4);
  143. }
  144. /**\brief Helper. Set up TX fifo
  145. * \param ep endpoint index
  146. * \param epsize required max packet size in bytes
  147. * \return true if TX fifo is successfully set
  148. */
  149. static bool set_tx_fifo(uint8_t ep, uint16_t epsize) {
  150. uint32_t _fsa = OTG->DIEPTXF0_HNPTXFSIZ;
  151. /* calculating initial TX FIFO address. next from EP0 TX fifo */
  152. _fsa = 0xFFFF & (_fsa + (_fsa >> 16));
  153. /* looking for next free TX fifo address */
  154. for (int i = 0; i < (MAX_EP - 1); i++) {
  155. uint32_t _t = OTG->DIEPTXF[i];
  156. if ((_t & 0xFFFF) < 0x200) {
  157. _t = 0xFFFF & (_t + (_t >> 16));
  158. if (_t > _fsa) {
  159. _fsa = _t;
  160. }
  161. }
  162. }
  163. /* calculating requited TX fifo size */
  164. /* getting in 32 bit terms */
  165. epsize = (epsize + 0x03) >> 2;
  166. /* it must be 16 32-bit words minimum */
  167. if (epsize < 0x10) epsize = 0x10;
  168. /* checking for the available fifo */
  169. if ((_fsa + epsize) > MAX_FIFO_SZ) return false;
  170. /* programming fifo register */
  171. _fsa |= (epsize << 16);
  172. OTG->DIEPTXF[ep - 1] = _fsa;
  173. return true;
  174. }
  175. static bool ep_config(uint8_t ep, uint8_t eptype, uint16_t epsize) {
  176. if (ep == 0) {
  177. /* configureing control endpoint EP0 */
  178. uint32_t mpsize;
  179. if (epsize <= 0x08) {
  180. epsize = 0x08;
  181. mpsize = 0x03;
  182. } else if (epsize <= 0x10) {
  183. epsize = 0x10;
  184. mpsize = 0x02;
  185. } else if (epsize <= 0x20) {
  186. epsize = 0x20;
  187. mpsize = 0x01;
  188. } else {
  189. epsize = 0x40;
  190. mpsize = 0x00;
  191. }
  192. /* EP0 TX FIFO size is setted on init level */
  193. /* enabling RX and TX interrupts from EP0 */
  194. OTGD->DAINTMSK |= 0x00010001;
  195. /* setting up EP0 TX and RX registers */
  196. /*EPIN(ep)->DIEPTSIZ = epsize;*/
  197. EPIN(ep)->DIEPCTL = mpsize | USB_OTG_DIEPCTL_SNAK;
  198. /* 1 setup packet, 1 packets total */
  199. EPOUT(ep)->DOEPTSIZ = epsize | (1 << 29) | (1 << 19);
  200. EPOUT(ep)->DOEPCTL = mpsize | USB_OTG_DOEPCTL_EPENA | USB_OTG_DOEPCTL_CNAK;
  201. return true;
  202. }
  203. if (ep & 0x80) {
  204. ep &= 0x7F;
  205. USB_OTG_INEndpointTypeDef* epi = EPIN(ep);
  206. /* configuring TX endpoint */
  207. /* setting up TX fifo and size register */
  208. if ((eptype == USB_EPTYPE_ISOCHRONUS) ||
  209. (eptype == (USB_EPTYPE_BULK | USB_EPTYPE_DBLBUF))) {
  210. if (!set_tx_fifo(ep, epsize << 1)) return false;
  211. } else {
  212. if (!set_tx_fifo(ep, epsize)) return false;
  213. }
  214. /* enabling EP TX interrupt */
  215. OTGD->DAINTMSK |= (0x0001UL << ep);
  216. /* setting up TX control register*/
  217. switch (eptype) {
  218. case USB_EPTYPE_ISOCHRONUS:
  219. epi->DIEPCTL = USB_OTG_DIEPCTL_EPENA | USB_OTG_DIEPCTL_CNAK |
  220. (0x01 << 18) | USB_OTG_DIEPCTL_USBAEP |
  221. USB_OTG_DIEPCTL_SD0PID_SEVNFRM |
  222. (ep << 22) | epsize;
  223. break;
  224. case USB_EPTYPE_BULK:
  225. case USB_EPTYPE_BULK | USB_EPTYPE_DBLBUF:
  226. epi->DIEPCTL = USB_OTG_DIEPCTL_SNAK | USB_OTG_DIEPCTL_USBAEP |
  227. (0x02 << 18) | USB_OTG_DIEPCTL_SD0PID_SEVNFRM |
  228. (ep << 22) | epsize;
  229. break;
  230. default:
  231. epi->DIEPCTL = USB_OTG_DIEPCTL_SNAK | USB_OTG_DIEPCTL_USBAEP |
  232. (0x03 << 18) | USB_OTG_DIEPCTL_SD0PID_SEVNFRM |
  233. (ep << 22) | epsize;
  234. break;
  235. }
  236. } else {
  237. /* configuring RX endpoint */
  238. USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep);
  239. /* setting up RX control register */
  240. switch (eptype) {
  241. case USB_EPTYPE_ISOCHRONUS:
  242. epo->DOEPCTL = USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_CNAK |
  243. USB_OTG_DOEPCTL_EPENA | USB_OTG_DOEPCTL_USBAEP |
  244. (0x01 << 18) | epsize;
  245. break;
  246. case USB_EPTYPE_BULK | USB_EPTYPE_DBLBUF:
  247. case USB_EPTYPE_BULK:
  248. epo->DOEPCTL = USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_CNAK |
  249. USB_OTG_DOEPCTL_EPENA | USB_OTG_DOEPCTL_USBAEP |
  250. (0x02 << 18) | epsize;
  251. break;
  252. default:
  253. epo->DOEPCTL = USB_OTG_DOEPCTL_SD0PID_SEVNFRM | USB_OTG_DOEPCTL_CNAK |
  254. USB_OTG_DOEPCTL_EPENA | USB_OTG_DOEPCTL_USBAEP |
  255. (0x03 << 18) | epsize;
  256. break;
  257. }
  258. }
  259. return true;
  260. }
  261. static void ep_deconfig(uint8_t ep) {
  262. ep &= 0x7F;
  263. volatile USB_OTG_INEndpointTypeDef* epi = EPIN(ep);
  264. volatile USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep);
  265. /* deconfiguring TX part */
  266. /* disable interrupt */
  267. OTGD->DAINTMSK &= ~(0x10001 << ep);
  268. /* decativating endpoint */
  269. _BCL(epi->DIEPCTL, USB_OTG_DIEPCTL_USBAEP);
  270. /* flushing FIFO */
  271. Flush_TX(ep);
  272. /* disabling endpoint */
  273. if ((epi->DIEPCTL & USB_OTG_DIEPCTL_EPENA) && (ep != 0)) {
  274. epi->DIEPCTL = USB_OTG_DIEPCTL_EPDIS;
  275. }
  276. /* clean EP interrupts */
  277. epi->DIEPINT = 0xFF;
  278. /* deconfiguring TX FIFO */
  279. if (ep > 0) {
  280. OTG->DIEPTXF[ep-1] = 0x02000200 + 0x200 * ep;
  281. }
  282. /* deconfigureing RX part */
  283. _BCL(epo->DOEPCTL, USB_OTG_DOEPCTL_USBAEP);
  284. if ((epo->DOEPCTL & USB_OTG_DOEPCTL_EPENA) && (ep != 0)) {
  285. epo->DOEPCTL = USB_OTG_DOEPCTL_EPDIS;
  286. }
  287. epo->DOEPINT = 0xFF;
  288. }
  289. static int32_t ep_read(uint8_t ep, void* buf, uint16_t blen) {
  290. uint32_t len, tmp = 0;
  291. ep &= 0x7F;
  292. volatile uint32_t *fifo = EPFIFO(0);
  293. USB_OTG_OUTEndpointTypeDef* epo = EPOUT(ep);
  294. /* no data in RX FIFO */
  295. if (!(OTG->GINTSTS & USB_OTG_GINTSTS_RXFLVL)) return -1;
  296. if ((OTG->GRXSTSR & USB_OTG_GRXSTSP_EPNUM) != ep) return -1;
  297. /* pop data from fifo */
  298. len = _FLD2VAL(USB_OTG_GRXSTSP_BCNT, OTG->GRXSTSP);
  299. for (int idx = 0; idx < len; idx++) {
  300. if ((idx & 0x03) == 0x00) {
  301. tmp = *fifo;
  302. }
  303. if (idx < blen) {
  304. ((uint8_t*)buf)[idx] = tmp & 0xFF;
  305. tmp >>= 8;
  306. }
  307. }
  308. _BST(epo->DOEPCTL, USB_OTG_DOEPCTL_CNAK | USB_OTG_DOEPCTL_EPENA);
  309. return (len < blen) ? len : blen;
  310. }
  311. static int32_t ep_write(uint8_t ep, const void *buf, uint16_t blen) {
  312. uint32_t len, tmp;
  313. ep &= 0x7F;
  314. volatile uint32_t* fifo = EPFIFO(ep);
  315. USB_OTG_INEndpointTypeDef* epi = EPIN(ep);
  316. /* transfer data size in 32-bit words */
  317. len = (blen + 3) >> 2;
  318. /* no enough space in TX fifo */
  319. if (len > epi->DTXFSTS) return -1;
  320. if (ep != 0 && epi->DIEPCTL & USB_OTG_DIEPCTL_EPENA) {
  321. return -1;
  322. }
  323. epi->DIEPTSIZ = 0;
  324. epi->DIEPTSIZ = (1 << 19) + blen;
  325. _BMD(epi->DIEPCTL, USB_OTG_DIEPCTL_STALL, USB_OTG_DIEPCTL_EPENA | USB_OTG_DIEPCTL_CNAK);
  326. /* push data to FIFO */
  327. tmp = 0;
  328. for (int idx = 0; idx < blen; idx++) {
  329. tmp |= (uint32_t)((const uint8_t*)buf)[idx] << ((idx & 0x03) << 3);
  330. if ((idx & 0x03) == 0x03 || (idx + 1) == blen) {
  331. *fifo = tmp;
  332. tmp = 0;
  333. }
  334. }
  335. return blen;
  336. }
  337. static uint16_t get_frame (void) {
  338. return _FLD2VAL(USB_OTG_DSTS_FNSOF, OTGD->DSTS);
  339. }
  340. static void evt_poll(usbd_device *dev, usbd_evt_callback callback) {
  341. uint32_t evt;
  342. uint32_t ep = 0;
  343. while (1) {
  344. uint32_t _t = OTG->GINTSTS;
  345. /* bus RESET event */
  346. if (_t & USB_OTG_GINTSTS_USBRST) {
  347. OTG->GINTSTS = USB_OTG_GINTSTS_USBRST;
  348. for (uint8_t i = 0; i < MAX_EP; i++ ) {
  349. ep_deconfig(i);
  350. }
  351. Flush_RX();
  352. continue;
  353. } else if (_t & USB_OTG_GINTSTS_ENUMDNE) {
  354. OTG->GINTSTS = USB_OTG_GINTSTS_ENUMDNE;
  355. evt = usbd_evt_reset;
  356. } else if (_t & USB_OTG_GINTSTS_IEPINT) {
  357. for (;; ep++) {
  358. USB_OTG_INEndpointTypeDef* epi = EPIN(ep);
  359. if (ep >= MAX_EP) return;
  360. if (epi->DIEPINT & USB_OTG_DIEPINT_XFRC) {
  361. epi->DIEPINT = USB_OTG_DIEPINT_XFRC;
  362. evt = usbd_evt_eptx;
  363. ep |= 0x80;
  364. break;
  365. }
  366. }
  367. } else if (_t & USB_OTG_GINTSTS_RXFLVL) {
  368. _t = OTG->GRXSTSR;
  369. ep = _t & USB_OTG_GRXSTSP_EPNUM;
  370. switch (_FLD2VAL(USB_OTG_GRXSTSP_PKTSTS, _t)) {
  371. case 0x02:
  372. evt = usbd_evt_eprx;
  373. break;
  374. case 0x06:
  375. evt = usbd_evt_epsetup;
  376. break;
  377. default:
  378. OTG->GRXSTSP;
  379. continue;
  380. }
  381. #if !defined(USBD_SOF_DISABLED)
  382. } else if (_t & USB_OTG_GINTSTS_SOF) {
  383. OTG->GINTSTS = USB_OTG_GINTSTS_SOF;
  384. evt = usbd_evt_sof;
  385. #endif
  386. } else if (_t & USB_OTG_GINTSTS_USBSUSP) {
  387. evt = usbd_evt_susp;
  388. OTG->GINTSTS = USB_OTG_GINTSTS_USBSUSP;
  389. } else if (_t & USB_OTG_GINTSTS_WKUINT) {
  390. OTG->GINTSTS = USB_OTG_GINTSTS_WKUINT;
  391. evt = usbd_evt_wkup;
  392. } else {
  393. /* no more supported events */
  394. return;
  395. }
  396. callback(dev, evt, ep);
  397. }
  398. }
  399. static uint32_t fnv1a32_turn (uint32_t fnv, uint32_t data ) {
  400. for (int i = 0; i < 4 ; i++) {
  401. fnv ^= (data & 0xFF);
  402. fnv *= 16777619;
  403. data >>= 8;
  404. }
  405. return fnv;
  406. }
  407. static uint16_t get_serialno_desc(void *buffer) {
  408. struct usb_string_descriptor *dsc = buffer;
  409. uint16_t *str = dsc->wString;
  410. uint32_t fnv = 2166136261;
  411. fnv = fnv1a32_turn(fnv, *(uint32_t*)(UID_BASE + 0x00));
  412. fnv = fnv1a32_turn(fnv, *(uint32_t*)(UID_BASE + 0x04));
  413. fnv = fnv1a32_turn(fnv, *(uint32_t*)(UID_BASE + 0x08));
  414. for (int i = 28; i >= 0; i -= 4 ) {
  415. uint16_t c = (fnv >> i) & 0x0F;
  416. c += (c < 10) ? '0' : ('A' - 10);
  417. *str++ = c;
  418. }
  419. dsc->bDescriptorType = USB_DTYPE_STRING;
  420. dsc->bLength = 18;
  421. return 18;
  422. }
  423. __attribute__((externally_visible)) const struct usbd_driver usbd_otgfs = {
  424. getinfo,
  425. enable,
  426. connect,
  427. setaddr,
  428. ep_config,
  429. ep_deconfig,
  430. ep_read,
  431. ep_write,
  432. ep_setstall,
  433. ep_isstalled,
  434. evt_poll,
  435. get_frame,
  436. get_serialno_desc,
  437. };
  438. #endif //USBD_STM32L446FS