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

传真(Fax)编程

开发平台:

C/C++

  1.         NAME FaxRxBuf2Flash
  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 ?Epilogue8
  9.         EXTERN gwPageAddress
  10.         EXTERN ViewCommunicationRX
  11.         FUNCTION ViewCommunicationRX,0202H
  12.         EXTERN aucUartRxBuf
  13.         EXTERN gdwRxQueueFrontCnt
  14.         EXTERN aucViewData
  15.         EXTERN FRHTSI
  16.         EXTERN ZERO_ADDRESS
  17.         FUNCTION ZERO_ADDRESS,0202H
  18.         EXTERN ROW_ADDRESS_LOW
  19.         EXTERN ROW_ADDRESS_HIGH
  20.         EXTERN PROGRAM_256_BYTE
  21.         FUNCTION PROGRAM_256_BYTE,0202H
  22.         EXTERN ReadLast16BytesFromFlashMemoryArea
  23.         FUNCTION ReadLast16BytesFromFlashMemoryArea,0202H
  24.         EXTERN CalNextPageAddress
  25.         FUNCTION CalNextPageAddress,0202H
  26.         EXTERN ?DivMod16u
  27.         EXTERN ERASE_ONE_BLOCK
  28.         FUNCTION ERASE_ONE_BLOCK,0202H
  29.         EXTERN COMMAND_VAL
  30.         EXTERN COMMAND_LATCH_INTO
  31.         FUNCTION COMMAND_LATCH_INTO,0202H
  32.         EXTERN ADDRESS_VALUE
  33.         EXTERN ADDRESS_LATCH_INTO
  34.         FUNCTION ADDRESS_LATCH_INTO,0202H
  35.         EXTERN READ_STATUS
  36.         FUNCTION READ_STATUS,0202H
  37.         EXTERN FLASH_STATUS
  38.         EXTERN gwGeneralPageAddress
  39.         EXTERN ?ShiftRight16u_6
  40.         EXTERN ?ShiftLeft16_6
  41.         EXTERN gwColumnAddress
  42.         EXTERN Write16Bytes2FlashMemoryArea
  43.         FUNCTION Write16Bytes2FlashMemoryArea,0202H
  44.         EXTERN ?longjmp_r4
  45.         EXTERN ?longjmp_r5
  46.         EXTERN ?setjmp_r4
  47.         EXTERN ?setjmp_r5
  48.         PUBWEAK ?setjmp_save_r4
  49.         PUBWEAK ?setjmp_save_r5
  50.         PUBLIC FaxRxBufRawdata2Flash
  51.         FUNCTION FaxRxBufRawdata2Flash,021203H
  52.         LOCFRAME CSTACK, 20, STACK
  53.         PUBWEAK P2IN
  54.         PUBWEAK P2OUT
  55.         
  56.         CFI Names cfiNames0
  57.         CFI StackFrame CFA SP DATA
  58.         CFI Resource PC:16, SP:16, SR:16, R4:16, R5:16, R6:16, R7:16, R8:16
  59.         CFI Resource R9:16, R10:16, R11:16, R12:16, R13:16, R14:16, R15:16
  60.         CFI EndNames cfiNames0
  61.         
  62.         CFI Common cfiCommon0 Using cfiNames0
  63.         CFI CodeAlign 2
  64.         CFI DataAlign 2
  65.         CFI ReturnAddress PC CODE
  66.         CFI CFA SP+2
  67.         CFI PC Frame(CFA, -2)
  68.         CFI SR Undefined
  69.         CFI R4 SameValue
  70.         CFI R5 SameValue
  71.         CFI R6 SameValue
  72.         CFI R7 SameValue
  73.         CFI R8 SameValue
  74.         CFI R9 SameValue
  75.         CFI R10 SameValue
  76.         CFI R11 SameValue
  77.         CFI R12 Undefined
  78.         CFI R13 Undefined
  79.         CFI R14 Undefined
  80.         CFI R15 Undefined
  81.         CFI EndCommon cfiCommon0
  82.         
  83. // E:projectFaxProgramVson_Bryan_Fax_Conexant_070423filesFaxRxBuf2Flash.c
  84. //    1 
  85. //    2 //**************************************************************************
  86. //    3 
  87. //    4 #include "includeH.h"
  88.         ASEGN DATA16_AN:DATA:NOROOT,028H
  89. // unsigned char const volatile __data P2IN
  90. P2IN:
  91.         DS8 1
  92.         ASEGN DATA16_AN:DATA:NOROOT,029H
  93. // unsigned char volatile __data P2OUT
  94. P2OUT:
  95.         DS8 1
  96. //    5 
  97.         RSEG CODE:CODE:NOROOT(1)
  98. //    6 void  FaxRxBufRawdata2Flash(void)
  99. FaxRxBufRawdata2Flash:
  100.         CFI Block cfiBlock0 Using cfiCommon0
  101.         CFI Function FaxRxBufRawdata2Flash
  102. //    7 {     
  103.         FUNCALL FaxRxBufRawdata2Flash, ViewCommunicationRX
  104.         LOCFRAME CSTACK, 20, STACK
  105.         FUNCALL FaxRxBufRawdata2Flash, ZERO_ADDRESS
  106.         LOCFRAME CSTACK, 20, STACK
  107.         FUNCALL FaxRxBufRawdata2Flash, PROGRAM_256_BYTE
  108.         LOCFRAME CSTACK, 20, STACK
  109.         FUNCALL FaxRxBufRawdata2Flash, ReadLast16BytesFromFlashMemoryArea
  110.         LOCFRAME CSTACK, 20, STACK
  111.         FUNCALL FaxRxBufRawdata2Flash, CalNextPageAddress
  112.         LOCFRAME CSTACK, 20, STACK
  113.         FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
  114.         LOCFRAME CSTACK, 20, STACK
  115.         FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
  116.         LOCFRAME CSTACK, 20, STACK
  117.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  118.         LOCFRAME CSTACK, 20, STACK
  119.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  120.         LOCFRAME CSTACK, 20, STACK
  121.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  122.         LOCFRAME CSTACK, 20, STACK
  123.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  124.         LOCFRAME CSTACK, 20, STACK
  125.         FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
  126.         LOCFRAME CSTACK, 20, STACK
  127.         FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
  128.         LOCFRAME CSTACK, 20, STACK
  129.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  130.         LOCFRAME CSTACK, 20, STACK
  131.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  132.         LOCFRAME CSTACK, 20, STACK
  133.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  134.         LOCFRAME CSTACK, 20, STACK
  135.         FUNCALL FaxRxBufRawdata2Flash, ADDRESS_LATCH_INTO
  136.         LOCFRAME CSTACK, 20, STACK
  137.         FUNCALL FaxRxBufRawdata2Flash, COMMAND_LATCH_INTO
  138.         LOCFRAME CSTACK, 20, STACK
  139.         FUNCALL FaxRxBufRawdata2Flash, READ_STATUS
  140.         LOCFRAME CSTACK, 20, STACK
  141.         FUNCALL FaxRxBufRawdata2Flash, CalNextPageAddress
  142.         LOCFRAME CSTACK, 20, STACK
  143.         FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
  144.         LOCFRAME CSTACK, 20, STACK
  145.         FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
  146.         LOCFRAME CSTACK, 20, STACK
  147.         FUNCALL FaxRxBufRawdata2Flash, Write16Bytes2FlashMemoryArea
  148.         LOCFRAME CSTACK, 20, STACK
  149.         FUNCALL FaxRxBufRawdata2Flash, ReadLast16BytesFromFlashMemoryArea
  150.         LOCFRAME CSTACK, 20, STACK
  151.         FUNCALL FaxRxBufRawdata2Flash, ERASE_ONE_BLOCK
  152.         LOCFRAME CSTACK, 20, STACK
  153.         FUNCALL FaxRxBufRawdata2Flash, Write16Bytes2FlashMemoryArea
  154.         LOCFRAME CSTACK, 20, STACK
  155. PUSH.W R10
  156.         CFI R10 Frame(CFA, -4)
  157.         CFI CFA SP+4
  158. PUSH.W R11
  159.         CFI R11 Frame(CFA, -6)
  160.         CFI CFA SP+6
  161. PUSH.W R8
  162.         CFI R8 Frame(CFA, -8)
  163.         CFI CFA SP+8
  164. PUSH.W R9
  165.         CFI R9 Frame(CFA, -10)
  166.         CFI CFA SP+10
  167. PUSH.W R6
  168.         CFI R6 Frame(CFA, -12)
  169.         CFI CFA SP+12
  170. PUSH.W R7
  171.         CFI R7 Frame(CFA, -14)
  172.         CFI CFA SP+14
  173. PUSH.W R4
  174.         CFI R4 Frame(CFA, -16)
  175.         CFI CFA SP+16
  176. PUSH.W R5
  177.         CFI R5 Frame(CFA, -18)
  178.         CFI CFA SP+18
  179. SUB.W #0x2, SP
  180.         CFI CFA SP+20
  181. //    8       unsigned char 
  182. //    9                     ucRxIndex=0,ucGeneralCnt=0,ucFlashSttsOverflowCnt=0,
  183. MOV.B #0x0, R11
  184. MOV.B #0x0, R10
  185. MOV.B #0x0, R5
  186. //   10                     ucBlockCnt=0;
  187. MOV.B #0x0, R9
  188. //   11       unsigned int  wPageCount=0,wRxBufPageRearAddress=0,
  189. MOV.W #0x0, R6
  190. MOV.W #0x0, 0x0(SP)
  191. //   12                     wNextPageAddress=0,wPageAddress=cstFaxRxBufStartPage,
  192. MOV.W #0x0, R4
  193. MOV.W #0x4c0, R8
  194. //   13                     wEveryFaxHead=0;//wFaxPropertyNo=0;
  195. MOV.W #0x0, R7
  196. //   14 
  197. //   15  
  198. //   16 
  199. //   17 
  200. //   18       wRxBufPageRearAddress=gwPageAddress;//1226;//gwPageAddress;
  201. MOV.W &gwPageAddress, 0x0(SP)
  202. //   19       ViewCommunicationRX();//read fax time
  203. CALL #ViewCommunicationRX
  204. //   20       for(ucGeneralCnt=0;ucGeneralCnt<255;ucGeneralCnt++)
  205. MOV.B #0x0, R10
  206. ??FaxRxBufRawdata2Flash_0:
  207. CMP.B #0xff, R10
  208. JC ??FaxRxBufRawdata2Flash_13
  209. //   21        { 
  210. //   22             aucUartRxBuf[ucGeneralCnt]=0;    //clear RX buffer
  211. MOV.B R10, R14
  212. AND.W #0xff, R14
  213. MOV.B #0x0, aucUartRxBuf(R14)
  214. //   23        }  
  215. ADD.B #0x1, R10
  216. JMP ??FaxRxBufRawdata2Flash_0
  217. //   24    
  218. //   25    gdwRxQueueFrontCnt += 2048;
  219. ??FaxRxBufRawdata2Flash_13:
  220. ADD.W #0x800, &gdwRxQueueFrontCnt
  221. ADDC.W #0x0, &gdwRxQueueFrontCnt + 0x2
  222. //   26        //Fax packet head ba 23 ba 23
  223. //   27                   ucRxIndex=0; //write Fax Property
  224. MOV.B #0x0, R11
  225. //   28    aucUartRxBuf[ucRxIndex++] = 0xba;
  226. MOV.B R11, R14
  227. AND.W #0xff, R14
  228. MOV.B #0xba, aucUartRxBuf(R14)
  229. ADD.B #0x1, R11
  230. //   29    aucUartRxBuf[ucRxIndex++] = 0x23;
  231. MOV.B R11, R14
  232. AND.W #0xff, R14
  233. MOV.B #0x23, aucUartRxBuf(R14)
  234. ADD.B #0x1, R11
  235. //   30    aucUartRxBuf[ucRxIndex++] = 0xba;
  236. MOV.B R11, R14
  237. AND.W #0xff, R14
  238. MOV.B #0xba, aucUartRxBuf(R14)
  239. ADD.B #0x1, R11
  240. //   31    aucUartRxBuf[ucRxIndex++] = 0x23;
  241. MOV.B R11, R14
  242. AND.W #0xff, R14
  243. MOV.B #0x23, aucUartRxBuf(R14)
  244. ADD.B #0x1, R11
  245. //   32       for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  246. MOV.B #0x0, R10
  247. ??FaxRxBufRawdata2Flash_1:
  248. CMP.B #0x8, R10
  249. JC ??FaxRxBufRawdata2Flash_14
  250. //   33       {
  251. //   34          aucUartRxBuf[ucRxIndex++] = 0x55;
  252. MOV.B R11, R14
  253. AND.W #0xff, R14
  254. MOV.B #0x55, aucUartRxBuf(R14)
  255. ADD.B #0x1, R11
  256. //   35       }
  257. ADD.B #0x1, R10
  258. JMP ??FaxRxBufRawdata2Flash_1
  259. //   36       //fax Length
  260. //   37       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt & 0xff);
  261. ??FaxRxBufRawdata2Flash_14:
  262. MOV.B R11, R14
  263. AND.W #0xff, R14
  264. MOV.B &gdwRxQueueFrontCnt, aucUartRxBuf(R14)
  265. ADD.B #0x1, R11
  266. //   38       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt >> 8) & 0xff;
  267. MOV.B R11, R14
  268. AND.W #0xff, R14
  269. MOV.W &gdwRxQueueFrontCnt, R15
  270. SWPB R15
  271. AND.W #0xff, R15
  272. MOV.B R15, aucUartRxBuf(R14)
  273. ADD.B #0x1, R11
  274. //   39       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>16) & 0xff;
  275. MOV.B R11, R14
  276. AND.W #0xff, R14
  277. MOV.B &gdwRxQueueFrontCnt + 0x2, aucUartRxBuf(R14)
  278. ADD.B #0x1, R11
  279. //   40       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>24) & 0xff;
  280. MOV.B R11, R12
  281. AND.W #0xff, R12
  282. MOV.W &gdwRxQueueFrontCnt, R14
  283. MOV.W &gdwRxQueueFrontCnt + 0x2, R15
  284. SWPB R15
  285. MOV.B R15, R14
  286. MOV.W #0x0, R15
  287. MOV.B R14, aucUartRxBuf(R12)
  288. ADD.B #0x1, R11
  289. //   41       for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  290. MOV.B #0x0, R10
  291. ??FaxRxBufRawdata2Flash_2:
  292. CMP.B #0x8, R10
  293. JC ??FaxRxBufRawdata2Flash_15
  294. //   42       {
  295. //   43          aucUartRxBuf[ucRxIndex++] = 0x55;
  296. MOV.B R11, R14
  297. AND.W #0xff, R14
  298. MOV.B #0x55, aucUartRxBuf(R14)
  299. ADD.B #0x1, R11
  300. //   44       }
  301. ADD.B #0x1, R10
  302. JMP ??FaxRxBufRawdata2Flash_2
  303. //   45       //fax time
  304. //   46       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewSecondIndex];// //second
  305. ??FaxRxBufRawdata2Flash_15:
  306. MOV.B R11, R14
  307. AND.W #0xff, R14
  308. MOV.B &aucViewData + 0x2, aucUartRxBuf(R14)
  309. ADD.B #0x1, R11
  310. //   47       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMinuteIndex];//  //minute
  311. MOV.B R11, R14
  312. AND.W #0xff, R14
  313. MOV.B &aucViewData + 0x1, aucUartRxBuf(R14)
  314. ADD.B #0x1, R11
  315. //   48       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewHourIndex];//hour
  316. MOV.B R11, R14
  317. AND.W #0xff, R14
  318. MOV.B &aucViewData, aucUartRxBuf(R14)
  319. ADD.B #0x1, R11
  320. //   49       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewDateIndex];//date
  321. MOV.B R11, R14
  322. AND.W #0xff, R14
  323. MOV.B &aucViewData + 0x4, aucUartRxBuf(R14)
  324. ADD.B #0x1, R11
  325. //   50       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMonthIndex];//month
  326. MOV.B R11, R14
  327. AND.W #0xff, R14
  328. MOV.B &aucViewData + 0x3, aucUartRxBuf(R14)
  329. ADD.B #0x1, R11
  330. //   51       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewYearIndex];//Year
  331. MOV.B R11, R14
  332. AND.W #0xff, R14
  333. MOV.B &aucViewData + 0x5, aucUartRxBuf(R14)
  334. ADD.B #0x1, R11
  335. //   52       //fax Head and Rear Address
  336. //   53       //aucUartRxBuf[ucRxIndex++] = wEveryFaxHead & 0xff;
  337. //   54       //aucUartRxBuf[ucRxIndex++] = (wEveryFaxHead>>8) & 0xff;
  338. //   55       //aucUartRxBuf[ucRxIndex++] = gwPageAddress & 0xff;
  339. //   56       //aucUartRxBuf[ucRxIndex++] = (gwPageAddress>>8) & 0xff;
  340. //   57       for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  341. MOV.B #0x0, R10
  342. ??FaxRxBufRawdata2Flash_3:
  343. CMP.B #0x8, R10
  344. JC ??FaxRxBufRawdata2Flash_16
  345. //   58       {
  346. //   59          aucUartRxBuf[ucRxIndex++] = 0x55;
  347. MOV.B R11, R14
  348. AND.W #0xff, R14
  349. MOV.B #0x55, aucUartRxBuf(R14)
  350. ADD.B #0x1, R11
  351. //   60       }
  352. ADD.B #0x1, R10
  353. JMP ??FaxRxBufRawdata2Flash_3
  354. //   61       
  355. //   62       //fax Telephone Number
  356. //   63       for (ucGeneralCnt=0; ucGeneralCnt<25; ucGeneralCnt++)
  357. ??FaxRxBufRawdata2Flash_16:
  358. MOV.B #0x0, R10
  359. ??FaxRxBufRawdata2Flash_4:
  360. CMP.B #0x19, R10
  361. JC ??FaxRxBufRawdata2Flash_17
  362. //   64       {
  363. //   65          aucUartRxBuf[ucRxIndex++] = FRHTSI[ucGeneralCnt];
  364. MOV.B R11, R15
  365. AND.W #0xff, R15
  366. MOV.B R10, R14
  367. AND.W #0xff, R14
  368. MOV.B FRHTSI(R14), aucUartRxBuf(R15)
  369. ADD.B #0x1, R11
  370. //   66       }
  371. ADD.B #0x1, R10
  372. JMP ??FaxRxBufRawdata2Flash_4
  373. //   67       for(ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
  374. ??FaxRxBufRawdata2Flash_17:
  375. MOV.B #0x0, R10
  376. ??FaxRxBufRawdata2Flash_5:
  377. CMP.B #0x8, R10
  378. JC ??FaxRxBufRawdata2Flash_18
  379. //   68       {
  380. //   69          aucUartRxBuf[ucRxIndex++] = 0x55;
  381. MOV.B R11, R14
  382. AND.W #0xff, R14
  383. MOV.B #0x55, aucUartRxBuf(R14)
  384. ADD.B #0x1, R11
  385. //   70       }
  386. ADD.B #0x1, R10
  387. JMP ??FaxRxBufRawdata2Flash_5
  388. //   71       
  389. //   72       //wPageAddress = cstFaxRxBufFirstPage;
  390. //   73       ZERO_ADDRESS();
  391. ??FaxRxBufRawdata2Flash_18:
  392. CALL #ZERO_ADDRESS
  393. //   74       ROW_ADDRESS_LOW = wPageAddress & 0XFF;
  394. MOV.B R8, &ROW_ADDRESS_LOW
  395. //   75       ROW_ADDRESS_HIGH = (wPageAddress>>8) & 0XFF;
  396. MOV.W R8, R14
  397. SWPB R14
  398. AND.W #0xff, R14
  399. MOV.B R14, &ROW_ADDRESS_HIGH
  400. //   76       PROGRAM_256_BYTE();                         
  401. CALL #PROGRAM_256_BYTE
  402. //   77    //find the rear pointer in the Fax Rear Area
  403. //   78    //wRxBufPageRearAddress=gwPageAddress;//1226;//gwPageAddress;
  404. //   79       ReadLastFaxRearPointer();//return gwPageAddress
  405. MOV.B #0x12, R14
  406. MOV.B #0xf, R12
  407. CALL #ReadLast16BytesFromFlashMemoryArea
  408. //   80       //ReadLast16BytesFromFlashMemoryArea(cstFaxRearPointerTableStartBlockNum, cstFaxRearPointerTableOverBlockNum);//return gwPageAddress
  409. //   81       gwPageAddress++;
  410. ADD.W #0x1, &gwPageAddress
  411. //   82              //check the gwPageAddress whether it is a page in bad block 
  412. //   83              do{
  413. //   84               wNextPageAddress=gwPageAddress+64;
  414. ??FaxRxBufRawdata2Flash_6:
  415. MOV.W #0x40, R14
  416. ADD.W &gwPageAddress, R14
  417. MOV.W R14, R4
  418. //   85               gwPageAddress=CalNextPageAddress(gwPageAddress);
  419. MOV.W &gwPageAddress, R12
  420. CALL #CalNextPageAddress
  421. MOV.W R12, &gwPageAddress
  422. //   86               }while(wNextPageAddress==gwPageAddress);
  423. CMP.W &gwPageAddress, R4
  424. JEQ ??FaxRxBufRawdata2Flash_6
  425. //   87             //erase next block
  426. //   88             if (gwPageAddress%64==0)
  427. MOV.W &gwPageAddress, R12
  428. MOV.W #0x40, R14
  429. CALL #?DivMod16u
  430. CMP.W #0x0, R14
  431. JNE ??FaxRxBufRawdata2Flash_19
  432. //   89                {
  433. //   90                   ROW_ADDRESS_LOW=gwPageAddress & 0XFF;
  434. MOV.B &gwPageAddress, &ROW_ADDRESS_LOW
  435. //   91                   ROW_ADDRESS_HIGH=(gwPageAddress>>8) & 0XFF; 
  436. MOV.W &gwPageAddress, R14
  437. SWPB R14
  438. AND.W #0xff, R14
  439. MOV.B R14, &ROW_ADDRESS_HIGH
  440. //   92                   ERASE_ONE_BLOCK();
  441. CALL #ERASE_ONE_BLOCK
  442. //   93                }
  443. //   94       wEveryFaxHead=gwPageAddress;//Record the Every Fax head for the Every fax table
  444. ??FaxRxBufRawdata2Flash_19:
  445. MOV.W &gwPageAddress, R7
  446. //   95               
  447. //   96         for (wPageCount=cstFaxRxBufStartPage;wPageCount<=wRxBufPageRearAddress;wPageCount++)//Block 19-39
  448. MOV.W #0x4c0, R6
  449. ??FaxRxBufRawdata2Flash_9:
  450. CMP.W R6, 0x0(SP)
  451. JNC ??FaxRxBufRawdata2Flash_20
  452. //   97         {
  453. //   98     COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2112BYTE
  454. MOV.B #0x0, &COMMAND_VAL
  455. //   99  COMMAND_LATCH_INTO();
  456. CALL #COMMAND_LATCH_INTO
  457. //  100 //ADDRESS
  458. //  101  ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
  459. MOV.B #0x0, &ADDRESS_VALUE
  460. //  102  ADDRESS_LATCH_INTO();
  461. CALL #ADDRESS_LATCH_INTO
  462. //  103 
  463. //  104  ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
  464. MOV.B #0x0, &ADDRESS_VALUE
  465. //  105  ADDRESS_LATCH_INTO();
  466. CALL #ADDRESS_LATCH_INTO
  467. //  106 
  468. //  107  ADDRESS_VALUE= wPageCount & 0xff ; //#0X00
  469. MOV.B R6, &ADDRESS_VALUE
  470. //  108  ADDRESS_LATCH_INTO();
  471. CALL #ADDRESS_LATCH_INTO
  472. //  109 
  473. //  110  ADDRESS_VALUE= (wPageCount>>8) & 0xff; //#0X00
  474. MOV.W R6, R14
  475. SWPB R14
  476. AND.W #0xff, R14
  477. MOV.B R14, &ADDRESS_VALUE
  478. //  111  ADDRESS_LATCH_INTO();
  479. CALL #ADDRESS_LATCH_INTO
  480. //  112  FLASH_CON_PORT_OUT &=~ ALE;
  481. BIC.B #0x2, &0x29
  482. //  113 
  483. //  114  COMMAND_VAL=0X35;
  484. MOV.B #0x35, &COMMAND_VAL
  485. //  115  COMMAND_LATCH_INTO();
  486. CALL #COMMAND_LATCH_INTO
  487. //  116  //ATcmdDelay();
  488. //  117  while((FLASH_CON_PORT_IN & RB)==0);
  489. ??FaxRxBufRawdata2Flash_7:
  490. BIT.B #0x20, &0x28
  491. JNC ??FaxRxBufRawdata2Flash_7
  492. //  118    
  493. //  119    COMMAND_VAL=0x85;
  494. MOV.B #0x85, &COMMAND_VAL
  495. //  120  COMMAND_LATCH_INTO();
  496. CALL #COMMAND_LATCH_INTO
  497. //  121 
  498. //  122 //ADDRESS
  499. //  123  ADDRESS_VALUE=0;//COLUMN_ADDRESS_LOW; //#0X00
  500. MOV.B #0x0, &ADDRESS_VALUE
  501. //  124  ADDRESS_LATCH_INTO();
  502. CALL #ADDRESS_LATCH_INTO
  503. //  125 
  504. //  126  ADDRESS_VALUE=0;//COLUMN_ADDRESS_HIGH; //#0X00
  505. MOV.B #0x0, &ADDRESS_VALUE
  506. //  127  ADDRESS_LATCH_INTO();
  507. CALL #ADDRESS_LATCH_INTO
  508. //  128 
  509. //  129  ADDRESS_VALUE= gwPageAddress & 0xff; //#0X00
  510. MOV.B &gwPageAddress, &ADDRESS_VALUE
  511. //  130  ADDRESS_LATCH_INTO();
  512. CALL #ADDRESS_LATCH_INTO
  513. //  131 
  514. //  132  ADDRESS_VALUE=(gwPageAddress>>8) & 0xff; //#0X00
  515. MOV.W &gwPageAddress, R14
  516. SWPB R14
  517. AND.W #0xff, R14
  518. MOV.B R14, &ADDRESS_VALUE
  519. //  133  ADDRESS_LATCH_INTO();
  520. CALL #ADDRESS_LATCH_INTO
  521. //  134 
  522. //  135  FLASH_CON_PORT_OUT &=~ ALE;
  523. BIC.B #0x2, &0x29
  524. //  136 
  525. //  137  COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
  526. MOV.B #0x10, &COMMAND_VAL
  527. //  138  COMMAND_LATCH_INTO();
  528. CALL #COMMAND_LATCH_INTO
  529. //  139 
  530. //  140  READ_STATUS();
  531. CALL #READ_STATUS
  532. //  141  ucFlashSttsOverflowCnt=0;
  533. MOV.B #0x0, R5
  534. //  142  if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
  535. CMP.B #0x1, &FLASH_STATUS
  536. JNE ??FaxRxBufRawdata2Flash_21
  537. ADD.B #0x1, R5
  538. //  143  {
  539. //  144  ;
  540. //  145  }
  541. //  146                 gwPageAddress++;
  542. ??FaxRxBufRawdata2Flash_21:
  543. ADD.W #0x1, &gwPageAddress
  544. //  147                 if (gwPageAddress==0) gwPageAddress+=cstFaxContentStartPage;
  545. CMP.W #0x0, &gwPageAddress
  546. JNE ??FaxRxBufRawdata2Flash_8
  547. ADD.W #0x1400, &gwPageAddress
  548. //  148              do{
  549. //  149               wNextPageAddress=gwPageAddress+64;
  550. ??FaxRxBufRawdata2Flash_8:
  551. MOV.W #0x40, R14
  552. ADD.W &gwPageAddress, R14
  553. MOV.W R14, R4
  554. //  150               gwPageAddress=CalNextPageAddress(gwPageAddress);
  555. MOV.W &gwPageAddress, R12
  556. CALL #CalNextPageAddress
  557. MOV.W R12, &gwPageAddress
  558. //  151               }while(wNextPageAddress==gwPageAddress);
  559. CMP.W &gwPageAddress, R4
  560. JEQ ??FaxRxBufRawdata2Flash_8
  561. //  152             if (gwPageAddress%64==0)
  562. MOV.W &gwPageAddress, R12
  563. MOV.W #0x40, R14
  564. CALL #?DivMod16u
  565. CMP.W #0x0, R14
  566. JNE ??FaxRxBufRawdata2Flash_22
  567. //  153                {
  568. //  154                   ROW_ADDRESS_LOW=gwPageAddress & 0XFF;
  569. MOV.B &gwPageAddress, &ROW_ADDRESS_LOW
  570. //  155                   ROW_ADDRESS_HIGH=(gwPageAddress>>8) & 0XFF; 
  571. MOV.W &gwPageAddress, R14
  572. SWPB R14
  573. AND.W #0xff, R14
  574. MOV.B R14, &ROW_ADDRESS_HIGH
  575. //  156                   ERASE_ONE_BLOCK();
  576. CALL #ERASE_ONE_BLOCK
  577. //  157                }
  578. //  158         //if ((aucUartRxBuf[ucRxIndex] == 0xfb && aucUartRxBuf[ucRxIndex-1] == 0x13 
  579. //  159       //&& aucUartRxBuf[ucRxIndex-2] == 0xff))// || (wRxQueueFrontCnt>gwRxQueueFrontCnt))
  580. //  160          //break;
  581. //  161         }//write 1344 pages over        
  582. ??FaxRxBufRawdata2Flash_22:
  583. ADD.W #0x1, R6
  584. JMP ??FaxRxBufRawdata2Flash_9
  585. //  162               
  586. //  163       /*******************************************      
  587. //  164 Write New Fax Rear Pointer
  588. //  165       if (FaxRearPointerTableFull)
  589. //  166        {erase next block in fax rear pointer table}
  590. //  167       else
  591. //  168        write one Fax content
  592. //  169 *******************************************/
  593. //  170       if ((gwGeneralPageAddress>>6) > cstFaxRearPointerTableOverBlockNum)
  594. ??FaxRxBufRawdata2Flash_20:
  595. MOV.W &gwGeneralPageAddress, R12
  596. CALL #?ShiftRight16u_6
  597. CMP.W #0x13, R12
  598. JNC ??FaxRxBufRawdata2Flash_23
  599. //  171        {
  600. //  172          for (ucBlockCnt=0;ucBlockCnt<4;ucBlockCnt++)
  601. MOV.B #0x0, R9
  602. ??FaxRxBufRawdata2Flash_10:
  603. CMP.B #0x4, R9
  604. JC ??FaxRxBufRawdata2Flash_24
  605. //  173          {
  606. //  174                  wPageAddress=(cstFaxRearPointerTableStartBlockNum+ucBlockCnt)<<6;
  607. MOV.B R9, R12
  608. AND.W #0xff, R12
  609. ADD.W #0xf, R12
  610. CALL #?ShiftLeft16_6
  611. MOV.W R12, R8
  612. //  175            ROW_ADDRESS_LOW=wPageAddress & 0XFF;
  613. MOV.B R8, &ROW_ADDRESS_LOW
  614. //  176            ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF; 
  615. MOV.W R8, R14
  616. SWPB R14
  617. AND.W #0xff, R14
  618. MOV.B R14, &ROW_ADDRESS_HIGH
  619. //  177            ERASE_ONE_BLOCK();
  620. CALL #ERASE_ONE_BLOCK
  621. //  178          }
  622. ADD.B #0x1, R9
  623. JMP ??FaxRxBufRawdata2Flash_10
  624. //  179          gwGeneralPageAddress=cstFaxRearPointerTableStartPage;
  625. ??FaxRxBufRawdata2Flash_24:
  626. MOV.W #0x3c0, &gwGeneralPageAddress
  627. //  180          gwColumnAddress=0;
  628. MOV.W #0x0, &gwColumnAddress
  629. //  181          
  630. //  182        }
  631. //  183       ucRxIndex=0; //write Fax Rear Pointer
  632. ??FaxRxBufRawdata2Flash_23:
  633. MOV.B #0x0, R11
  634. //  184       gwPageAddress--; // get Rear Pointer
  635. ADD.W #0xffff, &gwPageAddress
  636. //  185       aucUartRxBuf[ucRxIndex++]=gwPageAddress & 0xff;
  637. MOV.B R11, R14
  638. AND.W #0xff, R14
  639. MOV.B &gwPageAddress, aucUartRxBuf(R14)
  640. ADD.B #0x1, R11
  641. //  186       aucUartRxBuf[ucRxIndex++]=(gwPageAddress>>8) & 0xff;
  642. MOV.B R11, R14
  643. AND.W #0xff, R14
  644. MOV.W &gwPageAddress, R15
  645. SWPB R15
  646. AND.W #0xff, R15
  647. MOV.B R15, aucUartRxBuf(R14)
  648. ADD.B #0x1, R11
  649. //  187       for(ucGeneralCnt=0;ucGeneralCnt<14;ucGeneralCnt++)
  650. MOV.B #0x0, R10
  651. ??FaxRxBufRawdata2Flash_11:
  652. CMP.B #0xe, R10
  653. JC ??FaxRxBufRawdata2Flash_25
  654. //  188       {
  655. //  189          aucUartRxBuf[ucRxIndex++] = 0x55;
  656. MOV.B R11, R14
  657. AND.W #0xff, R14
  658. MOV.B #0x55, aucUartRxBuf(R14)
  659. ADD.B #0x1, R11
  660. //  190       }
  661. ADD.B #0x1, R10
  662. JMP ??FaxRxBufRawdata2Flash_11
  663. //  191         
  664. //  192       //WriteFaxRearPointerTable();
  665. //  193       Write16Bytes2FlashMemoryArea();
  666. ??FaxRxBufRawdata2Flash_25:
  667. CALL #Write16Bytes2FlashMemoryArea
  668. //  194 /*******************************************      
  669. //  195 Write Fax Property Table
  670. //  196       if (Fax Property Table Full)
  671. //  197        {erase next block in Fax Property Table}
  672. //  198       else
  673. //  199        write one Fax Property
  674. //  200 *******************************************/
  675. //  201       ReadLastFaxProperty();
  676. MOV.B #0xa, R14
  677. MOV.B #0x1, R12
  678. CALL #ReadLast16BytesFromFlashMemoryArea
  679. //  202       //ReadLast16BytesFromFlashMemoryArea(cstFaxPropertyTableStartBlockNum, cstFaxPropertyTableOverBlockNum);
  680. //  203       if ((gwGeneralPageAddress>>6) > cstFaxPropertyTableOverBlockNum)//>=cstFaxPropertyTableOverBlockNum)
  681. MOV.W &gwGeneralPageAddress, R12
  682. CALL #?ShiftRight16u_6
  683. CMP.W #0xb, R12
  684. JNC ??FaxRxBufRawdata2Flash_26
  685. //  204        {
  686. //  205        for (ucBlockCnt=0;ucBlockCnt<10;ucBlockCnt++)
  687. MOV.B #0x0, R9
  688. ??FaxRxBufRawdata2Flash_12:
  689. CMP.B #0xa, R9
  690. JC ??FaxRxBufRawdata2Flash_27
  691. //  206          {
  692. //  207            wPageAddress=(cstFaxPropertyTableStartBlockNum+ucBlockCnt)<<6;
  693. MOV.B R9, R12
  694. AND.W #0xff, R12
  695. ADD.W #0x1, R12
  696. CALL #?ShiftLeft16_6
  697. MOV.W R12, R8
  698. //  208            ROW_ADDRESS_LOW=wPageAddress & 0XFF;
  699. MOV.B R8, &ROW_ADDRESS_LOW
  700. //  209            ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF; 
  701. MOV.W R8, R14
  702. SWPB R14
  703. AND.W #0xff, R14
  704. MOV.B R14, &ROW_ADDRESS_HIGH
  705. //  210            ERASE_ONE_BLOCK();
  706. CALL #ERASE_ONE_BLOCK
  707. //  211          }
  708. ADD.B #0x1, R9
  709. JMP ??FaxRxBufRawdata2Flash_12
  710. //  212          gwGeneralPageAddress=cstFaxPropertyTableStartPage;
  711. ??FaxRxBufRawdata2Flash_27:
  712. MOV.W #0x40, &gwGeneralPageAddress
  713. //  213          gwColumnAddress=0;
  714. MOV.W #0x0, &gwColumnAddress
  715. //  214        }
  716. //  215       
  717. //  216       ucRxIndex=0; //write Fax Property
  718. ??FaxRxBufRawdata2Flash_26:
  719. MOV.B #0x0, R11
  720. //  217       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewSecondIndex];// //second
  721. MOV.B R11, R14
  722. AND.W #0xff, R14
  723. MOV.B &aucViewData + 0x2, aucUartRxBuf(R14)
  724. ADD.B #0x1, R11
  725. //  218       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMinuteIndex];//  //minute
  726. MOV.B R11, R14
  727. AND.W #0xff, R14
  728. MOV.B &aucViewData + 0x1, aucUartRxBuf(R14)
  729. ADD.B #0x1, R11
  730. //  219       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewHourIndex];//hour
  731. MOV.B R11, R14
  732. AND.W #0xff, R14
  733. MOV.B &aucViewData, aucUartRxBuf(R14)
  734. ADD.B #0x1, R11
  735. //  220       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewDateIndex];//date
  736. MOV.B R11, R14
  737. AND.W #0xff, R14
  738. MOV.B &aucViewData + 0x4, aucUartRxBuf(R14)
  739. ADD.B #0x1, R11
  740. //  221       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewMonthIndex];//month
  741. MOV.B R11, R14
  742. AND.W #0xff, R14
  743. MOV.B &aucViewData + 0x3, aucUartRxBuf(R14)
  744. ADD.B #0x1, R11
  745. //  222       aucUartRxBuf[ucRxIndex++] = aucViewData[cstViewYearIndex];//Year
  746. MOV.B R11, R14
  747. AND.W #0xff, R14
  748. MOV.B &aucViewData + 0x5, aucUartRxBuf(R14)
  749. ADD.B #0x1, R11
  750. //  223       aucUartRxBuf[ucRxIndex++] = wEveryFaxHead & 0xff;
  751. MOV.B R11, R14
  752. AND.W #0xff, R14
  753. MOV.B R7, aucUartRxBuf(R14)
  754. ADD.B #0x1, R11
  755. //  224       aucUartRxBuf[ucRxIndex++] = (wEveryFaxHead>>8) & 0xff;
  756. MOV.B R11, R15
  757. AND.W #0xff, R15
  758. MOV.W R7, R14
  759. SWPB R14
  760. AND.W #0xff, R14
  761. MOV.B R14, aucUartRxBuf(R15)
  762. ADD.B #0x1, R11
  763. //  225       aucUartRxBuf[ucRxIndex++] = gwPageAddress & 0xff;
  764. MOV.B R11, R14
  765. AND.W #0xff, R14
  766. MOV.B &gwPageAddress, aucUartRxBuf(R14)
  767. ADD.B #0x1, R11
  768. //  226       aucUartRxBuf[ucRxIndex++] = (gwPageAddress>>8) & 0xff;
  769. MOV.B R11, R14
  770. AND.W #0xff, R14
  771. MOV.W &gwPageAddress, R15
  772. SWPB R15
  773. AND.W #0xff, R15
  774. MOV.B R15, aucUartRxBuf(R14)
  775. ADD.B #0x1, R11
  776. //  227       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt & 0xff);
  777. MOV.B R11, R14
  778. AND.W #0xff, R14
  779. MOV.B &gdwRxQueueFrontCnt, aucUartRxBuf(R14)
  780. ADD.B #0x1, R11
  781. //  228       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt >> 8) & 0xff;
  782. MOV.B R11, R14
  783. AND.W #0xff, R14
  784. MOV.W &gdwRxQueueFrontCnt, R15
  785. SWPB R15
  786. AND.W #0xff, R15
  787. MOV.B R15, aucUartRxBuf(R14)
  788. ADD.B #0x1, R11
  789. //  229       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>16) & 0xff;
  790. MOV.B R11, R14
  791. AND.W #0xff, R14
  792. MOV.B &gdwRxQueueFrontCnt + 0x2, aucUartRxBuf(R14)
  793. ADD.B #0x1, R11
  794. //  230       aucUartRxBuf[ucRxIndex++] = (gdwRxQueueFrontCnt>>24) & 0xff;
  795. MOV.B R11, R12
  796. AND.W #0xff, R12
  797. MOV.W &gdwRxQueueFrontCnt, R14
  798. MOV.W &gdwRxQueueFrontCnt + 0x2, R15
  799. SWPB R15
  800. MOV.B R15, R14
  801. MOV.W #0x0, R15
  802. MOV.B R14, aucUartRxBuf(R12)
  803. ADD.B #0x1, R11
  804. //  231 
  805. //  232       aucUartRxBuf[ucRxIndex++]=0x55;
  806. MOV.B R11, R14
  807. AND.W #0xff, R14
  808. MOV.B #0x55, aucUartRxBuf(R14)
  809. ADD.B #0x1, R11
  810. //  233       aucUartRxBuf[ucRxIndex++]=0x55;                              //15
  811. MOV.B R11, R14
  812. AND.W #0xff, R14
  813. MOV.B #0x55, aucUartRxBuf(R14)
  814. ADD.B #0x1, R11
  815. //  234       //WriteFaxPropertyTable();
  816. //  235       Write16Bytes2FlashMemoryArea();             
  817. CALL #Write16Bytes2FlashMemoryArea
  818. //  236 }//FaxRXProcess
  819. ADD.W #0x2, SP
  820.         CFI CFA SP+18
  821. BR #?Epilogue8
  822.         CFI EndBlock cfiBlock0
  823.         RSEG CODE:CODE:NOROOT(1)
  824. ?setjmp_save_r4:
  825. REQUIRE ?setjmp_r4
  826. REQUIRE ?longjmp_r4
  827.         RSEG CODE:CODE:NOROOT(1)
  828. ?setjmp_save_r5:
  829. REQUIRE ?setjmp_r5
  830. REQUIRE ?longjmp_r5
  831.         END
  832. //  237 
  833. // 
  834. // 1 278 bytes in segment CODE
  835. //     2 bytes in segment DATA16_AN
  836. // 
  837. // 1 278 bytes of CODE memory
  838. //     0 bytes of DATA memory (+ 2 bytes shared)
  839. //
  840. //Errors: none
  841. //Warnings: none