summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHarald Welte <laforge@gnumonks.org>2013-11-17 20:13:13 +0100
committerHarald Welte <laforge@gnumonks.org>2013-11-17 20:13:13 +0100
commitbb28e090cd5521eb4cdc6123d970e35470671213 (patch)
treeef20732c82d7e6e2c260345edee4ead24c5063d8
parent54c248f97ac275469b667e2b17dedcaf013b8741 (diff)
simtrace: main_factory: Program OTP area with simtrace version
-rw-r--r--firmware/Makefile3
-rw-r--r--firmware/src/simtrace/main_factory.c24
2 files changed, 23 insertions, 4 deletions
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 <os/led.h>
#include <os/pcd_enumerate.h>
#include <os/usb_handler.h>
-#include "../openpcd.h"
#include "../simtrace.h"
#include <os/main.h>
#include <os/pio_irq.h>
@@ -33,6 +32,11 @@
#include <simtrace/tc_etu.h>
#include <simtrace/iso7816_uart.h>
#include <simtrace/sim_switch.h>
+#include <simtrace/prod_info.h>
+
+#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();
personal git repositories of Harald Welte. Your mileage may vary