📄 usbdriver.lst
字号:
219 2
220 2 #if DMA_ENGINE_EN
if (usb_ints & USBINT_STATUS_DMA)
USB_DMAService(); /* DMA中断处理 process DMA Interrupt */
#endif
224 2 }
225 1
226 1 USB_ISR_EXIT:
227 1 bEPPflags.bits.in_isr = 0; /* 标识程序退出中断 flag the program exit interrupt */
228 1 VICVectAddr = 0x00; /* 通知LPC214x中断结束 Inform LPC214x interrupt end */
229 1 }
230
231
232 /********************************************************************************************************
-*******
233 ** 函数名称 : Usb_HPService() Name : Usb_HPService()
234 ** 功能描述 : USB 端点高速中断服务程序 Function : USB endpoint fast Interrupt Service Program
235 ** 输 入 : 无 Input : NULL
236 ** 输 出 : 无 Output : NULL
237 *********************************************************************************************************
-*******/
238 void Usb_HPService(void)
239 {
240 1 INT32U ep_st;
241 1
242 1 ep_st = USBEpIntSt; /* 读端点中断状态寄存器 read endpoint interrupt status register */
243 1
244 1 if(ep_st & USB_ENDP00)
245 1 ep0_rxdone(); /* 控制端点接收数据处理 process controll endpoint receive data */
246 1 if(ep_st & USB_ENDP01)
247 1 ep0_txdone(); /* 控制端点发送数据处理 process controll endpoint transmit data */
ARM COMPILER V2.53, USBDriver 28/06/07 09:54:12 PAGE 5
248 1
249 1 if(ep_st & USB_ENDP02)
250 1 ep1_rxdone(); /* 逻辑端点1接收数据处理 process logic endpoint 1 receive data */
251 1 if(ep_st & USB_ENDP03)
252 1 ep1_txdone(); /* 逻辑端点1发送数据处理 process logic endpoint 1 transmit data */
253 1
254 1 if(ep_st & USB_ENDP04)
255 1 ep2_rxdone(); /* 逻辑端点2接收数据处理 process logic endpoint 2 receive data */
256 1 if(ep_st & USB_ENDP05)
257 1 ep2_txdone(); /* 逻辑端点2发送数据处理 process logic endpoint 2 transmit data */
258 1
259 1 USBDevIntClr = FASTINTERRUPT;
260 1 }
261
262
263 /********************************************************************************************************
-*******
264 ** 函数名称 : Usb_LPService() Name : Usb_LPService()
265 ** 功能描述 : USB 端点慢速中断服务程序 Function : USB endpoint slow Interrupt Service Program
266 ** 输 入 : 无 Input : NULL
267 ** 输 出 : 无 Output : NULL
268 *********************************************************************************************************
-*******/
269 void Usb_LPService(void)
270 {
271 1 INT32U ep_st;
272 1
273 1 ep_st = USBEpIntSt; /* 读端点中断状态寄存器 read endpoint interrupt status register */
274 1
275 1 if(ep_st & USB_ENDP00)
276 1 ep0_rxdone(); /* 控制端点接收数据处理 process controll endpoint receive data */
277 1 if(ep_st & USB_ENDP01)
278 1 ep0_txdone(); /* 控制端点发送数据处理 process controll endpoint transmit data */
279 1
280 1 if(ep_st & USB_ENDP02)
281 1 ep1_rxdone(); /* 端点1接收数据处理 process logic endpoint 1 receive data */
282 1 if(ep_st & USB_ENDP03)
283 1 ep1_txdone(); /* 端点1发送数据处理 process logic endpoint 1 transmit data */
284 1
285 1 if(ep_st & USB_ENDP04)
286 1 ep2_rxdone(); /* 端点2接收数据处理 process logic endpoint 2 receive data */
287 1 if(ep_st & USB_ENDP05)
288 1 ep2_txdone(); /* 端点2发送数据处理 process logic endpoint 2 transmit data */
289 1
290 1 USBDevIntClr = SLOWINTERRUPT;
291 1 }
292
293
294 /********************************************************************************************************
-*******
295 ** 函数名称 : ep1_txdone() Name : ep1_txdone()
296 ** 功能描述 : 逻辑端点1发送数据处理 Function : logic endpoint 1 TX
297 ** 输 入 : 无 Input : NULL
298 ** 输 出 : 无 Output : NULL
299 *********************************************************************************************************
-*******/
300 void ep1_txdone(void)
301 {
302 1 USB_SelectClrIntEndpoint(3); /* 选择端点并清除中断 select endpoint/clear interrupt */
303 1 }
304
305
306 /********************************************************************************************************
-*******
307 ** 函数名称 : ep1_txdone() Name : ep1_txdone()
308 ** 功能描述 : 逻辑端点1接收数据处理 Function : logic endpoint 1 RX
ARM COMPILER V2.53, USBDriver 28/06/07 09:54:12 PAGE 6
309 ** 输 入 : 无 Input : NULL
310 ** 输 出 : 无 Output : NULL
311 *********************************************************************************************************
-*******/
312 void ep1_rxdone(void)
313 {
314 1 INT8U len;
315 1
316 1 USB_SelectClrIntEndpoint(2); /* 选择端点并清除中断 select endpoint/clear interrupt */
317 1
318 1 len = USB_ReadEndpoint(2,sizeof(GenEpBuf),GenEpBuf); /* 从接收缓冲区中读出数据 read data from EP RAM */
319 1 if(len != 0)
320 1 bEPPflags.bits.ep1_rxdone = 1; /* 标识该端点收到数据 flag endpoint received data */
321 1 }
322
323
324 /********************************************************************************************************
-*******
325 ** 函数名称 : ep2_txdone() Name : ep2_txdone()
326 ** 功能描述 : 逻辑端点2发送数据处理 Function : logic endpoint 2 TX
327 ** 输 入 : 无 Input : NULL
328 ** 输 出 : 无 Output : NULL
329 *********************************************************************************************************
-*******/
330 void ep2_txdone(void)
331 {
332 1 USB_SelectClrIntEndpoint(5); /* 选择端点并清除中断 select endpoint/clear interrupt */
333 1 }
334
335
336 /********************************************************************************************************
-*******
337 ** 函数名称 : ep2_rxdone() Name : ep2_rxdone()
338 ** 功能描述 : 逻辑端点2接收数据处理 Function : logic endpoint 2 RX
339 ** 输 入 : 无 Input : NULL
340 ** 输 出 : 无 Output : NULL
341 *********************************************************************************************************
-*******/
342 void ep2_rxdone(void)
343 {
344 1 INT8U len;
345 1
346 1 USB_SelectClrIntEndpoint(4); /* 选择端点并清除中断 select endpoint/clear interrupt */
347 1
348 1 len = USB_ReadEndpoint(4,sizeof(EpBuf),EpBuf); /* 从接收缓冲区中读出数据 read data from EP RAM */
349 1 if (len != 0)
350 1 bEPPflags.bits.ep2_rxdone = 1; /* 标识该端点收到数据 flag endpoint received data */
351 1 }
352
353
354 /********************************************************************************************************
-*******
355 ** 函数名称 : USB_BusReset() Name : USB_BusReset()
356 ** 功能描述 : USB 总线复位处理 Function : process USB bus reset
357 ** 输 入 : 无 Input : NULL
358 ** 输 出 : 无 Output : NULL
359 *********************************************************************************************************
-*******/
360 void USB_BusReset(void)
361 {
362 1 USB_USBDevIntConfig();
363 1 USB_ConfigEndpoint(); /* 重新配置所有端点最大包大小 */
364 1 }
365
366
367 /********************************************************************************************************
ARM COMPILER V2.53, USBDriver 28/06/07 09:54:12 PAGE 7
-*******
368 ** 函数名称 : USB_Suspend() Name : USB_Suspend()
369 ** 功能描述 : USB 总线挂起改变 Function : process USB bus suspend change
370 ** 输 入 : 无 Input : NULL
371 ** 输 出 : 无 Output : NULL
372 *********************************************************************************************************
-*******/
373 void USB_SuspendChange(void)
374 {
375 1
376 1 }
377
378
379 /********************************************************************************************************
-*******
380 ** 函数名称 : USB_ConnectChange() Name : USB_ConnectChange()
381 ** 功能描述 : USB 总线连接改变 Function : process USB bus connect change
382 ** 输 入 : 无 Input : NULL
383 ** 输 出 : 无 Output : NULL
384 *********************************************************************************************************
-*******/
385 void USB_ConnectChange(void)
386 {
387 1
388 1 }
389
390
391 /********************************************************************************************************
-*******
392 ** 函数名称 : Get_USB214x_FirmwareVer() Name : Get_USB214x_FirmwareVer()
393 ** 功能描述 : 取得LPC214x USB固件版本号 Function : get the version of LPC214x USB firmware
394 ** 输 入 : 无 Input : NULL
395 ** 输 出 : 16位版本号 Output : 16bit Version Code
396 *********************************************************************************************************
-*******/
397 INT16U Get_USB214x_FirmwareVer(void)
398 {
399 1 return 0x0100; /* LPC214x USB 固件版本为 1.00 */
400 1 } /* LPC214x USB Firmware Version is 1.00 */
401
402
403 //***********************************************************************************
404 void ENABLE(void)
405 {
406 1 VICIntEnable = 1 << 22 ; //enable USB interrupt
407 1 }
408
409 void DISABLE(void)
410 {
411 1 VICIntEnClr = 1 << 22 ; //disable USB interrupt
412 1
413 1 }
414
415 void Init_USBInterrupt(void)
416 {
417 1
418 1 VICVectAddr0 = (INT32U)Usb_Exception; //USB中断服务程序地址
419 1 VICVectCntl0 = ( 0x20 | 22 ); //USB中断分配到中断向量0
420 1 VICIntEnable = 1 << 22; //使能USB中断
421 1 USBDevIntEn = DEV_STAT; // Enable Device Status Interrupt
422 1 }
423 /*******************************************************************************************************
424 ** End Of File
425 ********************************************************************************************************/
ARM COMPILER V2.53, USBDriver 28/06/07 09:54:12 PAGE 8
ASSEMBLY LISTING OF GENERATED OBJECT CODE
*** EXTERNALS:
EXTERN CODE16 (USB_InitHareware?T)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -