summaryrefslogtreecommitdiff
path: root/FreeRTOS/Demo/RISC-V_RV32_SiFive_HiFive1-RevB_FreedomStudio/freedom-metal/src/shutdown.c
blob: c3b5255a7a39661892ee7259f46aa9e8ff8d744e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
/* Copyright 2018 SiFive, Inc */
/* SPDX-License-Identifier: Apache-2.0 */

#include <metal/machine.h>
#include <metal/shutdown.h>

extern __inline__ void __metal_shutdown_exit(const struct __metal_shutdown *sd, int code);

#if defined(__METAL_DT_SHUTDOWN_HANDLE)
void metal_shutdown(int code)
{
    __metal_shutdown_exit(__METAL_DT_SHUTDOWN_HANDLE, code);
}
#else
#pragma message("There is no defined shutdown mechanism, metal_shutdown() will spin.")
void metal_shutdown(int code)
{
    while (1) {
      __asm__ volatile ("nop");
    }
}
#endif