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

📄 nf_file.lst

📁 通过车载终端采集GPS数据
💻 LST
字号:
C51 COMPILER V8.02   NF_FILE                                                               09/25/2008 19:29:41 PAGE 1   


C51 COMPILER V8.02, COMPILATION OF MODULE NF_FILE
OBJECT MODULE PLACED IN .\output\bin\nf_file.obj
COMPILER INVOKED BY: C:\Keil802\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 V8.02   NF_FILE                                                               09/25/2008 19:29:41 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          if (status == SERIAL_FIRSTUPDATE)
  72   1          {
  73   2              gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
  74   2          }
  75   1          gProgramBuf.bufvalid = 0;
  76   1      }
  77          
  78          Uint32 gnRemoteUpAddr;
  79          Byte write_programtoFlash(Byte* pBuf, Uint16 nLen, Uint32 nOffset)
  80          {
  81   1      //    Uint8 i;
  82   1      
  83   1              //当前无语音播放
  84   1              Uint32 nTmp32;
  85   1              nf_wp_off();
  86   1      /*      for (i=0; i<gProgramBuf.bufvalid; i++)
  87   1              {
  88   1                  if (gProgramBuf.offset[i] >= gProgramBuf.curBlock)
  89   1                  {                
  90   1                      nf_block_erase(gProgramBuf.curBlock>>1);
  91   1                      gProgramBuf.curBlock += 32*512;
  92   1                  }
  93   1                  else if (gProgramBuf.offset[i] == ZONE_PROGRAM_BASEADDR)
  94   1                  {
  95   1                      gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
  96   1                      nf_block_erase(gProgramBuf.curBlock>>1);
  97   1                      gProgramBuf.curBlock += 32*512;                
  98   1                  }
  99   1                  
 100   1                  nf_write_onebuf_withouterase(gProgramBuf.offset[i], bufPoint[i], gProgramBuf.bufLen);
 101   1              }
 102   1      */      
 103   1              if ((nOffset+ZONE_PROGRAM_BASEADDR) >= gProgramBuf.curBlock)
 104   1              {
 105   2                  nf_block_erase(gProgramBuf.curBlock>>1);
 106   2                  gProgramBuf.curBlock += 32*512;
 107   2              }
 108   1              else if (nOffset == 0)
 109   1              {
 110   2                  gProgramBuf.curBlock = ZONE_PROGRAM_BASEADDR;
 111   2                  nf_block_erase(gProgramBuf.curBlock>>1);
 112   2                  gProgramBuf.curBlock += 32*512;                
 113   2              }
 114   1              
 115   1              nTmp32 = nOffset+ZONE_PROGRAM_BASEADDR;
C51 COMPILER V8.02   NF_FILE                                                               09/25/2008 19:29:41 PAGE 3   

 116   1              nf_write_onebuf_withouterase(nTmp32, pBuf, nLen);
 117   1              gProgramBuf.bufvalid = 0;
 118   1              nf_wp_on();
 119   1              return OK;
 120   1      
 121   1      }


MODULE INFORMATION:   STATIC OVERLAYABLE
   CODE SIZE        =    283    ----
   CONSTANT SIZE    =   ----    ----
   XDATA SIZE       =  10678      12
   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 + -