Commit 1655324b authored by Andrew Burger's avatar Andrew Burger

Some logging

parent 348fcb47
......@@ -37,6 +37,31 @@
#include <nfapi.h>
#include <debug.h>
static const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len)
{
char *p = out;
char *endp = out + out_len;
const uint8_t *q = data;
snprintf(p, endp - p, "[%zu]", data_len);
p += strlen(p);
for (size_t i = 0; i < data_len; ++i)
{
if (p >= endp)
{
static const char ellipses[] = "...";
char *s = endp - sizeof(ellipses);
if (s >= p)
{
strcpy(s, ellipses);
}
break;
}
snprintf(p, endp - p, " %02X", *q++);
p += strlen(p);
}
return out;
}
extern int nfapi_unpack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppReadPackedMsg, void* user_data);
extern int nfapi_pack_p7_vendor_extension(nfapi_p7_message_header_t* header, uint8_t **ppWritePackedMsg, void* user_data);
......@@ -6109,6 +6134,8 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
nfapi_p7_message_header_t *pMessageHeader = (nfapi_p7_message_header_t*)pUnpackedBuf;
uint8_t *pReadPackedMessage = pMessageBuf;
uint8_t *end = pMessageBuf + messageBufLen;
uint8_t *end_unpacked_buf = pUnpackedBuf + unpackedBufLen;
uint8_t *start_unpacked_buf = pUnpackedBuf;
if (pMessageBuf == NULL || pUnpackedBuf == NULL)
{
......@@ -6317,6 +6344,13 @@ int nfapi_p7_message_unpack(void *pMessageBuf, uint32_t messageBufLen, void *pUn
break;
}
if (pMessageHeader->message_id == NFAPI_RX_ULSCH_INDICATION)
{
char foobar[1024];
NFAPI_TRACE(NFAPI_TRACE_ERROR, "Biden %s:%d: %s\n", __FUNCTION__,
__LINE__, hexdump(pUnpackedBuf, end_unpacked_buf - start_unpacked_buf, foobar, sizeof(foobar)));
}
if(result == 0)
return -1;
else
......
......@@ -1330,6 +1330,12 @@ const char *hexdump(const void *data, size_t data_len, char *out, size_t out_len
LOG_I(MAC, "RX_IND sent to Proxy, Size: %d Frame %d Subframe %d rx_ind.tl.length: %u num_pdus: %u\n",
encoded_size, NFAPI_SFNSF2SFN(UL->rx_ind.sfn_sf), NFAPI_SFNSF2SF(UL->rx_ind.sfn_sf),
UL->rx_ind.rx_indication_body.tl.length, UL->rx_ind.rx_indication_body.number_of_pdus);
nfapi_rx_indication_t test_ind;
if (nfapi_p7_message_unpack(buffer, encoded_size, &test_ind, sizeof(test_ind), NULL) < 0)
{
LOG_E(MAC, "could not unpack rx_ind right after packing encoded_size: %d\n" encoded_size);
abort();
}
break;
case NFAPI_RX_CQI_INDICATION:
encoded_size = nfapi_p7_message_pack(&UL->cqi_ind, buffer, sizeof(buffer), NULL); // Check pdu->ul_cqi_information.channel = 1
......
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