mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2025-12-15 16:49:15 -05:00
fpga/fw: Rename system_mode to app_mode
Rename `system_mode` to `app_mode` as to not confuse it with syscall or firmware mode. When `app_mode` is `1`/`true` we are in app mode.
This commit is contained in:
parent
19ae709c81
commit
97de5e68fd
14 changed files with 84 additions and 84 deletions
|
|
@ -211,7 +211,7 @@ Typical expected use scenario:
|
|||
uses no more automatic variables.
|
||||
|
||||
8. Firmware starts the application by first switching from firmware
|
||||
mode to application mode by writing to the `SYSTEM_MODE_CTRL`
|
||||
mode to application mode by writing to the `APP_MODE_CTRL`
|
||||
register. In this mode the MMIO region is restricted, e.g. some
|
||||
registers are removed (`UDS`), and some are switched from
|
||||
read/write to read-only (see [the memory
|
||||
|
|
|
|||
|
|
@ -18,7 +18,7 @@ volatile uint32_t *tk1name1 = (volatile uint32_t *)TK1_MMIO_TK1_NAME1;
|
|||
volatile uint32_t *uds = (volatile uint32_t *)TK1_MMIO_UDS_FIRST;
|
||||
volatile uint32_t *cdi = (volatile uint32_t *)TK1_MMIO_TK1_CDI_FIRST;
|
||||
volatile uint32_t *udi = (volatile uint32_t *)TK1_MMIO_TK1_UDI_FIRST;
|
||||
volatile uint32_t *system_mode_ctrl = (volatile uint32_t *)TK1_MMIO_TK1_SYSTEM_MODE_CTRL;
|
||||
volatile uint32_t *app_mode_ctrl = (volatile uint32_t *)TK1_MMIO_TK1_APP_MODE_CTRL;
|
||||
volatile uint8_t *fw_ram = (volatile uint8_t *)TK1_MMIO_FW_RAM_BASE;
|
||||
volatile uint32_t *timer = (volatile uint32_t *)TK1_MMIO_TIMER_TIMER;
|
||||
volatile uint32_t *timer_prescaler = (volatile uint32_t *)TK1_MMIO_TIMER_PRESCALER;
|
||||
|
|
@ -305,9 +305,9 @@ int main(void)
|
|||
}
|
||||
}
|
||||
|
||||
uint32_t sw = *system_mode_ctrl;
|
||||
uint32_t sw = *app_mode_ctrl;
|
||||
if (sw != 0) {
|
||||
failmsg("system_mode_ctrl is not 0 in fw mode");
|
||||
failmsg("app_mode_ctrl is not 0 in fw mode");
|
||||
anyfailed = 1;
|
||||
}
|
||||
|
||||
|
|
@ -317,11 +317,11 @@ int main(void)
|
|||
// Turn on application mode.
|
||||
// -------------------------
|
||||
|
||||
*system_mode_ctrl = 1;
|
||||
*app_mode_ctrl = 1;
|
||||
|
||||
sw = *system_mode_ctrl;
|
||||
sw = *app_mode_ctrl;
|
||||
if (sw != 0xffffffff) {
|
||||
failmsg("system_mode_ctrl is not 0xffffffff in app mode");
|
||||
failmsg("app_mode_ctrl is not 0xffffffff in app mode");
|
||||
anyfailed = 1;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -13,7 +13,7 @@
|
|||
|
||||
// clang-format off
|
||||
static volatile uint32_t *uds = (volatile uint32_t *)TK1_MMIO_UDS_FIRST;
|
||||
static volatile uint32_t *system_mode_ctrl = (volatile uint32_t *)TK1_MMIO_TK1_SYSTEM_MODE_CTRL;
|
||||
static volatile uint32_t *app_mode_ctrl = (volatile uint32_t *)TK1_MMIO_TK1_APP_MODE_CTRL;
|
||||
static volatile uint32_t *name0 = (volatile uint32_t *)TK1_MMIO_TK1_NAME0;
|
||||
static volatile uint32_t *name1 = (volatile uint32_t *)TK1_MMIO_TK1_NAME1;
|
||||
static volatile uint32_t *ver = (volatile uint32_t *)TK1_MMIO_TK1_VERSION;
|
||||
|
|
@ -345,7 +345,7 @@ static void run(const struct context *ctx)
|
|||
// clang-format on
|
||||
|
||||
// Flip over to application mode
|
||||
*system_mode_ctrl = 1;
|
||||
*app_mode_ctrl = 1;
|
||||
|
||||
// XXX Firmware stack now no longer available
|
||||
// Don't use any function calls!
|
||||
|
|
|
|||
|
|
@ -108,9 +108,9 @@
|
|||
#define TK1_MMIO_TK1_NAME1 0xff000004
|
||||
#define TK1_MMIO_TK1_VERSION 0xff000008
|
||||
|
||||
// Deprecated - use _SYSTEM_MODE_CTRL instead
|
||||
// Deprecated - use _APP_MODE_CTRL instead
|
||||
#define TK1_MMIO_TK1_SWITCH_APP 0xff000020
|
||||
#define TK1_MMIO_TK1_SYSTEM_MODE_CTRL 0xff000020
|
||||
#define TK1_MMIO_TK1_APP_MODE_CTRL 0xff000020
|
||||
|
||||
#define TK1_MMIO_TK1_LED 0xff000024
|
||||
#define TK1_MMIO_TK1_LED_R_BIT 2
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue