[101] | 1 | /*
|
---|
| 2 | * TOPPERS/SSP Kernel
|
---|
| 3 | * Smallest Set Profile Kernel
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 6 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 7 | * Copyright (C) 2005-2008 by Embedded and Real-Time Systems Laboratory
|
---|
| 8 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 9 | * Copyright (C) 2010 by Naoki Saito
|
---|
| 10 | * Nagoya Municipal Industrial Research Institute, JAPAN
|
---|
| 11 | * Copyright (C) 2010-2011 by Meika Sugimoto
|
---|
| 12 | *
|
---|
| 13 | * ãLì ÒÍCÈºÌ (1)`(4) Ìðð½·êÉÀèC{\tgEF
|
---|
| 14 | * Ai{\tgEFAðüϵ½àÌðÜÞDȺ¯¶jðgpE¡»EüÏE
|
---|
| 15 | * ÄzziȺCpÆÄÔj·é±Æð³Åø·éD
|
---|
| 16 | * (1) {\tgEFAð\[XR[hÌ`Åp·éêÉÍCãLÌì
|
---|
| 17 | * \¦C±Ìpð¨æѺL̳ÛØKèªC»ÌÜÜÌ`Å\[X
|
---|
| 18 | * R[hÉÜÜêÄ¢é±ÆD
|
---|
| 19 | * (2) {\tgEFAðCCu`®ÈÇC¼Ì\tgEFAJÉgp
|
---|
| 20 | * Å«é`ÅÄzz·éêÉÍCÄzzɺ¤hL
|
---|
| 21 | gipÒ}
|
---|
| 22 | * j
|
---|
| 23 | AÈÇjÉCãLÌì \¦C±Ìpð¨æѺL̳Û
|
---|
| 24 | * ØKèðfÚ·é±ÆD
|
---|
| 25 | * (3) {\tgEFAðC@íÉgÝÞÈÇC¼Ì\tgEFAJÉgp
|
---|
| 26 | * Å«È¢`ÅÄzz·éêÉÍCÌ¢¸ê©Ìðð½·±ÆD
|
---|
| 27 | * (a) Äzzɺ¤hL
|
---|
| 28 | gipÒ}j
|
---|
| 29 | AÈÇjÉCãLÌì
|
---|
| 30 | * \¦C±Ìpð¨æѺL̳ÛØKèðfÚ·é±ÆD
|
---|
| 31 | * (b) ÄzzÌ`ÔðCÊÉèßéû@ÉæÁÄCTOPPERSvWFNgÉñ
|
---|
| 32 | * ·é±ÆD
|
---|
| 33 | * (4) {\tgEFAÌpÉæè¼ÚIܽÍÔÚIɶ¶é¢©Èé¹Q
|
---|
| 34 | * ©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆDܽC
|
---|
| 35 | * {\tgEFAÌ[UܽÍGh[U©çÌ¢©ÈéRÉîÃ
|
---|
| 36 | * ¿©çàCãLì Ò¨æÑTOPPERSvWFNgðÆÓ·é±ÆD
|
---|
| 37 | *
|
---|
| 38 | * {\tgEFAÍC³ÛØÅñ³êÄ¢éàÌÅ éDãLì Ò¨æ
|
---|
| 39 | * ÑTOPPERSvWFNgÍC{\tgEFAÉÖµÄCÁèÌgpÚIÉη
|
---|
| 40 | * éK«àÜßÄC¢©ÈéÛØàsíÈ¢DܽC{\tgEFAÌp
|
---|
| 41 | * Éæè¼ÚIܽÍÔÚIɶ¶½¢©Èé¹QÉÖµÄàC»ÌÓCð
|
---|
| 42 | * íÈ¢D
|
---|
| 43 | *
|
---|
| 44 | */
|
---|
| 45 |
|
---|
| 46 | /*
|
---|
| 47 | * ÝÇ@\
|
---|
| 48 | */
|
---|
| 49 |
|
---|
| 50 | #include "kernel_impl.h"
|
---|
| 51 | #include "check.h"
|
---|
| 52 | #include "task.h"
|
---|
| 53 | #include "interrupt.h"
|
---|
| 54 |
|
---|
| 55 |
|
---|
| 56 | /*
|
---|
| 57 | * ÝÇ@\Ìú»
|
---|
| 58 | */
|
---|
| 59 | #ifdef TOPPERS_intini
|
---|
| 60 | #ifndef OMIT_INITIALIZE_INTERRUPT
|
---|
| 61 |
|
---|
| 62 | void
|
---|
| 63 | initialize_interrupt(void)
|
---|
| 64 | {
|
---|
| 65 | uint_t i;
|
---|
| 66 |
|
---|
| 67 | for (i = 0U; i < tnum_inhno; i++) {
|
---|
| 68 | x_define_inh(inhinib_inhno[i], (FP)(inhinib_entry[i]));
|
---|
| 69 | }
|
---|
| 70 | for (i = 0U; i < tnum_intno; i++) {
|
---|
| 71 | x_config_int(intinib_intno[i], intinib_intatr[i], intinib_intpri[i]);
|
---|
| 72 | }
|
---|
| 73 | }
|
---|
| 74 |
|
---|
| 75 | #endif /* OMIT_INITIALIZE_INTERRUPT */
|
---|
| 76 | #endif /* TOPPERS_intini */
|
---|
| 77 |
|
---|
| 78 | /*
|
---|
| 79 | * ÝÌÖ~
|
---|
| 80 | */
|
---|
| 81 | #ifdef TOPPERS_dis_int
|
---|
| 82 | #ifdef TOPPERS_TARGET_SUPPORT_DIS_INT
|
---|
| 83 |
|
---|
| 84 | ER
|
---|
| 85 | dis_int(INTNO intno)
|
---|
| 86 | {
|
---|
| 87 | bool_t locked;
|
---|
| 88 | ER ercd;
|
---|
| 89 |
|
---|
| 90 | CHECK_TSKCTX();
|
---|
| 91 | CHECK_INTNO_DISINT(intno);
|
---|
| 92 |
|
---|
| 93 | locked = t_sense_lock();
|
---|
| 94 |
|
---|
| 95 | if (!locked) {
|
---|
| 96 | t_lock_cpu();
|
---|
| 97 | }
|
---|
| 98 |
|
---|
| 99 | if (t_disable_int(intno)) {
|
---|
| 100 | ercd = E_OK;
|
---|
| 101 | }
|
---|
| 102 | else {
|
---|
| 103 | ercd = E_OBJ;
|
---|
| 104 | }
|
---|
| 105 |
|
---|
| 106 | if (!locked) {
|
---|
| 107 | t_unlock_cpu();
|
---|
| 108 | }
|
---|
| 109 |
|
---|
| 110 | error_exit:
|
---|
| 111 | return(ercd);
|
---|
| 112 | }
|
---|
| 113 |
|
---|
| 114 | #endif /* TOPPERS_SUPPORT_DIS_INT */
|
---|
| 115 | #endif /* TOPPERS_dis_int */
|
---|
| 116 |
|
---|
| 117 |
|
---|
| 118 | /*
|
---|
| 119 | * ÝÌÂ
|
---|
| 120 | */
|
---|
| 121 | #ifdef TOPPERS_ena_int
|
---|
| 122 | #ifdef TOPPERS_TARGET_SUPPORT_ENA_INT
|
---|
| 123 |
|
---|
| 124 | ER
|
---|
| 125 | ena_int(INTNO intno)
|
---|
| 126 | {
|
---|
| 127 | bool_t locked;
|
---|
| 128 | ER ercd;
|
---|
| 129 |
|
---|
| 130 | CHECK_TSKCTX();
|
---|
| 131 | CHECK_INTNO_DISINT(intno);
|
---|
| 132 |
|
---|
| 133 | locked = t_sense_lock();
|
---|
| 134 | if (!locked) {
|
---|
| 135 | t_lock_cpu();
|
---|
| 136 | }
|
---|
| 137 |
|
---|
| 138 | if (t_enable_int(intno)) {
|
---|
| 139 | ercd = E_OK;
|
---|
| 140 | }
|
---|
| 141 | else {
|
---|
| 142 | ercd = E_OBJ;
|
---|
| 143 | }
|
---|
| 144 |
|
---|
| 145 | if (!locked) {
|
---|
| 146 | t_unlock_cpu();
|
---|
| 147 | }
|
---|
| 148 |
|
---|
| 149 | error_exit:
|
---|
| 150 | return(ercd);
|
---|
| 151 | }
|
---|
| 152 |
|
---|
| 153 | #endif /* TOPPERS_SUPPORT_ENA_INT */
|
---|
| 154 | #endif /* TOPPERS_ena_int */
|
---|