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

📄 nf_file.lst

📁 通过车载终端采集GPS数据
💻 LST
字号:
C51 COMPILER V7.09   NF_FILE                                                               09/25/2008 11:56:22 PAGE 1   


C51 COMPILER V7.09, COMPILATION OF MODULE NF_FILE
OBJECT MODULE PLACED IN .\output\bin\nf_file.obj
COMPILER INVOKED BY: C:\Keil709\C51\BIN\C51.EXE flash\nf_file.c LARGE BROWSE INCDIR(audio\;eeprom\;extendUART\;flash\;gp
                    -s\;inter\;key\;mcu\;menu\;usb\;gprs\;main\;1wire\) DEBUG OBJECTEXTEND PRINT(.\output\nf_file.lst) OBJECT(.\output\bin\nf
                    -_file.obj)

line level    source

   1          /******************************************************************************/
   2          /*Usage:按照定义好的文件格式,读取flash上的内容
   3                  :填写好相应的变量
   4          /******************************************************************************/
   5          #include "global.h"
   6          #include "nf_file.h"
   7          #include "nf_drv.h"
   8          #include "string.h"
   9          #include "msm9841.h"
  10          #include "playsound.h"
  11          #include "position.h"
  12          #include "display.h"
  13          #include <string.h>
  14          #include <stdio.h>
  15          #include "commoninterface.h"
  16          #include "common_function.h"
  17          #define STARTADDR_BACKWARD 102 //报站位置数据中下行数据的起始位置
  18          /*************全局变量*******************************/
  19          xdata Uint8 xAddrBackward;//报站位置数据中下行数据在stationData中的起始位置
  20          xdata Uint32 xFileAddress;//该线路语音文件在flash中存储的起始地址
  21          xdata BUS_INFO busInfo;//线路当前信息
  22          xdata STATION_TONE stationTone[128];//上下行车站数据
  23          xdata Byte fixedTone[MAX_CUR_FIXNUM];//固定服务短语
  24          xdata Uint32 tonePointer[MAX_TONEPOINTER_NUMBER];//语音指针
  25          xdata Uint16 toneArrayPointer[MAX_TONEARRAY_SIZE];//语音串的存放空间
  26          xdata Uint16 toneArrayAddr[MAX_TONEARRAY_NUMBER];//所有语音串的起始序号(在toneArrayPointer中的位置)
  27          xdata TERM_PARA termPara;//线路参数
  28          
  29          extern char positionMode[128];
  30          extern POSITIONINFO positionInfo[204];
  31          
  32          extern Uint8 voiceSynMethod;
  33          extern Uint8 samplingFreq;
  34          
  35          PROGRAM_BUFPOINT gProgramBuf;
  36          
  37          
  38          
  39          /**********判断数据是否有效**********************/
  40          /*return value: OK:数据有效
  41          /*              KO:数据无效(pBuf中的数据为全0)
  42          /************************************************/
  43          Byte CheckDataValid(Byte *pBuf, Uint8 nLen)
  44          {
  45   1          Uint8 i;
  46   1          for (i=0; i<nLen; i++)
  47   1          {
  48   2              if (0 != pBuf[i])
  49   2                  return OK;
  50   2          }
  51   1          return KO;
  52   1      }
  53          /*******************write file********************/
C51 COMPILER V7.09   NF_FILE                                                               09/25/2008 11:56:22 PAGE 2   

  54          //xdata Byte writeBuf[512];
  55          xdata Byte writeBuf1[128] _at_ 0x1000;
  56          xdata Byte writeBuf2[128] _at_ 0x1100;
  57          xdata Byte writeBuf3[128] _at_ 0x1200;
  58          xdata Byte writeBuf4[128] _at_ 0x1300;
  59          xdata Byte* bufPoint[4] = {writeBuf1, writeBuf2, writeBuf3, writeBuf4};
  60          xdata Uint32 basePage;//写flash时起始的页地址
  61          
  62          /*****************以下是更新程序的代码************
  63          *pBuf:数据内容
  64          *nLen:pBuf的长度
  65          *nOffset:该块程序的偏移地址
  66          *返回值:OK,可以返回应答;KO
  67          *************************************************/
  68          /*通过串口更新程序时使用*/
  69          void init_serialupdateprogram(Byte status)
  70          {
  71   1          stop_board();
  72   1          if (status == SERIAL_FIRSTUPDATE)
  73   1          {
  74   2              gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
  75   2          }
  76   1          gProgramBuf.bufvalid = 0;
  77   1      }
  78          
  79          Uint32 gnRemoteUpAddr;
  80          Byte write_programtoFlash(Byte* pBuf, Uint16 nLen, Uint32 nOffset, Byte type)
  81          {
  82   1          Uint8 i;
  83   1      
  84   1          if (type == NFUPDATE_REMOTE)
  85   1          {
  86   2              Uint32 nTmp32;
  87   2              if (KO == is_playReadFlash())
  88   2                  return KO;
  89   2              
  90   2              nf_wp_off();
  91   2              if (nOffset == 0)
  92   2              {
  93   3                  gnRemoteUpAddr = ZONE_PROGRAM_BASEADDR;
  94   3                  nf_block_erase(gnRemoteUpAddr>>1);
  95   3                  gnRemoteUpAddr += 32*512;                
  96   3              }
  97   2              else if ((nOffset+ZONE_PROGRAM_BASEADDR) >= gnRemoteUpAddr)
  98   2              {
  99   3                  nf_block_erase(gnRemoteUpAddr>>1);
 100   3                  gnRemoteUpAddr += 32*512;
 101   3              }
 102   2      
 103   2              nTmp32 = nOffset+ZONE_PROGRAM_BASEADDR;
 104   2              nf_write_onebuf_withouterase(nTmp32, pBuf, nLen);
 105   2              nf_wp_on();
 106   2              return OK;
 107   2          }
 108   1          else
 109   1          {
 110   2              if (KO == is_playReadFlash())
 111   2              {
 112   3                  //当前正在有语音正在播放
 113   3                  if (PROGRAMBUF_NUMBER == gProgramBuf.bufvalid)
 114   3                      return KO;
 115   3                  else
C51 COMPILER V7.09   NF_FILE                                                               09/25/2008 11:56:22 PAGE 3   

 116   3                  {
 117   4                      memcpy(bufPoint[gProgramBuf.bufvalid], pBuf, nLen);
 118   4                      gProgramBuf.offset[gProgramBuf.bufvalid] = nOffset+ZONE_PROGRAM_BASEADDR;
 119   4                      gProgramBuf.bufLen[gProgramBuf.bufvalid] = nLen;
 120   4                      gProgramBuf.bufvalid++;  
 121   4                      return OK;          
 122   4                  }
 123   3              }
 124   2              else
 125   2              {
 126   3                  //当前无语音播放
 127   3                  Uint32 nTmp32;
 128   3                  nf_wp_off();
 129   3                  for (i=0; i<gProgramBuf.bufvalid; i++)
 130   3                  {
 131   4                      if (gProgramBuf.offset[i] >= gProgramBuf.curBlock)
 132   4                      {                
 133   5                          nf_block_erase(gProgramBuf.curBlock>>1);
 134   5                          gProgramBuf.curBlock += 32*512;
 135   5                      }
 136   4                      else if (gProgramBuf.offset[i] == ZONE_PROGRAM_BASEADDR)
 137   4                      {
 138   5                          gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
 139   5                          nf_block_erase(gProgramBuf.curBlock>>1);
 140   5                          gProgramBuf.curBlock += 32*512;                
 141   5                      }
 142   4                      
 143   4                      nf_write_onebuf_withouterase(gProgramBuf.offset[i], bufPoint[i], gProgramBuf.bufLen);
*** WARNING C214 IN LINE 143 OF FLASH\NF_FILE.C: 'Argument': conversion: pointer to non-pointer
 144   4                  }
 145   3          
 146   3                  if ((nOffset+ZONE_PROGRAM_BASEADDR) >= gProgramBuf.curBlock)
 147   3                  {
 148   4                      nf_block_erase(gProgramBuf.curBlock>>1);
 149   4                      gProgramBuf.curBlock += 32*512;
 150   4                  }
 151   3                  else if (nOffset == 0)
 152   3                  {
 153   4                      gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
 154   4                      nf_block_erase(gProgramBuf.curBlock>>1);
 155   4                      gProgramBuf.curBlock += 32*512;                
 156   4                  }
 157   3          
 158   3                  nTmp32 = nOffset+ZONE_PROGRAM_BASEADDR;
 159   3                  nf_write_onebuf_withouterase(nTmp32, pBuf, nLen);
 160   3                  gProgramBuf.bufvalid = 0;
 161   3                  nf_wp_on();
 162   3                  return OK;
 163   3              }
 164   2          }
 165   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    948    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =  10678      19
   PDATA SIZE       =   ----    ----
   DATA SIZE        =   ----    ----
   IDATA SIZE       =   ----    ----
   BIT SIZE         =   ----    ----
END OF MODULE INFORMATION.

C51 COMPILER V7.09   NF_FILE                                                               09/25/2008 11:56:22 PAGE 4   


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

⌨️ 快捷键说明

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