/******************************************************************************* * * * モジュール名称 :冗長メモリロード送信 * * モジュールラベル :rap_sv_sendRdnMemLoad * * タスク区分 :冗長ライブラリ * * 機能 :ミッション機器に対し、指定したアドレスへアプリケー * * ション用データ領域から指定したサイズのデータを書き * * 込むRMAP Write Commandを送信する。 * * * * コーリングシーケンス:int rap_sv_sendRdnMemLoad( nodeID, address, size, * * loadBuff ) * * 引数 :int nodeID :ミッション機器ID * * unsigned int address :ロードアドレス * * int size :ロードサイズ * * unsigned char loadBuff[163] :ロードデータ * * (RMAP Write Command のData 部分のみ)* * 戻り値 :処理結果 ( <0 :異常 , 0:正常) * * 0 :正常終了 * * -1 :自DPU側ミッション機器 * * -2 :ロードサイズが最大値を超える * * -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" #define RMAP_PKT_SIZE_MAX (15+163) int rap_sv_sendRdnMemLoad( int nodeID, unsigned int address, int size, unsigned char loadBuff[] ) { // int i; unsigned short us_buff[89]; unsigned char *ucp_buff; char c_msChannel; /* ミッションチャネル(0-7) */ char c_dpuIndex; /* 冗長DPUインデックス */ unsigned int ui_writeAddr; unsigned int ui_writeSize; 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; } } if( size < 0 || size > 163 ) { return -2; } /* コマンド生成 */ ui_writeAddr = address; ui_writeSize = 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 = 0x64; /* PacketType,Command,SourcePathAddrLen 01101100 */ ucp_buff++; *ucp_buff = 0x00; /* DestinationKey (0x00固定) */ ucp_buff++; *ucp_buff = 0x20; /* Source Logical Address (0x20固定) */ ucp_buff++; *ucp_buff = RA_d_SPW_MEMLOAD; /* Transaction Identifier MS (MSB=0,MS-Command) */ ucp_buff++; *ucp_buff = RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_MEMLOAD]; /* Transaction Identifier LS (Counter) */ ucp_buff++; *ucp_buff = 0x00; /* Extended Write Address (0x00固定) */ ucp_buff++; memcpy( ucp_buff, &ui_writeAddr, 4); ucp_buff+=4; /* *ucp_buff = (unsigned char)((ui_writeAddr >> 24) & 0xFF); // Write Address MS ucp_buff++; *ucp_buff = (unsigned char)((ui_writeAddr >> 16) & 0xFF); // Write Address ucp_buff++; *ucp_buff = (unsigned char)((ui_writeAddr >> 8) & 0xFF); // Write Address ucp_buff++; *ucp_buff = (unsigned char)( ui_writeAddr & 0xFF); // Write Address LS ucp_buff++; */ ui_writeSize = (ui_writeSize << 8); memcpy( ucp_buff, &ui_writeSize, 3); ucp_buff+=3; /* *ucp_buff = (unsigned char)((ui_writeSize >> 16) & 0xFF); // Data Length MS ucp_buff++; *ucp_buff = (unsigned char)((ui_writeSize >> 8) & 0xFF); // Data Length ucp_buff++; *ucp_buff = (unsigned char)( ui_writeSize & 0xFF); // Data Length LS */ /* Header CRCはハードが設定 */ /* Data本体 */ memcpy( ucp_buff, &(loadBuff[0]), size); ucp_buff+=(size-1); /* for( i=0 ; i