Commit acfe98a6 authored by Robert Schmidt's avatar Robert Schmidt

Hack: don't invert DCI payload, does not seem to work

parent a8140027
...@@ -548,9 +548,10 @@ uint8_t unpackarray(uint8_t **ppReadPackedMsg, void *array, uint16_t array_eleme ...@@ -548,9 +548,10 @@ uint8_t unpackarray(uint8_t **ppReadPackedMsg, void *array, uint16_t array_eleme
uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **out, uint8_t *end) uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **out, uint8_t *end)
{ {
// Helper vars for DCI Payload // Helper vars for DCI Payload
uint8_t dci_bytes_inverted[DCI_PAYLOAD_BYTE_LEN]; uint8_t dci_bytes_inverted[DCI_PAYLOAD_BYTE_LEN] = {0};
uint8_t dci_byte_len = (payloadSizeBits + 7) / 8; uint8_t dci_byte_len = (payloadSizeBits + 7) / 8;
// Align the dci payload bits to the left on the payload buffer // Align the dci payload bits to the left on the payload buffer
/*
uint64_t *dci_pdu = (uint64_t *)payload; uint64_t *dci_pdu = (uint64_t *)payload;
if (payloadSizeBits % 8 != 0) { if (payloadSizeBits % 8 != 0) {
uint8_t rotation_bits = 8 - (payloadSizeBits % 8); uint8_t rotation_bits = 8 - (payloadSizeBits % 8);
...@@ -560,17 +561,21 @@ uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t * ...@@ -560,17 +561,21 @@ uint32_t pack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t *
for (int j = 0; j < dci_byte_len; j++) { for (int j = 0; j < dci_byte_len; j++) {
dci_bytes_inverted[j] = payload[(dci_byte_len - 1) - j]; dci_bytes_inverted[j] = payload[(dci_byte_len - 1) - j];
} }
return pusharray8(dci_bytes_inverted, DCI_PAYLOAD_BYTE_LEN, dci_byte_len, out, end); print_dci_bytes_inverted(dci_bytes_inverted, dci_byte_len);
*/
return pusharray8(payload, DCI_PAYLOAD_BYTE_LEN, dci_byte_len, out, end);
} }
uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **in, uint8_t *end) uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t **in, uint8_t *end)
{ {
// Pull the inverted DCI and invert it back // Pull the inverted DCI and invert it back
// Helper vars for DCI Payload // Helper vars for DCI Payload
uint8_t dci_bytes_inverted[DCI_PAYLOAD_BYTE_LEN]; uint8_t dci_bytes_inverted[DCI_PAYLOAD_BYTE_LEN] = {0};
uint8_t dci_byte_len = (payloadSizeBits + 7) / 8; uint8_t dci_byte_len = (payloadSizeBits + 7) / 8;
// Get DCI array inverted // Get DCI array inverted
uint32_t pullresult = pullarray8(in, dci_bytes_inverted, DCI_PAYLOAD_BYTE_LEN, dci_byte_len, end); uint32_t pullresult = pullarray8(in, payload, DCI_PAYLOAD_BYTE_LEN, dci_byte_len, end);
/*
print_dci_bytes_inverted(dci_bytes_inverted, dci_byte_len);
uint64_t *dci_pdu = (uint64_t *)payload; uint64_t *dci_pdu = (uint64_t *)payload;
// Reversing the byte order of the inverted DCI payload // Reversing the byte order of the inverted DCI payload
for (uint16_t j = 0; j < dci_byte_len; j++) { for (uint16_t j = 0; j < dci_byte_len; j++) {
...@@ -580,6 +585,7 @@ uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t ...@@ -580,6 +585,7 @@ uint32_t unpack_dci_payload(uint8_t payload[], uint16_t payloadSizeBits, uint8_t
uint8_t rotation_bits = 8 - (payloadSizeBits % 8); uint8_t rotation_bits = 8 - (payloadSizeBits % 8);
*dci_pdu = (*dci_pdu >> rotation_bits); *dci_pdu = (*dci_pdu >> rotation_bits);
} }
*/
return pullresult; return pullresult;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment