Flash.s43
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:27k
- NAME Flash
- 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 COLUMN_ADDRESS_LOW
- EXTERN COLUMN_ADDRESS_HIGH
- EXTERN ROW_ADDRESS_LOW
- EXTERN ROW_ADDRESS_HIGH
- EXTERN COMMAND_VAL
- EXTERN ADDRESS_VALUE
- EXTERN FLASH_STATUS
- EXTERN aucUartRxBuf
- EXTERN ATcmdDelay
- FUNCTION ATcmdDelay,0202H
- EXTERN FLASH_READ_DATA
- EXTERN ?longjmp_r4
- EXTERN ?longjmp_r5
- EXTERN ?setjmp_r4
- EXTERN ?setjmp_r5
- PUBWEAK ?setjmp_save_r4
- PUBWEAK ?setjmp_save_r5
- PUBLIC ADDRESS_LATCH_INTO
- FUNCTION ADDRESS_LATCH_INTO,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC COMMAND_LATCH_INTO
- FUNCTION COMMAND_LATCH_INTO,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC ERASE_ONE_BLOCK
- FUNCTION ERASE_ONE_BLOCK,021203H
- LOCFRAME CSTACK, 4, STACK
- PUBLIC FLASH_READ_ID
- FUNCTION FLASH_READ_ID,021203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC Flash_Reset
- FUNCTION Flash_Reset,021203H
- LOCFRAME CSTACK, 4, STACK
- PUBWEAK P2IN
- PUBWEAK P2OUT
- PUBWEAK P5DIR
- PUBWEAK P5IN
- PUBWEAK P5OUT
- PUBLIC PROGRAM_256_BYTE
- FUNCTION PROGRAM_256_BYTE,021203H
- LOCFRAME CSTACK, 8, STACK
- PUBLIC PROGRAM_ONE_PAGE
- FUNCTION PROGRAM_ONE_PAGE,021203H
- LOCFRAME CSTACK, 8, STACK
- PUBLIC READ_256_BYTE
- FUNCTION READ_256_BYTE,021203H
- LOCFRAME CSTACK, 6, STACK
- PUBLIC READ_ONE_DATA
- FUNCTION READ_ONE_DATA,0203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC READ_STATUS
- FUNCTION READ_STATUS,021203H
- LOCFRAME CSTACK, 2, STACK
- PUBLIC ZERO_ADDRESS
- FUNCTION ZERO_ADDRESS,0203H
- LOCFRAME CSTACK, 2, STACK
-
- 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_070423filesFlash.c
- // 1 //Flash model HY27UF081G2M
- // 2
- // 3 #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
- ASEGN DATA16_AN:DATA:NOROOT,030H
- // unsigned char const volatile __data P5IN
- P5IN:
- DS8 1
- ASEGN DATA16_AN:DATA:NOROOT,031H
- // unsigned char volatile __data P5OUT
- P5OUT:
- DS8 1
- ASEGN DATA16_AN:DATA:NOROOT,032H
- // unsigned char volatile __data P5DIR
- P5DIR:
- DS8 1
- // 4
- // 5
- // 6 //***********************************************************************************
- // 7 /*
- // 8 void FlashPageCopy(void)
- // 9 {
- // 10 unsigned char ucFlashSttsOverflowCnt=0;
- // 11 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
- // 12 COMMAND_LATCH_INTO();
- // 13 //ADDRESS
- // 14 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- // 15 ADDRESS_LATCH_INTO();
- // 16
- // 17 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- // 18 ADDRESS_LATCH_INTO();
- // 19
- // 20 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- // 21 ADDRESS_LATCH_INTO();
- // 22
- // 23 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- // 24 ADDRESS_LATCH_INTO();
- // 25 FLASH_CON_PORT_OUT &=~ ALE;
- // 26
- // 27 COMMAND_VAL=0X35;
- // 28 COMMAND_LATCH_INTO();
- // 29 //ATcmdDelay();
- // 30 while((FLASH_CON_PORT_IN & RB)==0);
- // 31
- // 32 COMMAND_VAL=0x85;
- // 33 COMMAND_LATCH_INTO();
- // 34
- // 35 //ADDRESS
- // 36 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- // 37 ADDRESS_LATCH_INTO();
- // 38
- // 39 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- // 40 ADDRESS_LATCH_INTO();
- // 41
- // 42 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- // 43 ADDRESS_LATCH_INTO();
- // 44
- // 45 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- // 46 ADDRESS_LATCH_INTO();
- // 47
- // 48 FLASH_CON_PORT_OUT &=~ ALE;
- // 49
- // 50 COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
- // 51 COMMAND_LATCH_INTO();
- // 52
- // 53 READ_STATUS();
- // 54 ucFlashSttsOverflowCnt=0;
- // 55 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- // 56 {
- // 57 ;
- // 58 }
- // 59 }
- // 60 */
- // 61 //***********************************************************************************
- RSEG CODE:CODE:SORT:NOROOT(1)
- // 62 void ZERO_ADDRESS(void)
- ZERO_ADDRESS:
- CFI Block cfiBlock0 Using cfiCommon0
- CFI Function ZERO_ADDRESS
- // 63 {
- // 64 COLUMN_ADDRESS_LOW=0X00;
- MOV.B #0x0, &COLUMN_ADDRESS_LOW
- // 65 COLUMN_ADDRESS_HIGH=0X00;
- MOV.B #0x0, &COLUMN_ADDRESS_HIGH
- // 66 ROW_ADDRESS_LOW=0X00;
- MOV.B #0x0, &ROW_ADDRESS_LOW
- // 67 ROW_ADDRESS_HIGH=0X00;
- MOV.B #0x0, &ROW_ADDRESS_HIGH
- // 68 }
- RET
- CFI EndBlock cfiBlock0
- // 69
- RSEG CODE:CODE:NOROOT(1)
- // 70 void ERASE_ONE_BLOCK(void)
- ERASE_ONE_BLOCK:
- CFI Block cfiBlock1 Using cfiCommon0
- CFI Function ERASE_ONE_BLOCK
- // 71 {
- FUNCALL ERASE_ONE_BLOCK, Flash_Reset
- LOCFRAME CSTACK, 4, STACK
- FUNCALL ERASE_ONE_BLOCK, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 4, STACK
- FUNCALL ERASE_ONE_BLOCK, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 4, STACK
- FUNCALL ERASE_ONE_BLOCK, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 4, STACK
- FUNCALL ERASE_ONE_BLOCK, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 4, STACK
- FUNCALL ERASE_ONE_BLOCK, READ_STATUS
- LOCFRAME CSTACK, 4, STACK
- PUSH.W R10
- CFI R10 Frame(CFA, -4)
- CFI CFA SP+4
- // 72 unsigned int wGeneralCount = 0;
- MOV.W #0x0, R10
- // 73 //COMMAND
- // 74 Flash_Reset();
- CALL #Flash_Reset
- // 75
- // 76 COMMAND_VAL=0X60;
- MOV.B #0x60, &COMMAND_VAL
- // 77 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 78
- // 79 //ADDRESS
- // 80 /* ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- // 81 ADDRESS_LATCH_INTO();
- // 82
- // 83 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- // 84 ADDRESS_LATCH_INTO(); */ //a bug of Sep. 15
- // 85
- // 86 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- // 87 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 88
- // 89 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- // 90 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 91 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 92
- // 93 COMMAND_VAL=0XD0;
- MOV.B #0xd0, &COMMAND_VAL
- // 94 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 95 //delay1ms();
- // 96
- // 97 READ_STATUS();
- CALL #READ_STATUS
- // 98 while(wGeneralCount++<0xffff) //Jan. 18, 2007
- ??ERASE_ONE_BLOCK_0:
- MOV.W R10, R14
- MOV.W #0x1, R10
- ADD.W R14, R10
- CMP.W #0xffff, R14
- JEQ ??ERASE_ONE_BLOCK_1
- // 99 {if (FLASH_STATUS==0) break;}
- CMP.B #0x0, &FLASH_STATUS
- JNE ??ERASE_ONE_BLOCK_0
- // 100
- // 101 }
- ??ERASE_ONE_BLOCK_1:
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock1
- // 102
- // 103 //***********************************************************************************
- // 104
- RSEG CODE:CODE:NOROOT(1)
- // 105 void PROGRAM_ONE_PAGE(unsigned char ucFlashWriteData)
- PROGRAM_ONE_PAGE:
- CFI Block cfiBlock2 Using cfiCommon0
- CFI Function PROGRAM_ONE_PAGE
- // 106 {
- FUNCALL PROGRAM_ONE_PAGE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_ONE_PAGE, READ_STATUS
- LOCFRAME CSTACK, 8, 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
- MOV.B R12, R10
- // 107 unsigned int wByteCount;
- // 108 unsigned char ucFlashSttsOverflowCnt=0;
- MOV.B #0x0, R8
- // 109 //COMMAND
- // 110 COMMAND_VAL=cFlashWriteCmd;
- MOV.B #0x80, &COMMAND_VAL
- // 111 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 112
- // 113 //ADDRESS
- // 114 ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 115 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 116
- // 117 ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
- MOV.B #0x0, &ADDRESS_VALUE
- // 118 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 119
- // 120 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- // 121 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 122
- // 123 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- // 124 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 125
- // 126 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 127 //CALL DELAY_100US
- // 128 //for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++); //delay
- // 129
- // 130 DATA_PORT_OUT_INITIAL;
- MOV.B #0xff, &0x32
- // 131 for(wByteCount=0;wByteCount<2112;wByteCount++)
- MOV.W #0x0, R11
- ??PROGRAM_ONE_PAGE_0:
- CMP.W #0x840, R11
- JC ??PROGRAM_ONE_PAGE_1
- // 132 {
- // 133 //FLASH_WRITE_DATA=0x55;
- // 134 //WRITE_ONE_DATA();
- // 135 FLASH_CON_PORT_OUT&=~WE;
- BIC.B #0x1, &0x29
- // 136 DATA_PORT_OUT=ucFlashWriteData;
- MOV.B R10, &0x31
- // 137 FLASH_CON_PORT_OUT |= WE;
- BIS.B #0x1, &0x29
- // 138 }
- ADD.W #0x1, R11
- JMP ??PROGRAM_ONE_PAGE_0
- // 139
- // 140 COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
- ??PROGRAM_ONE_PAGE_1:
- MOV.B #0x10, &COMMAND_VAL
- // 141 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 142
- // 143 READ_STATUS();
- CALL #READ_STATUS
- // 144 ucFlashSttsOverflowCnt=0;
- MOV.B #0x0, R8
- // 145 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- CMP.B #0x1, &FLASH_STATUS
- JNE ??PROGRAM_ONE_PAGE_2
- ADD.B #0x1, R8
- // 146 {
- // 147 ;// Dec. 02,2006
- // 148 //ERASE_ONE_BLOCK();
- // 149 //PROGRAM_ONE_PAGE();
- // 150 }
- // 151 }
- ??PROGRAM_ONE_PAGE_2:
- POP.W R8
- CFI R8 SameValue
- CFI CFA SP+6
- POP.W R11
- CFI R11 SameValue
- CFI CFA SP+4
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock2
- // 152
- // 153 //***********************************************************************************
- // 154 //***********************************************************************************
- RSEG CODE:CODE:NOROOT(1)
- // 155 void PROGRAM_256_BYTE(void)
- PROGRAM_256_BYTE:
- CFI Block cfiBlock3 Using cfiCommon0
- CFI Function PROGRAM_256_BYTE
- // 156 {
- FUNCALL PROGRAM_256_BYTE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 8, STACK
- FUNCALL PROGRAM_256_BYTE, READ_STATUS
- LOCFRAME CSTACK, 8, 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
- // 157 unsigned int wGeneralCnt=0;
- MOV.W #0x0, R10
- // 158 unsigned char ucFlashSttsOverflowCnt=0,ucRxIndex=0;
- MOV.B #0x0, R11
- MOV.B #0x0, R8
- // 159 //COMMAND
- // 160 COMMAND_VAL=0X80;
- MOV.B #0x80, &COMMAND_VAL
- // 161 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 162
- // 163 //ADDRESS
- // 164 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- MOV.B &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
- // 165 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 166
- // 167 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- MOV.B &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
- // 168 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 169
- // 170 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- // 171 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 172
- // 173 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- // 174 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 175
- // 176 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 177 //CALL DELAY_100US
- // 178 for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++);
- MOV.W #0x0, R10
- ??PROGRAM_256_BYTE_0:
- CMP.W #0xff, R10
- JC ??PROGRAM_256_BYTE_2
- ADD.W #0x1, R10
- JMP ??PROGRAM_256_BYTE_0
- // 179 DATA_PORT_OUT_INITIAL;
- ??PROGRAM_256_BYTE_2:
- MOV.B #0xff, &0x32
- // 180 for(ucRxIndex=0;ucRxIndex<255;ucRxIndex++)
- MOV.B #0x0, R8
- ??PROGRAM_256_BYTE_1:
- CMP.B #0xff, R8
- JC ??PROGRAM_256_BYTE_3
- // 181 {
- // 182 FLASH_CON_PORT_OUT&=~WE;
- BIC.B #0x1, &0x29
- // 183 DATA_PORT_OUT=aucUartRxBuf[ucRxIndex];
- MOV.B R8, R14
- AND.W #0xff, R14
- MOV.B aucUartRxBuf(R14), &0x31
- // 184 FLASH_CON_PORT_OUT |= WE; //LATCH INTO ONE DATA
- BIS.B #0x1, &0x29
- // 185 }
- ADD.B #0x1, R8
- JMP ??PROGRAM_256_BYTE_1
- // 186
- // 187 COMMAND_VAL=0X10; //10H INITIATES PROGRAM
- ??PROGRAM_256_BYTE_3:
- MOV.B #0x10, &COMMAND_VAL
- // 188 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 189
- // 190 READ_STATUS();
- CALL #READ_STATUS
- // 191 ucFlashSttsOverflowCnt=0;
- MOV.B #0x0, R11
- // 192 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- CMP.B #0x1, &FLASH_STATUS
- JNE ??PROGRAM_256_BYTE_4
- ADD.B #0x1, R11
- // 193 {
- // 194 ;// Dec. 02,2006
- // 195 //ERASE_ONE_BLOCK();
- // 196 //PROGRAM_ONE_PAGE();
- // 197 }
- // 198 }
- ??PROGRAM_256_BYTE_4:
- POP.W R8
- CFI R8 SameValue
- CFI CFA SP+6
- POP.W R11
- CFI R11 SameValue
- CFI CFA SP+4
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock3
- // 199 //***********************************************************************************
- RSEG CODE:CODE:NOROOT(1)
- // 200 void READ_256_BYTE(void)
- READ_256_BYTE:
- CFI Block cfiBlock4 Using cfiCommon0
- CFI Function READ_256_BYTE
- // 201 {
- FUNCALL READ_256_BYTE, Flash_Reset
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 6, STACK
- FUNCALL READ_256_BYTE, ATcmdDelay
- LOCFRAME CSTACK, 6, 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
- // 202 int wByteCnt=0;
- MOV.W #0x0, R10
- // 203 unsigned char ucRxCnt=0;
- MOV.B #0x0, R11
- // 204 //COMMAND
- // 205 Flash_Reset();
- CALL #Flash_Reset
- // 206 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
- MOV.B #0x0, &COMMAND_VAL
- // 207 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 208 //ADDRESS
- // 209 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- MOV.B &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
- // 210 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 211
- // 212 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- MOV.B &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
- // 213 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 214
- // 215 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- // 216 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 217
- // 218 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- // 219 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 220 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 221
- // 222 COMMAND_VAL=0X30;
- MOV.B #0x30, &COMMAND_VAL
- // 223 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 224 ATcmdDelay();
- CALL #ATcmdDelay
- // 225 while((FLASH_CON_PORT_IN & RB)==0);
- ??READ_256_BYTE_0:
- BIT.B #0x20, &0x28
- JNC ??READ_256_BYTE_0
- // 226
- // 227 DATA_PORT_IN_INITIAL;
- MOV.B #0x0, &0x32
- // 228 for(wByteCnt=0,ucRxCnt=0;wByteCnt<256;wByteCnt++)
- MOV.W #0x0, R10
- MOV.B #0x0, R11
- ??READ_256_BYTE_1:
- CMP.W #0x100, R10
- JGE ??READ_256_BYTE_2
- // 229 {
- // 230 FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
- BIC.B #0x10, &0x29
- // 231 aucUartRxBuf[ucRxCnt++]=DATA_PORT_IN;
- MOV.B R11, R14
- AND.W #0xff, R14
- MOV.B &0x30, aucUartRxBuf(R14)
- ADD.B #0x1, R11
- // 232 FLASH_CON_PORT_OUT |= RE;
- BIS.B #0x10, &0x29
- // 233 }
- ADD.W #0x1, R10
- JMP ??READ_256_BYTE_1
- // 234
- // 235 }
- ??READ_256_BYTE_2:
- POP.W R11
- CFI R11 SameValue
- CFI CFA SP+4
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock4
- // 236 //***********************************************************************************
- // 237
- // 238 /***********************************************************************************
- // 239 void READ_ONE_PAGE(void)
- // 240 {
- // 241 int wByteCnt=0;
- // 242 unsigned char ucRxCnt=0;
- // 243 //COMMAND
- // 244 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
- // 245 COMMAND_LATCH_INTO();
- // 246 //ADDRESS
- // 247 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- // 248 ADDRESS_LATCH_INTO();
- // 249
- // 250 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- // 251 ADDRESS_LATCH_INTO();
- // 252
- // 253 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- // 254 ADDRESS_LATCH_INTO();
- // 255
- // 256 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- // 257 ADDRESS_LATCH_INTO();
- // 258 FLASH_CON_PORT_OUT &=~ ALE;
- // 259
- // 260 COMMAND_VAL=0X30;
- // 261 COMMAND_LATCH_INTO();
- // 262 ATcmdDelay();
- // 263 while((FLASH_CON_PORT_IN & RB)==0);
- // 264 for(wByteCnt=0,ucRxCnt=0;wByteCnt<2048;wByteCnt++)
- // 265 {
- // 266 READ_ONE_DATA();
- // 267 aucUartRxBuf[ucRxCnt++]=FLASH_READ_DATA;
- // 268 }
- // 269 }
- // 270 ***********************************************************************************/
- // 271
- // 272 //***********************************************************************************
- RSEG CODE:CODE:NOROOT(1)
- // 273 void READ_STATUS(void)
- READ_STATUS:
- ??READ_STATUS_0:
- CFI Block cfiBlock5 Using cfiCommon0
- CFI Function READ_STATUS
- // 274 {
- // 275 //CALL DELAY_50US
- // 276 while((FLASH_CON_PORT_IN & RB)==0); //FLASH_CON_PORT,RB,$ //CHECK BUSY
- FUNCALL READ_STATUS, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 2, STACK
- FUNCALL READ_STATUS, READ_ONE_DATA
- LOCFRAME CSTACK, 2, STACK
- BIT.B #0x20, &0x28
- JNC ??READ_STATUS_0
- // 277
- // 278 COMMAND_VAL=0X70;
- MOV.B #0x70, &COMMAND_VAL
- // 279
- // 280 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 281
- // 282 DATA_PORT_IN_INITIAL;
- MOV.B #0x0, &0x32
- // 283 READ_ONE_DATA(); //WHEN READY,READ STATUS
- CALL #READ_ONE_DATA
- // 284 FLASH_STATUS=FLASH_READ_DATA & 0x01; //0 OK 1 error
- MOV.B &FLASH_READ_DATA, R14
- AND.B #0x1, R14
- MOV.B R14, &FLASH_STATUS
- // 285 //if((READ_DATA_VALUE&0x01)==0)
- // 286 // FLASH_STATUS=0; //0 OK 1 error
- // 287 }
- RET
- CFI EndBlock cfiBlock5
- // 288
- // 289 //***********************************************************************************/
- // 290
- RSEG CODE:CODE:NOROOT(1)
- // 291 void FLASH_READ_ID(void)
- FLASH_READ_ID:
- CFI Block cfiBlock6 Using cfiCommon0
- CFI Function FLASH_READ_ID
- // 292 {
- // 293 COMMAND_VAL=0X90;
- FUNCALL FLASH_READ_ID, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 2, STACK
- FUNCALL FLASH_READ_ID, ADDRESS_LATCH_INTO
- LOCFRAME CSTACK, 2, STACK
- FUNCALL FLASH_READ_ID, READ_ONE_DATA
- LOCFRAME CSTACK, 2, STACK
- FUNCALL FLASH_READ_ID, READ_ONE_DATA
- LOCFRAME CSTACK, 2, STACK
- FUNCALL FLASH_READ_ID, READ_ONE_DATA
- LOCFRAME CSTACK, 2, STACK
- FUNCALL FLASH_READ_ID, READ_ONE_DATA
- LOCFRAME CSTACK, 2, STACK
- MOV.B #0x90, &COMMAND_VAL
- // 294 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 295
- // 296 ADDRESS_VALUE=0X00;
- MOV.B #0x0, &ADDRESS_VALUE
- // 297 ADDRESS_LATCH_INTO();
- CALL #ADDRESS_LATCH_INTO
- // 298 FLASH_CON_PORT_OUT &=~ ALE;
- BIC.B #0x2, &0x29
- // 299
- // 300 DATA_PORT_IN_INITIAL;
- MOV.B #0x0, &0x32
- // 301 READ_ONE_DATA();
- CALL #READ_ONE_DATA
- // 302 while (!(FLASH_READ_DATA==0xad));
- ??FLASH_READ_ID_0:
- CMP.B #0xad, &FLASH_READ_DATA
- JNE ??FLASH_READ_ID_0
- // 303
- // 304 READ_ONE_DATA();
- CALL #READ_ONE_DATA
- // 305 while (!(FLASH_READ_DATA==0xf1));
- ??FLASH_READ_ID_1:
- CMP.B #0xf1, &FLASH_READ_DATA
- JNE ??FLASH_READ_ID_1
- // 306 READ_ONE_DATA();
- CALL #READ_ONE_DATA
- // 307 READ_ONE_DATA();
- BR #READ_ONE_DATA
- CFI EndBlock cfiBlock6
- // 308 }
- // 309 //***********************************************************************************
- // 310
- RSEG CODE:CODE:NOROOT(1)
- // 311 void Flash_Reset(void) //flash reset
- Flash_Reset:
- CFI Block cfiBlock7 Using cfiCommon0
- CFI Function Flash_Reset
- // 312 {
- FUNCALL Flash_Reset, COMMAND_LATCH_INTO
- LOCFRAME CSTACK, 4, STACK
- PUSH.W R10
- CFI R10 Frame(CFA, -4)
- CFI CFA SP+4
- // 313 int i;
- // 314 COMMAND_VAL=0XFF; //reset command
- MOV.B #0xff, &COMMAND_VAL
- // 315 COMMAND_LATCH_INTO();
- CALL #COMMAND_LATCH_INTO
- // 316 for (i=0;i<3000;i++); //delay
- MOV.W #0x0, R10
- ??Flash_Reset_0:
- CMP.W #0xbb8, R10
- JGE ??Flash_Reset_1
- ADD.W #0x1, R10
- JMP ??Flash_Reset_0
- // 317 }
- ??Flash_Reset_1:
- POP.W R10
- CFI R10 SameValue
- CFI CFA SP+2
- RET
- CFI EndBlock cfiBlock7
- // 318
- // 319 //***********************************************************************************
- RSEG CODE:CODE:SORT:NOROOT(1)
- // 320 void COMMAND_LATCH_INTO(void) //FLASH CONTROL PORT
- COMMAND_LATCH_INTO:
- CFI Block cfiBlock8 Using cfiCommon0
- CFI Function COMMAND_LATCH_INTO
- // 321 {
- // 322
- // 323 FLASH_CON_PORT_OUT |= CLE; //COMMAND LATCH ENABLE
- BIS.B #0x4, &0x29
- // 324 FLASH_CON_PORT_OUT &= ~(CE|WE); //CHIP ENABLE WRITE ENABLE
- AND.B #0xf6, &0x29
- // 325
- // 326 DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ COMMAND
- MOV.B #0xff, &0x32
- // 327
- // 328 DATA_PORT_OUT=COMMAND_VAL; //DATA SETUP
- MOV.B &COMMAND_VAL, &0x31
- // 329
- // 330 FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE COMMAND
- BIS.B #0x1, &0x29
- // 331 FLASH_CON_PORT_OUT&= ~CLE;
- BIC.B #0x4, &0x29
- // 332 }
- RET
- CFI EndBlock cfiBlock8
- // 333 //********************************************************
- // 334
- RSEG CODE:CODE:SORT:NOROOT(1)
- // 335 void ADDRESS_LATCH_INTO(void)
- ADDRESS_LATCH_INTO:
- CFI Block cfiBlock9 Using cfiCommon0
- CFI Function ADDRESS_LATCH_INTO
- // 336 {
- // 337 FLASH_CON_PORT_OUT |= ALE;
- BIS.B #0x2, &0x29
- // 338 FLASH_CON_PORT_OUT &=~ (CLE|WE);
- AND.B #0xfa, &0x29
- // 339 DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ ADDRESS
- MOV.B #0xff, &0x32
- // 340 DATA_PORT_OUT=ADDRESS_VALUE;
- MOV.B &ADDRESS_VALUE, &0x31
- // 341
- // 342 FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE ADDRESS
- BIS.B #0x1, &0x29
- // 343 //FLASH_CON_PORT_OUT &=~ ALE;
- // 344
- // 345 }
- RET
- CFI EndBlock cfiBlock9
- // 346 /********************************************************
- // 347 void WRITE_ONE_DATA(void)
- // 348 {
- // 349 FLASH_CON_PORT_OUT&=~WE;
- // 350 //DATA_PORT_OUT_INITIAL; //MCU OUTPUT,MCU WRITE A DATA TO FLASH
- // 351 DATA_PORT_OUT=FLASH_WRITE_DATA;
- // 352 FLASH_CON_PORT_OUT |= WE; //LATCH INTO ONE DATA
- // 353
- // 354 }
- // 355
- // 356 ********************************************************/
- RSEG CODE:CODE:SORT:NOROOT(1)
- // 357 void READ_ONE_DATA(void)
- READ_ONE_DATA:
- CFI Block cfiBlock10 Using cfiCommon0
- CFI Function READ_ONE_DATA
- // 358 {
- // 359 FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
- BIC.B #0x10, &0x29
- // 360
- // 361 //DATA_PORT_IN_INITIAL; //MCU INPUT,MCU READ A DATA
- // 362 FLASH_READ_DATA=DATA_PORT_IN;
- MOV.B &0x30, &FLASH_READ_DATA
- // 363 FLASH_CON_PORT_OUT |= RE;
- BIS.B #0x10, &0x29
- // 364 }
- RET
- CFI EndBlock cfiBlock10
- 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
- //
- // 692 bytes in segment CODE
- // 5 bytes in segment DATA16_AN
- //
- // 692 bytes of CODE memory
- // 0 bytes of DATA memory (+ 5 bytes shared)
- //
- //Errors: none
- //Warnings: none