Exemple #1
0
void uart_stdio_init(void) {
    #ifndef RTT_STDIO_DISABLE_STDIN
    stdin_enabled = 1;
    #endif

    #ifdef RTT_STDIO_ENABLE_BLOCKING_STDOUT
    blocking_stdout = 1;
    #endif

#if MODULE_VFS
    int fd;
    fd = vfs_bind(STDIN_FILENO, O_RDONLY, &rtt_stdio_vfs_ops, (void *)STDIN_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
    fd = vfs_bind(STDOUT_FILENO, O_WRONLY, &rtt_stdio_vfs_ops, (void *)STDOUT_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
    fd = vfs_bind(STDERR_FILENO, O_WRONLY, &rtt_stdio_vfs_ops, (void *)STDERR_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
#endif

    /* the mutex should start locked */
    mutex_lock(&_rx_mutex);
}
Exemple #2
0
int ext2_mount(const char *dir, int flags, void *_args)
{
    printk("ext2_mount(dir=%s, flags=%x, args=%p)\n", dir, flags, _args);

    struct {
        char *dev;
        char *opt;
    } *args = _args;

    struct vnode vnode;
    struct inode *dev;
    int err;

    struct uio uio = {0};   /* FIXME */

    if ((err = vfs_lookup(args->dev, &uio, &vnode, NULL)))
        goto error;

    if ((err = vfs_vget(&vnode, &dev)))
        goto error;

    struct inode *fs;

    if ((err = ext2fs.load(dev, &fs)))
        goto error;

    return vfs_bind(dir, fs);

error:
    return err;
}
Exemple #3
0
void uart_stdio_init(void)
{
#ifndef USE_ETHOS_FOR_STDIO
    uart_init(UART_STDIO_DEV, UART_STDIO_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe);
#else
    uart_init(ETHOS_UART, ETHOS_BAUDRATE, (uart_rx_cb_t) isrpipe_write_one, &uart_stdio_isrpipe);
#endif
#if MODULE_VFS
    int fd;
    fd = vfs_bind(STDIN_FILENO, O_RDONLY, &uart_stdio_vfs_ops, (void *)STDIN_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
    fd = vfs_bind(STDOUT_FILENO, O_WRONLY, &uart_stdio_vfs_ops, (void *)STDOUT_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
    fd = vfs_bind(STDERR_FILENO, O_WRONLY, &uart_stdio_vfs_ops, (void *)STDERR_FILENO);
    if (fd < 0) {
        /* How to handle errors on init? */
    }
#endif
}