/******************************************************************************* * * * モジュール名称 :冗長側MSIFリセット * * モジュールラベル :rap_sv_resetRdnMisIf * * タスク区分 :冗長ライブラリ * * 機能 :指定したミッション機器に対応するミッションI/F H/Wを * * リセットする。 * * * * コーリングシーケンス:int rap_sv_resetRdnMisIf( nodeID, lowerAddr, * * upperAddr) * * 引数 :int nodeID :ミッション機器ID * * unsigned int lowerAddr :転送下限アドレス※ * * unsigned int upperAddr :転送上限アドレス※ * * ※:0x08100000〜0x17F00000、16バイト単位指定 * * 戻り値 :処理結果 ( <0 :異常 , 0:正常) * * 0 :正常終了 * * -1 :自DPU 側ミッション機器 * * -2 :lowerAddr 及びupperAddr が指定範囲外 * * -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 BUFF_SIZE 15 int rap_sv_resetRdnMisIf( int nodeID, unsigned int lowerAddr, unsigned int upperAddr ) { int i; unsigned int ui; unsigned short us_setValue[BUFF_SIZE]; /* レジスタ設定値格納 */ unsigned int ui_size = RA_d_SHORT * BUFF_SIZE; /* 格納領域サイズ */ char c_channel; char c_dpuIndex; int i_sendResult; unsigned char *ucp_msReadCmd; unsigned char uc_logicalAddr; unsigned char uc_msReadPktType; unsigned int ui_msReadAddr; unsigned int ui_msReadSize; /* 引数チェック */ c_channel = Gc_CHID[ nodeID ]; if( c_channel < 0 || c_channel >= RA_d_MISSION_NUM ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( c_channel ); return -1; } if( lowerAddr > upperAddr ) { return -2; } if( lowerAddr < 0x08100000 || lowerAddr > 0x17F00000 || ( lowerAddr % 0x00200000 ) != 0 ) { return -2; } if( upperAddr < 0x08100000 || upperAddr > 0x17F00000 || ( upperAddr % 0x00200000 ) != 0 ) { return -2; } /* 非定期コマンド送信コントロールレジスタ :エラーステータスクリア */ us_setValue[0] = 0x0F00; /* 定期コマンド送信コントロール・レジスタ :エラーステータスクリア */ us_setValue[1] = 0x1F00; /* 定期コマンド送信設定・レジスタ :(設定対象外) */ us_setValue[2] = 0x0000; /* RMAP 受信ステータス・レジスタ :受信イネーブル設定 */ /* :エラーカウンタクリア */ us_setValue[3] = 0x1001; /* RMAP Read Reply0 受信個数・レジスタ :受信個数クリア */ us_setValue[4] = 0x0001; /* DMA転送先アドレス0・レジスタ :(設定対象外) */ us_setValue[5] = 0x0000; us_setValue[6] = 0x0000; /* RMAP Read Reply1 受信個数・レジスタ :受信個数クリア */ us_setValue[7] = 0x0001; /* DMA転送先アドレス1・レジスタ :(設定対象外) */ us_setValue[8] = 0x0000; us_setValue[9] = 0x0000; /* RMAP Write Reply 受信個数・レジスタ :受信個数クリア */ us_setValue[10] = 0x0001; /* RMAP Write Command 受信個数・レジスタ :受信個数クリア */ us_setValue[11] = 0x0001; /* 転送先アドレスLower Limit 設定・レジスタ :lowerAddr に従う値に設定 */ us_setValue[12] = (unsigned short)((( lowerAddr - RA_d_SDRAM_BASE_ADDR ) & 0x0FE00000 ) >> 16 ); /* 転送先アドレスUpper Limit 設定・レジスタ :upperAddr に従う値に設定 */ us_setValue[13] = (unsigned short)((( upperAddr - RA_d_SDRAM_BASE_ADDR ) & 0x0FE00000 ) >> 16 ); /* RCV Buffer EDAC エラーステータス・レジスタ:エラーステータスクリア */ us_setValue[14] = 0x0003; i_sendResult = rap_cmm_setRdnRegister( (unsigned char *)us_setValue, RA_Gui_msRegStartAddr[(int)c_channel], RA_d_MSREG_SGLSDCTL, // 書込み先の先頭レジスタ ui_size ); if( i_sendResult < 0 ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( i_sendResult ); return -3; } /* ミッションデータ収集コマンド生成 */ c_dpuIndex = rap_cmm_getRdnDpuIndex(); uc_logicalAddr = RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_channel].uc_logicalAddr; ui_msReadAddr = RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_channel].ui_msDataBuffer; ui_msReadSize = RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_channel].ui_readSize; if(RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_channel].uc_incr == 1) { uc_msReadPktType = 0x4C; /* Incr : 01001100 */ }else{ uc_msReadPktType = 0x48; /* No-Incr : 01001000 */ } ucp_msReadCmd = (unsigned char *)RA_Gus_misClctCmd[(int)c_channel]; for( i = 0; i < RA_Gt_missionInfo[(int)c_dpuIndex][(int)c_channel].uc_number; i++ ) { *ucp_msReadCmd = uc_logicalAddr; /* Logical Address */ ucp_msReadCmd++; *ucp_msReadCmd = 0x01; /* Protocol Identifier (RMAP=0x01) */ ucp_msReadCmd++; *ucp_msReadCmd = uc_msReadPktType; /* PacketType,Command,SourcePathAddrLen */ ucp_msReadCmd++; *ucp_msReadCmd = 0x00; /* DestinationKey (0x00固定) */ ucp_msReadCmd++; *ucp_msReadCmd = 0x20; /* Source Logical Address (0x20固定) */ ucp_msReadCmd++; *ucp_msReadCmd = RA_d_SPW_MSREAD; /* Transaction Identifier MS (MSB=0,MSREAD) */ ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)i; /* Transaction Identifier LS (Counter) */ ucp_msReadCmd++; *ucp_msReadCmd = 0x00; /* Extended Write Address (0x00固定) */ ucp_msReadCmd++; memcpy( ucp_msReadCmd, &ui_msReadAddr, 4); ucp_msReadCmd += 4; /* *ucp_msReadCmd = (unsigned char)((ui_msReadAddr >> 24) & 0xFF); // Write Address ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)((ui_msReadAddr >> 16) & 0xFF); ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)((ui_msReadAddr >> 8) & 0xFF); ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)((ui_msReadAddr ) & 0xFF); ucp_msReadCmd++; */ ui = (ui_msReadSize << 8); memcpy( ucp_msReadCmd, &ui, 3); ucp_msReadCmd+=3; /* *ucp_msReadCmd = (unsigned char)((ui_msReadSize >> 16) & 0xFF); // Data Length ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)((ui_msReadSize >> 8) & 0xFF); ucp_msReadCmd++; *ucp_msReadCmd = (unsigned char)((ui_msReadSize ) & 0xFF); ucp_msReadCmd++; */ } /* 終了 */ return 0; }