QP/C  6.9.3
Real-Time Embedded Framework
ARM Cortex-R

Preemptive QK Kernel

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

Cooperative QV Kernel


Next: ARM7/ARM9