Dmitry Kovalev
/
LG
n
Fork of LG by
Embed:
(wiki syntax)
Show/hide line numbers
Parameters.c
00001 #include "Global.h" 00002 00003 /****************************************************************************** 00004 ** Function name: LoadFlashParam 00005 ** 00006 ** Descriptions: Load of the parameters from the flash memory 00007 ** 00008 ** parameters: None 00009 ** Returned value: None 00010 ** 00011 ******************************************************************************/ 00012 void LoadFlashParam(unsigned source) 00013 { 00014 if (source == FromFLASH) 00015 { 00016 while (LPC_GPDMACH3->CConfig & (1<<17)); //e. wait while DMA channel3 is busy 00017 00018 if (LPC_GPDMA->RawIntErrStat & INT_ERR_TC) 00019 LPC_GPDMA->IntErrClr |= INT_ERR_TC; //e. an errors found, reset interrupt 00020 00021 else if (LPC_GPDMA->RawIntTCStat & INT_ERR_TC) 00022 { //e. successful loading complete 00023 LPC_GPDMA->IntTCClear |= INT_ERR_TC; 00024 if (Device_blk.Str.Header_Word == HEADER_WORD_CONST) //e. flash contain valid data 00025 return; 00026 } 00027 else 00028 { //e. transfer was not started, start it immediatly 00029 FlashDMA_Init(); 00030 return; 00031 } 00032 init_DefaultParam(); //e. load parameters by default 00033 } 00034 else //e. source == ByDefault 00035 init_DefaultParam(); //e. load parameters by default 00036 00037 blt_in_test = ((uint32_t)FIRMWARE_VER << 8) | (Device_blk.Str.Device_SerialNumber & 0x00FF); 00038 } 00039 /****************************************************************************** 00040 ** Function name: init_DefaultParam 00041 ** 00042 ** Descriptions: Initialization of variables of computing procedures 00043 ** 00044 ** parameters: None 00045 ** Returned value: None 00046 ** 00047 ******************************************************************************/ 00048 void init_DefaultParam(void) 00049 { 00050 int i; 00051 00052 Device_blk.Str.My_Addres = My_Addres_const; //r. 0x00; //e. direct set of the main device address //r. прямое назначение основного адреса у-ва 00053 00054 Device_blk.Str.HF_ref = HF_REF_CONST; //e. set the reference voltage of the HFO //r. установить опорное напряжение ГВЧ 00055 Device_blk.Str.HF_scl = HF_SCL_CONST; //e. set the gain factor of HFO integrator to ~ 0.001 //r. установить к-т передачи интегратора ГВЧ ~ 0.001 00056 Device_blk.Str.HF_scl_2 = Device_blk.Str.HF_scl; 00057 Device_blk.Str.HF_max = HF_MAX_CONST; //e. maximal value of the regulator //r. максимальное значение регулятора 00058 00059 Device_blk.Str.HF_min = HF_MIN_CONST; //e. minimal value //r. минимальное значение 00060 Device_blk.Str.RI_ref= RI_REF_CONST; //e. set the reference voltage of DS to (=) 1,5 V //r. установить опорное напряжение ДУП = 1,5 В 00061 Device_blk.Str.RI_scl= RI_SCL_CONST; //e. set the gain factor of DS integrator to ~ 0.01 //r. установить к-т передачи интегратора ДУП ~ 0.01 00062 00063 Device_blk.Str.WP_ref = WP_REF_CONST; //e. set the reference signal of CPLC to ~ 0,01 of maximal input value //r. установить опорный сигнал СРП ~ 0,01 входного макс. 00064 Device_blk.Str.WP_scl = WP_SCL_CONST; //e. the gain factor of the CPLC regulator ~ 0,001 //r. к-т передачи контура СРП ~ 0,001 00065 Device_blk.Str.WP_rup = WP_RUP_CONST; //e. upper value of the heater current //r. верхнее значение тока нагревателя 00066 Device_blk.Str.WP_rdw = WP_RDW_CONST; //e. lower value of the heater current //r. нижнее значение тока нагревателя 00067 Device_blk.Str.WP_mdy = WP_MDY_CONST; //e. maximal delay of the reset //r. максимальная задержка обнуления 00068 00069 Device_blk.Str.VB_phs = VB_PHS_CONST; //e. the phase delay parameter of the PLL //r. параметр Phase_зад. 00070 Device_blk.Str.VB_scl = VB_SCL_CONST; //e. set the gain factor of the PLL of the dither drive //r. установить коэффициент передачи СРЧ вибропривода 00071 Device_blk.Str.VB_Fdf_Lo = VB_FDF_LO_CONST; //e. set the F_del parameter //r. установить параметр Fзад 00072 Device_blk.Str.VB_Fdf_Hi = VB_FDF_HI_CONST; //e. set the F_del parameter (120000) //r. установить параметр Fзад (120000) 00073 Device_blk.Str.VB_Fsc = VB_FSC_CONST; //e. set the ScaleTau parameter //r. установить параметр ScaleTau 00074 Device_blk.Str.VB_Tmin = VB_TMIN_CONST; //e. set minimal value of the Tau regulator //r. минимальное значение регулятора Tau 00075 Device_blk.Str.VB_Tmax = VB_TMAX_CONST; //e. set maximal value of the Tau reulator //r. максимальное значение регулятора Tau 00076 00077 Device_blk.Str.VB_N = T_VIB_START; //e. ... dither drive //r. вибропривода 00078 Device_blk.Str.VB_Nmin = T_VIB_START - T_VIB_DELTA; //e. minimal value of the N regulator //r. минимальное значение регулятора N 00079 Device_blk.Str.VB_Nmax = T_VIB_START + T_VIB_DELTA; //e. maximal value of the N regulator //r. максимальное значение регулятора N 00080 Device_blk.Str.VB_tau = L_VIB_START; //e. similarly load th pulse width of the dither drive //r. аналогично загрузить длительность импульсов вибропривода 00081 00082 Device_blk.Str.VBN_Tzd = VBN_TZD_CONST; //e. adjusted period of {noise}[??] //r. заданный период ошумления 00083 Device_blk.Str.VBN_Ran = VBN_RAN_CONST; //e. the range of the random component //r. диапазон случайной составляющей 00084 Device_blk.Str.VBN_k = VBN_K_CONST; //e. ajusted of the {noise}[??] constant //r. заданная константа ошумления 00085 00086 Device_blk.Str.PI_a0 = PI_A0_CONST; //e. a0 coefficient of the temperature correction //r. коэффициент a0 температурной коррекции 00087 Device_blk.Str.PI_a1 = PI_A1_CONST; //e. a1 coefficient of the temperature correction //r. коэффициент a1 температурной коррекции 00088 Device_blk.Str.PI_a2 = PI_A2_CONST; //e. a2 coefficient of the temperature correction //r. коэффициент a2 температурной коррекции 00089 Device_blk.Str.PI_a3 = PI_A3_CONST; //e. a3 coefficient of the temperature correction //r. коэффициент a3 температурной коррекции 00090 Device_blk.Str.PI_a4 = PI_A4_CONST; //e. a4 coefficient of the temperature correction //r. коэффициент a4 температурной коррекции 00091 Device_blk.Str.PI_a5 = PI_A5_CONST; //e. a5 coefficient of the temperature correction //r. коэффициент a5 температурной коррекции 00092 Device_blk.Str.PI_a6 = PI_A6_CONST; //e. a6 coefficient of the temperature correction //r. коэффициент a6 температурной коррекции 00093 00094 Device_blk.Str.PI_b1 = PI_B1_CONST; //e. b1 coefficient of the temperature correction //r. коэффициент b1 температурной коррекции 00095 Device_blk.Str.PI_b2 = PI_B2_CONST; //e. b2 coefficient of the temperature correction //r. коэффициент b2 температурной коррекции 00096 Device_blk.Str.PI_b3 = PI_B3_CONST; //e. b3 coefficient of the temperature correction //r. коэффициент b3 температурной коррекции 00097 Device_blk.Str.PI_b4 = PI_B4_CONST; //e. b4 coefficient of the temperature correction //r. коэффициент b4 температурной коррекции 00098 Device_blk.Str.PI_b5 = PI_B5_CONST; //e. b5 coefficient of the temperature correction //r. коэффициент b5 температурной коррекции 00099 Device_blk.Str.PI_b6 = PI_B6_CONST; //e. b6 coefficient of the temperature correction //r. коэффициент b6 температурной коррекции 00100 00101 Device_blk.Str.PI_Fsc = PI_FSC_CONST; //e. the S_ds scale parameter //r. масштабный коэффициент Sдуп 00102 Device_blk.Str.PI_Fb0 = PI_FB0_CONST; //e. the B_ds zero shift of the DS //r. смещение нуля ДУПа Bдуп 00103 Device_blk.Str.PI_scl = PI_SCL_CONST; //e. the Scale scale coefficient of the gyro //r. масштабный коэфф. гироскопа Scale 00104 Device_blk.Str.PI_bia = PI_BIA_CONST; //e. the Bias zero shift of the gyro //r. смещение нуля гироскопа Bias 00105 00106 for (i = 0; i <6 ; i++) 00107 { 00108 Device_blk.Str.Tmp_scal[i] = TMP_SCALE; 00109 Device_blk.Str.Tmp_bias[i] = TMP_BIAS; 00110 } 00111 Device_blk.Str.WP_transition_step = WP_TRANS_STEP; 00112 Device_blk.Str.WP_reset = WP_RESET_CONST; //e. default initial position = 0 //r. исходное положение по умолчанию = 0 00113 Device_blk.Str.WP_reset2 = WP_RESET2_CONST; 00114 Device_blk.Str.Gain_Ph_A = G_PHOTO_STRA; //e. load the initial value of the gain factor of photodetectors channels//r. загрузить начальное значение к-та усиления каналов фотоприемников 00115 Device_blk.Str.Gain_Ph_B = G_PHOTO_STRB; 00116 00117 Device_blk.Str.Device_SerialNumber = DEVICE_SN; //e. serial number of the device is by default written down in the register of self-testing //r. серийный номер прибора по умолчанию записываем в регистр самотестирования 00118 00119 } // init_DefaultParam 00120 /****************************************************************************** 00121 ** Function name: FlashDMA_Init 00122 ** 00123 ** Descriptions: Initialisation of DMA channel for flash reading 00124 ** 00125 ** parameters: None 00126 ** Returned value: None 00127 ** 00128 ******************************************************************************/ 00129 void FlashDMA_Init() 00130 { 00131 LPC_GPDMACH3->CConfig &= ~DMAChannelEn; 00132 00133 LPC_GPDMA->IntTCClear = DMA3_IntTCClear; 00134 LPC_GPDMA->IntErrClr = DMA3_IntTCClear; 00135 00136 /* Ch3 set for M2M transfer from Flash to RAM. */ 00137 LPC_GPDMACH3->CSrcAddr = 0x40000; //e. address of device parameter block in flash memory (22 sec) 00138 LPC_GPDMACH3->CDestAddr = (uint32_t)&(Device_blk.Array);//e. address of device parameter block in RAM 00139 00140 LPC_GPDMACH3->CControl = ((sizeof(Device_blk.Array))>>2)|SrcBSize_1 |DstBSize_1 00141 |SrcWidth_32b |DstWidth_32b |SrcInc |DstInc |TCIntEnabl; 00142 00143 LPC_GPDMACH3->CConfig = MaskTCInt |MaskErrInt|DMA_MEMORY |DMA_MEMORY |(M2M << 11)| DMAChannelEn; 00144 00145 return; 00146 }
Generated on Tue Jul 12 2022 15:16:11 by 1.7.2