/******************************************************************************* * * * モジュール名称 :SDRAMメモリ管理情報送信 * * モジュールラベル :rap_sv_sendRdnEwoMemInfo * * タスク区分 :冗長ライブラリ * * 機能 :SDRAMメモリ管理情報のRMAP Write CommandをEWOへ * * 送信する。 * * * * コーリングシーケンス:int rap_sv_sendRdnEwoMemInfo( switch, writeInfoAddr, * * startAddr, endAddr ) * * 引数 :int switch :収集開始/停止 * * (0:停止、1:開始) * * unsigned int writeInfoAddr: * * EWOデータ書込み情報アドレス※ * * unsigned int startAddr[4] : * * リングバッファ先頭アドレス※ * * unsigned int endAddr[4] : * * リングバッファ末尾アドレス※ * * ※:0x08100000〜0x17FF0000、64k バイト単位指定* * 戻り値 :処理結果 ( <0 :異常 , 0:正常) * * 0 :正常終了 * * -1 :自DPU側ミッション機器 * * -2 :blockが範囲外 * * -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 (16+80) int rap_sv_sendRdnEwoMemInfo( int clctSwitch, unsigned int writeInfoAddr, unsigned int startAddr[], unsigned int endAddr[] ) { int i, j; M_T_DPU_INFO dpuInfo; unsigned short us_buff[48]; unsigned char *ucp_buff; char c_msChannel; /* ミッションチャネル(0-7) */ unsigned int ui_sdramAddr; unsigned int ui_writeAddr; unsigned int ui_writeSize; unsigned char uc_sendEnaCode; /* ミッションデータ送信許可/禁止コード */ M_T_MIS_DATA_PLAN t_clctInfo; int i_result; /* DPUチェック */ dpu_getDPUInfo( &dpuInfo ); if( dpuInfo.uc_dpuID == 2 ) { return -1; } /* blockチェック */ for( i = 0; i < RA_d_EWO_DATA_TYPENUM; i++ ) { /* SDRAM領域内か */ if( startAddr[i] < ( RA_d_SDRAM_SADDR & 0xFFFF0000 ) || endAddr[i] > ( RA_d_SDRAM_EADDR & 0xFFFF0000 ) ) { return -2; } /* 64kB単位か */ if(( startAddr[i] & 0x0000FFFF ) != 0 || ( endAddr[i] & 0x0000FFFF ) != 0 ) { return -2; } /* 重複チェックしない(アプリの管理に任せることとする) */ } c_msChannel = Gc_CHID[ RA_d_NODE_EWO_E ]; if( c_msChannel < 0 || c_msChannel >= RA_d_MISSION_NUM ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( c_msChannel ); return -3; // 設計上このパスを通ることは無いが念のため } /* RMAP Write Command作成 */ ui_writeAddr = RA_Gt_missionInfo[1][(int)c_msChannel].ui_msDataBuffer; /* MDP-DS情報書込みアドレス修正 */ ui_writeSize = 0x50; ucp_buff = (unsigned char *)us_buff; //big endianなので問題無し *ucp_buff = RA_Gt_missionInfo[1][(int)c_msChannel].uc_logicalAddr; /* Logical Address */ ucp_buff++; *ucp_buff = 0x01; /* Protocol Identifier (RMAP=0x01) */ ucp_buff++; *ucp_buff = 0x64; /* PacketType,Command,SourcePathAddrLen 01100100 */ ucp_buff++; *ucp_buff = 0x00; /* DestinationKey (0x00固定) */ ucp_buff++; *ucp_buff = 0x20; /* Source Logical Address (0x20固定) */ ucp_buff++; *ucp_buff = RA_d_SPW_DIRECT; /* Transaction Identifier MS (MSB=0,DirectLoad) */ ucp_buff++; *ucp_buff = RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_DIRECT]; /* 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+=2; /* *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本体 ***/ /* SDRAM管理情報書き込み先頭アドレス(上位16bit) */ ui_sdramAddr = writeInfoAddr - RA_d_SDRAM_BASE_ADDR; ucp_buff++; *ucp_buff = (unsigned char)((ui_sdramAddr >> 24) & 0xFF); ucp_buff++; *ucp_buff = (unsigned char)((ui_sdramAddr >> 16) & 0xFF); ucp_buff++; *ucp_buff = 0x00; ucp_buff++; *ucp_buff = 0x00; /* RMAP 送信許可/禁止 */ if( clctSwitch == 1) { uc_sendEnaCode = 0x5A; /* 許可 */ }else{ uc_sendEnaCode = 0x00; /* 禁止 */ } ucp_buff++; *ucp_buff = uc_sendEnaCode; /* Gap領域を0x00で埋める */ for(j=0x05; j<0x10; j++) { ucp_buff++; *ucp_buff = 0x00; } /* Buffer毎の管理情報 */ for( i=0; i> 24) & 0xFF); ucp_buff++; *ucp_buff = (unsigned char)((ui_sdramAddr >> 16) & 0xFF); ucp_buff++; *ucp_buff = 0x00; ucp_buff++; *ucp_buff = 0x00; /* リングバッファ末尾アドレス(上位16bit) */ ui_sdramAddr = endAddr[i] - RA_d_SDRAM_BASE_ADDR; ucp_buff++; *ucp_buff = (unsigned char)((ui_sdramAddr >> 24) & 0xFF); ucp_buff++; *ucp_buff = (unsigned char)((ui_sdramAddr >> 16) & 0xFF); ucp_buff++; *ucp_buff = 0x00; ucp_buff++; *ucp_buff = 0x00; /* ブロックサイズ */ i_result = rap_mm_getMisDataPlan( RA_d_NODE_EWO_E, i, &t_clctInfo ); ucp_buff++; memcpy( ucp_buff, &(t_clctInfo.ui_blockSize), 4 ); ucp_buff+=3; /* *ucp_buff = (unsigned char)( t_clctInfo.ui_blockSize >> 24) & 0x00; // 上位10bit,下位4bit マスク ucp_buff++; *ucp_buff = (unsigned char)( t_clctInfo.ui_blockSize >> 16) & 0x3F; // 上位10bit,下位4bit マスク ucp_buff++; *ucp_buff = (unsigned char)( t_clctInfo.ui_blockSize >> 8) & 0xFF; // 上位10bit,下位4bit マスク ucp_buff++; *ucp_buff = (unsigned char)( t_clctInfo.ui_blockSize ) & 0xF0; // 上位10bit,下位4bit マスク */ /* Gap領域を0x00で埋める */ for(j=0x1C; j<0x20; j++) { ucp_buff++; *ucp_buff = 0x00; } } /* Data CRCはハードが設定 */ i_result = rap_dr_sendRdnMultiCmd( c_msChannel, (unsigned char *)us_buff, RMAP_PKT_SIZE, RA_Gt_missionInfo[1][(int)c_msChannel].uc_number, RA_Gt_missionInfo[1][(int)c_msChannel].uc_interval, RA_d_SDRAM_SADDR ); if( i_result != 0 ) { // ---comment out:110615 --- rap_cmm_putDbgTlm( i_result ); return -2; } RA_Guc_rmapCnt[(int)c_msChannel][RA_d_SPW_DIRECT]++; return 0; }