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
16
int
_fstat
(
int
file,
struct
stat *st)
17
{
18
(void)file;
19
20
st->st_mode = S_IFCHR;
21
return
0;
22
}
23
24
25
int
_close
(
int
file)
26
{
27
(void)file;
28
29
return
-1;
30
}
31
32
33
int
_getpid
(
void
)
34
{
35
return
1;
36
}
37
38
39
int
_isatty
(
int
file)
40
{
41
(void)file;
42
43
return
1;
44
}
45
46
47
int
_lseek
(
int
file,
int
ptr,
int
dir)
48
{
49
(void)file;
50
(void)ptr;
51
(void)dir;
52
53
return
0;
54
}
55
56
57
int
_kill
(
int
pid,
int
sig)
58
{
59
(void)pid;
60
(void)sig;
61
62
errno = EINVAL;
63
return
-1;
64
}
65
66
67
int
_read
(
int
file,
char
*ptr,
int
len)
68
{
69
(void)file;
70
(void)ptr;
71
(void)len;
72
73
return
-1;
74
}
75
76
77
int
_write
(
int
file,
char
*ptr,
int
len)
78
{
79
(void)file;
80
HAL_UART_Transmit(&
DEBUG_UART_HANDLE
, (uint8_t *)ptr, len, 0xFFFF);
81
return
len;
82
}
_lseek
int _lseek(int file, int ptr, int dir)
Definition:
syscalls.c:47
_getpid
int _getpid(void)
Definition:
syscalls.c:33
_close
int _close(int file)
Definition:
syscalls.c:25
_kill
int _kill(int pid, int sig)
Definition:
syscalls.c:57
_isatty
int _isatty(int file)
Definition:
syscalls.c:39
DEBUG_UART_HANDLE
UART_HandleTypeDef DEBUG_UART_HANDLE
_write
int _write(int file, char *ptr, int len)
Definition:
syscalls.c:77
_fstat
int _fstat(int file, struct stat *st)
Definition:
syscalls.c:16
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:67