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

📄 flash_example.lst

📁 本程序是并口FLASH 39sf040读写程序,并给出调用函数.
💻 LST
📖 第 1 页 / 共 2 页
字号:
C51 COMPILER V7.20   FLASH_EXAMPLE                                                         02/01/2007 15:50:57 PAGE 1   


C51 COMPILER V7.20, COMPILATION OF MODULE FLASH_EXAMPLE
OBJECT MODULE PLACED IN .\FLASH_Example.obj
COMPILER INVOKED BY: C:\Keil\C51\BIN\C51.EXE ..\src\FLASH_Example.C BROWSE DEBUG OBJECTEXTEND PRINT(.\FLASH_Example.lst)
                    - OBJECT(.\FLASH_Example.obj)

line level    source

   1          /************************************************************************
   2          Check_SST_39SF040       Check manufacturer and device ID
   3          Erase_Entire_Chip       Erase the contents of the entire chip
   4          Erase_One_Sector        Erase a sector of 4096 bytes
   5          Program_One_Byte        Alter data in one byte
   6          Program_One_Sector      Alter data in 4096 bytes sector
   7          Check_Toggle_Ready      End of internal program or erase detection using
   8                                  Toggle bit
   9          Check_Data_Polling      End of internal program or erase detection using
  10                                  Data# polling
  11          "C" LANGUAGE DRIVERS
  12          ***********************************************************************/
  13          /* Copyright Silicon Storage Technology, Inc. (SST), 1994-2001         */
  14          /* Example "C" Language Drivers of 39SF040 4 Mbit Multi-Purpose Flash  */
  15          /* Nelson Wang, Silicon Storage Technology, Inc.                       */
  16          /*                                                                     */
  17          /* Revision 1.0,  Sept. 12, 2001                                        */
  18          /*                                                                     */
  19          /* This file requires these external "timing"  routines:               */
  20          /*                                                                     */
  21          /*      1.)  Delay_150_Nano_Seconds                                    */
  22          /*      2.)  Delay_25_Milli_Seconds                                    */
  23          /*      3.)  Delay_100_Milli_Seconds                                   */
  24          /***********************************************************************/
  25          #include  <reg52.h>
  26          #define   FALSE                   0
  27          #define   TRUE                    1
  28          
  29          #define SECTOR_SIZE             4096    /* Must be 4096 bytes for 39SF040 */
  30          
  31          #define SST_ID                  0xBF    /* SST Manufacturer's ID code   */
  32          #define SST_39SF040             0xB7    /* SST 39SF040 device code      */
  33          
  34          typedef unsigned char           BYTE;
  35          
  36          /* -------------------------------------------------------------------- */
  37          /*                       EXTERNAL ROUTINES                              */
  38          /* -------------------------------------------------------------------- */
  39          extern farmalloc();
  40          extern void     Delay_150_Nano_Seconds();
  41          extern void     Delay_25_Milli_Seconds();
  42          extern void     Delay_100_Milli_Seconds();
  43          
  44          
  45          /*************************************************************************/
  46          /* PROCEDURE:   Check_SST_39SF040                                       */
  47          /*                                                                      */
  48          /* This procedure decides whether a physical hardware device has a      */
  49          /* SST 39SF040  4 Mbit Multi-Purpose Flash installed or not.            */
  50          /*                                                                      */
  51          /* Input:                                                               */
  52          /*          None                                                        */
  53          /*                                                                      */
  54          /* Output:                                                              */
C51 COMPILER V7.20   FLASH_EXAMPLE                                                         02/01/2007 15:50:57 PAGE 2   

  55          /*          return TRUE:  indicates a SST 39SF040                       */
  56          /*          return FALSE: indicates not a SST 39SF040                   */
  57          /************************************************************************/
  58          
  59          int Check_SST_39SF040()
  60          {
  61   1              BYTE far *Temp;
*** ERROR C141 IN LINE 61 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*'
  62   1              BYTE SST_id1;
  63   1              BYTE SST_id2;
  64   1              int  ReturnStatus;
  65   1      
  66   1              /*  Issue the Software Product ID code to 39SF040  */
  67   1      
  68   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 68 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  69   1              *Temp = 0xAA;                   /* write data 0xAA to the address     */
  70   1              Temp  = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh    */
*** ERROR C141 IN LINE 70 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  71   1              *Temp = 0x55;                   /* write data 0x55 to the address     */
  72   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 72 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  73   1              *Temp = 0x90;                   /* write data 0x90 to the address     */
  74   1      
  75   1              Delay_150_Nano_Seconds();       /* check DATABOOK for the most  */
  76   1                                              /* accurate value -- Tida       */
  77   1      
  78   1              /* Read the product ID from 39SF040 */
  79   1      
  80   1              Temp  = (BYTE far *)0xA0000000; /* set up address to be A000:0000h    */
*** ERROR C141 IN LINE 80 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  81   1              SST_id1  =  *Temp;              /* get first ID byte                  */
  82   1              Temp  = (BYTE far *)0xA0000001; /* set up address to be A000:0001h    */
*** ERROR C141 IN LINE 82 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  83   1              SST_id2  =  *Temp;              /* get first ID byte                  */
  84   1      
  85   1              /* Determine whether there is a SST 39SF040 installed or not */
  86   1      
  87   1              if ((SST_id1 == SST_ID) && (SST_id2 ==SST_39SF040))
  88   1                      ReturnStatus = TRUE;
  89   1              else
  90   1                      ReturnStatus = FALSE;
  91   1      
  92   1              /* Issue the Soffware Product ID Exit code thus returning the 39SF040 */
  93   1              /* to the read operating mode                                         */
  94   1      
  95   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 95 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  96   1              *Temp = 0xAA;                   /* write data 0xAA to the address     */
  97   1              Temp  = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh    */
*** ERROR C141 IN LINE 97 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
  98   1              *Temp = 0x55;                   /* write data 0x55 to the address     */
  99   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 99 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 100   1              *Temp =0xF0;                    /* write data 0xF0 to the address     */
 101   1      
 102   1              Delay_150_Nano_Seconds();       /* check DATABOOK for the most  */
 103   1                                              /* accurate value -- Tida       */
 104   1      
 105   1              return (ReturnStatus);
 106   1      }
 107          
C51 COMPILER V7.20   FLASH_EXAMPLE                                                         02/01/2007 15:50:57 PAGE 3   

 108          
 109          *************************************************************************/
*** ERROR C141 IN LINE 109 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '/'
 110          /* PROCEDURE:   Erase_Entire_Chip                                       */
 111          /*                                                                      */
 112          /* This procedure can be used to erase the entire chip.                 */
 113          /*                                                                      */
 114          /* Input:                                                               */
 115          /*      NONE                                                            */
 116          /*                                                                      */
 117          /* Output:                                                              */
 118          /*      NONE                                                            */
 119          /************************************************************************/
 120          
 121          int Erase_Entire_Chip()
 122          {
 123   1              BYTE far *Temp;
*** ERROR C141 IN LINE 123 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*'
 124   1      
 125   1              /*  Issue the Sector Erase command to 39SF040   */
 126   1      
 127   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 127 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 128   1              *Temp = 0xAA;                   /* write data 0xAA to the address     */
 129   1              Temp  = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh    */
*** ERROR C141 IN LINE 129 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 130   1              *Temp = 0x55;                   /* write data 0x55 to the address     */
 131   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 131 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 132   1              *Temp = 0x80;                   /* write data 0x80 to the address     */
 133   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 133 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 134   1              *Temp = 0xAA;                   /* write data 0xAA to the address     */
 135   1              Temp  = (BYTE far *)0xA0002AAA; /* set up address to be A000:2AAAh    */
*** ERROR C141 IN LINE 135 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 136   1              *Temp = 0x55;                   /* write data 0x55 to the address     */
 137   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */
*** ERROR C141 IN LINE 137 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near 'far', expected ')'
 138   1              *Temp = 0x10;                   /* write data 0x10 to the address     */
 139   1      
 140   1              Delay_100_Milli_Seconds();      /* check DATABOOK for the most  */
 141   1                                              /* accurate value -- Tsce       */
 142   1      }
 143          
 144          
 145          
 146          *************************************************************************/
*** ERROR C141 IN LINE 146 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '/'
 147          /* PROCEDURE:   Erase_One_Sector                                        */
 148          /*                                                                      */
 149          /* This procedure can be used to erase a total of 4096 bytes.           */
 150          /*                                                                      */
 151          /* Input:                                                               */
 152          /*      Dst     DESTINATION address at which the erase operation will   */
 153          /*              start.                                                  */
 154          /*                                                                      */
 155          /* Output:                                                              */
 156          /*      NONE                                                            */
 157          /************************************************************************/
 158          
 159          int Erase_One_Sector(BYTE far *Dst)
*** ERROR C141 IN LINE 159 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*', expected ')'
C51 COMPILER V7.20   FLASH_EXAMPLE                                                         02/01/2007 15:50:57 PAGE 4   

 160          {
 161   1              BYTE far *Temp;
*** ERROR C231 IN LINE 161 OF ..\SRC\FLASH_EXAMPLE.C: 'far': redefinition
*** ERROR C141 IN LINE 161 OF ..\SRC\FLASH_EXAMPLE.C: syntax error near '*'
 162   1      
 163   1              /*  Issue the Sector Erase command to 39SF040   */
 164   1      
 165   1              Temp  = (BYTE far *)0xA0005555; /* set up address to be A000:5555h    */

⌨️ 快捷键说明

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