Commit Graph

576 Commits

Author SHA1 Message Date
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
Harald Welte
d09829dcc6 Remove newlib dependency, include own stdio/string/assert 2017-02-27 23:00:26 +01:00
Harald Welte
d52523185f fix some compiler warnings 2017-02-27 22:18:47 +01:00
Harald Welte
d8a003dfd7 Structure build system to build for multiple boards/apps/environments 2017-02-27 22:18:45 +01:00
Harald Welte
a1cd0f31c8 fix compilation of card_emu_tests 2017-02-27 14:29:07 +01:00
Harald Welte
3f5e3ddffc Change directory structure to align with Atmel softpack
This way we can easily check with 'diff' for differences in our code and
Atmel softpack.  Also, this layout is more suitable for building various
different firmware images (e.g. factory-test, dfu-loader, main
application) for a variety of different boards (simtrace, owhw, qmod).
2017-02-27 14:24:11 +01:00
Harald Welte
7ed6f3bc37 WIP: Introduce USB DFU code from my at91lib DFU port 2017-02-27 09:28:34 +01:00
Harald Welte
aa3b867abb WIP: split main from board-speciic parts 2017-02-26 15:59:56 +01:00
Harald Welte
a05ccc9103 build efc.o and flashd.o as part of build process 2017-02-26 15:51:10 +01:00
Harald Welte
e9eaf90d35 import efc.[ch] and flashd.[ch] from SAM3S softpack 2.1 2017-02-26 12:52:01 +01:00
Harald Welte
1d91058eee qmod: Inver initial state of PERST signals
The signals are driving an external NPN transistor, so the default state
must be low at reset to en sure that !PERST on the modem input is
de-asserted by default.
2017-02-10 19:50:24 +01:00
Harald Welte
4a9bce127f qmod: invert WWAN_PERST logic (we use transistors now) 2017-02-10 19:19:52 +01:00
Harald Welte
6732248f71 Add support for board version reading via ADC 2017-02-10 19:19:48 +01:00
Harald Welte
9c78cff10b Extend WWAN modem PERST to 300ms
It seems like a lot of modems have rather long (100ms!) minimum reset
durations.  Makes me wonder if it's an actual reset line or rather juts
some GPIO that they poll/sample every so often.  Then there are other
modems that state the reset *must not* be longer than 1s.  So let's
choose 300ms as a value in-between.
2017-02-04 14:58:49 +01:00
Harald Welte
987f59aa02 Import libosmocore timer infrastructure and use it for PERST
The PERST is thus no longer busy-waiting but starting a timer to release
the PERST after 1ms.
2017-02-04 14:58:45 +01:00
Harald Welte
b41598b602 Introudce an include_libosmocore directory and move (updated) linuxlist there 2017-02-04 12:15:58 +01:00
Harald Welte
7e5c7d5b82 Add debug commands '1' and '2' to generate 1ms reset pulses to modems 2017-02-03 22:59:04 +01:00
Harald Welte
31f817c3ac Add support for controlling PERST of WWAN modems (on qmod) 2017-02-03 22:22:20 +01:00
Harald Welte
83207e0cad Add 'mdelay()' function to busy-wait for given number of milli-seconds 2017-02-03 22:22:17 +01:00
Harald Welte
2819e9c131 wwan_led: Read + report status changes of WWAN LED inputs 2017-02-03 07:49:28 +01:00
Harald Welte
af6147997d qmod: Remove 'U' debug command and directly initialize USB
The hack to manually delay the USB initialization is no longer needed as
finally the USB enumerates.
2017-01-12 18:59:41 +01:00
Harald Welte
fb3f308f2f board_lowlevel: Clean up PLLA configuration
The PLL setting doesn't depend on the 'qmod' board type but on the
combination of the BOARD_MAINOSC and BOARD_MCK #defines.  So let's
remove the '#ifdef qmod' from the equation.

The only 'qmod' specific part is whether or not to use the internal xtal
oscillator or not.
2017-01-12 18:16:23 +01:00
Harald Welte
84ad98585c usb: Cofnigure PLLB according to board.h BOARD_MAINOSC
Actually we don't even need to use PLLB for USB and could simply use
PLLA, but then we don't c are about the extra 2.5mA
2017-01-12 18:06:57 +01:00
Harald Welte
7861132fad qmod: Don't violate PLL minimum output frequency
Table 42-31 ofd DOC6500 states that the minimum output frequency of the
PLL is 60 MHz.   The existing qmod code violated this by configuring the
PLL multiplier output to 12*4 = 48 MHz.  Let's use 12*8 = 96 and then
divide that by two to get to the desired 48 MHz.

This might help to resolve the non-working USB on the qmod so far.
2017-01-12 11:07:04 +01:00
Harald Welte
b871363be7 qmod: cosmetic changes to EEPROM hex array
* move it out of the function so it actually is present in .rodata,
  rather than having a long sequence of stores into a stack buffer
* use 16 bytes per line so it is easier to find + change bits in there
2017-01-11 23:08:35 +01:00
Harald Welte
b30783c83e qmod EEPROM: Dont't mark any ports as non-removable
.. and don't disable any ports during bus-powered operation (which we
don't support anyway).
2017-01-11 23:02:26 +01:00
Harald Welte
ae8a465f36 qmod: Commit missing changes to EEPROM
The firmware we used for testing contained some local changes which were
not committed.  They primarily relate to the port re-ordering feature as
well as the amount of power (0x32 = 100mA) is now used consequently.
2017-01-11 22:59:09 +01:00
Harald Welte
6dfcf70f63 qmod: Start with _HUB_RESET=0 -> HUB_RESET=1 (not in reset)
Booting with the hub reset active would in turn cut our own power
supply as the hub disables all downstream port power in that case.
2017-01-11 22:23:13 +01:00
Harald Welte
f9a182d24d qmod: breal the command loop when 'U' is pressed and proceed to USB init 2017-01-11 22:22:16 +01:00
Harald Welte
afbb747170 qmod: do not automatically clear _HUB_RESET after EEPROM write
we'd rather have explicit control over that
2017-01-11 22:21:28 +01:00
Harald Welte
e07aed6543 qmod: debug menu: Add 'U' command to proceed to USB 2016-12-22 22:32:15 +01:00
Harald Welte
396354cbdb qmod: debug menu: make sure to always print something 2016-12-22 22:29:57 +01:00
Harald Welte
006b16ddc2 quad-modem: Add debug console commands for debugging 2016-12-22 21:29:41 +01:00
Harald Welte
e974fbb9e5 Issue ST12_PRTPWR_OVERRIDE before putting hub in reset
When we reset the hub, the hub will actively drvie the PRTPWR signal of
the SITMRACE12 low, resulting in the SAM3 being shut off.  If we want to
"survive" this, we need to set the OVERRIDE before we go into reset.

Right now, we never release the signal again, keeping ST12 enabled
permanently, which is of course not what we want in general.
2016-10-19 19:36:07 +02:00
Harald Welte
15e026ec34 qmod: Set PIN_PRTPWR_OVERRIDE to output/low 2016-10-11 17:46:09 +02:00
Harald Welte
4e3b9a5140 qmod: attempt to swithc the DN/DP wires of the SAM3 2016-09-05 14:04:43 +02:00
Harald Welte
67415e3385 HACK: Add EEPROM writing at boot of SAM3 on qmod
This is not for production use, but just for hardware verification
2016-09-01 20:57:56 +02:00