ViewData2Flash.lst
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:9k
源码类别:

传真(Fax)编程

开发平台:

C/C++

  1. ##############################################################################
  2. #                                                                            #
  3. # IAR MSP430 C/EC++ Compiler V2.10A/W32                12/Apr/2007  16:54:38 #
  4. # Copyright 1996-2003 IAR Systems. All rights reserved.                      #
  5. #                                                                            #
  6. #    __rt_version  =  1                                                      #
  7. #    __double_size =  32                                                     #
  8. #    __reg_r4      =  free                                                   #
  9. #    __reg_r5      =  free                                                   #
  10. #    __pic         =  no                                                     #
  11. #    Source file   =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  12. #                     filesViewData2Flash.c                                 #
  13. #    Command line  =  -I "C:Program FilesIAR SystemsEmbedded Workbench    #
  14. #                     3.2430INC" -I "C:Program FilesIAR                 #
  15. #                     SystemsEmbedded Workbench 3.2430INCCLIB" -lCN     #
  16. #                     E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  17. #                     DebugList -lA E:projectFaxProgramVson_Bryan_Fax_ #
  18. #                     Conexant_070412DebugList -o                         #
  19. #                     E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  20. #                     DebugObj -z2 --no_cse --no_unroll --no_inline        #
  21. #                     --no_code_motion --debug -e                            #
  22. #                     E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  23. #                     filesViewData2Flash.c                                 #
  24. #    List file     =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  25. #                     DebugListViewData2Flash.lst                          #
  26. #    Object file   =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  27. #                     DebugObjViewData2Flash.r43                           #
  28. #                                                                            #
  29. #                                                                            #
  30. ##############################################################################
  31. E:projectFaxProgramVson_Bryan_Fax_Conexant_070412filesViewData2Flash.c
  32.       1          /***************************************
  33.       2          Program:     View Data access into Flash
  34.       3          Author:      Bryan Cai
  35.       4          Date:        2007.04.11
  36.       5          ***************************************/
  37.       6          
  38.       7          #include "includeH.h"
  39.       8          
  40.       9          void WriteViewData(void)
  41.      10          {
  42.      11          
  43.      12           unsigned char ucFlashSttsOverflowCnt=0,ucFaxPropertyLenCnt=0,
  44.      13                         ucRxIndex=0;
  45.      14          
  46.      15             COMMAND_VAL=cFlashWriteCmd;
  47.      16             COMMAND_LATCH_INTO();
  48.      17          //ADDRESS
  49.      18             
  50.      19             ADDRESS_VALUE=gwColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  51.      20             ADDRESS_LATCH_INTO();
  52.      21          
  53.      22             ADDRESS_VALUE=(gwColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  54.      23             ADDRESS_LATCH_INTO();
  55.      24          
  56.      25             ADDRESS_VALUE=gwFaxPropertyAddress & 0xff;//gwFaxPropertyAddress is equal gwFaxRearPointerAddress
  57.      26             ADDRESS_LATCH_INTO();
  58.      27          
  59.      28             ADDRESS_VALUE=(gwFaxPropertyAddress>>8) & 0XFF;
  60.      29             ADDRESS_LATCH_INTO();
  61.      30             FLASH_CON_PORT_OUT &=~ ALE;
  62.      31          
  63.      32             DATA_PORT_OUT_INITIAL;
  64.      33             for (ucFaxPropertyLenCnt=0;ucFaxPropertyLenCnt<8;ucFaxPropertyLenCnt++)
  65.      34             {
  66.      35             FLASH_CON_PORT_OUT&=~WE;
  67.      36               DATA_PORT_OUT=aucUartRxBuf[ucRxIndex++];
  68.      37               FLASH_CON_PORT_OUT |= WE;
  69.      38             }
  70.      39          
  71.      40             COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  72.      41             COMMAND_LATCH_INTO();
  73.      42          
  74.      43             READ_STATUS();
  75.      44             ucFlashSttsOverflowCnt=0;
  76.      45             if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  77.      46             {;}
  78.      47          }
  79.      48          void ReadLastViewData(void)//find last fax property recorder
  80.      49          {
  81.      50           unsigned int wPageAddress=0, wBlockAddress=0,
  82.      51                        wColumnAddress=0,wNextPageAddress=0,
  83.      52                        wRearPntCnt=0;
  84.      53           unsigned char ucRxIndex=0,
  85.      54                         ucGeneralCnt=0,ucFaxPropertyLenCnt,
  86.      55                         ucRxIndex3=0,ucRxIndex2=0,
  87.      56                         ucRxIndex0=0,ucRxIndex1=0;
  88.      57          
  89.      58          
  90.      59            for (wBlockAddress=cstViewDataAreaStartPage;
  91.      60                wBlockAddress<=cstViewDataAreaEndPage;wBlockAddress++)
  92.      61           {
  93.      62          
  94.      63           for (wPageAddress=(wBlockAddress<<6);wPageAddress<((wBlockAddress<<6)+64);wPageAddress++)
  95.      64           {
  96.      65                do{
  97.      66               wNextPageAddress=wPageAddress+64;
  98.      67               wPageAddress=CalNextPageAddress(wPageAddress);
  99.      68                }while(wNextPageAddress==wPageAddress);
  100.      69                
  101.      70                wColumnAddress=0;
  102.      71                ROW_ADDRESS_LOW=wPageAddress & 0XFF;
  103.      72                ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
  104.      73                
  105.      74                for (ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  106.      75                {
  107.      76          //COMMAND
  108.      77             COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2111BYTE
  109.      78             COMMAND_LATCH_INTO();
  110.      79          //ADDRESS
  111.      80          
  112.      81             ADDRESS_VALUE=wColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  113.      82             ADDRESS_LATCH_INTO();
  114.      83          
  115.      84             ADDRESS_VALUE=(wColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  116.      85             ADDRESS_LATCH_INTO();
  117.      86          
  118.      87             ADDRESS_VALUE=ROW_ADDRESS_LOW;
  119.      88             ADDRESS_LATCH_INTO();
  120.      89          
  121.      90             ADDRESS_VALUE=ROW_ADDRESS_HIGH;
  122.      91             ADDRESS_LATCH_INTO();
  123.      92             FLASH_CON_PORT_OUT &=~ ALE;
  124.      93          
  125.      94             COMMAND_VAL=0X30;
  126.      95             COMMAND_LATCH_INTO();
  127.      96             //ATcmdDelay();
  128.      97             while((FLASH_CON_PORT_IN & RB)==0);
  129.      98             DATA_PORT_IN_INITIAL;
  130.      99             for (ucFaxPropertyLenCnt=0;ucFaxPropertyLenCnt<8;ucFaxPropertyLenCnt++)
  131.     100             {
  132.     101               FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
  133.     102               aucUartRxBuf[ucRxIndex++]=DATA_PORT_IN;
  134.     103               FLASH_CON_PORT_OUT |= RE;
  135.     104             }
  136.     105             wRearPntCnt++;
  137.     106             ucRxIndex3=ucRxIndex-4;
  138.     107                ucRxIndex2=ucRxIndex-3;
  139.     108                ucRxIndex1=ucRxIndex-2;
  140.     109                ucRxIndex0=ucRxIndex-1;
  141.     110               if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  142.     111                  0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  143.     112                {
  144.     113                break;  //next rear   
  145.     114                }//if
  146.     115             if (ucGeneralCnt<4)
  147.     116            wColumnAddress+=512;
  148.     117                    else
  149.     118            wColumnAddress+=16;
  150.     119             }//for read next rear pointer
  151.     120             
  152.     121             //ucRxIndex3=gucUartRxCnt-4;
  153.     122              //ucRxIndex2=gucUartRxCnt-3;
  154.     123              //ucRxIndex1=gucUartRxCnt-2;
  155.     124              //ucRxIndex0=gucUartRxCnt-1;
  156.     125             if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  157.     126                0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  158.     127               {break;}
  159.     128             }//for next page
  160.     129          
  161.     130             //ucRxIndex3=gucUartRxCnt-4;
  162.     131              //ucRxIndex2=gucUartRxCnt-3;
  163.     132              //ucRxIndex1=gucUartRxCnt-2;
  164.     133              //ucRxIndex0=gucUartRxCnt-1;
  165.     134             if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  166.     135                0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  167.     136               {break;}
  168.     137           }//for next block
  169.     138           gwFaxPropertyAddress=wPageAddress; //for write Fax property record //gwFaxPropertyAddress is equal gwFaxRearPointerAddress
  170.     139            gwColumnAddress=wColumnAddress; //
  171.     140          }
  172. Errors: 6
  173. Warnings: none