refactor: decouple lwip and hilog for liteos_m
decouple lwip and hilog for liteos_m close: #I46DAH Signed-off-by: liujiandong <liujiandong1@huawei.com>
This commit is contained in:
parent
4e11ded476
commit
be03374c3c
|
@ -93,23 +93,15 @@
|
||||||
|
|
||||||
#define LWIP_RAND rand
|
#define LWIP_RAND rand
|
||||||
|
|
||||||
extern void HilogPrintf(const char *fmt, ...);
|
#ifndef LWIP_LOGGER
|
||||||
|
#define LWIP_LOGGER(msg)
|
||||||
#ifndef HILOG_INFO
|
|
||||||
#define HILOG_INFO(...)
|
|
||||||
#ifndef HILOG_MODULE_APP
|
|
||||||
#define HILOG_MODULE_APP 0
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef HILOG_ERROR
|
extern void LwipLogPrintf(const char *fmt, ...);
|
||||||
#define HILOG_ERROR(...)
|
#define LWIP_PLATFORM_DIAG(vars) LwipLogPrintf vars
|
||||||
#endif
|
#define LWIP_PLATFORM_ASSERT(x) do { \
|
||||||
|
LWIP_PLATFORM_DIAG(("Assertion \"%s\" failed at line %d in %s\n", x, __LINE__, __FILE__)); \
|
||||||
#define LWIP_PLATFORM_DIAG(vars) HilogPrintf vars
|
} while (0)
|
||||||
#define LWIP_PLATFORM_ASSERT(x) do {HILOG_ERROR(HILOG_MODULE_APP, \
|
|
||||||
"Assertion \"%s\" errno %d line %d in %s\n", \
|
|
||||||
x, errno, __LINE__, __FILE__);} while (0)
|
|
||||||
|
|
||||||
#define init_waitqueue_head(...)
|
#define init_waitqueue_head(...)
|
||||||
#define poll_check_waiters(...)
|
#define poll_check_waiters(...)
|
||||||
|
|
|
@ -324,7 +324,7 @@ void sys_mutex_set_invalid(sys_mutex_t *mutex)
|
||||||
*mutex = LOSCFG_BASE_IPC_MUX_LIMIT;
|
*mutex = LOSCFG_BASE_IPC_MUX_LIMIT;
|
||||||
}
|
}
|
||||||
|
|
||||||
void HilogPrintf(const char *fmt, ...)
|
void LwipLogPrintf(const char *fmt, ...)
|
||||||
{
|
{
|
||||||
if ((fmt == NULL) || (strlen(fmt) == 0)) {
|
if ((fmt == NULL) || (strlen(fmt) == 0)) {
|
||||||
return;
|
return;
|
||||||
|
@ -337,8 +337,8 @@ void HilogPrintf(const char *fmt, ...)
|
||||||
len = vsprintf_s(buf, sizeof(buf) - 1, fmt, ap);
|
len = vsprintf_s(buf, sizeof(buf) - 1, fmt, ap);
|
||||||
va_end(ap);
|
va_end(ap);
|
||||||
if (len < 0) {
|
if (len < 0) {
|
||||||
HILOG_INFO(HILOG_MODULE_APP, "log param invalid or buf is not enough.");
|
LWIP_LOGGER("log param invalid or buf is not enough.");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
HILOG_INFO(HILOG_MODULE_APP, buf);
|
LWIP_LOGGER(buf);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue