mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-01-19 03:13:30 +08:00
[iar][syscalls] 补充注释
This commit is contained in:
parent
215d1d4c6e
commit
9254d1a3af
@ -11,7 +11,13 @@
|
|||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "__close" function should close the file corresponding to
|
||||||
|
* "handle". It should return 0 on success and nonzero on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?__close"
|
#pragma module_name = "?__close"
|
||||||
|
|
||||||
int __close(int handle)
|
int __close(int handle)
|
||||||
{
|
{
|
||||||
if (handle == _LLIO_STDOUT ||
|
if (handle == _LLIO_STDOUT ||
|
||||||
|
@ -11,7 +11,22 @@
|
|||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "__lseek" function makes the next file operation (__read or
|
||||||
|
* __write) act on a new location. The parameter "whence" specifies
|
||||||
|
* how the "offset" parameter should be interpreted according to the
|
||||||
|
* following table:
|
||||||
|
*
|
||||||
|
* 0 (=SEEK_SET) - Goto location "offset".
|
||||||
|
* 1 (=SEEK_CUR) - Go "offset" bytes from the current location.
|
||||||
|
* 2 (=SEEK_END) - Go to "offset" bytes from the end.
|
||||||
|
*
|
||||||
|
* This function should return the current file position, or -1 on
|
||||||
|
* failure.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?__lseek"
|
#pragma module_name = "?__lseek"
|
||||||
|
|
||||||
long __lseek(int handle, long offset, int whence)
|
long __lseek(int handle, long offset, int whence)
|
||||||
{
|
{
|
||||||
if (handle == _LLIO_STDOUT ||
|
if (handle == _LLIO_STDOUT ||
|
||||||
|
@ -12,6 +12,11 @@
|
|||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <fcntl.h>
|
#include <fcntl.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "__open" function opens the file named "filename" as specified
|
||||||
|
* by "mode".
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?__open"
|
#pragma module_name = "?__open"
|
||||||
|
|
||||||
int __open(const char *filename, int mode)
|
int __open(const char *filename, int mode)
|
||||||
|
@ -19,7 +19,19 @@
|
|||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "__read" function reads a number of bytes, at most "size" into
|
||||||
|
* the memory area pointed to by "buffer". It returns the number of
|
||||||
|
* bytes read, 0 at the end of the file, or _LLIO_ERROR if failure
|
||||||
|
* occurs.
|
||||||
|
*
|
||||||
|
* The template implementation below assumes that the application
|
||||||
|
* provides the function "MyLowLevelGetchar". It should return a
|
||||||
|
* character value, or -1 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?__read"
|
#pragma module_name = "?__read"
|
||||||
|
|
||||||
size_t __read(int handle, unsigned char *buf, size_t len)
|
size_t __read(int handle, unsigned char *buf, size_t len)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX
|
#ifdef RT_USING_POSIX
|
||||||
|
@ -11,12 +11,18 @@
|
|||||||
#include <LowLevelIOInterface.h>
|
#include <LowLevelIOInterface.h>
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "remove" function should remove the file named "filename". It
|
||||||
|
* should return 0 on success and nonzero on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?remove"
|
#pragma module_name = "?remove"
|
||||||
int remove(const char *val)
|
|
||||||
|
int remove(const char *filename)
|
||||||
{
|
{
|
||||||
#ifdef RT_USING_POSIX
|
#ifdef RT_USING_POSIX
|
||||||
return unlink(val);
|
return unlink(filename);
|
||||||
#else
|
#else
|
||||||
return -1;
|
return _LLIO_ERROR;
|
||||||
#endif /* RT_USING_POSIX */
|
#endif /* RT_USING_POSIX */
|
||||||
}
|
}
|
||||||
|
@ -19,6 +19,20 @@
|
|||||||
#define DBG_LVL DBG_INFO
|
#define DBG_LVL DBG_INFO
|
||||||
#include <rtdbg.h>
|
#include <rtdbg.h>
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The "__write" function should output "size" number of bytes from
|
||||||
|
* "buffer" in some application-specific way. It should return the
|
||||||
|
* number of characters written, or _LLIO_ERROR on failure.
|
||||||
|
*
|
||||||
|
* If "buffer" is zero then __write should perform flushing of
|
||||||
|
* internal buffers, if any. In this case "handle" can be -1 to
|
||||||
|
* indicate that all handles should be flushed.
|
||||||
|
*
|
||||||
|
* The template implementation below assumes that the application
|
||||||
|
* provides the function "MyLowLevelPutchar". It should return the
|
||||||
|
* character written, or -1 on failure.
|
||||||
|
*/
|
||||||
|
|
||||||
#pragma module_name = "?__write"
|
#pragma module_name = "?__write"
|
||||||
|
|
||||||
size_t __write(int handle, const unsigned char *buf, size_t len)
|
size_t __write(int handle, const unsigned char *buf, size_t len)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user