added comments

This commit is contained in:
Markus Fröschle
2012-12-17 16:48:15 +00:00
parent b257a93211
commit fd1b041675

View File

@@ -43,8 +43,8 @@ typedef struct srec2 /* two byte address field */
uint16_t address; /* [2 + 2] */ uint16_t address; /* [2 + 2] */
uint8_t data[64]; /* [4 + length] */ uint8_t data[64]; /* [4 + length] */
} __attribute__((packed)) SREC2; } __attribute__((packed)) SREC2;
#define SREC2_DATALEN(a) ((a)->length - 2) #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]) #define SREC2_CHECKSUM(a) ((a)->data[SREC2_DATALEN(a) - 1]) /* returns the checksum byte */
typedef struct srec4 /* four byte address field */ typedef struct srec4 /* four byte address field */
{ {
@@ -53,8 +53,8 @@ typedef struct srec4 /* four byte address field */
uint32_t address; /* [2 + 4] */ uint32_t address; /* [2 + 4] */
uint8_t data[64]; /* [6 + length] */ uint8_t data[64]; /* [6 + length] */
} __attribute__((packed)) SREC4; } __attribute__((packed)) SREC4;
#define SREC4_DATALEN(a) ((a)->length - 4) #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]) #define SREC4_CHECKSUM(a) ((a)->data[SREC4_DATALEN(a) - 1]) /* returns the checksum byte */
uint8_t nibble_to_byte(uint8_t nibble) uint8_t nibble_to_byte(uint8_t nibble)