[363] | 1 | /*
|
---|
| 2 | * TOPPERS/JSP Kernel
|
---|
| 3 | * Toyohashi Open Platform for Embedded Real-Time Systems/
|
---|
| 4 | * Just Standard Profile Kernel
|
---|
| 5 | *
|
---|
| 6 | * Copyright (C) 2000-2003 by Embedded and Real-Time Systems Laboratory
|
---|
| 7 | * Toyohashi Univ. of Technology, JAPAN
|
---|
| 8 | *
|
---|
| 9 | * ä¸è¨èä½æ¨©è
|
---|
| 10 | ã¯ï¼ä»¥ä¸ã® (1)ã(4) ã®æ¡ä»¶ãï¼Free Software Foundation
|
---|
| 11 | * ã«ãã£ã¦å
|
---|
| 12 | ¬è¡¨ããã¦ãã GNU General Public License ã® Version 2 ã«è¨
|
---|
| 13 | * è¿°ããã¦ããæ¡ä»¶ãæºããå ´åã«éãï¼æ¬ã½ããã¦ã§ã¢ï¼æ¬ã½ããã¦ã§ã¢
|
---|
| 14 | * ãæ¹å¤ãããã®ãå«ãï¼ä»¥ä¸åãï¼ã使ç¨ã»è¤è£½ã»æ¹å¤ã»åé
|
---|
| 15 | å¸ï¼ä»¥ä¸ï¼
|
---|
| 16 | * å©ç¨ã¨å¼ã¶ï¼ãããã¨ãç¡åã§è¨±è«¾ããï¼
|
---|
| 17 | * (1) æ¬ã½ããã¦ã§ã¢ãã½ã¼ã¹ã³ã¼ãã®å½¢ã§å©ç¨ããå ´åã«ã¯ï¼ä¸è¨ã®èä½
|
---|
| 18 | * 権表示ï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãï¼ãã®ã¾ã¾ã®å½¢ã§ã½ã¼
|
---|
| 19 | * ã¹ã³ã¼ãä¸ã«å«ã¾ãã¦ãããã¨ï¼
|
---|
| 20 | * (2) æ¬ã½ããã¦ã§ã¢ãï¼ã©ã¤ãã©ãªå½¢å¼ãªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 21 | * ç¨ã§ããå½¢ã§åé
|
---|
| 22 | å¸ããå ´åã«ã¯ï¼åé
|
---|
| 23 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨
|
---|
| 24 | * è
|
---|
| 25 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®èä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨
|
---|
| 26 | * ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 27 | * (3) æ¬ã½ããã¦ã§ã¢ãï¼æ©å¨ã«çµã¿è¾¼ããªã©ï¼ä»ã®ã½ããã¦ã§ã¢éçºã«ä½¿
|
---|
| 28 | * ç¨ã§ããªãå½¢ã§åé
|
---|
| 29 | å¸ããå ´åã«ã¯ï¼æ¬¡ã®ããããã®æ¡ä»¶ãæºããã
|
---|
| 30 | * ã¨ï¼
|
---|
| 31 | * (a) åé
|
---|
| 32 | å¸ã«ä¼´ãããã¥ã¡ã³ãï¼å©ç¨è
|
---|
| 33 | ããã¥ã¢ã«ãªã©ï¼ã«ï¼ä¸è¨ã®è
|
---|
| 34 | * ä½æ¨©è¡¨ç¤ºï¼ãã®å©ç¨æ¡ä»¶ããã³ä¸è¨ã®ç¡ä¿è¨¼è¦å®ãæ²è¼ãããã¨ï¼
|
---|
| 35 | * (b) åé
|
---|
| 36 | å¸ã®å½¢æ
|
---|
| 37 | ãï¼å¥ã«å®ããæ¹æ³ã«ãã£ã¦ï¼TOPPERSããã¸ã§ã¯ãã«
|
---|
| 38 | * å ±åãããã¨ï¼
|
---|
| 39 | * (4) æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´æ¥çã¾ãã¯éæ¥çã«çãããããªãæ
|
---|
| 40 | * 害ãããï¼ä¸è¨èä½æ¨©è
|
---|
| 41 | ããã³TOPPERSããã¸ã§ã¯ããå
|
---|
| 42 | 責ãããã¨ï¼
|
---|
| 43 | *
|
---|
| 44 | * æ¬ã½ããã¦ã§ã¢ã¯ï¼ç¡ä¿è¨¼ã§æä¾ããã¦ãããã®ã§ããï¼ä¸è¨èä½æ¨©è
|
---|
| 45 | ã
|
---|
| 46 | * ãã³TOPPERSããã¸ã§ã¯ãã¯ï¼æ¬ã½ããã¦ã§ã¢ã«é¢ãã¦ï¼ãã®é©ç¨å¯è½æ§ã
|
---|
| 47 | * å«ãã¦ï¼ãããªãä¿è¨¼ãè¡ããªãï¼ã¾ãï¼æ¬ã½ããã¦ã§ã¢ã®å©ç¨ã«ããç´
|
---|
| 48 | * æ¥çã¾ãã¯éæ¥çã«çãããããªãæ害ã«é¢ãã¦ãï¼ãã®è²¬ä»»ãè² ããªãï¼
|
---|
| 49 | *
|
---|
| 50 | * @(#) $Id: jsp_check.cpp,v 1.25 2005/07/06 01:29:21 honda Exp $
|
---|
| 51 | */
|
---|
| 52 |
|
---|
| 53 | // $Header: /home/CVS/configurator/jsp/jsp_check.cpp,v 1.25 2005/07/06 01:29:21 honda Exp $
|
---|
| 54 |
|
---|
| 55 | #include "base/defs.h"
|
---|
| 56 | #include "jsp/jsp_defs.h"
|
---|
| 57 | #include "base/message.h"
|
---|
| 58 | #include "base/component.h"
|
---|
| 59 | #include "base/filecontainer.h"
|
---|
| 60 |
|
---|
| 61 | #include <fstream>
|
---|
| 62 | #include <iomanip>
|
---|
| 63 |
|
---|
| 64 | class ConfigurationChecker : public Component
|
---|
| 65 | {
|
---|
| 66 | public:
|
---|
| 67 |
|
---|
| 68 | enum tagCheckLevel
|
---|
| 69 | {
|
---|
| 70 | UNKNOWN = 0,
|
---|
| 71 | LAZY = 1, /* è´å½ç (è¡ãéãæ¹é é²æ¢ç¨) */
|
---|
| 72 | STANDARD = 2, /* ITRONä»æ§ã®ç¯å² (æ¹é ã許容) */
|
---|
| 73 | TOPPERS = 4, /* TOPPERS/JSPã®ç¯å²å
|
---|
| 74 | */
|
---|
| 75 | RESTRICTED = 8, /* çã£ç«¯ããæã¾ãã */
|
---|
| 76 |
|
---|
| 77 | NORMAL = 8
|
---|
| 78 | };
|
---|
| 79 |
|
---|
| 80 | protected:
|
---|
| 81 | enum tagCheckLevel current_level;
|
---|
| 82 |
|
---|
| 83 | unsigned int error_count;
|
---|
| 84 | std::string banner;
|
---|
| 85 |
|
---|
| 86 | void set_banner(Directory &, Formatter , const char *, int);
|
---|
| 87 | void notify(enum tagCheckLevel, Formatter , bool = true);
|
---|
| 88 |
|
---|
| 89 | bool check_taskblock(Directory &, FileContainer *);
|
---|
| 90 | bool check_semaphoreblock(Directory &, FileContainer *);
|
---|
| 91 | bool check_eventflagblock(Directory &, FileContainer *);
|
---|
| 92 | bool check_dataqueueblock(Directory &, FileContainer *);
|
---|
| 93 | bool check_mailboxblock(Directory &, FileContainer *);
|
---|
| 94 | bool check_fixed_memorypoolblock(Directory &, FileContainer *);
|
---|
| 95 | bool check_cyclic_handlerblock(Directory &, FileContainer *);
|
---|
| 96 | bool check_interrupt_handlerblock(Directory &, FileContainer *);
|
---|
| 97 | bool check_exception_handlerblock(Directory &, FileContainer *);
|
---|
| 98 |
|
---|
| 99 | virtual void parseOption(Directory &);
|
---|
| 100 | virtual void body(Directory &);
|
---|
| 101 |
|
---|
| 102 | public:
|
---|
| 103 | ConfigurationChecker(void) throw();
|
---|
| 104 | ~ConfigurationChecker(void) throw() {}
|
---|
| 105 | };
|
---|
| 106 |
|
---|
| 107 | //------------------------------------------------------
|
---|
| 108 | using namespace std;
|
---|
| 109 |
|
---|
| 110 | static ConfigurationChecker instance_of_ConfigurationChecker;
|
---|
| 111 |
|
---|
| 112 | //------------------------------------------------------
|
---|
| 113 | //ã¿ã¼ã²ããã®ååã®åããã大ããªåã®å®ç¾©
|
---|
| 114 | // (注) å¤æ¯è¼, æ¼ç®ãå¯è½ãªåã§ãããã¨
|
---|
| 115 |
|
---|
| 116 | typedef int DT_INT;
|
---|
| 117 | typedef unsigned int DT_UINT;
|
---|
| 118 | typedef unsigned long DT_FP;
|
---|
| 119 | typedef unsigned long DT_VP_INT;
|
---|
| 120 | typedef unsigned long DT_VP;
|
---|
| 121 | typedef long DT_RELTIM;
|
---|
| 122 |
|
---|
| 123 | //------------------------------------------------------
|
---|
| 124 |
|
---|
| 125 | ConfigurationChecker::ConfigurationChecker(void) throw()
|
---|
| 126 | {
|
---|
| 127 | setBanner("--- TOPPERS/JSP Configuration Checker (ver 2.4) ---");
|
---|
| 128 | }
|
---|
| 129 |
|
---|
| 130 | void ConfigurationChecker::set_banner(Directory & container, Formatter object, const char * type, int id)
|
---|
| 131 | {
|
---|
| 132 | Directory * node;
|
---|
| 133 | char buffer[32];
|
---|
| 134 |
|
---|
| 135 | banner = string(" ") + object.str() + " : ";
|
---|
| 136 |
|
---|
| 137 | sprintf(buffer, "id = %d", id);
|
---|
| 138 |
|
---|
| 139 | node = container.findChild(OBJECTTREE, type, NULL)->getFirstChild();
|
---|
| 140 | while(node != 0 && node->toInteger() != id)
|
---|
| 141 | node = node->getNext();
|
---|
| 142 |
|
---|
| 143 | if( node != 0 ) {
|
---|
| 144 | banner += node->getKey() + " (" + buffer + ") ";
|
---|
| 145 |
|
---|
| 146 | node = node->findChild("position");
|
---|
| 147 | if(node != 0)
|
---|
| 148 | banner += string("at ") + node->toString();
|
---|
| 149 | }
|
---|
| 150 | else
|
---|
| 151 | banner += buffer;
|
---|
| 152 |
|
---|
| 153 | if(VerboseMessage::getVerbose())
|
---|
| 154 | {
|
---|
| 155 | cout << banner << endl;
|
---|
| 156 | banner.erase();
|
---|
| 157 | }
|
---|
| 158 | }
|
---|
| 159 |
|
---|
| 160 | void ConfigurationChecker::notify(enum tagCheckLevel level, Formatter msg, bool error)
|
---|
| 161 | {
|
---|
| 162 | if((level & current_level) != 0)
|
---|
| 163 | {
|
---|
| 164 |
|
---|
| 165 | if(!banner.empty())
|
---|
| 166 | {
|
---|
| 167 | cout << banner << endl;
|
---|
| 168 | banner.erase();
|
---|
| 169 | }
|
---|
| 170 |
|
---|
| 171 | cout << " ";
|
---|
| 172 |
|
---|
| 173 | if(error)
|
---|
| 174 | {
|
---|
| 175 | cout << Message("[ Error ] ","[ã¨ã©ã¼] ");
|
---|
| 176 | error_count ++;
|
---|
| 177 | }else
|
---|
| 178 | cout << Message("[Warning] ","[ è¦å ] ");
|
---|
| 179 | cout << msg << endl;
|
---|
| 180 | }
|
---|
| 181 | }
|
---|
| 182 |
|
---|
| 183 | /*
|
---|
| 184 | * ã¿ã¹ã¯ãªãã¸ã§ã¯ãã«é¢ããã¨ã©ã¼æ¤åº
|
---|
| 185 | */
|
---|
| 186 |
|
---|
| 187 | bool ConfigurationChecker::check_taskblock(Directory & parameter, FileContainer * container)
|
---|
| 188 | {
|
---|
| 189 | unsigned int id;
|
---|
| 190 | unsigned int maxpri;
|
---|
| 191 | unsigned int minpri;
|
---|
| 192 | unsigned int old_error_count = error_count;
|
---|
| 193 |
|
---|
| 194 | TargetVariable<unsigned int> _kernel_tmax_tskid("_kernel_tmax_tskid");
|
---|
| 195 |
|
---|
| 196 | Message object("Task","ã¿ã¹ã¯");
|
---|
| 197 |
|
---|
| 198 | if(!_kernel_tmax_tskid.isValid())
|
---|
| 199 | ExceptionMessage(
|
---|
| 200 | "Internal error: Unknown symbol (Probably, Symbol table was stripped)",
|
---|
| 201 | "å
|
---|
| 202 | é¨ã¨ã©ã¼: ä¸æ£ãªã·ã³ãã«å (å®è¡å½¢å¼ãã·ã³ãã«ãã¼ãã«ãå«ãã§ãªãå¯è½æ§ãããã¾ã)").throwException();
|
---|
| 203 |
|
---|
| 204 | if(*_kernel_tmax_tskid < 1)
|
---|
| 205 | {
|
---|
| 206 | notify(RESTRICTED,
|
---|
| 207 | Message(" [Task] : No tasks created\n"," [ã¿ã¹ã¯] : ã¿ã¹ã¯ãªãã¸ã§ã¯ããããã¾ãã\n"));
|
---|
| 208 | return true;
|
---|
| 209 | }
|
---|
| 210 |
|
---|
| 211 | TargetVariable<DT_UINT> tskatr("_kernel_tinib_table", "task_initialization_block::tskatr");
|
---|
| 212 | TargetVariable<DT_FP> task("_kernel_tinib_table", "task_initialization_block::task");
|
---|
| 213 | TargetVariable<DT_INT> ipriority("_kernel_tinib_table", "task_initialization_block::ipriority");
|
---|
| 214 | TargetVariable<DT_UINT> texatr("_kernel_tinib_table", "task_initialization_block::texatr");
|
---|
| 215 | TargetVariable<DT_UINT> stksz("_kernel_tinib_table", "task_initialization_block::stksz");
|
---|
| 216 |
|
---|
| 217 | maxpri = container->getVariableInfo("TMAX_TPRI").value;
|
---|
| 218 | minpri = container->getVariableInfo("TMIN_TPRI").value;
|
---|
| 219 |
|
---|
| 220 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tmax_tskid;
|
---|
| 221 | for(id = 1; id <= *_kernel_tmax_tskid; id++)
|
---|
| 222 | {
|
---|
| 223 | set_banner(parameter, object, TASK, id);
|
---|
| 224 |
|
---|
| 225 | /*
|
---|
| 226 | * å±æ§ãã§ãã¯
|
---|
| 227 | */
|
---|
| 228 |
|
---|
| 229 | // å±æ§å¤ã TA_HLNG|TA_ASM|TA_ACT 以å¤ã®å¤ãã¨ã£ã¦ãã
|
---|
| 230 | if((*tskatr & ~0x3) != 0)
|
---|
| 231 | notify( STANDARD,
|
---|
| 232 | Message("Illegal task attribute (It should be ((TA_HLNG||TA_ASM)|TA_ACT))",
|
---|
| 233 | "ä¸æ£ãªã¿ã¹ã¯å±æ§ ((TA_HLNG||TA_ASM)|TA_ACT)以å¤"));
|
---|
| 234 |
|
---|
| 235 | // å±æ§å¤ã« TA_ASM ãå«ã¾ãã¦ãã
|
---|
| 236 | if((*tskatr & 0x1) != 0)
|
---|
| 237 | notify( RESTRICTED,
|
---|
| 238 | Message("TA_ASM specified as task attribute takes no effect.",
|
---|
| 239 | "ã¿ã¹ã¯å±æ§ã«TA_ASMãæå®ããã¦ãã"));
|
---|
| 240 |
|
---|
| 241 | /* èµ·åçªå°ã0 */
|
---|
| 242 | if(*task == 0)
|
---|
| 243 | notify(RESTRICTED,
|
---|
| 244 | Message("The address of task routine is equal to zero.",
|
---|
| 245 | "éå§çªå°ã«0ãè¨å®ããã¦ãã¾ã"));
|
---|
| 246 |
|
---|
| 247 | /*
|
---|
| 248 | * åªå
|
---|
| 249 | 度ãã§ãã¯
|
---|
| 250 | */
|
---|
| 251 |
|
---|
| 252 | // æ大åªå
|
---|
| 253 | 度ã¨æå°åªå
|
---|
| 254 | 度ã®è¨å®ããããã
|
---|
| 255 | if(maxpri < minpri)
|
---|
| 256 | notify(LAZY,
|
---|
| 257 | Message("Illegal Priority Settings found (TMAX_TPRI(%) < TMIN_TPRI).",
|
---|
| 258 | "åæåªå
|
---|
| 259 | 度ãæä½åªå
|
---|
| 260 | 度(%)ãè¶
|
---|
| 261 | ãã¦ãã") << minpri);
|
---|
| 262 |
|
---|
| 263 | // åªå
|
---|
| 264 | 度ã®ç¯å²ã[æå°åªå
|
---|
| 265 | 度, æ大åªå
|
---|
| 266 | 度]ã®ç¯å²ãè¶
|
---|
| 267 | ãã¦ãã
|
---|
| 268 | if(*ipriority > (signed)(maxpri - minpri))
|
---|
| 269 | notify(TOPPERS,
|
---|
| 270 | Message("Initial priority is greater than maximum priority (%).",
|
---|
| 271 | "åæåªå
|
---|
| 272 | 度ãæ大åªå
|
---|
| 273 | 度(%)ãè¶
|
---|
| 274 | ãã¦ãã") << maxpri);
|
---|
| 275 | if(*ipriority < 0)
|
---|
| 276 | notify(STANDARD,
|
---|
| 277 | Message("Initial priority is less than the minimum priority (%).",
|
---|
| 278 | "åæåªå
|
---|
| 279 | 度ãæä½åªå
|
---|
| 280 | 度(%)ãä¸åã") << minpri);
|
---|
| 281 |
|
---|
| 282 | /*
|
---|
| 283 | * ã¿ã¹ã¯ä¾å¤å±æ§ãã§ãã¯
|
---|
| 284 | */
|
---|
| 285 |
|
---|
| 286 | // å±æ§å¤ãTA_HLNG or TA_ASMã§ãªã
|
---|
| 287 | if((*texatr & ~0x3) != 0)
|
---|
| 288 | notify(STANDARD,
|
---|
| 289 | Message("Task exception routine has an illegal attribute specifier.",
|
---|
| 290 | "ã¿ã¹ã¯ä¾å¤ã«ç¡å¹ãªå±æ§(TA_HLNG,TA_ASM以å¤) ãè¨å®ããã¦ãã¾ã"));
|
---|
| 291 |
|
---|
| 292 | // å±æ§å¤ã« TA_ASM ãå«ã¾ãã¦ãã
|
---|
| 293 | if((*texatr & 0x1) != 0)
|
---|
| 294 | notify( RESTRICTED,
|
---|
| 295 | Message("TA_ASM, specified as texatr, does not always take effect.",
|
---|
| 296 | "ã¿ã¹ã¯ä¾å¤ã«TA_ASMãæå®ããã¦ãã¾ã"));
|
---|
| 297 |
|
---|
| 298 | /*
|
---|
| 299 | * ã¹ã¿ãã¯ãã§ãã¯
|
---|
| 300 | */
|
---|
| 301 |
|
---|
| 302 | // ã¹ã¿ãã¯ãµã¤ãºã0
|
---|
| 303 | if(*stksz == 0)
|
---|
| 304 | notify(RESTRICTED,
|
---|
| 305 | Message("Stack size is equal to zero.",
|
---|
| 306 | "ã¹ã¿ãã¯ãµã¤ãºã«0ãè¨å®ããã¦ãã¾ã"));
|
---|
| 307 |
|
---|
| 308 | // ã¹ã¿ãã¯ã®çªå°ã0
|
---|
| 309 | if(*stksz == 0)
|
---|
| 310 | notify(RESTRICTED,
|
---|
| 311 | Message("The address of task stack is equal to zero.",
|
---|
| 312 | "ã¹ã¿ãã¯éå§çªå°ã«0ãè¨å®ããã¦ãã¾ã"));
|
---|
| 313 |
|
---|
| 314 | ++ tskatr, ++ task, ++ ipriority, ++ texatr, ++ stksz;
|
---|
| 315 | }
|
---|
| 316 |
|
---|
| 317 | return old_error_count == error_count;
|
---|
| 318 | }
|
---|
| 319 |
|
---|
| 320 | bool ConfigurationChecker::check_semaphoreblock(Directory & parameter, FileContainer * container)
|
---|
| 321 | {
|
---|
| 322 | unsigned int id;
|
---|
| 323 | unsigned int old_error_count = error_count;
|
---|
| 324 |
|
---|
| 325 | Message object("Semaphore","ã»ããã©");
|
---|
| 326 |
|
---|
| 327 | TargetVariable<DT_UINT> _kernel_tmax_semid("_kernel_tmax_semid");
|
---|
| 328 | if(*_kernel_tmax_semid < 1)
|
---|
| 329 | return true;
|
---|
| 330 |
|
---|
| 331 | TargetVariable<DT_UINT> sematr("_kernel_seminib_table","semaphore_initialization_block::sematr");
|
---|
| 332 | TargetVariable<DT_UINT> maxsem("_kernel_seminib_table","semaphore_initialization_block::maxsem");
|
---|
| 333 | TargetVariable<DT_UINT> isemcnt("_kernel_seminib_table","semaphore_initialization_block::isemcnt");
|
---|
| 334 |
|
---|
| 335 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n")
|
---|
| 336 | << object << *_kernel_tmax_semid;
|
---|
| 337 |
|
---|
| 338 | for(id = 1; id <= *_kernel_tmax_semid; id++)
|
---|
| 339 | {
|
---|
| 340 | set_banner(parameter, object, SEMAPHORE, id);
|
---|
| 341 |
|
---|
| 342 | //attribute validation check
|
---|
| 343 | if((*sematr & ~0x1) != 0)
|
---|
| 344 | notify(STANDARD,
|
---|
| 345 | Message("Illegal attribute (It should be (TA_TFIFO||TA_TPRI)).",
|
---|
| 346 | "(TA_TFIFO||TA_TPRI)以å¤ã®å±æ§ãæå®ããã¦ãã"));
|
---|
| 347 |
|
---|
| 348 | //maxcnt < isemcnt
|
---|
| 349 | if(*maxsem < *isemcnt)
|
---|
| 350 | notify(STANDARD,
|
---|
| 351 | Message("Initial count[%] is greater than the maximum count[%] of this semaphore",
|
---|
| 352 | "åæå¤[%]ãæ大å¤[%]ãè¶
|
---|
| 353 | ãã¦ãã") << *isemcnt << *maxsem);
|
---|
| 354 |
|
---|
| 355 | if(*maxsem == 0)
|
---|
| 356 | notify(STANDARD,
|
---|
| 357 | Message("Maximum count must be greater than zero.",
|
---|
| 358 | "ã»ããã©ã®æ大ã«ã¦ã³ãã¯1以ä¸ã§ãªããã°ããã¾ãã"));
|
---|
| 359 |
|
---|
| 360 | ++ sematr, ++ maxsem, ++ isemcnt;
|
---|
| 361 | }
|
---|
| 362 |
|
---|
| 363 | return old_error_count == error_count;
|
---|
| 364 | }
|
---|
| 365 |
|
---|
| 366 |
|
---|
| 367 | bool ConfigurationChecker::check_eventflagblock(Directory & parameter, FileContainer * container)
|
---|
| 368 | {
|
---|
| 369 | unsigned int id;
|
---|
| 370 | unsigned int old_error_count = error_count;
|
---|
| 371 |
|
---|
| 372 | Message object("Event flag","ã¤ãã³ããã©ã°");
|
---|
| 373 |
|
---|
| 374 | TargetVariable<DT_UINT> _kernel_tmax_flgid("_kernel_tmax_flgid");
|
---|
| 375 | if(*_kernel_tmax_flgid < 1)
|
---|
| 376 | return true;
|
---|
| 377 |
|
---|
| 378 | TargetVariable<DT_UINT> flgatr("_kernel_flginib_table","eventflag_initialization_block::flgatr");
|
---|
| 379 |
|
---|
| 380 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n")
|
---|
| 381 | << object << *_kernel_tmax_flgid;
|
---|
| 382 |
|
---|
| 383 | for(id = 1; id <= *_kernel_tmax_flgid; id++)
|
---|
| 384 | {
|
---|
| 385 | set_banner(parameter, object, EVENTFLAG, id);
|
---|
| 386 |
|
---|
| 387 | //attribute validation check
|
---|
| 388 | if((*flgatr & ~0x7) != 0)
|
---|
| 389 | notify(STANDARD,
|
---|
| 390 | Message("Illegal attribute value [0x%]",
|
---|
| 391 | "ããããªå±æ§å¤ [0x%]") << setbase(16) << (*flgatr & ~0x7));
|
---|
| 392 |
|
---|
| 393 | if((*flgatr & 0x2) != 0)
|
---|
| 394 | notify(TOPPERS, //ä¾åé¨ã§ç´ããªãã®ã§RESTRICTEDã«ããªã
|
---|
| 395 | Message("Attribute TA_WMUL is not supported in current version.",
|
---|
| 396 | "TA_WMULã¯ãµãã¼ãå¤"));
|
---|
| 397 |
|
---|
| 398 | ++ flgatr;
|
---|
| 399 | }
|
---|
| 400 |
|
---|
| 401 | return old_error_count == error_count;
|
---|
| 402 | }
|
---|
| 403 |
|
---|
| 404 |
|
---|
| 405 | bool ConfigurationChecker::check_dataqueueblock(Directory & parameter, FileContainer * container)
|
---|
| 406 | {
|
---|
| 407 | unsigned int id;
|
---|
| 408 | unsigned int old_error_count = error_count;
|
---|
| 409 |
|
---|
| 410 | Message object("Data queue","ãã¼ã¿ãã¥ã¼");
|
---|
| 411 |
|
---|
| 412 | TargetVariable<DT_UINT> _kernel_tmax_dtqid("_kernel_tmax_dtqid");
|
---|
| 413 | if(*_kernel_tmax_dtqid < 1)
|
---|
| 414 | return true;
|
---|
| 415 |
|
---|
| 416 | TargetVariable<DT_UINT> dtqatr("_kernel_dtqinib_table", "dataqueue_initialization_block::dtqatr");
|
---|
| 417 | TargetVariable<DT_UINT> dtqcnt("_kernel_dtqinib_table", "dataqueue_initialization_block::dtqcnt");
|
---|
| 418 | TargetVariable<DT_VP_INT> dtq("_kernel_dtqinib_table", "dataqueue_initialization_block::dtq");
|
---|
| 419 |
|
---|
| 420 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n")
|
---|
| 421 | << object << *_kernel_tmax_dtqid;
|
---|
| 422 |
|
---|
| 423 | for(id = 1; id <= *_kernel_tmax_dtqid; id++)
|
---|
| 424 | {
|
---|
| 425 | set_banner(parameter, object, DATAQUEUE, id);
|
---|
| 426 |
|
---|
| 427 | //attribute validation check
|
---|
| 428 | if((*dtqatr & ~0x1) != 0)
|
---|
| 429 | notify(STANDARD,
|
---|
| 430 | Message("Illegal attribute value [0x%]",
|
---|
| 431 | "ããããªå±æ§å¤ [0x%]") << setbase(16) << (*dtqatr & ~0x1));
|
---|
| 432 |
|
---|
| 433 | if(*dtqcnt != 0 && *dtq == 0)
|
---|
| 434 | notify(TOPPERS,
|
---|
| 435 | Message("Dataqueue buffer should not be NULL", "ãã¼ã¿ãã¥ã¼ã®ãããã¡ãNULLå¤"));
|
---|
| 436 |
|
---|
| 437 | ++ dtqatr, ++ dtqcnt, ++ dtq;
|
---|
| 438 | }
|
---|
| 439 |
|
---|
| 440 | return old_error_count == error_count;
|
---|
| 441 | }
|
---|
| 442 |
|
---|
| 443 |
|
---|
| 444 | bool ConfigurationChecker::check_mailboxblock(Directory & parameter, FileContainer * container)
|
---|
| 445 | {
|
---|
| 446 | unsigned int id;
|
---|
| 447 | unsigned int old_error_count = error_count;
|
---|
| 448 |
|
---|
| 449 | Message object("Mailbox","ã¡ã¼ã«ããã¯ã¹");
|
---|
| 450 |
|
---|
| 451 | TargetVariable<DT_UINT> _kernel_tmax_mbxid("_kernel_tmax_mbxid");
|
---|
| 452 | if(*_kernel_tmax_mbxid < 1)
|
---|
| 453 | return true;
|
---|
| 454 |
|
---|
| 455 | TargetVariable<DT_UINT> mbxatr("_kernel_mbxinib_table","mailbox_initialization_block::mbxatr");
|
---|
| 456 | TargetVariable<DT_INT> maxmpri("_kernel_mbxinib_table","mailbox_initialization_block::maxmpri");
|
---|
| 457 |
|
---|
| 458 | DT_INT maxpri = container->getVariableInfo("TMAX_MPRI").value;
|
---|
| 459 | DT_INT minpri = container->getVariableInfo("TMIN_MPRI").value;
|
---|
| 460 |
|
---|
| 461 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tmax_mbxid;
|
---|
| 462 | for(id = 1; id <= *_kernel_tmax_mbxid; id++)
|
---|
| 463 | {
|
---|
| 464 | set_banner(parameter, object, MAILBOX, id);
|
---|
| 465 |
|
---|
| 466 | //attribute validation check
|
---|
| 467 | if((*mbxatr & ~0x3) != 0)
|
---|
| 468 | notify(STANDARD,
|
---|
| 469 | Message("Illegal attribute value [0x%]",
|
---|
| 470 | "ããããªå±æ§å¤ [0x%]") << setbase(16) << (*mbxatr & ~0x3));
|
---|
| 471 |
|
---|
| 472 | //mailbox message priority check
|
---|
| 473 | if(*maxmpri < 0)
|
---|
| 474 | notify(STANDARD,
|
---|
| 475 | Message("Priority must not be a negative number.","åªå
|
---|
| 476 | 度ãè² å¤"));
|
---|
| 477 |
|
---|
| 478 | if(*maxmpri < minpri)
|
---|
| 479 | notify(STANDARD,
|
---|
| 480 | Message("Message priority should be greater than or equal to %.",
|
---|
| 481 | "ã¡ãã»ã¼ã¸åªå
|
---|
| 482 | 度ã¯%以ä¸ã§ãªããã°ããã¾ãã") << minpri);
|
---|
| 483 |
|
---|
| 484 | if(*maxmpri > maxpri)
|
---|
| 485 | notify(STANDARD,
|
---|
| 486 | Message("Message priority should be less than or equal to %.",
|
---|
| 487 | "ã¡ãã»ã¼ã¸åªå
|
---|
| 488 | 度ã¯%以ä¸ã§ãªããã°ããã¾ãã") << maxpri);
|
---|
| 489 |
|
---|
| 490 | ++ mbxatr, ++ maxmpri;
|
---|
| 491 | }
|
---|
| 492 |
|
---|
| 493 | return old_error_count == error_count;
|
---|
| 494 | }
|
---|
| 495 |
|
---|
| 496 | bool ConfigurationChecker::check_fixed_memorypoolblock(Directory & parameter, FileContainer * container)
|
---|
| 497 | {
|
---|
| 498 | unsigned int id;
|
---|
| 499 | unsigned int old_error_count = error_count;
|
---|
| 500 |
|
---|
| 501 | Message object("Fixed size memory pool","åºå®é·ã¡ã¢ãªãã¼ã«");
|
---|
| 502 |
|
---|
| 503 | TargetVariable<DT_UINT> _kernel_tmax_mpfid("_kernel_tmax_mpfid");
|
---|
| 504 | if(*_kernel_tmax_mpfid < 1)
|
---|
| 505 | return true;
|
---|
| 506 |
|
---|
| 507 | TargetVariable<DT_UINT> mpfatr("_kernel_mpfinib_table", "fixed_memorypool_initialization_block::mpfatr");
|
---|
| 508 | TargetVariable<DT_UINT> limit ("_kernel_mpfinib_table", "fixed_memorypool_initialization_block::limit");
|
---|
| 509 | TargetVariable<DT_VP> mpf ("_kernel_mpfinib_table", "fixed_memorypool_initialization_block::mpf");
|
---|
| 510 | TargetVariable<DT_UINT> blksz ("_kernel_mpfinib_table", "fixed_memorypool_initialization_block::blksz");
|
---|
| 511 |
|
---|
| 512 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tmax_mpfid;
|
---|
| 513 | for(id = 1; id <= *_kernel_tmax_mpfid; id++)
|
---|
| 514 | {
|
---|
| 515 | set_banner(parameter, object, FIXEDSIZEMEMORYPOOL, id);
|
---|
| 516 |
|
---|
| 517 | //attribute validation check
|
---|
| 518 | if((*mpfatr & ~0x1) != 0)
|
---|
| 519 | notify(STANDARD,
|
---|
| 520 | Message("Illegal attribute value [0x%]","ããããªå±æ§å¤ [0x%]") << (*mpfatr & ~0x1));
|
---|
| 521 |
|
---|
| 522 | //ãããã¯æ°ã0
|
---|
| 523 | if(*mpf == *limit)
|
---|
| 524 | notify(STANDARD,
|
---|
| 525 | Message("blkcnt should be a non-zero value.","ãããã¯æ°ã0ã§ã"));
|
---|
| 526 |
|
---|
| 527 | //ãããã¯ãµã¤ãºã0
|
---|
| 528 | if(*blksz == 0)
|
---|
| 529 | notify(STANDARD,
|
---|
| 530 | Message("blksz should be a non-zero value.","ãããã¯ãµã¤ãºã0ã§ã"));
|
---|
| 531 |
|
---|
| 532 | //ãããã¡ã¢ãã¬ã¹ã0
|
---|
| 533 | if(*mpf == 0)
|
---|
| 534 | notify(TOPPERS,
|
---|
| 535 | Message("buffer address is a NULL pointer.","ãããã¡ã¢ãã¬ã¹ãNULLãã¤ã³ã¿ã«ãªã£ã¦ãã¾ã"));
|
---|
| 536 |
|
---|
| 537 | ++ mpfatr, ++ limit, ++ mpf, ++ blksz;
|
---|
| 538 | }
|
---|
| 539 |
|
---|
| 540 | return old_error_count == error_count;
|
---|
| 541 | }
|
---|
| 542 |
|
---|
| 543 |
|
---|
| 544 | bool ConfigurationChecker::check_cyclic_handlerblock(Directory & parameter, FileContainer * container)
|
---|
| 545 | {
|
---|
| 546 | unsigned int id;
|
---|
| 547 | unsigned int old_error_count = error_count;
|
---|
| 548 |
|
---|
| 549 | Message object("Cyclic handler","å¨æãã³ãã©");
|
---|
| 550 |
|
---|
| 551 | TargetVariable<DT_UINT> _kernel_tmax_cycid("_kernel_tmax_cycid");
|
---|
| 552 | if(*_kernel_tmax_cycid < 1)
|
---|
| 553 | return true;
|
---|
| 554 |
|
---|
| 555 | DT_RELTIM maxreltim = container->getVariableInfo("TMAX_RELTIM").value;
|
---|
| 556 | TargetVariable<DT_UINT> cycatr("_kernel_cycinib_table", "cyclic_handler_initialization_block::cycatr");
|
---|
| 557 | TargetVariable<DT_RELTIM> cyctim("_kernel_cycinib_table", "cyclic_handler_initialization_block::cyctim");
|
---|
| 558 | TargetVariable<DT_RELTIM> cycphs("_kernel_cycinib_table", "cyclic_handler_initialization_block::cycphs");
|
---|
| 559 |
|
---|
| 560 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tmax_cycid;
|
---|
| 561 | for(id = 1; id <= *_kernel_tmax_cycid; id++)
|
---|
| 562 | {
|
---|
| 563 | set_banner(parameter, object, CYCLICHANDLER, id);
|
---|
| 564 |
|
---|
| 565 | //attribute validation check
|
---|
| 566 | if((*cycatr & ~0x7) != 0)
|
---|
| 567 | notify(STANDARD,
|
---|
| 568 | Message("Illegal attribute value [0x%]","ããããªå±æ§å¤ [0x%]") << (*cycatr & ~0x1));
|
---|
| 569 |
|
---|
| 570 | if((*cycatr & 0x4) != 0)
|
---|
| 571 | notify(TOPPERS, //éä¾åé¨ãªã®ã§RESTRICTEDã«ããªã
|
---|
| 572 | Message("TA_PHS is not supported in this kernel.","TA_PHSã¯ãµãã¼ãå¤"));
|
---|
| 573 |
|
---|
| 574 | // å±æ§å¤ã« TA_ASM ãå«ã¾ãã¦ãã
|
---|
| 575 | if((*cycatr & 0x1) != 0)
|
---|
| 576 | notify( RESTRICTED,
|
---|
| 577 | Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
|
---|
| 578 | "TOPPERS/JSPã«ã¼ãã«ã®å
|
---|
| 579 | ¨ã¦ã®æ©ç¨®ä¾åé¨ã§TA_ASMããµãã¼ãããã¨ã¯éããªã"));
|
---|
| 580 |
|
---|
| 581 | //RELTIMã§ã®è¡¨ç¾ç¯å²å
|
---|
| 582 | ã«ãããã©ããã®ãã§ãã¯
|
---|
| 583 | if(*cyctim > maxreltim)
|
---|
| 584 | notify(STANDARD,
|
---|
| 585 | Message("The cyclic object has a period (%) that exceeds the maximum period (%)",
|
---|
| 586 | "èµ·åå¨æ(%)ã表ç¾å¯è½ãªç¸å¯¾æéã®ç¯å²(%)ãè¶
|
---|
| 587 | ãã¦ãã¾ã") << *cyctim << maxreltim);
|
---|
| 588 |
|
---|
| 589 | //èµ·åå¨æã0ã§ãªããã¨ã®ãã§ãã¯
|
---|
| 590 | if(*cyctim == 0)
|
---|
| 591 | notify(STANDARD,
|
---|
| 592 | Message("The cyclic object has a ZERO period.",
|
---|
| 593 | "èµ·åå¨æã0ã«ãªã£ã¦ãã¾ã"));
|
---|
| 594 |
|
---|
| 595 | if(*cycphs > maxreltim)
|
---|
| 596 | notify(STANDARD,
|
---|
| 597 | Message("The cyclic object has a initial delay (%) that exceeds the maximum period (%)",
|
---|
| 598 | "èµ·åä½ç¸(%)ã表ç¾å¯è½ãªç¸å¯¾æéã®ç¯å²(%)ãè¶
|
---|
| 599 | ãã¦ãã¾ã") << *cycphs << maxreltim);
|
---|
| 600 |
|
---|
| 601 | ++ cycatr, ++ cyctim, ++ cycphs;
|
---|
| 602 | }
|
---|
| 603 |
|
---|
| 604 | return old_error_count == error_count;
|
---|
| 605 | }
|
---|
| 606 |
|
---|
| 607 | bool ConfigurationChecker::check_interrupt_handlerblock(Directory & parameter, FileContainer * container)
|
---|
| 608 | {
|
---|
| 609 | unsigned int id;
|
---|
| 610 | unsigned int old_error_count = error_count;
|
---|
| 611 |
|
---|
| 612 | Message object("Interrupt handler","å²è¾¼ã¿ãã³ãã©");
|
---|
| 613 |
|
---|
| 614 | TargetVariable<DT_UINT> _kernel_tnum_inhno("_kernel_tnum_inhno");
|
---|
| 615 | if(*_kernel_tnum_inhno == 0)
|
---|
| 616 | return true;
|
---|
| 617 |
|
---|
| 618 | TargetVariable<DT_UINT> inhatr("_kernel_inhinib_table", "interrupt_handler_initialization_block::inhatr");
|
---|
| 619 | TargetVariable<DT_FP> inthdr("_kernel_inhinib_table", "interrupt_handler_initialization_block::inthdr");
|
---|
| 620 |
|
---|
| 621 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tnum_inhno;
|
---|
| 622 | for(id = 0; id < *_kernel_tnum_inhno; id++)
|
---|
| 623 | {
|
---|
| 624 | set_banner(parameter, object, INTERRUPTHANDLER, id);
|
---|
| 625 |
|
---|
| 626 | //attribute validation check
|
---|
| 627 | if((*inhatr & 0x1) != 0)
|
---|
| 628 | notify(STANDARD,
|
---|
| 629 | Message("The attribute can take only TA_HLNG|TA_ASM",
|
---|
| 630 | "TA_HLNG|TA_ASM以å¤ã®å±æ§ã¯è¨å®ã§ãã¾ãã"));
|
---|
| 631 |
|
---|
| 632 | // å±æ§å¤ã« TA_ASM ãå«ã¾ãã¦ãã
|
---|
| 633 | if((*inhatr & 0x1) != 0)
|
---|
| 634 | notify(RESTRICTED,
|
---|
| 635 | Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
|
---|
| 636 | "TA_ASMã使ç¨ããã¦ãã"));
|
---|
| 637 |
|
---|
| 638 | // èµ·åçªå°ãã§ãã¯
|
---|
| 639 | if(*inthdr == 0)
|
---|
| 640 | notify(RESTRICTED,
|
---|
| 641 | Message("NULL pointer is specified as an inthdr address.",
|
---|
| 642 | "å²è¾¼ã¿ãã³ãã©ã®çªå°ãNULLã§ã"));
|
---|
| 643 |
|
---|
| 644 | ++ inhatr, ++ inthdr;
|
---|
| 645 | }
|
---|
| 646 |
|
---|
| 647 | return old_error_count == error_count;
|
---|
| 648 | }
|
---|
| 649 |
|
---|
| 650 | bool ConfigurationChecker::check_exception_handlerblock(Directory & parameter, FileContainer * container)
|
---|
| 651 | {
|
---|
| 652 | unsigned int id;
|
---|
| 653 | unsigned int old_error_count = error_count;
|
---|
| 654 |
|
---|
| 655 | Message object("Exception handler","ä¾å¤ãã³ãã©");
|
---|
| 656 |
|
---|
| 657 | TargetVariable<DT_UINT> _kernel_tnum_excno("_kernel_tnum_excno");
|
---|
| 658 | if(*_kernel_tnum_excno == 0)
|
---|
| 659 | return true;
|
---|
| 660 |
|
---|
| 661 | TargetVariable<DT_UINT> excatr("_kernel_excinib_table", "cpu_exception_handler_initialization_block::excatr");
|
---|
| 662 | TargetVariable<DT_FP> exchdr("_kernel_excinib_table", "cpu_exception_handler_initialization_block::exchdr");
|
---|
| 663 |
|
---|
| 664 | VerboseMessage("% object : % items\n","%ãªãã¸ã§ã¯ã : % å\n") << object << *_kernel_tnum_excno;
|
---|
| 665 | for(id = 0; id < *_kernel_tnum_excno; id++)
|
---|
| 666 | {
|
---|
| 667 | set_banner(parameter, object, EXCEPTIONHANDLER, id);
|
---|
| 668 |
|
---|
| 669 | //attribute validation check
|
---|
| 670 | if((*excatr & 0x1) != 0)
|
---|
| 671 | notify(STANDARD,
|
---|
| 672 | Message("The attribute can take only TA_HLNG|TA_ASM",
|
---|
| 673 | "TA_HLNG|TA_ASM以å¤ã®å±æ§ã¯è¨å®ã§ãã¾ãã"));
|
---|
| 674 |
|
---|
| 675 | // å±æ§å¤ã« TA_ASM ãå«ã¾ãã¦ãã
|
---|
| 676 | if((*excatr & 0x1) != 0)
|
---|
| 677 | notify(RESTRICTED,
|
---|
| 678 | Message("TOPPERS/JSP Kernel never minds the flag 'TA_ASM'.",
|
---|
| 679 | "TOPPERS/JSPã«ã¼ãã«ã®å
|
---|
| 680 | ¨ã¦ã®æ©ç¨®ä¾åé¨ã§TA_ASMããµãã¼ãããã¨ã¯éããªã"));
|
---|
| 681 |
|
---|
| 682 | // èµ·åçªå°ãã§ãã¯
|
---|
| 683 | if(*exchdr == 0)
|
---|
| 684 | notify(RESTRICTED,
|
---|
| 685 | Message("NULL pointer is specified as an exchdr address.",
|
---|
| 686 | "ä¾å¤ãã³ãã©ã®çªå°ãNULLã§ã"));
|
---|
| 687 |
|
---|
| 688 | ++ excatr, ++ exchdr;
|
---|
| 689 | }
|
---|
| 690 |
|
---|
| 691 | return old_error_count == error_count;
|
---|
| 692 | }
|
---|
| 693 |
|
---|
| 694 | //------------------------------------------------------
|
---|
| 695 |
|
---|
| 696 | void ConfigurationChecker::parseOption(Directory & parameter)
|
---|
| 697 | {
|
---|
| 698 | string loadmodule;
|
---|
| 699 | string work;
|
---|
| 700 |
|
---|
| 701 | if(findOption("h","help"))
|
---|
| 702 | {
|
---|
| 703 | cout << endl << Message(
|
---|
| 704 | "Configuration checker - option\n"
|
---|
| 705 | " -m, --module=filename : Specify the load module (essential option)\n"
|
---|
| 706 | " -cs, --script=filename : Specify the checker script file\n"
|
---|
| 707 | " -cl, --checklevel=level : Specify one of the check levels below \n"
|
---|
| 708 | " l(azy) : Minimum check will be performed.\n"
|
---|
| 709 | " s(tandard) : includes some ITRON Standard check items.\n"
|
---|
| 710 | " t(oppers) : checks whether it meets TOPPERS/JSP restrictions\n"
|
---|
| 711 | " r(estricted) : All of check items will be performed.\n",
|
---|
| 712 | "ã³ã³ãã£ã®ã¥ã¬ã¼ã·ã§ã³ãã§ãã« - ãªãã·ã§ã³\n"
|
---|
| 713 | " -m, --module=ãã¡ã¤ã«å : ãã¼ãã¢ã¸ã¥ã¼ã«åãæå®ãã¾ã (å¿
|
---|
| 714 | é é
|
---|
| 715 | ç®)\n"
|
---|
| 716 | " -cs, --script=ãã¡ã¤ã«å : ãã§ãã«ã¹ã¯ãªãããæå®ãã¾ã\n"
|
---|
| 717 | " -cl, --checklevel=level : Specify one of the check levels below \n"
|
---|
| 718 | " l(azy) : æå°éã®ãã§ãã¯ã®ã¿ãè¡ãã¾ã\n"
|
---|
| 719 | " s(tandard) : ITRONä»æ§ã®ç¯å²ã§ãã§ãã¯ãè¡ãã¾ã\n"
|
---|
| 720 | " t(oppers) : TOPPERS/JSPã«ã¼ãã«ã®å¶éãæºãããã¨ã確èªãã¾ã\n"
|
---|
| 721 | " r(estricted) : æ©ç¨®ä¾åé¨ãå«ãå
|
---|
| 722 | ¨ã¦ã®ãã§ãã¯é
|
---|
| 723 | ç®ãå®æ½ãã¾ã\n");
|
---|
| 724 | cout << endl
|
---|
| 725 | << Message("Supported architecture : ", "対å¿ã¢ã¼ããã¯ã㣠: ")
|
---|
| 726 | << FileContainer::getInstance()->getArchitecture()
|
---|
| 727 | << endl;
|
---|
| 728 | return;
|
---|
| 729 | }
|
---|
| 730 |
|
---|
| 731 | if(findOption("m","module",&loadmodule) || findOption(DEFAULT_PARAMETER,NULL,&loadmodule))
|
---|
| 732 | {
|
---|
| 733 | if(findOption("s","source"))
|
---|
| 734 | ExceptionMessage("Configuration checker can not execute while Configurator executes","ã³ã³ãã£ã®ã¥ã¬ã¼ã¿ã¨ãã§ãã«ã¯åæã«èµ·åã§ãã¾ãã").throwException();
|
---|
| 735 |
|
---|
| 736 | parameter["/file/loadmodule"] = loadmodule;
|
---|
| 737 | activateComponent();
|
---|
| 738 | }
|
---|
| 739 |
|
---|
| 740 | if(!findOption("cs","script",&work))
|
---|
| 741 | work = loadmodule.substr(0,loadmodule.find_last_of('.')) + ".chk";
|
---|
| 742 | parameter["/file/checkerscript"] = work;
|
---|
| 743 |
|
---|
| 744 | work.erase();
|
---|
| 745 | if(findOption("obj","load-object",&work))
|
---|
| 746 | {
|
---|
| 747 | if(work.empty())
|
---|
| 748 | work.assign("kernel_obj.dat");
|
---|
| 749 |
|
---|
| 750 | fstream f(work.c_str(), ios::in|ios::binary);
|
---|
| 751 | if(f.is_open())
|
---|
| 752 | {
|
---|
| 753 | parameter["/object"].Load(&f);
|
---|
| 754 | f.close();
|
---|
| 755 | }else
|
---|
| 756 | ExceptionMessage(" Failed to open the file '%' for storing object definitions"," ãªãã¸ã§ã¯ãæ
|
---|
| 757 | å ±ãæ ¼ç´ããããã®ãã¡ã¤ã«(%)ãéãã¾ãã") << work << throwException;
|
---|
| 758 | }
|
---|
| 759 |
|
---|
| 760 | if(findOption("cl","checklevel",&work))
|
---|
| 761 | {
|
---|
| 762 | current_level = UNKNOWN;
|
---|
| 763 |
|
---|
| 764 | if(work.compare("lazy") == 0 || work[0] == 'l')
|
---|
| 765 | current_level = LAZY;
|
---|
| 766 | if(work.compare("standard") == 0 || work[0] == 's')
|
---|
| 767 | current_level = STANDARD;
|
---|
| 768 | if(work.compare("toppers") == 0 || work[0] == 't')
|
---|
| 769 | current_level = TOPPERS;
|
---|
| 770 | if(work.compare("restricted") == 0 || work[0] == 'r')
|
---|
| 771 | current_level = RESTRICTED;
|
---|
| 772 |
|
---|
| 773 | if(current_level == UNKNOWN)
|
---|
| 774 | ExceptionMessage(" Unknown check level [%] specified"," ç¡å¹ãªãã§ãã¯ã¬ãã«æå® [%]") << work << throwException;
|
---|
| 775 | }else
|
---|
| 776 | current_level = NORMAL;
|
---|
| 777 |
|
---|
| 778 | checkOption("cpu", "cpu");
|
---|
| 779 | checkOption("system", "system");
|
---|
| 780 | }
|
---|
| 781 |
|
---|
| 782 | void ConfigurationChecker::body(Directory & parameter)
|
---|
| 783 | {
|
---|
| 784 | FileContainer * container;
|
---|
| 785 | bool result = true;
|
---|
| 786 |
|
---|
| 787 | /* ããåªå
|
---|
| 788 | 度ã®é«ãã¨ã©ã¼ã対象㫠*/
|
---|
| 789 | current_level = static_cast<enum tagCheckLevel>(static_cast<int>(current_level) * 2 - 1);
|
---|
| 790 |
|
---|
| 791 | container = FileContainer::getInstance();
|
---|
| 792 | container->attachInfo(parameter["/file/checkerscript"].toString());
|
---|
| 793 | container->attachModule(parameter["/file/loadmodule"].toString());
|
---|
| 794 |
|
---|
| 795 | if(VerboseMessage::getVerbose())
|
---|
| 796 | {
|
---|
| 797 | cout << Message(" Target architecture : "," ã¿ã¼ã²ããã¢ã¼ããã¯ã㣠: ")
|
---|
| 798 | << container->getArchitecture() << endl;
|
---|
| 799 | }
|
---|
| 800 |
|
---|
| 801 | error_count = 0;
|
---|
| 802 | result &= check_taskblock(parameter,container);
|
---|
| 803 | result &= check_semaphoreblock(parameter,container);
|
---|
| 804 | result &= check_eventflagblock(parameter,container);
|
---|
| 805 | result &= check_dataqueueblock(parameter,container);
|
---|
| 806 | result &= check_mailboxblock(parameter,container);
|
---|
| 807 | result &= check_fixed_memorypoolblock(parameter,container);
|
---|
| 808 | result &= check_cyclic_handlerblock(parameter,container);
|
---|
| 809 | result &= check_interrupt_handlerblock(parameter,container);
|
---|
| 810 | result &= check_exception_handlerblock(parameter,container);
|
---|
| 811 |
|
---|
| 812 | if(!result)
|
---|
| 813 | ExceptionMessage("Total % errors found in current configuration.\n","å
|
---|
| 814 | ¨é¨ã§%åã®ã¨ã©ã¼ãæ¤åºããã¾ãã\n") << error_count << throwException;
|
---|
| 815 |
|
---|
| 816 | VerboseMessage("No error found in current configuration\n","æ§æã«ç°å¸¸ã¯ããã¾ããã§ãã\n");
|
---|
| 817 | }
|
---|
| 818 |
|
---|