stm32f411/stm32f411e-disco/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 #include "stm32f411e_discovery.h"
35 
36 /* Variables */
37 //#undef errno
38 extern int errno;
39 extern int __io_putchar(int ch) __attribute__((weak));
40 extern int __io_getchar(void) __attribute__((weak));
41 
42 char *__env[1] = { 0 };
43 char **environ = __env;
44 
45 
46 /* Functions */
48 {
49 }
50 
51 int _getpid(void)
52 {
53  return 1;
54 }
55 
56 int _kill(int pid, int sig)
57 {
58  errno = EINVAL;
59  return -1;
60 }
61 
62 void _exit (int status)
63 {
64  _kill(status, -1);
65  while (1) {} /* Make sure we hang here */
66 }
67 
68 __attribute__((weak)) int _read(int file, char *ptr, int len)
69 {
70  int DataIdx;
71 
72  for (DataIdx = 0; DataIdx < len; DataIdx++)
73  {
74  *ptr++ = __io_getchar();
75  }
76 
77 return len;
78 }
79 
80 __attribute__((weak)) int _write(int file, char *ptr, int len)
81 {
82  int DataIdx;
83 
84  for (DataIdx = 0; DataIdx < len; DataIdx++)
85  {
86  __io_putchar(*ptr++);
87  }
88  return len;
89 }
90 
91 int _close(int file)
92 {
93  return -1;
94 }
95 
96 
97 int _fstat(int file, struct stat *st)
98 {
99  st->st_mode = S_IFCHR;
100  return 0;
101 }
102 
103 int _isatty(int file)
104 {
105  return 1;
106 }
107 
108 int _lseek(int file, int ptr, int dir)
109 {
110  return 0;
111 }
112 
113 int _open(char *path, int flags, ...)
114 {
115  /* Pretend like we always fail */
116  return -1;
117 }
118 
119 int _wait(int *status)
120 {
121  errno = ECHILD;
122  return -1;
123 }
124 
125 int _unlink(char *name)
126 {
127  errno = ENOENT;
128  return -1;
129 }
130 
131 int _times(struct tms *buf)
132 {
133  return -1;
134 }
135 
136 int _stat(char *file, struct stat *st)
137 {
138  st->st_mode = S_IFCHR;
139  return 0;
140 }
141 
142 int _link(char *old, char *new)
143 {
144  errno = EMLINK;
145  return -1;
146 }
147 
148 int _fork(void)
149 {
150  errno = EAGAIN;
151  return -1;
152 }
153 
154 int _execve(char *name, char **argv, char **env)
155 {
156  errno = ENOMEM;
157  return -1;
158 }
_open
int _open(char *path, int flags,...)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:113
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
Definition: pv_stm32f469.c:141
errno
int errno
time.h
_unlink
int _unlink(char *name)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:125
_execve
int _execve(char *name, char **argv, char **env)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:154
python.setup.name
name
Definition: porcupine/binding/python/setup.py:69
_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
initialise_monitor_handles
void initialise_monitor_handles()
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:47
_stat
int _stat(char *file, struct stat *st)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:136
__io_getchar
int __io_getchar(void)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:40
_exit
void _exit(int status)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:62
environ
char ** environ
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:43
_close
int _close(int file)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:91
__attribute__
__attribute__((weak))
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:68
_wait
int _wait(int *status)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:119
_link
int _link(char *old, char *new)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:142
_times
int _times(struct tms *buf)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:131
_lseek
int _lseek(int file, int ptr, int dir)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:108
python.test_porcupine.argv
argv
Definition: test_porcupine.py:158
_fstat
int _fstat(int file, struct stat *st)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:97
_fork
int _fork(void)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:148
stm32f411e_discovery.h
This file contains definitions for STM32F401-Discovery Kit's Leds and push-button hardware resources.
_kill
int _kill(int pid, int sig)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:56
_isatty
int _isatty(int file)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:103
_getpid
int _getpid(void)
Definition: stm32f411/stm32f411e-disco/Src/syscalls.c:51


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