/******************************************************************************* * モジュール名称 :APP01 - CMD from DMC to DPU (for MEF task) * * 作成日・作成者 :2012/4/23 Y.K. * * * * 参照 : app01_DPU.c を参照のこと * * 注意 : EDIT権限は、MWE組 (MEFISTOから委託) * * * * Modified : 2012/12/27 Y.K. Sweep table CHKSUM * ********************************************************************************/ #include "app_common.h" #include "app_MEF.h" // *** Prototype - Local *** unsigned char app01_MEF ( unsigned int, unsigned char * , int); // unsigned char app01_InitVar_MEF ( void ); //unsigned char app01_ErrClr_MEF ( void ); // ******************************** // *** CMD analyses / execution *** // ******************************** unsigned char app01_MEF ( unsigned int ui_Cntl, unsigned char uc_Data[], int i_Size ) { unsigned char uc_flag = 0; switch (ui_Cntl) { // -------------------------------------------------------- // ----- Admin -------------------------------------------- // -------------------------------------------------------- case 0x0000: if (i_Size!=0) return(0xFF); uc_flag = app01_InitVar_MEF(); // MD*U_MEF_INIT break; //AK110708// /* case 0x0001: if (i_Size!=0) return(0xFF); uc_flag = app01_ErrClr_MEF (); // MD*U_MEF_ERR_CLR break; //AK110708// */ // -------------------------------------------------------- // ----- HV Breaker --------------------------------------- // -------------------------------------------------------- case 0x0800: Guc_MEF_H_Para_NL = uc_Data[0]; Guc_MEF_H_Para_NU = uc_Data[1]; Guc_MEF_H_Para_PL = uc_Data[2]; Guc_MEF_H_Para_PU = uc_Data[3]; Guc_MEF_H_Off_Chk = 0x80; Guc_MEF_H_Off_Res = 0x00; Guc_MEF_Cmd_Cnt++; break; case 0x0801: Guc_MEF_H_Off_Chk = 0x00; Guc_MEF_H_Off_Res = 0x00; Guc_MEF_Cmd_Cnt++; break; // -------------------------------------------------------- // ----- Common: EXT -------------------------------------- // -------------------------------------------------------- case 0x1000: //AK110611// MD2U.MEFI_EXTSTOP_SET (Deploy start) if (i_Size!=4) return(0xFF); //AK120804// Arg. Length chaeck Gus_MEF_D_Timer = (unsigned short)uc_Data[0] * 256 // Arg-1&2: Count-down Timer Set [sec] + (unsigned short)uc_Data[1]; Guc_MEF_D_Off_Chk = uc_Data[2]; // Arg-3: Control Enable/Disable Guc_MEF_D_Off_Chk2 = uc_Data[3]; if (Guc_MEF_D_Off_Chk2 & 0x80) Gi_MEF_D_STEP_H = 0xFFFF; //AK120805// Reference value of step counter (FFFF=To be updated by HK) else Gi_MEF_D_STEP_H = 0x0000; //AK120805// Reference value of step counter (0000=Control by absolute value) if (Guc_MEF_D_Off_Chk2 & 0x40) Gi_MEF_D_LEN1 = 0xFFFF; //AK120805// Reference lenght of S1 (FFFF=To be updated by HK when monitor start) else Gi_MEF_D_LEN1 = 0x0000; //AK120805// Reference lenght of S1 (0000=Control by absolute value) if (Guc_MEF_D_Off_Chk2 & 0x20) Gi_MEF_D_LEN2 = 0xFFFF; //AK120805// Reference lenght of S2 (FFFF=To be updated by HK when monitor start) else Gi_MEF_D_LEN2 = 0x0000; //AK120805// Reference lenght of S2 (0000=Control by absolute value) Guc_MEF_D_Off_Res1 = 0; // Result-1 log reset (1=Automatic drive off was sent by MDP) Guc_MEF_D_Off_Res2 = 0; // Result-2 log reset (1=Drive was on when automatic drive off was sent) Guc_MEF_Cmd_Cnt++; uc_flag = 0; break; case 0x1001: //AK110611// MD2U.MEF_EXTSTOP_PARA (Deploy parameter set) if (i_Size!=7) return(0xFF); //AK120804// Arg. Length chaeck Gi_MEF_D_Para_LA = ((int)uc_Data[0])*256+(int)uc_Data[1]; //AK120804// arg-1&2: Coef. for deployment counter Gi_MEF_D_Para_LB = ((int)uc_Data[2])*256+(int)uc_Data[3]; //AK120804// arg-3&4: Allowed difference between deployment and step counters Gi_MEF_D_Para_LD = (int)uc_Data[4]; //AK120804// arg-5: allowed difference between S1 and S2 deployment counters Guc_MEF_D_Para_TU = uc_Data[5]; //AK120804// arg-6: Upper limit of motor temperature Guc_MEF_D_Para_TL = uc_Data[6]; //AK120804// arg-7: Lower limit of motor temperature Gus_MEF_D_Timer = 0; //AK110611// Guc_MEF_D_Off_Chk = 0; //AK110611// Guc_MEF_D_Off_Res1 = 0; //AK110611// History flag clear Guc_MEF_D_Off_Res2 = 0; //AK110611// Guc_MEF_D_EMG2 = 0; //AK110611// Guc_MEF_Cmd_Cnt++; uc_flag =0; break; // -------------------------------------------------------- // ----- Common: OBS ------------------------------------- // -------------------------------------------------------- case 0x2000: if (i_Size!=0) return(0xFF); // MD*U_MEF_E2PROM G1uc_MEF_E2PROM = 0x01; // MEF: E2PROM op. (128Bx4) -- 1:start 2:Wrt-1 3:Wrt-2 4:Wrt-3 5:Wrt-4 0:none G1uc_MEF_E2PROM_sum = 0x00; // SWEEP-SUM default: uc_flag = 0xFF; break; // *** Error: CMD not found *** } return( uc_flag ); } // **********************************************************************************************************