Commit Graph

149 Commits

Author SHA1 Message Date
Harald Welte a40c8e502d 'cuart' Card-UART abstraction + driver for simple serial reader
Change-Id: Ic7e324d99f78b3bfb98fc667d9a1b7fa363f092d
2019-10-09 18:08:07 +02:00
Harald Welte 06348367fa ISO7816-3 FSMs as osmo_fsm
This implements ISO 7816-3 T=0 as three finite state machines using
osmo_fsm.

Change-Id: I0145b77e6165d36d33f18ef3a452f2c37913bd73
2019-10-09 17:58:15 +02:00
Harald Welte 6312b444b9 contrib/jenkins.sh: Also build host/gadget code
Change-Id: Ided54d69a776ce2b86f4117a27fc7ad3b7a1a1d2
2019-10-09 17:58:15 +02:00
Eric Wild 6a902a39e9 allow different prefixes, print memory usage
Change-Id: If34b5eba2992f8f9f75ea234b94467af46b028c6
2019-10-09 17:58:15 +02:00
Harald Welte 13950f5ebe ccid_host/Makefile: Ensure 'make clean' succeeds (rm -f)
Change-Id: Ie4e1fa64b707d86a20582b1b88612e5d268db558
2019-10-09 14:37:56 +02:00
Eric Wild d5eaa9f400 split ccid into common and host-only code
Change-Id: I175c4efdafedc1d8953d3fb03f2d622a7a74af3b
2019-10-09 13:18:21 +02:00
Harald Welte 860d0069b2 ccid: Fix overflow in Fi value
The Fi value can easily exceed 8bits. Even its default of 372 already
exceeds 256...

Change-Id: If2e2c46411d724883dca48f24e08d002e6670299
2019-10-01 15:24:12 +02:00
Eric Wild 2de998aa90 ccid_gen_notify_slot_status: Fix bitmask of card slot insert status
Change-Id: I0dece04fd302041aa8e23208734e9028ad42cd62
2019-10-01 15:24:12 +02:00
Eric Wild 1209152b24 ccid_df: Ensure all three endpoints are correctly set
The old code used to do OSMO_ASSERT(), i.e. checking if the
endpoint number was != 0.  However, now we're checking if it's
!= 0xFF, as the default initialization is 0xFF, and an unset
endpoint can be detected this way.

Change-Id: I7d334724a4c6b89ef8faa49bed49ed57ea216ff9
2019-10-01 15:24:12 +02:00
Eric Wild 7603390bd0 Fix USB descriptor bugs (wrong interface, ProtocolsSuported, ...)
Change-Id: I0be2d8b92f176f31250a76e6f5b74a5c12d8cf42
2019-10-01 15:23:40 +02:00
Eric Wild 33403af9a0 CCID: fix length checks in PC_to_RDR_{GetSlotStatus,SetParameters}
Change-Id: I5ec32fd5fdf704ee06f21e548a16523a557d4988
2019-10-01 15:23:40 +02:00
Harald Welte a7c1eb01b5 add small program to play with how Linux reacts to hubs with many ports
Change-Id: Ic3d2bec3f55f4d9e13183795c5825723f9427476
2019-09-12 15:16:43 +02:00
Eric Wild 1bb360a027 proper link order
undef syms from the left, def syms from the right, as it should be.
It's either this, or -Wl,--start-group/-Wl,--end-group around
everything.

Change-Id: I8083c5dc990acd6b60b053883fdd1b42c3bc0d4f
2019-08-01 17:51:43 +02:00
Eric Wild 2a85a042e2 ensure kernel >= 5.0 is happy
dummy_hcd now checks wMaxPacketSize

Change-Id: I3ca4fa3948b5eb9995e0c9f679713ad860dd118e
2019-08-01 17:51:43 +02:00
Harald Welte 37ab4babca name binaries including their git version number
Change-Id: I21a782de7e6a51351f8c8a4a24bb06107ebe0b14
Related: OS#3452
2019-06-20 18:43:30 +02:00
Kevin Redon 99d82ab4d5 Makefile: automatically get output directory list
Change-Id: I8a18a5f04b03f9fa95a1b4f5ee77945e4fa8db07
2019-06-13 18:34:46 +02:00
Kevin Redon 78bb885dbf ASF: add new utils
AFAIK these are not used yet, but have been added to the upstream
ASFv4 library.
I added them to avoid future false negative when diffing files.

Change-Id: Icf6fb641050a1e7132ff2b14c1ce537ec9403b9f
2019-06-13 18:34:46 +02:00
Kevin Redon f041136fb2 ASF: minor, update copyright
upstream ASFv4 updated the copyright year.
somehow they don't know you should use the range instead of the
last year :/
this change is just so I can't continue diffing ASF files without
false positive.

Change-Id: Ic90e692815b30921bc8750c240ba0a5d3f4ccc70
2019-06-13 18:34:46 +02:00
Kevin Redon a6c44f1411 ASF: update E54 SERCOM library
E54 ASFv4 change from backend 1.5.122
update local files to stay in sync

Change-Id: Iabeb2b94d51743a0347ea81fef8fa6236d8b12c0
2019-06-13 18:34:46 +02:00
Kevin Redon e108e61bec ASF: update e54 library
E54 ASFv4 change from backend 1.5.122
update local files to stay in sync

Change-Id: Ib9017744644357ba9ec99eddbcc89d7f95068c34
2019-06-13 18:34:46 +02:00
Harald Welte 271d4876f2 contrib/jenkins.sh: Build libosmocore for Cortex-M4 during build testing
Change-Id: I9a64efe810fabe3edd54a4586f42e9100a0faab0
2019-06-13 18:32:07 +02:00
Harald Welte 6a739d1841 Makefile: Allow user to override libosmocore install prefix
We should probably use PKG_CONFIG to do this in the next step..

Change-Id: Ie1eda223da3e22b6b1eea73cfcca499cf3ba7940
2019-06-13 18:32:07 +02:00
Kevin Redon b14518c87f ASF: add related RTC files
this add the documentation and (yet unused) RTC definitions so to
by in sync with the ASFv4 upstream library

Change-Id: If3e24ede24b4e8cc2724a796756a5a2aa81119de
2019-06-06 13:54:56 +02:00
Kevin Redon f80ad405e8 Makefile: add missing hpl/rtc directory
Change-Id: I3fed159173467d1da091758fe2a87bef2cd2e3c7
2019-06-06 13:29:33 +02:00
Harald Welte c175f666f5 Add missing linuxlist_atomic.h
Change-Id: Iee29c24ea7cb57ddc3a688336fd8902afb3277fb
2019-05-23 20:30:43 +02:00
Harald Welte 23f4fc1953 add ccid symlink to use ccid code from within sysmoOCTSIM directory
Change-Id: I6bc35f2c12f3bf7eeda0ac136587634d5b7ae0be
2019-05-17 20:47:30 +02:00
Harald Welte 1017a759f8 main: add timer-test command for testing libosmocore timers
Change-Id: Id8d6fd9bc3d6de852997261eb555fe35cbc04e57
2019-05-17 20:39:49 +02:00
Harald Welte 3450fec9b8 Fix SystemCoreClock for our use case (120 MHz)
With all the tons of ASF4 library code, ARM/Microchip couldn't even
bothered to implement the most basic CMSIS bits such as the
SystemCoreClockUpdate() function that would dynamically compute
the current SysTick rate at runtime.

To make things worse, they're also not using the #define they have
for the initial core clock rate that's set up at boot time but rather
have a hardcoded 48 MHz value as SystemCoreClock.

Without a correct SystemCoreClock, the jiffies rate is wrong, and
all related timing off.

Change-Id: I9966de4d9ad4e623893044fc341b9852659e8f39
2019-05-17 20:31:31 +02:00
Harald Welte b98478a1fe libosmo_emb: Implement _gettimeofday() on simplistic 'jiffies' counter.
We simply use the SysTick timer to count at 1KHz and fill a 64bit jiffies
conunter.  This counter is then used to fill tv_sec and tv_usec in the
gettimeofday() implementation.

NOTE: tv_sec will not indicate the seconds since the epoch (Jan 01,
1970), but rather since system startup.  For the existign users,
particularly osmo_timer, this doesn't matter.

Change-Id: I9dbbb730996bde1e7039f790d76d7243739a8419
2019-05-17 19:19:18 +02:00
Harald Welte 8a534f189b move _gettimeofday() from main.c to libosmo_emb.c
Change-Id: If7f2624a1ddf84fd436670bb8667ad88561c93ae
2019-05-17 19:19:18 +02:00
Harald Welte 9ab4bc865b main: Print reset causes on boot
Change-Id: I6d6c9a435ca997d829d0b02c26e4c8aee78fa88b
2019-05-17 19:19:18 +02:00
Harald Welte 2dc67e93b2 Command to obtain RTC date/time
This will display the time; However, as the host is not telling us
anything about the current date/time [yet], we will always be in
"N seconds since 1970".

Change-Id: Ic23152db65a01eefd28d67e0132a82352875e467
2019-05-17 19:18:44 +02:00
Harald Welte bd5d3e44f6 Enable OXC32K at start
Change-Id: Ib34cc540c8e591241791432c96241b1826803aaf
2019-05-17 19:18:44 +02:00
Harald Welte d1bd5c42dd Add RTC peripheral from ASF4 (CALENDAR)
Change-Id: I04b6608b72f22cf9829a5bfdddf7cbbbbe8ebb3e
2019-05-17 18:23:55 +02:00
Harald Welte 9bb8bfedb3 Update from Atmel START 1.0.87 to 1.1.134
Change-Id: I095f2f3f4de8ebba154b7d8f9f763a2fa6472ebd
2019-05-17 16:10:00 +02:00
Harald Welte fa9ea7703d Makefile: build ccid_{device,proto} as part of firmware
Change-Id: I3e7afb7ed623f9ac65318bb9ee43eadcea59077f
2019-05-17 13:05:26 +02:00
Harald Welte 71d01e4bfb Makefile: cosmetics (indent, alphabetic sort)
Change-Id: If34d344261bc3982f5fda07aa287e1080671f4ea
2019-05-17 12:50:42 +02:00
Harald Welte c85aab2ecd Makefile: Ensure the firmware binary is called sysmoOCTSIM.bin
Change-Id: Ib8480d8f1f3535efb7c35c01ea4ef24d3c3302a9
2019-05-17 11:05:20 +02:00
Harald Welte 729a7624f2 main.c: Visible banner with firmware version + copyright statement
Change-Id: I0b9c442f61ecd78693ac437633fb9bea81e670c0
2019-05-17 11:02:11 +02:00
Harald Welte 059d1b0eec Ensure the git version ends up in compiled firmware binary
This uses the usual 'git-version-gen' magic we use in all Osmocom
projects.

Change-Id: I076430e5eae32f46f87b778e362b089ae8d0e8ee
2019-05-17 10:53:53 +02:00
Harald Welte 488ddaeeca Makefile: Use Variables for generating compiler/binutils names
Change-Id: I68db7c35e73b1ac5f45ed6e0c6c29045b0cb5581
2019-05-17 10:53:27 +02:00
Harald Welte fad379ac88 Makefile: Move compiler flags to variable
Change-Id: Iacfad9f585d06d31de15bb4c2bddca84ab230b53
2019-05-17 10:42:02 +02:00
Harald Welte b2fc511179 Makefile: Move include directories to INC_DIRS variable
I really hate the Atmel copy+paste style makefile where every include path
is specified three times, rather than using variables.

Change-Id: I39dd880ced341aaea54e30e8b670dbaea445aa8b
2019-05-17 10:37:45 +02:00
Harald Welte 6135be9910 Makefile: Update comment; this is no longer automatucally generated
Change-Id: I75748df90a722462d62067db2db7910035ffb99c
2019-05-17 10:31:40 +02:00
Harald Welte e4ea2b2f62 Makefile: Remove {OBJS,DEPS}_AS_ARGS variables
... which make it very clumsy to add new files to the makefile by hand.

Change-Id: Icfd42470bc43dc49feabc425774737b43f928d03
2019-05-17 10:30:40 +02:00
Harald Welte bdf1b35fbb integrate libosmocore logging into firmware
We do so using our own 'raw' log target to avoid the 4k-on-stack
buffer of libosmocore _output() function.

Change-Id: I7a10b5b2b50bcee0154a1fa3fc43756aec836226
2019-05-17 10:22:00 +02:00
Harald Welte dda661c298 Makefile: Use -fdata-sections, not just -ffunction-sections
Change-Id: I7445da79e17de0ded6496493c2f22364e7cdd426
2019-05-17 10:20:50 +02:00
Harald Welte 5a8af4d743 Add support for polling card detect from main loop; report it
Change-Id: If877691c4759905f70bfb55c7fdc6ab2b065754d
2019-05-16 23:05:21 +02:00
Harald Welte 08ea062daf ncn8025: ncn8025_interrupt_active -> ncn8025_interrupt_level
The IRQ output of the NCN8025 doesn't really have an "active" state
but it's slightly more intricate.  To avoid confusion, let's just
provide a function to obtain the raw value (0=low / 1=high) and
let the user decide what to do with that

Change-Id: I752a84c67046b1d5f832cd1ef2070ec9b2489231
2019-05-16 23:05:21 +02:00
Harald Welte c7a58ba755 WIP: Actual 'main' integration of CCID using msgb queues for USB transfers
Change-Id: I9b7dbbc72dd566be19b217a57767f8404e1b02c4
2019-05-16 23:05:21 +02:00