Files
Federico Cerutti 4135ca135c ISO15693 Codec minor fixes
Unvarying interrupt configuration moved from StartISO15693Demod to CodecInit
Fixed an old issue (https://github.com/geo-rg/ChameleonMini/issues/4) properly
overwriting the PERBUF register when no data has to be sent
Loadmodulation ISR has a new GOTO label which is called when ISO t1 time is
elapsed, but data is not yet ready. This way it is possible to avoid checking
for state validity on every ISR hit
New inline function to clean up interrupts when field noise (garbage)
is incorrectly picked up
Bitrate configuration in ISO15693_EOC has been simplified

Cleaned up header file with useless defines. Moved defines to .c when there was
no need to share them with other source files

Annotated numer of clock cycles consumed by asm ISR sharing routine

As usual, this work was done with @MrModDom
2020-09-04 01:41:22 +02:00

49 lines
1.4 KiB
ArmAsm

; This file allows to share ISR at runtime with a low overhead.
; Functions that have to be shared MUST be defined as ISR_SHARED types
; (Defined in Common.h) to instruct GCC to compile them preserving the stack
;
; Created on: 2019-12-06
; Author: ceres-c
;
#include "Codec/Codec.h"
#include <avr/interrupt.h>
; Macro to call ISR functions
; For development purposes: cycles penality before landing in the Shared ISR is 10
.macro call_isr isr_address
push r30 ; 1
push r31 ; 1
lds r30, \isr_address ; 3
lds r31, \isr_address+1 ; 3
icall ; 2 (16 bit PC)
pop r31
pop r30
reti
.endm
; Shared ISR must be defined below as globals
; Example:
;
; .global <INTERRUPT-TO-SHARE>
; INTERRUPT-TO-SHARE:
; call_isr POINTER-TO-VARIABLE-INTERRUPT-HANDLER
;
; Where:
; INTERRUPT-TO-SHARE
; The target interrupt which needs to be shared
; POINTER-TO-VARIABLE-INTERRUPT-HANDLER
; A pointer to the interrupt handler which can be modified at runtime.
; Must be a volatile pointer to function declared in Codec.h
.global CODEC_DEMOD_IN_INT0_VECT
CODEC_DEMOD_IN_INT0_VECT:
call_isr isr_func_CODEC_DEMOD_IN_INT0_VECT
.global CODEC_TIMER_SAMPLING_CCC_VECT
CODEC_TIMER_SAMPLING_CCC_VECT:
call_isr isr_func_TCD0_CCC_vect
.global CODEC_TIMER_LOADMOD_CCB_VECT
CODEC_TIMER_LOADMOD_CCB_VECT:
call_isr isr_func_CODEC_TIMER_LOADMOD_CCB_VECT