Commit Graph

317 Commits

Author SHA1 Message Date
Harald Welte
c47fc5febf set local slot LED according to remote/local state.
The LED is illuminated as long as the slot is in local (physical SIM
card) mode.
2017-05-20 14:46:57 +01:00
Harald Welte
02d0ec6e08 uart_console: Re-start watchdog during busy-waiting for serial chars 2017-05-20 14:46:57 +01:00
Harald Welte
3b646955b9 Fix swapped manufacturer/product strings
the */usb_strings.txt files always assumed that the first line is the
manufacturer string, followed by the product string in the second line.

However, the enum strDescNum had it the other way around. Let's fix it
by adjusting the enum to reality.

Fixes: SYS#3591
2017-05-14 23:15:11 +02:00
Harald Welte
23c00b6ad3 cardemu: Fix interpretation of MSGC_MODEM messages
msg->l2h should always point at the first byte of the header after the
generic simtrace header.  For some reason this doesn't work if used
globally, but it is required for the MSGC_MODEM messages to be
interpreted correctly.
2017-05-11 01:11:43 +02:00
Harald Welte
253991789a dfu: make sure to not bloat the loader with main board init stuff. 2017-05-11 00:47:29 +02:00
Harald Welte
0709d2d842 perst/sim_switch: Log events using TRACE_INFO 2017-05-11 00:06:00 +02:00
Harald Welte
44622dfd8d consistently use 0-based counting of modems/slots 2017-05-11 00:04:50 +02:00
Harald Welte
b91f6ad848 firmware: fix various compiler warnings 2017-05-10 23:20:50 +02:00
Harald Welte
5c583d3535 Generalize SIM switching code and allow local/remote switching via USB 2017-05-09 13:24:28 +02:00
Harald Welte
114e74d322 wwan_perst: Warn if somebody failed to initialize us 2017-05-09 13:24:28 +02:00
Harald Welte
2e9254ac3f cardem: Implement WWAN Modem reset via USB
Using the SIMTRACE_MSGT_DT_MODEM_RESET message
2017-05-09 13:24:28 +02:00
Harald Welte
cb093ce878 wwan_perst: Support varying timeout and permanent active/inactive 2017-05-09 13:24:28 +02:00
Harald Welte
25a9a80ff5 Convert to new generalized SIMTRACE2 USB protocol
The current protocol was card-emulation specific.  The new protocol is
generic/flexible enough to accommodate both tracing and card emulation,
as well as modem control and other future extensions.
2017-05-09 13:24:23 +02:00
Harald Welte
ed1efc5035 qmod: debug_cmd: Avoid 'Unknown command' for valid commands 2017-05-07 23:10:02 +02:00
Harald Welte
f8c83a4d64 Make hardfault handler a bit more verbose 2017-05-07 23:10:02 +02:00
Harald Welte
28174982b6 qmod: Initialize ST12 specific I/O pins only on ST12 2017-05-07 23:10:02 +02:00
Harald Welte
8e7fca3255 migrate from req_ctx to msgb
We now generalize the USB communiction and abandon the 'req_ctx'
structure inherited from openpcd.  Instead we use the libosmocore 'msgb'
structure to handle incoming and outgoing USB tranfers.  We also use
linuxlist-based msgb-queues for each endpoint.
2017-05-07 23:09:56 +02:00
Harald Welte
eb81d23a56 import libosmocore msgb handling (and dependencies)
This is supposed to be replaced with upstream libosmocore, as soon as
that has a proper maintained embedded build (again).
2017-05-07 13:18:36 +02:00
Harald Welte
0380d74405 Makefile: remove .p files during 'make clean' 2017-05-07 11:20:40 +02:00
Harald Welte
9457bf765d Makefile: Don't warn about failed inlines 2017-05-07 11:20:24 +02:00
Harald Welte
9ac794c770 Add llist_add_irqsafe() similar to llist_add_tail_irqsafe() 2017-05-07 11:19:45 +02:00
Harald Welte
caca0b1e7a Makefile: Add new 'combined' target to build combined DFU+APP image 2017-05-05 23:17:31 +02:00
Harald Welte
6d1128e9d1 QMOD: Add code to determine SIM Card presence 2017-05-05 23:17:27 +02:00
Harald Welte
7e4390f181 qmod: wwan_led.c: Fix handling of LED for second Modem 2017-05-05 20:58:53 +02:00
Harald Welte
9164a6d335 qmod: Disable various console commands on ST34
A number of commands related to the USB hub and the EEPROM are only
available on ST12, but not on ST34.  Let's remove them if not
applicable.
2017-05-05 20:58:52 +02:00
Harald Welte
2cbc9b29f3 use same USB Product ID for DFU and runtime mode
This was introduced for interoperability with operating systems that
might prefer such setup (I heard that Windows prefers this about a
decade ago, but I don't have any personal experience with it).

However, using different VID/PID between DFU and RT breaks usability of
dfu-util, and I really think this matters much more to our users and
developers.
2017-05-05 00:34:28 +02:00
Harald Welte
601e0d3e35 update + split README into general and firmware-specific part 2017-03-08 15:33:33 +01:00
Harald Welte
3d4869cbb4 add missing usbstring.c 2017-03-07 15:51:49 +01:00
Harald Welte
353330dcc7 qmod: Fix polarity of SPDT switch
the default boot state should be to use the local SIM, until the user
changes it (currently only possible via entering '!' or '@' on the
serial console).  The code so far had this completely inverted.
2017-03-07 08:17:19 +01:00
Harald Welte
3bbaba0090 DFU: Disable LED blinking code
Something odd is happening that breaks DFU mode if we blink.  Let's
remove this feature for now.
2017-03-06 22:47:06 +01:00
Harald Welte
e8869fb8ff DFU: Resolve DFU runtime descriptor dynamically from descriptors
We cannoy simply use the DFU runtime descriptor of the DFU mode, but we
have to use the descriptor of the specific currently-selected runtime
configuration.  Let's iterate over the descriptors of a configuration
and find the DFU runtime descriptor in it.
2017-03-06 22:44:42 +01:00
Harald Welte
5b108d8cf0 DFU: initialize g_dfu during real power up
At power-up we need to initialize g_dfu once, to ensure a consistent
state.  Afterwards we want to keep it across (software) reset, but on
power-up the memory would otherwise be filled with random data, causing
issues with detection of DFU/Runtime switching.
2017-03-06 21:51:55 +01:00
Harald Welte
abba8a8d85 LED: Introduce LED blinking pattern code
It might be useful to display some different blinking patterns to
indicate specific system state (such as DFU mode vs. regular firmware)
2017-03-06 16:58:00 +01:00
Harald Welte
054216d94d usb: Use different SubClass values for card-emulation and sniffer
This way, host code can dynamically detect which interface supports
which functionality.

The related #defines should be moved to a header file that's shared with
the host application code.
2017-03-06 10:07:17 +01:00
Harald Welte
eab7e456fe USB: Don't specify Class/Subclass 0xff at device level
Actually, at device level we want to specify 0, so we can select
individual Class/Subclass values at Interface values.

Table 9-8 of the USB2 Specification is quite clear about this.
2017-03-06 10:04:56 +01:00
Harald Welte
495a67da7d usb: consistently use named structure initializers 2017-03-06 09:55:37 +01:00
Harald Welte
912b183b29 qmod: Use different Interface Strings for Modem1+2 / Modem 3+4
This makes it obvious in 'lsusb' and to other software on the USB host
which interface is for which of the modems.
2017-03-06 09:28:13 +01:00
Harald Welte
809e5840f9 qmod: Add code to switch between physical and virtual SIM 2017-03-06 09:16:40 +01:00
Harald Welte
2bff7cd9c2 tc_etu: Don't confiugre unused TIOA pin of TC0 + TC2
When initializing the TC blocks, let's only configure the GPIO pins TCLK
and TIOB, and not the unused TIOA pin.  That pin is actually used for
(separate) different functions in both qmod and owhw.
2017-03-05 22:15:54 +01:00
Harald Welte
705e899e5f qmod: (re)activate USB port remapping.
The port mapping is now as follows:

* port 1: ST12
* port 2: modem 1
* port 3: modem 2
* port 4: ST34
* port 5: modem 3
* port 6: modem 4
* port 7: daisy-chaining port
2017-03-05 17:10:26 +01:00
Harald Welte
0e2959859a qmod: Replace hand-crafted delay loop with call to mdelay() 2017-03-05 16:48:47 +01:00
Harald Welte
c6e482d581 qmod eeprom/i2c: Re-start watchdog while slow bit-banging 2017-03-05 16:24:29 +01:00
Harald Welte
2363fa0327 Generate USB Strings from apps/*/usb_strings.txt files at compile time
This way we can skip the manually-crafted USB string definitions in the
dfu_desc.c and usb.c files.
2017-03-05 10:16:25 +01:00
Harald Welte
1405100dff DFU: Introduce board/app-specific override for booting in DFU mode
Using the USBDFU_OverrideEnterDFU() function, a board/application can
define extra conditions when the system should boot in DFU mode, even if
it was not explicitly switched to DFU mode from the application.

The app/dfu/main.c uses this mechanism to boot into DFU mode if the
stack + reset vector addresses are not plausible (i.e. some random junk
appears to be flashed in the application partition) or if the user
places a jumper accross the RxD+TxD lines of the debug UART.  The idea
is that the system can be recovered by placing this jumper and then
re-installing the application from DFU.
2017-03-04 19:17:27 +01:00
Harald Welte
7214b4747f Make sure to print CPU Reset Cause when starting the software 2017-03-03 19:02:09 +01:00
Harald Welte
45ebe4591a Enable Watchdog (500ms) 2017-03-03 19:01:53 +01:00
Harald Welte
aaba4af46c Use Supply Controller to avoid running SAM3 on voltages lower than 3.0V
Sometimes there is some leakage current via some I/O that's sufficient
to power up the  SAM3S.  Use the supply monitor to make sure the CPU
will be reset (and kept in reset) if the supply voltage is below 3.0V.
2017-03-03 18:48:13 +01:00
Harald Welte
3ecbf678db only simtrace is bus-powered, SAM3 on qmod + owhw are self-powered 2017-03-03 02:10:34 +01:00
Harald Welte
8adf0ac2ce DFU app: call into board_main_top() for qmod related initialization 2017-03-03 01:52:34 +01:00
Harald Welte
f415d7163b Call USBD_Disconnect before software-triggered CPU reset
This makes sure that we'll re-enumerate on the USB, as a CPU reset
apparently doesn't automatically release the pull-up and notify the hub
that we were gone?
2017-03-03 01:51:43 +01:00