Change in ...simtrace2[master]: add new board and app for gpio testing on octsimtest board

2019-07-30 Thread laforge
laforge has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/c/simtrace2/+/14969 )

Change subject: add new board and app for gpio testing on octsimtest board
..

add new board and app for gpio testing on octsimtest board

Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
---
M firmware/README.txt
A firmware/apps/gpio_test/Makefile
A firmware/apps/gpio_test/gpio_test.c
A firmware/apps/gpio_test/main.c
A firmware/apps/gpio_test/usb_strings.txt
A firmware/libboard/octsimtest/include/board.h
A firmware/libboard/octsimtest/include/i2c.h
A firmware/libboard/octsimtest/include/mcp23017.h
A firmware/libboard/octsimtest/source/board_octsimtest.c
A firmware/libboard/octsimtest/source/i2c.c
A firmware/libboard/octsimtest/source/mcp23017.c
11 files changed, 687 insertions(+), 0 deletions(-)

Approvals:
  Jenkins Builder: Verified
  laforge: Looks good to me, approved



diff --git a/firmware/README.txt b/firmware/README.txt
index fa7f60a..cd04e7a 100644
--- a/firmware/README.txt
+++ b/firmware/README.txt
@@ -24,6 +24,7 @@
 * `simtrace`: The good old Osmocom SIMtrace PCB with SAM3 instead of SAM7, 
open hardware.
 * `qmod`: A sysmocom-proprietary quad mPCIe carrier board, publicly available
 * `owhw`: An undisclosed sysmocom-internal board, not publicly available
+* `octsimtest`: A sysmocom-proprietary production testing board, not publicly 
available

 = Firmware

@@ -51,6 +52,7 @@
 * `cardem`: To provide remote SIM operation capabilities.
 * `trace`:  To monitor the communication between a SIM card and a phone 
(corresponds to the functionality provide by the first SIMtrace)
 * `triple_play`: To support the three previous functionalities, using USB 
configurations.
+* `gpio_test`: internal test code

 == Memories

diff --git a/firmware/apps/gpio_test/Makefile b/firmware/apps/gpio_test/Makefile
new file mode 100644
index 000..b2b4707
--- /dev/null
+++ b/firmware/apps/gpio_test/Makefile
@@ -0,0 +1,3 @@
+C_FILES += $(C_LIBUSB_RT)
+
+C_FILES += gpio_test.c
diff --git a/firmware/apps/gpio_test/gpio_test.c 
b/firmware/apps/gpio_test/gpio_test.c
new file mode 100644
index 000..2ab23e7
--- /dev/null
+++ b/firmware/apps/gpio_test/gpio_test.c
@@ -0,0 +1,10 @@
+#include 
+#include "utils.h"
+#include "chip.h"
+
+
+
+void gpio_test_init(void)
+{
+   printf("FIXME run tests here\n\n");
+}
diff --git a/firmware/apps/gpio_test/main.c b/firmware/apps/gpio_test/main.c
new file mode 100644
index 000..8fe68b3
--- /dev/null
+++ b/firmware/apps/gpio_test/main.c
@@ -0,0 +1,54 @@
+
+#include "board.h"
+#include "utils.h"
+#include "osmocom/core/timer.h"
+
+extern void gpio_test_init(void);
+
+/* returns '1' in case we should break any endless loop */
+static void check_exec_dbg_cmd(void)
+{
+   int ch;
+
+   if (!UART_IsRxReady())
+   return;
+
+   ch = UART_GetChar();
+
+   board_exec_dbg_cmd(ch);
+}
+
+
+extern int main(void)
+{
+   led_init();
+   led_blink(LED_RED, BLINK_ALWAYS_ON);
+   led_blink(LED_GREEN, BLINK_ALWAYS_ON);
+
+   /* Enable watchdog for 2000 ms, with no window */
+   WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
+  (WDT_GetPeriod(2000) << 16) | WDT_GetPeriod(2000));
+
+   PIO_InitializeInterrupts(0);
+
+
+   printf("\n\r\n\r"
+   
"=\n\r"
+   "GPIO Test firmware " GIT_VERSION " (C) 2019 Sysmocom GmbH\n\r"
+   
"=\n\r");
+
+   board_main_top();
+
+   TRACE_INFO("starting gpio test...\n\r");
+   gpio_test_init();
+
+   TRACE_INFO("entering main loop...\n\r");
+   while (1) {
+   WDT_Restart(WDT);
+
+   check_exec_dbg_cmd();
+   osmo_timers_prepare();
+   osmo_timers_update();
+   }
+
+}
diff --git a/firmware/apps/gpio_test/usb_strings.txt 
b/firmware/apps/gpio_test/usb_strings.txt
new file mode 100644
index 000..0e797ac
--- /dev/null
+++ b/firmware/apps/gpio_test/usb_strings.txt
@@ -0,0 +1,10 @@
+sysmocom - s.f.m.c. GmbH
+SIMtrace 2 compatible device
+SIMtrace Sniffer
+SIMtrace CCID
+SIMtrace Phone
+SIMtrace MITM
+CardEmulator Modem 1
+CardEmulator Modem 2
+CardEmulator Modem 3
+CardEmulator Modem 4
diff --git a/firmware/libboard/octsimtest/include/board.h 
b/firmware/libboard/octsimtest/include/board.h
new file mode 100644
index 000..2effc02
--- /dev/null
+++ b/firmware/libboard/octsimtest/include/board.h
@@ -0,0 +1,154 @@
+/* octSIMtest with SAM3S board definition
+ *
+ * (C) 2019 by sysmocom -s.f.m.c. GmbH, Author:Joachim Steiger 

+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * 

Change in ...simtrace2[master]: add new board and app for gpio testing on octsimtest board

2019-07-30 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/14969 )

Change subject: add new board and app for gpio testing on octsimtest board
..


Patch Set 2: Code-Review+2


--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/14969
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
Gerrit-Change-Number: 14969
Gerrit-PatchSet: 2
Gerrit-Owner: roh 
Gerrit-Reviewer: Jenkins Builder
Gerrit-Reviewer: laforge 
Gerrit-Comment-Date: Tue, 30 Jul 2019 12:41:29 +
Gerrit-HasComments: No
Gerrit-Has-Labels: Yes
Gerrit-MessageType: comment


Change in ...simtrace2[master]: add new board and app for gpio testing on octsimtest board

2019-07-30 Thread roh
Hello Jenkins Builder,

I'd like you to reexamine a change. Please visit

https://gerrit.osmocom.org/c/simtrace2/+/14969

to look at the new patch set (#2).

Change subject: add new board and app for gpio testing on octsimtest board
..

add new board and app for gpio testing on octsimtest board

Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
---
M firmware/README.txt
A firmware/apps/gpio_test/Makefile
A firmware/apps/gpio_test/gpio_test.c
A firmware/apps/gpio_test/main.c
A firmware/apps/gpio_test/usb_strings.txt
A firmware/libboard/octsimtest/include/board.h
A firmware/libboard/octsimtest/include/i2c.h
A firmware/libboard/octsimtest/include/mcp23017.h
A firmware/libboard/octsimtest/source/board_octsimtest.c
A firmware/libboard/octsimtest/source/i2c.c
A firmware/libboard/octsimtest/source/mcp23017.c
11 files changed, 687 insertions(+), 0 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/69/14969/2
--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/14969
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
Gerrit-Change-Number: 14969
Gerrit-PatchSet: 2
Gerrit-Owner: roh 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-MessageType: newpatchset


Change in ...simtrace2[master]: add new board and app for gpio testing on octsimtest board

2019-07-29 Thread laforge
laforge has posted comments on this change. ( 
https://gerrit.osmocom.org/c/simtrace2/+/14969 )

Change subject: add new board and app for gpio testing on octsimtest board
..


Patch Set 1:

(2 comments)

https://gerrit.osmocom.org/#/c/14969/1/firmware/libboard/octsimtest/include/board.h
File firmware/libboard/octsimtest/include/board.h:

https://gerrit.osmocom.org/#/c/14969/1/firmware/libboard/octsimtest/include/board.h@1
PS1, Line 1: SIMtrace
copy+paste error


https://gerrit.osmocom.org/#/c/14969/1/firmware/libboard/octsimtest/include/board.h@3
PS1, Line 3:  * (C) 2016-2017 by Harald Welte 
   :  * (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

(C) 2019 by sysmocom - s.fm.c. GmbH, Author: Joachim Steiger



--
To view, visit https://gerrit.osmocom.org/c/simtrace2/+/14969
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: simtrace2
Gerrit-Branch: master
Gerrit-Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
Gerrit-Change-Number: 14969
Gerrit-PatchSet: 1
Gerrit-Owner: roh 
Gerrit-Reviewer: Jenkins Builder
Gerrit-CC: laforge 
Gerrit-Comment-Date: Mon, 29 Jul 2019 18:36:16 +
Gerrit-HasComments: Yes
Gerrit-Has-Labels: No
Gerrit-MessageType: comment


Change in ...simtrace2[master]: add new board and app for gpio testing on octsimtest board

2019-07-26 Thread roh
roh has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/simtrace2/+/14969


Change subject: add new board and app for gpio testing on octsimtest board
..

add new board and app for gpio testing on octsimtest board

Change-Id: I01243044002f51b34e8dc12c1b1f565bbf1740a2
---
A firmware/apps/gpio_test/Makefile
A firmware/apps/gpio_test/gpio_test.c
A firmware/apps/gpio_test/main.c
A firmware/apps/gpio_test/usb_strings.txt
A firmware/libboard/octsimtest/include/board.h
A firmware/libboard/octsimtest/include/i2c.h
A firmware/libboard/octsimtest/include/mcp23017.h
A firmware/libboard/octsimtest/source/board_octsimtest.c
A firmware/libboard/octsimtest/source/i2c.c
A firmware/libboard/octsimtest/source/mcp23017.c
10 files changed, 686 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/simtrace2 refs/changes/69/14969/1

diff --git a/firmware/apps/gpio_test/Makefile b/firmware/apps/gpio_test/Makefile
new file mode 100644
index 000..b2b4707
--- /dev/null
+++ b/firmware/apps/gpio_test/Makefile
@@ -0,0 +1,3 @@
+C_FILES += $(C_LIBUSB_RT)
+
+C_FILES += gpio_test.c
diff --git a/firmware/apps/gpio_test/gpio_test.c 
b/firmware/apps/gpio_test/gpio_test.c
new file mode 100644
index 000..2ab23e7
--- /dev/null
+++ b/firmware/apps/gpio_test/gpio_test.c
@@ -0,0 +1,10 @@
+#include 
+#include "utils.h"
+#include "chip.h"
+
+
+
+void gpio_test_init(void)
+{
+   printf("FIXME run tests here\n\n");
+}
diff --git a/firmware/apps/gpio_test/main.c b/firmware/apps/gpio_test/main.c
new file mode 100644
index 000..8fe68b3
--- /dev/null
+++ b/firmware/apps/gpio_test/main.c
@@ -0,0 +1,54 @@
+
+#include "board.h"
+#include "utils.h"
+#include "osmocom/core/timer.h"
+
+extern void gpio_test_init(void);
+
+/* returns '1' in case we should break any endless loop */
+static void check_exec_dbg_cmd(void)
+{
+   int ch;
+
+   if (!UART_IsRxReady())
+   return;
+
+   ch = UART_GetChar();
+
+   board_exec_dbg_cmd(ch);
+}
+
+
+extern int main(void)
+{
+   led_init();
+   led_blink(LED_RED, BLINK_ALWAYS_ON);
+   led_blink(LED_GREEN, BLINK_ALWAYS_ON);
+
+   /* Enable watchdog for 2000 ms, with no window */
+   WDT_Enable(WDT, WDT_MR_WDRSTEN | WDT_MR_WDDBGHLT | WDT_MR_WDIDLEHLT |
+  (WDT_GetPeriod(2000) << 16) | WDT_GetPeriod(2000));
+
+   PIO_InitializeInterrupts(0);
+
+
+   printf("\n\r\n\r"
+   
"=\n\r"
+   "GPIO Test firmware " GIT_VERSION " (C) 2019 Sysmocom GmbH\n\r"
+   
"=\n\r");
+
+   board_main_top();
+
+   TRACE_INFO("starting gpio test...\n\r");
+   gpio_test_init();
+
+   TRACE_INFO("entering main loop...\n\r");
+   while (1) {
+   WDT_Restart(WDT);
+
+   check_exec_dbg_cmd();
+   osmo_timers_prepare();
+   osmo_timers_update();
+   }
+
+}
diff --git a/firmware/apps/gpio_test/usb_strings.txt 
b/firmware/apps/gpio_test/usb_strings.txt
new file mode 100644
index 000..0e797ac
--- /dev/null
+++ b/firmware/apps/gpio_test/usb_strings.txt
@@ -0,0 +1,10 @@
+sysmocom - s.f.m.c. GmbH
+SIMtrace 2 compatible device
+SIMtrace Sniffer
+SIMtrace CCID
+SIMtrace Phone
+SIMtrace MITM
+CardEmulator Modem 1
+CardEmulator Modem 2
+CardEmulator Modem 3
+CardEmulator Modem 4
diff --git a/firmware/libboard/octsimtest/include/board.h 
b/firmware/libboard/octsimtest/include/board.h
new file mode 100644
index 000..018cfdd
--- /dev/null
+++ b/firmware/libboard/octsimtest/include/board.h
@@ -0,0 +1,155 @@
+/* SIMtrace with SAM3S board definition
+ *
+ * (C) 2016-2017 by Harald Welte 
+ * (C) 2018 by sysmocom -s.f.m.c. GmbH, Author: Kevin Redon 

+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307, USA
+ */
+#pragma once
+#include "board_common.h"
+#include "simtrace_usb.h"
+
+/* Name of the board */
+#define BOARD_NAME "OCTSIMTEST"
+/* Board definition */
+#define octsimtest
+
+/** oscillator used as main clock source (in Hz) */
+#define BOARD_MAINOSC 18432000
+/** desired main clock frequency (in Hz, based on BOARD_MAINOSC) */
+#define BOARD_MCK 58982400