FaxFrontPointerManage.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:53:12 #
  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. #                     filesFaxFrontPointerManage.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. #                     filesFaxFrontPointerManage.c                          #
  24. #    List file     =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  25. #                     DebugListFaxFrontPointerManage.lst                   #
  26. #    Object file   =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
  27. #                     DebugObjFaxFrontPointerManage.r43                    #
  28. #                                                                            #
  29. #                                                                            #
  30. ##############################################################################
  31. E:projectFaxProgramVson_Bryan_Fax_Conexant_070412filesFaxFrontPointerManage.c
  32.       1          /***************************************
  33.       2          Program:     FlashManage
  34.       3          Author:      Bryan Cai
  35.       4          Date:        2006.12.12
  36.       5          ***************************************/
  37.       6          
  38.       7          
  39.       8          #include "includeH.h"
  40.       9          
  41.      10          
  42.      11          void WriteFaxFrontPointerTable(void)
  43.      12          {
  44.      13          
  45.      14           unsigned char ucFlashSttsOverflowCnt=0,ucFaxPointerLenCnt=0,
  46.      15                         ucRxIndex=0;
  47.      16          
  48.      17             COMMAND_VAL=cFlashWriteCmd;
  49.      18             COMMAND_LATCH_INTO();
  50.      19          //ADDRESS
  51.      20             
  52.      21             ADDRESS_VALUE=gwColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  53.      22             ADDRESS_LATCH_INTO();
  54.      23          
  55.      24             ADDRESS_VALUE=(gwColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  56.      25             ADDRESS_LATCH_INTO();
  57.      26          
  58.      27             ADDRESS_VALUE=gwFrontPointerAddress & 0xff;
  59.      28             ADDRESS_LATCH_INTO();
  60.      29          
  61.      30             ADDRESS_VALUE=(gwFrontPointerAddress>>8) & 0XFF;
  62.      31             ADDRESS_LATCH_INTO();
  63.      32             FLASH_CON_PORT_OUT &=~ ALE;
  64.      33          
  65.      34             DATA_PORT_OUT_INITIAL;
  66.      35             for (ucFaxPointerLenCnt=0;ucFaxPointerLenCnt<4;ucFaxPointerLenCnt++)
  67.      36             {
  68.      37             FLASH_CON_PORT_OUT&=~WE;
  69.      38               DATA_PORT_OUT=aucUartRxBuf[ucRxIndex++];
  70.      39               FLASH_CON_PORT_OUT |= WE;
  71.      40             }
  72.      41          
  73.      42             COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  74.      43             COMMAND_LATCH_INTO();
  75.      44          
  76.      45             READ_STATUS();
  77.      46             ucFlashSttsOverflowCnt=0;
  78.      47             if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  79.      48             {;}
  80.      49          }
  81.      50          void ReadLastFaxFrontPointer(void)//find last fax front pointer
  82.      51          {
  83.      52           unsigned int wPageAddress=0, wBlockAddress=0,
  84.      53                        wColumnAddress=0,wNextPageAddress=0,
  85.      54                        wRearPntCnt=0;
  86.      55           unsigned char ucRxIndex=0,
  87.      56                         ucRxIndex3=0,ucRxIndex2=0,
  88.      57                         ucRxIndex0=0,ucRxIndex1=0,
  89.      58                         ucGeneralCnt=0,ucFaxRearLenCnt;
  90.      59          
  91.      60          
  92.      61            for (wBlockAddress=cFaxFrontPointerTableStartBlockNum;
  93.      62                wBlockAddress<=cFaxFrontPointerTableOverBlockNum;wBlockAddress++)
  94.      63           {
  95.      64          
  96.      65           for (wPageAddress=(wBlockAddress<<6);wPageAddress<((wBlockAddress<<6)+64);wPageAddress++)
  97.      66           {
  98.      67                do{
  99.      68               wNextPageAddress=wPageAddress+64;
  100.      69               wPageAddress=CalNextPageAddress(wPageAddress);
  101.      70                }while(wNextPageAddress==wPageAddress);
  102.      71                
  103.      72                wColumnAddress=0;
  104.      73                ROW_ADDRESS_LOW=wPageAddress & 0XFF;
  105.      74                ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
  106.      75                
  107.      76                for (ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  108.      77                {
  109.      78          //COMMAND
  110.      79             COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2111BYTE
  111.      80             COMMAND_LATCH_INTO();
  112.      81          //ADDRESS
  113.      82          
  114.      83             ADDRESS_VALUE=wColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  115.      84             ADDRESS_LATCH_INTO();
  116.      85          
  117.      86             ADDRESS_VALUE=(wColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  118.      87             ADDRESS_LATCH_INTO();
  119.      88          
  120.      89             ADDRESS_VALUE=ROW_ADDRESS_LOW;
  121.      90             ADDRESS_LATCH_INTO();
  122.      91          
  123.      92             ADDRESS_VALUE=ROW_ADDRESS_HIGH;
  124.      93             ADDRESS_LATCH_INTO();
  125.      94             FLASH_CON_PORT_OUT &=~ ALE;
  126.      95          
  127.      96             COMMAND_VAL=0X30;
  128.      97             COMMAND_LATCH_INTO();
  129.      98             //ATcmdDelay();
  130.      99             while((FLASH_CON_PORT_IN & RB)==0);
  131.     100             DATA_PORT_IN_INITIAL;
  132.     101             for (ucFaxRearLenCnt=0;ucFaxRearLenCnt<4;ucFaxRearLenCnt++)
  133.     102             {
  134.     103               FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
  135.     104               aucUartRxBuf[ucRxIndex++]=DATA_PORT_IN;
  136.     105               FLASH_CON_PORT_OUT |= RE;
  137.     106             }
  138.     107             wRearPntCnt++;
  139.     108               
  140.     109               ucRxIndex3=ucRxIndex-4;
  141.     110                      ucRxIndex2=ucRxIndex-3;
  142.     111                      ucRxIndex1=ucRxIndex-2;
  143.     112                      ucRxIndex0=ucRxIndex-1;
  144.     113               if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  145.     114                  0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  146.     115                {
  147.     116                break;  //next front   
  148.     117                }//if
  149.     118             if (ucGeneralCnt<4)
  150.     119            wColumnAddress+=512;
  151.     120                    else
  152.     121            wColumnAddress+=16;
  153.     122             }//for read next front pointer
  154.     123              
  155.     124               if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  156.     125                  0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  157.     126                {break;}
  158.     127             }//for next page
  159.     128               
  160.     129               if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  161.     130                  0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  162.     131                {break;}
  163.     132           }//for next block
  164.     133           gwFrontPointerAddress=wPageAddress; //for write Fax front pointer
  165.     134            gwColumnAddress=wColumnAddress; //read next front pointer address, for write next front pointer
  166.     135            if (wRearPntCnt>1)
  167.     136            {
  168.     137              ucRxIndex1=ucRxIndex-8;
  169.     138              ucRxIndex0=ucRxIndex-7;
  170.     139              wPageAddress=aucUartRxBuf[ucRxIndex0];
  171.     140              gwPageAddress=(wPageAddress<<8) | aucUartRxBuf[ucRxIndex1]; 
  172.     141            }
  173.     142            else
  174.     143              gwPageAddress=cstFaxContentStartPage-1;//2559;//1279;//read data start address(1280)
  175.     144          }
  176. Errors: 8
  177. Warnings: none