syscalls.c
Go to the documentation of this file.
1
// Copyright (c) Acconeer AB, 2019-2023
2
// All rights reserved
3
// This file is subject to the terms and conditions defined in the file
4
// 'LICENSES/license_acconeer.txt', (BSD 3-Clause License) which is part
5
// of this source code package.
6
7
#include <errno.h>
8
#include <stdint.h>
9
#include <sys/stat.h>
10
11
#include "
main.h
"
12
13
extern
UART_HandleTypeDef
DEBUG_UART_HANDLE
;
14
15
int
_fstat
(
int
file,
struct
stat *st)
16
{
17
(void)file;
18
19
st->st_mode = S_IFCHR;
20
return
0;
21
}
22
23
int
_close
(
int
file)
24
{
25
(void)file;
26
27
return
-1;
28
}
29
30
int
_getpid
(
void
)
31
{
32
return
1;
33
}
34
35
int
_isatty
(
int
file)
36
{
37
(void)file;
38
39
return
1;
40
}
41
42
int
_lseek
(
int
file,
int
ptr,
int
dir)
43
{
44
(void)file;
45
(void)ptr;
46
(void)dir;
47
48
return
0;
49
}
50
51
int
_kill
(
int
pid,
int
sig)
52
{
53
(void)pid;
54
(void)sig;
55
56
errno = EINVAL;
57
return
-1;
58
}
59
60
int
_read
(
int
file,
char
*ptr,
int
len)
61
{
62
(void)file;
63
(void)ptr;
64
(void)len;
65
66
return
-1;
67
}
68
69
int
_write
(
int
file,
char
*ptr,
int
len)
70
{
71
(void)file;
72
HAL_UART_Transmit(&
DEBUG_UART_HANDLE
, (uint8_t *)ptr, len, 0xFFFF);
73
return
len;
74
}
_lseek
int _lseek(int file, int ptr, int dir)
Definition:
syscalls.c:42
_getpid
int _getpid(void)
Definition:
syscalls.c:30
_close
int _close(int file)
Definition:
syscalls.c:23
_kill
int _kill(int pid, int sig)
Definition:
syscalls.c:51
_isatty
int _isatty(int file)
Definition:
syscalls.c:35
DEBUG_UART_HANDLE
UART_HandleTypeDef DEBUG_UART_HANDLE
_write
int _write(int file, char *ptr, int len)
Definition:
syscalls.c:69
_fstat
int _fstat(int file, struct stat *st)
Definition:
syscalls.c:15
main.h
: Header for main.c file. This file contains the common defines of the application.
_read
int _read(int file, char *ptr, int len)
Definition:
syscalls.c:60