Skip to content

Commit

Permalink
[features]: 实现中断上下文打印输出特性支持 V1
Browse files Browse the repository at this point in the history
  1. 添加中断上下文加锁、释放锁接口
  • Loading branch information
ji.hb committed Nov 19, 2023
1 parent 17b2063 commit 5101be2
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
18 changes: 18 additions & 0 deletions easylogger/port/elog_port.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
*/
Expand Down
8 changes: 8 additions & 0 deletions easylogger/src/elog.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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();
}
}

Expand All @@ -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();
}
}

Expand Down

0 comments on commit 5101be2

Please sign in to comment.