summaryrefslogtreecommitdiffhomepage
path: root/src/neboot-cpu-api.c
blob: a3209aab3f4d1a42a25231cf0b6dda125e4eeb22 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// Copyright 2024-2025, Amlal El Mahrouss (amlal@nekernel.org)
// Distributed under the Apache Software License, Version 2.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.apache.org/licenses/LICENSE-2.0)
// Official repository: https://github.com/nekernel-org/neboot

#include <include/boot.h>

/// @brief Restarts the computer.
/// @param none.
void nb_restart_machine(void) {
#ifdef __COMPILE_RISCV__
  volatile uint32_t* brd_pwr = (volatile uint32_t*) 0x100000;
  *brd_pwr                   = 0x7777;  // send reboot signal from DMA.

  while (1) {
    asm volatile("wfi");
  }
#else
  /// @todo add your reset vector here.
  while (1);
#endif
}