mirror of
git://projects.qi-hardware.com/xburst-tools.git
synced 2024-11-25 16:11:53 +02:00
try to debug the nand_read
This commit is contained in:
parent
05afbb65a7
commit
12ba156cfb
@ -20,13 +20,6 @@
|
||||
* MA 02111-1307 USA
|
||||
*/
|
||||
#include "blink_led.h"
|
||||
#define GPBCON (*(volatile unsigned *)0x56000010)
|
||||
#define GPBDAT (*(volatile unsigned *)0x56000014)
|
||||
#define GPBDW (*(volatile unsigned *)0x56000018)
|
||||
#define LED3_ON() (GPBDAT &= ~(0x1))
|
||||
#define LED4_ON() (GPBDAT &= ~(0x2))
|
||||
#define LED3_OFF() (GPBDAT |= (0x1))
|
||||
#define LED4_OFF() (GPBDAT |= (0x2))
|
||||
|
||||
int delay(int time)
|
||||
{
|
||||
@ -34,22 +27,63 @@ int delay(int time)
|
||||
for(i=0;i<time;i++);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int blink_led()
|
||||
int set_GPB()
|
||||
{
|
||||
GPBCON = 0x5;
|
||||
GPBDW = 0xffff;
|
||||
while(1)
|
||||
{
|
||||
LED3_ON();
|
||||
delay(0xfffff);
|
||||
LED3_OFF() ;
|
||||
delay(0xfffff);
|
||||
|
||||
LED4_ON();
|
||||
delay(0xfffff);
|
||||
LED4_OFF();
|
||||
delay(0xfffff);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int orange_on(int times)
|
||||
{
|
||||
int count=0;
|
||||
set_GPB();
|
||||
|
||||
for(count=0;count<times;count++)
|
||||
{
|
||||
ORANGE_ON();
|
||||
delay(0xfffff);
|
||||
ORANGE_OFF() ;
|
||||
delay(0xfffff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int blue_on(int times)
|
||||
{
|
||||
int count=0;
|
||||
set_GPB();
|
||||
|
||||
for(count=0;count<times;count++)
|
||||
{
|
||||
BLUE_ON();
|
||||
delay(0xfffff);
|
||||
BLUE_OFF();
|
||||
delay(0xfffff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
int blink_led()
|
||||
{
|
||||
set_GPB();
|
||||
|
||||
while(1)
|
||||
{
|
||||
ORANGE_ON();
|
||||
delay(0xfffff);
|
||||
ORANGE_OFF() ;
|
||||
delay(0xfffff);
|
||||
|
||||
BLUE_ON();
|
||||
delay(0xfffff);
|
||||
BLUE_OFF();
|
||||
delay(0xfffff);
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
@ -23,6 +23,19 @@
|
||||
#ifndef __BLINK_LED_H
|
||||
#define __BLINK_LED_H
|
||||
|
||||
#define GPBCON (*(volatile unsigned *)0x56000010)
|
||||
#define GPBDAT (*(volatile unsigned *)0x56000014)
|
||||
#define GPBDW (*(volatile unsigned *)0x56000018)
|
||||
#define ORANGE_OFF() (GPBDAT &= ~(0x1))
|
||||
#define BLUE_OFF() (GPBDAT &= ~(0x2))
|
||||
#define ORANGE_ON() (GPBDAT |= (0x1))
|
||||
#define BLUE_ON() (GPBDAT |= (0x2))
|
||||
|
||||
#define ORANGE 1;
|
||||
#define BLUE 0;
|
||||
|
||||
int orange_on(int times);
|
||||
int blue_on(int times);
|
||||
int blink_led();
|
||||
|
||||
#endif /* __BLINK_LED_H */
|
||||
|
@ -19,6 +19,7 @@
|
||||
#include <linux/mtd/nand.h>
|
||||
*/
|
||||
#include "nand_read.h"
|
||||
#include "blink_led.h"
|
||||
|
||||
#define NAND_CMD_READ0 0
|
||||
#define NAND_CMD_READSTART 0x30
|
||||
@ -117,20 +118,19 @@ int nand_read_ll(unsigned char *buf, unsigned long start_addr, int size)
|
||||
for (i=0; i<10; i++);
|
||||
|
||||
for (i=start_addr; i < (start_addr + size);) {
|
||||
|
||||
if (i % NAND_BLOCK_SIZE == 0) {
|
||||
if (is_bad_block(i) ||
|
||||
is_bad_block(i + NAND_PAGE_SIZE)) {
|
||||
/* Bad block */
|
||||
orange_on(1);
|
||||
i += NAND_BLOCK_SIZE;
|
||||
size += NAND_BLOCK_SIZE;
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
blue_on(1);
|
||||
j = nand_read_page_ll(buf, i);
|
||||
i += j;
|
||||
buf += j;
|
||||
/* buf += j;*/
|
||||
}
|
||||
|
||||
/* chip Disable */
|
||||
|
@ -38,19 +38,15 @@ unsigned char buf[2048];
|
||||
|
||||
int start_kboot()
|
||||
{
|
||||
if(nand_read_ll(buf, 0x32000000, sizeof(buf))==-1) {
|
||||
blink_led();
|
||||
if(nand_read_ll(buf, 0x32000000, sizeof(buf))==-1)
|
||||
{
|
||||
while(1){blink_led(1);}
|
||||
}
|
||||
|
||||
/*
|
||||
void (*fp)(void)=(void (*)(void))&buf;
|
||||
(fp)();
|
||||
*/
|
||||
|
||||
asm volatile("mov pc, %0\n"
|
||||
: /* output */
|
||||
:"r"(ADDR) /* input */
|
||||
);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user