Add SPI flash emulation capability to the dummy programmer.

You have to choose between
- no emulation
- ST M25P10.RES SPI flash chip (RES, page write)
- SST SST25VF040.REMS SPI flash chip (REMS, byte write)
- SST SST25VF032B SPI flash chip (RDID, AAI write)
Example usage: flashrom -p dummy:emulate=SST25VF032B

Flash image persistence is available as well.
Example usage: flashrom -p dummy:image=dummy_simulator.rom

Allow setting the max chunksize for page write with the dummy
programmer.
Example usage: flashrom -p dummy:spi_write_256_chunksize=5

Flash emulation is compiled in by default. 

This code helped me find and fix various bugs in the SPI write code
as well as in the testsuite.

Signed-off-by: Carl-Daniel Hailfinger <c-d.hailfinger.devel.2006@gmx.net>
Acked-by: David Hendricks <dhendrix@google.com>


git-svn-id: svn://coreboot.org/flashrom/trunk@1220 2b7e53f0-3cfb-0310-b3e9-8179ed1497e1
diff --git a/flash.h b/flash.h
index 700b3f4..6ac3c1c 100644
--- a/flash.h
+++ b/flash.h
@@ -207,6 +207,8 @@
 void list_programmers_linebreak(int startcol, int cols, int paren);
 int selfcheck(void);
 int doit(struct flashchip *flash, int force, char *filename, int read_it, int write_it, int erase_it, int verify_it);
+int read_buf_from_file(unsigned char *buf, unsigned long size, char *filename);
+int write_buf_to_file(unsigned char *buf, unsigned long size, char *filename);
 
 #define OK 0
 #define NT 1    /* Not tested */