Flash.lst
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:35k
- ##############################################################################
- # #
- # IAR MSP430 C/EC++ Compiler V2.10A/W32 23/Apr/2007 18:04:10 #
- # Copyright 1996-2003 IAR Systems. All rights reserved. #
- # #
- # __rt_version = 1 #
- # __double_size = 32 #
- # __reg_r4 = free #
- # __reg_r5 = free #
- # __pic = no #
- # Source file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # filesFlash.c #
- # Command line = -I "C:Program FilesIAR SystemsEmbedded Workbench #
- # 3.2430INC" -I "C:Program FilesIAR #
- # SystemsEmbedded Workbench 3.2430INCCLIB" -lCN #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugList -lA E:projectFaxProgramVson_Bryan_Fax_ #
- # Conexant_070423DebugList -o #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugObj -z2 --no_cse --no_unroll --no_inline #
- # --no_code_motion --debug -e #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # filesFlash.c #
- # List file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugListFlash.lst #
- # Object file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070423 #
- # DebugObjFlash.r43 #
- # #
- # #
- ##############################################################################
- E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesFlash.c
- 1 //Flash model HY27UF081G2M
- 2
- 3 #include "includeH.h"
- In segment DATA16_AN, at 0x28
- unsigned char const volatile __data P2IN
- P2IN:
- 000000 DS8 1
- In segment DATA16_AN, at 0x29
- unsigned char volatile __data P2OUT
- P2OUT:
- 000000 DS8 1
- In segment DATA16_AN, at 0x30
- unsigned char const volatile __data P5IN
- P5IN:
- 000000 DS8 1
- In segment DATA16_AN, at 0x31
- unsigned char volatile __data P5OUT
- P5OUT:
- 000000 DS8 1
- In segment DATA16_AN, at 0x32
- unsigned char volatile __data P5DIR
- P5DIR:
- 000000 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 //***********************************************************************************
- In segment CODE, align 2, align-sorted
- 62 void ZERO_ADDRESS(void)
- ZERO_ADDRESS:
- 63 {
- 64 COLUMN_ADDRESS_LOW=0X00;
- 000000 C243.... MOV.B #0x0, &COLUMN_ADDRESS_LOW
- 65 COLUMN_ADDRESS_HIGH=0X00;
- 000004 C243.... MOV.B #0x0, &COLUMN_ADDRESS_HIGH
- 66 ROW_ADDRESS_LOW=0X00;
- 000008 C243.... MOV.B #0x0, &ROW_ADDRESS_LOW
- 67 ROW_ADDRESS_HIGH=0X00;
- 00000C C243.... MOV.B #0x0, &ROW_ADDRESS_HIGH
- 68 }
- 000010 3041 RET
- 69
- In segment CODE, align 2, keep-with-next
- 70 void ERASE_ONE_BLOCK(void)
- ERASE_ONE_BLOCK:
- 71 {
- 000000 0A12 PUSH.W R10
- 72 unsigned int wGeneralCount = 0;
- 000002 0A43 MOV.W #0x0, R10
- 73 //COMMAND
- 74 Flash_Reset();
- 000004 B012.... CALL #Flash_Reset
- 75
- 76 COMMAND_VAL=0X60;
- 000008 F2406000.... MOV.B #0x60, &COMMAND_VAL
- 77 COMMAND_LATCH_INTO();
- 00000E B012.... 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
- 000012 D242........ MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- 87 ADDRESS_LATCH_INTO();
- 000018 B012.... CALL #ADDRESS_LATCH_INTO
- 88
- 89 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- 00001C D242........ MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- 90 ADDRESS_LATCH_INTO();
- 000022 B012.... CALL #ADDRESS_LATCH_INTO
- 91 FLASH_CON_PORT_OUT &=~ ALE;
- 000026 E2C32900 BIC.B #0x2, &0x29
- 92
- 93 COMMAND_VAL=0XD0;
- 00002A F240D000.... MOV.B #0xd0, &COMMAND_VAL
- 94 COMMAND_LATCH_INTO();
- 000030 B012.... CALL #COMMAND_LATCH_INTO
- 95 //delay1ms();
- 96
- 97 READ_STATUS();
- 000034 B012.... CALL #READ_STATUS
- 98 while(wGeneralCount++<0xffff) //Jan. 18, 2007
- ??ERASE_ONE_BLOCK_0:
- 000038 0E4A MOV.W R10, R14
- 00003A 1A43 MOV.W #0x1, R10
- 00003C 0A5E ADD.W R14, R10
- 00003E 3E93 CMP.W #0xffff, R14
- 000040 0324 JEQ ??ERASE_ONE_BLOCK_1
- 99 {if (FLASH_STATUS==0) break;}
- 000042 C293.... CMP.B #0x0, &FLASH_STATUS
- 000046 F823 JNE ??ERASE_ONE_BLOCK_0
- 100
- 101 }
- ??ERASE_ONE_BLOCK_1:
- 000048 3A41 POP.W R10
- 00004A 3041 RET
- 102
- 103 //***********************************************************************************
- 104
- In segment CODE, align 2, keep-with-next
- 105 void PROGRAM_ONE_PAGE(unsigned char ucFlashWriteData)
- PROGRAM_ONE_PAGE:
- 106 {
- 000000 0A12 PUSH.W R10
- 000002 0B12 PUSH.W R11
- 000004 0812 PUSH.W R8
- 000006 4A4C MOV.B R12, R10
- 107 unsigned int wByteCount;
- 108 unsigned char ucFlashSttsOverflowCnt=0;
- 000008 4843 MOV.B #0x0, R8
- 109 //COMMAND
- 110 COMMAND_VAL=cFlashWriteCmd;
- 00000A F2408000.... MOV.B #0x80, &COMMAND_VAL
- 111 COMMAND_LATCH_INTO();
- 000010 B012.... CALL #COMMAND_LATCH_INTO
- 112
- 113 //ADDRESS
- 114 ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
- 000014 C243.... MOV.B #0x0, &ADDRESS_VALUE
- 115 ADDRESS_LATCH_INTO();
- 000018 B012.... CALL #ADDRESS_LATCH_INTO
- 116
- 117 ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
- 00001C C243.... MOV.B #0x0, &ADDRESS_VALUE
- 118 ADDRESS_LATCH_INTO();
- 000020 B012.... CALL #ADDRESS_LATCH_INTO
- 119
- 120 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- 000024 D242........ MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- 121 ADDRESS_LATCH_INTO();
- 00002A B012.... CALL #ADDRESS_LATCH_INTO
- 122
- 123 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- 00002E D242........ MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- 124 ADDRESS_LATCH_INTO();
- 000034 B012.... CALL #ADDRESS_LATCH_INTO
- 125
- 126 FLASH_CON_PORT_OUT &=~ ALE;
- 000038 E2C32900 BIC.B #0x2, &0x29
- 127 //CALL DELAY_100US
- 128 //for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++); //delay
- 129
- 130 DATA_PORT_OUT_INITIAL;
- 00003C F2433200 MOV.B #0xff, &0x32
- 131 for(wByteCount=0;wByteCount<2112;wByteCount++)
- 000040 0B43 MOV.W #0x0, R11
- ??PROGRAM_ONE_PAGE_0:
- 000042 3B904008 CMP.W #0x840, R11
- 000046 082C JC ??PROGRAM_ONE_PAGE_1
- 132 {
- 133 //FLASH_WRITE_DATA=0x55;
- 134 //WRITE_ONE_DATA();
- 135 FLASH_CON_PORT_OUT&=~WE;
- 000048 D2C32900 BIC.B #0x1, &0x29
- 136 DATA_PORT_OUT=ucFlashWriteData;
- 00004C C24A3100 MOV.B R10, &0x31
- 137 FLASH_CON_PORT_OUT |= WE;
- 000050 D2D32900 BIS.B #0x1, &0x29
- 138 }
- 000054 1B53 ADD.W #0x1, R11
- 000056 F53F JMP ??PROGRAM_ONE_PAGE_0
- 139
- 140 COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
- ??PROGRAM_ONE_PAGE_1:
- 000058 F2401000.... MOV.B #0x10, &COMMAND_VAL
- 141 COMMAND_LATCH_INTO();
- 00005E B012.... CALL #COMMAND_LATCH_INTO
- 142
- 143 READ_STATUS();
- 000062 B012.... CALL #READ_STATUS
- 144 ucFlashSttsOverflowCnt=0;
- 000066 4843 MOV.B #0x0, R8
- 145 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- 000068 D293.... CMP.B #0x1, &FLASH_STATUS
- 00006C 0120 JNE ??PROGRAM_ONE_PAGE_2
- 00006E 5853 ADD.B #0x1, R8
- 146 {
- 147 ;// Dec. 02,2006
- 148 //ERASE_ONE_BLOCK();
- 149 //PROGRAM_ONE_PAGE();
- 150 }
- 151 }
- ??PROGRAM_ONE_PAGE_2:
- 000070 3841 POP.W R8
- 000072 3B41 POP.W R11
- 000074 3A41 POP.W R10
- 000076 3041 RET
- 152
- 153 //***********************************************************************************
- 154 //***********************************************************************************
- In segment CODE, align 2, keep-with-next
- 155 void PROGRAM_256_BYTE(void)
- PROGRAM_256_BYTE:
- 156 {
- 000000 0A12 PUSH.W R10
- 000002 0B12 PUSH.W R11
- 000004 0812 PUSH.W R8
- 157 unsigned int wGeneralCnt=0;
- 000006 0A43 MOV.W #0x0, R10
- 158 unsigned char ucFlashSttsOverflowCnt=0,ucRxIndex=0;
- 000008 4B43 MOV.B #0x0, R11
- 00000A 4843 MOV.B #0x0, R8
- 159 //COMMAND
- 160 COMMAND_VAL=0X80;
- 00000C F2408000.... MOV.B #0x80, &COMMAND_VAL
- 161 COMMAND_LATCH_INTO();
- 000012 B012.... CALL #COMMAND_LATCH_INTO
- 162
- 163 //ADDRESS
- 164 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- 000016 D242........ MOV.B &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
- 165 ADDRESS_LATCH_INTO();
- 00001C B012.... CALL #ADDRESS_LATCH_INTO
- 166
- 167 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- 000020 D242........ MOV.B &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
- 168 ADDRESS_LATCH_INTO();
- 000026 B012.... CALL #ADDRESS_LATCH_INTO
- 169
- 170 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- 00002A D242........ MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- 171 ADDRESS_LATCH_INTO();
- 000030 B012.... CALL #ADDRESS_LATCH_INTO
- 172
- 173 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- 000034 D242........ MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- 174 ADDRESS_LATCH_INTO();
- 00003A B012.... CALL #ADDRESS_LATCH_INTO
- 175
- 176 FLASH_CON_PORT_OUT &=~ ALE;
- 00003E E2C32900 BIC.B #0x2, &0x29
- 177 //CALL DELAY_100US
- 178 for(wGeneralCnt=0;wGeneralCnt<0xff;wGeneralCnt++);
- 000042 0A43 MOV.W #0x0, R10
- ??PROGRAM_256_BYTE_0:
- 000044 3A90FF00 CMP.W #0xff, R10
- 000048 022C JC ??PROGRAM_256_BYTE_2
- 00004A 1A53 ADD.W #0x1, R10
- 00004C FB3F JMP ??PROGRAM_256_BYTE_0
- 179 DATA_PORT_OUT_INITIAL;
- ??PROGRAM_256_BYTE_2:
- 00004E F2433200 MOV.B #0xff, &0x32
- 180 for(ucRxIndex=0;ucRxIndex<255;ucRxIndex++)
- 000052 4843 MOV.B #0x0, R8
- ??PROGRAM_256_BYTE_1:
- 000054 7893 CMP.B #0xff, R8
- 000056 0C2C JC ??PROGRAM_256_BYTE_3
- 181 {
- 182 FLASH_CON_PORT_OUT&=~WE;
- 000058 D2C32900 BIC.B #0x1, &0x29
- 183 DATA_PORT_OUT=aucUartRxBuf[ucRxIndex];
- 00005C 4E48 MOV.B R8, R14
- 00005E 3EF0FF00 AND.W #0xff, R14
- 000062 D24E....3100 MOV.B aucUartRxBuf(R14), &0x31
- 184 FLASH_CON_PORT_OUT |= WE; //LATCH INTO ONE DATA
- 000068 D2D32900 BIS.B #0x1, &0x29
- 185 }
- 00006C 5853 ADD.B #0x1, R8
- 00006E F23F JMP ??PROGRAM_256_BYTE_1
- 186
- 187 COMMAND_VAL=0X10; //10H INITIATES PROGRAM
- ??PROGRAM_256_BYTE_3:
- 000070 F2401000.... MOV.B #0x10, &COMMAND_VAL
- 188 COMMAND_LATCH_INTO();
- 000076 B012.... CALL #COMMAND_LATCH_INTO
- 189
- 190 READ_STATUS();
- 00007A B012.... CALL #READ_STATUS
- 191 ucFlashSttsOverflowCnt=0;
- 00007E 4B43 MOV.B #0x0, R11
- 192 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- 000080 D293.... CMP.B #0x1, &FLASH_STATUS
- 000084 0120 JNE ??PROGRAM_256_BYTE_4
- 000086 5B53 ADD.B #0x1, R11
- 193 {
- 194 ;// Dec. 02,2006
- 195 //ERASE_ONE_BLOCK();
- 196 //PROGRAM_ONE_PAGE();
- 197 }
- 198 }
- ??PROGRAM_256_BYTE_4:
- 000088 3841 POP.W R8
- 00008A 3B41 POP.W R11
- 00008C 3A41 POP.W R10
- 00008E 3041 RET
- 199 //***********************************************************************************
- In segment CODE, align 2, keep-with-next
- 200 void READ_256_BYTE(void)
- READ_256_BYTE:
- 201 {
- 000000 0A12 PUSH.W R10
- 000002 0B12 PUSH.W R11
- 202 int wByteCnt=0;
- 000004 0A43 MOV.W #0x0, R10
- 203 unsigned char ucRxCnt=0;
- 000006 4B43 MOV.B #0x0, R11
- 204 //COMMAND
- 205 Flash_Reset();
- 000008 B012.... CALL #Flash_Reset
- 206 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-527BYTE
- 00000C C243.... MOV.B #0x0, &COMMAND_VAL
- 207 COMMAND_LATCH_INTO();
- 000010 B012.... CALL #COMMAND_LATCH_INTO
- 208 //ADDRESS
- 209 ADDRESS_VALUE=COLUMN_ADDRESS_LOW; //#0X00
- 000014 D242........ MOV.B &COLUMN_ADDRESS_LOW, &ADDRESS_VALUE
- 210 ADDRESS_LATCH_INTO();
- 00001A B012.... CALL #ADDRESS_LATCH_INTO
- 211
- 212 ADDRESS_VALUE=COLUMN_ADDRESS_HIGH; //#0X00
- 00001E D242........ MOV.B &COLUMN_ADDRESS_HIGH, &ADDRESS_VALUE
- 213 ADDRESS_LATCH_INTO();
- 000024 B012.... CALL #ADDRESS_LATCH_INTO
- 214
- 215 ADDRESS_VALUE=ROW_ADDRESS_LOW; //#0X00
- 000028 D242........ MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
- 216 ADDRESS_LATCH_INTO();
- 00002E B012.... CALL #ADDRESS_LATCH_INTO
- 217
- 218 ADDRESS_VALUE=ROW_ADDRESS_HIGH; //#0X00
- 000032 D242........ MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
- 219 ADDRESS_LATCH_INTO();
- 000038 B012.... CALL #ADDRESS_LATCH_INTO
- 220 FLASH_CON_PORT_OUT &=~ ALE;
- 00003C E2C32900 BIC.B #0x2, &0x29
- 221
- 222 COMMAND_VAL=0X30;
- 000040 F2403000.... MOV.B #0x30, &COMMAND_VAL
- 223 COMMAND_LATCH_INTO();
- 000046 B012.... CALL #COMMAND_LATCH_INTO
- 224 ATcmdDelay();
- 00004A B012.... CALL #ATcmdDelay
- 225 while((FLASH_CON_PORT_IN & RB)==0);
- ??READ_256_BYTE_0:
- 00004E F2B020002800 BIT.B #0x20, &0x28
- 000054 FC2B JNC ??READ_256_BYTE_0
- 226
- 227 DATA_PORT_IN_INITIAL;
- 000056 C2433200 MOV.B #0x0, &0x32
- 228 for(wByteCnt=0,ucRxCnt=0;wByteCnt<256;wByteCnt++)
- 00005A 0A43 MOV.W #0x0, R10
- 00005C 4B43 MOV.B #0x0, R11
- ??READ_256_BYTE_1:
- 00005E 3A900001 CMP.W #0x100, R10
- 000062 0F34 JGE ??READ_256_BYTE_2
- 229 {
- 230 FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
- 000064 F2C010002900 BIC.B #0x10, &0x29
- 231 aucUartRxBuf[ucRxCnt++]=DATA_PORT_IN;
- 00006A 4E4B MOV.B R11, R14
- 00006C 3EF0FF00 AND.W #0xff, R14
- 000070 DE423000.... MOV.B &0x30, aucUartRxBuf(R14)
- 000076 5B53 ADD.B #0x1, R11
- 232 FLASH_CON_PORT_OUT |= RE;
- 000078 F2D010002900 BIS.B #0x10, &0x29
- 233 }
- 00007E 1A53 ADD.W #0x1, R10
- 000080 EE3F JMP ??READ_256_BYTE_1
- 234
- 235 }
- ??READ_256_BYTE_2:
- 000082 3B41 POP.W R11
- 000084 3A41 POP.W R10
- 000086 3041 RET
- 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 //***********************************************************************************
- In segment CODE, align 2, keep-with-next
- 273 void READ_STATUS(void)
- READ_STATUS:
- ??READ_STATUS_0:
- 274 {
- 275 //CALL DELAY_50US
- 276 while((FLASH_CON_PORT_IN & RB)==0); //FLASH_CON_PORT,RB,$ //CHECK BUSY
- 000000 F2B020002800 BIT.B #0x20, &0x28
- 000006 FC2B JNC ??READ_STATUS_0
- 277
- 278 COMMAND_VAL=0X70;
- 000008 F2407000.... MOV.B #0x70, &COMMAND_VAL
- 279
- 280 COMMAND_LATCH_INTO();
- 00000E B012.... CALL #COMMAND_LATCH_INTO
- 281
- 282 DATA_PORT_IN_INITIAL;
- 000012 C2433200 MOV.B #0x0, &0x32
- 283 READ_ONE_DATA(); //WHEN READY,READ STATUS
- 000016 B012.... CALL #READ_ONE_DATA
- 284 FLASH_STATUS=FLASH_READ_DATA & 0x01; //0 OK 1 error
- 00001A 5E42.... MOV.B &FLASH_READ_DATA, R14
- 00001E 5EF3 AND.B #0x1, R14
- 000020 C24E.... MOV.B R14, &FLASH_STATUS
- 285 //if((READ_DATA_VALUE&0x01)==0)
- 286 // FLASH_STATUS=0; //0 OK 1 error
- 287 }
- 000024 3041 RET
- 288
- 289 //***********************************************************************************/
- 290
- In segment CODE, align 2, keep-with-next
- 291 void FLASH_READ_ID(void)
- FLASH_READ_ID:
- 292 {
- 293 COMMAND_VAL=0X90;
- 000000 F2409000.... MOV.B #0x90, &COMMAND_VAL
- 294 COMMAND_LATCH_INTO();
- 000006 B012.... CALL #COMMAND_LATCH_INTO
- 295
- 296 ADDRESS_VALUE=0X00;
- 00000A C243.... MOV.B #0x0, &ADDRESS_VALUE
- 297 ADDRESS_LATCH_INTO();
- 00000E B012.... CALL #ADDRESS_LATCH_INTO
- 298 FLASH_CON_PORT_OUT &=~ ALE;
- 000012 E2C32900 BIC.B #0x2, &0x29
- 299
- 300 DATA_PORT_IN_INITIAL;
- 000016 C2433200 MOV.B #0x0, &0x32
- 301 READ_ONE_DATA();
- 00001A B012.... CALL #READ_ONE_DATA
- 302 while (!(FLASH_READ_DATA==0xad));
- ??FLASH_READ_ID_0:
- 00001E F290AD00.... CMP.B #0xad, &FLASH_READ_DATA
- 000024 FC23 JNE ??FLASH_READ_ID_0
- 303
- 304 READ_ONE_DATA();
- 000026 B012.... CALL #READ_ONE_DATA
- 305 while (!(FLASH_READ_DATA==0xf1));
- ??FLASH_READ_ID_1:
- 00002A F290F100.... CMP.B #0xf1, &FLASH_READ_DATA
- 000030 FC23 JNE ??FLASH_READ_ID_1
- 306 READ_ONE_DATA();
- 000032 B012.... CALL #READ_ONE_DATA
- 307 READ_ONE_DATA();
- 000036 3040.... BR #READ_ONE_DATA
- 308 }
- 309 //***********************************************************************************
- 310
- In segment CODE, align 2, keep-with-next
- 311 void Flash_Reset(void) //flash reset
- Flash_Reset:
- 312 {
- 000000 0A12 PUSH.W R10
- 313 int i;
- 314 COMMAND_VAL=0XFF; //reset command
- 000002 F243.... MOV.B #0xff, &COMMAND_VAL
- 315 COMMAND_LATCH_INTO();
- 000006 B012.... CALL #COMMAND_LATCH_INTO
- 316 for (i=0;i<3000;i++); //delay
- 00000A 0A43 MOV.W #0x0, R10
- ??Flash_Reset_0:
- 00000C 3A90B80B CMP.W #0xbb8, R10
- 000010 0234 JGE ??Flash_Reset_1
- 000012 1A53 ADD.W #0x1, R10
- 000014 FB3F JMP ??Flash_Reset_0
- 317 }
- ??Flash_Reset_1:
- 000016 3A41 POP.W R10
- 000018 3041 RET
- 318
- 319 //***********************************************************************************
- In segment CODE, align 2, align-sorted
- 320 void COMMAND_LATCH_INTO(void) //FLASH CONTROL PORT
- COMMAND_LATCH_INTO:
- 321 {
- 322
- 323 FLASH_CON_PORT_OUT |= CLE; //COMMAND LATCH ENABLE
- 000000 E2D22900 BIS.B #0x4, &0x29
- 324 FLASH_CON_PORT_OUT &= ~(CE|WE); //CHIP ENABLE WRITE ENABLE
- 000004 F2F0F6002900 AND.B #0xf6, &0x29
- 325
- 326 DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ COMMAND
- 00000A F2433200 MOV.B #0xff, &0x32
- 327
- 328 DATA_PORT_OUT=COMMAND_VAL; //DATA SETUP
- 00000E D242....3100 MOV.B &COMMAND_VAL, &0x31
- 329
- 330 FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE COMMAND
- 000014 D2D32900 BIS.B #0x1, &0x29
- 331 FLASH_CON_PORT_OUT&= ~CLE;
- 000018 E2C22900 BIC.B #0x4, &0x29
- 332 }
- 00001C 3041 RET
- 333 //********************************************************
- 334
- In segment CODE, align 2, align-sorted
- 335 void ADDRESS_LATCH_INTO(void)
- ADDRESS_LATCH_INTO:
- 336 {
- 337 FLASH_CON_PORT_OUT |= ALE;
- 000000 E2D32900 BIS.B #0x2, &0x29
- 338 FLASH_CON_PORT_OUT &=~ (CLE|WE);
- 000004 F2F0FA002900 AND.B #0xfa, &0x29
- 339 DATA_PORT_OUT_INITIAL; //MCU OUTPUT,FLASH READ ADDRESS
- 00000A F2433200 MOV.B #0xff, &0x32
- 340 DATA_PORT_OUT=ADDRESS_VALUE;
- 00000E D242....3100 MOV.B &ADDRESS_VALUE, &0x31
- 341
- 342 FLASH_CON_PORT_OUT |= WE; //LATCH INTO THE ADDRESS
- 000014 D2D32900 BIS.B #0x1, &0x29
- 343 //FLASH_CON_PORT_OUT &=~ ALE;
- 344
- 345 }
- 000018 3041 RET
- 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 ********************************************************/
- In segment CODE, align 2, align-sorted
- 357 void READ_ONE_DATA(void)
- READ_ONE_DATA:
- 358 {
- 359 FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
- 000000 F2C010002900 BIC.B #0x10, &0x29
- 360
- 361 //DATA_PORT_IN_INITIAL; //MCU INPUT,MCU READ A DATA
- 362 FLASH_READ_DATA=DATA_PORT_IN;
- 000006 D2423000.... MOV.B &0x30, &FLASH_READ_DATA
- 363 FLASH_CON_PORT_OUT |= RE;
- 00000C F2D010002900 BIS.B #0x10, &0x29
- 364 }
- 000012 3041 RET
- Maximum stack usage in bytes:
- Function CSTACK
- -------- ------
- ADDRESS_LATCH_INTO 2
- COMMAND_LATCH_INTO 2
- ERASE_ONE_BLOCK 4
- -> Flash_Reset 4
- -> COMMAND_LATCH_INTO 4
- -> ADDRESS_LATCH_INTO 4
- -> ADDRESS_LATCH_INTO 4
- -> COMMAND_LATCH_INTO 4
- -> READ_STATUS 4
- FLASH_READ_ID 2
- -> COMMAND_LATCH_INTO 2
- -> ADDRESS_LATCH_INTO 2
- -> READ_ONE_DATA 2
- -> READ_ONE_DATA 2
- -> READ_ONE_DATA 2
- -> READ_ONE_DATA 2
- Flash_Reset 4
- -> COMMAND_LATCH_INTO 4
- PROGRAM_256_BYTE 8
- -> COMMAND_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> COMMAND_LATCH_INTO 8
- -> READ_STATUS 8
- PROGRAM_ONE_PAGE 8
- -> COMMAND_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> ADDRESS_LATCH_INTO 8
- -> COMMAND_LATCH_INTO 8
- -> READ_STATUS 8
- READ_256_BYTE 6
- -> Flash_Reset 6
- -> COMMAND_LATCH_INTO 6
- -> ADDRESS_LATCH_INTO 6
- -> ADDRESS_LATCH_INTO 6
- -> ADDRESS_LATCH_INTO 6
- -> ADDRESS_LATCH_INTO 6
- -> COMMAND_LATCH_INTO 6
- -> ATcmdDelay 6
- READ_ONE_DATA 2
- READ_STATUS 2
- -> COMMAND_LATCH_INTO 2
- -> READ_ONE_DATA 2
- ZERO_ADDRESS 2
- Segment part sizes:
- Function/Label Bytes
- -------------- -----
- P2IN 1
- P2OUT 1
- P5IN 1
- P5OUT 1
- P5DIR 1
- ZERO_ADDRESS 18
- ERASE_ONE_BLOCK 76
- PROGRAM_ONE_PAGE 120
- PROGRAM_256_BYTE 144
- READ_256_BYTE 136
- ??READ_STATUS_0 38
- FLASH_READ_ID 58
- Flash_Reset 26
- COMMAND_LATCH_INTO 30
- ADDRESS_LATCH_INTO 26
- READ_ONE_DATA 20
-
- 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