APM:Libraries
syscalls.h
Go to the documentation of this file.
1 #include "stm32f4xx.h"
2 #include <reent.h>
3 #include <stdbool.h>
4 #include <errno.h>
5 #include <stdlib.h>
6 #include <sys/types.h>
7 #include <sys/stat.h>
8 #include <hal_types.h>
9 
10 #ifdef __cplusplus
11  extern "C" {
12 #endif
13 
14 int _kill(int pid, int sig);
15 
16 void _exit(int status);
17 int _getpid(void);
18 
19 static inline caddr_t get_stack_top(void)
20 {
21 // return (char*) __get_MSP(); -- let use current stack
22  uint32_t sp;
23  asm volatile ("mov %0, sp\n\t" : "=rm" (sp) );
24  return (caddr_t)sp;
25 }
26 
27 caddr_t _sbrk(int nbytes);
28 caddr_t sbrk_ccm(int nbytes);
29 
30 int _open(const char *path, int flags, ...);
31 int _close(int fd);
32 int _fstat(int fd, struct stat *st);
33 int _isatty(int fd);
34 int isatty(int fd);
35 int _lseek(int fd, off_t pos, int whence);
36 unsigned char getch(void);
37 int _read(int fd, char *buf, size_t cnt);
38 void putch(unsigned char c);
39 
40 void cgets(char *s, int bufsize);
41 int _write(int fd, const char *buf, size_t cnt);
42 //char *fgets(char *s, int bufsize, void *f);
43 void clock_gettime(uint32_t a1, void *a2);
44 
45 
46 #pragma pack(push, 1)
47 union udid {
48  uint32_t serial[3];
49  uint8_t data[12];
50 };
51 #pragma pack(pop)
52 
53 void get_board_serial(uint8_t *serialid);
54 int val_read(void *dest, volatile const void *src, int bytes);
55 
56 #ifdef __cplusplus
57  }
58 #endif
void putch(unsigned char c)
Definition: system.cpp:139
caddr_t sbrk_ccm(int nbytes)
Definition: syscalls.c:121
void cgets(char *s, int bufsize)
Definition: syscalls.c:158
int _lseek(int fd, off_t pos, int whence)
Definition: syscalls.c:153
void get_board_serial(uint8_t *serialid)
Definition: syscalls.c:217
int _open(const char *path, int flags,...)
Definition: syscalls.c:132
void _exit(int status)
Definition: syscalls.c:54
Definition: syscalls.h:47
void clock_gettime(uint32_t a1, void *a2)
Definition: syscalls.c:201
uint32_t serial[3]
Definition: syscalls.h:48
int _isatty(int fd)
Definition: syscalls.c:145
int _write(int fd, const char *buf, size_t cnt)
Definition: syscalls.c:191
static caddr_t get_stack_top(void)
Definition: syscalls.h:19
int _kill(int pid, int sig)
Definition: syscalls.c:48
uint8_t data[12]
Definition: syscalls.h:49
int _fstat(int fd, struct stat *st)
Definition: syscalls.c:140
int stat(const char *name, struct stat *buf)
Display struct stat, from POSIX stat(0 or fstat(), in ASCII. NOT POSIX.
Definition: posix.c:1319
int isatty(int fd)
Test POSIX fileno if it is a Serial Console/TTY.
Definition: posix.c:185
int _getpid(void)
Definition: syscalls.c:59
unsigned char getch(void)
Definition: system.cpp:120
caddr_t _sbrk(int nbytes)
Definition: syscalls.c:127
int _close(int fd)
Definition: syscalls.c:136
int _read(int fd, char *buf, size_t cnt)
Definition: system.cpp:126
int val_read(void *dest, volatile const void *src, int bytes)
Definition: syscalls.c:203