hsk-libs-dev  270
High Speed Karlsruhe XC878 library collection
Data Structures | Variables
hsk_isr.h File Reference

HSK Shared Interrupt Service Routine headers. More...

#include "hsk_isr.isr"
Include dependency graph for hsk_isr.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hsk_isr5_callback
 Shared interrupt 5 routine. More...
 
struct  hsk_isr6_callback
 Shared interrupt 6 routine. More...
 
struct  hsk_isr8_callback
 Shared interrupt 8 routine. More...
 
struct  hsk_isr9_callback
 Shared interrupt 9 routine. More...
 
struct  hsk_isr14_callback
 Shared non-maskable interrupt routine. More...
 

Variables

volatile struct hsk_isr5_callback hsk_isr5
 Introduce callback function pointers for ISR 5. More...
 
volatile struct hsk_isr6_callback hsk_isr6
 Introduce callback function pointers for ISR 6. More...
 
volatile struct hsk_isr8_callback hsk_isr8
 Introduce callback function pointers for ISR 8. More...
 
volatile struct hsk_isr9_callback hsk_isr9
 Introduce callback function pointers for ISR 9. More...
 
volatile struct hsk_isr14_callback hsk_isr14
 Introduce callback function pointers for NMI ISR. More...
 

Detailed Description

HSK Shared Interrupt Service Routine headers.

This header is used by other libraries to use interrupts with multiple sources. A callback function can be provided for each available interrupt source.

Author
kami

SFR Pages

An ISR callback function cannot make assumptions about current SFR pages like the regular functions that can expect all pages to be set to 0.

Instead a callback function needs to set all pages and restore whatever page was in use previously.

The following table lists the store and restore selectors by context and must be obeyed to avoid memory corruption:

Save Restore Context
SST0 RST0 ISRs
SST1 RST1 ISR callback functions
SST2 RST2 NMI ISR
SST3 RST3 NMI callback functions

Every callback function is called with RMAP = 0. If the callback function changes RMAP it does not have to take care of restoring it. RMAP is always restored to its original state by the shared ISRs.

Register Banks

Interrupts are each a root node of their own call tree. This is why they must preserve all the working registers.

the pushing and popping of the 8 Rn registers for each interrupt call costs 64 CCLK cycles.

To avoid this overhead different register banks are used. Call trees, i.e. interrupts, can use the same register bank if they cannot interrupt each other. Each used register bank costs 8 bytes of regular data memory. To minimize this cost all interrupts must have the same priority.

The following table is used:

Priority Context Bank
- Regular code 0
0 ISR, callback 1
1 ISR, callback -
2 ISR, callback -
3 ISR, callback -
NMI NMI ISR, callback 2

Assigning higher priority to an ISR will affect (as in break) the operation of all lower priority ISRs.

Variable Documentation

§ hsk_isr14

volatile struct hsk_isr14_callback hsk_isr14

Introduce callback function pointers for NMI ISR.

Functions called back from the NMI ISR should use SST3/RST3 instead of SST1/RST1, because they might interrupt other ISRs.

Introduce callback function pointers for NMI ISR.

§ hsk_isr5

volatile struct hsk_isr5_callback hsk_isr5

Introduce callback function pointers for ISR 5.

Introduce callback function pointers for ISR 5.

§ hsk_isr6

volatile struct hsk_isr6_callback hsk_isr6

Introduce callback function pointers for ISR 6.

Introduce callback function pointers for ISR 6.

§ hsk_isr8

volatile struct hsk_isr8_callback hsk_isr8

Introduce callback function pointers for ISR 8.

Introduce callback function pointers for ISR 8.

§ hsk_isr9

volatile struct hsk_isr9_callback hsk_isr9

Introduce callback function pointers for ISR 9.

Introduce callback function pointers for ISR 9.