[Kernel] Add rt_kputs routine.
This commit is contained in:
parent
355b926e89
commit
2ce7382534
|
@ -488,8 +488,10 @@ void rt_components_board_init(void);
|
|||
*/
|
||||
#ifndef RT_USING_CONSOLE
|
||||
#define rt_kprintf(...)
|
||||
#define rt_kputs(str)
|
||||
#else
|
||||
void rt_kprintf(const char *fmt, ...);
|
||||
void rt_kputs(const char *str);
|
||||
#endif
|
||||
rt_int32_t rt_vsprintf(char *dest, const char *format, va_list arg_ptr);
|
||||
rt_int32_t rt_vsnprintf(char *buf, rt_size_t size, const char *fmt, va_list args);
|
||||
|
|
|
@ -1107,6 +1107,31 @@ WEAK void rt_hw_console_output(const char *str)
|
|||
}
|
||||
RTM_EXPORT(rt_hw_console_output);
|
||||
|
||||
/**
|
||||
* This function will put string to the console.
|
||||
*
|
||||
* @param str the string output to the console.
|
||||
*/
|
||||
void rt_kputs(const char *str)
|
||||
{
|
||||
#ifdef RT_USING_DEVICE
|
||||
if (_console_device == RT_NULL)
|
||||
{
|
||||
rt_hw_console_output(str);
|
||||
}
|
||||
else
|
||||
{
|
||||
rt_uint16_t old_flag = _console_device->open_flag;
|
||||
|
||||
_console_device->open_flag |= RT_DEVICE_FLAG_STREAM;
|
||||
rt_device_write(_console_device, 0, str, rt_strlen(str));
|
||||
_console_device->open_flag = old_flag;
|
||||
}
|
||||
#else
|
||||
rt_hw_console_output(str);
|
||||
#endif
|
||||
}
|
||||
|
||||
/**
|
||||
* This function will print a formatted string on system console
|
||||
*
|
||||
|
|
Loading…
Reference in New Issue