提交 81751d99 编写于 作者: P prife

fix bug in simulator/drivers/serial.c which deadlock may happen if multi-uart...

fix bug in simulator/drivers/serial.c which deadlock may happen if multi-uart both output use printf
上级 1c522be5
...@@ -151,6 +151,7 @@ static rt_size_t rt_serial_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_ ...@@ -151,6 +151,7 @@ static rt_size_t rt_serial_read(rt_device_t dev, rt_off_t pos, void *buffer, rt_
static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size) static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void *buffer, rt_size_t size)
{ {
int level;
#if _DEBUG_SERIAL==1 #if _DEBUG_SERIAL==1
printf("in rt_serial_write()\n"); printf("in rt_serial_write()\n");
#endif #endif
...@@ -162,8 +163,10 @@ static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void *buff ...@@ -162,8 +163,10 @@ static rt_size_t rt_serial_write(rt_device_t dev, rt_off_t pos, const void *buff
fwrite(buffer, size, 1, fp); fwrite(buffer, size, 1, fp);
#endif #endif
level = rt_hw_interrupt_disable();
printf("%s", (char *)buffer); printf("%s", (char *)buffer);
fflush(stdout); fflush(stdout);
rt_hw_interrupt_enable(level);
return size; return size;
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册