|
|
@@ -178,8 +178,19 @@ size_t ulog_ultoa(char *s, unsigned long int n)
|
|
|
|
|
|
static void output_unlock(void)
|
|
|
{
|
|
|
+ uint32_t cpsr = 0;
|
|
|
+ uint32_t mode;
|
|
|
+
|
|
|
+ asm("mrs %0, CPSR" : : "r"(cpsr));
|
|
|
+ mode = cpsr & 0x1f;
|
|
|
+
|
|
|
+ /* is in abort or undefine mode */
|
|
|
+ if (mode == 0x17 || mode == 0x1b)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
/* is in thread context */
|
|
|
- if (interrupt_get_nest() == 0)
|
|
|
+ else if (interrupt_get_nest() == 0)
|
|
|
{
|
|
|
xSemaphoreGive(ulog.output_locker);
|
|
|
}
|
|
|
@@ -193,8 +204,19 @@ static void output_unlock(void)
|
|
|
|
|
|
static void output_lock(void)
|
|
|
{
|
|
|
+ uint32_t cpsr = 0;
|
|
|
+ uint32_t mode;
|
|
|
+
|
|
|
+ asm("mrs %0, CPSR" : : "r"(cpsr));
|
|
|
+ mode = cpsr & 0x1f;
|
|
|
+
|
|
|
+ /* is in abort or undefine mode */
|
|
|
+ if (mode == 0x17 || mode == 0x1b)
|
|
|
+ {
|
|
|
+
|
|
|
+ }
|
|
|
/* is in thread context */
|
|
|
- if (interrupt_get_nest() == 0)
|
|
|
+ else if (interrupt_get_nest() == 0)
|
|
|
{
|
|
|
xSemaphoreTake(ulog.output_locker, portMAX_DELAY);
|
|
|
}
|
|
|
@@ -254,9 +276,20 @@ WEAK size_t ulog_formater(char *log_buf, uint32_t level, const char *tag, int ne
|
|
|
#ifdef ULOG_TIME_USING_TIMESTAMP
|
|
|
SystemTime_t tm;
|
|
|
|
|
|
+#ifdef RTC_SUPPORT
|
|
|
iGetLocalTime(&tm);
|
|
|
snprintf(log_buf + log_len, ULOG_LINE_BUF_SIZE - log_len, "%02d-%02d %02d:%02d:%02d", tm.tm_mon + 1,
|
|
|
tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
|
+#else
|
|
|
+ tm.tm_year = YearDat;
|
|
|
+ tm.tm_mon = MonthDat;
|
|
|
+ tm.tm_mday = DayDat;
|
|
|
+ tm.tm_hour = HourDat;
|
|
|
+ tm.tm_min = MinuteDat;
|
|
|
+ tm.tm_sec = SecondDat;
|
|
|
+ snprintf(log_buf + log_len, ULOG_LINE_BUF_SIZE - log_len, "%02d-%02d %02d:%02d:%02d", tm.tm_mon,
|
|
|
+ tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
|
|
|
+#endif
|
|
|
|
|
|
#else
|
|
|
static size_t tick_len = 0;
|
|
|
@@ -410,6 +443,8 @@ static void do_output(uint32_t level, const char *tag, int is_raw, const char *l
|
|
|
#ifdef ULOG_USING_ASYNC_OUTPUT
|
|
|
rbb_blk_t log_blk;
|
|
|
ulog_frame_t log_frame;
|
|
|
+ uint32_t cpsr = 0;
|
|
|
+ uint32_t mode;
|
|
|
|
|
|
/* allocate log frame */
|
|
|
log_blk = rbb_blk_alloc(ulog.async_rbb, ULOG_ALIGN(sizeof(struct ulog_frame) + log_len, ULOG_ALIGN_SIZE));
|
|
|
@@ -427,8 +462,13 @@ static void do_output(uint32_t level, const char *tag, int is_raw, const char *l
|
|
|
memcpy(log_blk->buf + sizeof(struct ulog_frame), log_buf, log_len);
|
|
|
/* put the block */
|
|
|
rbb_blk_put(log_blk);
|
|
|
+ asm("mrs %0, CPSR" : : "r"(cpsr));
|
|
|
+ mode = cpsr & 0x1f;
|
|
|
+ /* is in abort or undefine mode */
|
|
|
+ if (mode == 0x17 || mode == 0x1b)
|
|
|
+ ;
|
|
|
/* send a notice */
|
|
|
- if (interrupt_get_nest() == 0)
|
|
|
+ else if (interrupt_get_nest() == 0)
|
|
|
xQueueSend(ulog.async_notice, NULL, 0);
|
|
|
else
|
|
|
xQueueSendFromISR(ulog.async_notice, NULL, 0);
|