io: kiss I/O thread goodbye
This commit is contained in:
parent
e439172025
commit
3026bfe2f1
3 changed files with 3 additions and 33 deletions
|
@ -38,8 +38,7 @@ ARDIX_SOURCES += \
|
|||
|
||||
ARDIX_ASM_SOURCES += \
|
||||
$(ARDIX_ARCH_PWD)/irq_pend_sv.S \
|
||||
$(ARDIX_ARCH_PWD)/irq_svc.S \
|
||||
$(ARDIX_ARCH_PWD)/syscall.S
|
||||
$(ARDIX_ARCH_PWD)/irq_svc.S
|
||||
|
||||
CFLAGS += \
|
||||
-DARCH_AT91SAM3X8E
|
||||
|
|
|
@ -6,21 +6,13 @@
|
|||
#include <ardix/serial.h>
|
||||
|
||||
/**
|
||||
* Initialize the I/O thread and subsystems.
|
||||
* Must be called after all I/O components have been initialized.
|
||||
* Initialize all basic I/O subsystems.
|
||||
* After a successful return, printk() will be available.
|
||||
*
|
||||
* @returns 0 on success, or a negative number on failure.
|
||||
*/
|
||||
int io_init(void);
|
||||
|
||||
/**
|
||||
* Update the hardware serial buffers if necessary.
|
||||
* This includes copying to and from the main ring buffers.
|
||||
*
|
||||
* @param interface: The serial interface.
|
||||
*/
|
||||
void io_serial_buf_update(struct serial_interface *interface);
|
||||
|
||||
/*
|
||||
* Copyright (c) 2020 Felix Kopp <sandtler@sandtler.club>
|
||||
*
|
||||
|
|
|
@ -1,35 +1,14 @@
|
|||
/* SPDX-License-Identifier: BSD-3-Clause */
|
||||
/* See the end of this file for copyright, licensing, and warranty information. */
|
||||
|
||||
#include <arch/serial.h>
|
||||
|
||||
#include <ardix/io.h>
|
||||
#include <ardix/sched.h>
|
||||
#include <ardix/serial.h>
|
||||
|
||||
#include <toolchain.h>
|
||||
|
||||
static __naked void io_thread_entry(void)
|
||||
{
|
||||
while (1) {
|
||||
io_serial_buf_update(serial_default_interface);
|
||||
|
||||
sched_yield(PROC_QUEUE);
|
||||
}
|
||||
}
|
||||
|
||||
int io_init(void)
|
||||
{
|
||||
int ret;
|
||||
struct process *proc;
|
||||
|
||||
ret = serial_init(serial_default_interface, CONFIG_SERIAL_BAUD);
|
||||
if (ret)
|
||||
return ret;
|
||||
|
||||
proc = sched_process_create(&io_thread_entry);
|
||||
if (proc == NULL)
|
||||
ret = -1;
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue