/******************************************************************************* * * * モジュール名称 :冗長メモリダンプ送信 * * モジュールラベル :rap_sv_sendRdnMemDump * * タスク区分 :冗長ライブラリ * * 機能 :ミッション機器に対し、指定したアドレスから指定した * * サイズだけ読み込むRMAP Read Commandを送信する。 * * * * コーリングシーケンス:int rap_sv_sendRdnMemDump( nodeID, address, size, * * recvAddr ) * * 引数 :int nodeID :ミッション機器ID * * unsigned int address :ダンプアドレス * * int size :ダンプサイズ * * unsigned int recvAddr :ダンプデータ受信領域 * * (0x08100000〜0x17FFFFFF、16 バイト単位指定)* * 戻り値 :処理結果 ( <0 :異常 , 0:正常) * * 0 :正常終了 * * -1 :自DPU 側ミッション機器 * * -2 :上記以外 * * 使用上の注意 :なし * * エラー処理 :なし * * * *******************************************************************************/ #include "dpu_api.h" #include "dpu_api_proto.h" #include "rap_api.h" #include "rap_define.h" /* define定義 */ #include "rap_variable.h" /* グローバル変数宣言 */ #include "rap_func.h" /* 関数プロトタイプ宣言 */ #include "app_rdn_core.h" #define RMAP_PKT_SIZE (16) int rap_sv_sendRdnMemDump( int nodeID, unsigned int address, int size, unsigned int recvAddr ) { unsigned short us_buff[8]; unsigned char *ucp_buff; char c_msChannel; /* ミッションチャネル(0-7) */ char c_dpuIndex; /* 冗長DPUインデックス */ unsigned int ui_readAddr; unsigned int ui_readSize; int i_result; /* コマンド送信結果 */ /* 処理開始 */ /* 引数チェック */ c_msChannel = Gc_CHID[ nodeID ]; c_dpuIndex = rap_cmm_getRdnDpuIndex(); if( c_msChannel < 0 || c_msChannel >= RA_d_MISSION_NUM ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( c_msChannel ); return -1; } if( c_dpuIndex == 0 ) { if( nodeID >= RA_d_NODE_MGF_I ) { return -1; } }else{ if( nodeID < RA_d_NODE_MGF_I || nodeID == RA_d_NODE_EWO_B ) { return -1; } } /* RMAP Write Command作成 */ ui_readAddr = address; ui_readSize = size; ucp_buff = (unsigned char *)us_buff; //big endianなので問題無し *ucp_buff = RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_msChannel].uc_logicalAddr;/* Logical Address */ ucp_buff++; *ucp_buff = 0x01; /* Protocol Identifier (RMAP=0x01) */ ucp_buff++; *ucp_buff = 0x4C; /* PacketType,Command,SourcePathAddrLen 01001100 */ ucp_buff++; *ucp_buff = 0x00; /* DestinationKey (0x00固定) */ ucp_buff++; *ucp_buff = 0x20; /* Source Logical Address (0x20固定) */ ucp_buff++; *ucp_buff = RA_d_SPW_MEMDUMP; /* Transaction Identifier MS (MSB=1固定) */ ucp_buff++; *ucp_buff = RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_MEMDUMP]; /* Transaction Identifier LS (Counter) */ ucp_buff++; *ucp_buff = 0x00; /* Extended Write Address (0x00固定) */ ucp_buff++; memcpy( ucp_buff, &ui_readAddr, 4); ucp_buff+=4; /* *ucp_buff = (unsigned char)((ui_readAddr >> 24) & 0xFF); // Read Address MS ucp_buff++; *ucp_buff = (unsigned char)((ui_readAddr >> 16) & 0xFF); // Read Address ucp_buff++; *ucp_buff = (unsigned char)((ui_readAddr >> 8) & 0xFF); // Read Address ucp_buff++; *ucp_buff = (unsigned char)( ui_readAddr & 0xFF); // Read Address LS ucp_buff++; */ ui_readSize = (ui_readSize << 8); memcpy( ucp_buff, &ui_readSize, 3); ucp_buff+=3; /* *ucp_buff = (unsigned char)((ui_readSize >> 16) & 0xFF); // Data Length MS ucp_buff++; *ucp_buff = (unsigned char)((ui_readSize >> 8) & 0xFF); // Data Length ucp_buff++; *ucp_buff = (unsigned char)( ui_readSize & 0xFF); // Data Length LS ucp_buff++; */ *ucp_buff = 0x00; /* CRCはハードが作成 */ i_result = rap_dr_sendRdnMultiCmd( c_msChannel, (unsigned char *)us_buff, RMAP_PKT_SIZE, 1, 1, recvAddr); if( i_result != 0 ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( i_result ); return -3; } RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_MEMDUMP]++; // 修正:TID更新漏れ return 0; }