]> git.sur5r.net Git - freertos/blob - FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1_FreedomStudio/freedom-metal/metal/shutdown.h
Update RISCC-V-RV32-SiFive_HiFive1_FreedomStudio project to latest tools and metal...
[freertos] / FreeRTOS / Demo / RISC-V_RV32_SiFive_HiFive1_FreedomStudio / freedom-metal / metal / shutdown.h
1 /* Copyright 2018 SiFive, Inc */
2 /* SPDX-License-Identifier: Apache-2.0 */
3
4 #ifndef METAL__SHUTDOWN_H
5 #define METAL__SHUTDOWN_H
6
7 /*!
8  * @file shutdown.h
9  * @brief API for shutting down a machine
10  */
11
12 struct __metal_shutdown;
13
14 struct __metal_shutdown_vtable {
15     void (*exit)(const struct __metal_shutdown *sd, int code) __attribute__((noreturn));
16 };
17
18 struct __metal_shutdown {
19     const struct __metal_shutdown_vtable *vtable;
20 };
21
22 __inline__ void __metal_shutdown_exit(const struct __metal_shutdown *sd, int code) __attribute__((noreturn));
23 __inline__ void __metal_shutdown_exit(const struct __metal_shutdown *sd, int code) { sd->vtable->exit(sd, code); }
24
25 /*!
26  * @brief The public METAL shutdown interface
27  *
28  * Shuts down the machine, if the machine enables an interface for
29  * shutting down. When no interface is provided, will cause the machine
30  * to spin indefinitely.
31  *
32  * @param code The return code to set. 0 indicates program success.
33  */
34 void metal_shutdown(int code) __attribute__((noreturn));
35
36 #endif