tests: boards: add SysID test app for altera_max10 board
Add test application to demonstrate the usage of Nios-II System ID soft IP. Signed-off-by: Ramakrishna Pallala <ramakrishna.pallala@intel.com>
This commit is contained in:
parent
27aced168d
commit
eace9ede03
5
tests/boards/altera_max10/sysid/CMakeLists.txt
Normal file
5
tests/boards/altera_max10/sysid/CMakeLists.txt
Normal file
|
@ -0,0 +1,5 @@
|
|||
include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)
|
||||
project(NONE)
|
||||
|
||||
FILE(GLOB app_sources src/*.c)
|
||||
target_sources(app PRIVATE ${app_sources})
|
2
tests/boards/altera_max10/sysid/README.txt
Normal file
2
tests/boards/altera_max10/sysid/README.txt
Normal file
|
@ -0,0 +1,2 @@
|
|||
Build test for:
|
||||
Altera Nios-II System ID soft IP core.
|
2
tests/boards/altera_max10/sysid/prj.conf
Normal file
2
tests/boards/altera_max10/sysid/prj.conf
Normal file
|
@ -0,0 +1,2 @@
|
|||
CONFIG_ALTERA_AVALON_SYSID=y
|
||||
CONFIG_ZTEST=y
|
34
tests/boards/altera_max10/sysid/src/sysid.c
Normal file
34
tests/boards/altera_max10/sysid/src/sysid.c
Normal file
|
@ -0,0 +1,34 @@
|
|||
/*
|
||||
* Copyright (c) 2017 Intel Corporation
|
||||
*
|
||||
* SPDX-License-Identifier: Apache-2.0
|
||||
*/
|
||||
|
||||
#include <zephyr.h>
|
||||
#include <ztest.h>
|
||||
|
||||
#include "altera_avalon_sysid.h"
|
||||
|
||||
void testing_sysid(void)
|
||||
{
|
||||
s32_t sysid, status = TC_FAIL;
|
||||
|
||||
sysid = alt_avalon_sysid_test();
|
||||
if (!sysid) {
|
||||
status = TC_PASS;
|
||||
TC_PRINT("[SysID] hardware and software appear to be in sync\n");
|
||||
} else if (sysid > 0) {
|
||||
TC_PRINT("[SysID] software appears to be older than hardware\n");
|
||||
} else {
|
||||
TC_PRINT("[SysID] hardware appears to be older than software\n");
|
||||
}
|
||||
|
||||
zassert_equal(status, TC_PASS, "SysID test failed");
|
||||
}
|
||||
|
||||
void test_main(void)
|
||||
{
|
||||
ztest_test_suite(nios2_sysid_test_suite,
|
||||
ztest_unit_test(testing_sysid));
|
||||
ztest_run_test_suite(nios2_sysid_test_suite);
|
||||
}
|
4
tests/boards/altera_max10/sysid/testcase.yaml
Normal file
4
tests/boards/altera_max10/sysid/testcase.yaml
Normal file
|
@ -0,0 +1,4 @@
|
|||
tests:
|
||||
test:
|
||||
platform_whitelist: altera_max10
|
||||
tags: sysid
|
Loading…
Reference in a new issue