summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorDavid Hendricks <dhendrix@chromium.org>2012-04-25 11:40:11 -0700
committerDavid Hendricks <dhendrix@chromium.org>2012-04-25 14:51:33 -0700
commitef9424dd1058d1f49692ecf10d7b1b207b175e15 (patch)
treed8f4db5a65adb85ec36ae03ad1b67f49d2344bcb /include
parent83082746a9a463ad6a964cfc2f2abd0bf08d95fb (diff)
downloadchrome-ec-ef9424dd1058d1f49692ecf10d7b1b207b175e15.tar.gz
simplified message protocol
This simplifies the messaging protocol. Messages will now only have the raw content plus a checksum byte at the end. We will worry about needs of the transport layer (e.g. preamble/postamble bytes) on the host driver side, and will not support variable-length commands for now. There is also a protocol version command, which is now command number 0x00, which returns a 4-byte protocol version followed by a 1-byte checksum. BUG=none TEST=tested on daisy using mkbp kernel driver Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: I8fcc693cd50bc2b515164ea7a2a941cdd8333e73
Diffstat (limited to 'include')
-rw-r--r--include/message.h31
1 files changed, 8 insertions, 23 deletions
diff --git a/include/message.h b/include/message.h
index 0930eb24f1..439c6df67e 100644
--- a/include/message.h
+++ b/include/message.h
@@ -11,28 +11,19 @@
/* Command interface between EC and AP */
enum {
- /* Mask to convert a command byte into a command */
- MSG_CMD_MASK = 0x7f,
-
- /* The bytes which appear before the header in a message */
- MSG_PREAMBLE = 0xff,
-
- /* The header byte, which follows the preamble */
- MSG_HEADER = 0xec,
-
- MSG_HEADER_BYTES = 3,
- MSG_TRAILER_BYTES = 2,
- MSG_PROTO_BYTES = MSG_HEADER_BYTES + MSG_TRAILER_BYTES,
+ MSG_TRAILER_BYTES = 1,
+ MSG_PROTO_BYTES = MSG_TRAILER_BYTES,
};
/* The command codes that we understand */
enum message_cmd_t {
- /* control / status messages */
+ /* EC control/status messages */
+ CMDC_PROTO_VER = 0x00, /* Protocol version */
CMDC_NOP, /* No operation / ping */
CMDC_ID, /* Read EC ID */
- /* functional messages */
- CMDC_KEY_STATE = 0x20, /* Read key state */
+ /* Functional messages */
+ CMDC_KEY_STATE = 0x20, /* Read key state */
};
@@ -44,15 +35,9 @@ enum message_cmd_t {
*
* The format of a reply is a sequence of bytes:
*
- * <hdr> <len_lo> <len_hi> <msg bytes> <sum> <preamble bytes>
- *
- * The hdr byte is just a tag to indicate that the real message follows. It
- * signals the end of any preamble required by the interface.
- *
- * The 16-bit length is the entire packet size, including the header, length
- * bytes, message payload, checksum, and postamble byte.
+ * <msg bytes> <sum>
*
- * The checksum is calculated as the sum of the header, len byte and message.
+ * The checksum is calculated as the sum of all message bytes
*
* @param cmd Command to process (CMD_...)
* @param buff Pointer to buffer to store reponse