Commit Graph
12 Commits
Author SHA1 Message Date
Ave c5b07988dc Merge remote-tracking branch 'ceres/rrg-iso15693-codec-upd' into proxgrind 2020-09-15 21:08:19 +03: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
Willok 0cf47594ef RevG rebooted initial release 2019-12-06 10:18:01 +01:00
Fabian a35610f6a7 run make style #237 2019-11-15 10:21:40 +01:00
Georg 94d24d95c6 unified indentation 2017-11-07 15:53:23 +01: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 6ad9436a1e fix for AVR Toolchain 3.4.5 (WDT_PER_500CLK_gc) 2015-03-04 01:40:02 +08: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
Simon Küppers d2acde526d Fixed a problem with the WDT_PER_500CLK_gc define in new Versions of the AVR Toolchain 2015-02-22 17:56:53 +01:00
Simon Küppers 7b5573ef0f It looks like Atmel changed the naming of some defines in the avr-libc 2014-09-24 19:47:47 +02:00
Simon Küppers 646fc49150 Initial commit 2013-12-22 16:48:22 +01:00