]> git.donarmstrong.com Git - qmk_firmware.git/blob - tool/mbed/mbed-sdk/libraries/mbed/targets/cmsis/TARGET_STM/TARGET_STM32F3/stm32f3xx_hal_pcd.c
Squashed 'tmk_core/' changes from 7967731..b9e0ea0
[qmk_firmware.git] / tool / mbed / mbed-sdk / libraries / mbed / targets / cmsis / TARGET_STM / TARGET_STM32F3 / stm32f3xx_hal_pcd.c
1 /**
2   ******************************************************************************
3   * @file    stm32f3xx_hal_pcd.c
4   * @author  MCD Application Team
5   * @version V1.1.0
6   * @date    12-Sept-2014
7   * @brief   PCD HAL module driver.
8   *          This file provides firmware functions to manage the following 
9   *          functionalities of the USB Peripheral Controller:
10   *           + Initialization and de-initialization functions
11   *           + IO operation functions
12   *           + Peripheral Control functions 
13   *           + Peripheral State functions
14   *         
15   @verbatim
16   ==============================================================================
17                     ##### How to use this driver #####
18   ==============================================================================
19     [..]
20       The PCD HAL driver can be used as follows:
21
22      (#) Declare a PCD_HandleTypeDef handle structure, for example:
23          PCD_HandleTypeDef  hpcd;
24         
25      (#) Fill parameters of Init structure in HCD handle
26   
27      (#) Call HAL_PCD_Init() API to initialize the HCD peripheral (Core, Device core, ...) 
28
29      (#) Initialize the PCD low level resources through the HAL_PCD_MspInit() API:
30          (##) Enable the PCD/USB Low Level interface clock using 
31               (+++) __USB_CLK_ENABLE);
32            
33          (##) Initialize the related GPIO clocks
34          (##) Configure PCD pin-out
35          (##) Configure PCD NVIC interrupt
36     
37      (#)Associate the Upper USB device stack to the HAL PCD Driver:
38          (##) hpcd.pData = pdev;
39
40      (#)Enable HCD transmission and reception:
41          (##) HAL_PCD_Start();
42
43   @endverbatim
44   ******************************************************************************
45   * @attention
46   *
47   * <h2><center>&copy; COPYRIGHT(c) 2014 STMicroelectronics</center></h2>
48   *
49   * Redistribution and use in source and binary forms, with or without modification,
50   * are permitted provided that the following conditions are met:
51   *   1. Redistributions of source code must retain the above copyright notice,
52   *      this list of conditions and the following disclaimer.
53   *   2. Redistributions in binary form must reproduce the above copyright notice,
54   *      this list of conditions and the following disclaimer in the documentation
55   *      and/or other materials provided with the distribution.
56   *   3. Neither the name of STMicroelectronics nor the names of its contributors
57   *      may be used to endorse or promote products derived from this software
58   *      without specific prior written permission.
59   *
60   * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
61   * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
62   * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
63   * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
64   * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
65   * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
66   * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
67   * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
68   * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
69   * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
70   *
71   ******************************************************************************
72   */
73
74 /* Includes ------------------------------------------------------------------*/
75 #include "stm32f3xx_hal.h"
76
77 /** @addtogroup STM32F3xx_HAL_Driver
78   * @{
79   */
80
81 /** @defgroup PCD PCD HAL module driver
82   * @brief PCD HAL module driver
83   * @{
84   */
85
86 #ifdef HAL_PCD_MODULE_ENABLED
87
88 #if defined(STM32F302xE) || defined(STM32F303xE) || \
89     defined(STM32F302xC) || defined(STM32F303xC) || \
90     defined(STM32F302x8)                         || \
91     defined(STM32F373xC)
92
93 /* Private typedef -----------------------------------------------------------*/
94 /* Private define ------------------------------------------------------------*/
95
96 /** @defgroup PCD_Private_Define PCD Private Define
97   * @{
98   */
99 #define BTABLE_ADDRESS                  (0x000)  
100 /**
101   * @}
102   */ 
103   
104 /* Private macro -------------------------------------------------------------*/
105 /* Private variables ---------------------------------------------------------*/
106 /* Private function prototypes -----------------------------------------------*/
107 /** @defgroup PCD_Private_Functions PCD Private Functions
108   * @{
109   */
110 static HAL_StatusTypeDef PCD_EP_ISR_Handler(PCD_HandleTypeDef *hpcd);
111 /**
112   * @}
113   */ 
114 /* Exported functions ---------------------------------------------------------*/
115
116 /** @defgroup PCD_Exported_Functions PCD Exported Functions
117   * @{
118   */
119
120 /** @defgroup PCD_Exported_Functions_Group1 Initialization and de-initialization functions 
121  *  @brief    Initialization and Configuration functions 
122  *
123 @verbatim
124  ===============================================================================
125             ##### Initialization and de-initialization functions #####
126  ===============================================================================
127     [..]  This section provides functions allowing to:
128  
129 @endverbatim
130   * @{
131   */
132
133 /**
134   * @brief  Initializes the PCD according to the specified
135   *         parameters in the PCD_InitTypeDef and create the associated handle.
136   * @param  hpcd: PCD handle
137   * @retval HAL status
138   */
139 HAL_StatusTypeDef HAL_PCD_Init(PCD_HandleTypeDef *hpcd)
140
141   uint32_t i = 0;
142
143   uint32_t wInterrupt_Mask = 0;
144   
145   /* Check the PCD handle allocation */
146   if(hpcd == HAL_NULL)
147   {
148     return HAL_ERROR;
149   }
150   
151   /* Check the parameters */
152   assert_param(IS_PCD_ALL_INSTANCE(hpcd->Instance));
153
154   hpcd->State = PCD_BUSY;
155   
156   /* Init the low level hardware : GPIO, CLOCK, NVIC... */
157   HAL_PCD_MspInit(hpcd);
158
159  /* Init endpoints structures */
160  for (i = 0; i < hpcd->Init.dev_endpoints ; i++)
161  {
162    /* Init ep structure */
163    hpcd->IN_ep[i].is_in = 1;
164    hpcd->IN_ep[i].num = i;
165    /* Control until ep is actvated */
166    hpcd->IN_ep[i].type = PCD_EP_TYPE_CTRL;
167    hpcd->IN_ep[i].maxpacket =  0;
168    hpcd->IN_ep[i].xfer_buff = 0;
169    hpcd->IN_ep[i].xfer_len = 0;
170  }
171  
172  for (i = 0; i < hpcd->Init.dev_endpoints ; i++)
173  {
174    hpcd->OUT_ep[i].is_in = 0;
175    hpcd->OUT_ep[i].num = i;
176    /* Control until ep is activated */
177    hpcd->OUT_ep[i].type = PCD_EP_TYPE_CTRL;
178    hpcd->OUT_ep[i].maxpacket = 0;
179    hpcd->OUT_ep[i].xfer_buff = 0;
180    hpcd->OUT_ep[i].xfer_len = 0;
181  }
182   
183  /* Init Device */
184  /*CNTR_FRES = 1*/
185  hpcd->Instance->CNTR = USB_CNTR_FRES;
186  
187  /*CNTR_FRES = 0*/
188  hpcd->Instance->CNTR = 0;
189  
190  /*Clear pending interrupts*/
191  hpcd->Instance->ISTR = 0;
192  
193   /*Set Btable Adress*/
194  hpcd->Instance->BTABLE = BTABLE_ADDRESS;
195   
196   /*set wInterrupt_Mask global variable*/
197   wInterrupt_Mask = USB_CNTR_CTRM  | USB_CNTR_WKUPM | USB_CNTR_SUSPM | USB_CNTR_ERRM \
198     | USB_CNTR_ESOFM | USB_CNTR_RESETM;
199   
200   /*Set interrupt mask*/
201   hpcd->Instance->CNTR = wInterrupt_Mask;
202   
203   hpcd->USB_Address = 0;
204   hpcd->State= PCD_READY;
205
206  return HAL_OK;
207 }
208
209 /**
210   * @brief  DeInitializes the PCD peripheral 
211   * @param  hpcd: PCD handle
212   * @retval HAL status
213   */
214 HAL_StatusTypeDef HAL_PCD_DeInit(PCD_HandleTypeDef *hpcd)
215 {
216   /* Check the PCD handle allocation */
217   if(hpcd == HAL_NULL)
218   {
219     return HAL_ERROR;
220   }
221
222   hpcd->State = PCD_BUSY;
223   
224   /* Stop Device */
225   HAL_PCD_Stop(hpcd);
226     
227   /* DeInit the low level hardware */
228   HAL_PCD_MspDeInit(hpcd);
229   
230   hpcd->State = PCD_READY; 
231   
232   return HAL_OK;
233 }
234
235 /**
236   * @brief  Initializes the PCD MSP.
237   * @param  hpcd: PCD handle
238   * @retval None
239   */
240 __weak void HAL_PCD_MspInit(PCD_HandleTypeDef *hpcd)
241 {
242   /* NOTE : This function Should not be modified, when the callback is needed,
243             the HAL_PCD_MspInit could be implenetd in the user file
244    */
245 }
246
247 /**
248   * @brief  DeInitializes PCD MSP.
249   * @param  hpcd: PCD handle
250   * @retval None
251   */
252 __weak void HAL_PCD_MspDeInit(PCD_HandleTypeDef *hpcd)
253 {
254   /* NOTE : This function Should not be modified, when the callback is needed,
255             the HAL_PCD_MspDeInit could be implenetd in the user file
256    */
257 }
258
259 /**
260   * @}
261   */
262
263 /** @defgroup PCD_Exported_Functions_Group2 Input and Output operation functions 
264  *  @brief   Data transfers functions 
265  *
266 @verbatim   
267  ===============================================================================
268                       ##### IO operation functions #####
269  ===============================================================================  
270     [..]
271     This subsection provides a set of functions allowing to manage the PCD data 
272     transfers.
273
274 @endverbatim
275   * @{
276   */
277   
278 /**
279   * @brief  Start The USB OTG Device.
280   * @param  hpcd: PCD handle
281   * @retval HAL status
282   */
283 HAL_StatusTypeDef HAL_PCD_Start(PCD_HandleTypeDef *hpcd)
284
285   /*  DP Pull-Down is external */
286   HAL_PCDEx_SetConnectionState (hpcd, 1);
287   
288   return HAL_OK;
289 }
290
291 /**
292   * @brief  Stop The USB OTG Device.
293   * @param  hpcd: PCD handle
294   * @retval HAL status
295   */
296 HAL_StatusTypeDef HAL_PCD_Stop(PCD_HandleTypeDef *hpcd)
297
298   __HAL_LOCK(hpcd); 
299   
300     /* disable all interrupts and force USB reset */
301   hpcd->Instance->CNTR = USB_CNTR_FRES;
302   
303   /* clear interrupt status register */
304   hpcd->Instance->ISTR = 0;
305   
306   /* switch-off device */
307   hpcd->Instance->CNTR = (USB_CNTR_FRES | USB_CNTR_PDWN);
308   
309   __HAL_UNLOCK(hpcd); 
310   return HAL_OK;
311 }
312 /**
313   * @}
314   */
315   
316 /**
317   * @}
318   */  
319
320 /** @addtogroup PCD_Private_Functions PCD Private Functions
321   * @{
322   */
323 /**
324   * @brief  This function handles PCD Endpoint interrupt request.
325   * @param  hpcd: PCD handle
326   * @retval HAL status
327   */
328 static HAL_StatusTypeDef PCD_EP_ISR_Handler(PCD_HandleTypeDef *hpcd)
329 {
330   PCD_EPTypeDef *ep;
331   uint16_t count=0;
332   uint8_t EPindex;
333   __IO uint16_t wIstr;  
334   __IO uint16_t wEPVal = 0;
335   
336   /* stay in loop while pending interrupts */
337   while (((wIstr = hpcd->Instance->ISTR) & USB_ISTR_CTR) != 0)
338   {
339     /* extract highest priority endpoint number */
340     EPindex = (uint8_t)(wIstr & USB_ISTR_EP_ID);
341     
342     if (EPindex == 0)
343     {
344       /* Decode and service control endpoint interrupt */
345       
346       /* DIR bit = origin of the interrupt */   
347       if ((wIstr & USB_ISTR_DIR) == 0)
348       {
349         /* DIR = 0 */
350         
351         /* DIR = 0      => IN  int */
352         /* DIR = 0 implies that (EP_CTR_TX = 1) always  */
353         PCD_CLEAR_TX_EP_CTR(hpcd->Instance, PCD_ENDP0);
354         ep = &hpcd->IN_ep[0];
355         
356         ep->xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->num);
357         ep->xfer_buff += ep->xfer_count;
358  
359         /* TX COMPLETE */
360         HAL_PCD_DataInStageCallback(hpcd, 0);
361         
362         
363         if((hpcd->USB_Address > 0)&& ( ep->xfer_len == 0))
364         {
365           hpcd->Instance->DADDR = (hpcd->USB_Address | USB_DADDR_EF);
366           hpcd->USB_Address = 0;
367         }
368         
369       }
370       else
371       {
372         /* DIR = 1 */
373         
374         /* DIR = 1 & CTR_RX       => SETUP or OUT int */
375         /* DIR = 1 & (CTR_TX | CTR_RX) => 2 int pending */
376         ep = &hpcd->OUT_ep[0];
377         wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, PCD_ENDP0);
378         
379         if ((wEPVal & USB_EP_SETUP) != 0)
380         {
381           /* Get SETUP Packet*/
382           ep->xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num);
383           PCD_ReadPMA(hpcd->Instance, (uint8_t*)hpcd->Setup ,ep->pmaadress , ep->xfer_count);       
384           /* SETUP bit kept frozen while CTR_RX = 1*/ 
385           PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0); 
386           
387           /* Process SETUP Packet*/
388           HAL_PCD_SetupStageCallback(hpcd);
389         }
390         
391         else if ((wEPVal & USB_EP_CTR_RX) != 0)
392         {
393           PCD_CLEAR_RX_EP_CTR(hpcd->Instance, PCD_ENDP0);
394           /* Get Control Data OUT Packet*/
395           ep->xfer_count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num);
396           
397           if (ep->xfer_count != 0)
398           {
399             PCD_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaadress, ep->xfer_count);
400             ep->xfer_buff+=ep->xfer_count;
401           }
402           
403           /* Process Control Data OUT Packet*/
404            HAL_PCD_DataOutStageCallback(hpcd, 0);
405           
406           PCD_SET_EP_RX_CNT(hpcd->Instance, PCD_ENDP0, ep->maxpacket);
407           PCD_SET_EP_RX_STATUS(hpcd->Instance, PCD_ENDP0, USB_EP_RX_VALID);
408         }
409       }
410     }
411     else
412     {
413       
414       /* Decode and service non control endpoints interrupt  */
415       
416       /* process related endpoint register */
417       wEPVal = PCD_GET_ENDPOINT(hpcd->Instance, EPindex);
418       if ((wEPVal & USB_EP_CTR_RX) != 0)
419       {  
420         /* clear int flag */
421         PCD_CLEAR_RX_EP_CTR(hpcd->Instance, EPindex);
422         ep = &hpcd->OUT_ep[EPindex];
423         
424         /* OUT double Buffering*/
425         if (ep->doublebuffer == 0)
426         {
427           count = PCD_GET_EP_RX_CNT(hpcd->Instance, ep->num);
428           if (count != 0)
429           {
430             PCD_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaadress, count);
431           }
432         }
433         else
434         {
435           if (PCD_GET_ENDPOINT(hpcd->Instance, ep->num) & USB_EP_DTOG_RX)
436           {
437             /*read from endpoint BUF0Addr buffer*/
438             count = PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->num);
439             if (count != 0)
440             {
441               PCD_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr0, count);
442             }
443           }
444           else
445           {
446             /*read from endpoint BUF1Addr buffer*/
447             count = PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->num);
448             if (count != 0)
449             {
450               PCD_ReadPMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr1, count);
451             }
452           }
453           PCD_FreeUserBuffer(hpcd->Instance, ep->num, PCD_EP_DBUF_OUT);  
454         }
455         /*multi-packet on the NON control OUT endpoint*/
456         ep->xfer_count+=count;
457         ep->xfer_buff+=count;
458        
459         if ((ep->xfer_len == 0) || (count < ep->maxpacket))
460         {
461           /* RX COMPLETE */
462           HAL_PCD_DataOutStageCallback(hpcd, ep->num);
463         }
464         else
465         {
466           HAL_PCD_EP_Receive(hpcd, ep->num, ep->xfer_buff, ep->xfer_len);
467         }
468         
469       } /* if((wEPVal & EP_CTR_RX) */
470       
471       if ((wEPVal & USB_EP_CTR_TX) != 0)
472       {
473         ep = &hpcd->IN_ep[EPindex];
474         
475         /* clear int flag */
476         PCD_CLEAR_TX_EP_CTR(hpcd->Instance, EPindex);
477         
478         /* IN double Buffering*/
479         if (ep->doublebuffer == 0)
480         {
481           ep->xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->num);
482           if (ep->xfer_count != 0)
483           {
484             PCD_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaadress, ep->xfer_count);
485           }
486         }
487         else
488         {
489           if (PCD_GET_ENDPOINT(hpcd->Instance, ep->num) & USB_EP_DTOG_TX)
490           {
491             /*read from endpoint BUF0Addr buffer*/
492             ep->xfer_count = PCD_GET_EP_DBUF0_CNT(hpcd->Instance, ep->num);
493             if (ep->xfer_count != 0)
494             {
495               PCD_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr0, ep->xfer_count);
496             }
497           }
498           else
499           {
500             /*read from endpoint BUF1Addr buffer*/
501             ep->xfer_count = PCD_GET_EP_DBUF1_CNT(hpcd->Instance, ep->num);
502             if (ep->xfer_count != 0)
503             {
504               PCD_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaaddr1, ep->xfer_count);
505             }
506           }
507           PCD_FreeUserBuffer(hpcd->Instance, ep->num, PCD_EP_DBUF_IN);  
508         }
509         /*multi-packet on the NON control IN endpoint*/
510         ep->xfer_count = PCD_GET_EP_TX_CNT(hpcd->Instance, ep->num);
511         ep->xfer_buff+=ep->xfer_count;
512        
513         /* Zero Length Packet? */
514         if (ep->xfer_len == 0)
515         {
516           /* TX COMPLETE */
517           HAL_PCD_DataInStageCallback(hpcd, ep->num);
518         }
519         else
520         {
521           HAL_PCD_EP_Transmit(hpcd, ep->num, ep->xfer_buff, ep->xfer_len);
522         }
523       } 
524     }
525   }
526   return HAL_OK;
527 }
528 /**
529   * @}
530   */
531
532 /** @addtogroup PCD_Exported_Functions
533   * @{
534   */
535
536 /** @defgroup PCD_Exported_Functions_Group2 Input and Output operation functions 
537  * @{
538  */    
539  
540 /**
541   * @brief  This function handles PCD interrupt request.
542   * @param  hpcd: PCD handle
543   * @retval HAL status
544   */
545 void HAL_PCD_IRQHandler(PCD_HandleTypeDef *hpcd)
546 {
547   uint32_t wInterrupt_Mask = 0;
548   
549   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_CTR))
550   {
551     /* servicing of the endpoint correct transfer interrupt */
552     /* clear of the CTR flag into the sub */
553     PCD_EP_ISR_Handler(hpcd);
554   }
555
556   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_RESET))
557   {
558     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_RESET);
559     HAL_PCD_ResetCallback(hpcd);
560     HAL_PCD_SetAddress(hpcd, 0);
561   }
562
563   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_PMAOVRM))
564   {
565     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_PMAOVRM);    
566   }
567   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_ERR))
568   {
569     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_ERR); 
570   }
571
572   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_WKUP))
573   {  
574     hpcd->Instance->CNTR &= ~(USB_CNTR_LP_MODE);
575     
576     /*set wInterrupt_Mask global variable*/
577     wInterrupt_Mask = USB_CNTR_CTRM  | USB_CNTR_WKUPM | USB_CNTR_SUSPM | USB_CNTR_ERRM \
578       | USB_CNTR_ESOFM | USB_CNTR_RESETM;
579     
580     /*Set interrupt mask*/
581     hpcd->Instance->CNTR = wInterrupt_Mask;
582     
583     HAL_PCD_ResumeCallback(hpcd);
584     
585     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_WKUP);     
586   }
587
588   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_SUSP))
589   {    
590     /* clear of the ISTR bit must be done after setting of CNTR_FSUSP */
591     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_SUSP);  
592     
593     /* Force low-power mode in the macrocell */
594     hpcd->Instance->CNTR |= USB_CNTR_FSUSP;
595     hpcd->Instance->CNTR |= USB_CNTR_LP_MODE;
596     if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_WKUP) == 0)
597     {
598       HAL_PCD_SuspendCallback(hpcd);
599     }
600   }
601
602   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_SOF))
603   {
604     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_SOF); 
605     HAL_PCD_SOFCallback(hpcd);
606   }
607
608   if (__HAL_PCD_GET_FLAG (hpcd, USB_ISTR_ESOF))
609   {
610     /* clear ESOF flag in ISTR */
611     __HAL_PCD_CLEAR_FLAG(hpcd, USB_ISTR_ESOF); 
612   }
613 }
614
615 /**
616   * @brief  Data out stage callbacks
617   * @param  hpcd: PCD handle
618   * @param  epnum: endpoint number
619   * @retval None
620   */
621  __weak void HAL_PCD_DataOutStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
622 {
623   /* NOTE : This function Should not be modified, when the callback is needed,
624             the HAL_PCD_DataOutStageCallback could be implemented in the user file
625    */ 
626 }
627
628 /**
629   * @brief  Data IN stage callbacks
630   * @param  hpcd: PCD handle
631   * @param  epnum: endpoint number
632   * @retval None
633   */
634  __weak void HAL_PCD_DataInStageCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
635 {
636   /* NOTE : This function Should not be modified, when the callback is needed,
637             the HAL_PCD_DataInStageCallback could be implemented in the user file
638    */ 
639 }
640 /**
641   * @brief  Setup stage callback
642   * @param  hpcd: ppp handle
643   * @retval None
644   */
645  __weak void HAL_PCD_SetupStageCallback(PCD_HandleTypeDef *hpcd)
646 {
647   /* NOTE : This function Should not be modified, when the callback is needed,
648             the HAL_PCD_SetupStageCallback could be implemented in the user file
649    */ 
650 }
651
652 /**
653   * @brief  USB Start Of Frame callbacks
654   * @param  hpcd: PCD handle
655   * @retval None
656   */
657  __weak void HAL_PCD_SOFCallback(PCD_HandleTypeDef *hpcd)
658 {
659   /* NOTE : This function Should not be modified, when the callback is needed,
660             the HAL_PCD_SOFCallback could be implemented in the user file
661    */ 
662 }
663
664 /**
665   * @brief  USB Reset callbacks
666   * @param  hpcd: PCD handle
667   * @retval None
668   */
669  __weak void HAL_PCD_ResetCallback(PCD_HandleTypeDef *hpcd)
670 {
671   /* NOTE : This function Should not be modified, when the callback is needed,
672             the HAL_PCD_ResetCallback could be implemented in the user file
673    */ 
674 }
675
676 /**
677   * @brief  Suspend event callbacks
678   * @param  hpcd: PCD handle
679   * @retval None
680   */
681  __weak void HAL_PCD_SuspendCallback(PCD_HandleTypeDef *hpcd)
682 {
683   /* NOTE : This function Should not be modified, when the callback is needed,
684             the HAL_PCD_SuspendCallback could be implemented in the user file
685    */ 
686 }
687
688 /**
689   * @brief  Resume event callbacks
690   * @param  hpcd: PCD handle
691   * @retval None
692   */
693  __weak void HAL_PCD_ResumeCallback(PCD_HandleTypeDef *hpcd)
694 {
695   /* NOTE : This function Should not be modified, when the callback is needed,
696             the HAL_PCD_ResumeCallback could be implemented in the user file
697    */ 
698 }
699
700 /**
701   * @brief  Incomplete ISO OUT callbacks
702   * @param  hpcd: PCD handle
703   * @param  epnum: endpoint number
704   * @retval None
705   */
706  __weak void HAL_PCD_ISOOUTIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
707 {
708   /* NOTE : This function Should not be modified, when the callback is needed,
709             the HAL_PCD_ISOOUTIncompleteCallback could be implemented in the user file
710    */ 
711 }
712
713 /**
714   * @brief  Incomplete ISO IN  callbacks
715   * @param  hpcd: PCD handle
716   * @param  epnum: endpoint number
717   * @retval None
718   */
719  __weak void HAL_PCD_ISOINIncompleteCallback(PCD_HandleTypeDef *hpcd, uint8_t epnum)
720 {
721   /* NOTE : This function Should not be modified, when the callback is needed,
722             the HAL_PCD_ISOINIncompleteCallback could be implemented in the user file
723    */ 
724 }
725
726 /**
727   * @brief  Connection event callbacks
728   * @param  hpcd: PCD handle
729   * @retval None
730   */
731  __weak void HAL_PCD_ConnectCallback(PCD_HandleTypeDef *hpcd)
732 {
733   /* NOTE : This function Should not be modified, when the callback is needed,
734             the HAL_PCD_ConnectCallback could be implemented in the user file
735    */ 
736 }
737
738 /**
739   * @brief  Disconnection event callbacks
740   * @param  hpcd: ppp handle
741   * @retval None
742   */
743  __weak void HAL_PCD_DisconnectCallback(PCD_HandleTypeDef *hpcd)
744 {
745   /* NOTE : This function Should not be modified, when the callback is needed,
746             the HAL_PCD_DisconnectCallback could be implemented in the user file
747    */ 
748 }
749 /**
750   * @}
751   */
752   
753 /** @defgroup PCD_Exported_Functions_Group3 Peripheral Control functions 
754  *  @brief   management functions 
755  *
756 @verbatim   
757  ===============================================================================
758                       ##### Peripheral Control functions #####
759  ===============================================================================  
760     [..]
761     This subsection provides a set of functions allowing to control the PCD data 
762     transfers.
763
764 @endverbatim
765   * @{
766   */
767
768 /**
769   * @brief  Connect the USB device 
770   * @param  hpcd: PCD handle
771   * @retval HAL status
772   */
773 HAL_StatusTypeDef HAL_PCD_DevConnect(PCD_HandleTypeDef *hpcd)
774 {
775   __HAL_LOCK(hpcd); 
776   
777   /* Enabling DP Pull-Down bit to Connect internal pull-up on USB DP line */
778    HAL_PCDEx_SetConnectionState(hpcd, 1);
779   
780   __HAL_UNLOCK(hpcd); 
781   return HAL_OK;
782 }
783
784 /**
785   * @brief  Disconnect the USB device 
786   * @param  hpcd: PCD handle
787   * @retval HAL status
788   */
789 HAL_StatusTypeDef HAL_PCD_DevDisconnect(PCD_HandleTypeDef *hpcd)
790 {
791   __HAL_LOCK(hpcd); 
792   
793   /* Disable DP Pull-Down bit*/
794   HAL_PCDEx_SetConnectionState(hpcd, 0);
795   
796   __HAL_UNLOCK(hpcd); 
797   return HAL_OK;
798 }
799
800 /**
801   * @brief  Set the USB Device address 
802   * @param  hpcd: PCD handle
803   * @param  address: new device address
804   * @retval HAL status
805   */
806 HAL_StatusTypeDef HAL_PCD_SetAddress(PCD_HandleTypeDef *hpcd, uint8_t address)
807 {
808    __HAL_LOCK(hpcd); 
809
810    if(address == 0) 
811    {
812      /* set device address and enable function */
813      hpcd->Instance->DADDR = USB_DADDR_EF;
814    }
815    else /* USB Address will be applied later */
816    {
817      hpcd->USB_Address = address;
818    }
819
820   __HAL_UNLOCK(hpcd);   
821   return HAL_OK;
822 }
823 /**
824   * @brief  Open and configure an endpoint
825   * @param  hpcd: PCD handle
826   * @param  ep_addr: endpoint address
827   * @param  ep_mps: endpoint max packert size
828   * @param  ep_type: endpoint type   
829   * @retval HAL status
830   */
831 HAL_StatusTypeDef HAL_PCD_EP_Open(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint16_t ep_mps, uint8_t ep_type)
832 {
833   HAL_StatusTypeDef  ret = HAL_OK;
834   PCD_EPTypeDef *ep;
835   
836   if ((ep_addr & 0x80) == 0x80)
837   {
838     ep = &hpcd->IN_ep[ep_addr & 0x7F];
839   }
840   else
841   {
842     ep = &hpcd->OUT_ep[ep_addr & 0x7F];
843   }
844   ep->num   = ep_addr & 0x7F;
845   
846   ep->is_in = (0x80 & ep_addr) != 0;
847   ep->maxpacket = ep_mps;
848   ep->type = ep_type;
849   
850   __HAL_LOCK(hpcd); 
851
852 /* initialize Endpoint */
853   switch (ep->type)
854   {
855   case PCD_EP_TYPE_CTRL:
856     PCD_SET_EPTYPE(hpcd->Instance, ep->num, USB_EP_CONTROL);
857     break;
858   case PCD_EP_TYPE_BULK:
859     PCD_SET_EPTYPE(hpcd->Instance, ep->num, USB_EP_BULK);
860     break;
861   case PCD_EP_TYPE_INTR:
862     PCD_SET_EPTYPE(hpcd->Instance, ep->num, USB_EP_INTERRUPT);
863     break;
864   case PCD_EP_TYPE_ISOC:
865     PCD_SET_EPTYPE(hpcd->Instance, ep->num, USB_EP_ISOCHRONOUS);
866     break;
867   } 
868   
869   PCD_SET_EP_ADDRESS(hpcd->Instance, ep->num, ep->num);
870   
871   if (ep->doublebuffer == 0) 
872   {
873     if (ep->is_in)
874     {
875       /*Set the endpoint Transmit buffer address */
876       PCD_SET_EP_TX_ADDRESS(hpcd->Instance, ep->num, ep->pmaadress);
877       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
878       /* Configure NAK status for the Endpoint*/
879       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_NAK); 
880     }
881     else
882     {
883       /*Set the endpoint Receive buffer address */
884       PCD_SET_EP_RX_ADDRESS(hpcd->Instance, ep->num, ep->pmaadress);
885       /*Set the endpoint Receive buffer counter*/
886       PCD_SET_EP_RX_CNT(hpcd->Instance, ep->num, ep->maxpacket);
887       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
888       /* Configure VALID status for the Endpoint*/
889       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID);
890     }
891   }
892   /*Double Buffer*/
893   else
894   {
895     /*Set the endpoint as double buffered*/
896     PCD_SET_EP_DBUF(hpcd->Instance, ep->num);
897     /*Set buffer address for double buffered mode*/
898     PCD_SET_EP_DBUF_ADDR(hpcd->Instance, ep->num,ep->pmaaddr0, ep->pmaaddr1);
899     
900     if (ep->is_in==0)
901     {
902       /* Clear the data toggle bits for the endpoint IN/OUT*/
903       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
904       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
905       
906       /* Reset value of the data toggle bits for the endpoint out*/
907       PCD_TX_DTOG(hpcd->Instance, ep->num);
908       
909       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID);
910       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_DIS);
911     }
912     else
913     {
914       /* Clear the data toggle bits for the endpoint IN/OUT*/
915       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
916       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
917       PCD_RX_DTOG(hpcd->Instance, ep->num);
918       /* Configure DISABLE status for the Endpoint*/
919       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_DIS);
920       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_DIS);
921     }
922   } 
923   
924   __HAL_UNLOCK(hpcd);   
925   return ret;
926 }
927
928
929 /**
930   * @brief  Deactivate an endpoint
931   * @param  hpcd: PCD handle
932   * @param  ep_addr: endpoint address
933   * @retval HAL status
934   */
935 HAL_StatusTypeDef HAL_PCD_EP_Close(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
936 {  
937   PCD_EPTypeDef *ep;
938   
939   if ((ep_addr & 0x80) == 0x80)
940   {
941     ep = &hpcd->IN_ep[ep_addr & 0x7F];
942   }
943   else
944   {
945     ep = &hpcd->OUT_ep[ep_addr & 0x7F];
946   }
947   ep->num   = ep_addr & 0x7F;
948   
949   ep->is_in = (0x80 & ep_addr) != 0;
950   
951   __HAL_LOCK(hpcd); 
952
953   if (ep->doublebuffer == 0) 
954   {
955     if (ep->is_in)
956     {
957       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
958       /* Configure DISABLE status for the Endpoint*/
959       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_DIS); 
960     }
961     else
962     {
963       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
964       /* Configure DISABLE status for the Endpoint*/
965       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_DIS);
966     }
967   }
968   /*Double Buffer*/
969   else
970   { 
971     if (ep->is_in==0)
972     {
973       /* Clear the data toggle bits for the endpoint IN/OUT*/
974       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
975       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
976       
977       /* Reset value of the data toggle bits for the endpoint out*/
978       PCD_TX_DTOG(hpcd->Instance, ep->num);
979       
980       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_DIS);
981       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_DIS);
982     }
983     else
984     {
985       /* Clear the data toggle bits for the endpoint IN/OUT*/
986       PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
987       PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
988       PCD_RX_DTOG(hpcd->Instance, ep->num);
989       /* Configure DISABLE status for the Endpoint*/
990       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_DIS);
991       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_DIS);
992     }
993   } 
994   
995   __HAL_UNLOCK(hpcd);   
996   return HAL_OK;
997 }
998
999
1000 /**
1001   * @brief  Receive an amount of data  
1002   * @param  hpcd: PCD handle
1003   * @param  ep_addr: endpoint address
1004   * @param  pBuf: pointer to the reception buffer   
1005   * @param  len: amount of data to be received
1006   * @retval HAL status
1007   */
1008 HAL_StatusTypeDef HAL_PCD_EP_Receive(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
1009 {
1010   
1011  PCD_EPTypeDef *ep;
1012   
1013   ep = &hpcd->OUT_ep[ep_addr & 0x7F];
1014   
1015   /*setup and start the Xfer */
1016   ep->xfer_buff = pBuf;  
1017   ep->xfer_len = len;
1018   ep->xfer_count = 0;
1019   ep->is_in = 0;
1020   ep->num = ep_addr & 0x7F;
1021    
1022   __HAL_LOCK(hpcd); 
1023    
1024   /* Multi packet transfer*/
1025   if (ep->xfer_len > ep->maxpacket)
1026   {
1027     len=ep->maxpacket;
1028     ep->xfer_len-=len; 
1029   }
1030   else
1031   {
1032     len=ep->xfer_len;
1033     ep->xfer_len =0;
1034   }
1035   
1036   /* configure and validate Rx endpoint */
1037   if (ep->doublebuffer == 0) 
1038   {
1039     /*Set RX buffer count*/
1040     PCD_SET_EP_RX_CNT(hpcd->Instance, ep->num, len);
1041   }
1042   else
1043   {
1044     /*Set the Double buffer counter*/
1045     PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, len);
1046   } 
1047   
1048   PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID);
1049   
1050   __HAL_UNLOCK(hpcd); 
1051   
1052   return HAL_OK;
1053 }
1054
1055 /**
1056   * @brief  Get Received Data Size
1057   * @param  hpcd: PCD handle
1058   * @param  ep_addr: endpoint address
1059   * @retval Data Size
1060   */
1061 uint16_t HAL_PCD_EP_GetRxCount(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
1062 {
1063   return hpcd->OUT_ep[ep_addr & 0x7F].xfer_count;
1064 }
1065 /**
1066   * @brief  Send an amount of data  
1067   * @param  hpcd: PCD handle
1068   * @param  ep_addr: endpoint address
1069   * @param  pBuf: pointer to the transmission buffer   
1070   * @param  len: amount of data to be sent
1071   * @retval HAL status
1072   */
1073 HAL_StatusTypeDef HAL_PCD_EP_Transmit(PCD_HandleTypeDef *hpcd, uint8_t ep_addr, uint8_t *pBuf, uint32_t len)
1074 {
1075   PCD_EPTypeDef *ep;
1076   uint16_t pmabuffer = 0;
1077     
1078   ep = &hpcd->IN_ep[ep_addr & 0x7F];
1079   
1080   /*setup and start the Xfer */
1081   ep->xfer_buff = pBuf;  
1082   ep->xfer_len = len;
1083   ep->xfer_count = 0;
1084   ep->is_in = 1;
1085   ep->num = ep_addr & 0x7F;
1086   
1087   __HAL_LOCK(hpcd); 
1088   
1089   /*Multi packet transfer*/
1090   if (ep->xfer_len > ep->maxpacket)
1091   {
1092     len=ep->maxpacket;
1093     ep->xfer_len-=len; 
1094   }
1095   else
1096   {  
1097     len=ep->xfer_len;
1098     ep->xfer_len =0;
1099   }
1100   
1101   /* configure and validate Tx endpoint */
1102   if (ep->doublebuffer == 0) 
1103   {
1104     PCD_WritePMA(hpcd->Instance, ep->xfer_buff, ep->pmaadress, len);
1105     PCD_SET_EP_TX_CNT(hpcd->Instance, ep->num, len);
1106   }
1107   else
1108   {
1109     /*Set the Double buffer counter*/
1110     PCD_SET_EP_DBUF1_CNT(hpcd->Instance, ep->num, ep->is_in, len);
1111     
1112     /*Write the data to the USB endpoint*/
1113     if (PCD_GET_ENDPOINT(hpcd->Instance, ep->num)& USB_EP_DTOG_TX)
1114     {
1115       pmabuffer = ep->pmaaddr1;
1116     }
1117     else
1118     {
1119       pmabuffer = ep->pmaaddr0;
1120     }
1121     PCD_WritePMA(hpcd->Instance, ep->xfer_buff, pmabuffer, len);
1122     PCD_FreeUserBuffer(hpcd->Instance, ep->num, ep->is_in);
1123   }
1124
1125   PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_VALID);
1126   
1127   __HAL_UNLOCK(hpcd);
1128      
1129   return HAL_OK;
1130 }
1131
1132 /**
1133   * @brief  Set a STALL condition over an endpoint
1134   * @param  hpcd: PCD handle
1135   * @param  ep_addr: endpoint address
1136   * @retval HAL status
1137   */
1138 HAL_StatusTypeDef HAL_PCD_EP_SetStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
1139 {
1140   PCD_EPTypeDef *ep;
1141    
1142   __HAL_LOCK(hpcd); 
1143    
1144   if ((0x80 & ep_addr) == 0x80)
1145   {
1146     ep = &hpcd->IN_ep[ep_addr & 0x7F];
1147   }
1148   else
1149   {
1150     ep = &hpcd->OUT_ep[ep_addr];
1151   }
1152   
1153   ep->is_stall = 1;
1154   ep->num   = ep_addr & 0x7F;
1155   ep->is_in = ((ep_addr & 0x80) == 0x80);
1156   
1157   if (ep->num == 0)
1158   {
1159     /* This macro sets STALL status for RX & TX*/ 
1160     PCD_SET_EP_TXRX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_STALL, USB_EP_TX_STALL); 
1161   }
1162   else
1163   {
1164     if (ep->is_in)
1165     {
1166       PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num , USB_EP_TX_STALL); 
1167     }
1168     else
1169     {
1170       PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num , USB_EP_RX_STALL);
1171     }
1172   }
1173   __HAL_UNLOCK(hpcd); 
1174   
1175   return HAL_OK;
1176 }
1177
1178 /**
1179   * @brief  Clear a STALL condition over in an endpoint
1180   * @param  hpcd: PCD handle
1181   * @param  ep_addr: endpoint address
1182   * @retval HAL status
1183   */
1184 HAL_StatusTypeDef HAL_PCD_EP_ClrStall(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
1185 {
1186   PCD_EPTypeDef *ep;
1187   
1188   if ((0x80 & ep_addr) == 0x80)
1189   {
1190     ep = &hpcd->IN_ep[ep_addr & 0x7F];
1191   }
1192   else
1193   {
1194     ep = &hpcd->OUT_ep[ep_addr];
1195   }
1196   
1197   ep->is_stall = 0;
1198   ep->num   = ep_addr & 0x7F;
1199   ep->is_in = ((ep_addr & 0x80) == 0x80);
1200   
1201   __HAL_LOCK(hpcd); 
1202   
1203   if (ep->is_in)
1204   {
1205     PCD_CLEAR_TX_DTOG(hpcd->Instance, ep->num);
1206     PCD_SET_EP_TX_STATUS(hpcd->Instance, ep->num, USB_EP_TX_VALID);
1207   }
1208   else
1209   {
1210     PCD_CLEAR_RX_DTOG(hpcd->Instance, ep->num);
1211     PCD_SET_EP_RX_STATUS(hpcd->Instance, ep->num, USB_EP_RX_VALID);
1212   }
1213   __HAL_UNLOCK(hpcd); 
1214     
1215   return HAL_OK;
1216 }
1217
1218 /**
1219   * @brief  Flush an endpoint
1220   * @param  hpcd: PCD handle
1221   * @param  ep_addr: endpoint address
1222   * @retval HAL status
1223   */
1224 HAL_StatusTypeDef HAL_PCD_EP_Flush(PCD_HandleTypeDef *hpcd, uint8_t ep_addr)
1225
1226   return HAL_OK;
1227 }
1228
1229 /**
1230   * @brief  HAL_PCD_ActiveRemoteWakeup : active remote wakeup signalling
1231   * @param  hpcd: PCD handle
1232   * @retval status
1233   */
1234 HAL_StatusTypeDef HAL_PCD_ActiveRemoteWakeup(PCD_HandleTypeDef *hpcd)
1235 {
1236   hpcd->Instance->CNTR |= USB_CNTR_RESUME;
1237   return HAL_OK;  
1238 }
1239
1240 /**
1241   * @brief  HAL_PCD_DeActiveRemoteWakeup : de-active remote wakeup signalling
1242   * @param  hpcd: PCD handle
1243   * @retval status
1244   */
1245 HAL_StatusTypeDef HAL_PCD_DeActiveRemoteWakeup(PCD_HandleTypeDef *hpcd)
1246 {
1247   hpcd->Instance->CNTR &= ~(USB_CNTR_RESUME);
1248   return HAL_OK;  
1249 }
1250
1251 /**
1252   * @}
1253   */
1254   
1255 /** @defgroup PCD_Exported_Functions_Group4 Peripheral State functions 
1256  *  @brief   Peripheral State functions 
1257  *
1258 @verbatim   
1259  ===============================================================================
1260                       ##### Peripheral State functions #####
1261  ===============================================================================  
1262     [..]
1263     This subsection permit to get in run-time the status of the peripheral 
1264     and the data flow.
1265
1266 @endverbatim
1267   * @{
1268   */
1269
1270 /**
1271   * @brief  Return the PCD state
1272   * @param  hpcd : PCD handle
1273   * @retval HAL state
1274   */
1275 PCD_StateTypeDef HAL_PCD_GetState(PCD_HandleTypeDef *hpcd)
1276 {
1277   return hpcd->State;
1278 }
1279 /**
1280   * @}
1281   */
1282
1283
1284 /**
1285   * @}
1286   */
1287
1288 #endif /* STM32F302xE || STM32F303xE || */
1289        /* STM32F302xC || STM32F303xC || */
1290        /* STM32F302x8                || */
1291        /* STM32F373xC                   */
1292
1293 #endif /* HAL_PCD_MODULE_ENABLED */
1294 /**
1295   * @}
1296   */
1297
1298 /**
1299   * @}
1300   */
1301
1302 /************************ (C) COPYRIGHT STMicroelectronics *****END OF FILE****/