Prusa MINI Firmware overview
syscalls.c File Reference
#include <sys/stat.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <signal.h>
#include <time.h>
#include <sys/time.h>
#include <sys/times.h>

Functions

int __io_putchar (int ch) __attribute__((weak))
 
int __io_getchar (void)
 
void initialise_monitor_handles ()
 
int _getpid (void)
 
int _kill (int pid, int sig)
 
void _exit (int status)
 
int _read (int file, char *ptr, int len)
 
int _write (int file, char *ptr, int len)
 
caddr_t _sbrk (int incr)
 
int _close (int file)
 
int _fstat (int file, struct stat *st)
 
int _isatty (int file)
 
int _lseek (int file, int ptr, int dir)
 
int _open (char *path, int flags,...)
 
int _wait (int *status)
 
int _unlink (char *name)
 
int _times (struct tms *buf)
 
int _stat (char *file, struct stat *st)
 
int _link (char *old, char *new)
 
int _fork (void)
 
int _execve (char *name, char **argv, char **env)
 

Variables

int errno
 
char ** environ = __env
 

Function Documentation

◆ __io_putchar()

int __io_putchar ( int  ch)
Here is the caller graph for this function:

◆ __io_getchar()

int __io_getchar ( void  )
64  { 0 };
Here is the caller graph for this function:

◆ initialise_monitor_handles()

void initialise_monitor_handles ( )
68  {
69 }

◆ _getpid()

int _getpid ( void  )
71  {
72  return 1;
73 }

◆ _kill()

int _kill ( int  pid,
int  sig 
)
75  {
76  errno = EINVAL;
77  return -1;
78 }
Here is the caller graph for this function:

◆ _exit()

void _exit ( int  status)
80  {
81  _kill(status, -1);
82  while (1) {
83  } /* Make sure we hang here */
84 }
Here is the call graph for this function:

◆ _read()

int _read ( int  file,
char *  ptr,
int  len 
)
86  {
87  int DataIdx;
88 
89  for (DataIdx = 0; DataIdx < len; DataIdx++) {
90  *ptr++ = __io_getchar();
91  }
92 
93  return len;
94 }
Here is the call graph for this function:

◆ _write()

int _write ( int  file,
char *  ptr,
int  len 
)
96  {
97  int DataIdx;
98 
99  for (DataIdx = 0; DataIdx < len; DataIdx++) {
100  __io_putchar(*ptr++);
101  }
102  return len;
103 }
Here is the call graph for this function:

◆ _sbrk()

caddr_t _sbrk ( int  incr)
105  {
106  extern char end asm("end");
107  static char *heap_end;
108  char *prev_heap_end;
109 
110  if (heap_end == 0)
111  heap_end = &end;
112 
113  prev_heap_end = heap_end;
114  if (heap_end + incr > stack_ptr) {
115  // write(1, "Heap and stack collision\n", 25);
116  // abort();
117  errno = ENOMEM;
118  return (caddr_t)-1;
119  }
120 
121  heap_end += incr;
122 
123  return (caddr_t)prev_heap_end;
124 }
Here is the caller graph for this function:

◆ _close()

int _close ( int  file)
126  {
127  return -1;
128 }

◆ _fstat()

int _fstat ( int  file,
struct stat *  st 
)
130  {
131  st->st_mode = S_IFCHR;
132  return 0;
133 }

◆ _isatty()

int _isatty ( int  file)
135  {
136  return 1;
137 }

◆ _lseek()

int _lseek ( int  file,
int  ptr,
int  dir 
)
139  {
140  return 0;
141 }

◆ _open()

int _open ( char *  path,
int  flags,
  ... 
)
143  {
144  /* Pretend like we always fail */
145  return -1;
146 }

◆ _wait()

int _wait ( int *  status)
148  {
149  errno = ECHILD;
150  return -1;
151 }

◆ _unlink()

int _unlink ( char *  name)
153  {
154  errno = ENOENT;
155  return -1;
156 }

◆ _times()

int _times ( struct tms *  buf)
158  {
159  return -1;
160 }

◆ _stat()

int _stat ( char *  file,
struct stat *  st 
)
162  {
163  st->st_mode = S_IFCHR;
164  return 0;
165 }

◆ _link()

int _link ( char *  old,
char *  new 
)
167  {
168  errno = EMLINK;
169  return -1;
170 }

◆ _fork()

int _fork ( void  )
172  {
173  errno = EAGAIN;
174  return -1;
175 }

◆ _execve()

int _execve ( char *  name,
char **  argv,
char **  env 
)
177  {
178  errno = ENOMEM;
179  return -1;
180 }

Variable Documentation

◆ errno

int errno

File : syscalls.c

Abstract : System Workbench Minimal System calls file

             For more information about which c-functions
          need which of these lowlevel functions
          please consult the Newlib libc-manual

Environment : System Workbench for MCU

Distribution: The file is distributed as is without any warranty of any kind.

© COPYRIGHT(c) 2014 Ac6

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.
  2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.
  3. Neither the name of Ac6 nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

◆ environ

char** environ = __env
__io_putchar
int __io_putchar(int ch) __attribute__((weak))
createSpeedLookupTable.end
end
Definition: createSpeedLookupTable.py:33
_kill
int _kill(int pid, int sig)
Definition: syscalls.c:75
__io_getchar
int __io_getchar(void)
Definition: syscalls.c:60
errno
int errno
status
static status_t status
Definition: filament_sensor.c:37