stm32h747/stm32h747i-disco/CM7/Src/syscalls.c
Go to the documentation of this file.
1 
24 /* Includes */
25 #include <sys/stat.h>
26 #include <stdlib.h>
27 #include <errno.h>
28 #include <stdio.h>
29 #include <signal.h>
30 #include <time.h>
31 #include <sys/time.h>
32 #include <sys/times.h>
33 
34 
35 /* Variables */
36 //#undef errno
37 extern int errno;
38 extern int __io_putchar(int ch) __attribute__((weak));
39 extern int __io_getchar(void) __attribute__((weak));
40 
41 char *__env[1] = { 0 };
42 char **environ = __env;
43 
44 
45 /* Functions */
47 {
48 }
49 
50 int _getpid(void)
51 {
52  return 1;
53 }
54 
55 int _kill(int pid, int sig)
56 {
57  (void) pid;
58  (void) sig;
59  errno = EINVAL;
60  return -1;
61 }
62 
63 void _exit (int status)
64 {
65  _kill(status, -1);
66  while (1) {} /* Make sure we hang here */
67 }
68 
69 __attribute__((weak)) int _read(int file, char *ptr, int len)
70 {
71  (void) file;
72  (void) ptr;
73  (void) len;
74 
75  int DataIdx;
76 
77  for (DataIdx = 0; DataIdx < len; DataIdx++)
78  {
79  *ptr++ = __io_getchar();
80  }
81 
82  return len;
83 }
84 
85 __attribute__((weak)) int _write(int file, char *ptr, int len)
86 {
87  (void) file;
88  (void) ptr;
89  (void) len;
90 
91  int DataIdx;
92 
93  for (DataIdx = 0; DataIdx < len; DataIdx++)
94  {
95  __io_putchar(*ptr++);
96  }
97  return len;
98 }
99 
100 int _close(int file)
101 {
102  (void) file;
103  return -1;
104 }
105 
106 
107 int _fstat(int file, struct stat *st)
108 {
109  (void) file;
110  st->st_mode = S_IFCHR;
111  return 0;
112 }
113 
114 int _isatty(int file)
115 {
116  (void) file;
117  return 1;
118 }
119 
120 int _lseek(int file, int ptr, int dir)
121 {
122  (void) file;
123  (void) ptr;
124  (void) dir;
125  return 0;
126 }
127 
128 int _open(char *path, int flags, ...)
129 {
130  (void) path;
131  (void) flags;
132  return -1;
133 }
134 
135 int _wait(int *status)
136 {
137  (void) status;
138  errno = ECHILD;
139  return -1;
140 }
141 
142 int _unlink(char *name)
143 {
144  (void) name;
145  errno = ENOENT;
146  return -1;
147 }
148 
149 int _times(struct tms *buf)
150 {
151  (void) buf;
152  return -1;
153 }
154 
155 int _stat(char *file, struct stat *st)
156 {
157  (void) file;
158  st->st_mode = S_IFCHR;
159  return 0;
160 }
161 
162 int _link(char *old, char *new)
163 {
164  (void) old;
165  (void) new;
166  errno = EMLINK;
167  return -1;
168 }
169 
170 int _fork(void)
171 {
172  errno = EAGAIN;
173  return -1;
174 }
175 
176 int _execve(char *name, char **argv, char **env)
177 {
178  (void) name;
179  (void) argv;
180  (void) env;
181  errno = ENOMEM;
182  return -1;
183 }
_wait
int _wait(int *status)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:135
__attribute__
__attribute__((weak))
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:69
initialise_monitor_handles
void initialise_monitor_handles()
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:46
_stat
int _stat(char *file, struct stat *st)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:155
time.h
_getpid
int _getpid(void)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:50
__io_getchar
int __io_getchar(void)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:39
_lseek
int _lseek(int file, int ptr, int dir)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:120
python.setup.name
name
Definition: porcupine/binding/python/setup.py:69
_close
int _close(int file)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:100
_write
int _write(int file, char *ptr, int len)
Definition: stm32f407/stm32f407g-disc1/Src/syscalls.c:101
_read
int _read(int file, char *ptr, int len)
Definition: stm32f407/stm32f407g-disc1/Src/syscalls.c:133
environ
char ** environ
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:42
_kill
int _kill(int pid, int sig)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:55
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
Definition: pv_stm32f469.c:141
_isatty
int _isatty(int file)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:114
_unlink
int _unlink(char *name)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:142
_times
int _times(struct tms *buf)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:149
_open
int _open(char *path, int flags,...)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:128
_execve
int _execve(char *name, char **argv, char **env)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:176
python.test_porcupine.argv
argv
Definition: test_porcupine.py:158
_fork
int _fork(void)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:170
errno
int errno
_exit
void _exit(int status)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:63
_link
int _link(char *old, char *new)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:162
_fstat
int _fstat(int file, struct stat *st)
Definition: stm32h747/stm32h747i-disco/CM7/Src/syscalls.c:107


picovoice_driver
Author(s):
autogenerated on Fri Apr 1 2022 02:14:55