diff options
| author | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
|---|---|---|
| committer | Xavier ASUS <xavi92psx@gmail.com> | 2019-10-18 00:31:54 +0200 |
| commit | 268a53de823a6750d6256ee1fb1e7707b4b45740 (patch) | |
| tree | 42c1799a9a82b2f7d9790ee9fe181d72a7274751 /support/regression/tests/interrupt.c | |
| download | sdcc-gas-268a53de823a6750d6256ee1fb1e7707b4b45740.tar.gz | |
sdcc-3.9.0 fork implementing GNU assembler syntax
This fork aims to provide better support for stm8-binutils
Diffstat (limited to 'support/regression/tests/interrupt.c')
| -rw-r--r-- | support/regression/tests/interrupt.c | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/support/regression/tests/interrupt.c b/support/regression/tests/interrupt.c new file mode 100644 index 0000000..c0d0d32 --- /dev/null +++ b/support/regression/tests/interrupt.c @@ -0,0 +1,48 @@ +/** Interrupt tests. + regbank: 0,1 + */ +#include <testfwk.h> + +#if defined(__SDCC_mcs51) + +#include <8052.h> + +volatile long lA = 12345; +volatile long lB = 67890; +volatile long lC = 0; + +#endif + +void +testInterrupt (void) +{ +#if defined(__SDCC_mcs51) + register long x = lC; + + //enable the interrupt and set it + ET2 = 1; + EA = 1; + TF2 = 1; + + while (TF2) + ; //wait until serviced + ASSERT (lC + x == 74474); +#else + ASSERT (1); +#endif +} + +#if defined(__SDCC_mcs51) +// Timer2 interrupt service routine +// with register and (stack)spil usage +void +T2_isr (void) __interrupt 5 __using({regbank}) +{ + long a, b, c; + a = lA + 0xBABE; + b = lB + 0xBEEB; + c = a ^ b; + lC = c; + TF2 = 0; +} +#endif |
