|
|
interrupt.cpp00001 /* 00002 * TOPPERS/FDMP Kernel 00003 * Toyohashi Open Platform for Embedded Real-Time Systems/ 00004 * Function Distributed Multiprocessor Kernel 00005 * 00006 * Copyright (C) 2005 by Takagi Nobuhisa 00007 * 00008 * 上記著作権者は,以下の (1)〜(4) の条件か,Free Software Foundation 00009 * によって公表されている GNU General Public License の Version 2 に記 00010 * 述されている条件を満たす場合に限り,本ソフトウェア(本ソフトウェア 00011 * を改変したものを含む.以下同じ)を使用・複製・改変・再配布(以下, 00012 * 利用と呼ぶ)することを無償で許諾する. 00013 * (1) 本ソフトウェアをソースコードの形で利用する場合には,上記の著作 00014 * 権表示,この利用条件および下記の無保証規定が,そのままの形でソー 00015 * スコード中に含まれていること. 00016 * (2) 本ソフトウェアを,ライブラリ形式など,他のソフトウェア開発に使 00017 * 用できる形で再配布する場合には,再配布に伴うドキュメント(利用 00018 * 者マニュアルなど)に,上記の著作権表示,この利用条件および下記 00019 * の無保証規定を掲載すること. 00020 * (3) 本ソフトウェアを,機器に組み込むなど,他のソフトウェア開発に使 00021 * 用できない形で再配布する場合には,次のいずれかの条件を満たすこ 00022 * と. 00023 * (a) 再配布に伴うドキュメント(利用者マニュアルなど)に,上記の著 00024 * 作権表示,この利用条件および下記の無保証規定を掲載すること. 00025 * (b) 再配布の形態を,別に定める方法によって,TOPPERSプロジェクトに 00026 * 報告すること. 00027 * (4) 本ソフトウェアの利用により直接的または間接的に生じるいかなる損 00028 * 害からも,上記著作権者およびTOPPERSプロジェクトを免責すること. 00029 * 00030 * 本ソフトウェアは,無保証で提供されているものである.上記著作権者お 00031 * よびTOPPERSプロジェクトは,本ソフトウェアに関して,その適用可能性も 00032 * 含めて,いかなる保証も行わない.また,本ソフトウェアの利用により直 00033 * 接的または間接的に生じたいかなる損害に関しても,その責任を負わない. 00034 * 00035 */ 00036 00037 /* 00038 * toppers/itron/jsp/interrupt.cpp 00039 */ 00040 #include "toppers/itron/jsp/interrupt.hpp" 00041 #include "toppers/itron/jsp/kernel_chk.hpp" 00042 #include "toppers/reporter.hpp" 00043 #include "toppers/s_record.hpp" 00044 #include "toppers/nm_symbol.hpp" 00045 #include <boost/lexical_cast.hpp> 00046 00047 namespace toppers 00048 { 00049 namespace itron 00050 { 00051 namespace jsp 00052 { 00053 00059 void interrupt_policy::generate_assertions( const kernel_cfg& cfg, std::ostream& ostr ) 00060 { 00061 const kernel_cfg::inib_array* pinibs = cfg.get_inib_array( name_ ); 00062 static const char pattern[] = 00063 "#if (@#inhatr) != 0x00u\n" 00064 "#error \"`inhatr\' of interrupt handler `@name\' is not 0\"\n" 00065 "#endif\n" 00066 "__CFG_ASSERT((@#inhatr) == 0x00u);\n" 00067 "\n"; 00068 std::transform( pinibs->begin(), pinibs->end(), std::ostream_iterator<std::string>( ostr ), generator( pattern ) ); 00069 } 00070 00077 bool interrupt_policy::verify( const static_api& api, kernel_object& obj ) 00078 { 00079 try 00080 { 00081 if ( boost::lexical_cast<long>( obj.get( "%inhno" ) ) < 0 ) 00082 { 00083 warning( _( "parameter `%1%\' is negative" ) % "inhno" ); 00084 } 00085 } 00086 catch ( boost::bad_lexical_cast& ) 00087 { 00088 // inhnoは必ずしも整数定数ではないので、例外が発生しても特に問題はない 00089 } 00090 return true; 00091 } 00092 00099 bool interrupt_policy::check( const itron::kernel_chk& chk, const s_record& srec, const nm_symbol& syms ) 00100 { 00101 nm_symbol::entry entry = syms.find( "_kernel_inhinib_table" ); 00102 if ( entry.type < 0 ) 00103 { 00104 return false; 00105 } 00106 long tnum_cycid = chk.get( kernel_chk::countof_INHNO ); 00107 long sizeof_FP = chk.get( kernel_chk::sizeof_FP ); 00108 long sizeof_INHINIB = chk.get( kernel_chk::sizeof_INHINIB ); 00109 long offsetof_INHINIB_inthdr = chk.get( kernel_chk::offsetof_INHINIB_inthdr ); 00110 00111 for ( int i = 0; i < tnum_cycid; i++ ) 00112 { 00113 unsigned long value = 0; 00114 for ( int j = 0; j < sizeof_FP; j++ ) 00115 { 00116 int t = srec[entry.address + sizeof_INHINIB*i + offsetof_INHINIB_inthdr + j]; 00117 if ( t < 0 ) 00118 { 00119 return false; 00120 } 00121 value = ( value << 8 ) | ( t & 0xff ); 00122 } 00123 if ( value == 0 ) 00124 { 00125 error( _( "start address of interrupt #%1% handler is null" ) % ( i + 1 ) ); 00126 } 00127 } 00128 return true; 00129 } 00130 00131 const char interrupt_policy::name_[] = "interrupt"; 00132 const char interrupt_policy::symbol_[] = "inh"; 00133 const char* const interrupt_policy::apis_[] = { "DEF_INH", 0 }; 00134 const char* const interrupt_policy::params_[] = { "%inhno { #inhatr inthdr }" }; 00135 const char interrupt_policy::region_format_[] = "CFG_INTHDR_ENTRY(@inthdr);\n"; 00136 const char interrupt_policy::init_format_[] = "\t{ @%inhno, @#inhatr, (FP)CFG_INT_ENTRY(@inthdr) }"; 00137 00138 } 00139 } 00140 } Copyright © 2006 by TAKAGI Nobuhisa. このページは Wed Apr 12 16:31:56 2006 に Doxygen によって生成されました。 |