REVISION
Definition in file btldr.h.
#include "../feature.h"
#include "../fat/fat.h"
Include dependency graph for btldr.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.
Functions | |
| BOOL | BTLDR_backup (unsigned long pAddr) |
| Function backs up bootloader into NAND flash. | |
|
|
Function backs up bootloader into NAND flash.
Definition at line 60 of file BTLDR_backup.c. Referenced by FAT__format(). 00061 {
00062 struct stParamHeader * pstPHeaderReader;
00063 BOOL bResult;
00064 unsigned long ulStartSec;
00065 unsigned int unCalcChkSum;
00066 unsigned long ulReadHeaderChksum;
00067
00068 ulStartSec = pAddr;
00069
00070 /* The way the flash chip works, if you write to one param block
00071 * the data in the other is corrupt. Therefore we must see which
00072 * header is valid.
00073 */
00074
00075 /* Start with #2, most of the time the valid one */
00076 asm(" SSBX INTM");
00077 PMST |= 0x0040;
00078
00079 /* Get a copy of the header in FLASH, copy to RAM */
00080 GEN_rdSRAM(HEADER2_ADDR, (unsigned short *)&NandBuffer[0], HEADER_SIZE);
00081 pstPHeaderReader = (struct stParamHeader *)&NandBuffer[0];
00082
00083 PMST &= ~0x0040;
00084 asm(" RSBX INTM");
00085
00086 /* Perform Checksum on Parameter Table */
00087 unCalcChkSum = __calcParamChecksum(pstPHeaderReader);
00088 ulReadHeaderChksum = (NandBuffer[HEADER_CRC] & 0xffff0000) >> 16;
00089
00090 if(unCalcChkSum != ulReadHeaderChksum)
00091 {
00092 asm(" SSBX INTM");
00093 PMST |= 0x0040;
00094
00095 /* Now check other header */
00096 /* Get a copy of the header in FLASH, copy to RAM */
00097 GEN_rdSRAM(HEADER1_ADDR, (unsigned short *)&NandBuffer[0], HEADER_SIZE);
00098 pstPHeaderReader = (struct stParamHeader *)&NandBuffer[0];
00099
00100 PMST &= ~0x0040;
00101 asm(" RSBX INTM");
00102
00103 /* Perform Checksum on Parameter Table */
00104 unCalcChkSum = __calcParamChecksum(pstPHeaderReader);
00105 ulReadHeaderChksum = (NandBuffer[HEADER_CRC] & 0xffff0000) >> 16;
00106
00107 if(unCalcChkSum != ulReadHeaderChksum)
00108 bResult = FALSE;
00109 else
00110 bResult = __copybtldrtonand(pstPHeaderReader, ulStartSec);
00111 }
00112 else
00113 bResult = __copybtldrtonand(pstPHeaderReader, ulStartSec);
00114
00115
00116 return(bResult);
00117 }
|
1.3.9.1