/******************************************************************************* * モジュール名称 :アプリケーション07 * * モジュールラベル :dpu_app07 * * タスク区分 :アプリケーションタスク * * 機能 : * * コーリングシーケンス:void dpu_app07(int mode) * * 引数 :int mode 冗長機能 - SPIN-PULSE & EWO COLLECT * * 戻り値 :void * * 使用上の注意 :なし * * エラー処理 :なし * * 作成日・作成者 :2014/7/20 Y.K. * ********************************************************************************/ #include "dpu_api.h" #include "dpu_api_proto.h" #include "app_rdn_core.h" // *** Macro *** int app07_Rdn_EWOclct(); void app07_Rdn_EWOclct_work( unsigned char, unsigned int ); void dpu_app07(int mode) { #ifdef _APP_RDN_ int i; int i_flag; dpu_waitProcessingSlot(32); // ****************************************************** // *** EXECUTE @ RDN: Sun Pulse & EWO-mission collect *** // ****************************************************** if (Guc_dpuRdn) { for (;;) { // dpu_delay(1000); // 1-sec wait dpu_waitSunpulse(1); // 1-spin pulse wait if (Guc_dpuRdn==2) { if (Guc_dpuNo==0) { for (i=Gd_N_MGFI; i<=Gd_N_MWE; i++) if (i!=0x11 && Guc_HK_link[i]) i_flag = rap_sv_sendRdnSunpulseTime( i ); if ( (Guc_RDN_MemDump_NID & 0x80) ==0 && (Guc_RDN_MemLoad_NID & 0x80) ==0 && Guc_HK_link[Gd_N_EWO]) { dpu_waitProcessingSlot(1); i_flag = app07_Rdn_EWOclct(); } } else { for (i=Gd_N_MEA1; i<=Gd_N_MGFO; i++) if ( Guc_HK_link[i] ) i_flag = rap_sv_sendRdnSunpulseTime( i ); } } // *** CMD-buffer clear (for BroadCast) *** if (Guc_WDTena) { dpu_setWDT( 800 ); dpu_WDTEna(1); } else dpu_WDTEna(0); // WDT: ENA(64sec) / DIS dpu_getCommand( Guc_cmdDummy, &i_flag); } } dpu_WDTEna(0); // WDT: DIS #endif // _APP_RDN_ dpu_appStop(); // *** End *** } #ifdef _APP_RDN_ // ********************** // *** EWO @ SunPulse *** // ********************** // (2) dpu_waitSunpulse(1)をコールし、EWO からのミッションデータ書込み開始の同期を取る。 // (3) dpu_waitSunpulse(1)をコールする。 // (4) rap_sv_getRdnData()をコールし EWO DS 書込み情報を取得し、ブロックへの書込みパケット数を計算する。 // (5) rap_sv_getRdnMisIfStatus()をコールし RMAP 受信ステータスを取得し、ミッションデータが正常に書き込まれたかチェックする。 void app07_Rdn_EWOclct_work( unsigned char uc_nodeId, unsigned int ui_WriteAddress ) { // int i_flag; int i_NumBlock; int i_NumPacket = 0; M_T_TIME_INFO t_timeInfo; // ====================================================================================================== // ---- 要INPUT: // unsigned int ui_createTime[Gd_rdn_MaxBlock]; // TI of each Block *** // int i_replyNum [Gd_rdn_MaxBlock]; // Reply Num of each Block *** // char c_invalidFlg [Gd_rdn_MaxBlock]; // Invalid Flag of each Block **** // // unsigned int ui_AddStart; // Block address of each Block // unsigned char uc_BlockNumMax; // Max block num 初期設定 // // unsigned char uc_BlockLatest; // Latest block num *** // unsigned char uc_BlockOldest; // Oldest block num *** // unsigned char uc_BlockWrite; // Write block num *** // ====================================================================================================== // **** BLOCK **** if ( ui_WriteAddress >= Gt_rdnBLOCK[uc_nodeId].ui_AddStart ) { i_NumBlock = (ui_WriteAddress - Gt_rdnBLOCK[uc_nodeId].ui_AddStart) / Gi_SizeBlk[uc_nodeId]; if ( ( (ui_WriteAddress - Gt_rdnBLOCK[uc_nodeId].ui_AddStart) % Gi_SizeBlk[uc_nodeId] ) == 0 ) if ( i_NumBlock ) i_NumBlock --; if ( i_NumBlock < Gt_rdnBLOCK[uc_nodeId].uc_BlockNumMax) { // Num Packet i_NumPacket = ui_WriteAddress - Gt_rdnBLOCK[uc_nodeId].ui_AddStart - i_NumBlock * Gi_SizeBlk[uc_nodeId]; i_NumPacket = i_NumPacket / Gus_SizePac[uc_nodeId]; // ---- STATUS ---- // i_flag = i_NumBlock; dpu_getTime( &t_timeInfo ); Gt_rdnBLOCK[uc_nodeId].ui_createTime [ i_NumBlock ] = t_timeInfo.ui_currentTime2; Gt_rdnBLOCK[uc_nodeId].i_replyNum [ i_NumBlock ] = i_NumPacket; if ( i_NumPacket > Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum || i_NumPacket < (Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum) * 4 / 5) { Gt_rdnBLOCK[uc_nodeId].c_invalidFlg [ i_NumBlock ] = 1; } else { Gt_rdnBLOCK[uc_nodeId].c_invalidFlg [ i_NumBlock ] = 0; } if ( uc_nodeId == 0x10) { if ( i_NumPacket <= 0x212 && i_NumPacket >= 0x1A8 ) { Gt_rdnBLOCK[uc_nodeId].c_invalidFlg [ i_NumBlock ] = 0; } } // Latest Block (WROTE) & Oldest Block (Writing) Gt_rdnBLOCK[uc_nodeId].uc_BlockLatest = i_NumBlock; // WROTE BLOCK if (Gt_rdnBLOCK[uc_nodeId].uc_BlockOldest != 0 || i_NumBlock >= Gt_rdnBLOCK[uc_nodeId].uc_BlockNumMax - 2 ) { Gt_rdnBLOCK[uc_nodeId].uc_BlockOldest = ( i_NumBlock + 2 ) % Gt_rdnBLOCK[uc_nodeId].uc_BlockNumMax; // OLDEST BLOCK } } } /* // **** NumPacket correction **** int i; int j; unsigned char uc_data[16]; unsigned int ui_time, ui_time0, ui_time1; for (i=0; i 0) i_NumPacket = 2; else i_NumPacket = -2; } if ( i_NumPacket > Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum || i_NumPacket < (Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum) * 4 / 5) { Gt_rdnBLOCK[uc_nodeId].c_invalidFlg [ i ] = 1; // i_NumPacket = 0; } if ( Gt_rdnBLOCK[uc_nodeId].i_replyNum[i] != i_NumPacket ) { Gt_rdnBLOCK[uc_nodeId].i_replyNum[i] = i_NumPacket; } // } } */ /* // ---------TMP: MONITOR-PACKET--------- // ---------TMP: MONITOR-PACKET--------- // ---------TMP: MONITOR-PACKET--------- if ( Gt_rdnBLOCK[uc_nodeId].uc_BlockLatest != Gt_rdnBLOCK[uc_nodeId].uc_BlockOldest) { for (j=0; j> 4); Gt_rdnBLOCK2[uc_nodeId].ui_createTime [ i ] = ui_time; if ( ui_time0 > ui_time ) { ui_time0 = ui_time; Gt_rdnBLOCK2[uc_nodeId].uc_BlockOldest = i; } if ( ui_time1 < ui_time ) { ui_time1 = ui_time; Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest = i; } Gt_rdnBLOCK2[uc_nodeId].c_invalidFlg [ i ] = 0; } else { Gt_rdnBLOCK2[uc_nodeId].ui_createTime[ i ] = 0; Gt_rdnBLOCK2[uc_nodeId].c_invalidFlg [ i ] = 1; } } if (Gt_rdnBLOCK2[uc_nodeId].uc_BlockOldest != Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest ) { if (Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest == 0) Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest = Gt_rdnBLOCK[uc_nodeId].uc_BlockNumMax - 1; else Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest--; } for (i=0; i 0) i_NumPacket = 2; else i_NumPacket = -2; } if ( i_NumPacket > Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum || i_NumPacket < (Gt_rdnBLOCK[uc_nodeId].us_BlockPacNum) * 4 / 5) { Gt_rdnBLOCK2[uc_nodeId].c_invalidFlg [ i ] = 1; // i_NumPacket = 0; } if ( Gt_rdnBLOCK2[uc_nodeId].i_replyNum[i] != i_NumPacket ) { Gt_rdnBLOCK2[uc_nodeId].i_replyNum[i] = i_NumPacket; } } if ( Gt_rdnBLOCK2[uc_nodeId].uc_BlockLatest != Gt_rdnBLOCK2[uc_nodeId].uc_BlockOldest) { for (j=0; j>>> ui_dataTi, // [INPUT] Data TI <<<< USER-DEF: 0x00000000-0xFFFFFFFF >>>> Guc_cmdDummy, // [INPUT] Comment <<<< USER-DEF: <128B >>>> 0, // [INPUT] Comment - Size <<<< USER-DEF: <128B >>>> uc_data, // [INPUT] Data <<<< USER-DEF: <0x1E00 >>>> i_dataSize); // [INPUT] Data - Size <<<< USER-DEF: <0x1E00 >>>> return; } */ #endif // _APP_RDN_