mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-08-07 22:22:29 -04:00
fw: Add syscalls
Adds: - SYSCALL_RESET - SYSCALL_SET_LED Co-authored-by: Michael Cardell Widerkrantz <mc@tillitis.se>
This commit is contained in:
parent
969df46315
commit
d82c3a706e
10 changed files with 283 additions and 9 deletions
30
hw/application_fpga/fw/tk1/syscall_handler.c
Normal file
30
hw/application_fpga/fw/tk1/syscall_handler.c
Normal file
|
@ -0,0 +1,30 @@
|
|||
/*
|
||||
* Copyright (C) 2025 - Tillitis AB
|
||||
* SPDX-License-Identifier: GPL-2.0-only
|
||||
*/
|
||||
|
||||
#include "../tk1/assert.h"
|
||||
#include "../tk1/led.h"
|
||||
#include "../tk1/syscall_num.h"
|
||||
#include "../tk1/types.h"
|
||||
|
||||
// clang-format off
|
||||
static volatile uint32_t *system_reset = (volatile uint32_t *)TK1_MMIO_TK1_SYSTEM_RESET;
|
||||
// clang-format on
|
||||
|
||||
int32_t syscall_handler(uint32_t number, uint32_t arg1)
|
||||
{
|
||||
switch (number) {
|
||||
case TK1_SYSCALL_RESET:
|
||||
*system_reset = 1;
|
||||
return 0;
|
||||
case TK1_SYSCALL_SET_LED:
|
||||
set_led(arg1);
|
||||
return 0;
|
||||
default:
|
||||
assert(1 == 2);
|
||||
}
|
||||
|
||||
assert(1 == 2);
|
||||
return -1; // This should never run
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue