[302] | 1 | /*
|
---|
| 2 | * TOPPERS Software
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems
|
---|
| 4 | *
|
---|
| 5 | * Copyright (C) 2014-2015 by Embedded and Real-Time Systems Laboratory
|
---|
| 6 | * Graduate School of Information Science, Nagoya Univ., JAPAN
|
---|
| 7 | *
|
---|
| 8 | * ä¸è¨èä½æ¨©è
|
---|
| 9 | ã¯ï¼ä»¥ä¸ã®(1)ã(4)ã®æ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§
|
---|
| 10 | * ã¢ï¼æ¬ã½ããã¦ã§ã¢ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹
|
---|
| 11 | * å¤ã»åé
|
---|
| 12 | å¸ï¼ä»¥ä¸ï¼å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 13 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 14 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 15 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 16 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 17 | * ç¨ã§ããå½¢ã§åé
|
---|
| 18 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 19 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 20 | * è
|
---|
| 21 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 22 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 23 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 24 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 25 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 26 | * ã¨ï¼
|
---|
| 27 | * (a) åé
|
---|
| 28 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 29 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 30 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 31 | * (b) åé
|
---|
| 32 | å¸ã®å½¢æ
|
---|
| 33 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 34 | * å ±åãããã¨ï¼
|
---|
| 35 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 36 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 37 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 38 | 責ãããã¨ï¼
|
---|
| 39 | * ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®ã¦ã¼ã¶ã¾ãã¯ã¨ã³ãã¦ã¼ã¶ããã®ãããªãç
|
---|
| 40 | * ç±ã«åºã¥ãè«æ±ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 41 | ããã³TOPPERSããã¸ã§ã¯ãã
|
---|
| 42 | * å
|
---|
| 43 | 責ãããã¨ï¼
|
---|
| 44 | *
|
---|
| 45 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 46 | ã
|
---|
| 47 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ç¹å®ã®ä½¿ç¨ç®ç
|
---|
| 48 | * ã«å¯¾ããé©åæ§ãå«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§
|
---|
| 49 | * ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ã
|
---|
| 50 | * ã®è²¬ä»»ãè² ããªãï¼
|
---|
| 51 | *
|
---|
| 52 | * $Id: hrt_systim3.c 310 2015-02-08 13:46:46Z ertl-hiro $
|
---|
| 53 | */
|
---|
| 54 |
|
---|
| 55 | /*
|
---|
| 56 | * ã·ã¹ãã æå»ç®¡çæ©è½ã®ãã¹ã(3)
|
---|
| 57 | *
|
---|
| 58 | * ããã¹ãã®ç®çã
|
---|
| 59 | *
|
---|
| 60 | * å¨æãã³ãã©ã®èµ·åã¿ã¤ãã³ã°ããã¹ãããï¼
|
---|
| 61 | *
|
---|
| 62 | * ã¾ãï¼ä»¥ä¸ã®é¢æ°ã®C1ã«ãã¬ãã¸ãéæããï¼
|
---|
| 63 | * tmevtb_dequeue
|
---|
| 64 | * tmevtb_lefttim
|
---|
| 65 | *
|
---|
| 66 | * ããã¹ãé
|
---|
| 67 | ç®ã
|
---|
| 68 | *
|
---|
| 69 | * (A) å¨æãã³ãã©ã®èµ·åã¿ã¤ãã³ã°ã®ç¢ºèª
|
---|
| 70 | * (A-1) TA_STAå±æ§ã§ï¼èµ·åä½ç¸ï¼ååã®èµ·åæå»ï¼ã0ã®å ´å
|
---|
| 71 | * (A-2) TA_STAå±æ§ã§ï¼èµ·åä½ç¸ï¼ååã®èµ·åæå»ï¼ã0ã§ãªãå ´å
|
---|
| 72 | * (A-3) sta_cycã§ï¼èµ·åä½ç¸ï¼ååã®èµ·åæå»ï¼ã0ã®å ´å
|
---|
| 73 | * (A-4) sta_cycã§ï¼èµ·åä½ç¸ï¼ååã®èµ·åæå»ï¼ã0ã§ãªãå ´å
|
---|
| 74 | * (A-5) 決ããããå¨æã§åèµ·åããããã¨
|
---|
| 75 | * (B) tmevtb_dequeueã®å®è¡/åå²ãã¹ã®ç¶²ç¾
|
---|
| 76 |
|
---|
| 77 | * (B-1) signal_timeä¸ããã®å¼ã³åºã
|
---|
| 78 | * (B-2) å
|
---|
| 79 | é 以å¤ã®ã¿ã¤ã ã¤ãã³ããåé¤ããå ´å
|
---|
| 80 | * (B-3) å
|
---|
| 81 | é ã®ã¿ã¤ã ã¤ãã³ããåé¤ããå ´å
|
---|
| 82 | * (C) tmevtb_lefttimã®å®è¡/åå²ãã¹ã®ç¶²ç¾
|
---|
| 83 |
|
---|
| 84 | * (C-1) ã¤ãã³ãã®çºçæå»ãéãã¦ããå ´å
|
---|
| 85 | * (C-2) ã¤ãã³ãã®çºçæå»ãéãã¦ããªãå ´å
|
---|
| 86 | *
|
---|
| 87 | * ã使ç¨ãªã½ã¼ã¹ã
|
---|
| 88 | *
|
---|
| 89 | * é«å解è½ã¿ã¤ãã¢ã¸ã¥ã¼ã«ã®æ§è³ªï¼HRT_CONFIG1
|
---|
| 90 | * TCYC_HRTCNT æªå®ç¾©ï¼2^32ã®æå³ï¼
|
---|
| 91 | * TSTEP_HRTCNT 1U
|
---|
| 92 | * HRTCNT_BOUND 4000000002U
|
---|
| 93 | *
|
---|
| 94 | * TASK1: ä¸åªå
|
---|
| 95 | 度ã¿ã¹ã¯ï¼ã¡ã¤ã³ã¿ã¹ã¯ï¼æåããèµ·å
|
---|
| 96 | * ALM1: ã¢ã©ã¼ã ãã³ãã©
|
---|
| 97 | * CYC1: å¨æãã³ãã©ï¼å¨æï¼1000ï¼åæä½ç¸ï¼0ï¼
|
---|
| 98 | * CYC2: å¨æãã³ãã©ï¼å¨æï¼500ï¼åæä½ç¸ï¼499ï¼
|
---|
| 99 | *
|
---|
| 100 | * ãè£è¶³èª¬æã
|
---|
| 101 | *
|
---|
| 102 | * ã¿ã¤ã ã¤ãã³ããç»é²ããã¦ããªãæã«é«å解è½ã¿ã¤ãã«è¨å®ããç¸å¯¾ã¯ï¼
|
---|
| 103 | * ããªãã調æ´æ©è½ãæããªãå ´åã¯HRTCNT_BOUNDã§ããã®ã«å¯¾ãã¦ï¼ããª
|
---|
| 104 | * ãã調æ´æ©è½ãæã¤å ´åã¯TMAX_RELTIMãã¤ãã³ãæå»ã®ä¼¸ç¸®çã§å²ã£ãå¤
|
---|
| 105 | * ã¨HRTCNT_BOUNDã®å°ããæ¹ã®å¤ï¼ãã®ãã¹ãã§ã¯ï¼ããªããéãè¨å®ããï¼
|
---|
| 106 | * HRTCNT_BOUNDï¼TMAX_RELTIMã§ããããï¼TMAX_RELTIMã«ä¸è´ï¼ã¨ãªãï¼ã
|
---|
| 107 | * ãã§ï¼HRTCNT_EMPTYããã®å¤ã«å®ç¾©ãï¼ããªãã調æ´æ©è½ã®æç¡ã«ããã
|
---|
| 108 | * åããã¹ãã·ã¼ã±ã³ã¹ã使ããããã«ããï¼
|
---|
| 109 | *
|
---|
| 110 | * 以ä¸ã®ãã¹ãã·ã¼ã±ã³ã¹ã®ã³ã¡ã³ãä¸ã§ï¼ãçºçï¼xxxãã¨ã¯ï¼é«å解è½ã¿
|
---|
| 111 | * ã¤ãã®ã«ã¦ã³ãå¤ãxxxã«ãªã£ãæã«ã¿ã¤ã ã¤ãã³ããçºçãããã¨ãæå³
|
---|
| 112 | * ããï¼ã¿ã¤ã ã¤ãã³ãã®ã¤ãã³ãçºçæå»ã§ã¯ãªãï¼
|
---|
| 113 | *
|
---|
| 114 | * ããã¹ãã·ã¼ã±ã³ã¹ã
|
---|
| 115 | *
|
---|
| 116 | * == START ==
|
---|
| 117 | * // ã«ã¼ãã«èµ·åï¼é«å解è½ã¿ã¤ãã®ã«ã¦ã³ãå¤ã¨ã¤ãã³ãæå»ã¯10ããã
|
---|
| 118 | * 1: [target_hrt_get_current -> 10U] // CYC1ã®æ¬¡åçºçï¼10
|
---|
| 119 | * 2: [target_hrt_raise_event] // CYC2ã®æ¬¡åçºçï¼509
|
---|
| 120 | * == TASK1ï¼åªå
|
---|
| 121 | 度ï¼ä¸ï¼==
|
---|
| 122 | * 3: DO(target_raise_hrt_int(0U))
|
---|
| 123 | * == HRT_HANDLER ==
|
---|
| 124 | * 4: [target_hrt_get_current -> 10U] ... (A-1) // CYC1ã®çºç
|
---|
| 125 | * == CYC1-1ï¼1åç®ï¼== // CYC1ã®æ¬¡åçºçï¼1010
|
---|
| 126 | * 5: RETURN
|
---|
| 127 | * 6: [target_hrt_get_current -> 20U]
|
---|
| 128 | * 7: [target_hrt_set_event <- 489U]
|
---|
| 129 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 130 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
| 131 | * 8: DO(target_raise_hrt_int(0U))
|
---|
| 132 | * == HRT_HANDLER ==
|
---|
| 133 | * 9: [target_hrt_get_current -> 509U] ... (A-2) // CYC2ã®çºç
|
---|
| 134 | * == CYC2-1ï¼1åç®ï¼== // CYC2ã®æ¬¡åçºçï¼1009
|
---|
| 135 | * 10: RETURN
|
---|
| 136 | * 11: [target_hrt_get_current -> 519U]
|
---|
| 137 | * 12: [target_hrt_set_event <- 490U]
|
---|
| 138 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 139 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
| 140 | * 13: DO(target_raise_hrt_int(0U))
|
---|
| 141 | * == HRT_HANDLER ==
|
---|
| 142 | * 14: [target_hrt_get_current -> 1009U] ... (A-5) // CYC2ã®çºç
|
---|
| 143 | * == CYC2-2ï¼2åç®ï¼== // CYC2ã®æ¬¡åçºçï¼1509
|
---|
| 144 | * 15: RETURN
|
---|
| 145 | * 16: [target_hrt_get_current -> 1010U] ... (A-5) // CYC1ã®çºç
|
---|
| 146 | * == CYC1-2ï¼2åç®ï¼== // CYC1ã®æ¬¡åçºçï¼2010
|
---|
| 147 | * 17: RETURN
|
---|
| 148 | * 18: [target_hrt_get_current -> 1020U]
|
---|
| 149 | * 19: [target_hrt_set_event <- 489U]
|
---|
| 150 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 151 | * 20: ref_cyc(CYC1, &rcyc) ... (C-2)
|
---|
| 152 | * 21: [target_hrt_get_current -> 1030U]
|
---|
| 153 | * 22: assert(rcyc.lefttim == 979U)
|
---|
| 154 | * 23: stp_cyc(CYC1) ... (B-2)
|
---|
| 155 | * 24: stp_cyc(CYC2) ... (B-3)
|
---|
| 156 | * 25: [target_hrt_get_current -> 1040U]
|
---|
| 157 | * 26: [target_hrt_set_event <- HRTCNT_EMPTY]
|
---|
| 158 | * 27: sta_cyc(CYC1) ... (A-3)
|
---|
| 159 | * 28: [target_hrt_get_current -> 1050U] // CYC1ã®çºçï¼1051
|
---|
| 160 | * 29: [target_hrt_set_event <- 1U]
|
---|
| 161 | * 30: DO(target_raise_hrt_int(0U))
|
---|
| 162 | * == HRT_HANDLER ==
|
---|
| 163 | * 31: [target_hrt_get_current -> 1051U] // CYC1ãçºç
|
---|
| 164 | * == CYC1-3ï¼3åç®ï¼== // CYC1ã®æ¬¡åçºçï¼2051
|
---|
| 165 | * 32: RETURN
|
---|
| 166 | * 33: [target_hrt_get_current -> 1052U]
|
---|
| 167 | * 34: [target_hrt_set_event <- 999U]
|
---|
| 168 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 169 | * 35: sta_cyc(CYC2) ... (A-4)
|
---|
| 170 | * 36: [target_hrt_get_current -> 1060U] // CYC2ã®çºçï¼1560
|
---|
| 171 | * 37: [target_hrt_set_event <- 500U]
|
---|
| 172 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
| 173 | * 38: ref_cyc(CYC2, &rcyc) ... (C-2)
|
---|
| 174 | * 39: [target_hrt_get_current -> 1558U]
|
---|
| 175 | * 40: assert(rcyc.lefttim == 1U)
|
---|
| 176 | * // 以ä¸ã®ã·ã¼ã±ã³ã¹ã¯ï¼ã¿ã¤ãå²è¾¼ã¿ã®åä»ãé
|
---|
| 177 | ããå ´åã«ããçºçããªãï¼
|
---|
| 178 | * 41: ref_cyc(CYC2, &rcyc) ... (C-1)
|
---|
| 179 | * 42: [target_hrt_get_current -> 1561U] // CYC2ã®çºçæå»ã
|
---|
| 180 | * 43: assert(rcyc.lefttim == 0U) // éãã¦ãã
|
---|
| 181 | * 44: DO(target_raise_hrt_int(0U))
|
---|
| 182 | * == HRT_HANDLER ==
|
---|
| 183 | * 45: [target_hrt_get_current -> 1562U] // CYC2ãçºç
|
---|
| 184 | * == CYC2-3ï¼3åç®ï¼== // CYC2ã®æ¬¡åçºçï¼2060
|
---|
| 185 | * 46: RETURN
|
---|
| 186 | * 47: [target_hrt_get_current -> 1563U]
|
---|
| 187 | * 48: [target_hrt_set_event <- 488U]
|
---|
| 188 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 189 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
| 190 | * 49: sta_alm(ALM1, 100U)
|
---|
| 191 | * 50: [target_hrt_get_current -> 1620U] // ALM1ã®çºçï¼1721
|
---|
| 192 | * 51: [target_hrt_set_event <- 101U]
|
---|
| 193 | * 52: sta_alm(ALM2, 200U)
|
---|
| 194 | * 53: [target_hrt_get_current -> 1630U] // ALM2ã®çºçï¼1831
|
---|
| 195 | * // ããã§æéãçµéãããã¨ãæ³å®
|
---|
| 196 | * 54: DO(target_raise_hrt_int(0U))
|
---|
| 197 | * == HRT_HANDLER ==
|
---|
| 198 | * 55: [target_hrt_get_current -> 1721] // ALM1ãçºç
|
---|
| 199 | * == ALM1-1ï¼1åç®ï¼==
|
---|
| 200 | * 56: stp_alm(ALM2) ... (B-1)
|
---|
| 201 | * RETURN
|
---|
| 202 | * 57: [target_hrt_get_current -> 1730U]
|
---|
| 203 | * 58: [target_hrt_set_event <- 321U]
|
---|
| 204 | * == TASK1ï¼ç¶ãï¼==
|
---|
| 205 | * 59: END
|
---|
| 206 | */
|
---|
| 207 |
|
---|
| 208 | #include <kernel.h>
|
---|
| 209 | #include <t_syslog.h>
|
---|
| 210 | #include "syssvc/test_svc.h"
|
---|
| 211 | #include "kernel_cfg.h"
|
---|
| 212 | #include "hrt_systim3.h"
|
---|
| 213 | #include "target_timer.h"
|
---|
| 214 |
|
---|
| 215 | #if !defined(HRT_CONFIG1) || defined(HRT_CONFIG2)
|
---|
| 216 | #error Compiler option "-DHRT_CONFIG1" is missing.
|
---|
| 217 | #endif
|
---|
| 218 |
|
---|
| 219 | #ifdef TOPPERS_SUPPORT_DRIFT
|
---|
| 220 | #define HRTCNT_EMPTY TMAX_RELTIM
|
---|
| 221 | #else /* TOPPERS_SUPPORT_DRIFT */
|
---|
| 222 | #define HRTCNT_EMPTY HRTCNT_BOUND
|
---|
| 223 | #endif /* TOPPERS_SUPPORT_DRIFT */
|
---|
| 224 |
|
---|
| 225 | #define target_hrt_get_current _kernel_target_hrt_get_current
|
---|
| 226 | #define target_hrt_set_event _kernel_target_hrt_set_event
|
---|
| 227 | #define target_hrt_raise_event _kernel_target_hrt_raise_event
|
---|
| 228 |
|
---|
| 229 | void
|
---|
| 230 | alarm2_handler(intptr_t exinf)
|
---|
| 231 | {
|
---|
| 232 | }
|
---|
| 233 |
|
---|
| 234 | /* DO NOT DELETE THIS LINE -- gentest depends on it. */
|
---|
| 235 |
|
---|
| 236 | static uint_t alarm1_count = 0;
|
---|
| 237 |
|
---|
| 238 | void
|
---|
| 239 | alarm1_handler(intptr_t exinf)
|
---|
| 240 | {
|
---|
| 241 | ER_UINT ercd;
|
---|
| 242 |
|
---|
| 243 | switch (++alarm1_count) {
|
---|
| 244 | case 1:
|
---|
| 245 | check_point(56);
|
---|
| 246 | ercd = stp_alm(ALM2);
|
---|
| 247 | check_ercd(ercd, E_OK);
|
---|
| 248 |
|
---|
| 249 | return;
|
---|
| 250 |
|
---|
| 251 | check_point(0);
|
---|
| 252 |
|
---|
| 253 | default:
|
---|
| 254 | check_point(0);
|
---|
| 255 | }
|
---|
| 256 | check_point(0);
|
---|
| 257 | }
|
---|
| 258 |
|
---|
| 259 | static uint_t cyclic1_count = 0;
|
---|
| 260 |
|
---|
| 261 | void
|
---|
| 262 | cyclic1_handler(intptr_t exinf)
|
---|
| 263 | {
|
---|
| 264 |
|
---|
| 265 | switch (++cyclic1_count) {
|
---|
| 266 | case 1:
|
---|
| 267 | check_point(5);
|
---|
| 268 | return;
|
---|
| 269 |
|
---|
| 270 | check_point(0);
|
---|
| 271 |
|
---|
| 272 | case 2:
|
---|
| 273 | check_point(17);
|
---|
| 274 | return;
|
---|
| 275 |
|
---|
| 276 | check_point(0);
|
---|
| 277 |
|
---|
| 278 | case 3:
|
---|
| 279 | check_point(32);
|
---|
| 280 | return;
|
---|
| 281 |
|
---|
| 282 | check_point(0);
|
---|
| 283 |
|
---|
| 284 | default:
|
---|
| 285 | check_point(0);
|
---|
| 286 | }
|
---|
| 287 | check_point(0);
|
---|
| 288 | }
|
---|
| 289 |
|
---|
| 290 | static uint_t cyclic2_count = 0;
|
---|
| 291 |
|
---|
| 292 | void
|
---|
| 293 | cyclic2_handler(intptr_t exinf)
|
---|
| 294 | {
|
---|
| 295 |
|
---|
| 296 | switch (++cyclic2_count) {
|
---|
| 297 | case 1:
|
---|
| 298 | check_point(10);
|
---|
| 299 | return;
|
---|
| 300 |
|
---|
| 301 | check_point(0);
|
---|
| 302 |
|
---|
| 303 | case 2:
|
---|
| 304 | check_point(15);
|
---|
| 305 | return;
|
---|
| 306 |
|
---|
| 307 | check_point(0);
|
---|
| 308 |
|
---|
| 309 | case 3:
|
---|
| 310 | check_point(46);
|
---|
| 311 | return;
|
---|
| 312 |
|
---|
| 313 | check_point(0);
|
---|
| 314 |
|
---|
| 315 | default:
|
---|
| 316 | check_point(0);
|
---|
| 317 | }
|
---|
| 318 | check_point(0);
|
---|
| 319 | }
|
---|
| 320 |
|
---|
| 321 | void
|
---|
| 322 | task1(intptr_t exinf)
|
---|
| 323 | {
|
---|
| 324 | ER_UINT ercd;
|
---|
| 325 | T_RCYC rcyc;
|
---|
| 326 |
|
---|
| 327 | check_point(3);
|
---|
| 328 | target_raise_hrt_int(0U);
|
---|
| 329 |
|
---|
| 330 | check_point(8);
|
---|
| 331 | target_raise_hrt_int(0U);
|
---|
| 332 |
|
---|
| 333 | check_point(13);
|
---|
| 334 | target_raise_hrt_int(0U);
|
---|
| 335 |
|
---|
| 336 | check_point(20);
|
---|
| 337 | ercd = ref_cyc(CYC1, &rcyc);
|
---|
| 338 | check_ercd(ercd, E_OK);
|
---|
| 339 |
|
---|
| 340 | check_point(22);
|
---|
| 341 | check_assert(rcyc.lefttim == 979U);
|
---|
| 342 |
|
---|
| 343 | check_point(23);
|
---|
| 344 | ercd = stp_cyc(CYC1);
|
---|
| 345 | check_ercd(ercd, E_OK);
|
---|
| 346 |
|
---|
| 347 | check_point(24);
|
---|
| 348 | ercd = stp_cyc(CYC2);
|
---|
| 349 | check_ercd(ercd, E_OK);
|
---|
| 350 |
|
---|
| 351 | check_point(27);
|
---|
| 352 | ercd = sta_cyc(CYC1);
|
---|
| 353 | check_ercd(ercd, E_OK);
|
---|
| 354 |
|
---|
| 355 | check_point(30);
|
---|
| 356 | target_raise_hrt_int(0U);
|
---|
| 357 |
|
---|
| 358 | check_point(35);
|
---|
| 359 | ercd = sta_cyc(CYC2);
|
---|
| 360 | check_ercd(ercd, E_OK);
|
---|
| 361 |
|
---|
| 362 | check_point(38);
|
---|
| 363 | ercd = ref_cyc(CYC2, &rcyc);
|
---|
| 364 | check_ercd(ercd, E_OK);
|
---|
| 365 |
|
---|
| 366 | check_point(40);
|
---|
| 367 | check_assert(rcyc.lefttim == 1U);
|
---|
| 368 |
|
---|
| 369 | check_point(41);
|
---|
| 370 | ercd = ref_cyc(CYC2, &rcyc);
|
---|
| 371 | check_ercd(ercd, E_OK);
|
---|
| 372 |
|
---|
| 373 | check_point(43);
|
---|
| 374 | check_assert(rcyc.lefttim == 0U);
|
---|
| 375 |
|
---|
| 376 | check_point(44);
|
---|
| 377 | target_raise_hrt_int(0U);
|
---|
| 378 |
|
---|
| 379 | check_point(49);
|
---|
| 380 | ercd = sta_alm(ALM1, 100U);
|
---|
| 381 | check_ercd(ercd, E_OK);
|
---|
| 382 |
|
---|
| 383 | check_point(52);
|
---|
| 384 | ercd = sta_alm(ALM2, 200U);
|
---|
| 385 | check_ercd(ercd, E_OK);
|
---|
| 386 |
|
---|
| 387 | check_point(54);
|
---|
| 388 | target_raise_hrt_int(0U);
|
---|
| 389 |
|
---|
| 390 | check_finish(59);
|
---|
| 391 | check_point(0);
|
---|
| 392 | }
|
---|
| 393 |
|
---|
| 394 | static uint_t target_hrt_get_current_count = 0;
|
---|
| 395 |
|
---|
| 396 | HRTCNT
|
---|
| 397 | target_hrt_get_current(void)
|
---|
| 398 | {
|
---|
| 399 |
|
---|
| 400 | switch (++target_hrt_get_current_count) {
|
---|
| 401 | case 1:
|
---|
| 402 | test_start(__FILE__);
|
---|
| 403 |
|
---|
| 404 | check_point(1);
|
---|
| 405 | return(10U);
|
---|
| 406 |
|
---|
| 407 | check_point(0);
|
---|
| 408 |
|
---|
| 409 | case 2:
|
---|
| 410 | check_point(4);
|
---|
| 411 | return(10U);
|
---|
| 412 |
|
---|
| 413 | check_point(0);
|
---|
| 414 |
|
---|
| 415 | case 3:
|
---|
| 416 | check_point(6);
|
---|
| 417 | return(20U);
|
---|
| 418 |
|
---|
| 419 | check_point(0);
|
---|
| 420 |
|
---|
| 421 | case 4:
|
---|
| 422 | check_point(9);
|
---|
| 423 | return(509U);
|
---|
| 424 |
|
---|
| 425 | check_point(0);
|
---|
| 426 |
|
---|
| 427 | case 5:
|
---|
| 428 | check_point(11);
|
---|
| 429 | return(519U);
|
---|
| 430 |
|
---|
| 431 | check_point(0);
|
---|
| 432 |
|
---|
| 433 | case 6:
|
---|
| 434 | check_point(14);
|
---|
| 435 | return(1009U);
|
---|
| 436 |
|
---|
| 437 | check_point(0);
|
---|
| 438 |
|
---|
| 439 | case 7:
|
---|
| 440 | check_point(16);
|
---|
| 441 | return(1010U);
|
---|
| 442 |
|
---|
| 443 | check_point(0);
|
---|
| 444 |
|
---|
| 445 | case 8:
|
---|
| 446 | check_point(18);
|
---|
| 447 | return(1020U);
|
---|
| 448 |
|
---|
| 449 | check_point(0);
|
---|
| 450 |
|
---|
| 451 | case 9:
|
---|
| 452 | check_point(21);
|
---|
| 453 | return(1030U);
|
---|
| 454 |
|
---|
| 455 | check_point(0);
|
---|
| 456 |
|
---|
| 457 | case 10:
|
---|
| 458 | check_point(25);
|
---|
| 459 | return(1040U);
|
---|
| 460 |
|
---|
| 461 | check_point(0);
|
---|
| 462 |
|
---|
| 463 | case 11:
|
---|
| 464 | check_point(28);
|
---|
| 465 | return(1050U);
|
---|
| 466 |
|
---|
| 467 | check_point(0);
|
---|
| 468 |
|
---|
| 469 | case 12:
|
---|
| 470 | check_point(31);
|
---|
| 471 | return(1051U);
|
---|
| 472 |
|
---|
| 473 | check_point(0);
|
---|
| 474 |
|
---|
| 475 | case 13:
|
---|
| 476 | check_point(33);
|
---|
| 477 | return(1052U);
|
---|
| 478 |
|
---|
| 479 | check_point(0);
|
---|
| 480 |
|
---|
| 481 | case 14:
|
---|
| 482 | check_point(36);
|
---|
| 483 | return(1060U);
|
---|
| 484 |
|
---|
| 485 | check_point(0);
|
---|
| 486 |
|
---|
| 487 | case 15:
|
---|
| 488 | check_point(39);
|
---|
| 489 | return(1558U);
|
---|
| 490 |
|
---|
| 491 | check_point(0);
|
---|
| 492 |
|
---|
| 493 | case 16:
|
---|
| 494 | check_point(42);
|
---|
| 495 | return(1561U);
|
---|
| 496 |
|
---|
| 497 | check_point(0);
|
---|
| 498 |
|
---|
| 499 | case 17:
|
---|
| 500 | check_point(45);
|
---|
| 501 | return(1562U);
|
---|
| 502 |
|
---|
| 503 | check_point(0);
|
---|
| 504 |
|
---|
| 505 | case 18:
|
---|
| 506 | check_point(47);
|
---|
| 507 | return(1563U);
|
---|
| 508 |
|
---|
| 509 | check_point(0);
|
---|
| 510 |
|
---|
| 511 | case 19:
|
---|
| 512 | check_point(50);
|
---|
| 513 | return(1620U);
|
---|
| 514 |
|
---|
| 515 | check_point(0);
|
---|
| 516 |
|
---|
| 517 | case 20:
|
---|
| 518 | check_point(53);
|
---|
| 519 | return(1630U);
|
---|
| 520 |
|
---|
| 521 | check_point(0);
|
---|
| 522 |
|
---|
| 523 | case 21:
|
---|
| 524 | check_point(55);
|
---|
| 525 | return(1721);
|
---|
| 526 |
|
---|
| 527 | check_point(0);
|
---|
| 528 |
|
---|
| 529 | case 22:
|
---|
| 530 | check_point(57);
|
---|
| 531 | return(1730U);
|
---|
| 532 |
|
---|
| 533 | check_point(0);
|
---|
| 534 |
|
---|
| 535 | default:
|
---|
| 536 | check_point(0);
|
---|
| 537 | }
|
---|
| 538 | check_point(0);
|
---|
| 539 | return(0U);
|
---|
| 540 | }
|
---|
| 541 |
|
---|
| 542 | static uint_t target_hrt_raise_event_count = 0;
|
---|
| 543 |
|
---|
| 544 | void
|
---|
| 545 | target_hrt_raise_event(void)
|
---|
| 546 | {
|
---|
| 547 |
|
---|
| 548 | switch (++target_hrt_raise_event_count) {
|
---|
| 549 | case 1:
|
---|
| 550 | check_point(2);
|
---|
| 551 | return;
|
---|
| 552 |
|
---|
| 553 | check_point(0);
|
---|
| 554 |
|
---|
| 555 | default:
|
---|
| 556 | check_point(0);
|
---|
| 557 | }
|
---|
| 558 | check_point(0);
|
---|
| 559 | }
|
---|
| 560 |
|
---|
| 561 | static uint_t target_hrt_set_event_count = 0;
|
---|
| 562 |
|
---|
| 563 | void
|
---|
| 564 | target_hrt_set_event(HRTCNT hrtcnt)
|
---|
| 565 | {
|
---|
| 566 |
|
---|
| 567 | switch (++target_hrt_set_event_count) {
|
---|
| 568 | case 1:
|
---|
| 569 | check_point(7);
|
---|
| 570 | check_assert(hrtcnt == 489U);
|
---|
| 571 |
|
---|
| 572 | return;
|
---|
| 573 |
|
---|
| 574 | check_point(0);
|
---|
| 575 |
|
---|
| 576 | case 2:
|
---|
| 577 | check_point(12);
|
---|
| 578 | check_assert(hrtcnt == 490U);
|
---|
| 579 |
|
---|
| 580 | return;
|
---|
| 581 |
|
---|
| 582 | check_point(0);
|
---|
| 583 |
|
---|
| 584 | case 3:
|
---|
| 585 | check_point(19);
|
---|
| 586 | check_assert(hrtcnt == 489U);
|
---|
| 587 |
|
---|
| 588 | return;
|
---|
| 589 |
|
---|
| 590 | check_point(0);
|
---|
| 591 |
|
---|
| 592 | case 4:
|
---|
| 593 | check_point(26);
|
---|
| 594 | check_assert(hrtcnt == HRTCNT_EMPTY);
|
---|
| 595 |
|
---|
| 596 | return;
|
---|
| 597 |
|
---|
| 598 | check_point(0);
|
---|
| 599 |
|
---|
| 600 | case 5:
|
---|
| 601 | check_point(29);
|
---|
| 602 | check_assert(hrtcnt == 1U);
|
---|
| 603 |
|
---|
| 604 | return;
|
---|
| 605 |
|
---|
| 606 | check_point(0);
|
---|
| 607 |
|
---|
| 608 | case 6:
|
---|
| 609 | check_point(34);
|
---|
| 610 | check_assert(hrtcnt == 999U);
|
---|
| 611 |
|
---|
| 612 | return;
|
---|
| 613 |
|
---|
| 614 | check_point(0);
|
---|
| 615 |
|
---|
| 616 | case 7:
|
---|
| 617 | check_point(37);
|
---|
| 618 | check_assert(hrtcnt == 500U);
|
---|
| 619 |
|
---|
| 620 | return;
|
---|
| 621 |
|
---|
| 622 | check_point(0);
|
---|
| 623 |
|
---|
| 624 | case 8:
|
---|
| 625 | check_point(48);
|
---|
| 626 | check_assert(hrtcnt == 488U);
|
---|
| 627 |
|
---|
| 628 | return;
|
---|
| 629 |
|
---|
| 630 | check_point(0);
|
---|
| 631 |
|
---|
| 632 | case 9:
|
---|
| 633 | check_point(51);
|
---|
| 634 | check_assert(hrtcnt == 101U);
|
---|
| 635 |
|
---|
| 636 | return;
|
---|
| 637 |
|
---|
| 638 | check_point(0);
|
---|
| 639 |
|
---|
| 640 | case 10:
|
---|
| 641 | check_point(58);
|
---|
| 642 | check_assert(hrtcnt == 321U);
|
---|
| 643 |
|
---|
| 644 | return;
|
---|
| 645 |
|
---|
| 646 | check_point(0);
|
---|
| 647 |
|
---|
| 648 | default:
|
---|
| 649 | check_point(0);
|
---|
| 650 | }
|
---|
| 651 | check_point(0);
|
---|
| 652 | }
|
---|