ViewData2Flash.lst
上传用户:xhjmsc
上传日期:2019-09-13
资源大小:389k
文件大小:9k
- ##############################################################################
- # #
- # IAR MSP430 C/EC++ Compiler V2.10A/W32 12/Apr/2007 16:54:38 #
- # 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_070412 #
- # filesViewData2Flash.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_070412 #
- # DebugList -lA E:projectFaxProgramVson_Bryan_Fax_ #
- # Conexant_070412DebugList -o #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
- # DebugObj -z2 --no_cse --no_unroll --no_inline #
- # --no_code_motion --debug -e #
- # E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
- # filesViewData2Flash.c #
- # List file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
- # DebugListViewData2Flash.lst #
- # Object file = E:projectFaxProgramVson_Bryan_Fax_Conexant_070412 #
- # DebugObjViewData2Flash.r43 #
- # #
- # #
- ##############################################################################
- E:projectFaxProgramVson_Bryan_Fax_Conexant_070412filesViewData2Flash.c
- 1 /***************************************
- 2 Program: View Data access into Flash
- 3 Author: Bryan Cai
- 4 Date: 2007.04.11
- 5 ***************************************/
- 6
- 7 #include "includeH.h"
- 8
- 9 void WriteViewData(void)
- 10 {
- 11
- 12 unsigned char ucFlashSttsOverflowCnt=0,ucFaxPropertyLenCnt=0,
- 13 ucRxIndex=0;
- 14
- 15 COMMAND_VAL=cFlashWriteCmd;
- 16 COMMAND_LATCH_INTO();
- 17 //ADDRESS
- 18
- 19 ADDRESS_VALUE=gwColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
- 20 ADDRESS_LATCH_INTO();
- 21
- 22 ADDRESS_VALUE=(gwColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
- 23 ADDRESS_LATCH_INTO();
- 24
- 25 ADDRESS_VALUE=gwFaxPropertyAddress & 0xff;//gwFaxPropertyAddress is equal gwFaxRearPointerAddress
- 26 ADDRESS_LATCH_INTO();
- 27
- 28 ADDRESS_VALUE=(gwFaxPropertyAddress>>8) & 0XFF;
- 29 ADDRESS_LATCH_INTO();
- 30 FLASH_CON_PORT_OUT &=~ ALE;
- 31
- 32 DATA_PORT_OUT_INITIAL;
- 33 for (ucFaxPropertyLenCnt=0;ucFaxPropertyLenCnt<8;ucFaxPropertyLenCnt++)
- 34 {
- 35 FLASH_CON_PORT_OUT&=~WE;
- 36 DATA_PORT_OUT=aucUartRxBuf[ucRxIndex++];
- 37 FLASH_CON_PORT_OUT |= WE;
- 38 }
- 39
- 40 COMMAND_VAL=cFlashWriteInitiateCmd; //10H INITIATES PROGRAM
- 41 COMMAND_LATCH_INTO();
- 42
- 43 READ_STATUS();
- 44 ucFlashSttsOverflowCnt=0;
- 45 if(FLASH_STATUS==1&&(ucFlashSttsOverflowCnt++)<2)
- 46 {;}
- 47 }
- 48 void ReadLastViewData(void)//find last fax property recorder
- 49 {
- 50 unsigned int wPageAddress=0, wBlockAddress=0,
- 51 wColumnAddress=0,wNextPageAddress=0,
- 52 wRearPntCnt=0;
- 53 unsigned char ucRxIndex=0,
- 54 ucGeneralCnt=0,ucFaxPropertyLenCnt,
- 55 ucRxIndex3=0,ucRxIndex2=0,
- 56 ucRxIndex0=0,ucRxIndex1=0;
- 57
- 58
- 59 for (wBlockAddress=cstViewDataAreaStartPage;
- 60 wBlockAddress<=cstViewDataAreaEndPage;wBlockAddress++)
- 61 {
- 62
- 63 for (wPageAddress=(wBlockAddress<<6);wPageAddress<((wBlockAddress<<6)+64);wPageAddress++)
- 64 {
- 65 do{
- 66 wNextPageAddress=wPageAddress+64;
- 67 wPageAddress=CalNextPageAddress(wPageAddress);
- 68 }while(wNextPageAddress==wPageAddress);
- 69
- 70 wColumnAddress=0;
- 71 ROW_ADDRESS_LOW=wPageAddress & 0XFF;
- 72 ROW_ADDRESS_HIGH=(wPageAddress>>8) & 0XFF;
- 73
- 74 for (ucGeneralCnt=0;ucGeneralCnt<8;ucGeneralCnt++)
- 75 {
- 76 //COMMAND
- 77 COMMAND_VAL=0x00; //#0X00 //00H READ1 0-2111BYTE
- 78 COMMAND_LATCH_INTO();
- 79 //ADDRESS
- 80
- 81 ADDRESS_VALUE=wColumnAddress & 0xff;//COLUMN_ADDRESS_LOW;
- 82 ADDRESS_LATCH_INTO();
- 83
- 84 ADDRESS_VALUE=(wColumnAddress>>8) & 0XFF;//COLUMN_ADDRESS_HIGH;
- 85 ADDRESS_LATCH_INTO();
- 86
- 87 ADDRESS_VALUE=ROW_ADDRESS_LOW;
- 88 ADDRESS_LATCH_INTO();
- 89
- 90 ADDRESS_VALUE=ROW_ADDRESS_HIGH;
- 91 ADDRESS_LATCH_INTO();
- 92 FLASH_CON_PORT_OUT &=~ ALE;
- 93
- 94 COMMAND_VAL=0X30;
- 95 COMMAND_LATCH_INTO();
- 96 //ATcmdDelay();
- 97 while((FLASH_CON_PORT_IN & RB)==0);
- 98 DATA_PORT_IN_INITIAL;
- 99 for (ucFaxPropertyLenCnt=0;ucFaxPropertyLenCnt<8;ucFaxPropertyLenCnt++)
- 100 {
- 101 FLASH_CON_PORT_OUT &=~ RE; //RE IS LOW,ENABLE READ DATA
- 102 aucUartRxBuf[ucRxIndex++]=DATA_PORT_IN;
- 103 FLASH_CON_PORT_OUT |= RE;
- 104 }
- 105 wRearPntCnt++;
- 106 ucRxIndex3=ucRxIndex-4;
- 107 ucRxIndex2=ucRxIndex-3;
- 108 ucRxIndex1=ucRxIndex-2;
- 109 ucRxIndex0=ucRxIndex-1;
- 110 if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
- 111 0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
- 112 {
- 113 break; //next rear
- 114 }//if
- 115 if (ucGeneralCnt<4)
- 116 wColumnAddress+=512;
- 117 else
- 118 wColumnAddress+=16;
- 119 }//for read next rear pointer
- 120
- 121 //ucRxIndex3=gucUartRxCnt-4;
- 122 //ucRxIndex2=gucUartRxCnt-3;
- 123 //ucRxIndex1=gucUartRxCnt-2;
- 124 //ucRxIndex0=gucUartRxCnt-1;
- 125 if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
- 126 0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
- 127 {break;}
- 128 }//for next page
- 129
- 130 //ucRxIndex3=gucUartRxCnt-4;
- 131 //ucRxIndex2=gucUartRxCnt-3;
- 132 //ucRxIndex1=gucUartRxCnt-2;
- 133 //ucRxIndex0=gucUartRxCnt-1;
- 134 if (0xff == aucUartRxBuf[ucRxIndex0] && 0xff == aucUartRxBuf[ucRxIndex1] &&
- 135 0xff == aucUartRxBuf[ucRxIndex2] && 0xff == aucUartRxBuf[ucRxIndex3])
- 136 {break;}
- 137 }//for next block
- 138 gwFaxPropertyAddress=wPageAddress; //for write Fax property record //gwFaxPropertyAddress is equal gwFaxRearPointerAddress
- 139 gwColumnAddress=wColumnAddress; //
- 140 }
- Errors: 6
- Warnings: none