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

传真(Fax)编程

开发平台:

C/C++

  1. ##############################################################################
  2. #                                                                            #
  3. # IAR MSP430 C/EC++ Compiler V2.10A/W32                23/Apr/2007  18:04:10 #
  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_070423 #
  12. #                     filesFlash.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_070423 #
  17. #                     DebugList -lA E:projectFaxProgramVson_Bryan_Fax_ #
  18. #                     Conexant_070423DebugList -o                         #
  19. #                     E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
  20. #                     DebugObj -z2 --no_cse --no_unroll --no_inline        #
  21. #                     --no_code_motion --debug -e                            #
  22. #                     E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
  23. #                     filesFlash.c                                          #
  24. #    List file     =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
  25. #                     DebugListFlash.lst                                   #
  26. #    Object file   =  E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
  27. #                     DebugObjFlash.r43                                    #
  28. #                                                                            #
  29. #                                                                            #
  30. ##############################################################################
  31. E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesFlash.c
  32.       1          //Flash model HY27UF081G2M
  33.       2          
  34.       3          #include "includeH.h"
  35.                                     In segment DATA16_AN, at 0x28
  36.       unsigned char const volatile __data P2IN
  37.                         P2IN:
  38.       000000                        DS8 1
  39.                                     In segment DATA16_AN, at 0x29
  40.       unsigned char volatile __data P2OUT
  41.                         P2OUT:
  42.       000000                        DS8 1
  43.                                     In segment DATA16_AN, at 0x30
  44.       unsigned char const volatile __data P5IN
  45.                         P5IN:
  46.       000000                        DS8 1
  47.                                     In segment DATA16_AN, at 0x31
  48.       unsigned char volatile __data P5OUT
  49.                         P5OUT:
  50.       000000                        DS8 1
  51.                                     In segment DATA16_AN, at 0x32
  52.       unsigned char volatile __data P5DIR
  53.                         P5DIR:
  54.       000000                        DS8 1
  55.       4          
  56.       5          
  57.       6          //***********************************************************************************
  58.       7          /*
  59.       8          void FlashPageCopy(void)
  60.       9          {
  61.      10                   unsigned char ucFlashSttsOverflowCnt=0;
  62.      11                   COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
  63.      12           COMMAND_LATCH_INTO();
  64.      13          //ADDRESS
  65.      14           ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  66.      15           ADDRESS_LATCH_INTO();
  67.      16          
  68.      17           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  69.      18           ADDRESS_LATCH_INTO();
  70.      19          
  71.      20           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  72.      21           ADDRESS_LATCH_INTO();
  73.      22          
  74.      23           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  75.      24           ADDRESS_LATCH_INTO();
  76.      25           FLASH_CON_PORT_OUT &=~ ALE;
  77.      26          
  78.      27           COMMAND_VAL=0X35;
  79.      28           COMMAND_LATCH_INTO();
  80.      29           //ATcmdDelay();
  81.      30           while((FLASH_CON_PORT_IN & RB)==0);
  82.      31             
  83.      32                   COMMAND_VAL=0x85;
  84.      33           COMMAND_LATCH_INTO();
  85.      34          
  86.      35          //ADDRESS
  87.      36           ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  88.      37           ADDRESS_LATCH_INTO();
  89.      38          
  90.      39           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  91.      40           ADDRESS_LATCH_INTO();
  92.      41          
  93.      42           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  94.      43           ADDRESS_LATCH_INTO();
  95.      44          
  96.      45           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  97.      46           ADDRESS_LATCH_INTO();
  98.      47          
  99.      48           FLASH_CON_PORT_OUT &=~ ALE;
  100.      49          
  101.      50           COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  102.      51           COMMAND_LATCH_INTO();
  103.      52          
  104.      53           READ_STATUS();
  105.      54           ucFlashSttsOverflowCnt=0;
  106.      55           if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  107.      56           {
  108.      57           ;
  109.      58           }
  110.      59          }
  111.      60          */
  112.      61          //***********************************************************************************
  113.                                     In segment CODE, align 2, align-sorted
  114.      62          void ZERO_ADDRESS(void)
  115.                         ZERO_ADDRESS:
  116.      63          {
  117.      64           COLUMN_ADDRESS_LOW=0X00;
  118.       000000   C243....             MOV.B   #0x0, &COLUMN_ADDRESS_LOW
  119.      65           COLUMN_ADDRESS_HIGH=0X00;
  120.       000004   C243....             MOV.B   #0x0, &COLUMN_ADDRESS_HIGH
  121.      66           ROW_ADDRESS_LOW=0X00;
  122.       000008   C243....             MOV.B   #0x0, &ROW_ADDRESS_LOW
  123.      67           ROW_ADDRESS_HIGH=0X00;
  124.       00000C   C243....             MOV.B   #0x0, &ROW_ADDRESS_HIGH
  125.      68          }
  126.       000010   3041                 RET
  127.      69          
  128.                                     In segment CODE, align 2, keep-with-next
  129.      70          void ERASE_ONE_BLOCK(void)
  130.                         ERASE_ONE_BLOCK:
  131.      71          {
  132.       000000   0A12                 PUSH.W  R10
  133.      72                          unsigned int wGeneralCount = 0;
  134.       000002   0A43                 MOV.W   #0x0, R10
  135.      73          //COMMAND
  136.      74           Flash_Reset();
  137.       000004   B012....             CALL    #Flash_Reset
  138.      75          
  139.      76           COMMAND_VAL=0X60;
  140.       000008   F2406000....         MOV.B   #0x60, &COMMAND_VAL
  141.      77           COMMAND_LATCH_INTO();
  142.       00000E   B012....             CALL    #COMMAND_LATCH_INTO
  143.      78          
  144.      79          //ADDRESS
  145.      80           /* ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  146.      81           ADDRESS_LATCH_INTO();
  147.      82          
  148.      83           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  149.      84           ADDRESS_LATCH_INTO();                 */ //a bug of Sep. 15
  150.      85          
  151.      86           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  152.       000012   D242........         MOV.B   &ROW_ADDRESS_LOW, &ADDRESS_VALUE
  153.      87           ADDRESS_LATCH_INTO();
  154.       000018   B012....             CALL    #ADDRESS_LATCH_INTO
  155.      88          
  156.      89           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  157.       00001C   D242........         MOV.B   &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
  158.      90           ADDRESS_LATCH_INTO();
  159.       000022   B012....             CALL    #ADDRESS_LATCH_INTO
  160.      91           FLASH_CON_PORT_OUT &=~ ALE;
  161.       000026   E2C32900             BIC.B   #0x2, &0x29
  162.      92          
  163.      93           COMMAND_VAL=0XD0;
  164.       00002A   F240D000....         MOV.B   #0xd0, &COMMAND_VAL
  165.      94           COMMAND_LATCH_INTO();
  166.       000030   B012....             CALL    #COMMAND_LATCH_INTO
  167.      95           //delay1ms();
  168.      96          
  169.      97           READ_STATUS();
  170.       000034   B012....             CALL    #READ_STATUS
  171.      98           while(wGeneralCount++<0xffff) //Jan. 18, 2007
  172.                         ??ERASE_ONE_BLOCK_0:
  173.       000038   0E4A                 MOV.W   R10, R14
  174.       00003A   1A43                 MOV.W   #0x1, R10
  175.       00003C   0A5E                 ADD.W   R14, R10
  176.       00003E   3E93                 CMP.W   #0xffff, R14
  177.       000040   0324                 JEQ     ??ERASE_ONE_BLOCK_1
  178.      99           {if (FLASH_STATUS==0) break;}
  179.       000042   C293....             CMP.B   #0x0, &FLASH_STATUS
  180.       000046   F823                 JNE     ??ERASE_ONE_BLOCK_0
  181.     100          
  182.     101          }
  183.                         ??ERASE_ONE_BLOCK_1:
  184.       000048   3A41                 POP.W   R10
  185.       00004A   3041                 RET
  186.     102          
  187.     103          //***********************************************************************************
  188.     104          
  189.                                     In segment CODE, align 2, keep-with-next
  190.     105          void PROGRAM_ONE_PAGE(unsigned char ucFlashWriteData)
  191.                         PROGRAM_ONE_PAGE:
  192.     106          {
  193.       000000   0A12                 PUSH.W  R10
  194.       000002   0B12                 PUSH.W  R11
  195.       000004   0812                 PUSH.W  R8
  196.       000006   4A4C                 MOV.B   R12, R10
  197.     107              unsigned int wByteCount;
  198.     108              unsigned char ucFlashSttsOverflowCnt=0;
  199.       000008   4843                 MOV.B   #0x0, R8
  200.     109          //COMMAND
  201.     110           COMMAND_VAL=cFlashWriteCmd;
  202.       00000A   F2408000....         MOV.B   #0x80, &COMMAND_VAL
  203.     111           COMMAND_LATCH_INTO();
  204.       000010   B012....             CALL    #COMMAND_LATCH_INTO
  205.     112          
  206.     113          //ADDRESS
  207.     114           ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
  208.       000014   C243....             MOV.B   #0x0, &ADDRESS_VALUE
  209.     115           ADDRESS_LATCH_INTO();
  210.       000018   B012....             CALL    #ADDRESS_LATCH_INTO
  211.     116          
  212.     117           ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
  213.       00001C   C243....             MOV.B   #0x0, &ADDRESS_VALUE
  214.     118           ADDRESS_LATCH_INTO();
  215.       000020   B012....             CALL    #ADDRESS_LATCH_INTO
  216.     119          
  217.     120           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  218.       000024   D242........         MOV.B   &ROW_ADDRESS_LOW, &ADDRESS_VALUE
  219.     121           ADDRESS_LATCH_INTO();
  220.       00002A   B012....             CALL    #ADDRESS_LATCH_INTO
  221.     122          
  222.     123           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  223.       00002E   D242........         MOV.B   &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
  224.     124           ADDRESS_LATCH_INTO();
  225.       000034   B012....             CALL    #ADDRESS_LATCH_INTO
  226.     125          
  227.     126           FLASH_CON_PORT_OUT &=~ ALE;
  228.       000038   E2C32900             BIC.B   #0x2, &0x29
  229.     127           //CALL DELAY_100US
  230.     128           //for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++); //delay
  231.     129          
  232.     130           DATA_PORT_OUT_INITIAL;
  233.       00003C   F2433200             MOV.B   #0xff, &0x32
  234.     131           for(wByteCount=0;wByteCount<2112;wByteCount++)
  235.       000040   0B43                 MOV.W   #0x0, R11
  236.                         ??PROGRAM_ONE_PAGE_0:
  237.       000042   3B904008             CMP.W   #0x840, R11
  238.       000046   082C                 JC      ??PROGRAM_ONE_PAGE_1
  239.     132           {
  240.     133           //FLASH_WRITE_DATA=0x55;
  241.     134           //WRITE_ONE_DATA();
  242.     135           FLASH_CON_PORT_OUT&=~WE;
  243.       000048   D2C32900             BIC.B   #0x1, &0x29
  244.     136             DATA_PORT_OUT=ucFlashWriteData;
  245.       00004C   C24A3100             MOV.B   R10, &0x31
  246.     137             FLASH_CON_PORT_OUT |= WE;
  247.       000050   D2D32900             BIS.B   #0x1, &0x29
  248.     138           }
  249.       000054   1B53                 ADD.W   #0x1, R11
  250.       000056   F53F                 JMP     ??PROGRAM_ONE_PAGE_0
  251.     139          
  252.     140           COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  253.                         ??PROGRAM_ONE_PAGE_1:
  254.       000058   F2401000....         MOV.B   #0x10, &COMMAND_VAL
  255.     141           COMMAND_LATCH_INTO();
  256.       00005E   B012....             CALL    #COMMAND_LATCH_INTO
  257.     142          
  258.     143           READ_STATUS();
  259.       000062   B012....             CALL    #READ_STATUS
  260.     144           ucFlashSttsOverflowCnt=0;
  261.       000066   4843                 MOV.B   #0x0, R8
  262.     145           if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  263.       000068   D293....             CMP.B   #0x1, &FLASH_STATUS
  264.       00006C   0120                 JNE     ??PROGRAM_ONE_PAGE_2
  265.       00006E   5853                 ADD.B   #0x1, R8
  266.     146           {
  267.     147           ;// Dec. 02,2006
  268.     148           //ERASE_ONE_BLOCK();
  269.     149           //PROGRAM_ONE_PAGE();
  270.     150           }
  271.     151          }
  272.                         ??PROGRAM_ONE_PAGE_2:
  273.       000070   3841                 POP.W   R8
  274.       000072   3B41                 POP.W   R11
  275.       000074   3A41                 POP.W   R10
  276.       000076   3041                 RET
  277.     152          
  278.     153          //***********************************************************************************
  279.     154          //***********************************************************************************
  280.                                     In segment CODE, align 2, keep-with-next
  281.     155          void PROGRAM_256_BYTE(void)
  282.                         PROGRAM_256_BYTE:
  283.     156          {
  284.       000000   0A12                 PUSH.W  R10
  285.       000002   0B12                 PUSH.W  R11
  286.       000004   0812                 PUSH.W  R8
  287.     157              unsigned int wGeneralCnt=0;
  288.       000006   0A43                 MOV.W   #0x0, R10
  289.     158              unsigned char ucFlashSttsOverflowCnt=0,ucRxIndex=0;
  290.       000008   4B43                 MOV.B   #0x0, R11
  291.       00000A   4843                 MOV.B   #0x0, R8
  292.     159          //COMMAND
  293.     160           COMMAND_VAL=0X80;
  294.       00000C   F2408000....         MOV.B   #0x80, &COMMAND_VAL
  295.     161           COMMAND_LATCH_INTO();
  296.       000012   B012....             CALL    #COMMAND_LATCH_INTO
  297.     162          
  298.     163          //ADDRESS
  299.     164           ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  300.       000016   D242........         MOV.B   &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
  301.     165           ADDRESS_LATCH_INTO();
  302.       00001C   B012....             CALL    #ADDRESS_LATCH_INTO
  303.     166          
  304.     167           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  305.       000020   D242........         MOV.B   &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
  306.     168           ADDRESS_LATCH_INTO();
  307.       000026   B012....             CALL    #ADDRESS_LATCH_INTO
  308.     169          
  309.     170           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  310.       00002A   D242........         MOV.B   &ROW_ADDRESS_LOW, &ADDRESS_VALUE
  311.     171           ADDRESS_LATCH_INTO();
  312.       000030   B012....             CALL    #ADDRESS_LATCH_INTO
  313.     172          
  314.     173           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  315.       000034   D242........         MOV.B   &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
  316.     174           ADDRESS_LATCH_INTO();
  317.       00003A   B012....             CALL    #ADDRESS_LATCH_INTO
  318.     175          
  319.     176           FLASH_CON_PORT_OUT &=~ ALE;
  320.       00003E   E2C32900             BIC.B   #0x2, &0x29
  321.     177           //CALL DELAY_100US
  322.     178           for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++);
  323.       000042   0A43                 MOV.W   #0x0, R10
  324.                         ??PROGRAM_256_BYTE_0:
  325.       000044   3A90FF00             CMP.W   #0xff, R10
  326.       000048   022C                 JC      ??PROGRAM_256_BYTE_2
  327.       00004A   1A53                 ADD.W   #0x1, R10
  328.       00004C   FB3F                 JMP     ??PROGRAM_256_BYTE_0
  329.     179           DATA_PORT_OUT_INITIAL;
  330.                         ??PROGRAM_256_BYTE_2:
  331.       00004E   F2433200             MOV.B   #0xff, &0x32
  332.     180           for(ucRxIndex=0;ucRxIndex<255;ucRxIndex++)
  333.       000052   4843                 MOV.B   #0x0, R8
  334.                         ??PROGRAM_256_BYTE_1:
  335.       000054   7893                 CMP.B   #0xff, R8
  336.       000056   0C2C                 JC      ??PROGRAM_256_BYTE_3
  337.     181           {
  338.     182           FLASH_CON_PORT_OUT&=~WE;
  339.       000058   D2C32900             BIC.B   #0x1, &0x29
  340.     183             DATA_PORT_OUT=aucUartRxBuf[ucRxIndex];
  341.       00005C   4E48                 MOV.B   R8, R14
  342.       00005E   3EF0FF00             AND.W   #0xff, R14
  343.       000062   D24E....3100         MOV.B   aucUartRxBuf(R14), &0x31
  344.     184             FLASH_CON_PORT_OUT |= WE; //LATCH INTO ONE DATA
  345.       000068   D2D32900             BIS.B   #0x1, &0x29
  346.     185           }
  347.       00006C   5853                 ADD.B   #0x1, R8
  348.       00006E   F23F                 JMP     ??PROGRAM_256_BYTE_1
  349.     186          
  350.     187           COMMAND_VAL=0X10; //10H INITIATES PROGRAM
  351.                         ??PROGRAM_256_BYTE_3:
  352.       000070   F2401000....         MOV.B   #0x10, &COMMAND_VAL
  353.     188           COMMAND_LATCH_INTO();
  354.       000076   B012....             CALL    #COMMAND_LATCH_INTO
  355.     189          
  356.     190           READ_STATUS();
  357.       00007A   B012....             CALL    #READ_STATUS
  358.     191           ucFlashSttsOverflowCnt=0;
  359.       00007E   4B43                 MOV.B   #0x0, R11
  360.     192           if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  361.       000080   D293....             CMP.B   #0x1, &FLASH_STATUS
  362.       000084   0120                 JNE     ??PROGRAM_256_BYTE_4
  363.       000086   5B53                 ADD.B   #0x1, R11
  364.     193           {
  365.     194           ;// Dec. 02,2006
  366.     195           //ERASE_ONE_BLOCK();
  367.     196           //PROGRAM_ONE_PAGE();
  368.     197           }
  369.     198          }
  370.                         ??PROGRAM_256_BYTE_4:
  371.       000088   3841                 POP.W   R8
  372.       00008A   3B41                 POP.W   R11
  373.       00008C   3A41                 POP.W   R10
  374.       00008E   3041                 RET
  375.     199          //***********************************************************************************
  376.                                     In segment CODE, align 2, keep-with-next
  377.     200          void READ_256_BYTE(void)
  378.                         READ_256_BYTE:
  379.     201          {
  380.       000000   0A12                 PUSH.W  R10
  381.       000002   0B12                 PUSH.W  R11
  382.     202                          int wByteCnt=0;
  383.       000004   0A43                 MOV.W   #0x0, R10
  384.     203           unsigned char ucRxCnt=0;
  385.       000006   4B43                 MOV.B   #0x0, R11
  386.     204          //COMMAND
  387.     205           Flash_Reset();
  388.       000008   B012....             CALL    #Flash_Reset
  389.     206           COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
  390.       00000C   C243....             MOV.B   #0x0, &COMMAND_VAL
  391.     207           COMMAND_LATCH_INTO();
  392.       000010   B012....             CALL    #COMMAND_LATCH_INTO
  393.     208          //ADDRESS
  394.     209           ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  395.       000014   D242........         MOV.B   &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
  396.     210           ADDRESS_LATCH_INTO();
  397.       00001A   B012....             CALL    #ADDRESS_LATCH_INTO
  398.     211          
  399.     212           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  400.       00001E   D242........         MOV.B   &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
  401.     213           ADDRESS_LATCH_INTO();
  402.       000024   B012....             CALL    #ADDRESS_LATCH_INTO
  403.     214          
  404.     215           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  405.       000028   D242........         MOV.B   &ROW_ADDRESS_LOW, &ADDRESS_VALUE
  406.     216           ADDRESS_LATCH_INTO();
  407.       00002E   B012....             CALL    #ADDRESS_LATCH_INTO
  408.     217          
  409.     218           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  410.       000032   D242........         MOV.B   &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
  411.     219           ADDRESS_LATCH_INTO();
  412.       000038   B012....             CALL    #ADDRESS_LATCH_INTO
  413.     220           FLASH_CON_PORT_OUT &=~ ALE;
  414.       00003C   E2C32900             BIC.B   #0x2, &0x29
  415.     221          
  416.     222           COMMAND_VAL=0X30;
  417.       000040   F2403000....         MOV.B   #0x30, &COMMAND_VAL
  418.     223           COMMAND_LATCH_INTO();
  419.       000046   B012....             CALL    #COMMAND_LATCH_INTO
  420.     224           ATcmdDelay();
  421.       00004A   B012....             CALL    #ATcmdDelay
  422.     225           while((FLASH_CON_PORT_IN & RB)==0);
  423.                         ??READ_256_BYTE_0:
  424.       00004E   F2B020002800         BIT.B   #0x20, &0x28
  425.       000054   FC2B                 JNC     ??READ_256_BYTE_0
  426.     226          
  427.     227           DATA_PORT_IN_INITIAL;
  428.       000056   C2433200             MOV.B   #0x0, &0x32
  429.     228           for(wByteCnt=0,ucRxCnt=0;wByteCnt<256;wByteCnt++)
  430.       00005A   0A43                 MOV.W   #0x0, R10
  431.       00005C   4B43                 MOV.B   #0x0, R11
  432.                         ??READ_256_BYTE_1:
  433.       00005E   3A900001             CMP.W   #0x100, R10
  434.       000062   0F34                 JGE     ??READ_256_BYTE_2
  435.     229           {
  436.     230                       FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
  437.       000064   F2C010002900         BIC.B   #0x10, &0x29
  438.     231               aucUartRxBuf[ucRxCnt++]=DATA_PORT_IN;
  439.       00006A   4E4B                 MOV.B   R11, R14
  440.       00006C   3EF0FF00             AND.W   #0xff, R14
  441.       000070   DE423000....         MOV.B   &0x30, aucUartRxBuf(R14)
  442.       000076   5B53                 ADD.B   #0x1, R11
  443.     232               FLASH_CON_PORT_OUT |= RE;
  444.       000078   F2D010002900         BIS.B   #0x10, &0x29
  445.     233           }
  446.       00007E   1A53                 ADD.W   #0x1, R10
  447.       000080   EE3F                 JMP     ??READ_256_BYTE_1
  448.     234          
  449.     235          }
  450.                         ??READ_256_BYTE_2:
  451.       000082   3B41                 POP.W   R11
  452.       000084   3A41                 POP.W   R10
  453.       000086   3041                 RET
  454.     236          //***********************************************************************************
  455.     237          
  456.     238          /***********************************************************************************
  457.     239          void READ_ONE_PAGE(void)
  458.     240          {
  459.     241                          int wByteCnt=0;
  460.     242           unsigned char ucRxCnt=0;
  461.     243          //COMMAND
  462.     244           COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
  463.     245           COMMAND_LATCH_INTO();
  464.     246          //ADDRESS
  465.     247           ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
  466.     248           ADDRESS_LATCH_INTO();
  467.     249          
  468.     250           ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
  469.     251           ADDRESS_LATCH_INTO();
  470.     252          
  471.     253           ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
  472.     254           ADDRESS_LATCH_INTO();
  473.     255          
  474.     256           ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
  475.     257           ADDRESS_LATCH_INTO();
  476.     258           FLASH_CON_PORT_OUT &=~ ALE;
  477.     259          
  478.     260           COMMAND_VAL=0X30;
  479.     261           COMMAND_LATCH_INTO();
  480.     262           ATcmdDelay();
  481.     263           while((FLASH_CON_PORT_IN & RB)==0);
  482.     264           for(wByteCnt=0,ucRxCnt=0;wByteCnt<2048;wByteCnt++)
  483.     265           {
  484.     266                       READ_ONE_DATA();
  485.     267                       aucUartRxBuf[ucRxCnt++]=FLASH_READ_DATA;
  486.     268           }
  487.     269          }
  488.     270          ***********************************************************************************/
  489.     271          
  490.     272          //***********************************************************************************
  491.                                     In segment CODE, align 2, keep-with-next
  492.     273          void READ_STATUS(void)
  493.                         READ_STATUS:
  494.                         ??READ_STATUS_0:
  495.     274          {
  496.     275           //CALL DELAY_50US
  497.     276           while((FLASH_CON_PORT_IN & RB)==0); //FLASH_CON_PORT,RB,$ //CHECK BUSY
  498.       000000   F2B020002800         BIT.B   #0x20, &0x28
  499.       000006   FC2B                 JNC     ??READ_STATUS_0
  500.     277          
  501.     278           COMMAND_VAL=0X70;
  502.       000008   F2407000....         MOV.B   #0x70, &COMMAND_VAL
  503.     279          
  504.     280           COMMAND_LATCH_INTO();
  505.       00000E   B012....             CALL    #COMMAND_LATCH_INTO
  506.     281          
  507.     282           DATA_PORT_IN_INITIAL;
  508.       000012   C2433200             MOV.B   #0x0, &0x32
  509.     283           READ_ONE_DATA(); //WHEN READY,READ STATUS
  510.       000016   B012....             CALL    #READ_ONE_DATA
  511.     284           FLASH_STATUS=FLASH_READ_DATA & 0x01; //0 OK 1 error
  512.       00001A   5E42....             MOV.B   &FLASH_READ_DATA, R14
  513.       00001E   5EF3                 AND.B   #0x1, R14
  514.       000020   C24E....             MOV.B   R14, &FLASH_STATUS
  515.     285           //if((READ_DATA_VALUE&0x01)==0)
  516.     286           // FLASH_STATUS=0; //0 OK 1 error
  517.     287          }
  518.       000024   3041                 RET
  519.     288          
  520.     289          //***********************************************************************************/
  521.     290          
  522.                                     In segment CODE, align 2, keep-with-next
  523.     291          void FLASH_READ_ID(void)
  524.                         FLASH_READ_ID:
  525.     292          {
  526.     293           COMMAND_VAL=0X90;
  527.       000000   F2409000....         MOV.B   #0x90, &COMMAND_VAL
  528.     294           COMMAND_LATCH_INTO();
  529.       000006   B012....             CALL    #COMMAND_LATCH_INTO
  530.     295          
  531.     296           ADDRESS_VALUE=0X00;
  532.       00000A   C243....             MOV.B   #0x0, &ADDRESS_VALUE
  533.     297           ADDRESS_LATCH_INTO();
  534.       00000E   B012....             CALL    #ADDRESS_LATCH_INTO
  535.     298           FLASH_CON_PORT_OUT &=~ ALE;
  536.       000012   E2C32900             BIC.B   #0x2, &0x29
  537.     299          
  538.     300           DATA_PORT_IN_INITIAL;
  539.       000016   C2433200             MOV.B   #0x0, &0x32
  540.     301           READ_ONE_DATA();
  541.       00001A   B012....             CALL    #READ_ONE_DATA
  542.     302           while (!(FLASH_READ_DATA==0xad));
  543.                         ??FLASH_READ_ID_0:
  544.       00001E   F290AD00....         CMP.B   #0xad, &FLASH_READ_DATA
  545.       000024   FC23                 JNE     ??FLASH_READ_ID_0
  546.     303          
  547.     304           READ_ONE_DATA();
  548.       000026   B012....             CALL    #READ_ONE_DATA
  549.     305           while (!(FLASH_READ_DATA==0xf1));
  550.                         ??FLASH_READ_ID_1:
  551.       00002A   F290F100....         CMP.B   #0xf1, &FLASH_READ_DATA
  552.       000030   FC23                 JNE     ??FLASH_READ_ID_1
  553.     306           READ_ONE_DATA();
  554.       000032   B012....             CALL    #READ_ONE_DATA
  555.     307           READ_ONE_DATA();
  556.       000036   3040....             BR      #READ_ONE_DATA
  557.     308          }
  558.     309          //***********************************************************************************
  559.     310          
  560.                                     In segment CODE, align 2, keep-with-next
  561.     311          void Flash_Reset(void) //flash reset
  562.                         Flash_Reset:
  563.     312          { 
  564.       000000   0A12                 PUSH.W  R10
  565.     313           int i;
  566.     314           COMMAND_VAL=0XFF; //reset command
  567.       000002   F243....             MOV.B   #0xff, &COMMAND_VAL
  568.     315           COMMAND_LATCH_INTO();
  569.       000006   B012....             CALL    #COMMAND_LATCH_INTO
  570.     316           for (i=0;i<3000;i++); //delay 
  571.       00000A   0A43                 MOV.W   #0x0, R10
  572.                         ??Flash_Reset_0:
  573.       00000C   3A90B80B             CMP.W   #0xbb8, R10
  574.       000010   0234                 JGE     ??Flash_Reset_1
  575.       000012   1A53                 ADD.W   #0x1, R10
  576.       000014   FB3F                 JMP     ??Flash_Reset_0
  577.     317          }
  578.                         ??Flash_Reset_1:
  579.       000016   3A41                 POP.W   R10
  580.       000018   3041                 RET
  581.     318          
  582.     319          //***********************************************************************************
  583.                                     In segment CODE, align 2, align-sorted
  584.     320          void COMMAND_LATCH_INTO(void) //FLASH CONTROL PORT
  585.                         COMMAND_LATCH_INTO:
  586.     321          {
  587.     322          
  588.     323           FLASH_CON_PORT_OUT |= CLE; //COMMAND LATCH ENABLE
  589.       000000   E2D22900             BIS.B   #0x4, &0x29
  590.     324           FLASH_CON_PORT_OUT &= ~(CE|WE); //CHIP ENABLE WRITE ENABLE
  591.       000004   F2F0F6002900         AND.B   #0xf6, &0x29
  592.     325          
  593.     326           DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ COMMAND
  594.       00000A   F2433200             MOV.B   #0xff, &0x32
  595.     327          
  596.     328           DATA_PORT_OUT=COMMAND_VAL; //DATA SETUP
  597.       00000E   D242....3100         MOV.B   &COMMAND_VAL, &0x31
  598.     329          
  599.     330           FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE COMMAND
  600.       000014   D2D32900             BIS.B   #0x1, &0x29
  601.     331                          FLASH_CON_PORT_OUT&= ~CLE;
  602.       000018   E2C22900             BIC.B   #0x4, &0x29
  603.     332          }
  604.       00001C   3041                 RET
  605.     333          //********************************************************
  606.     334          
  607.                                     In segment CODE, align 2, align-sorted
  608.     335          void ADDRESS_LATCH_INTO(void)
  609.                         ADDRESS_LATCH_INTO:
  610.     336          {
  611.     337           FLASH_CON_PORT_OUT |= ALE;
  612.       000000   E2D32900             BIS.B   #0x2, &0x29
  613.     338           FLASH_CON_PORT_OUT &=~ (CLE|WE);
  614.       000004   F2F0FA002900         AND.B   #0xfa, &0x29
  615.     339           DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ ADDRESS
  616.       00000A   F2433200             MOV.B   #0xff, &0x32
  617.     340           DATA_PORT_OUT=ADDRESS_VALUE;
  618.       00000E   D242....3100         MOV.B   &ADDRESS_VALUE, &0x31
  619.     341          
  620.     342           FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE ADDRESS
  621.       000014   D2D32900             BIS.B   #0x1, &0x29
  622.     343           //FLASH_CON_PORT_OUT &=~ ALE;
  623.     344          
  624.     345          }
  625.       000018   3041                 RET
  626.     346          /********************************************************
  627.     347          void WRITE_ONE_DATA(void)
  628.     348          {
  629.     349           FLASH_CON_PORT_OUT&=~WE;
  630.     350           //DATA_PORT_OUT_INITIAL; //MCU OUTPUT,MCU WRITE A DATA TO FLASH
  631.     351           DATA_PORT_OUT=FLASH_WRITE_DATA;
  632.     352           FLASH_CON_PORT_OUT |= WE; //LATCH INTO ONE DATA
  633.     353          
  634.     354          }
  635.     355          
  636.     356          ********************************************************/
  637.                                     In segment CODE, align 2, align-sorted
  638.     357          void READ_ONE_DATA(void)
  639.                         READ_ONE_DATA:
  640.     358          {
  641.     359           FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
  642.       000000   F2C010002900         BIC.B   #0x10, &0x29
  643.     360          
  644.     361           //DATA_PORT_IN_INITIAL; //MCU INPUT,MCU READ A DATA
  645.     362           FLASH_READ_DATA=DATA_PORT_IN;
  646.       000006   D2423000....         MOV.B   &0x30, &FLASH_READ_DATA
  647.     363           FLASH_CON_PORT_OUT |= RE;
  648.       00000C   F2D010002900         BIS.B   #0x10, &0x29
  649.     364          }
  650.       000012   3041                 RET
  651.    Maximum stack usage in bytes:
  652.      Function                CSTACK
  653.      --------                ------
  654.      ADDRESS_LATCH_INTO          2
  655.      COMMAND_LATCH_INTO          2
  656.      ERASE_ONE_BLOCK             4
  657.        -> Flash_Reset            4
  658.        -> COMMAND_LATCH_INTO     4
  659.        -> ADDRESS_LATCH_INTO     4
  660.        -> ADDRESS_LATCH_INTO     4
  661.        -> COMMAND_LATCH_INTO     4
  662.        -> READ_STATUS            4
  663.      FLASH_READ_ID               2
  664.        -> COMMAND_LATCH_INTO     2
  665.        -> ADDRESS_LATCH_INTO     2
  666.        -> READ_ONE_DATA          2
  667.        -> READ_ONE_DATA          2
  668.        -> READ_ONE_DATA          2
  669.        -> READ_ONE_DATA          2
  670.      Flash_Reset                 4
  671.        -> COMMAND_LATCH_INTO     4
  672.      PROGRAM_256_BYTE            8
  673.        -> COMMAND_LATCH_INTO     8
  674.        -> ADDRESS_LATCH_INTO     8
  675.        -> ADDRESS_LATCH_INTO     8
  676.        -> ADDRESS_LATCH_INTO     8
  677.        -> ADDRESS_LATCH_INTO     8
  678.        -> COMMAND_LATCH_INTO     8
  679.        -> READ_STATUS            8
  680.      PROGRAM_ONE_PAGE            8
  681.        -> COMMAND_LATCH_INTO     8
  682.        -> ADDRESS_LATCH_INTO     8
  683.        -> ADDRESS_LATCH_INTO     8
  684.        -> ADDRESS_LATCH_INTO     8
  685.        -> ADDRESS_LATCH_INTO     8
  686.        -> COMMAND_LATCH_INTO     8
  687.        -> READ_STATUS            8
  688.      READ_256_BYTE               6
  689.        -> Flash_Reset            6
  690.        -> COMMAND_LATCH_INTO     6
  691.        -> ADDRESS_LATCH_INTO     6
  692.        -> ADDRESS_LATCH_INTO     6
  693.        -> ADDRESS_LATCH_INTO     6
  694.        -> ADDRESS_LATCH_INTO     6
  695.        -> COMMAND_LATCH_INTO     6
  696.        -> ATcmdDelay             6
  697.      READ_ONE_DATA               2
  698.      READ_STATUS                 2
  699.        -> COMMAND_LATCH_INTO     2
  700.        -> READ_ONE_DATA          2
  701.      ZERO_ADDRESS                2
  702.    Segment part sizes:
  703.      Function/Label     Bytes
  704.      --------------     -----
  705.      P2IN                  1
  706.      P2OUT                 1
  707.      P5IN                  1
  708.      P5OUT                 1
  709.      P5DIR                 1
  710.      ZERO_ADDRESS         18
  711.      ERASE_ONE_BLOCK      76
  712.      PROGRAM_ONE_PAGE    120
  713.      PROGRAM_256_BYTE    144
  714.      READ_256_BYTE       136
  715.      ??READ_STATUS_0      38
  716.      FLASH_READ_ID        58
  717.      Flash_Reset          26
  718.      COMMAND_LATCH_INTO   30
  719.      ADDRESS_LATCH_INTO   26
  720.      READ_ONE_DATA        20
  721.  
  722.  692 bytes in segment CODE
  723.    5 bytes in segment DATA16_AN
  724.  
  725.  692 bytes of CODE memory
  726.    0 bytes of DATA memory (+ 5 bytes shared)
  727. Errors: none
  728. Warnings: none