GD32F10x USB-Device: E:/USB Libraries/GD32_USB_Device_Driver/src/usb_int.c Source File

GD32F103 Firmware

usb_int.c
Go to the documentation of this file.
1 
11 /* Includes ------------------------------------------------------------------*/
12 #include "usb_int.h"
13 
29 extern uint32_t InterruptMask;
30 extern USB_CORE_HANDLE USB_Device_dev;
31 extern USB_INTHandler_TypeDef *USB_INT_fops;
32 
46 void USB_Ifr (void)
47 {
48  __IO uint16_t Ifr = 0;
49  __IO uint16_t Ctlr = 0;
50 
51  Ifr = _GetIFR();
52 
53  if (Ifr & IFR_STIF & InterruptMask)
54  {
55  /* The endpoint successful transfer interrupt service */
56  USB_INT_fops->LP_ST(&USB_Device_dev);
57  }
58 
59  if (Ifr & IFR_RSTIF & InterruptMask)
60  {
61  /* Clear reset interrupt flag in IFR */
62  _SetIFR((uint16_t)CLR_RSTIF);
63 
64  /* USB reset interrupt handle */
65  USB_INT_fops->Reset(&USB_Device_dev);
66  }
67 
68  if (Ifr & IFR_PMOUIF & InterruptMask)
69  {
70  /* Clear packet memory overrun/underrun interrupt flag in IFR */
71  _SetIFR((uint16_t)CLR_PMOUIF);
72 
73  /* USB packet memory overrun/underrun interrrupt handle */
74  USB_INT_fops->PMOU(&USB_Device_dev);
75  }
76 
77  if (Ifr & IFR_ERRIF & InterruptMask)
78  {
79  /* Clear error interrupt flag in IFR */
80  _SetIFR((uint16_t)CLR_ERRIF);
81 
82  /* USB error interrupt handle */
83  USB_INT_fops->Error(&USB_Device_dev);
84  }
85 
86  if (Ifr & IFR_WKUPIF & InterruptMask)
87  {
88  /* Clear wakeup interrupt flag in IFR */
89  _SetIFR((uint16_t)CLR_WKUPIF);
90 
91  /* USB wakeup interrupt handle */
92  USB_INT_fops->WakeUp(&USB_Device_dev);
93  }
94 
95  if (Ifr & IFR_SPSIF & InterruptMask)
96  {
97  /* Process library core layer suspend routine*/
98  USB_INT_fops->Suspend(&USB_Device_dev);
99 
100  /* Clear of suspend interrupt flag bit must be done after setting of CTLR_SETSPS */
101  _SetIFR((uint16_t)CLR_SPSIF);
102  }
103 
104  if (Ifr & IFR_SOFIF & InterruptMask)
105  {
106  /* clear SOF interrupt flag in IFR */
107  _SetIFR((uint16_t)CLR_SOFIF);
108 
109  /* USB SOF interrupt handle */
110  USB_INT_fops->SOF(&USB_Device_dev);
111  }
112 
113  if (Ifr & IFR_ESOFIF & InterruptMask)
114  {
115  /* clear ESOF interrupt flag in IFR */
116  _SetIFR((uint16_t)CLR_ESOFIF);
117 
118  /* USB ESOF interrupt handle */
119  USB_INT_fops->ESOF(&USB_Device_dev);
120  }
121 }
122 
139 /************************ (C) COPYRIGHT 2014 GIGADEVICE *****END OF FILE****/
#define CLR_SOFIF
Definition: usb_regs.h:175
#define IFR_SOFIF
Definition: usb_regs.h:164
#define CLR_RSTIF
Definition: usb_regs.h:174
void USB_Ifr(void)
USB interrupt events service routine.
Definition: usb_int.c:46
#define IFR_PMOUIF
Definition: usb_regs.h:159
#define IFR_WKUPIF
Definition: usb_regs.h:161
USB device interrupt management header file.
#define IFR_STIF
IFR interrupt events bits definitions.
Definition: usb_regs.h:158
#define CLR_SPSIF
Definition: usb_regs.h:173
#define IFR_RSTIF
Definition: usb_regs.h:163
#define CLR_PMOUIF
Definition: usb_regs.h:170
#define IFR_SPSIF
Definition: usb_regs.h:162
#define CLR_ESOFIF
Definition: usb_regs.h:176
#define IFR_ESOFIF
Definition: usb_regs.h:165
#define CLR_ERRIF
Definition: usb_regs.h:171
#define CLR_WKUPIF
Definition: usb_regs.h:172
#define IFR_ERRIF
Definition: usb_regs.h:160
Generated on Fri Feb 6 2015 14:56:35 for GD32F10x USB-Device by   doxygen 1.8.8