fw: Introduce reset()

- New function reset.c:reset(). Move code from syscall handler switch
  to this function.

- Rename resetinfo.h to reset.h.
This commit is contained in:
Michael Cardell Widerkrantz 2025-04-29 17:10:19 +02:00
parent 9d1bbffbaa
commit f373ad3f68
No known key found for this signature in database
GPG key ID: D3DB3DDF57E704E5
9 changed files with 57 additions and 36 deletions

View file

@ -0,0 +1,30 @@
// Copyright (C) 2025 - Tillitis AB
// SPDX-License-Identifier: GPL-2.0-only
#ifndef TKEY_RESET_H
#define TKEY_RESET_H
#include <stddef.h>
#include <stdint.h>
#define TK1_MMIO_RESETINFO_BASE 0xd0000f00
#define TK1_MMIO_RESETINFO_SIZE 0x100
enum reset_start {
START_DEFAULT = 0, // Probably cold boot
START_FLASH0 = 1,
START_FLASH1 = 2,
START_FLASH0_VER = 3,
START_FLASH1_VER = 4,
START_CLIENT = 5,
START_CLIENT_VER = 6,
};
struct reset {
uint32_t type; // Reset type
uint8_t app_digest[32]; // Program digest
uint8_t next_app_data[220]; // Data to leave around for next app
};
int reset(struct reset *userreset, size_t nextlen);
#endif