Rename the header_len field to header_data_len
authorAntonio Ospite <ospite@studenti.unina.it>
Fri, 13 Jan 2012 12:43:59 +0000 (13:43 +0100)
committerAntonio Ospite <ospite@studenti.unina.it>
Fri, 13 Jan 2012 12:43:59 +0000 (13:43 +0100)
This matches better match its meaning, it is not the length of the whole
header, but only of the header_data section.

src/am7xxx.c
src/am7xxx.h

index d81d1a8..0dc9cd8 100644 (file)
@@ -56,11 +56,11 @@ static void dump_header(struct am7xxx_header *h)
        if (h == NULL)
                return;
 
-       printf("packet_type: 0x%08x (%u)\n", h->packet_type, h->packet_type);
-       printf("unknown0:    0x%02hhx (%hhu)\n", h->unknown0, h->unknown0);
-       printf("header_len:  0x%02hhx (%hhu)\n", h->header_len, h->header_len);
-       printf("unknown2:    0x%02hhx (%hhu)\n", h->unknown2, h->unknown2);
-       printf("unknown3:    0x%02hhx (%hhu)\n", h->unknown3, h->unknown3);
+       printf("packet_type:     0x%08x (%u)\n", h->packet_type, h->packet_type);
+       printf("unknown0:        0x%02hhx (%hhu)\n", h->unknown0, h->unknown0);
+       printf("header_data_len: 0x%02hhx (%hhu)\n", h->header_data_len, h->header_data_len);
+       printf("unknown2:        0x%02hhx (%hhu)\n", h->unknown2, h->unknown2);
+       printf("unknown3:        0x%02hhx (%hhu)\n", h->unknown3, h->unknown3);
 
        switch(h->packet_type) {
        case AM7XXX_PACKET_TYPE_IMAGE:
@@ -165,11 +165,11 @@ int am7xxx_send_image(am7xxx_device dev,
 {
        int ret;
        struct am7xxx_header h = {
-               .packet_type = htole32(AM7XXX_PACKET_TYPE_IMAGE),
-               .unknown0    = 0x00,
-               .header_len  = sizeof(struct am7xxx_image_header),
-               .unknown2    = 0x3e,
-               .unknown3    = 0x10,
+               .packet_type     = htole32(AM7XXX_PACKET_TYPE_IMAGE),
+               .unknown0        = 0x00,
+               .header_data_len = sizeof(struct am7xxx_image_header),
+               .unknown2        = 0x3e,
+               .unknown3        = 0x10,
                .header_data = {
                        .image = {
                                .format     = htole32(format),
index e67ec9f..84a1efb 100644 (file)
@@ -72,7 +72,7 @@ struct am7xxx_power_header {
 struct am7xxx_header {
        uint32_t packet_type;
        uint8_t unknown0;
-       uint8_t header_len;
+       uint8_t header_data_len;
        uint8_t unknown2;
        uint8_t unknown3;
        union {
@@ -82,6 +82,7 @@ struct am7xxx_header {
 };
 
 am7xxx_device am7xxx_init(void);
+
 void am7xxx_shutdown(am7xxx_device dev);
 
 int am7xxx_send_image(am7xxx_device dev,