クラス toppers::itron::kernel_chk

"kernel_chk.c"出力クラス [詳細]

#include "toppers/itron/kernel_chk.hpp"

toppers::itron::kernel_chkに対する継承グラフ

Inheritance graph
[凡例]
toppers::itron::kernel_chkのコラボレーション図

Collaboration graph
[凡例]
すべてのメンバ一覧

Public 型

enum  byteorder_type { big_endian, little_endian, unknown = -1 }
enum  { magic_number, TKERNEL_PRID }

Public メソッド

 kernel_chk (const std::string &file)
virtual ~kernel_chk ()
void load (const boost::shared_ptr< cfg_contents > &contents)
 コンテンツ情報のロード
void load (const s_record &srec, unsigned long address=~0UL)
 "kernel_chk.srec"からのチェック情報の読み込み
long countof (const std::string &object_type) const
 カーネルオブジェクト数の取得
unsigned long get (int key) const
 "kernel_chk.c"の配列要素の参照
void set (int key, unsigned long value)
 "kernel_chk.c"の配列要素の設定
byteorder_type byteorder () const
void byteorder (byteorder_type order)

Static Public メソッド

static long read_prid (const s_record &srec, unsigned long address=~0UL)
 プロダクトID番号の読み込み

Protected メソッド

virtual bool do_save (std::ostream &ostr) const
 ファイル出力内容の規定
virtual void do_load (const boost::shared_ptr< cfg_contents > &contents)
 load 関数の実体
virtual bool do_load (const s_record &srec, unsigned long address)=0
 load 関数の実体

説明

"kernel_chk.c"出力クラス

kernel_chk.hpp63 行で定義されています。


関数

long toppers::itron::kernel_chk::countof const std::string &  object_type  )  const
 

カーネルオブジェクト数の取得

引数:
object_type カーネルオブジェクトの種類
戻り値:
指定した種類のカーネルオブジェクト数を返す
"task"等のカーネルオブジェクトの個数を調べます。

kernel_chk.cpp82 行で定義されています。

参照元 toppers::itron::jsp::kernel_chk::do_body().

00083     {
00084       std::map<std::string, long>::const_iterator iter( countof_map_.find( object_type ) );
00085       if ( iter != countof_map_.end() )
00086       {
00087         return iter->second;
00088       }
00089       return 0;
00090     }

bool toppers::itron::kernel_chk::do_load const s_record srec,
unsigned long  address
[protected, pure virtual]
 

load 関数の実体

引数:
srec "kernel_chk.srec"の内容
address 読み込み開始番地
戻り値:
読み込みに成功した場合はtrueを返す

toppers::itron::jsp::kernel_chkで実装されています。

void toppers::itron::kernel_chk::do_load const boost::shared_ptr< cfg_contents > &  contents  )  [protected, virtual]
 

load 関数の実体

引数:
contents チェック情報を取得するコンテンツ情報

kernel_chk.cpp198 行で定義されています。

参照元 load().

00199     {
00200       typedef cfg_contents::group_container::const_iterator group_iterator;
00201       const cfg_contents::group_container& container = contents->groups();
00202 
00203       for ( group_iterator giter( contents->groups().begin() ), glast( contents->groups().end() ); giter != glast; ++giter )
00204       {
00205         typedef cfg_group::object_container::const_iterator object_iterator;
00206         const boost::shared_ptr<cfg_group> group( *giter );
00207         for ( object_iterator oiter( group->objects().begin() ), olast( group->objects().end() ); oiter != olast; ++oiter )
00208         {
00209           ++countof_map_[( *oiter )->get_object_type()];
00210         }
00211       }
00212     }

bool toppers::itron::kernel_chk::do_save std::ostream &  ostr  )  const [protected, virtual]
 

ファイル出力内容の規定

引数:
ostr 出力ストリーム
戻り値:
true ファイルに書き込む必要あり
false ファイルに書き込み必要なし

toppers::cfg_baseを実装しています。

kernel_chk.cpp187 行で定義されています。

参照先 toppers::cfg_base::do_body()toppers::cfg_base::do_file_header().

00188     {
00189       do_file_header( ostr );
00190       do_body( ostr );
00191       return true;
00192     }

関数の呼び出しグラフ:

unsigned long toppers::itron::kernel_chk::get int  key  )  const
 

"kernel_chk.c"の配列要素の参照

引数:
key 配列のインデックス
戻り値:
key で指定した配列要素(UW型)の値を返す

kernel_chk.cpp97 行で定義されています。

参照元 toppers::itron::jsp::task_policy::check()toppers::itron::jsp::interrupt_policy::check()toppers::itron::jsp::exception_policy::check()toppers::itron::jsp::cyclic_policy::check().

00098     {
00099       if ( key < 0 || static_cast<int>( table_.size() ) <= key )
00100       {
00101         return 0;
00102       }
00103       return table_[key];
00104     }

void toppers::itron::kernel_chk::load const s_record srec,
unsigned long  address = ~0UL
 

"kernel_chk.srec"からのチェック情報の読み込み

引数:
srec "kernel_chk.srec"の内容
address 読み込み開始番地
address に~0UL(デフォルト値)を指定すると、Sレコードの最初から読み込みます。

kernel_chk.cpp58 行で定義されています。

参照先 _do_load()toppers::error()toppers::s_record::lower_bound()toppers::s_record::upper_bound().

00059     {
00060       if ( address == ~0UL )
00061       {
00062         address = srec.lower_bound();
00063       }
00064       byteorder_ = unknown;
00065 
00066       while ( !do_load( srec, address ) )
00067       {
00068         if ( srec.upper_bound() <= address + 1 )
00069         {
00070           error( _( "illegal check script" ) );
00071         }
00072       }
00073     }

関数の呼び出しグラフ:

void toppers::itron::kernel_chk::load const boost::shared_ptr< cfg_contents > &  contents  )  [inline]
 

コンテンツ情報のロード

引数:
contents ロードするコンテンツ情報

kernel_chk.hpp86 行で定義されています。

参照先 do_load().

00086 { do_load( contents ); }

関数の呼び出しグラフ:

long toppers::itron::kernel_chk::read_prid const s_record srec,
unsigned long  address = ~0UL
[static]
 

プロダクトID番号の読み込み

引数:
srec "kernel_chk.srec"ファイルの内容
address 開始アドレス
プロダクトID番号は"kernel_chk.c"に出力した2番目の要素に格納されていると想定します。 address に~0UL(既定値)を指定すると srec の先頭アドレスを採用します。

kernel_chk.cpp135 行で定義されています。

参照先 toppers::s_record::lower_bound().

00136     {
00137       const int table_size = 2;
00138       unsigned long table[table_size];
00139       long prid = -1;
00140 
00141       if ( address == ~0UL )
00142       {
00143         address = srec.lower_bound();
00144       }
00145 
00146       do
00147       {
00148         for ( int i = 0; i < table_size; i++ )
00149         {
00150           unsigned long value = 0;
00151           for ( int j = 0; j < 4; j++ )
00152           {
00153             value = value << 8 | srec[address + i*4 + j];
00154           }
00155           table[i] = value;
00156         }
00157 
00158         switch ( table[0] )
00159         {
00160         case 0x12345678:
00161           prid = static_cast<long>( table[1] );
00162           break;
00163         case 0x78563412:
00164           {
00165             unsigned long value = 0;
00166             unsigned long t = table[1];
00167             for ( int j = 0; j < 4; j++ )
00168             {
00169               value = value << 8 | ( t & 0xff );
00170               t >>= 8;
00171             }
00172             prid = static_cast<long>( value );
00173           }
00174           break;
00175         default:
00176           if ( srec.upper_bound() <= address + 1 )
00177           {
00178             return -1;
00179           }
00180           ++address;
00181           break;
00182         }
00183       } while ( prid < 0 );
00184       return prid;
00185     }

関数の呼び出しグラフ:

void toppers::itron::kernel_chk::set int  key,
unsigned long  value
 

"kernel_chk.c"の配列要素の設定

引数:
key 配列のインデックス
value 配列要素の値に設定する値
この関数は kernel_chk オブジェクトが内部的に管理する配列を設定するために使用します。 この関数を呼び出しても、"kernel_chk.srec"や"kernel_chk.o", "kernel_chk.c"に影響が出る わけではありません。

kernel_chk.cpp115 行で定義されています。

参照元 toppers::itron::jsp::kernel_chk::do_load().

00116     {
00117       if ( key >= 0 )
00118       {
00119         if ( key >= static_cast<int>( table_.size() ) )
00120         {
00121           table_.resize( key + 1 );
00122         }
00123         table_[key] = value;
00124       }
00125     }


このクラスの説明は次のファイルから生成されました:
Copyright © 2006 by TAKAGI Nobuhisa.
このページは Wed Apr 12 16:32:05 2006 に Doxygen によって生成されました。