mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-02 13:14:51 +00:00
Update message protocol length byte to include postamble
This simply changes the constant '4' to MSG_PROTO_BYTES, which includes the postamble. This helps reduce magic constant values used in processing a packet. BUG=chrome-os-partner:8975 TEST=tested on daisy (with kernel mkbp driver change) Signed-off-by: David Hendricks <dhendrix@chromium.org> Change-Id: Id4634076ad63f45783354179dfebea4fd450fc1e
This commit is contained in:
@@ -69,7 +69,7 @@ int message_process_cmd(int cmd, uint8_t *out_msg, int max_len)
|
||||
*/
|
||||
if (msg_len + MSG_PROTO_BYTES > max_len)
|
||||
msg_len = max_len - MSG_PROTO_BYTES;
|
||||
len = msg_len + 4;
|
||||
len = msg_len + MSG_PROTO_BYTES;
|
||||
ASSERT(msg_len >= 0 && msg_len < 0xffff);
|
||||
need_copy = msg != out_msg + MSG_HEADER_BYTES;
|
||||
ASSERT(!need_copy ||
|
||||
|
||||
@@ -46,8 +46,8 @@ enum message_cmd_t {
|
||||
* 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 includes the length of the header, len bytes, message
|
||||
* and checksum, but not the final preamble byte.
|
||||
* The 16-bit length is the entire packet size, including the header, length
|
||||
* bytes, message payload, checksum, and postamble byte.
|
||||
*
|
||||
* The checksum is calculated as the sum of the header, len byte and message.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user