/** * @brief Write characters to a file * * All output is currently directed to UART_0, independent of the given file descriptor. * The write call will further block until the byte is actually written to the UART. * * TODO: implement more sophisticated write call. * * @param r TODO * @param fd TODO * @param data TODO * @param int TODO * * @return TODO */ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count) { for (int i = 0; i < count; i++) { uart_write_blocking(UART_0, ((char *)data)[i]); } return count; }
int io_arch_puts(char *data, int size) { for (int i = 0; i < size; i++) { uart_write_blocking(STDIO, data[i]); } return size; }
/** * @brief Write characters to a file * * All output is currently directed to UART_0, independent of the given file descriptor. * The write call will further block until the byte is actually written to the UART. * * TODO: implement more sophisticated write call. * * @param r TODO * @param fd TODO * @param data TODO * @param int TODO * * @return TODO */ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count) { char *c = (char*)data; for (int i = 0; i < count; i++) { uart_write_blocking(STDIO, c[i]); } return count; }
/** * @brief Write characters to a file * * All output is currently directed to UART_0, independent of the given file descriptor. * The write call will further block until the byte is actually written to the UART. * * TODO: implement more sophisticated write call. * * @param r TODO * @param fd TODO * @param data TODO * @param int TODO * * @return TODO */ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count) { int i = 0; while (i < count) { uart_write_blocking(STDIO, ((char*)data)[i++]); } return i; }
/** * @brief Write characters to a file * * All output is currently directed to UART_0, independent of the given file descriptor. * The write call will further block until the byte is actually written to the UART. * * TODO: implement more sophisticated write call. * * @param r TODO * @param fd TODO * @param data TODO * @param int TODO * * @return TODO */ int _write_r(struct _reent *r, int fd, const void *data, unsigned int count) { if ((fd != STDOUT_FILENO) && (fd != STDERR_FILENO)) { r->_errno = EBADF; return -1; } r->_errno = 0; for (unsigned i = 0; i < count; i++) { uart_write_blocking(STDIO, ((char*)data)[i]); } return count; }