/* * Copyright (c) 2020 AIIT XUOS Lab * XiUOS is licensed under Mulan PSL v2. * You can use this software according to the terms and conditions of the Mulan PSL v2. * You may obtain a copy of Mulan PSL v2 at: * http://license.coscl.org.cn/MulanPSL2 * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. * See the Mulan PSL v2 for more details. */ /** * @file riscv_test_can.c * @brief support to test can function on aiit-riscv64-board * @version 1.0 * @author AIIT XUOS Lab * @date 2021-04-24 */ #include #ifdef BOARD_AIIT_RISCV_EVB #include #include #include "board.h" #include "connect_ch438.h" static struct Bus *bus; static struct HardwareDev *dev; static struct Driver *drv; static int32 Timer = NONE; static uint8 idx = 0; static void Ch438Read(void *parameter) { uint8 rev_len; uint8 ext_uart_no = 3; static uint8 dat,i,count; struct BusBlockReadParam read_param; static uint8 Ch438Buff[8][BUFFSIZE]; while (1) { read_param.buffer = Ch438Buff[3]; rev_len = BusDevReadData(dev, &read_param); for(count = 0 ;count < rev_len ;count++) { KPrintf("%#2x ",Ch438Buff[3][count]); KPrintf("\n"); } for(i=0;i