diff options
| author | Meco Jianting Man <[email protected]> | 2021-02-27 01:02:48 -0600 |
|---|---|---|
| committer | GitHub <[email protected]> | 2021-02-27 01:02:48 -0600 |
| commit | 8932ffdb96b793031bbc71bb3bd23202939fcb2c (patch) | |
| tree | 33ac8cd4afac62c449384ed20f2af94ab0b90708 /components/libc/compilers/armlibc | |
| parent | bc28df8b350f2118f418b966df0843c7f2c02496 (diff) | |
| parent | 2bf53d315d62bd199c01fd2d6a7f05d1a6712153 (diff) | |
Merge pull request #21 from RT-Thread/master
pr
Diffstat (limited to 'components/libc/compilers/armlibc')
| -rw-r--r-- | components/libc/compilers/armlibc/sys/types.h | 6 | ||||
| -rw-r--r-- | components/libc/compilers/armlibc/syscalls.c | 31 |
2 files changed, 37 insertions, 0 deletions
diff --git a/components/libc/compilers/armlibc/sys/types.h b/components/libc/compilers/armlibc/sys/types.h index d1e457b36f..491445d72b 100644 --- a/components/libc/compilers/armlibc/sys/types.h +++ b/components/libc/compilers/armlibc/sys/types.h @@ -25,4 +25,10 @@ typedef long signed int ssize_t; /* Used for a count of bytes or an error #endif typedef unsigned long useconds_t; /* microseconds (unsigned) */ +typedef unsigned long dev_t; + +typedef unsigned int u_int; +typedef unsigned char u_char; +typedef unsigned long u_long; + #endif diff --git a/components/libc/compilers/armlibc/syscalls.c b/components/libc/compilers/armlibc/syscalls.c index d17460b413..8addb3e163 100644 --- a/components/libc/compilers/armlibc/syscalls.c +++ b/components/libc/compilers/armlibc/syscalls.c @@ -13,6 +13,7 @@ * RT_USING_DFS is not defined * 2020-02-13 Meco Man re-implement exit() and abort() * 2020-02-14 Meco Man implement _sys_tmpnam() + * 2020-02-25 Meco Man add multithreaded protection */ #include <string.h> @@ -41,6 +42,36 @@ const char __stdin_name[] = "STDIN"; const char __stdout_name[] = "STDOUT"; const char __stderr_name[] = "STDERR"; +#ifdef RT_USING_HEAP +int _mutex_initialize(rt_mutex_t *m) +{ + *m = rt_mutex_create("_mutex_", RT_IPC_FLAG_PRIO); + if(*m == RT_NULL) + { + return 0; + } + else + { + return 1; + } +} + +void _mutex_acquire(rt_mutex_t *m) +{ + rt_mutex_take(*m, RT_WAITING_FOREVER); +} + +void _mutex_release(rt_mutex_t *m) +{ + rt_mutex_release(*m); +} + +void _mutex_free(rt_mutex_t *m) +{ + rt_mutex_delete(*m); +} +#endif + /** * required by fopen() and freopen(). * |
