From c2e2b6b1b1e5e14140fc0c60e0383b3a3688e35a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Markus=20Fr=C3=B6schle?= Date: Mon, 17 Dec 2012 16:48:15 +0000 Subject: [PATCH] added comments --- BaS_gcc/sources/s19reader.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/BaS_gcc/sources/s19reader.c b/BaS_gcc/sources/s19reader.c index a943d06..83d4d51 100644 --- a/BaS_gcc/sources/s19reader.c +++ b/BaS_gcc/sources/s19reader.c @@ -43,8 +43,8 @@ typedef struct srec2 /* two byte address field */ uint16_t address; /* [2 + 2] */ uint8_t data[64]; /* [4 + length] */ } __attribute__((packed)) SREC2; -#define SREC2_DATALEN(a) ((a)->length - 2) -#define SREC2_CHECKSUM(a) ((a)->data[SREC2_DATALEN(a) - 1]) +#define SREC2_DATALEN(a) ((a)->length - 2) /* returns the length of the data array (including the last checksum byte) */ +#define SREC2_CHECKSUM(a) ((a)->data[SREC2_DATALEN(a) - 1]) /* returns the checksum byte */ typedef struct srec4 /* four byte address field */ { @@ -53,8 +53,8 @@ typedef struct srec4 /* four byte address field */ uint32_t address; /* [2 + 4] */ uint8_t data[64]; /* [6 + length] */ } __attribute__((packed)) SREC4; -#define SREC4_DATALEN(a) ((a)->length - 4) -#define SREC4_CHECKSUM(a) ((a)->data[SREC4_DATALEN(a) - 1]) +#define SREC4_DATALEN(a) ((a)->length - 4) /* returns the length of the data array (including the last checksum byte) */ +#define SREC4_CHECKSUM(a) ((a)->data[SREC4_DATALEN(a) - 1]) /* returns the checksum byte */ uint8_t nibble_to_byte(uint8_t nibble)