diff --git a/include/btstack/utils.h b/include/btstack/utils.h index 960b1c294..6ee6a8563 100644 --- a/include/btstack/utils.h +++ b/include/btstack/utils.h @@ -100,3 +100,7 @@ uint8_t crc8_calc(uint8_t *data, uint16_t len); #define BD_ADDR_CMP(a,b) memcmp(a,b, BD_ADDR_LEN) #define BD_ADDR_COPY(dest,src) memcpy(dest,src,BD_ADDR_LEN) + +#ifdef EMBEDDED +void bzero(void *s, uint32_t n); +#endif diff --git a/src/hci_cmds.c b/src/hci_cmds.c index 3e4316fb6..6a0200201 100644 --- a/src/hci_cmds.c +++ b/src/hci_cmds.c @@ -41,6 +41,7 @@ #include #include "../config.h" +#include // for bzero on embedded #include "hci.h" // calculate combined ogf/ocf value diff --git a/src/utils.c b/src/utils.c index 4449845f0..4595af5e2 100644 --- a/src/utils.c +++ b/src/utils.c @@ -176,3 +176,12 @@ uint8_t crc8_calc(uint8_t *data, uint16_t len) /* Ones complement */ return 0xFF - crc8(data, len); } + +/*-----------------------------------------------------------------------------------*/ +// ad-hoc implemenation for embedded targets +void bzero(void *s, uint32_t n){ + uint8_t * data = (uint8_t *) s; + while (n--){ + *data++ = 0; + } +}