mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-23 16:23:56 -04:00
HAL_ChibiOS: simplify stubs code
This commit is contained in:
parent
d1565a96c5
commit
bf79b65e07
@ -70,6 +70,7 @@
|
||||
*
|
||||
* Modified for use in AP_HAL by Andrew Tridgell and Siddharth Bharat Purohit
|
||||
*/
|
||||
|
||||
#include <sys/unistd.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
@ -88,21 +89,11 @@ uint8_t _before_main = 1;
|
||||
__attribute__((used))
|
||||
int _read(struct _reent *r, int file, char * ptr, int len)
|
||||
{
|
||||
(void)r;
|
||||
#if defined(STDIN_SD)
|
||||
if (!len || (file != 0)) {
|
||||
__errno_r(r) = EINVAL;
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
return -1;
|
||||
}
|
||||
len = sdRead(&STDIN_SD, (uint8_t *)ptr, (size_t)len);
|
||||
return len;
|
||||
#else
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
__errno_r(r) = EINVAL;
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -110,12 +101,12 @@ int _read(struct _reent *r, int file, char * ptr, int len)
|
||||
__attribute__((used))
|
||||
int _lseek(struct _reent *r, int file, int ptr, int dir)
|
||||
{
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)dir;
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)dir;
|
||||
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -123,17 +114,11 @@ int _lseek(struct _reent *r, int file, int ptr, int dir)
|
||||
__attribute__((used))
|
||||
int _write(struct _reent *r, int file, char * ptr, int len)
|
||||
{
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
#if defined(STDOUT_SD)
|
||||
if (file != 1) {
|
||||
__errno_r(r) = EINVAL;
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)ptr;
|
||||
(void)len;
|
||||
return -1;
|
||||
}
|
||||
sdWrite(&STDOUT_SD, (uint8_t *)ptr, (size_t)len);
|
||||
#endif
|
||||
return len;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -141,10 +126,9 @@ int _write(struct _reent *r, int file, char * ptr, int len)
|
||||
__attribute__((used))
|
||||
int _close(struct _reent *r, int file)
|
||||
{
|
||||
(void)r;
|
||||
(void)file;
|
||||
|
||||
return 0;
|
||||
(void)r;
|
||||
(void)file;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -175,12 +159,10 @@ caddr_t _sbrk(struct _reent *r, int incr)
|
||||
__attribute__((used))
|
||||
int _fstat(struct _reent *r, int file, struct stat * st)
|
||||
{
|
||||
(void)r;
|
||||
(void)file;
|
||||
|
||||
memset(st, 0, sizeof(*st));
|
||||
st->st_mode = S_IFCHR;
|
||||
return 0;
|
||||
(void)r;
|
||||
(void)file;
|
||||
(void)st;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/***************************************************************************/
|
||||
@ -188,23 +170,22 @@ int _fstat(struct _reent *r, int file, struct stat * st)
|
||||
__attribute__((used))
|
||||
int _isatty(struct _reent *r, int fd)
|
||||
{
|
||||
(void)r;
|
||||
(void)fd;
|
||||
|
||||
return 1;
|
||||
(void)r;
|
||||
(void)fd;
|
||||
return 1;
|
||||
}
|
||||
|
||||
__attribute__((used))
|
||||
pid_t _getpid(void)
|
||||
{
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
|
||||
__attribute__((used))
|
||||
void _exit( int status )
|
||||
{
|
||||
(void)status;
|
||||
while( 1 );
|
||||
(void)status;
|
||||
while ( 1 );
|
||||
}
|
||||
|
||||
__attribute__((used))
|
||||
@ -215,8 +196,9 @@ void _fini(void)
|
||||
__attribute__((used))
|
||||
int _kill( int pid, int sig )
|
||||
{
|
||||
(void)pid; (void)sig;
|
||||
return -1;
|
||||
(void)pid;
|
||||
(void)sig;
|
||||
return -1;
|
||||
}
|
||||
|
||||
/*** EOF ***/
|
||||
|
Loading…
Reference in New Issue
Block a user