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

📄 scfirst.lst

📁 psoc_usb的代码,用来小卡测试的.没事下下来
💻 LST
字号:
C51 COMPILER V8.06   SCFIRST                                                               01/31/2008 22:24:26 PAGE 1   


C51 COMPILER V8.06, COMPILATION OF MODULE SCFIRST
OBJECT MODULE PLACED IN scfirst.OBJ
COMPILER INVOKED BY: C:\Program Files\Keil\C51\BIN\C51.EXE scfirst.c OPTIMIZE(9,SPEED) MODDP2 INCDIR(C:\Cypress\USB\Targ
                    -et\Inc) DEFINE(__USE_USB__) DEBUG OBJECTEXTEND

line level    source

   1          //-----------------------------------------------------------------------------
   2          // Contents:  main module of a simple firmware
   3          //
   4          // Copyright: Inventec Electronics(Tianjin) Co., Ltd.
   5          // $Archive:  scmain.c
   6          // $Date:     2007-12-06
   7          // $Revision: 1.00
   8          //
   9          //-----------------------------------------------------------------------------
  10          // Copyright 2006, xsh.han@itc.inventec
  11          //-----------------------------------------------------------------------------
  12          #include <stdio.h>
  13          #include <stdlib.h>
  14          #include <string.h>
  15          #include <ctype.h>
  16          
  17          #include "fx2.h"
  18          #include "fx2regs.h"
  19          #include "absacc.h"
  20          #include "scmain.h"
  21          
  22          #ifndef __USE_USB__
              #include "serial.h"
              #endif
  25          
  26          //--------------------------------------------------------------
  27          //global variable
  28          //--------------------------------------------------------------
  29          BYTE xdata malloc_mempool[2048];
  30          BYTE xdata g_in_buffer[BUFF_LENGTH];
  31          WORD xdata g_in_buffer_len = 0;
  32          WORD xdata g_loopcount = 0;
  33          
  34          //--------------------------------------------------------------
  35          //extern function
  36          //--------------------------------------------------------------
  37          extern int  sc_main(char *cmd_buff,int size);  
  38          extern void sc_process_blinking();
  39          
  40          //-----------------------------------------------------------------------------
  41          // main function init
  42          //-----------------------------------------------------------------------------
  43          int user_init()
  44          {
  45   1          // set the CPU clock to 48MHz
  46   1          CPUCS = ((CPUCS & ~bmCLKSPD) | bmCLKSPD1) ;
  47   1      
  48   1          // set the slave FIFO interface to 48MHz
  49   1          IFCONFIG |= 0x40;
  50   1      
  51   1          //init malloc memory pool
  52   1          init_mempool(&malloc_mempool, sizeof(malloc_mempool));
  53   1         
  54   1          // Initialize EZ-USB I2C controller
C51 COMPILER V8.06   SCFIRST                                                               01/31/2008 22:24:26 PAGE 2   

  55   1          //EZUSB_InitI2C();    
  56   1      
  57   1          //initialize serial port
  58   1      #ifndef __USE_USB__
                  serial_init(19200,1);
              #endif
  61   1             
  62   1          //delay 
  63   1          EZUSB_Delay(1);     //delay 1ms
  64   1      
  65   1          return 0;
  66   1      }
  67           
  68          //--------------------------------------------------------------
  69          //show led
  70          //--------------------------------------------------------------
  71          void user_status(BYTE onoff)
  72          {
  73   1          if (onoff) {
  74   2              IOE |= 1;
  75   2          }else{
  76   2              IOE &= (~1);
  77   2          }
  78   1          return;
  79   1      }
  80          
  81          //-----------------------------------------------------------------------------
  82          // main function loop
  83          //-----------------------------------------------------------------------------
  84          int user_loop()
  85          {
  86   1      #ifndef __USE_USB__
                  g_in_buffer_len = SERIAL_GET_STRING(g_in_buffer,BUFF_LENGTH);
                  g_in_buffer[g_in_buffer_len] = 0;
                  if (g_in_buffer_len){
                      g_in_buffer_len = sc_main(g_in_buffer,g_in_buffer_len);
                      if (g_in_buffer_len){
                          PRINTF_COM(g_in_buffer);            
                      }else{
                          PRINTF_COM("<NULL>\r\n");            
                      }
                      
                      //clear buffer length
                      g_in_buffer_len = 0;
                  }    
              #endif
 101   1      
 102   1          user_status(g_loopcount&0x01);
 103   1      
 104   1          return 0;
 105   1      }
 106          
 107          
 108          //-----------------------------------------------------------------------------
 109          //main function
 110          //-----------------------------------------------------------------------------
 111          #ifndef __USE_USB__
              int main()
              {
                  //call user init function
                  user_init();
              
C51 COMPILER V8.06   SCFIRST                                                               01/31/2008 22:24:26 PAGE 3   

                  //out infor message
                  PRINTF_COM("\r\n>>>Serial Command Interface, HELP for usage.<<<\r\n");
              
                  //main loop
                  while(1) 
                      {
                          //process user loop
                      if ((g_loopcount%50)==0)
                              {
                          user_loop();
                      }
                      
                      if ((g_loopcount%10)==0)
                              {
                          sc_process_blinking();
                      }
                      
                      //inc counter
                      g_loopcount++;
                      EZUSB_Delay(2);   //delay 1ms
                  }
              }
              #endif
 140          


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =     64    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =   2308    ----
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.


C51 COMPILATION COMPLETE.  0 WARNING(S),  0 ERROR(S)

⌨️ 快捷键说明

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