[include] move almost all of the remainder of top level includes into a subdir
Examples are include/platform.h -> platform/include/platform.h include/target.h -> target/include/target.h The old model generally considered these to be Always There includes, but they're starting to stick out more and more so may as well actually follow the model that most of the rest of the system follows.
This commit is contained in:
72
platform/include/platform.h
Normal file
72
platform/include/platform.h
Normal file
@@ -0,0 +1,72 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Use of this source code is governed by a MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <lk/compiler.h>
|
||||
|
||||
__BEGIN_CDECLS
|
||||
|
||||
typedef enum {
|
||||
HALT_ACTION_HALT = 0, // Spin forever.
|
||||
HALT_ACTION_REBOOT, // Reset the CPU.
|
||||
HALT_ACTION_SHUTDOWN, // Shutdown and power off.
|
||||
} platform_halt_action;
|
||||
|
||||
typedef enum {
|
||||
HALT_REASON_UNKNOWN = 0,
|
||||
HALT_REASON_POR, // Cold-boot
|
||||
HALT_REASON_HW_WATCHDOG, // HW watchdog timer
|
||||
HALT_REASON_LOWVOLTAGE, // LV/Brownout condition
|
||||
HALT_REASON_HIGHVOLTAGE, // High voltage condition.
|
||||
HALT_REASON_THERMAL, // Thermal reason (probably overtemp)
|
||||
HALT_REASON_OTHER_HW, // Other hardware (platform) specific reason
|
||||
HALT_REASON_SW_RESET, // Generic Software Initiated Reboot
|
||||
HALT_REASON_SW_WATCHDOG, // Reboot triggered by a SW watchdog timer
|
||||
HALT_REASON_SW_PANIC, // Reboot triggered by a SW panic or ASSERT
|
||||
HALT_REASON_SW_UPDATE, // SW triggered reboot in order to begin firmware update
|
||||
} platform_halt_reason;
|
||||
|
||||
lk_time_t current_time(void);
|
||||
lk_bigtime_t current_time_hires(void);
|
||||
|
||||
/* super early platform initialization, before almost everything */
|
||||
void platform_early_init(void);
|
||||
|
||||
/* later init, after the kernel has come up */
|
||||
void platform_init(void);
|
||||
|
||||
/* called by the arch init code to get the platform to set up any mmu mappings it may need */
|
||||
void platform_init_mmu_mappings(void);
|
||||
|
||||
/* if the platform has knowledge of what caused the latest reboot, it can report
|
||||
* it to applications with this function. */
|
||||
platform_halt_reason platform_get_reboot_reason(void);
|
||||
|
||||
/* platform_halt is a method which is called from various places in the LK
|
||||
* system, and may be implemented by platforms and called by applications. This
|
||||
* call represents the end of the life of SW for a device; there is no returning
|
||||
* from this function. Callers will provide a reason for the halt, and a
|
||||
* suggested action for the platform to take, but it is the platform's
|
||||
* responsibility to determine the final action taken. For example, in the case
|
||||
* of a failed ASSERT or a panic, LK will call platform halt and suggest a Halt
|
||||
* action, but a release build on a platform with no debug channel may choose to
|
||||
* reboot instead as there is no one to tell about the ASSERT, and no one
|
||||
* waiting to debug the device in its halted state. If not overloaded by the
|
||||
* platform, the default behavior of platform halt will be to dprintf the
|
||||
* reason, and then halt execution by turning off interrupts and spinning
|
||||
* forever.
|
||||
*/
|
||||
void platform_halt(platform_halt_action suggested_action,
|
||||
platform_halt_reason reason) __NO_RETURN;
|
||||
|
||||
/* called during chain loading to make sure drivers and platform is put into a stopped state */
|
||||
void platform_quiesce(void);
|
||||
|
||||
__END_CDECLS
|
||||
|
||||
24
platform/include/platform/debug.h
Normal file
24
platform/include/platform/debug.h
Normal file
@@ -0,0 +1,24 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Use of this source code is governed by a MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <stdbool.h>
|
||||
#include <stdarg.h>
|
||||
#include <lk/compiler.h>
|
||||
|
||||
__BEGIN_CDECLS
|
||||
|
||||
void platform_dputc(char c);
|
||||
int platform_dgetc(char *c, bool wait);
|
||||
|
||||
// Should be available even if the system has panicked.
|
||||
void platform_pputc(char c);
|
||||
int platform_pgetc(char *c, bool wait);
|
||||
|
||||
__END_CDECLS
|
||||
17
platform/include/platform/interrupts.h
Normal file
17
platform/include/platform/interrupts.h
Normal file
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Use of this source code is governed by a MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
status_t mask_interrupt(unsigned int vector);
|
||||
status_t unmask_interrupt(unsigned int vector);
|
||||
|
||||
typedef enum handler_return (*int_handler)(void *arg);
|
||||
|
||||
void register_int_handler(unsigned int vector, int_handler handler, void *arg);
|
||||
20
platform/include/platform/timer.h
Normal file
20
platform/include/platform/timer.h
Normal file
@@ -0,0 +1,20 @@
|
||||
/*
|
||||
* Copyright (c) 2008 Travis Geiselbrecht
|
||||
*
|
||||
* Use of this source code is governed by a MIT-style
|
||||
* license that can be found in the LICENSE file or at
|
||||
* https://opensource.org/licenses/MIT
|
||||
*/
|
||||
#pragma once
|
||||
|
||||
#include <sys/types.h>
|
||||
|
||||
typedef enum handler_return (*platform_timer_callback)(void *arg, lk_time_t now);
|
||||
|
||||
status_t platform_set_periodic_timer(platform_timer_callback callback, void *arg, lk_time_t interval);
|
||||
|
||||
#if PLATFORM_HAS_DYNAMIC_TIMER
|
||||
status_t platform_set_oneshot_timer (platform_timer_callback callback, void *arg, lk_time_t interval);
|
||||
void platform_stop_timer(void);
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user