Commit Graph

562 Commits

Author SHA1 Message Date
Harald Welte
2ba03bb9fc simtrace2-remsim: Move away from global variables
When we want to run multiple instances of the card-emulator (e.g. for
multi-modem/multi-card versions of the hardware), the code shouldn't be
using any global variables but have them per-instance.
2017-03-06 18:57:01 +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
0a8306ec69 add gnumeric spreadsheet with GPIO/Pin assignments of all boards
This software is supposed to support a SIMTRACE1 with SAM#, as well
ast the OWHW and QMOD hardware.  Let's compare the GPIO/Pin assignments
of the SAM3 in one shared spreadsheet.
2017-03-05 22:17:28 +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
1776997f8a remove old 'notes' file with german textaul notes 2017-03-05 13:30:32 +01:00
Harald Welte
596e666fa0 fix symlink that caused host programs to not build 2017-03-05 13:28:32 +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
Harald Welte
ec0837c463 change from \r\n (CRLF) to \n\r (LFCR)
For some strange reason my output is garbled in both the 'screen' and
'cu' teerminal programs and 'raw' terminal (stty) mode.  I fail to
understand why, but let's simply adjust the code as needed for now.
2017-03-03 01:33:24 +01:00
Harald Welte
0de99cd069 DFU: String descriptors for DFU alt-interfaces
they are only shown in DFU mode for now, until we find a way to export
them over to the runtime.
2017-03-03 01:20:19 +01:00
Harald Welte
ac4f66e5d1 DFU: Set 10ms bwPollTimeout (lowest possible as per spec) 2017-03-03 01:13:34 +01:00
Harald Welte
91fc40240e DFU: make sure to properly initialize g_dfu pointer before using it 2017-03-03 01:05:22 +01:00
Harald Welte
b04f4f0ee8 DFU Runtime: Add missing return after handling USB standard requests
the same as 479e97e338 but this time for
the runtime, not for DFU.
2017-03-03 00:36:39 +01:00
Harald Welte
e8eea29cf6 dfu: fix cosmetic issue in debug message 2017-03-03 00:35:51 +01:00
Harald Welte
d1e963479e DFU: fix transitions between runtime and DFU mode
we now always go through a processor reset to avoid any state that might
be persistent/left-over during the switch.
2017-03-03 00:34:17 +01:00
Harald Welte
db17e83960 cstartup: (re-)enable interrupts before calling main() 2017-03-02 23:19:13 +01:00
Harald Welte
ec9b5fff3f dfu/main.c: Initialize FLASHD driver before using it 2017-03-02 23:18:40 +01:00
Harald Welte
0af4948211 cstartup / USBD: Use correct Makefile conditionals for DFU 2017-03-02 23:18:02 +01:00
Harald Welte
adbe72a5ba Makefile: Define APPLICATION_foo BOARD_bar and ENVIRONMENT_baz #defines
This can help us with conditional code
2017-03-02 23:16:01 +01:00
Harald Welte
e36970cac7 dfu: print Chip ID during boot 2017-03-02 19:24:14 +01:00
Harald Welte
cab66419d6 flashd: Set 6 Wait states as per Errata requiremens for Revision A
It is utterly unacceptable that Atmel is shipping example code in 2011,
which doesn't support parts that are shipped still in 2016.  They would
have had five years to fix their code to implement the chip errata :(
2017-03-02 19:22:50 +01:00
Harald Welte
479e97e338 DFU: Add missing 'return' after handling generic USB control request 2017-03-02 16:53:13 +01:00
Harald Welte
203abf5f6e dfu_desc: Add some string descriptors and fix configuration desc table 2017-03-02 16:52:48 +01:00
Harald Welte
ee9ebb30da stdio: Increase max string size to 512 and don't endless-loop!! 2017-03-02 16:52:08 +01:00
Harald Welte
b2ad7f76a1 dfu_des.c: Cosmetic changes, use named initializers 2017-03-01 22:15:28 +01:00
Harald Welte
0395bd15b3 move PLLB (for USB) initialization to board_lowlevel.c
This way it is present both inside the DFU loader and in the main app.
2017-02-28 01:28:56 +01:00
Harald Welte
c430ac1f2a have local stdio.h file to avoid newlib issues
... we should move to -nostdinc at some point :/
2017-02-28 01:25:12 +01:00
Harald Welte
adba0ce80b fix g_dfu access from both DFU and runtime access
We need to refer to g_dfu as a pointer from all code.  In DFU mode, it
gets assigned to the address of _g_dfu, which is placed by the linker
script at the start of RAM.  In runtime mode, the pointer is statically
defined to point at the start of RAM.  The linker script for the runtime
(dfu environment) is adjusted to save the first 32 bytes for the _g_dfu
structure.
2017-02-28 01:10:32 +01:00
Harald Welte
65cca7cccc ensure g_dfu is linked to start of RAM when building DFU loader 2017-02-28 01:10:27 +01:00
Harald Welte
db30727514 remove obsolete old linker script 2017-02-28 01:10:27 +01:00
Harald Welte
32852bc1d9 DFU: towards a more complete implementation
* we now actually route the EP0 control requests in DFU mode to the
  correct handler (weak linker symbols are tricky)
* we now actually call code to read/write data from/to RAM/FLASH
2017-02-28 01:10:23 +01:00
Harald Welte
edf9c9d322 Makefile: Optimize for size
This gets the dfu image down from 19 to 11 kBytes, with is well within
the 16kbyte limit for the DFU partition.
2017-02-27 23:24:22 +01:00
Harald Welte
37b6e41f84 move last few files from src_board / include_board 2017-02-27 23:20:38 +01:00
Harald Welte
964f509f59 remove pio_capture, we don't use it
As it registers a non-weak exception handler, it consumes memory in
every build
2017-02-27 23:14:16 +01:00
Harald Welte
96e62a4664 stdio.c: fix compiler warning 2017-02-27 23:05:15 +01:00
Harald Welte
045ea3eb7b timer.h: Fix compiler warnings about redefinition 2017-02-27 23:02:26 +01:00