blob: 7a43437b7875d7fa5ceba2cb08affef923e46001 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
|
/* Copyright 2018 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */
#ifndef METAL__SHUTDOWN_H
#define METAL__SHUTDOWN_H
/*!
* @file shutdown.h
* @brief API for shutting down a machine
*/
struct __metal_shutdown;
struct __metal_shutdown_vtable {
void (*exit)(const struct __metal_shutdown *sd, int code)
__attribute__((noreturn));
};
struct __metal_shutdown {
const struct __metal_shutdown_vtable *vtable;
};
__inline__ void __metal_shutdown_exit(const struct __metal_shutdown *sd,
int code) __attribute__((noreturn));
__inline__ void __metal_shutdown_exit(const struct __metal_shutdown *sd,
int code) {
sd->vtable->exit(sd, code);
}
/*!
* @brief The public METAL shutdown interface
*
* Shuts down the machine, if the machine enables an interface for
* shutting down. When no interface is provided, will cause the machine
* to spin indefinitely.
*
* @param code The return code to set. 0 indicates program success.
*/
void metal_shutdown(int code) __attribute__((noreturn));
#endif
|