1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
4 #include <metal/machine/platform.h>
6 #ifdef METAL_SIFIVE_TEST0
8 #include <metal/machine.h>
12 #include <metal/drivers/sifive_test0.h>
15 void __metal_driver_sifive_test0_exit(const struct __metal_shutdown *sd, int code) __attribute__((noreturn));
16 void __metal_driver_sifive_test0_exit(const struct __metal_shutdown *sd, int code)
18 long base = __metal_driver_sifive_test0_base(sd);
19 uint32_t out = (code << 16) + (code == 0 ? 0x5555 : 0x3333);
21 __METAL_ACCESS_ONCE((__metal_io_u32 *)(base + METAL_SIFIVE_TEST0_FINISHER_OFFSET)) = out;
25 __METAL_DEFINE_VTABLE(__metal_driver_vtable_sifive_test0) = {
26 .shutdown.exit = &__metal_driver_sifive_test0_exit,
28 #endif /* METAL_SIFIVE_TEST0 */
30 typedef int no_empty_translation_units;