FaxRxBuf2Flash.s43
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:27k
- NAME FaxRxBuf2Flash
- RTMODEL "__double_size", "32"
- RTMODEL "__pic", "no"
- RTMODEL "__reg_r4", "free"
- RTMODEL "__reg_r5", "free"
- RTMODEL "__rt_version", "1"
- RSEG CSTACK:DATA:SORT:NOROOT(1)
- EXTERN ?Epilogue8
- EXTERN gwPageAddress
- EXTERN ViewCommunicationRX
- FUNCTION ViewCommunicationRX,0202H
- EXTERN aucUartRxBuf
- EXTERN gdwRxQueueFrontCnt
- EXTERN aucViewData
- EXTERN FRHTSI
- EXTERN ZERO_ADDRESS
- FUNCTION ZERO_ADDRESS,0202H
- EXTERN ROW_ADDRESS_LOW
- EXTERN ROW_ADDRESS_HIGH
- EXTERN PROGRAM_256_BYTE
- FUNCTION PROGRAM_256_BYTE,0202H
- EXTERN ReadLast16BytesFromFlashMemoryArea
- FUNCTION ReadLast16BytesFromFlashMemoryArea,0202H
- EXTERN CalNextPageAddress
- FUNCTION CalNextPageAddress,0202H
- EXTERN ?DivMod16u
- EXTERN ERASE_ONE_BLOCK
- FUNCTION ERASE_ONE_BLOCK,0202H
- EXTERN COMMAND_VAL
- EXTERN COMMAND_LATCH_INTO
- FUNCTION COMMAND_LATCH_INTO,0202H
- EXTERN ADDRESS_VALUE
- EXTERN ADDRESS_LATCH_INTO
- FUNCTION ADDRESS_LATCH_INTO,0202H
- EXTERN READ_STATUS
- FUNCTION READ_STATUS,0202H
- EXTERN FLASH_STATUS
- EXTERN gwGeneralPageAddress
- EXTERN ?ShiftRight16u_6
- EXTERN ?ShiftLeft16_6
- EXTERN gwColumnAddress
- EXTERN Write16Bytes2FlashMemoryArea
- FUNCTION Write16Bytes2FlashMemoryArea,0202H
- EXTERN ?longjmp_r4
- EXTERN ?longjmp_r5
- EXTERN ?setjmp_r4
- EXTERN ?setjmp_r5
- PUBWEAK ?setjmp_save_r4
- PUBWEAK ?setjmp_save_r5
- PUBLIC FaxRxBufRawdata2Flash
- FUNCTION FaxRxBufRawdata2Flash,021203H
- LOCFRAME CSTACK, 20, STACK
- PUBWEAK P2IN
- PUBWEAK P2OUT
-
- CFI Names cfiNames0
- CFI StackFrame CFA SP DATA
- CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
- CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
- CFI EndNames cfiNames0
-
- CFI Common cfiCommon0 Using cfiNames0
- CFI CodeAlign 2
- CFI DataAlign 2
- CFI ReturnAddress PC CODE
- CFI CFA SP+2
- CFI PC Frame(CFA, -2)
- CFI SR Undefined
- CFI R4 SameValue
- CFI R5 SameValue
- CFI R6 SameValue
- CFI R7 SameValue
- CFI R8 SameValue
- CFI R9 SameValue
- CFI R10 SameValue
- CFI R11 SameValue
- CFI R12 Undefined
- CFI R13 Undefined
- CFI R14 Undefined
- CFI R15 Undefined
- CFI EndCommon cfiCommon0
-
- // E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesFaxRxBuf2Flash.c
- // 1
- // 2 //**************************************************************************
- // 3
- // 4 #include "includeH.h"
- ASEGN DATA16_AN:DATA:NOROOT,028H
- // unsigned char const volatile __data P2IN
- P2IN:
- DS8 1
- ASEGN DATA16_AN:DATA:NOROOT,029H
- // unsigned char volatile __data P2OUT
- P2OUT:
- DS8 1
- // 5
- RSEG CODE:CODE:NOROOT(1)
- // 6 void FaxRxBufRawdata2Flash(void)
- FaxRxBufRawdata2Flash:
- CFI Block cfiBlock0 Using cfiCommon0
- CFI Function FaxRxBufRawdata2Flash
- // 7 {
- FUNCALL FaxRxBufRawdata2Flash, ViewCommunicationRX
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ZERO_ADDRESS
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, PROGRAM_256_BYTE
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ReadLast16BytesFromFlashMemoryArea
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, CalNextPageAddress
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, READ_STATUS
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, CalNextPageAddress
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, Write16Bytes2FlashMemoryArea
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ReadLast16BytesFromFlashMemoryArea
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
- LOCFRAME CSTACK, 20, STACK
- FUNCALL FaxRxBufRawdata2Flash, Write16Bytes2FlashMemoryArea
- LOCFRAME CSTACK, 20, STACK
- PUSH.W R10
- CFI R10 Frame(CFA, -4)
- CFI CFA SP+4
- PUSH.W R11
- CFI R11 Frame(CFA, -6)
- CFI CFA SP+6
- PUSH.W R8
- CFI R8 Frame(CFA, -8)
- CFI CFA SP+8
- PUSH.W R9
- CFI R9 Frame(CFA, -10)
- CFI CFA SP+10
- PUSH.W R6
- CFI R6 Frame(CFA, -12)
- CFI CFA SP+12
- PUSH.W R7
- CFI R7 Frame(CFA, -14)
- CFI CFA SP+14
- PUSH.W R4
- CFI R4 Frame(CFA, -16)
- CFI CFA SP+16
- PUSH.W R5
- CFI R5 Frame(CFA, -18)
- CFI CFA SP+18
- SUB.W #0x2, SP
- CFI CFA SP+20
- // 8 unsigned char
- // 9 ucRxIndex=0,ucGeneralCnt=0,ucFlashSttsOverflowCnt=0,
- MOV.B #0x0, R11
- MOV.B #0x0, R10
- MOV.B #0x0, R5
- // 10 ucBlockCnt=0;
- MOV.B #0x0, R9
- // 11 unsigned int wPageCount=0,wRxBufPageRearAddress=0,
- MOV.W #0x0, R6
- MOV.W #0x0, 0x0(SP)
- // 12 wNextPageAddress=0,wPageAddress=cstFaxRxBufStartPage,
- MOV.W #0x0, R4
- MOV.W #0x4c0, R8
- // 13 wEveryFaxHead=0;//wFaxPropertyNo=0;
- MOV.W #0x0, R7
- // 14
- // 15
- // 16
- // 17
- // 18 wRxBufPageRearAddress=gwPageAddress;//1226;//gwPageAddress;
- MOV.W &gwPageAddress, 0x0(SP)
- // 19 ViewCommunicationRX();//read fax time
- CALL #ViewCommunicationRX
- // 20 for(ucGeneralCnt=0;ucGeneralCnt<255;ucGeneralCnt++)
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_0:
- CMP.B #0xff, R10
- JC ??FaxRxBufRawdata2Flash_13
- // 21 {
- // 22 aucUartRxBuf[ucGeneralCnt]=0; //clear RX buffer
- MOV.B R10, R14
- AND.W #0xff, R14
- MOV.B #0x0, aucUartRxBuf(R14)
- // 23 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_0
- // 24
- // 25 gdwRxQueueFrontCnt += 2048;
- ??FaxRxBufRawdata2Flash_13:
- ADD.W #0x800, &gdwRxQueueFrontCnt
- ADDC.W #0x0, &gdwRxQueueFrontCnt + 0x2
- // 26 //Fax packet head ba 23 ba 23
- // 27 ucRxIndex=0; //write Fax Property
- MOV.B #0x0, R11
- // 28 aucUartRxBuf[ucRxIndex++] = 0xba;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0xba, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 29 aucUartRxBuf[ucRxIndex++] = 0x23;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x23, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 30 aucUartRxBuf[ucRxIndex++] = 0xba;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0xba, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 31 aucUartRxBuf[ucRxIndex++] = 0x23;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x23, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 32 for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_1:
- CMP.B #0x8, R10
- JC ??FaxRxBufRawdata2Flash_14
- // 33 {
- // 34 aucUartRxBuf[ucRxIndex++] = 0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 35 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_1
- // 36 //fax Length
- // 37 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt & 0xff);
- ??FaxRxBufRawdata2Flash_14:
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gdwRxQueueFrontCnt, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 38 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt >> 8) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.W &gdwRxQueueFrontCnt, R15
- SWPB R15
- AND.W #0xff, R15
- MOV.B R15, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 39 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>16) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gdwRxQueueFrontCnt + 0x2, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 40 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>24) & 0xff;
- MOV.B R11, R12
- AND.W #0xff, R12
- MOV.W &gdwRxQueueFrontCnt, R14
- MOV.W &gdwRxQueueFrontCnt + 0x2, R15
- SWPB R15
- MOV.B R15, R14
- MOV.W #0x0, R15
- MOV.B R14, aucUartRxBuf(R12)
- ADD.B #0x1, R11
- // 41 for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_2:
- CMP.B #0x8, R10
- JC ??FaxRxBufRawdata2Flash_15
- // 42 {
- // 43 aucUartRxBuf[ucRxIndex++] = 0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 44 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_2
- // 45 //fax time
- // 46 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewSecondIndex];// //second
- ??FaxRxBufRawdata2Flash_15:
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x2, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 47 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMinuteIndex];// //minute
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x1, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 48 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewHourIndex];//hour
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 49 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewDateIndex];//date
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x4, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 50 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMonthIndex];//month
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x3, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 51 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewYearIndex];//Year
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x5, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 52 //fax Head and Rear Address
- // 53 //aucUartRxBuf[ucRxIndex++] = wEveryFaxHead & 0xff;
- // 54 //aucUartRxBuf[ucRxIndex++] = (wEveryFaxHead>>8) & 0xff;
- // 55 //aucUartRxBuf[ucRxIndex++] = gwPageAddress & 0xff;
- // 56 //aucUartRxBuf[ucRxIndex++] = (gwPageAddress>>8) & 0xff;
- // 57 for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_3:
- CMP.B #0x8, R10
- JC ??FaxRxBufRawdata2Flash_16
- // 58 {
- // 59 aucUartRxBuf[ucRxIndex++] = 0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 60 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_3
- // 61
- // 62 //fax Telephone Number
- // 63 for (ucGeneralCnt=0; ucGeneralCnt<25; ucGeneralCnt++)
- ??FaxRxBufRawdata2Flash_16:
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_4:
- CMP.B #0x19, R10
- JC ??FaxRxBufRawdata2Flash_17
- // 64 {
- // 65 aucUartRxBuf[ucRxIndex++] = FRHTSI[ucGeneralCnt];
- MOV.B R11, R15
- AND.W #0xff, R15
- MOV.B R10, R14
- AND.W #0xff, R14
- MOV.B FRHTSI(R14), aucUartRxBuf(R15)
- ADD.B #0x1, R11
- // 66 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_4
- // 67 for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
- ??FaxRxBufRawdata2Flash_17:
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_5:
- CMP.B #0x8, R10
- JC ??FaxRxBufRawdata2Flash_18
- // 68 {
- // 69 aucUartRxBuf[ucRxIndex++] = 0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 70 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_5
- // 71
- // 72 //wPageAddress = cstFaxRxBufFirstPage;
- // 73 ZERO_ADDRESS();
- ??FaxRxBufRawdata2Flash_18:
- CALL #ZERO_ADDRESS
- // 74 ROW_ADDRESS_LOW = wPageAddress & 0XFF;
- MOV.B R8, &ROW_ADDRESS_LOW
- // 75 ROW_ADDRESS_HIGH = (wPageAddress>>8) & 0XFF;
- MOV.W R8, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ROW_ADDRESS_HIGH
- // 76 PROGRAM_256_BYTE();
- CALL #PROGRAM_256_BYTE
- // 77 //find the rear pointer in the Fax Rear Area
- // 78 //wRxBufPageRearAddress=gwPageAddress;//1226;//gwPageAddress;
- // 79 ReadLastFaxRearPointer();//return gwPageAddress
- MOV.B #0x12, R14
- MOV.B #0xf, R12
- CALL #ReadLast16BytesFromFlashMemoryArea
- // 80 //ReadLast16BytesFromFlashMemoryArea(cstFaxRearPointerTableStartBlockNum, cstFaxRearPointerTableOverBlockNum);//return gwPageAddress
- // 81 gwPageAddress++;
- ADD.W #0x1, &gwPageAddress
- // 82 //check the gwPageAddress whether it is a page in bad block
- // 83 do{
- // 84 wNextPageAddress=gwPageAddress+64;
- ??FaxRxBufRawdata2Flash_6:
- MOV.W #0x40, R14
- ADD.W &gwPageAddress, R14
- MOV.W R14, R4
- // 85 gwPageAddress=CalNextPageAddress(gwPageAddress);
- MOV.W &gwPageAddress, R12
- CALL #CalNextPageAddress
- MOV.W R12, &gwPageAddress
- // 86 }while(wNextPageAddress==gwPageAddress);
- CMP.W &gwPageAddress, R4
- JEQ ??FaxRxBufRawdata2Flash_6
- // 87 //erase next block
- // 88 if (gwPageAddress%64==0)
- MOV.W &gwPageAddress, R12
- MOV.W #0x40, R14
- CALL #?DivMod16u
- CMP.W #0x0, R14
- JNE ??FaxRxBufRawdata2Flash_19
- // 89 {
- // 90 ROW_ADDRESS_LOW=gwPageAddress & 0XFF;
- MOV.B &gwPageAddress, &ROW_ADDRESS_LOW
- // 91 ROW_ADDRESS_HIGH=(gwPageAddress>>8) & 0XFF;
- MOV.W &gwPageAddress, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ROW_ADDRESS_HIGH
- // 92 ERASE_ONE_BLOCK();
- CALL #ERASE_ONE_BLOCK
- // 93 }
- // 94 wEveryFaxHead=gwPageAddress;//Record the Every Fax head for the Every fax table
- ??FaxRxBufRawdata2Flash_19:
- MOV.W &gwPageAddress, R7
- // 95
- // 96 for (wPageCount=cstFaxRxBufStartPage;wPageCount<=wRxBufPageRearAddress;wPageCount++)//Block 19-39
- MOV.W #0x4c0, R6
- ??FaxRxBufRawdata2Flash_9:
- CMP.W R6, 0x0(SP)
- JNC ??FaxRxBufRawdata2Flash_20
- // 97 {
- // 98 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2112BYTE
- MOV.B #0x0, &COMMAND_VAL
- // 99 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 100 //ADDRESS
- // 101 ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 102 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 103
- // 104 ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 105 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 106
- // 107 ADDRESS_VALUE= wPageCount & 0xff ; //#0X00
- MOV.B R6, &ADDRESS_VALUE
- // 108 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 109
- // 110 ADDRESS_VALUE= (wPageCount>>8) & 0xff; //#0X00
- MOV.W R6, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ADDRESS_VALUE
- // 111 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 112 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 113
- // 114 COMMAND_VAL=0X35;
- MOV.B #0x35, &COMMAND_VAL
- // 115 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 116 //ATcmdDelay();
- // 117 while((FLASH_CON_PORT_IN & RB)==0);
- ??FaxRxBufRawdata2Flash_7:
- BIT.B #0x20, &0x28
- JNC ??FaxRxBufRawdata2Flash_7
- // 118
- // 119 COMMAND_VAL=0x85;
- MOV.B #0x85, &COMMAND_VAL
- // 120 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 121
- // 122 //ADDRESS
- // 123 ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 124 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 125
- // 126 ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 127 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 128
- // 129 ADDRESS_VALUE= gwPageAddress & 0xff; //#0X00
- MOV.B &gwPageAddress, &ADDRESS_VALUE
- // 130 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 131
- // 132 ADDRESS_VALUE=(gwPageAddress>>8) & 0xff; //#0X00
- MOV.W &gwPageAddress, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ADDRESS_VALUE
- // 133 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 134
- // 135 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 136
- // 137 COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
- MOV.B #0x10, &COMMAND_VAL
- // 138 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 139
- // 140 READ_STATUS();
- CALL #READ_STATUS
- // 141 ucFlashSttsOverflowCnt=0;
- MOV.B #0x0, R5
- // 142 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- CMP.B #0x1, &FLASH_STATUS
- JNE ??FaxRxBufRawdata2Flash_21
- ADD.B #0x1, R5
- // 143 {
- // 144 ;
- // 145 }
- // 146 gwPageAddress++;
- ??FaxRxBufRawdata2Flash_21:
- ADD.W #0x1, &gwPageAddress
- // 147 if (gwPageAddress==0) gwPageAddress+=cstFaxContentStartPage;
- CMP.W #0x0, &gwPageAddress
- JNE ??FaxRxBufRawdata2Flash_8
- ADD.W #0x1400, &gwPageAddress
- // 148 do{
- // 149 wNextPageAddress=gwPageAddress+64;
- ??FaxRxBufRawdata2Flash_8:
- MOV.W #0x40, R14
- ADD.W &gwPageAddress, R14
- MOV.W R14, R4
- // 150 gwPageAddress=CalNextPageAddress(gwPageAddress);
- MOV.W &gwPageAddress, R12
- CALL #CalNextPageAddress
- MOV.W R12, &gwPageAddress
- // 151 }while(wNextPageAddress==gwPageAddress);
- CMP.W &gwPageAddress, R4
- JEQ ??FaxRxBufRawdata2Flash_8
- // 152 if (gwPageAddress%64==0)
- MOV.W &gwPageAddress, R12
- MOV.W #0x40, R14
- CALL #?DivMod16u
- CMP.W #0x0, R14
- JNE ??FaxRxBufRawdata2Flash_22
- // 153 {
- // 154 ROW_ADDRESS_LOW=gwPageAddress & 0XFF;
- MOV.B &gwPageAddress, &ROW_ADDRESS_LOW
- // 155 ROW_ADDRESS_HIGH=(gwPageAddress>>8) & 0XFF;
- MOV.W &gwPageAddress, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ROW_ADDRESS_HIGH
- // 156 ERASE_ONE_BLOCK();
- CALL #ERASE_ONE_BLOCK
- // 157 }
- // 158 //if ((aucUartRxBuf[ucRxIndex] == 0xfb && aucUartRxBuf[ucRxIndex-1] == 0x13
- // 159 //&& aucUartRxBuf[ucRxIndex-2] == 0xff))// || (wRxQueueFrontCnt>gwRxQueueFrontCnt))
- // 160 //break;
- // 161 }//write 1344 pages over
- ??FaxRxBufRawdata2Flash_22:
- ADD.W #0x1, R6
- JMP ??FaxRxBufRawdata2Flash_9
- // 162
- // 163 /*******************************************
- // 164 Write New Fax Rear Pointer
- // 165 if (FaxRearPointerTableFull)
- // 166 {erase next block in fax rear pointer table}
- // 167 else
- // 168 write one Fax content
- // 169 *******************************************/
- // 170 if ((gwGeneralPageAddress>>6) > cstFaxRearPointerTableOverBlockNum)
- ??FaxRxBufRawdata2Flash_20:
- MOV.W &gwGeneralPageAddress, R12
- CALL #?ShiftRight16u_6
- CMP.W #0x13, R12
- JNC ??FaxRxBufRawdata2Flash_23
- // 171 {
- // 172 for (ucBlockCnt=0;ucBlockCnt<4;ucBlockCnt++)
- MOV.B #0x0, R9
- ??FaxRxBufRawdata2Flash_10:
- CMP.B #0x4, R9
- JC ??FaxRxBufRawdata2Flash_24
- // 173 {
- // 174 wPageAddress=(cstFaxRearPointerTableStartBlockNum+ucBlockCnt)<<6;
- MOV.B R9, R12
- AND.W #0xff, R12
- ADD.W #0xf, R12
- CALL #?ShiftLeft16_6
- MOV.W R12, R8
- // 175 ROW_ADDRESS_LOW=wPageAddress & 0XFF;
- MOV.B R8, &ROW_ADDRESS_LOW
- // 176 ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
- MOV.W R8, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ROW_ADDRESS_HIGH
- // 177 ERASE_ONE_BLOCK();
- CALL #ERASE_ONE_BLOCK
- // 178 }
- ADD.B #0x1, R9
- JMP ??FaxRxBufRawdata2Flash_10
- // 179 gwGeneralPageAddress=cstFaxRearPointerTableStartPage;
- ??FaxRxBufRawdata2Flash_24:
- MOV.W #0x3c0, &gwGeneralPageAddress
- // 180 gwColumnAddress=0;
- MOV.W #0x0, &gwColumnAddress
- // 181
- // 182 }
- // 183 ucRxIndex=0; //write Fax Rear Pointer
- ??FaxRxBufRawdata2Flash_23:
- MOV.B #0x0, R11
- // 184 gwPageAddress--; // get Rear Pointer
- ADD.W #0xffff, &gwPageAddress
- // 185 aucUartRxBuf[ucRxIndex++]=gwPageAddress & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gwPageAddress, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 186 aucUartRxBuf[ucRxIndex++]=(gwPageAddress>>8) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.W &gwPageAddress, R15
- SWPB R15
- AND.W #0xff, R15
- MOV.B R15, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 187 for(ucGeneralCnt=0;ucGeneralCnt<14;ucGeneralCnt++)
- MOV.B #0x0, R10
- ??FaxRxBufRawdata2Flash_11:
- CMP.B #0xe, R10
- JC ??FaxRxBufRawdata2Flash_25
- // 188 {
- // 189 aucUartRxBuf[ucRxIndex++] = 0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 190 }
- ADD.B #0x1, R10
- JMP ??FaxRxBufRawdata2Flash_11
- // 191
- // 192 //WriteFaxRearPointerTable();
- // 193 Write16Bytes2FlashMemoryArea();
- ??FaxRxBufRawdata2Flash_25:
- CALL #Write16Bytes2FlashMemoryArea
- // 194 /*******************************************
- // 195 Write Fax Property Table
- // 196 if (Fax Property Table Full)
- // 197 {erase next block in Fax Property Table}
- // 198 else
- // 199 write one Fax Property
- // 200 *******************************************/
- // 201 ReadLastFaxProperty();
- MOV.B #0xa, R14
- MOV.B #0x1, R12
- CALL #ReadLast16BytesFromFlashMemoryArea
- // 202 //ReadLast16BytesFromFlashMemoryArea(cstFaxPropertyTableStartBlockNum, cstFaxPropertyTableOverBlockNum);
- // 203 if ((gwGeneralPageAddress>>6) > cstFaxPropertyTableOverBlockNum)//>=cstFaxPropertyTableOverBlockNum)
- MOV.W &gwGeneralPageAddress, R12
- CALL #?ShiftRight16u_6
- CMP.W #0xb, R12
- JNC ??FaxRxBufRawdata2Flash_26
- // 204 {
- // 205 for (ucBlockCnt=0;ucBlockCnt<10;ucBlockCnt++)
- MOV.B #0x0, R9
- ??FaxRxBufRawdata2Flash_12:
- CMP.B #0xa, R9
- JC ??FaxRxBufRawdata2Flash_27
- // 206 {
- // 207 wPageAddress=(cstFaxPropertyTableStartBlockNum+ucBlockCnt)<<6;
- MOV.B R9, R12
- AND.W #0xff, R12
- ADD.W #0x1, R12
- CALL #?ShiftLeft16_6
- MOV.W R12, R8
- // 208 ROW_ADDRESS_LOW=wPageAddress & 0XFF;
- MOV.B R8, &ROW_ADDRESS_LOW
- // 209 ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
- MOV.W R8, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, &ROW_ADDRESS_HIGH
- // 210 ERASE_ONE_BLOCK();
- CALL #ERASE_ONE_BLOCK
- // 211 }
- ADD.B #0x1, R9
- JMP ??FaxRxBufRawdata2Flash_12
- // 212 gwGeneralPageAddress=cstFaxPropertyTableStartPage;
- ??FaxRxBufRawdata2Flash_27:
- MOV.W #0x40, &gwGeneralPageAddress
- // 213 gwColumnAddress=0;
- MOV.W #0x0, &gwColumnAddress
- // 214 }
- // 215
- // 216 ucRxIndex=0; //write Fax Property
- ??FaxRxBufRawdata2Flash_26:
- MOV.B #0x0, R11
- // 217 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewSecondIndex];// //second
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x2, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 218 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMinuteIndex];// //minute
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x1, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 219 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewHourIndex];//hour
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 220 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewDateIndex];//date
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x4, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 221 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMonthIndex];//month
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x3, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 222 aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewYearIndex];//Year
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &aucViewData + 0x5, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 223 aucUartRxBuf[ucRxIndex++] = wEveryFaxHead & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B R7, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 224 aucUartRxBuf[ucRxIndex++] = (wEveryFaxHead>>8) & 0xff;
- MOV.B R11, R15
- AND.W #0xff, R15
- MOV.W R7, R14
- SWPB R14
- AND.W #0xff, R14
- MOV.B R14, aucUartRxBuf(R15)
- ADD.B #0x1, R11
- // 225 aucUartRxBuf[ucRxIndex++] = gwPageAddress & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gwPageAddress, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 226 aucUartRxBuf[ucRxIndex++] = (gwPageAddress>>8) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.W &gwPageAddress, R15
- SWPB R15
- AND.W #0xff, R15
- MOV.B R15, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 227 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt & 0xff);
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gdwRxQueueFrontCnt, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 228 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt >> 8) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.W &gdwRxQueueFrontCnt, R15
- SWPB R15
- AND.W #0xff, R15
- MOV.B R15, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 229 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>16) & 0xff;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &gdwRxQueueFrontCnt + 0x2, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 230 aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>24) & 0xff;
- MOV.B R11, R12
- AND.W #0xff, R12
- MOV.W &gdwRxQueueFrontCnt, R14
- MOV.W &gdwRxQueueFrontCnt + 0x2, R15
- SWPB R15
- MOV.B R15, R14
- MOV.W #0x0, R15
- MOV.B R14, aucUartRxBuf(R12)
- ADD.B #0x1, R11
- // 231
- // 232 aucUartRxBuf[ucRxIndex++]=0x55;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 233 aucUartRxBuf[ucRxIndex++]=0x55; //15
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B #0x55, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 234 //WriteFaxPropertyTable();
- // 235 Write16Bytes2FlashMemoryArea();
- CALL #Write16Bytes2FlashMemoryArea
- // 236 }//FaxRXProcess
- ADD.W #0x2, SP
- CFI CFA SP+18
- BR #?Epilogue8
- CFI EndBlock cfiBlock0
- RSEG CODE:CODE:NOROOT(1)
- ?setjmp_save_r4:
- REQUIRE ?setjmp_r4
- REQUIRE ?longjmp_r4
- RSEG CODE:CODE:NOROOT(1)
- ?setjmp_save_r5:
- REQUIRE ?setjmp_r5
- REQUIRE ?longjmp_r5
- END
- // 237
- //
- // 1 278 bytes in segment CODE
- // 2 bytes in segment DATA16_AN
- //
- // 1 278 bytes of CODE memory
- // 0 bytes of DATA memory (+ 2 bytes shared)
- //
- //Errors: none
- //Warnings: none