//2013.10.24 /******************************************************************************* * モジュール名称 :APP01 - CMD from DMC to DPU (for 'MIA' task) * * 作成日・作成者 :2011/10/08 Y.K. * * * * 参照 : app01_DPU.c を参照のこと * * 注意 : EDIT権限は、MPPE/MIA組 * ********************************************************************************/ #include "app_common.h" #include "app_MPPE-MIA.h" //########## デバッグ用 ########## #ifdef _RUN_ON_WINDOWS_ #include "app_MPPE-MEA.h" #include "app_MPPE-MSA.h" struct _s_MIA_ProcParam Gst_MIA_proc; struct _s_MIA_CtrlParam Gst_MIA_ctrl; struct _s_MIA_Product Gst_MIA_dat; struct _s_MIA_Command Gst_MIA_cmd; unsigned short Gus_MPPE_rice[0x1000]; //unsigned short Gus_MPPE_Ldata[0x1000]; unsigned short Gus_MPPE_Ldata[0xee0]; struct _s_MEA_CtrlParam Gst_MEA1_ctrl; struct _s_MEA_CtrlParam Gst_MEA2_ctrl; struct _s_MEA_ProcParam Gst_MEA1_proc; struct _s_MEA_ProcParam Gst_MEA2_proc; struct _s_MEA_Product Gst_MEA_dat; struct _s_MEA_Command Gst_MEA1_cmd; struct _s_MEA_Command Gst_MEA2_cmd; struct _s_MSA_CtrlParam Gst_MSA_ctrl; struct _s_MSA_Command Gst_MSA_cmd; struct _s_MSA_Product Gst_MSA_dat; #endif //########## デバッグ用 ########## // *** Prototype - MIA *** unsigned char app01_MIA ( unsigned int, unsigned char * , int); // //unsigned char app01_InitVar_MIA ( void ); //unsigned char app01_ErrClr_MIA ( void ); unsigned char app01_InitVar2_MIA ( void ); // ************************************** // *** MIA: CMD analyses / execution *** // ************************************** unsigned char app01_MIA ( unsigned int ui_Cntl, unsigned char uc_Data[], int i_Size ) { unsigned char uc_flag; struct _s_MIA_Command *pCmd; //コマンド struct _s_MIA_CtrlParam *pCtrl; //制御用のフラグ及びパラメータ pCtrl = &Gst_MIA_ctrl; pCmd = &Gst_MIA_cmd; uc_flag = 0; pCmd->uc_cnt++; pCmd->uc_ans[0] = ui_Cntl >> 8 & 0xff; pCmd->uc_ans[1] = ui_Cntl & 0xff; pCmd->uc_ans[2] = 0xec; pCmd->uc_ans[3] = 0xec; if (i_Size > 0) pCmd->uc_ans[2] = uc_Data[0]; if (i_Size > 1) pCmd->uc_ans[3] = uc_Data[1]; //データ処理モードのセット //SIZEの確認は一切行わない if (ui_Cntl == 0x0010) pCtrl->uc_snap_ave = TRUE; //MIA_PROC_SNAPSHOT else if (ui_Cntl == 0x0011) pCtrl->uc_snap_ave = FALSE; //MIA_PROC_AVERAGE else if (ui_Cntl == 0x0012) { pCtrl->uc_eng_sci = (uc_Data[0])? 1:0; //MIA_DATA_MODE pCtrl->uc_mode = uc_Data[1] & 0x0f; } else if (ui_Cntl == 0x0013) pCtrl->uc_HKmon_ena = uc_Data[1]; //MIA_SET_HK_MON else if (ui_Cntl == 0x0014) { pCtrl->uc_MHV_lmt[0] = uc_Data[0]; //MIA_SET_MHV_LIM pCtrl->uc_MHV_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x0015) { pCtrl->uc_SVS_lmt[0] = uc_Data[0]; //MIA_SET_SVS_LIM pCtrl->uc_SVS_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x0016) { pCtrl->uc_SVG_lmt[0] = uc_Data[0]; //MIA_SET_SVG_LIM pCtrl->uc_SVG_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x0017) { pCtrl->uc_MCPI_lmt[0] = uc_Data[0]; //MIA_SET_MCPI_LIM pCtrl->uc_MCPI_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x0018) { pCtrl->uc_ASCT_lmt[0] = uc_Data[0]; //MIA_SET_ASICT_LIM pCtrl->uc_ASCT_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x0019) { pCtrl->uc_IFT_lmt[0] = uc_Data[0]; //MIA_SET_IFT_LIM pCtrl->uc_IFT_lmt[1] = uc_Data[1]; } else if (ui_Cntl == 0x001a) memcpy(&pCtrl->ui_eng_vmf, uc_Data, 4); //MIA_PROC_ERNG else if (ui_Cntl == 0x0020) uc_flag = app01_InitVar2_MIA(); //MIA_SWINIT 初期化 else if (ui_Cntl == 0x0021) { pCmd->uc_err_cnt = 0; //MIA_ERR_CLR pCtrl->uc_HK_anmly = 0; } else if (ui_Cntl == 0x0022) pCtrl->uc_readrom = TRUE; //MIA_ROM_READ else if (ui_Cntl == 0x0002) { //MIA_CNT1_SET if (uc_Data[1] == 0x01) { pCtrl->uc_swcal_prm[0] = (uc_Data[2])? 1:0; //SW CAL pCtrl->uc_swcal_prm[1] = uc_Data[3]; //En pCtrl->uc_swcal_prm[2] = uc_Data[4]; //CH pCtrl->uc_swcal_prm[3] = uc_Data[5]; //SC pCtrl->uc_swcal_prm[4] = uc_Data[6]; } //Count //else if (uc_Data[1] == 0x02) pCtrl->uc_watchman = (uc_Data[3])? 1:0; //SWITCH TI tag else if (uc_Data[1] == 0x04) { pCtrl->uc_vet_cmp_ena = (uc_Data[3])? 1:0; //COMPRESSION Guc_TLMm_cmp[Gd_N_MIA] = (uc_Data[3])? 0:3; Guc_TLMh_cmp[Gd_N_MIA] = (uc_Data[3])? 0:3; } else if (uc_Data[1] == 0x06) uc_flag = app_PiCmd(Gd_N_MIA, &uc_Data[2], 4); //SEND MIA CMD via MDP else uc_flag = 0xFF; } else uc_flag = 0xFF; // *** Error: CMD not found *** if (uc_flag) pCmd->uc_err_cnt++; //エラーカウンタ return( uc_flag ); } unsigned char app01_InitVar2_MIA() { int i; struct _s_MIA_CtrlParam *pCtrl; //制御用のフラグ及びパラメータ struct _s_MIA_Product *pDat; //プロダクト struct _s_MIA_ProcParam *pP; struct _s_MIA_Command *pCmd; //コマンド pCtrl = &Gst_MIA_ctrl; pDat = &Gst_MIA_dat; pP = &Gst_MIA_proc; pCmd = &Gst_MIA_cmd; //制御用のフラグ及びパラメータ、コマンドによる変更がある pCtrl->uc_snap_ave = 1; //1:Snapshot, 0:Average pCtrl->uc_eng_sci = 0; //1:Eng, 0:Sci pCtrl->uc_mode = 0; //1:Eng(0-4), 0:Sci(0-8) pCtrl->uc_HKmon_ena = 0x00; //1:ENA, 0:DIS (from Higher bit, MHV, SVS, SVG, MCPI, ASCT, IF-T, ASIC_SEL) pCtrl->uc_HK_anmly = 0; pCtrl->uc_HK_delay = 0; pCtrl->ui_eng_vmf = 0xffffffff; //pCtrl->uc_activate = FALSE; pCtrl->uc_readrom = FALSE; //初期化で自動的にE2PROMを読まない pCtrl->uc_got_e2p_prm = FALSE; //E2PROMから読むとこのフラグが立つ //SWcal pCtrl->uc_swcal_prm[0] = FALSE; //本来はFALSE pCtrl->uc_swcal_prm[1] = 0xff; //EnStep 0xff = All pCtrl->uc_swcal_prm[2] = 0xff; //CH pCtrl->uc_swcal_prm[3] = 0xff; //Sector pCtrl->uc_swcal_prm[4] = 1; //Count 00=>k(en step) //圧縮 pCtrl->uc_vet_cmp_ena = FALSE; //FALSE(する) Guc_TLMm_cmp[Gd_N_MIA] = 3; //3 Guc_TLMh_cmp[Gd_N_MIA] = 3; //3 //pCtrl->uc_watchman = 0; pDat->us_SPIN_N = 0xffff; //スピンカウンタ pDat->uc_ASIC_idx = 0; pDat->us_Llen_ttl = 0; //Lproductデータ長、複数スピンでTLMにするため //for (i = 0; i < 10; ++i) pDat->f_VMsw[i] = 0.; //E2PROMからのパラメータもここで値は入れておく //後にE2PROMのデータで上書きする pCtrl->uc_MHV_lmt[0] = 0; pCtrl->uc_MHV_lmt[1] = 0xff; pCtrl->uc_SVS_lmt[0] = 0; pCtrl->uc_SVS_lmt[1] = 0xff; pCtrl->uc_SVG_lmt[0] = 0; pCtrl->uc_SVG_lmt[1] = 0xff; pCtrl->uc_MCPI_lmt[0] = 0; pCtrl->uc_MCPI_lmt[1] = 0xff; pCtrl->uc_ASCT_lmt[0] = 0; pCtrl->uc_ASCT_lmt[1] = 0xff; pCtrl->uc_IFT_lmt[0] = 0; pCtrl->uc_IFT_lmt[1] = 0xff; //コマンドの登録、要確認 pCmd->uc_cnt = 0; pCmd->uc_err_cnt = 0; for (i = 0; i < 4; ++i) pCmd->uc_ans[i] = 0; //残りのパラメータ初期化はAPP02にて行う。 pCtrl->uc_settbl_n = 1; return(0); } // **********************************************************************************************************