/******************************************************************************* * * * モジュール名称 :冗長ミッションHK収集コマンド送信 * * モジュールラベル :rap_sv_sendRdnHKCollect * * タスク区分 :冗長ライブラリ * * 機能 :ミッション機器へミッションHK収集のRMAP Read Command* * を送信する * * * * コーリングシーケンス:int rap_sv_sendRdnHKCollect( nodeID, recvAddr ) * * 引数 :int nodeID :ミッション機器ID * * unsigned int recvAddr :ミッションHK 受信領域 * * (0x08100000〜0x17FFFFFF、16 バイト単位指定)* * 戻り値 :処理結果 ( <0 :異常 , 0:正常) * * 0 :正常終了 * * -1 :自DPU 側ミッション機器 * * -2 :recvAddr が指定範囲外 * * -3 :上記以外の異常 * * 使用上の注意 :なし * * エラー処理 :なし * * * *******************************************************************************/ #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" extern unsigned char Guc_rdn_MwHK[]; #define RMAP_PKT_SIZE 16 int rap_sv_sendRdnHKCollect( int nodeID, 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; int i_result; /* コマンド送信結果 */ M_T_RDN_MIS_IF_STATUS t_misIfStatus ; /* 冗長側DPU MISSION IFステータス */ /* 処理開始 */ /* 引数チェック */ 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 = RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_msChannel].ui_hkBuffer; 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 = 0x80; /* Transaction Identifier MS (MSB=1固定) */ ucp_buff++; *ucp_buff = RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_HKREAD]; /* 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++; */ *ucp_buff = 0x00; /* Data Length MS */ ucp_buff++; *ucp_buff = 0x00; /* Data Length */ ucp_buff++; *ucp_buff = 0x80; /* Data Length LS (128byte固定) */ ucp_buff++; *ucp_buff = 0x00; /* CRCはハードが作成 */ // MS0_SGL_CMD_ERR "Mission-IF 非定期コマンド送信エラー(2013.01.22) // 処理の遅れが原因の場合は、一時的にERR立つが解消されればクリア。 // ミッション機器からFCTが返らないことが原因の場合は送信フラグが下りないので、ERRが立ったままとなる。 i_result = rap_sv_getRdnMisIfStatus( nodeID, &t_misIfStatus ); if( ( t_misIfStatus.us_singleSendCtl & 0x01 ) != 0 ) { /* 送信中 */ Guc_rdn_MwHK[37] |= ( 0x01 << ( 7 - c_msChannel ) ); // ERR }else{ /* 待機中 */ Guc_rdn_MwHK[37] &= ~( 0x01 << ( 7 - c_msChannel ) ); // no-ERR } i_result = rap_dr_sendRdnSingleCmd( c_msChannel, (unsigned char *)us_buff, RMAP_PKT_SIZE, recvAddr); if ( i_result == 0 ) RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_HKREAD]++; else if ( i_result == -3 || i_result == -4 ) return -2; else return -3; return 0; }