fengc234 发表于 2012-7-13 09:23:45

UBOOT中Boot_init.c关于从NAND拷贝代码到SDRAM

在函数int nand_read_ll_lp(unsigned char *buf, unsigned long start_addr, int size)里有这样一段代码
/* Check Bad Block */
if(1){
      int col, page;

      col = i & NAND_BLOCK_MASK_LP;
      page = i / NAND_SECTOR_SIZE_LP;

      write_cmd(0x00);

      *p = 5;
      for(j=0; j<10; j++);
      *p = 8;
      for(j=0; j<10; j++);
      *p = page & 0xff;      /* Row Address A12~A19 */
      for(j=0; j<10; j++);
      *p = (page >> 8) & 0xff;      /* Row Address A20~A27 */
      for(j=0; j<10; j++);
if (b128MB == 0)
      *p = (page >> 16) & 0x03;      /* Row Address A28~A29 */
      for(j=0; j<10; j++);

      write_cmd(0x30);
      wait_idle();

      dat = read_data();
      nand_deselect_chip();
      if(dat != 0xff)
            i += 131072;      // 1 Block = 2048*64= 131072
/* Read Page */
      nand_select_chip();
}
问题1:      *p = 5;
      for(j=0; j<10; j++);
      *p = 8;
      for(j=0; j<10; j++);这个地址是怎么来的?
问题2:如果检测到是坏块,这里面也没看到做什么处理?


页: [1]
查看完整版本: UBOOT中Boot_init.c关于从NAND拷贝代码到SDRAM