File: system.h

package info (click to toggle)
crust-firmware 0.6-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,900 kB
  • sloc: ansic: 19,341; yacc: 596; lex: 479; makefile: 334; asm: 215; sh: 136; python: 42
file content (65 lines) | stat: -rw-r--r-- 1,530 bytes parent folder | download | duplicates (2)
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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
/*
 * Copyright © 2017-2022 The Crust Firmware Authors.
 * SPDX-License-Identifier: BSD-3-Clause OR GPL-2.0-only
 */

#ifndef COMMON_SYSTEM_H
#define COMMON_SYSTEM_H

#include <stdint.h>

enum {
	SD_NONE,    /**< Perform no extra suspend actions. */
	SD_OSC24M,  /**< Power down the high-speed oscillator and PLLs. */
	SD_AVCC,    /**< Gate the AVCC power domain. */
	SD_VDD_SYS, /**< Gate and reset the VDD_SYS power domain. */
};

/**
 * Perform system state management.
 *
 * This is the main loop of the firmware, which never returns.
 *
 * @param exception Exception information provided by startup assembly code.
 */
noreturn void system_state_machine(uint32_t exception);

/**
 * Reboot the board, including the SoC and external peripherals.
 *
 * Must only be called while the system is awake.
 */
void system_reboot(void);

/**
 * Reset the SoC, including all CPUs and internal peripherals.
 *
 * Must only be called while the system is awake.
 */
void system_reset(void);

/**
 * Shut down the SoC, and turn off all possible power domains.
 *
 * Must only be called while the system is awake.
 */
void system_shutdown(void);

/**
 * Suspend the SoC, and turn off all non-wakeup power domains.
 *
 * Must only be called while the system is awake.
 */
void system_suspend(void);

/**
 * Wake the system.
 *
 * Transition to a state where the rich OS is awake and running, by resetting
 * the SoC or the entire board if necessary.
 *
 * May be called at any time.
 */
void system_wake(void);

#endif /* COMMON_SYSTEM_H */