diff --git a/easylogger/port/elog_port.c b/easylogger/port/elog_port.c index 9d476a0..49a7796 100644 --- a/easylogger/port/elog_port.c +++ b/easylogger/port/elog_port.c @@ -72,6 +72,24 @@ void elog_port_interrupt_get_nest(void) { } +/** + * output lock in isr context + */ +void elog_port_output_lock_isr(void) { + + /* add your code here */ + +} + +/** + * output unlock in isr context + */ +void elog_port_output_unlock_isr(void) { + + /* add your code here */ + +} + /** * output lock */ diff --git a/easylogger/src/elog.c b/easylogger/src/elog.c index 48f8bb9..8f81bd7 100644 --- a/easylogger/src/elog.c +++ b/easylogger/src/elog.c @@ -149,6 +149,8 @@ void (*elog_assert_hook)(const char* expr, const char* func, size_t line); extern void elog_port_output(const char *log, size_t size); extern int elog_port_interrupt_get_nest(void); +extern void elog_port_output_lock_isr(void); +extern void elog_port_output_unlock_isr(void); extern void elog_port_output_lock(void); extern void elog_port_output_unlock(void); @@ -385,6 +387,9 @@ void elog_output_lock(void) { } else { elog.output_is_locked_before_enable = true; } + } else { + if (elog.output_lock_enabled) + elog_port_output_lock_isr(); } } @@ -399,6 +404,9 @@ void elog_output_unlock(void) { } else { elog.output_is_locked_before_enable = false; } + } else { + if (elog.output_lock_enabled) + elog_port_output_unlock_isr(); } }