From bb28e090cd5521eb4cdc6123d970e35470671213 Mon Sep 17 00:00:00 2001 From: Harald Welte Date: Sun, 17 Nov 2013 20:13:13 +0100 Subject: simtrace: main_factory: Program OTP area with simtrace version --- firmware/Makefile | 3 ++- firmware/src/simtrace/main_factory.c | 24 +++++++++++++++++++++--- 2 files changed, 23 insertions(+), 4 deletions(-) (limited to 'firmware') diff --git a/firmware/Makefile b/firmware/Makefile index 3f7a2e9..350b0dc 100644 --- a/firmware/Makefile +++ b/firmware/Makefile @@ -116,7 +116,8 @@ ifeq ($(BOARD), SIMTRACE) SUBMDL = AT91SAM7S128 TARGET := main_simtrace SRCARM += src/simtrace/iso7816_uart.c src/simtrace/tc_etu.c \ - src/simtrace/sim_switch.c src/simtrace/spi_flash.c + src/simtrace/sim_switch.c src/simtrace/spi_flash.c \ + src/simtrace/prod_info.c SRCARM += src/simtrace/$(TARGET).c endif diff --git a/firmware/src/simtrace/main_factory.c b/firmware/src/simtrace/main_factory.c index 3585fa6..268c45f 100644 --- a/firmware/src/simtrace/main_factory.c +++ b/firmware/src/simtrace/main_factory.c @@ -25,7 +25,6 @@ #include #include #include -#include "../openpcd.h" #include "../simtrace.h" #include #include @@ -33,6 +32,11 @@ #include #include #include +#include + +#include "spi_flash.h" +#include "prod_info.h" + void _init_func(void) { @@ -57,8 +61,22 @@ int _main_dbgu(char key) DEBUGPCRF("main_dbgu"); switch (key) { - case 'f': - spiflash_id(); + case 'g': + for (i = 1; i <= 16; i++) { + int s = spiflash_otp_get_lock(i); + DEBUGPCR("OTP region %d locked: %d", i, s); + } + break; + case 'p': + prod_info_write(0, SIMTRACE_VER(1,3,0), 0); + break; + case 'P': + { + u_int32_t version; + int rc = prod_info_get(&version, NULL); + if (rc >= 0) + DEBUGPCR("Version: 0x%08x\n", version); + } break; case '?': help(); -- cgit v1.2.3