mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-22 03:09:16 +08:00
[console] 解决在没有定义RT_USING_DEVICE的情况下使用device报错的问题
* [console] 解决在没有定义RT_USING_DEVICE的情况下使用device报错的问题 * format codes * [libc] 整理格式 * refresh projects
This commit is contained in:
committed by
Bernard Xiong
parent
353f717037
commit
bb1084556f
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
|
||||
@@ -204,7 +204,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode)
|
||||
|
||||
if (fh == STDOUT || fh == STDERR)
|
||||
{
|
||||
#ifdef RT_USING_CONSOLE
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_device_t console;
|
||||
console = rt_console_get_device();
|
||||
if (console)
|
||||
@@ -214,7 +214,7 @@ int _sys_write(FILEHANDLE fh, const unsigned char *buf, unsigned len, int mode)
|
||||
return 0; /* success */
|
||||
#else
|
||||
return 0; /* error */
|
||||
#endif /* RT_USING_CONSOLE */
|
||||
#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */
|
||||
}
|
||||
else if (fh == STDIN)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-12-26 Meco Man First Version
|
||||
*/
|
||||
|
||||
#ifndef __COMPILER_PRIVATE_H__
|
||||
#define __COMPILER_PRIVATE_H__
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#ifndef __DIRENT_H__
|
||||
#define __DIRENT_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-09-02 Meco Man First version
|
||||
*/
|
||||
|
||||
#ifndef __FCNTL_H__
|
||||
#define __FCNTL_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-05-22 Meco Man The first version.
|
||||
*/
|
||||
|
||||
#ifndef __SYS_ERRNO_H__
|
||||
#define __SYS_ERRNO_H__
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 2020-09-05 Meco Man fix bugs
|
||||
* 2020-12-16 Meco Man add useconds_t
|
||||
*/
|
||||
|
||||
#ifndef __SYS_TYPES_H__
|
||||
#define __SYS_TYPES_H__
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 2020-12-16 Meco Man add usleep
|
||||
* 2021-09-11 Meco Man move functions from dfs_posix.h to unistd.h
|
||||
*/
|
||||
|
||||
#ifndef __SYS_UNISTD_H__
|
||||
#define __SYS_UNISTD_H__
|
||||
|
||||
|
||||
@@ -6,4 +6,5 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#include "sys/unistd.h"
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2020-09-01 Meco Man First Version
|
||||
*/
|
||||
|
||||
#ifndef __SYS_IOCTL_H__
|
||||
#define __SYS_IOCTL_H__
|
||||
|
||||
|
||||
@@ -6,6 +6,7 @@
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
*/
|
||||
|
||||
#ifndef __SYS_STATFS_H__
|
||||
#define __SYS_STATFS_H__
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 2020-09-07 Meco Man combine gcc armcc iccarm
|
||||
* 2021-02-12 Meco Man move all definitions located in <clock_time.h> to this file
|
||||
*/
|
||||
|
||||
#ifndef __SYS_TIME_H__
|
||||
#define __SYS_TIME_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-09-11 Meco Man First version
|
||||
*/
|
||||
|
||||
#ifndef __SYS_VFS_H__
|
||||
#define __SYS_VFS_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2015-01-28 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <LowLevelIOInterface.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2015-01-28 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <LowLevelIOInterface.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -8,6 +8,7 @@
|
||||
* 2015-01-28 Bernard first version
|
||||
* 2021-11-13 Meco Man implement no-heap warning
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <stddef.h>
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2015-01-28 Bernard first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <LowLevelIOInterface.h>
|
||||
#include <unistd.h>
|
||||
|
||||
@@ -40,7 +40,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
|
||||
|
||||
if ((handle == _LLIO_STDOUT) || (handle == _LLIO_STDERR))
|
||||
{
|
||||
#ifdef RT_USING_CONSOLE
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_device_t console_device;
|
||||
|
||||
console_device = rt_console_get_device();
|
||||
@@ -52,7 +52,7 @@ size_t __write(int handle, const unsigned char *buf, size_t len)
|
||||
return len; /* return the length of the data written */
|
||||
#else
|
||||
return _LLIO_ERROR;
|
||||
#endif /* RT_USING_CONSOLE */
|
||||
#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */
|
||||
}
|
||||
else if (handle == _LLIO_STDIN)
|
||||
{
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-02-13 Meco Man implement exit() and abort()
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
|
||||
/* for exit() and abort() */
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2021-09-02 Meco Man First version
|
||||
*/
|
||||
|
||||
#ifndef __FCNTL_H__
|
||||
#define __FCNTL_H__
|
||||
|
||||
|
||||
@@ -7,6 +7,7 @@
|
||||
* Date Author Notes
|
||||
* 2017/10/15 bernard the first version
|
||||
*/
|
||||
|
||||
#include <rtthread.h>
|
||||
#include <rtm.h>
|
||||
|
||||
|
||||
@@ -1,3 +1,13 @@
|
||||
/*
|
||||
* Copyright (c) 2006-2021, RT-Thread Development Team
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*
|
||||
* Change Logs:
|
||||
* Date Author Notes
|
||||
* 2021-02-16 Meco Man The first version
|
||||
*/
|
||||
|
||||
#ifndef _MACHTIME_H_
|
||||
#define _MACHTIME_H_
|
||||
|
||||
|
||||
@@ -297,7 +297,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
|
||||
|
||||
if (fd == STDOUT_FILENO || fd == STDERR_FILENO)
|
||||
{
|
||||
#ifdef RT_USING_CONSOLE
|
||||
#if defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE)
|
||||
rt_device_t console;
|
||||
|
||||
console = rt_console_get_device();
|
||||
@@ -306,7 +306,7 @@ _ssize_t _write_r(struct _reent *ptr, int fd, const void *buf, size_t nbytes)
|
||||
#else
|
||||
ptr->_errno = ENOTSUP;
|
||||
return -1;
|
||||
#endif /* RT_USING_CONSOLE */
|
||||
#endif /* defined(RT_USING_CONSOLE) && defined(RT_USING_DEVICE) */
|
||||
}
|
||||
else if (fd == STDIN_FILENO)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user