r43 - trunk/src/host/sjf2410-linux
laforge at gta01.hmw-consulting.de
laforge at gta01.hmw-consulting.de
Wed Sep 6 20:37:38 CEST 2006
Author: laforge
Date: 2006-09-06 18:37:38 +0000 (Wed, 06 Sep 2006)
New Revision: 43
Modified:
trunk/src/host/sjf2410-linux/k9s1208.c
Log:
add clumsy mode to read out nand flash
Modified: trunk/src/host/sjf2410-linux/k9s1208.c
===================================================================
--- trunk/src/host/sjf2410-linux/k9s1208.c 2006-09-02 10:33:54 UTC (rev 42)
+++ trunk/src/host/sjf2410-linux/k9s1208.c 2006-09-06 18:37:38 UTC (rev 43)
@@ -1,4 +1,8 @@
+#include <sys/types.h>
+#include <sys/stat.h>
+#include <fcntl.h>
#include <stdio.h>
+#include <unistd.h>
#include "pin2410.h"
#include "jtag.h"
#include "k9s1208.h"
@@ -31,6 +35,7 @@
void K9S1208_PrintBlock(void);
void K9S1208_Program(void);
+void K9S1208_Read(void);
static U32 targetBlock; // Block number (0 ~ 4095)
@@ -41,6 +46,7 @@
{
(void *)K9S1208_Program, "K9S1208 Program ",
(void *)K9S1208_PrintBlock, "K9S1208 Pr BlkPage ",
+ (void *)K9S1208_Read, "K9S1208 Read Flash ",
(void *)1, "Exit ",
0,0
};
@@ -169,9 +175,30 @@
}
}
+void K9S1208_Read(void)
+{
+ int of, block, page;
+ unsigned char buffer[512];
+ printf("\n[SMC(K9S1208V0M) NAND Flash Reading Program]\n");
+ of = creat("flash-read.bin", 0660);
+ if (of < 0) {
+ printf("error opening out file");
+ return;
+ }
+ for (block = 0; block < 4096; block++) {
+ for (page = 0; page < 32; page++) {
+ NF_ReadPage(block, page, buffer,NULL);
+ write(of, buffer, 512);
+ }
+ }
+
+ close(of);
+}
+
+
void K9S1208_PrintBlock(void)// Printf one page
{
int i;
More information about the commitlog
mailing list