Replace the existing Apache 2.0 boilerplate header with an SPDX tag throughout the zephyr code tree. This patch was generated via a script run over the master branch. Also updated doc/porting/application.rst that had a dependency on line numbers in a literal include. Manually updated subsys/logging/sys_log.c that had a malformed header in the original file. Also cleanup several cases that already had a SPDX tag and we either got a duplicate or missed updating. Jira: ZEP-1457 Change-Id: I6131a1d4ee0e58f5b938300c2d2fc77d2e69572c Signed-off-by: David B. Kinder <david.b.kinder@intel.com> Signed-off-by: Kumar Gala <kumar.gala@linaro.org>
45 lines
876 B
C
45 lines
876 B
C
/* log.c - logging helpers */
|
|
|
|
/*
|
|
* Copyright (c) 2016 Intel Corporation
|
|
*
|
|
* SPDX-License-Identifier: Apache-2.0
|
|
*/
|
|
|
|
/* Helper for printk parameters to convert from binary to hex.
|
|
* We declare multiple buffers so the helper can be used multiple times
|
|
* in a single printk call.
|
|
*/
|
|
|
|
#include <stddef.h>
|
|
#include <stdint.h>
|
|
#include <zephyr.h>
|
|
#include <misc/util.h>
|
|
|
|
const char *bt_hex(const void *buf, size_t len)
|
|
{
|
|
static const char hex[] = "0123456789abcdef";
|
|
static char hexbufs[4][129];
|
|
static uint8_t curbuf;
|
|
const uint8_t *b = buf;
|
|
unsigned int mask;
|
|
char *str;
|
|
int i;
|
|
|
|
mask = irq_lock();
|
|
str = hexbufs[curbuf++];
|
|
curbuf %= ARRAY_SIZE(hexbufs);
|
|
irq_unlock(mask);
|
|
|
|
len = min(len, (sizeof(hexbufs[0]) - 1) / 2);
|
|
|
|
for (i = 0; i < len; i++) {
|
|
str[i * 2] = hex[b[i] >> 4];
|
|
str[i * 2 + 1] = hex[b[i] & 0xf];
|
|
}
|
|
|
|
str[i * 2] = '\0';
|
|
|
|
return str;
|
|
}
|