26 Commits
Author SHA1 Message Date
Federico Cerutti c82572daf3 Updated code to build with GCC 10 - Updated ISR Sharing
Since GCC 10, the compiler defaults to -fno-common, thus variables with
multiple tentative definitions result in linker errors.
We've (me and @MrMoDDoM) extern-ed the shared variables to fix the issue.

Also, when I implemented ISR sharing, somehow I forgot about a function
which was shared as well, so I fixed that mistake and added a couple of
comments on how shared function calls work.
2020-08-26 20:19:33 +02:00
Federico Cerutti 247a0ffd55 Faster ISR sharing in ASM
While in the process of writing a new codec I stumbled upon the long
standing issue of ISR sharing in AVR MCUs.
Actually this is accomplished with an ISR written in C, which simply
calls another plain C function referenced via a function pointer
updated at runtime.
This approach is slow because GCC can't optimize the ISR, since it
does not know which registers will be used, so it defaults to push/pop
all of them.

My solution keeps the concept of pointers to functions, but greatly
improves speed by reducing the ISR itself to the bare minimum to call
another function, which will be compiled by GCC as a signal.
This means all interrupt optimizations will be put in place by GCC,
while ISRs can be still written in plain C code, but the overhead is
now much smaller. It has proven to reduce by 20 the number of
instructions for every ISR, mainly pushes/pops, which cuts the clock
cycle count down by 30 cycles (1 cycle for every push, 2 for pop).
In time units, this means 1.1 uSec are saved for every ISR invocation
and every shared ISR now takes only 13 clock cycles more than the
"bare" one.

A new ISR_SHARED function type has been defined in Common.h to hide
away from the programmer GCC attributes. All new shared interrupt
handling routines should be defined of this type to prevent
stack and registers corruption.

Minor changes were made to Codec.h to allow including it in .S files.
2019-12-08 14:11:05 +01:00
Fabian a35610f6a7 run make style #237 2019-11-15 10:21:40 +01:00
Georg 6e9b8563ee fixed bug with volatile position 2019-03-21 16:26:36 +01:00
Thorsten Bosbach 35cd58d048 Buildable, ISR sharing 2018-10-17 07:46:57 +02:00
ThorstenandGitHub 3484ce8288 Merge branch 'master' into ISO15693_base 2018-10-17 00:29:09 +02:00
Thorsten Bosbach d0c0da7d70 get iso15 buildable, runable and accepted by android reader 2018-08-18 12:37:59 +02:00
georgandThorsten Bosbach b1f0da0c33 added ISO15693 codec 2018-08-17 21:05:17 +02:00
chenzitai 396cc21be1 Start reader sniffing right after card sniffing finished.
This fix the bug that the sniffing get wrong data when the time gap between card signal and reader signal is too small

(cherry picked from commit 573cb49)
2018-08-15 22:48:22 +01:00
chenzitai 7af4cc5ee1 Longer reader pending timeout according to ISO-14443-4 5.5
(cherry picked from commit 4347afc)
2018-08-15 22:48:14 +01:00
chenzitai cb49799de1 Fix bug: ACA interrupt start after the card->Reader traffic start, so sometimes get not complete trace
Another buffer used for store card->reader traffic is added, so that card->reader traffic sniffing can start right after the reader->Card trafic sniffing finished.

(cherry picked from commit e074fcc)
2018-08-15 22:46:53 +01:00
chenzitai 2fa4a94fb9 name Interrupt vectors
(cherry picked from commit 8d15036)
2018-08-15 22:46:42 +01:00
chenzitai 686691f30c Remove experimental code in Reader14443-2A.c, make sniffing code independent form Reader14443-2A.c and ISO14443-2A.c
(cherry picked from commit 16f4fb1)
2018-08-15 22:46:30 +01:00
chenzitai cd321aff3d Event Channel and PORTB int1 bug fix:
1. Use event CH2 for timer resetting

2.  Can not sniff the second round of traffic due to the PORTB int1 was disabled in CardSniffInit(). This is reenabled in ReaderSniffInit

(cherry picked from commit 24b87e2)
2018-08-15 22:46:23 +01:00
chenzitai 08404604c2 Separate Reader->Card sniffing from the ISO14443-2A code
Use PORTB INT1, TCD0 CCD for sampling

The card->reader sniffing of this commint may be buggy

(cherry picked from commit 73b6c51)
2018-08-15 22:46:10 +01:00
chenzitai 5b46650edd Set up framework for sniffing
(cherry picked from commit 8a0b331)
2018-08-15 22:43:05 +01:00
Georg be67058675 added function for storing single setting data to eeprom, added reader threshold being stored in eeprom 2018-01-24 15:38:10 +01:00
Georg a5d0a8d216 reader codec upgrade 2018-01-22 08:47:59 +01:00
Georg 94d24d95c6 unified indentation 2017-11-07 15:53:23 +01:00
Georg c764e52bdc added autocalibrate command 2017-07-12 10:52:05 +02:00
Georg b1e457ca01 added reader restart function which may be called from application, so the reader field will be shut down and restarted after a given time 2017-04-04 16:26:09 +02:00
Georg 06f6d970ba added Reader_FWT variable
Application with this may now change the frame waiting time which may be helpful for ISO14443A-4 processing
2017-04-04 16:18:10 +02:00
Georg f46f5b4fbf update to RevG 2016-10-07 23:44:50 +02:00
Georg 5ac1cc7ed7 moved discontinued RevE files to own directory 2016-10-07 18:18:13 +02:00
Timo Kasper 49b2a19364 Major improvements (amongst others Mifare Ultralight and 7-Byte UID MF Plus support) and major bug fixes. Thanks to Simon Küppers and Julius Schmalz. 2015-03-04 01:28:25 +08:00