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

传真(Fax)编程

开发平台:

C/C++

  1.         NAME FlashMemoryAreaRW
  2.         RTMODEL "__double_size", "32"
  3.         RTMODEL "__pic", "no"
  4.         RTMODEL "__reg_r4", "free"
  5.         RTMODEL "__reg_r5", "free"
  6.         RTMODEL "__rt_version", "1"
  7.         RSEG CSTACK:DATA:SORT:NOROOT(1)
  8.         EXTERN COMMAND_VAL
  9.         EXTERN COMMAND_LATCH_INTO
  10.         FUNCTION COMMAND_LATCH_INTO,0202H
  11.         EXTERN gwColumnAddress
  12.         EXTERN ADDRESS_VALUE
  13.         EXTERN ADDRESS_LATCH_INTO
  14.         FUNCTION ADDRESS_LATCH_INTO,0202H
  15.         EXTERN gwGeneralPageAddress
  16.         EXTERN aucUartRxBuf
  17.         EXTERN READ_STATUS
  18.         FUNCTION READ_STATUS,0202H
  19.         EXTERN FLASH_STATUS
  20.         EXTERN ?Epilogue8
  21.         EXTERN ?ShiftLeft16_6
  22.         EXTERN CalNextPageAddress
  23.         FUNCTION CalNextPageAddress,0202H
  24.         EXTERN ROW_ADDRESS_LOW
  25.         EXTERN ROW_ADDRESS_HIGH
  26.         EXTERN gucUartRxCnt
  27.         EXTERN gwPageAddress
  28.         EXTERN gucGeneralStatus
  29.         EXTERN ?longjmp_r4
  30.         EXTERN ?longjmp_r5
  31.         EXTERN ?setjmp_r4
  32.         EXTERN ?setjmp_r5
  33.         PUBWEAK ?setjmp_save_r4
  34.         PUBWEAK ?setjmp_save_r5
  35.         PUBWEAK P2IN
  36.         PUBWEAK P2OUT
  37.         PUBWEAK P5DIR
  38.         PUBWEAK P5IN
  39.         PUBWEAK P5OUT
  40.         PUBLIC ReadLast16BytesFromFlashMemoryArea
  41.         FUNCTION ReadLast16BytesFromFlashMemoryArea,021203H
  42.         LOCFRAME CSTACK, 26, STACK
  43.         PUBLIC Write16Bytes2FlashMemoryArea
  44.         FUNCTION Write16Bytes2FlashMemoryArea,021203H
  45.         LOCFRAME CSTACK, 8, STACK
  46.         
  47.         CFI Names cfiNames0
  48.         CFI StackFrame CFA SP DATA
  49.         CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
  50.         CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
  51.         CFI EndNames cfiNames0
  52.         
  53.         CFI Common cfiCommon0 Using cfiNames0
  54.         CFI CodeAlign 2
  55.         CFI DataAlign 2
  56.         CFI ReturnAddress PC CODE
  57.         CFI CFA SP+2
  58.         CFI PC Frame(CFA, -2)
  59.         CFI SR Undefined
  60.         CFI R4 SameValue
  61.         CFI R5 SameValue
  62.         CFI R6 SameValue
  63.         CFI R7 SameValue
  64.         CFI R8 SameValue
  65.         CFI R9 SameValue
  66.         CFI R10 SameValue
  67.         CFI R11 SameValue
  68.         CFI R12 Undefined
  69.         CFI R13 Undefined
  70.         CFI R14 Undefined
  71.         CFI R15 Undefined
  72.         CFI EndCommon cfiCommon0
  73.         
  74. // E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesFlashMemoryAreaRW.c
  75. //    1 /***************************************
  76. //    2 Program:     FlashManage
  77. //    3 Author:      Bryan Cai
  78. //    4 Date:        2006.12.07
  79. //    5 ***************************************/
  80. //    6 
  81. //    7 #include "includeH.h"
  82.         ASEGN DATA16_AN:DATA:NOROOT,028H
  83. // unsigned char const volatile __data P2IN
  84. P2IN:
  85.         DS8 1
  86.         ASEGN DATA16_AN:DATA:NOROOT,029H
  87. // unsigned char volatile __data P2OUT
  88. P2OUT:
  89.         DS8 1
  90.         ASEGN DATA16_AN:DATA:NOROOT,030H
  91. // unsigned char const volatile __data P5IN
  92. P5IN:
  93.         DS8 1
  94.         ASEGN DATA16_AN:DATA:NOROOT,031H
  95. // unsigned char volatile __data P5OUT
  96. P5OUT:
  97.         DS8 1
  98.         ASEGN DATA16_AN:DATA:NOROOT,032H
  99. // unsigned char volatile __data P5DIR
  100. P5DIR:
  101.         DS8 1
  102. //    8 
  103. //    9 //unsigned int  gwGeneralPageAddress=0;//=960;
  104. //   10 
  105.         RSEG CODE:CODE:NOROOT(1)
  106. //   11 void Write16Bytes2FlashMemoryArea(void)
  107. Write16Bytes2FlashMemoryArea:
  108.         CFI Block cfiBlock0 Using cfiCommon0
  109.         CFI Function Write16Bytes2FlashMemoryArea
  110. //   12 {
  111.         FUNCALL Write16Bytes2FlashMemoryArea, COMMAND_LATCH_INTO
  112.         LOCFRAME CSTACK, 8, STACK
  113.         FUNCALL Write16Bytes2FlashMemoryArea, ADDRESS_LATCH_INTO
  114.         LOCFRAME CSTACK, 8, STACK
  115.         FUNCALL Write16Bytes2FlashMemoryArea, ADDRESS_LATCH_INTO
  116.         LOCFRAME CSTACK, 8, STACK
  117.         FUNCALL Write16Bytes2FlashMemoryArea, ADDRESS_LATCH_INTO
  118.         LOCFRAME CSTACK, 8, STACK
  119.         FUNCALL Write16Bytes2FlashMemoryArea, ADDRESS_LATCH_INTO
  120.         LOCFRAME CSTACK, 8, STACK
  121.         FUNCALL Write16Bytes2FlashMemoryArea, COMMAND_LATCH_INTO
  122.         LOCFRAME CSTACK, 8, STACK
  123.         FUNCALL Write16Bytes2FlashMemoryArea, READ_STATUS
  124.         LOCFRAME CSTACK, 8, STACK
  125. PUSH.W R10
  126.         CFI R10 Frame(CFA, -4)
  127.         CFI CFA SP+4
  128. PUSH.W R11
  129.         CFI R11 Frame(CFA, -6)
  130.         CFI CFA SP+6
  131. PUSH.W R8
  132.         CFI R8 Frame(CFA, -8)
  133.         CFI CFA SP+8
  134. //   13 
  135. //   14  unsigned char ucFlashSttsOverflowCnt=0,ucFaxGeneralLenCnt=0,
  136. MOV.B #0x0, R8
  137. MOV.B #0x0, R10
  138. //   15                ucRxIndex=0;
  139. MOV.B #0x0, R11
  140. //   16                
  141. //   17 
  142. //   18    COMMAND_VAL=cFlashWriteCmd;
  143. MOV.B #0x80, &COMMAND_VAL
  144. //   19    COMMAND_LATCH_INTO();
  145. CALL #COMMAND_LATCH_INTO
  146. //   20 //ADDRESS
  147. //   21    
  148. //   22    ADDRESS_VALUE=gwColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  149. MOV.B &gwColumnAddress, &ADDRESS_VALUE
  150. //   23    ADDRESS_LATCH_INTO();
  151. CALL #ADDRESS_LATCH_INTO
  152. //   24 
  153. //   25    ADDRESS_VALUE=(gwColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  154. MOV.W &gwColumnAddress, R14
  155. SWPB R14
  156. AND.W #0xff, R14
  157. MOV.B R14, &ADDRESS_VALUE
  158. //   26    ADDRESS_LATCH_INTO();
  159. CALL #ADDRESS_LATCH_INTO
  160. //   27 
  161. //   28    ADDRESS_VALUE=gwGeneralPageAddress & 0xff;
  162. MOV.B &gwGeneralPageAddress, &ADDRESS_VALUE
  163. //   29    ADDRESS_LATCH_INTO();
  164. CALL #ADDRESS_LATCH_INTO
  165. //   30 
  166. //   31    ADDRESS_VALUE=(gwGeneralPageAddress>>8) & 0XFF;
  167. MOV.W &gwGeneralPageAddress, R14
  168. SWPB R14
  169. AND.W #0xff, R14
  170. MOV.B R14, &ADDRESS_VALUE
  171. //   32    ADDRESS_LATCH_INTO();
  172. CALL #ADDRESS_LATCH_INTO
  173. //   33    FLASH_CON_PORT_OUT &=~ ALE;
  174. BIC.B #0x2, &0x29
  175. //   34 
  176. //   35    DATA_PORT_OUT_INITIAL;
  177. MOV.B #0xff, &0x32
  178. //   36    for (ucFaxGeneralLenCnt=0;ucFaxGeneralLenCnt<16;ucFaxGeneralLenCnt++)
  179. MOV.B #0x0, R10
  180. ??Write16Bytes2FlashMemoryArea_0:
  181. CMP.B #0x10, R10
  182. JC ??Write16Bytes2FlashMemoryArea_1
  183. //   37    {
  184. //   38    FLASH_CON_PORT_OUT&=~WE;
  185. BIC.B #0x1, &0x29
  186. //   39      DATA_PORT_OUT=aucUartRxBuf[ucRxIndex++];
  187. MOV.B R11, R14
  188. AND.W #0xff, R14
  189. MOV.B aucUartRxBuf(R14), &0x31
  190. ADD.B #0x1, R11
  191. //   40      FLASH_CON_PORT_OUT |= WE;
  192. BIS.B #0x1, &0x29
  193. //   41    }
  194. ADD.B #0x1, R10
  195. JMP ??Write16Bytes2FlashMemoryArea_0
  196. //   42 
  197. //   43    COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  198. ??Write16Bytes2FlashMemoryArea_1:
  199. MOV.B #0x10, &COMMAND_VAL
  200. //   44    COMMAND_LATCH_INTO();
  201. CALL #COMMAND_LATCH_INTO
  202. //   45 
  203. //   46    READ_STATUS();
  204. CALL #READ_STATUS
  205. //   47    ucFlashSttsOverflowCnt=0;
  206. MOV.B #0x0, R8
  207. //   48    if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  208. CMP.B #0x1, &FLASH_STATUS
  209. JNE ??Write16Bytes2FlashMemoryArea_2
  210. ADD.B #0x1, R8
  211. //   49    {;}
  212. //   50 }
  213. ??Write16Bytes2FlashMemoryArea_2:
  214. POP.W R8
  215.         CFI R8 SameValue
  216.         CFI CFA SP+6
  217. POP.W R11
  218.         CFI R11 SameValue
  219.         CFI CFA SP+4
  220. POP.W R10
  221.         CFI R10 SameValue
  222.         CFI CFA SP+2
  223. RET
  224.         CFI EndBlock cfiBlock0
  225.         RSEG CODE:CODE:NOROOT(1)
  226. //   51 void ReadLast16BytesFromFlashMemoryArea(unsigned char ucAreaStartBlockAddress, unsigned char ucAreaOverBlockAddress)//read last fax General pointer
  227. ReadLast16BytesFromFlashMemoryArea:
  228.         CFI Block cfiBlock1 Using cfiCommon0
  229.         CFI Function ReadLast16BytesFromFlashMemoryArea
  230. //   52 {
  231.         FUNCALL ReadLast16BytesFromFlashMemoryArea, CalNextPageAddress
  232.         LOCFRAME CSTACK, 26, STACK
  233.         FUNCALL ReadLast16BytesFromFlashMemoryArea, COMMAND_LATCH_INTO
  234.         LOCFRAME CSTACK, 26, STACK
  235.         FUNCALL ReadLast16BytesFromFlashMemoryArea, ADDRESS_LATCH_INTO
  236.         LOCFRAME CSTACK, 26, STACK
  237.         FUNCALL ReadLast16BytesFromFlashMemoryArea, ADDRESS_LATCH_INTO
  238.         LOCFRAME CSTACK, 26, STACK
  239.         FUNCALL ReadLast16BytesFromFlashMemoryArea, ADDRESS_LATCH_INTO
  240.         LOCFRAME CSTACK, 26, STACK
  241.         FUNCALL ReadLast16BytesFromFlashMemoryArea, ADDRESS_LATCH_INTO
  242.         LOCFRAME CSTACK, 26, STACK
  243.         FUNCALL ReadLast16BytesFromFlashMemoryArea, COMMAND_LATCH_INTO
  244.         LOCFRAME CSTACK, 26, STACK
  245. PUSH.W R10
  246.         CFI R10 Frame(CFA, -4)
  247.         CFI CFA SP+4
  248. PUSH.W R11
  249.         CFI R11 Frame(CFA, -6)
  250.         CFI CFA SP+6
  251. PUSH.W R8
  252.         CFI R8 Frame(CFA, -8)
  253.         CFI CFA SP+8
  254. PUSH.W R9
  255.         CFI R9 Frame(CFA, -10)
  256.         CFI CFA SP+10
  257. PUSH.W R6
  258.         CFI R6 Frame(CFA, -12)
  259.         CFI CFA SP+12
  260. PUSH.W R7
  261.         CFI R7 Frame(CFA, -14)
  262.         CFI CFA SP+14
  263. PUSH.W R4
  264.         CFI R4 Frame(CFA, -16)
  265.         CFI CFA SP+16
  266. PUSH.W R5
  267.         CFI R5 Frame(CFA, -18)
  268.         CFI CFA SP+18
  269. SUB.W #0x8, SP
  270.         CFI CFA SP+26
  271. MOV.B R12, 0x3(SP)
  272. MOV.B R14, 0x2(SP)
  273. //   53  unsigned int wPageAddress=0, wBlockAddress=0,
  274. MOV.W #0x0, R4
  275. MOV.W #0x0, R5
  276. //   54               wColumnAddress=0,wNextPageAddress=0,
  277. MOV.W #0x0, R10
  278. MOV.W #0x0, 0x4(SP)
  279. //   55               wGeneralPntCnt=0;
  280. MOV.W #0x0, 0x6(SP)
  281. //   56  unsigned char ucRxIndex=0,
  282. MOV.B #0x0, R11
  283. //   57                ucRxIndex3=0,ucRxIndex2=0,
  284. MOV.B #0x0, R7
  285. MOV.B #0x0, R8
  286. //   58                ucRxIndex0=0,ucRxIndex1=0,
  287. MOV.B #0x0, R9
  288. MOV.B #0x0, R6
  289. //   59                ucGeneralCnt=0,ucFaxGeneralLenCnt;
  290. MOV.B #0x0, 0x0(SP)
  291. //   60 
  292. //   61 
  293. //   62   //for (wBlockAddress=cFaxRearPointerTableStartBlockNum;
  294. //   63       //wBlockAddress<=cFaxRearPointerTableOverBlockNum;wBlockAddress++)
  295. //   64  for (wBlockAddress=ucAreaStartBlockAddress;
  296. MOV.B 0x3(SP), R14
  297. AND.W #0xff, R14
  298. MOV.W R14, R5
  299. //   65       wBlockAddress<=ucAreaOverBlockAddress;wBlockAddress++)
  300. ??ReadLast16BytesFromFlashMemoryArea_5:
  301. MOV.B 0x2(SP), R14
  302. AND.W #0xff, R14
  303. CMP.W R5, R14
  304. JNC ??ReadLast16BytesFromFlashMemoryArea_6
  305. //   66  {
  306. //   67 
  307. //   68  for (wPageAddress=(wBlockAddress<<6);wPageAddress<((wBlockAddress<<6)+64);wPageAddress++)//one block
  308. MOV.W R5, R12
  309. CALL #?ShiftLeft16_6
  310. MOV.W R12, R4
  311. ??ReadLast16BytesFromFlashMemoryArea_4:
  312. MOV.W R5, R12
  313. CALL #?ShiftLeft16_6
  314. ADD.W #0x40, R12
  315. CMP.W R12, R4
  316. JC ??ReadLast16BytesFromFlashMemoryArea_7
  317. //   69  {
  318. //   70       do{
  319. //   71      wNextPageAddress=wPageAddress+64;
  320. ??ReadLast16BytesFromFlashMemoryArea_0:
  321. MOV.W #0x40, R14
  322. ADD.W R4, R14
  323. MOV.W R14, 0x4(SP)
  324. //   72      wPageAddress=CalNextPageAddress(wPageAddress);
  325. MOV.W R4, R12
  326. CALL #CalNextPageAddress
  327. MOV.W R12, R4
  328. //   73       }while(wNextPageAddress==wPageAddress);
  329. CMP.W R4, 0x4(SP)
  330. JEQ ??ReadLast16BytesFromFlashMemoryArea_0
  331. //   74       
  332. //   75       wColumnAddress=0;
  333. MOV.W #0x0, R10
  334. //   76       ROW_ADDRESS_LOW=wPageAddress & 0XFF;
  335. MOV.B R4, &ROW_ADDRESS_LOW
  336. //   77       ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
  337. MOV.W R4, R14
  338. SWPB R14
  339. AND.W #0xff, R14
  340. MOV.B R14, &ROW_ADDRESS_HIGH
  341. //   78       
  342. //   79       for (ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  343. MOV.B #0x0, 0x0(SP)
  344. ??ReadLast16BytesFromFlashMemoryArea_3:
  345. CMP.B #0x8, 0x0(SP)
  346. JC ??ReadLast16BytesFromFlashMemoryArea_8
  347. //   80       {
  348. //   81 //COMMAND
  349. //   82    COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2111BYTE
  350. MOV.B #0x0, &COMMAND_VAL
  351. //   83    COMMAND_LATCH_INTO();
  352. CALL #COMMAND_LATCH_INTO
  353. //   84 //ADDRESS
  354. //   85 
  355. //   86    ADDRESS_VALUE=wColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
  356. MOV.B R10, &ADDRESS_VALUE
  357. //   87    ADDRESS_LATCH_INTO();
  358. CALL #ADDRESS_LATCH_INTO
  359. //   88 
  360. //   89    ADDRESS_VALUE=(wColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
  361. MOV.W R10, R14
  362. SWPB R14
  363. AND.W #0xff, R14
  364. MOV.B R14, &ADDRESS_VALUE
  365. //   90    ADDRESS_LATCH_INTO();
  366. CALL #ADDRESS_LATCH_INTO
  367. //   91 
  368. //   92    ADDRESS_VALUE=ROW_ADDRESS_LOW;
  369. MOV.B &ROW_ADDRESS_LOW, &ADDRESS_VALUE
  370. //   93    ADDRESS_LATCH_INTO();
  371. CALL #ADDRESS_LATCH_INTO
  372. //   94 
  373. //   95    ADDRESS_VALUE=ROW_ADDRESS_HIGH;
  374. MOV.B &ROW_ADDRESS_HIGH, &ADDRESS_VALUE
  375. //   96    ADDRESS_LATCH_INTO();
  376. CALL #ADDRESS_LATCH_INTO
  377. //   97    FLASH_CON_PORT_OUT &=~ ALE;
  378. BIC.B #0x2, &0x29
  379. //   98 
  380. //   99    COMMAND_VAL=0X30;
  381. MOV.B #0x30, &COMMAND_VAL
  382. //  100    COMMAND_LATCH_INTO();
  383. CALL #COMMAND_LATCH_INTO
  384. //  101    //ATcmdDelay();
  385. //  102    while((FLASH_CON_PORT_IN & RB)==0);
  386. ??ReadLast16BytesFromFlashMemoryArea_1:
  387. BIT.B #0x20, &0x28
  388. JNC ??ReadLast16BytesFromFlashMemoryArea_1
  389. //  103    DATA_PORT_IN_INITIAL;
  390. MOV.B #0x0, &0x32
  391. //  104    for (ucFaxGeneralLenCnt=0;ucFaxGeneralLenCnt<16;ucFaxGeneralLenCnt++)
  392. MOV.B #0x0, 0x1(SP)
  393. ??ReadLast16BytesFromFlashMemoryArea_2:
  394. CMP.B #0x10, 0x1(SP)
  395. JC ??ReadLast16BytesFromFlashMemoryArea_9
  396. //  105    {
  397. //  106      FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
  398. BIC.B #0x10, &0x29
  399. //  107      aucUartRxBuf[ucRxIndex++]=DATA_PORT_IN;
  400. MOV.B R11, R14
  401. AND.W #0xff, R14
  402. MOV.B &0x30, aucUartRxBuf(R14)
  403. ADD.B #0x1, R11
  404. //  108      FLASH_CON_PORT_OUT |= RE;
  405. BIS.B #0x10, &0x29
  406. //  109    }
  407. ADD.B #0x1, 0x1(SP)
  408. JMP ??ReadLast16BytesFromFlashMemoryArea_2
  409. //  110    wGeneralPntCnt++;
  410. ??ReadLast16BytesFromFlashMemoryArea_9:
  411. ADD.W #0x1, 0x6(SP)
  412. //  111    
  413. //  112    ucRxIndex3=ucRxIndex-4;
  414. MOV.B #0xfc, R14
  415. ADD.B R11, R14
  416. MOV.B R14, R7
  417. //  113           ucRxIndex2=ucRxIndex-3;
  418. MOV.B #0xfd, R14
  419. ADD.B R11, R14
  420. MOV.B R14, R8
  421. //  114           ucRxIndex1=ucRxIndex-2;
  422. MOV.B #0xfe, R14
  423. ADD.B R11, R14
  424. MOV.B R14, R6
  425. //  115           ucRxIndex0=ucRxIndex-1;
  426. MOV.B #0xff, R14
  427. ADD.B R11, R14
  428. MOV.B R14, R9
  429. //  116    if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  430. //  117         0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  431. MOV.B R9, R14
  432. AND.W #0xff, R14
  433. CMP.B #0xff, aucUartRxBuf(R14)
  434. JNE ??ReadLast16BytesFromFlashMemoryArea_10
  435. MOV.B R6, R14
  436. AND.W #0xff, R14
  437. CMP.B #0xff, aucUartRxBuf(R14)
  438. JNE ??ReadLast16BytesFromFlashMemoryArea_10
  439. MOV.B R8, R14
  440. AND.W #0xff, R14
  441. CMP.B #0xff, aucUartRxBuf(R14)
  442. JNE ??ReadLast16BytesFromFlashMemoryArea_10
  443. MOV.B R7, R14
  444. AND.W #0xff, R14
  445. CMP.B #0xff, aucUartRxBuf(R14)
  446. JNE ??ReadLast16BytesFromFlashMemoryArea_10
  447. //  118       {
  448. //  119       gucUartRxCnt = ucRxIndex-32;
  449. MOV.B #0xe0, R14
  450. ADD.B R11, R14
  451. MOV.B R14, &gucUartRxCnt
  452. //  120       break;  //next General   
  453. JMP ??ReadLast16BytesFromFlashMemoryArea_8
  454. //  121       }//if
  455. //  122    if (ucGeneralCnt<4)
  456. ??ReadLast16BytesFromFlashMemoryArea_10:
  457. CMP.B #0x4, 0x0(SP)
  458. JC ??ReadLast16BytesFromFlashMemoryArea_11
  459. //  123   wColumnAddress+=512;
  460. ADD.W #0x200, R10
  461. JMP ??ReadLast16BytesFromFlashMemoryArea_12
  462. //  124           else
  463. //  125   wColumnAddress+=16;
  464. ??ReadLast16BytesFromFlashMemoryArea_11:
  465. ADD.W #0x10, R10
  466. //  126    }//for read next General pointer
  467. ??ReadLast16BytesFromFlashMemoryArea_12:
  468. ADD.B #0x1, 0x0(SP)
  469. JMP ??ReadLast16BytesFromFlashMemoryArea_3
  470. //  127    
  471. //  128    
  472. //  129    if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  473. //  130         0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  474. ??ReadLast16BytesFromFlashMemoryArea_8:
  475. MOV.B R9, R14
  476. AND.W #0xff, R14
  477. CMP.B #0xff, aucUartRxBuf(R14)
  478. JNE ??ReadLast16BytesFromFlashMemoryArea_13
  479. MOV.B R6, R14
  480. AND.W #0xff, R14
  481. CMP.B #0xff, aucUartRxBuf(R14)
  482. JNE ??ReadLast16BytesFromFlashMemoryArea_13
  483. MOV.B R8, R14
  484. AND.W #0xff, R14
  485. CMP.B #0xff, aucUartRxBuf(R14)
  486. JNE ??ReadLast16BytesFromFlashMemoryArea_13
  487. MOV.B R7, R14
  488. AND.W #0xff, R14
  489. CMP.B #0xff, aucUartRxBuf(R14)
  490. JEQ ??ReadLast16BytesFromFlashMemoryArea_7
  491. //  131       {break;}
  492. //  132    }//for next page
  493. ??ReadLast16BytesFromFlashMemoryArea_13:
  494. ADD.W #0x1, R4
  495. JMP ??ReadLast16BytesFromFlashMemoryArea_4
  496. //  133    
  497. //  134    
  498. //  135    if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
  499. //  136         0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
  500. ??ReadLast16BytesFromFlashMemoryArea_7:
  501. MOV.B R9, R14
  502. AND.W #0xff, R14
  503. CMP.B #0xff, aucUartRxBuf(R14)
  504. JNE ??ReadLast16BytesFromFlashMemoryArea_14
  505. MOV.B R6, R14
  506. AND.W #0xff, R14
  507. CMP.B #0xff, aucUartRxBuf(R14)
  508. JNE ??ReadLast16BytesFromFlashMemoryArea_14
  509. MOV.B R8, R14
  510. AND.W #0xff, R14
  511. CMP.B #0xff, aucUartRxBuf(R14)
  512. JNE ??ReadLast16BytesFromFlashMemoryArea_14
  513. MOV.B R7, R14
  514. AND.W #0xff, R14
  515. CMP.B #0xff, aucUartRxBuf(R14)
  516. JEQ ??ReadLast16BytesFromFlashMemoryArea_6
  517. //  137       {break;}
  518. //  138  }//for next block
  519. ??ReadLast16BytesFromFlashMemoryArea_14:
  520. ADD.W #0x1, R5
  521. JMP ??ReadLast16BytesFromFlashMemoryArea_5
  522. //  139  gwGeneralPageAddress=wPageAddress; //for write Fax General pointer
  523. ??ReadLast16BytesFromFlashMemoryArea_6:
  524. MOV.W R4, &gwGeneralPageAddress
  525. //  140   gwColumnAddress=wColumnAddress; //for find blank page
  526. MOV.W R10, &gwColumnAddress
  527. //  141   if (ucAreaOverBlockAddress>10)
  528. CMP.B #0xb, 0x2(SP)
  529. JNC ??ReadLast16BytesFromFlashMemoryArea_15
  530. //  142   {
  531. //  143   if (wGeneralPntCnt>1)
  532. CMP.W #0x2, 0x6(SP)
  533. JNC ??ReadLast16BytesFromFlashMemoryArea_16
  534. //  144   {
  535. //  145     ucRxIndex1=ucRxIndex-32;
  536. MOV.B #0xe0, R14
  537. ADD.B R11, R14
  538. MOV.B R14, R6
  539. //  146     ucRxIndex0=ucRxIndex-31;
  540. MOV.B #0xe1, R14
  541. ADD.B R11, R14
  542. MOV.B R14, R9
  543. //  147     wPageAddress=aucUartRxBuf[ucRxIndex0];
  544. MOV.B R9, R14
  545. AND.W #0xff, R14
  546. MOV.B aucUartRxBuf(R14), R14
  547. AND.W #0xff, R14
  548. MOV.W R14, R4
  549. //  148     gwPageAddress=(wPageAddress<<8) | aucUartRxBuf[ucRxIndex1];
  550. MOV.W R4, R15
  551. AND.W #0xff, R15
  552. SWPB R15
  553. MOV.B R6, R14
  554. AND.W #0xff, R14
  555. MOV.B aucUartRxBuf(R14), R14
  556. AND.W #0xff, R14
  557. BIS.W R14, R15
  558. MOV.W R15, &gwPageAddress
  559. //  149     gucGeneralStatus |= bitReadFlashMemoryOK; 
  560. BIS.B #0x20, &gucGeneralStatus
  561. JMP ??ReadLast16BytesFromFlashMemoryArea_15
  562. //  150   }
  563. //  151   else
  564. //  152     {
  565. //  153      gwPageAddress=cstFaxContentStartPage-1;//2559;//1279;//write the data start address
  566. ??ReadLast16BytesFromFlashMemoryArea_16:
  567. MOV.W #0x13ff, &gwPageAddress
  568. //  154      gucGeneralStatus &= ~bitReadFlashMemoryOK;
  569. BIC.B #0x20, &gucGeneralStatus
  570. //  155     }
  571. //  156   }
  572. //  157 }
  573. ??ReadLast16BytesFromFlashMemoryArea_15:
  574. ADD.W #0x8, SP
  575.         CFI CFA SP+18
  576. BR #?Epilogue8
  577.         CFI EndBlock cfiBlock1
  578.         RSEG CODE:CODE:NOROOT(1)
  579. ?setjmp_save_r4:
  580. REQUIRE ?setjmp_r4
  581. REQUIRE ?longjmp_r4
  582.         RSEG CODE:CODE:NOROOT(1)
  583. ?setjmp_save_r5:
  584. REQUIRE ?setjmp_r5
  585. REQUIRE ?longjmp_r5
  586.         END
  587. // 
  588. // 752 bytes in segment CODE
  589. //   5 bytes in segment DATA16_AN
  590. // 
  591. // 752 bytes of CODE memory
  592. //   0 bytes of DATA memory (+ 5 bytes shared)
  593. //
  594. //Errors: none
  595. //Warnings: none