⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 vcomuser.lst

📁 针对飞利浦LPC214x的虚拟串口程序
💻 LST
📖 第 1 页 / 共 4 页
字号:
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 1   


ARM COMPILER V2.53, COMPILATION OF MODULE VCOMuser
OBJECT MODULE PLACED IN .\Obj\VCOMuser.obj
COMPILER INVOKED BY: C:\Keil\ARM\BIN\CA.exe VCOMuser.c THUMB BROWSE DEFINE(MCB2140) DEBUG PRINT(.\LST\VCOMUSER.LST) TABS
                    -(4) OBJECT(.\Obj\VCOMuser.obj) 

stmt  level    source

    1          /*----------------------------------------------------------------------------
    2          *      U S B  -  K e r n e l
    3          *----------------------------------------------------------------------------
    4          *      Name:    vcomuser.c
    5          *      Purpose: Virtual COM custom user module file for Philips LPC214x Family 
    6          *       Microprocessors
    7          *      Version: V1.04
    8          *----------------------------------------------------------------------------
    9          *      This software is supplied "AS IS" without any warranties, express, 
   10          *      implied or statutory, including but not limited to the implied 
   11          *      warranties of fitness for purpose, satisfactory quality and 
   12          *      noninfringement. Keil extends you a royalty-free right to reproduce and
   13          *      distribute executable files created using this software for use on 
   14          *      Philips LPC2xxx microcontroller devices only. Nothing else gives you the 
   15          *      right to use this software. 
   16          *
   17          *      Copyright (c) 2005 Keil Software.
   18          *       Modified by Philips Semiconductor
   19          *---------------------------------------------------------------------------*/
   20          #include <string.h>
   21          #include <LPC214x.h>                        /* LPC214x definitions */
   22          
   23          #include "type.h"
   24          #include "usb.h"
   25          #include "usbhw.h"
   26          #include "usbcfg.h"
   27          #include "usbcore.h"
   28          #include "vcomuser.h"
   29          #include "demo.h"
   30          #include "uart.h"
   31          
   32          
   33          
   34          BYTE ReportStatus0 = 0, ReportStatus1 = 0;
   35          BYTE Data2Host0 = 0, Data2Host1 = 0;
   36          
   37          
   38          
   39          /*
   40          *  USB Power Event Callback
   41          *    Parameter:       power: On(TRUE)/Off(FALSE)
   42          */
   43          
   44          #if USB_POWER_EVENT
               void USB_Power_Event (BOOL  power) {
                   power;
               }
               #endif
   49          
   50          
   51          /*
   52          *  USB Reset Event Callback
   53          */
   54          
   55          #if USB_RESET_EVENT
   56          void USB_Reset_Event (void) {
   57   1          USB_ResetCore();
   58   1      }
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 2   

   59          #endif
   60          
   61          
   62          /*
   63          *  USB Suspend Event Callback
   64          */
   65          
   66          #if USB_SUSPEND_EVENT
               void USB_Suspend_Event (void) {
               }
               #endif
   70          
   71          
   72          /*
   73          *  USB Resume Event Callback
   74          */
   75          
   76          #if USB_RESUME_EVENT
               void USB_Resume_Event (void) {
               }
               #endif
   80          
   81          
   82          /*
   83          *  USB Remote Wakeup Event Callback
   84          */
   85          
   86          #if USB_WAKEUP_EVENT
               void USB_WakeUp_Event (void) {
               }
               #endif
   90          
   91          
   92          /*
   93          *  USB Start of frame Event Callback
   94          *    Parameter:       frame: 11-bit Frame Number
   95          */
   96          
   97          #if USB_SOF_EVENT
               void USB_SOF_Event (DWORD frame) {
                   frame;
               }
               #endif
  102          
  103          
  104          /*
  105          *  USB Error Event Callback
  106          *    Parameter:       error: Error Code
  107          */
  108          
  109          #if USB_ERROR_EVENT
               void USB_Error_Event (DWORD error) {
                   error;
               }
               #endif
  114          
  115          /*
  116          *  USB Set Configuration Event Callback
  117          */
  118          #if USB_CONFIGURE_EVENT
  119          void USB_Configure_Event (void) {
  120   1          if (USB_Configuration) {             /* Check if USB is configured */
  121   2              ReportStatus0 = ReportStatus1 = 1;
  122   2              Data2Host0 = Data2Host1 = 1;
  123   2          }
  124   1      }
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 3   

  125          #endif
  126          
  127          /*
  128          *  USB Set Interface Event Callback
  129          */
  130          
  131          #if USB_INTERFACE_EVENT
               void USB_Interface_Event (void) {
               }
               #endif
  135          
  136          /*
  137          *  USB Set/Clear Feature Event Callback
  138          */
  139          
  140          #if USB_FEATURE_EVENT
               void USB_Feature_Event (void) {
               }
               #endif
  144          
  145          
  146          #define P_EP(n) ((USB_EP_EVENT & (1 << (n))) ? USB_EndPoint##n : NULL)
  147          
  148          /* USB Endpoint Events Callback Pointers */
  149          const void (* USB_P_EP[16]) (DWORD event) = {
  150              P_EP(0),
  151                  P_EP(1),
  152                  P_EP(2),
  153                  P_EP(3),
  154                  P_EP(4),
  155                  P_EP(5),
  156                  P_EP(6),
  157                  P_EP(7),
  158                  P_EP(8),
  159                  P_EP(9),
  160                  P_EP(10),
  161                  P_EP(11),
  162                  P_EP(12),
  163                  P_EP(13),
  164                  P_EP(14),
  165                  P_EP(15),
  166          };
  167          
  168          /*
  169          *  USB Endpoint 1 Event Callback
  170          *    Parameter:       event
  171          */
  172          
  173          void USB_EndPoint1 (DWORD event) {
  174   1          event;
  175   1      }
  176          
  177          /*
  178          *  USB Endpoint 2 Event Callback
  179          *    Parameter:       event
  180          */
  181          
  182          void USB_EndPoint2 (DWORD event) {
  183   1          switch (event) {
  184   2          case USB_EVT_IN:
  185   2              Data2Host0 = 1;
  186   2              break;
  187   2          case USB_EVT_OUT:
  188   2              HostDataToUart(0);
  189   2      
  190   2          //  DeviceData2UART( 0 );
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 4   

  191   2              break;
  192   2          }
  193   1          event;
  194   1      }
  195          
  196          
  197          /*
  198          *  USB Endpoint 3 Event Callback
  199          *    Parameter:       event
  200          */
  201          
  202          void USB_EndPoint3 (DWORD event) {
  203   1          event;
  204   1      }
  205          
  206          /*
  207          *  USB Endpoint 4 Event Callback
  208          *    Parameter:       event
  209          */
  210          
  211          void USB_EndPoint4 (DWORD event) {
  212   1          event;
  213   1      }
  214          
  215          /*
  216          *  USB Endpoint 5 Event Callback
  217          *    Parameter:       event
  218          */
  219          
  220          void USB_EndPoint5 (DWORD event) {
  221   1          switch (event) {
  222   2          case USB_EVT_IN:
  223   2              Data2Host1 = 1;
  224   2              break;
  225   2          case USB_EVT_OUT:
  226   2              HostDataToUart( 1 );
  227   2              break;
  228   2          }
  229   1          event;
  230   1      }
  231          
  232          /*
  233          *  USB Endpoint 6 Event Callback
  234          *    Parameter:       event
  235          */
  236          
  237          void USB_EndPoint6 (DWORD event) {
  238   1          event;
  239   1      }
  240          
  241          
  242          /*
  243          *  USB Endpoint 7 Event Callback
  244          *    Parameter:       event
  245          */
  246          
  247          void USB_EndPoint7 (DWORD event) {
  248   1          event;
  249   1      }
  250          
  251          
  252          /*
  253          *  USB Endpoint 8 Event Callback
  254          *    Parameter:       event
  255          */
  256          
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 5   

  257          void USB_EndPoint8 (DWORD event) {
  258   1          event;
  259   1      }
  260          
  261          
  262          /*
  263          *  USB Endpoint 9 Event Callback
  264          *    Parameter:       event
  265          */
  266          
  267          void USB_EndPoint9 (DWORD event) {
  268   1          event;
  269   1      }
  270          
  271          
  272          /*
  273          *  USB Endpoint 10 Event Callback
  274          *    Parameter:       event
  275          */
  276          
  277          void USB_EndPoint10 (DWORD event) {
  278   1          event;
  279   1      }
  280          
  281          
  282          /*
  283          *  USB Endpoint 11 Event Callback
  284          *    Parameter:       event
  285          */
  286          
  287          void USB_EndPoint11 (DWORD event) {
  288   1          event;
  289   1      }
  290          
  291          /*
  292          *  USB Endpoint 12 Event Callback
  293          *    Parameter:       event
  294          */
  295          
  296          void USB_EndPoint12 (DWORD event) {
  297   1          event;
  298   1      }
  299          
  300          
  301          /*
  302          *  USB Endpoint 13 Event Callback
  303          *    Parameter:       event
  304          */
  305          
  306          void USB_EndPoint13 (DWORD event) {
  307   1          event;
  308   1      }
  309          
  310          
  311          /*
  312          *  USB Endpoint 14 Event Callback
  313          *    Parameter:       event
  314          */
  315          
  316          void USB_EndPoint14 (DWORD event) {
  317   1          event;
  318   1      }
  319          
  320          
  321          /*
  322          *  USB Endpoint 15 Event Callback
ARM COMPILER V2.53,  VCOMuser                                                              09/06/07  15:42:25  PAGE 6   

  323          *    Parameter:       event
  324          */
  325          
  326          void USB_EndPoint15 (DWORD event) {
  327   1          event;
  328   1      }
  329          
  330          
  331          
  332          /* UART setup and simple putc() and getc() routine */
  333          /* Default setting of CCLK is 60Mhz, VPBCLK is 1/4 = 15Mhz */
  334          
  335          
  336          /*  Setup SIO configuration based on the channel number */
  337          void SetSIOBaudrate( BYTE channelNum, BYTE Data )
  338          {
  339   1      /* Data = 0x1       Baudrate = 115,200
  340   1      Data = 0x2      Baudrate = 57,600
  341   1      Data = 0x3      Baudrate = 38,400
  342   1      Data = 0x6      Baudrate = 19,200
  343   1             Data = 0x0C      Baudrate = 9,600 */
  344   1          
  345   1          /* PCLK is set the same as CCLK at 60Mhz */ 
  346   1          if ( channelNum == 0 ) 
  347   1          {
  348   2              U0FCR = 0x87;                  /* Enable and reset TX and RX FIFO. */
  349   2              U0LCR |= 0x80;  
  350   2              switch(Data)
  351   2              {
  352   3              case 1:
  353   3                  SET_UART0_BAUD(115200);
  354   3                  break;
  355   3              case 2:
  356   3                  SET_UART0_BAUD(57600);
  357   3                  break;
  358   3              case 3:
  359   3                  SET_UART0_BAUD(38400);
  360   3                  break;
  361   3              case 6:
  362   3                  SET_UART0_BAUD(19200);
  363   3                  break;
  364   3              default:
  365   3                  SET_UART0_BAUD(9600);
  366   3              }
  367   2              U0LCR &= ~0x80;
  368   2          }
  369   1          else if ( channelNum == 1 ) 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -