summaryrefslogtreecommitdiff
path: root/ports/risc-v32/gnu/example_build/qemu_virt/board.c
blob: fc75de6684c95d972609ada1f1f4c226191f1fad (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
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/***************************************************************************
 * Copyright (c) 2025 10xEngineers
 *
 * This program and the accompanying materials are made available under the
 * terms of the MIT License which is available at
 * https://opensource.org/licenses/MIT.
 *
 * SPDX-License-Identifier: MIT
 **************************************************************************/

#include "plic.h"
#include "hwtimer.h"
#include "uart.h"
#include <stdint.h>
#include <stddef.h>

void *memset(const void *des, int c,size_t n)
{
    if((des == NULL) || n <=0)
            return (void*)des;
    char* t = (char*)des;
    int i;
    for(i=0;i<n;i++)
        t[i]=c;
    return t;
}


int board_init(void)
{
	int ret;
	ret = plic_init();
	if(ret)
		return ret;
	ret = uart_init();
	if(ret)
		return ret;
	ret = hwtimer_init();
	if(ret)
		return ret;
	return 0;
}