2022-06-29 06:00:49 -04:00
|
|
|
/*
|
2023-07-14 05:06:47 -04:00
|
|
|
* SPDX-FileCopyrightText: 2021-2023 Espressif Systems (Shanghai) CO LTD
|
2022-06-29 06:00:49 -04:00
|
|
|
*
|
|
|
|
* SPDX-License-Identifier: Unlicense OR CC0-1.0
|
|
|
|
*/
|
|
|
|
|
2022-08-25 02:31:52 -04:00
|
|
|
#include "esp_peripheral.h"
|
2022-06-29 06:00:49 -04:00
|
|
|
|
|
|
|
/**
|
|
|
|
* Utility function to log an array of bytes.
|
|
|
|
*/
|
|
|
|
void
|
|
|
|
print_bytes(const uint8_t *bytes, int len)
|
|
|
|
{
|
|
|
|
int i;
|
|
|
|
|
|
|
|
for (i = 0; i < len; i++) {
|
|
|
|
MODLOG_DFLT(INFO, "%s0x%02x", i != 0 ? ":" : "", bytes[i]);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
print_addr(const void *addr)
|
|
|
|
{
|
|
|
|
const uint8_t *u8p;
|
|
|
|
|
|
|
|
u8p = addr;
|
|
|
|
MODLOG_DFLT(INFO, "%02x:%02x:%02x:%02x:%02x:%02x",
|
|
|
|
u8p[5], u8p[4], u8p[3], u8p[2], u8p[1], u8p[0]);
|
|
|
|
}
|
2023-07-14 05:06:47 -04:00
|
|
|
|
|
|
|
char *
|
|
|
|
addr_str(const void *addr)
|
|
|
|
{
|
|
|
|
static char buf[6 * 2 + 5 + 1];
|
|
|
|
const uint8_t *u8p;
|
|
|
|
|
|
|
|
u8p = addr;
|
|
|
|
sprintf(buf, "%02x:%02x:%02x:%02x:%02x:%02x",
|
|
|
|
u8p[5], u8p[4], u8p[3], u8p[2], u8p[1], u8p[0]);
|
|
|
|
|
|
|
|
return buf;
|
|
|
|
}
|
2023-05-05 03:13:21 -04:00
|
|
|
|
|
|
|
void
|
|
|
|
print_mbuf(const struct os_mbuf *om)
|
|
|
|
{
|
|
|
|
int colon, i;
|
|
|
|
|
|
|
|
colon = 0;
|
|
|
|
while (om != NULL) {
|
|
|
|
if (colon) {
|
|
|
|
MODLOG_DFLT(DEBUG, ":");
|
|
|
|
} else {
|
|
|
|
colon = 1;
|
|
|
|
}
|
|
|
|
for (i = 0; i < om->om_len; i++) {
|
|
|
|
MODLOG_DFLT(DEBUG, "%s0x%02x", i != 0 ? ":" : "", om->om_data[i]);
|
|
|
|
}
|
|
|
|
om = SLIST_NEXT(om, om_next);
|
|
|
|
}
|
|
|
|
}
|