From bbeb614408734e61d62f462519f2f29aa30d9225 Mon Sep 17 00:00:00 2001 From: Armin Luntzer <armin.luntzer@univie.ac.at> Date: Mon, 31 Aug 2020 15:27:30 +0200 Subject: [PATCH] if available, extract data crc from packet --- FEE/rmap.c | 5 +++++ FEE/rmap.h | 2 ++ 2 files changed, 7 insertions(+) diff --git a/FEE/rmap.c b/FEE/rmap.c index 6deb6a0..e6a0846 100644 --- a/FEE/rmap.c +++ b/FEE/rmap.c @@ -560,6 +560,8 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf) (uint32_t) buf[RMAP_DATALEN_BYTE2 + n]; } + pkt->hdr_crc = buf[RMAP_HEADER_CRC]; + if (pkt->data_len) { pkt->data = (uint8_t *) malloc(pkt->data_len); if (!pkt->data) @@ -567,6 +569,9 @@ struct rmap_pkt *rmap_pkt_from_buffer(uint8_t *buf) for (i = 0; i < pkt->data_len; i++) pkt->data[i] = buf[RMAP_DATA_START + n + i]; + + /* final byte is data crc */ + pkt->data_crc = buf[RMAP_DATA_START + n + i]; } diff --git a/FEE/rmap.h b/FEE/rmap.h index 2d94db2..17e4df1 100644 --- a/FEE/rmap.h +++ b/FEE/rmap.h @@ -183,6 +183,8 @@ struct rmap_pkt { uint32_t addr; /* (first) data address */ uint8_t *data; uint32_t data_len; /* lenght of data in bytes */ + uint8_t hdr_crc; + uint8_t data_crc; }; -- GitLab