提交 9254d1a3 编写于 作者: mysterywolf's avatar mysterywolf

[iar][syscalls] 补充注释

上级 215d1d4c
......@@ -11,7 +11,13 @@
#include <LowLevelIOInterface.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"
int __close(int handle)
{
if (handle == _LLIO_STDOUT ||
......
......@@ -11,7 +11,22 @@
#include <LowLevelIOInterface.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"
long __lseek(int handle, long offset, int whence)
{
if (handle == _LLIO_STDOUT ||
......
......@@ -12,6 +12,11 @@
#include <LowLevelIOInterface.h>
#include <fcntl.h>
/*
* The "__open" function opens the file named "filename" as specified
* by "mode".
*/
#pragma module_name = "?__open"
int __open(const char *filename, int mode)
......
......@@ -19,7 +19,19 @@
#define DBG_LVL DBG_INFO
#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"
size_t __read(int handle, unsigned char *buf, size_t len)
{
#ifdef RT_USING_POSIX
......
......@@ -11,12 +11,18 @@
#include <LowLevelIOInterface.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"
int remove(const char *val)
int remove(const char *filename)
{
#ifdef RT_USING_POSIX
return unlink(val);
return unlink(filename);
#else
return -1;
return _LLIO_ERROR;
#endif /* RT_USING_POSIX */
}
......@@ -19,6 +19,20 @@
#define DBG_LVL DBG_INFO
#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"
size_t __write(int handle, const unsigned char *buf, size_t len)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册