微波EDA网,见证研发工程师的成长!
首页 > 硬件设计 > 嵌入式设计 > 嵌入式Linux开发环境的搭建之:U-Boot移植

嵌入式Linux开发环境的搭建之:U-Boot移植

时间:08-13 来源:3721RD 点击:

{"Samsung KM29N16000",NAND_MFR_SAMSUNG, 0x64, 21, 1, 2, 0x1000, 0},

{"Samsung K9F1208U0M", NAND_MFR_SAMSUNG, 0x76, 26, 0, 3, 0x4000, 0},

{"Samsung unknown 4Mb", NAND_MFR_SAMSUNG, 0x6b, 22, 0, 2, 0x2000, 0},

......

{NULL,}

};

(11)设置Nand Flash环境(common/env_nand.c)

int nand_legacy_rw (struct nand_chip* nand, int cmd,

size_t start, size_t len,

size_t * retlen, u_char * buf);

extern struct nand_chip nand_dev_desc[CFG_MAX_NAND_DEVICE];

extern int nand_legacy_erase(struct nand_chip *nand,

size_t ofs, size_t len, int clean);

/* info for NAND chips, defined in drivers/nand/nand.c */

extern nand_info_t nand_info[CFG_MAX_NAND_DEVICE];

......

#else /* ! CFG_ENV_OFFSET_REDUND */

int saveenv(void)

{

ulong total;

int ret = 0;

puts ("Erasing Nand...");

if (nand_legacy_erase(nand_dev_desc + 0,

CFG_ENV_OFFSET, CFG_ENV_SIZE, 0))

{

return 1;

}

puts ("Writing to Nand... ");

total = CFG_ENV_SIZE;

ret = nand_legacy_rw(nand_dev_desc + 0, 0x00 | 0x02, CFG_ENV_OFFSET,

CFG_ENV_SIZE, &total, (u_char*)env_ptr);

if (ret || total != CFG_ENV_SIZE)

{

return 1;

}

puts ("done\n");

return ret;

......

#else /* ! CFG_ENV_OFFSET_REDUND */

void env_relocate_spec (void)

{

#if !defined(ENV_IS_EMBEDDED)

ulong total;

int ret;

total = CFG_ENV_SIZE;

ret = nand_legacy_rw(nand_dev_desc + 0, 0x01 | 0x02, CFG_ENV_OFFSET,

CFG_ENV_SIZE, &total, (u_char*)env_ptr);

Copyright © 2017-2020 微波EDA网 版权所有

网站地图

Top