btiger2000您说的id是什么呢?
我将详细的相关程序贴在下面
;reset nand > ldr r1,=0x4E000000 ;NFCONF > ldr r2,=0xf830 ;TWRPH0=3,TACLS=0,NAND CHIP INACTIVE,INITIALIZE ECC > str r2,[r1] > ldr r2,[r1] > bic r2,r2,#0x800 ;NAND CHIP ACTIVE,ENABLE NAND FLASH CONTROLER > str r2,[r1] > mov r2,#0xff > strb r2,[r1,#0x04] ;NFCMD > mov r3,#0 >1 add r3,r3,#0x1 > cmp r3,#0xa > blt %b1 >2 ldr r2,[r1,#0x10] ;NFSTAT > TST r2,#0X1 > beq %b2 > ldr r2,[r1] > orr r2,r2,#0x800 ;disable chip > str r2,[r1] > > > ldr sp,=0x33df6ffb ;DW_STACK_START ****** setup stack pionter > mov fp,#0 > > ldr r0,=0x33f00000 ;VIVI_RAM_BASE > mov r1,#0x0 > mov r2,#0x20000 ;要拷贝128k >;******************************************************************************* > > > bl nand_read_ll ;nand_read_ll函数将nand的从0地址处开始的128k的内 > > >容读到 ram的指定处 下面是nand_read_ll函数:
#define NFCONF (*(volatile unsigned char *)0x4e000000) >#define NFCMD (*(volatile unsigned char *)0x4e000004) >#define NFADDR (*(volatile unsigned char *)0x4e000008) >#define NFDATA (*(volatile unsigned char *)0x4e00000c) >#define NFSTAT (*(volatile unsigned char *)0x4e000010) >#define BUSY 1 > void wait_idle(void) { > int i; > > while(!(NFSTAT & BUSY)) > for(i=0; i<10; i++); >} > >#define NAND_SECTOR_SIZE 512 >#define NAND_BLOCK_MASK (NAND_SECTOR_SIZE - 1) > >/* low level nand read function */ >int nand_read_ll(unsigned int *buf, unsigned long start_addr, int size) >{ //(0x33f00000,#0x0,#0x20000) > int i, j; > > if ((start_addr & NAND_BLOCK_MASK) || (size & NAND_BLOCK_MASK)) > { > return -1; /* invalid alignment */ > } > > /* chip Enable */ > NFCONF &= ~0x800; > for(i=0; i<10; i++); > > for(i=start_addr; i < (start_addr + size);) { > /* READ0 */ > NFCMD = 0; > > /* Write Address */ > NFADDR = i & 0xff; > NFADDR = (i >> 9) & 0xff; > NFADDR = (i >> 17) & 0xff; > NFADDR = (i >> 25) & 0xff; > > wait_idle(); > > for(j=0; j < NAND_SECTOR_SIZE; j++, i++) { > *buf = (NFDATA & 0xff); > buf++; > } > } > > /* chip Disable */ > NFCONF |= 0x800; /* chip disable */ > > return 0; > >} |