建立工程,成功创建两个虚拟串口

This commit is contained in:
ranchuan
2023-06-21 18:00:56 +08:00
commit 3604192d8f
872 changed files with 428764 additions and 0 deletions

View File

@@ -0,0 +1,3 @@
collect (PROJECT_LIB_TESTS device.c)
# vim: expandtab:ts=2:sw=2:smartindent

View File

@@ -0,0 +1,36 @@
/*
* Copyright (c) 2015, Xilinx Inc. and Contributors. All rights reserved.
*
* SPDX-License-Identifier: BSD-3-Clause
*/
#include <unistd.h>
#include "metal-test.h"
#include <metal/device.h>
static int device(void)
{
struct metal_device *device;
struct metal_io_region *io;
uint32_t idcode;
int error;
error = metal_device_open("platform", "f8000000.slcr", &device);
if (error)
return error;
io = metal_device_io_region(device, 0);
if (!io) {
metal_device_close(device);
return -ENODEV;
}
idcode = metal_io_read32(io, 0x530);
metal_log(METAL_LOG_DEBUG, "Read id code %x\n", idcode);
metal_device_close(device);
return 0;
}
METAL_ADD_TEST(device);