mirror of
https://github.com/trezor/trezor-firmware.git
synced 2025-02-15 09:02:02 +00:00
feat(core): add powerctl_suspend syscall
[no changelog]
This commit is contained in:
parent
f3793fd8c4
commit
fc2f9c5949
@ -51,6 +51,10 @@
|
||||
#include <sec/optiga.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_POWERCTL
|
||||
#include <sys/powerctl.h>
|
||||
#endif
|
||||
|
||||
#ifdef USE_RGB_LED
|
||||
#include <io/rgb_led.h>
|
||||
#endif
|
||||
@ -673,6 +677,12 @@ __attribute((no_stack_protector)) void syscall_handler(uint32_t *args,
|
||||
firmware_hash_callback_wrapper, callback_context);
|
||||
} break;
|
||||
|
||||
#ifdef USE_POWERCTL
|
||||
case SYSCALL_POWERCTL_SUSPEND: {
|
||||
powerctl_suspend();
|
||||
} break;
|
||||
#endif
|
||||
|
||||
default:
|
||||
system_exit_fatal("Invalid syscall", __FILE__, __LINE__);
|
||||
break;
|
||||
|
@ -139,6 +139,8 @@ typedef enum {
|
||||
SYSCALL_FIRMWARE_GET_VENDOR,
|
||||
SYSCALL_FIRMWARE_CALC_HASH,
|
||||
|
||||
SYSCALL_POWERCTL_SUSPEND,
|
||||
|
||||
} syscall_number_t;
|
||||
|
||||
#endif // SYSCALL_NUMBERS_H
|
||||
|
@ -645,4 +645,16 @@ secbool firmware_calc_hash(const uint8_t *challenge, size_t challenge_len,
|
||||
SYSCALL_FIRMWARE_CALC_HASH);
|
||||
}
|
||||
|
||||
// =============================================================================
|
||||
// powerctl.h
|
||||
// =============================================================================
|
||||
|
||||
#ifdef USE_POWERCTL
|
||||
|
||||
#include <sys/powerctl.h>
|
||||
|
||||
void powerctl_suspend(void) { syscall_invoke0(SYSCALL_POWERCTL_SUSPEND); }
|
||||
|
||||
#endif // USE_POWERCTL
|
||||
|
||||
#endif // KERNEL_MODE
|
||||
|
Loading…
Reference in New Issue
Block a user