QP/C++ 6.9.3
ARM Cortex-R

Preemptive QK Kernel

1 
38 #ifndef QK_PORT_HPP
39 #define QK_PORT_HPP
40 
41 // QK-specific Interrupt Request handler BEGIN
42 #ifdef __FPU_PRESENT
43 #define QK_IRQ_BEGIN(name_) \
44  void name_(void) \
45  __attribute__ ((interrupt ("irq"))); \
46  __attribute__ ((naked)) void name_(void) { \
47  __asm volatile (" SUB LR, LR, #4\n" \
48  " SRSDB #31!\n" \
49  " CPS #31\n" \
50  " PUSH {R0-R3, R12}"); \
51  __asm(" FMRX R12, FPSCR\n" \
52  " STMFD SP!, {R12}\n" \
53  " FMRX R12, FPEXC\n" \
54  " STMFD SP!, {R12}\n" \
55  " FSTMDBD SP!, {D0-D7}"); \
56  __asm(" AND R3, SP, #4\n" \
57  " SUB SP, SP, R3\n" \
58  " PUSH {R3, LR}\n"); \
59  ++QK_attr_.intNest; {
60 #else
61 #define QK_IRQ_BEGIN(name_) \
62  void name_(void) \
63  __attribute__ ((target ("arm"))); \
64  __attribute__ ((naked)) void name_(void) { \
65  __asm volatile (" SUB LR, LR, #4\n" \
66  " SRSDB #31!\n" \
67  " CPS #31\n" \
68  " PUSH {R0-R3, R12}"); \
69  __asm(" AND R3, SP, #4\n" \
70  " SUB SP, SP, R3\n" \
71  " PUSH {R3, LR}\n"); \
72  ++QK_attr_.intNest; {
73 #endif
74 
75 /* QK-specific Interrupt Request handler END */
76 #ifdef __FPU_PRESENT
77 #define QK_IRQ_END() \
78  } --QK_attr_.intNest; \
79  if (QK_attr_.intNest == (uint_fast8_t)0) { \
80  if (QK_sched_() != (uint_fast8_t)0) { \
81  QK_activate_(); \
82  } \
83  } \
84  __asm volatile (" POP {R3, LR}\n" \
85  " ADD SP, SP, R3"); \
86  __asm(" FLDMIAD SP!, {D0-D7}\n" \
87  " LDMFD SP!, {R12}\n" \
88  " FMXR FPEXC, R12 \n" \
89  " LDMFD SP!, {R12} \n" \
90  " FMXR FPSCR, R12"); \
91  __asm(" POP {R0-R3, R12}\n" \
92  " RFEIA SP!"); \
93 }
94 #else
95 #define QK_IRQ_END() \
96  } --QK_attr_.intNest; \
97  if (QK_attr_.intNest == (uint_fast8_t)0) { \
98  if (QK_sched_() != (uint_fast8_t)0) { \
99  QK_activate_(); \
100  } \
101  } \
102  __asm volatile (" POP {R3, LR}\n" \
103  " ADD SP, SP, R3"); \
104  __asm volatile (" POP {R0-R3, R12}\n" \
105  " RFEIA SP!"); \
106 }
107 #endif
108 
109 #include "qk.hpp" // QK platform-independent public interface
110 
111 #endif // QK_PORT_HPP
QK/C++ platform-independent public interface.

Cooperative QV Kernel


Next: ARM7/ARM9