Blame view

Src/gd32f30x_it.c 6.62 KB
95ce2328   李外   完成USB移植,测试正常,
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
  /*!
      \file    gd32f30x_it.c
      \brief   main interrupt service routines
  
      \version 2020-08-01, V3.0.0, firmware for GD32F30x
  */
  
  /*
      Copyright (c) 2020, GigaDevice Semiconductor Inc.
  
      Redistribution and use in source and binary forms, with or without modification, 
  are permitted provided that the following conditions are met:
  
      1. Redistributions of source code must retain the above copyright notice, this 
         list of conditions and the following disclaimer.
      2. Redistributions in binary form must reproduce the above copyright notice, 
         this list of conditions and the following disclaimer in the documentation 
         and/or other materials provided with the distribution.
      3. Neither the name of the copyright holder nor the names of its contributors 
         may be used to endorse or promote products derived from this software without 
         specific prior written permission.
  
      THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 
  AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY 
  OF SUCH DAMAGE.
  */
  
  #include "gd32f30x_it.h"
  #include "usbd_lld_int.h"
  #include "custom_hid_core.h"
  #include "HW_MCUIO.h"
  #include "platform.h"
  #include 	"base_core_user.h"
88180837   李外   1、移植何工名单管理功能;
41
  
95ce2328   李外   完成USB移植,测试正常,
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
  extern usb_dev usbd_custom_hid;
  
  uint8_t Send_Buffer[4] = {0x00, 0x01, 0x00, 0x01};
  
  /*!
      \brief      this function handles NMI exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void NMI_Handler(void)
  {
  }
  
  /*!
      \brief      this function handles HardFault exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void HardFault_Handler(void)
  {
      /* if Hard Fault exception occurs, go to infinite loop */
      while (1);
  }
  
  /*!
      \brief      this function handles MemManage exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void MemManage_Handler(void)
  {
      /* if Memory Manage exception occurs, go to infinite loop */
      while (1);
  }
  
  /*!
      \brief      this function handles BusFault exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void BusFault_Handler(void)
  {
      /* if Bus Fault exception occurs, go to infinite loop */
      while (1);
  }
  
  /*!
      \brief      this function handles UsageFault exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void UsageFault_Handler(void)
  {
      /* if Usage Fault exception occurs, go to infinite loop */
      while (1);
  }
  
  /*!
      \brief      this function handles SVC exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void SVC_Handler(void)
  {
  }
  
  /*!
      \brief      this function handles DebugMon exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void DebugMon_Handler(void)
  {
  }
  
  /*!
      \brief      this function handles PendSV exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void PendSV_Handler(void)
  {
  }
  
  /*!
      \brief      this function handles SysTick exception
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void SysTick_Handler(void)
  {
      HW_GD_IncTick();
  }
  
  void TIMER1_IRQHandler(void)
  {
      if (RESET != timer_interrupt_flag_get(TIMER1, TIMER_INT_FLAG_UP))
      {
          timer_interrupt_flag_clear(TIMER1, TIMER_INT_FLAG_UP);
  
          base_core.timer_2ms5_enter();
  		void user_2ms5_timer(void);
          user_2ms5_timer();
      }
  }
  
  void TIMER2_IRQHandler(void)
  {
4fe99ff7   李外   SPI移植完成,RF功能测试通过,...
159
      if (RESET != timer_interrupt_flag_get(TIMER2, TIMER_INT_FLAG_UP))
95ce2328   李外   完成USB移植,测试正常,
160
      {
4fe99ff7   李外   SPI移植完成,RF功能测试通过,...
161
          timer_interrupt_flag_clear(TIMER2, TIMER_INT_FLAG_UP);
95ce2328   李外   完成USB移植,测试正常,
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
          
          base_core.timer_20ms_enter();
  
          void user_20ms_timer(void);
          user_20ms_timer();
      }
  }
  
  void TIMER3_IRQHandler(void)
  {
      if (RESET != timer_interrupt_flag_get(TIMER1, TIMER_INT_FLAG_UP))
      {
          timer_interrupt_flag_clear(TIMER1, TIMER_INT_FLAG_UP);
          //isr
      }
  }
  /*!
      \brief      this function handles USBD interrupt
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void USBD_LP_CAN0_RX0_IRQHandler (void)
  {
      usbd_isr();
  }
  
0897ce2d   李外   rf 的 SPI暂未调通,还是有问题
189
  void EXTI5_9_IRQHandler(void)
95ce2328   李外   完成USB移植,测试正常,
190
  {
4fe99ff7   李外   SPI移植完成,RF功能测试通过,...
191
      if (RESET != exti_interrupt_flag_get(EXTI_7))
0897ce2d   李外   rf 的 SPI暂未调通,还是有问题
192
193
194
      {
  //        HW_Battery_CHGHandler();
          rf_Irq(3);
4fe99ff7   李外   SPI移植完成,RF功能测试通过,...
195
          exti_interrupt_flag_clear(EXTI_7);
95ce2328   李外   完成USB移植,测试正常,
196
197
198
      }
  }
  
0897ce2d   李外   rf 的 SPI暂未调通,还是有问题
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
  ///*!
  //    \brief      this function handles EXTI0_1_IRQ Handler.
  //    \param[in]  none
  //    \param[out] none
  //    \retval     none
  //*/
  //void EXTI0_IRQHandler (void)
  //{
  //    if (RESET != exti_interrupt_flag_get(EXTI_0)) {//(WAKEUP_KEY_EXTI_LINE)) {
  //        if (USBD_CONFIGURED == usbd_custom_hid.cur_status) {
  //            Send_Buffer[0] = 0x15U; 
  
  ////            if (RESET == gd_eval_key_state_get(KEY_WAKEUP)) {
  ////                if(Send_Buffer[1]) {
  ////                    Send_Buffer[1] = 0x00U;
  ////                } else {
  ////                    Send_Buffer[1] = 0x01U;
  ////                }
  ////            }
  
  //            custom_hid_report_send (&usbd_custom_hid, Send_Buffer, 2U);
  //        }
  
  //        /* clear the EXTI line interrupt flag */
  //        exti_interrupt_flag_clear(EXTI_0);
  //    }
  //}
  
  ///*!
  //    \brief      this function handles EXTI14_15_IRQ Handler.
  //    \param[in]  none
  //    \param[out] none
  //    \retval     none
  //*/
  //void EXTI10_15_IRQHandler (void)
  //{
  //    if (RESET != exti_interrupt_flag_get(EXTI_13)) {//(TAMPER_KEY_EXTI_LINE)) {
  //        if(USBD_CONFIGURED == usbd_custom_hid.cur_status) {
  //            Send_Buffer[2] = 0x16U; 
  
  ////            if (RESET == gd_eval_key_state_get(KEY_TAMPER)) {
  ////                if(Send_Buffer[3]) {
  ////                    Send_Buffer[3] = 0x00U;
  ////                } else {
  ////                    Send_Buffer[3] = 0x01U;
  ////                }
  ////            }
  //            custom_hid_report_send (&usbd_custom_hid, &Send_Buffer[2], 2U);
  //        }
  
  //        /* clear the EXTI line interrupt flag */
  //        exti_interrupt_flag_clear(EXTI_13);
  //    }
  //}
95ce2328   李外   完成USB移植,测试正常,
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
  
  #ifdef USBD_LOWPWR_MODE_ENABLE
  
  /*!
      \brief      this function handles USBD wakeup interrupt request.
      \param[in]  none
      \param[out] none
      \retval     none
  */
  void USBD_WKUP_IRQHandler (void)
  {
      exti_interrupt_flag_clear(EXTI_18);
  }
  
  #endif /* USBD_LOWPWR_MODE_ENABLE */