summaryrefslogtreecommitdiff
path: root/libcpu/risc-v/common/serial/serial-early-sbi.c
blob: afbe8d39ab23c810408b1638e9867a7bdea1db9d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
/*
 * Copyright (c) 2006-2023, RT-Thread Development Team
 *
 * SPDX-License-Identifier: Apache-2.0
 *
 * Change Logs:
 * Date           Author       Notes
 * 2023-01-30     GuEe-GUI     first version
 */

#include <rtdevice.h>

#include <sbi.h>

static void sbi_early_console_putchar(void *data, char c)
{
    sbi_console_putchar(c);
}

static rt_err_t sbi_early_setup(struct rt_fdt_earlycon *con, const char *options)
{
    con->console_putc = sbi_early_console_putchar;

    return RT_EOK;
}
RT_FDT_EARLYCON_EXPORT(sbi, "sbi", "riscv,sbi-console", sbi_early_setup);