Skip to content

Commit e750c91

Browse files
author
stefanct
committed
serprog: move the macro list to its own header file.
Signed-off-by: Stefan Tauner <[email protected]> Acked-by: Stefan Tauner <[email protected]>
1 parent 66bb84d commit e750c91

File tree

3 files changed

+26
-49
lines changed

3 files changed

+26
-49
lines changed

Documentation/serprog-protocol.txt

+1-25
Original file line numberDiff line numberDiff line change
@@ -92,28 +92,4 @@ Additional information of the above commands:
9292
In addition, support for these commands is recommended:
9393
S_CMD_Q_PGMNAME, S_CMD_Q_BUSTYPE, S_CMD_Q_CHIPSIZE (if parallel).
9494

95-
96-
This define listing should help C coders - (it's here to be the single source for copying - will be a .h someday i think)
97-
#define S_ACK 0x06
98-
#define S_NAK 0x15
99-
#define S_CMD_NOP 0x00 /* No operation */
100-
#define S_CMD_Q_IFACE 0x01 /* Query interface version */
101-
#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
102-
#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
103-
#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
104-
#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
105-
#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
106-
#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
107-
#define S_CMD_Q_WRNMAXLEN 0x08 /* Query Write to opbuf: Write-N maximum length */
108-
#define S_CMD_R_BYTE 0x09 /* Read a single byte */
109-
#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
110-
#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
111-
#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
112-
#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
113-
#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
114-
#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
115-
#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
116-
#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
117-
#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
118-
#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
119-
#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */
95+
See also serprog.h.

serprog.c

+1-24
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@
3838
#include "flash.h"
3939
#include "programmer.h"
4040
#include "chipdrivers.h"
41+
#include "serprog.h"
4142

4243
#define MSGHEADER "serprog: "
4344

@@ -48,30 +49,6 @@
4849
*/
4950
static int serprog_shutdown(void *data);
5051

51-
#define S_ACK 0x06
52-
#define S_NAK 0x15
53-
#define S_CMD_NOP 0x00 /* No operation */
54-
#define S_CMD_Q_IFACE 0x01 /* Query interface version */
55-
#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
56-
#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
57-
#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
58-
#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
59-
#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
60-
#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
61-
#define S_CMD_Q_WRNMAXLEN 0x08 /* Query opbuf-write-N maximum length */
62-
#define S_CMD_R_BYTE 0x09 /* Read a single byte */
63-
#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
64-
#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
65-
#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
66-
#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
67-
#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
68-
#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
69-
#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
70-
#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
71-
#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
72-
#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
73-
#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */
74-
7552
static uint16_t sp_device_serbuf_size = 16;
7653
static uint16_t sp_device_opbuf_size = 300;
7754
/* Bitmap of supported commands */

serprog.h

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
/* According to Serial Flasher Protocol Specification - version 1 */
2+
#define S_ACK 0x06
3+
#define S_NAK 0x15
4+
#define S_CMD_NOP 0x00 /* No operation */
5+
#define S_CMD_Q_IFACE 0x01 /* Query interface version */
6+
#define S_CMD_Q_CMDMAP 0x02 /* Query supported commands bitmap */
7+
#define S_CMD_Q_PGMNAME 0x03 /* Query programmer name */
8+
#define S_CMD_Q_SERBUF 0x04 /* Query Serial Buffer Size */
9+
#define S_CMD_Q_BUSTYPE 0x05 /* Query supported bustypes */
10+
#define S_CMD_Q_CHIPSIZE 0x06 /* Query supported chipsize (2^n format) */
11+
#define S_CMD_Q_OPBUF 0x07 /* Query operation buffer size */
12+
#define S_CMD_Q_WRNMAXLEN 0x08 /* Query Write to opbuf: Write-N maximum length */
13+
#define S_CMD_R_BYTE 0x09 /* Read a single byte */
14+
#define S_CMD_R_NBYTES 0x0A /* Read n bytes */
15+
#define S_CMD_O_INIT 0x0B /* Initialize operation buffer */
16+
#define S_CMD_O_WRITEB 0x0C /* Write opbuf: Write byte with address */
17+
#define S_CMD_O_WRITEN 0x0D /* Write to opbuf: Write-N */
18+
#define S_CMD_O_DELAY 0x0E /* Write opbuf: udelay */
19+
#define S_CMD_O_EXEC 0x0F /* Execute operation buffer */
20+
#define S_CMD_SYNCNOP 0x10 /* Special no-operation that returns NAK+ACK */
21+
#define S_CMD_Q_RDNMAXLEN 0x11 /* Query read-n maximum length */
22+
#define S_CMD_S_BUSTYPE 0x12 /* Set used bustype(s). */
23+
#define S_CMD_O_SPIOP 0x13 /* Perform SPI operation. */
24+
#define S_CMD_S_SPI_FREQ 0x14 /* Set SPI clock frequency */

0 commit comments

Comments
 (0)