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

📄 f34x_usb_main.lst

📁 支持USB2.0 BULK传输范例
💻 LST
字号:
C51 COMPILER V8.08   F34X_USB_MAIN                                                         06/23/2008 15:53:52 PAGE 1   


C51 COMPILER V8.08, COMPILATION OF MODULE F34X_USB_MAIN
OBJECT MODULE PLACED IN F34x_USB_Main.OBJ
COMPILER INVOKED BY: C:\SiLabs\MCU\IDEfiles\C51\BIN\C51.exe F34x_USB_Main.c DB OE

line level    source

   1          //-----------------------------------------------------------------------------
   2          // F34x_USB_Main.c
   3          //-----------------------------------------------------------------------------
   4          // Copyright 2005 Silicon Laboratories, Inc.
   5          // http://www.silabs.com
   6          //
   7          // Program Description:
   8          //
   9          // Source file for USB firmware. Includes main routine and
  10          // all hardware initialization routines.
  11          //
  12          // This firmware is intended to work with the Silabs USB Bulk File Transfer example,
  13          // implementing two Bulk pipes with 64-byte Maximum transfers. The endpoints
  14          // used are as follows:
  15          //
  16          // Endpoint1 IN - BULK IN
  17          // Endpoint2 OUT - BULK OUT
  18          //
  19          //
  20          // How To Test:    See Readme.txt
  21          //
  22          //
  23          // FID:            34X000008
  24          // Target:         C8051F34x
  25          // Tool chain:     Keil C51 7.50 / Keil EVAL C51
  26          //                 Silicon Laboratories IDE version 2.6
  27          // Command Line:   See Readme.txt
  28          // Project Name:   F34x_USB_Bulk
  29          //
  30          //
  31          // Release 1.3
  32          //    -All changes by GP
  33          //    -21 NOV 2005
  34          //    -Changed revision number to match project revision
  35          //     No content changes to this file
  36          //    -Modified file to fit new formatting guidelines
  37          //    -Changed file name from main.c
  38          //
  39          //
  40          // Release 1.2
  41          //    -Initial Revision (JS/CS/JM)
  42          //    -XX OCT 2003
  43          //
  44          
  45          //-----------------------------------------------------------------------------
  46          // Includes
  47          //-----------------------------------------------------------------------------
  48          
  49          #include <c8051f340.h>                 // SFR declarations
  50          #include "F34x_USB_Registers.h"
  51          #include "F34x_USB_Structs.h"
  52          #include "F34x_USB_Main.h"
  53          #include "F34x_USB_Descriptors.h"
  54          
  55          //-----------------------------------------------------------------------------
C51 COMPILER V8.08   F34X_USB_MAIN                                                         06/23/2008 15:53:52 PAGE 2   

  56          // Global Constants
  57          //-----------------------------------------------------------------------------
  58          
  59          sbit Led1 = P2^2;                      // LED='1' means ON
  60          sbit Led2 = P2^3;                      // blink to indicate data transmission
  61          
  62          
  63          //-----------------------------------------------------------------------------
  64          // Function Prototypes
  65          //-----------------------------------------------------------------------------
  66          
  67          void USB0_Init (void);
  68          void USB0_Enable (void);
  69          void PORT_Init (void);
  70          void SYSCLK_Init (void);
  71          void VDD_MON_Init(void);               // Turn on VDD Monitor
  72          
  73          //-----------------------------------------------------------------------------
  74          // Globals Variables
  75          //-----------------------------------------------------------------------------
  76          
  77          DEVICE_STATUS    gDeviceStatus;
  78          EP_STATUS        gEp0Status;
  79          EP_STATUS        gEp1InStatus;
  80          EP_STATUS        gEp2OutStatus;
  81          EP0_COMMAND      gEp0Command;
  82          
  83          
  84          //-----------------------------------------------------------------------------
  85          //Attention:
  86          //1. USB时钟应在收发器被使能之前就处于活动状态。
  87          //2. 访问USB寄存器时,USB时钟必须是活动的
  88          //3. 软件在写USB0DAT之前应先检查BUSY位是否为0。
  89          //4. 在使能时钟恢复电路之前,USB收发器必须被使能
  90          //5. 读一个中断标志寄存器将使该寄存器中的所有标志位复位为‘0’。
  91          //6.
  92          //7.
  93          //8.
  94          //9.
  95          
  96          
  97          //-----------------USB0DAT:USB0数据寄存器-----------------//
  98          //间接写步骤:
  99          //1.查询BUSY位(USB0ADR.7)=>‘0’。
 100          //2.将目标USB0寄存器地址装入到寄存器USB0ADR中的USBADDR位。
 101          //3.向USB0DAT写数据。
 102          //4.重复上述步骤(当写同一个USB0寄存器时,步骤2可以被跳过)。
 103          //间接读步骤:
 104          //1.查询BUSY位(USB0ADR.7)=>‘0’。
 105          //2.将目标USB0寄存器地址装入到寄存器USB0ADR中的USBADDR位。
 106          //3.向寄存器USB0ADR中的BUSY位写‘1’(步骤2和步骤3可以在同一个写操作完成)。
 107          //4.查询BUSY位(USB0ADR.7)=>‘0’。
 108          //5.从USB0DAT读数据。
 109          //6.重复从步骤2开始的步骤(当读同一个USB0寄存器时,步骤2可以被跳过;当AUTORD位(USB0ADR.6)为逻辑1时,步

⌨️ 快捷键说明

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