summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-27 00:34:18 +0000
committerStefan Tauner <stefan.tauner@alumni.tuwien.ac.at>2012-10-27 00:34:18 +0000
commit0d82e952f2a896aefa1187e53b0ec6d6d559fe9b (patch)
tree5ff85d0f98f3e30909ff2a4d38d159405e424c48
parent94b39b47e475d3d8f153acea4a3fdcd6bbc81ea7 (diff)
downloadast2050-flashrom-0d82e952f2a896aefa1187e53b0ec6d6d559fe9b.zip
ast2050-flashrom-0d82e952f2a896aefa1187e53b0ec6d6d559fe9b.tar.gz
serprog: move the macro list to its own header file
Corresponding to flashrom svn r1617. Signed-off-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at> Acked-by: Stefan Tauner <stefan.tauner@alumni.tuwien.ac.at>
-rw-r--r--Documentation/serprog-protocol.txt26
-rw-r--r--serprog.c25
-rw-r--r--serprog.h24
3 files changed, 26 insertions, 49 deletions
diff --git a/Documentation/serprog-protocol.txt b/Documentation/serprog-protocol.txt
index d8733cc..821cf28 100644
--- a/Documentation/serprog-protocol.txt
+++ b/Documentation/serprog-protocol.txt
@@ -92,28 +92,4 @@ Additional information of the above commands:
In addition, support for these commands is recommended:
S_CMD_Q_PGMNAME, S_CMD_Q_BUSTYPE, S_CMD_Q_CHIPSIZE (if parallel).
-
-This define listing should help C coders - (it's here to be the single source for copying - will be a .h someday i think)
-#define S_ACK 0x06
-#define S_NAK 0x15
-#define S_CMD_NOP 0x00 /* No operation */
-#define S_CMD_Q_IFACE 0x01 /* Query interface version */
-#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
-#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
-#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
-#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
-#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
-#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
-#define S_CMD_Q_WRNMAXLEN 0x08 /* Query Write to opbuf: Write-N maximum length */
-#define S_CMD_R_BYTE 0x09 /* Read a single byte */
-#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
-#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
-#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
-#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
-#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
-#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
-#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
-#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
-#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
-#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
-#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */
+See also serprog.h.
diff --git a/serprog.c b/serprog.c
index 854cb93..28faac8 100644
--- a/serprog.c
+++ b/serprog.c
@@ -38,6 +38,7 @@
#include "flash.h"
#include "programmer.h"
#include "chipdrivers.h"
+#include "serprog.h"
#define MSGHEADER "serprog: "
@@ -48,30 +49,6 @@
*/
static int serprog_shutdown(void *data);
-#define S_ACK 0x06
-#define S_NAK 0x15
-#define S_CMD_NOP 0x00 /* No operation */
-#define S_CMD_Q_IFACE 0x01 /* Query interface version */
-#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
-#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
-#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
-#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
-#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
-#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
-#define S_CMD_Q_WRNMAXLEN 0x08 /* Query opbuf-write-N maximum length */
-#define S_CMD_R_BYTE 0x09 /* Read a single byte */
-#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
-#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
-#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
-#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
-#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
-#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
-#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
-#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
-#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
-#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
-#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */
-
static uint16_t sp_device_serbuf_size = 16;
static uint16_t sp_device_opbuf_size = 300;
/* Bitmap of supported commands */
diff --git a/serprog.h b/serprog.h
new file mode 100644
index 0000000..8d11772
--- /dev/null
+++ b/serprog.h
@@ -0,0 +1,24 @@
+/* According to Serial Flasher Protocol Specification - version 1 */
+#define S_ACK 0x06
+#define S_NAK 0x15
+#define S_CMD_NOP 0x00 /* No operation */
+#define S_CMD_Q_IFACE 0x01 /* Query interface version */
+#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
+#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
+#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
+#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
+#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
+#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
+#define S_CMD_Q_WRNMAXLEN 0x08 /* Query Write to opbuf: Write-N maximum length */
+#define S_CMD_R_BYTE 0x09 /* Read a single byte */
+#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
+#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
+#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
+#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
+#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
+#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
+#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
+#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
+#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
+#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
+#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */
OpenPOWER on IntegriCloud