]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/gloss/sys_write.c
Update RISCC-V-RV32-SiFive_HiFive1_FreedomStudio project to latest tools and metal...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_FreedomStudio / freedom-metal / gloss / sys_write.c
1 #include <metal/tty.h>
2 #include <sys/types.h>
3 #include <errno.h>
4 #include <unistd.h>
5
6 /* Write to a file.  */
7 ssize_t
8 _write(int file, const void *ptr, size_t len)
9 {
10   if (file != STDOUT_FILENO) {
11     errno = ENOSYS;
12     return -1;
13   }
14
15   const char *bptr = ptr;
16   for (size_t i = 0; i < len; ++i)
17     metal_tty_putc(bptr[i]);
18   return 0;
19 }