⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 btflash.c

📁 strongarm的bootloader
💻 C
📖 第 1 页 / 共 3 页
字号:
/****************************************************************************//* Copyright 2000 Compaq Computer Corporation.                              *//*                                           .                              *//* Copying or modifying this code for any purpose is permitted,             *//* provided that this copyright notice is preserved in its entirety         *//* in all copies or modifications.  COMPAQ COMPUTER CORPORATION             *//* MAKES NO WARRANTIES, EXPRESSED OR IMPLIED, AS TO THE USEFULNESS          *//* OR CORRECTNESS OF THIS CODE OR ITS FITNESS FOR ANY PARTICULAR            *//* PURPOSE.                                                                 *//****************************************************************************//* * btflash.c - Flash erase and program routines for Compaq Personal Server Monitor * */#include "btflash.h"#define FLASH_TIMEOUT 20000000int btflash_verbose = 0;/* default to physical address, update this variable when MMU gets changed */volatile unsigned long *flashword = (volatile unsigned long*)FLASH_BASE;#define doubleword(w_) ((((w_)&0xFFFF) << 16)|((w_)&0xFFFF))#ifdef CONFIG_AMD_FLASHstatic unsigned long flashSectors_Am29LV160BB[] = {  0x00000000, /* first sector of bootldr */  0x00008000, /* last sector of bootldr */  0x0000c000, /* param sector */  0x00010000, /* kernel starts here */  0x00020000,  0x00040000,  0x00060000,  0x00080000,  0x000A0000,  0x000C0000,  0x000E0000,  0x00100000,  0x00120000,  0x00140000,  0x00160000,  0x00180000,  0x001A0000,  0x001C0000,  0x001E0000,  0x00200000,  0x00220000,  0x00240000,  0x00260000,  0x00280000,  0x002A0000,  0x002C0000,  0x002E0000,  0x00300000, /* user code starts here */  0x00320000,  0x00340000,  0x00360000,  0x00380000,  0x003A0000,  0x003C0000,  0x003E0000,  0x00400000 /* guard sector -- not in flash */};static int amdFlashReset(void);static int amdFlashProgramWord(unsigned long flashAddress, unsigned long value);static int amdFlashProgramBlock(unsigned long flashAddress, unsigned long *values, int nbytes);static int amdFlashEraseChip(void);static int amdFlashEraseSector(unsigned long sectorAddress);static int amdFlashEraseRange(unsigned long start, unsigned long len);static int amdFlashProtectRange(unsigned long start, unsigned long len, int protect);static FlashAlgorithm amdFlashAlgorithm = {   amdFlashReset,   amdFlashProgramWord,   amdFlashProgramBlock,   amdFlashEraseChip,   amdFlashEraseSector,   amdFlashEraseRange,   amdFlashProtectRange};static struct FlashDescriptor flashDescriptor_Am29LV160BB = {   "Am29LV160BB",   1, 0x2249,    &amdFlashAlgorithm,   sizeof(flashSectors_Am29LV160BB)/sizeof(dword) - 1, flashSectors_Am29LV160BB,   { "bootldr",   0x00000000, 0x0000c000, LFR_PATCH_BOOTLDR },   { "params",    0x0000c000, 0x00004000, 0 },   { "kernel",    0x00010000, 0x00200000, LFR_KERNEL },   { "ramdisk",   0x00100000, 0x00300000, LFR_SIZE_PREFIX },   { "usercode",  0x00300000, 0x00100000, LFR_SIZE_PREFIX },   { "altkernel", 0x00300000, 0x00100000, LFR_KERNEL }};#endif /* CONFIG_AMD_FLASH */#ifdef CONFIG_AMD_FLASHstatic unsigned long flashSectors_Am29DL323CT[] = {    0x00000000,    0x00020000,    0x00040000,    0x00060000,    0x00080000,    0x000a0000,    0x000c0000,    0x000e0000,    0x00100000,    0x00120000,    0x00140000,    0x00160000,    0x00180000,    0x001a0000,    0x001c0000,    0x001e0000,    0x00200000,    0x00220000,    0x00240000,    0x00260000,    0x00280000,    0x002a0000,    0x002c0000,    0x002e0000,    0x00300000,    0x00320000,    0x00340000,    0x00360000,    0x00380000,    0x003a0000,    0x003c0000,    0x003e0000,    0x00400000,    0x00420000,    0x00440000,    0x00460000,    0x00480000,    0x004a0000,    0x004c0000,    0x004e0000,    0x00500000,    0x00520000,    0x00540000,    0x00560000,    0x00580000,    0x005a0000,    0x005c0000,    0x005e0000,    0x00600000,    0x00620000,    0x00640000,    0x00660000,    0x00680000,    0x006a0000,    0x006c0000,    0x006e0000,    0x00700000,    0x00720000,    0x00740000,    0x00760000,    0x00780000,    0x007a0000,    0x007c0000,    0x007e0000,    0x007e4000,    0x007e8000,    0x007ec000,    0x007f0000,    0x007f4000,    0x007f8000,    0x007fc000,    0x00800000 /* guard entry */};static struct FlashDescriptor flashDescriptor_Am29DL323CT =  {   "Am29DL323CT",    1, 0x2250,    &amdFlashAlgorithm,   sizeof(flashSectors_Am29DL323CT)/sizeof(dword) - 1, flashSectors_Am29DL323CT,   { "bootldr",   0x00000000, 0x00020000, LFR_PATCH_BOOTLDR },   { "params",    0x007f4000, 0x00004000, 0 },   { "kernel",    0x00020000, 0x000e0000, LFR_KERNEL },   { "ramdisk",   0x00100000, 0x00300000, LFR_SIZE_PREFIX },   { "usercode",  0x00100000, 0x00600000, 0 }, /* overlaps ramdisk */   { "altkernel", 0x00700000, 0x000f0000, LFR_KERNEL },   { "debugger",  0x00800000, 0x00000000, LFR_KERNEL }};static unsigned long flashSectors_Am29DL323CB[] = {    0x00000000,    0x00020000,    0x00040000,    0x00060000,    0x00080000,    0x000a0000,    0x000c0000,    0x000e0000,    0x00100000,    0x00120000,    0x00140000,    0x00160000,    0x00180000,    0x001a0000,    0x001c0000,    0x001e0000,    0x00200000,    0x00220000,    0x00240000,    0x00260000,    0x00280000,    0x002a0000,    0x002c0000,    0x002e0000,    0x00300000,    0x00320000,    0x00340000,    0x00360000,    0x00380000,    0x003a0000,    0x003c0000,    0x003e0000,    0x00400000,    0x00420000,    0x00440000,    0x00460000,    0x00480000,    0x004a0000,    0x004c0000,    0x004e0000,    0x00500000,    0x00520000,    0x00540000,    0x00560000,    0x00580000,    0x005a0000,    0x005c0000,    0x005e0000,    0x00600000,    0x00620000,    0x00640000,    0x00660000,    0x00680000,    0x006a0000,    0x006c0000,    0x006e0000,    0x00700000,    0x00720000,    0x00740000,    0x00760000,    0x00780000,    0x007a0000,    0x007c0000,    0x007e0000,    0x00800000 /* guard entry */};static struct FlashDescriptor flashDescriptor_Am29DL323CB=  {   "Am29DL323CB",    1, 0x2250,    &amdFlashAlgorithm,   sizeof(flashSectors_Am29DL323CB)/sizeof(dword) - 1, flashSectors_Am29DL323CB,   { "bootldr",   0x00000000, 0x00020000, LFR_PATCH_BOOTLDR },   { "params",    0x007e0000, 0x00004000, 0 },   { "kernel",    0x00020000, 0x000e0000, LFR_KERNEL },   { "ramdisk",   0x00100000, 0x00400000, LFR_SIZE_PREFIX },   { "usercode",  0x00100000, 0x00080000, 0 }, /* overlaps ramdisk */   { "altkernel", 0x00600000, 0x00200000, LFR_KERNEL },   { "debugger",  0x00700000, 0x00080000, LFR_KERNEL }};#endif /* CONFIG_AMD_FLASH */#ifdef CONFIG_INTEL_FLASHstatic unsigned long flashSectors_28F128J3A[] = {  0x00000000,   0x00040000,   0x00080000,   0x000c0000,   0x00100000,   0x00140000,   0x00180000,   0x001c0000,   0x00200000,   0x00240000,   0x00280000,   0x002c0000,   0x00300000,   0x00340000,   0x00380000,   0x003c0000,   0x00400000,   0x00440000,   0x00480000,   0x004c0000,   0x00500000,   0x00540000,   0x00580000,   0x005c0000,   0x00600000,   0x00640000,   0x00680000,   0x006c0000,   0x00700000,   0x00740000,   0x00780000,   0x007c0000,   0x00800000,   0x00840000,   0x00880000,   0x008c0000,   0x00900000,   0x00940000,   0x00980000,   0x009c0000,   0x00a00000,   0x00a40000,   0x00a80000,   0x00ac0000,   0x00b00000,   0x00b40000,   0x00b80000,   0x00bc0000,   0x00c00000,   0x00c40000,   0x00c80000,   0x00cc0000,   0x00d00000,   0x00d40000,   0x00d80000,   0x00dc0000,   0x00e00000,   0x00e40000,   0x00e80000,   0x00ec0000,   0x00f00000,   0x00f40000,   0x00f80000,   0x00fc0000,   0x01000000,   0x01040000,   0x01080000,   0x010c0000,   0x01100000,   0x01140000,   0x01180000,   0x011c0000,   0x01200000,   0x01240000,   0x01280000,   0x012c0000,   0x01300000,   0x01340000,   0x01380000,   0x013c0000,   0x01400000,   0x01440000,   0x01480000,   0x014c0000,   0x01500000,   0x01540000,   0x01580000,   0x015c0000,   0x01600000,   0x01640000,   0x01680000,   0x016c0000,   0x01700000,   0x01740000,   0x01780000,   0x017c0000,   0x01800000,   0x01840000,   0x01880000,   0x018c0000,   0x01900000,   0x01940000,   0x01980000,   0x019c0000,   0x01a00000,   0x01a40000,   0x01a80000,   0x01ac0000,   0x01b00000,   0x01b40000,   0x01b80000,   0x01bc0000,   0x01c00000,   0x01c40000,   0x01c80000,   0x01cc0000,   0x01d00000,   0x01d40000,   0x01d80000,   0x01dc0000,   0x01e00000,   0x01e40000, 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -