?? mainfile.c
字號:
/************************************************************************
* C-EMERALD code for ACCORDO ( 15 - 05 - 2003 )
* Ver: ver0.2
*
* File: Mainfile.c (main)
*
* Author: A. Di Carlo
************************************************************************/
#include "emerald.h"
#include "dspadd.h"
#include "map.h"
#include "accordo.h"
#define CONST const
#define NLC_LOG2_MAXGAIN 3 /* Maximum nonlinear gain is 2^NLC_LOG2_MAXGAIN. */
/* Reserved memory locations */
/* --------------------------*/
memoryY CONST reserved[2]; /* Locations 0x0A and 0x0B of YMEM should not be used, alway 0 is read back. */
/* Parameter variables accessed by both the ARM and the DSP */
/* -------------------------------------------------------- */
#define MAX_DIM_COEFF_FOCUS 16
memoryY coeff_focus[MAX_DIM_COEFF_FOCUS]; /* Coefficients for the focus PID in focus(): 0..10, Not used: 11..15 */
#define MAX_DIM_COEFF_TRACKING 16
memoryY coeff_tracking[MAX_DIM_COEFF_TRACKING]; /* Coefficients for the tracking PID in track(): 0...10, Nonlinear control: 11..15 */
#define MAX_DIM_COEFF_ERROR 11
memoryY CONST coeff_error[MAX_DIM_COEFF_ERROR]; /* Coefficients used for the generation of the error signals in err_gen() */
#define MAX_DIM_COEFF_SLEDGE 3
memoryY CONST coeff_sledge[MAX_DIM_COEFF_SLEDGE]; /* Coefficients for controlling the sledge in track() */
#define MAX_DIM_COEFF_CLV 10
memoryY CONST coeff_clv[MAX_DIM_COEFF_CLV]; /* Coefficients of the TTM controller in misc() */
#define MAX_DIM_COEFF_MISC 12
memoryY CONST coeff_misc[MAX_DIM_COEFF_MISC]; /* Coefficients used in misc() other than the TTM controller */
memoryX fcs_off; /* Focus offset */
memoryX fok_thr; /* Focus ok threshold */
memoryX fok_tdn; /* Focus ok -- TO DO: describe */
memoryX fok_tup; /* Focus ok -- TO DO: describe */
memoryX trk_off; /* Tracking offset */
memoryX te_thr; /* Tracking ok threshold */
integer adjust_flags; /* Flags used for min/max measurement in adjust(), ARM sets ADJ_FLG_RESET bit to reset and start new min/max measurement, ADJ_FLG_NOSTAT bit cleared by DSP after first valid measurement. */
memoryX temin; /* Min value of TE, determined in min/max measurement of adjust() */
memoryX temax; /* Max value of TE, determined in min/max measurement of adjust() */
memoryX femin; /* Min value of FE, determined in min/max measurement of adjust() */
memoryX femax; /* Max value of FE, determined in min/max measurement of adjust() */
integer ramp_mode; /* Ramp mode flags, containing switch (on = 1 / off = 0), direction (up = 2 / down = 0), counting (single = 4 / continuous = 0) */
integer ramp_step; /* Ramp step, determines the speed/slope of the ramp */
integer ramp_max; /* Ramp max value */
integer ramp_min; /* Ramp min value */
memoryX fe_cmp; /* Value of FE around which the focus close condition is generated */
memoryX hyst; /* Hysteresis for focus close condition */
memoryX vib_gain; /* Injection gain for the AGC */
integer gainadj; /* Specifiy AGC: 0x0000/0x0001/0x0003 = No AGC/Focus AGC/Radial AGC */ /* TO DO: Use common defines or both ARM and DSP. */
memoryX tawin; /* A sledge microstep is made when DC value radial PID output is outside -tawin..tawin window. */
integer sledtime; /* Check for above mircostep performed every sledtime*16/fs seconds */
integer disc_mode; /* Set TTM controller mode: KICK/CLV/CAV/HOLD = 0x80/0x81/0x82/0x83 */
memoryX spindle_kick; /* TTM output when TTM controller in kick mode */
integer target_p1T; /* Setpoint PLL-freq/FG-period of the TTM controller in CLV/CAV mode. TO DO: add formulas */
integer clv_ds; /* Additional decimation factor for the TTM controller */
memoryX sledpulse_fwd_amp; /* Sledge pulse amplitude for forward direction */
memoryX sledpulse_bwd_amp; /* Sledge pulse amplitude for backward direction */
memoryX sledpulse_fwd_time; /* Sledge pulse duration for forward direction */
memoryX sledpulse_bwd_time; /* Sledge pulse duration for backward direction */
integer jump_mode; /* Disable/enable jump mode -> 0x0000/0x0001 */
integer jmp_dir; /* Jump forward/backward -> 0x0000/0x0001 */
integer def_ena; /* Disable/enable defect detector -> 0x0000/0x0001 */
integer wd_cnt_max; /* Maximum length of a white dot defect in number of full sampling rate sampling periods. */
integer int_mode; /* Operations mode, discerns between tracking and adjust mode */
memoryX cav_period_err_max; /* Maximum limit on error in TTM FG period, determines ttm_speed_ok signal in CAV mode */
memoryX clv_freq_err_max; /* Maximum limit on PLL frequency error, determines ttm_speed_ok signal in CLV mode */
memoryX clv_phase_err_max; /* Maximum limit on error in CLV fullness, determines ttm_speed_ok signal in CLV mode */
memoryX spdl_limit_min; /* Positive maximum limit of TTM controller output */ /* MR20050523c */
memoryX spdl_limit_max; /* Negative maximum limit of TTM controller output */ /* MR20050523c */
integer ttm_recov_ic; /* Initial value of the TTM controller I-action, I-action set to this value after detecting HF FG pulses from TTM driver IC */ /* MR20050523b */
memoryX nlc_alpha; /* Gain (slope) of deadzone */
memoryX nlc_delta; /* Threshold of deadzone */
integer agc_minmax_nr_cycles; /* Number of min/max cycles (i.e. disc revolutions) in row during which the AGC is performed */
integer agc_minmax_threshold; /* Number of fs/4 samples after which the last found min/max in the stima signal is declared to a real minimum/maximum. */
integer proc_enable; /* Enables (0x0001) processing of all control loops, if disabled (0x0000) then only dpsio16() is executed */
integer def_tup; /* The time DEFACQ must be active before hfok is reset to 0x0000, i.e. hf not okay */
integer def_tdn; /* The time DEFACQ must be deactivated before hfok is set to 0x0001, i.e. hf okay */
memoryX bw_switch; /* Controls loopgain of both radial and focus controller, used to switch bandwidth for different TTM speeds. */
memoryX clv_buffer_ok_thres; /* Threshold for the evaluation of the CLV buffer condition */
/* State of the DSP accessed by both the ARM and DSP */
/* ------------------------------------------------- */
int dsp_state; /* Current state of the DSP, changes are reported to the ARM via mailbox. */
/* Local variables and signals, accessed by the DSP only */
/* ------------------------------------------------------*/
#define MAX_DIM_DELAY_FOCUS 7
memoryX delay_focus[MAX_DIM_DELAY_FOCUS];
#define MAX_DIM_DELAY_TRACKING 14
memoryX delay_tracking[MAX_DIM_DELAY_TRACKING];
#define MAX_DIM_DELAY_ERROR 2
memoryX delay_error[MAX_DIM_DELAY_ERROR];
#define MAX_DIM_DELAY_MISC 8
memoryX delay_misc[MAX_DIM_DELAY_MISC];
#define MAX_DIM_DELAY_CLV 8
memoryX delay_clv[MAX_DIM_DELAY_CLV];
/* These variables are located in the same order as listed here and */
/* are in some parts of the code treated as an array. */
memoryY fe; /* Focus error */
memoryY fa; /* Focus actuator signal after AGC injection and offset addition, output on FACT */
memoryY fa2; /* Focus actuator signal before AGC injection, but after offset addition */
memoryY te; /* Tracking error */
memoryY ta; /* Tracking actuator signal after AGC injection and offset addition, output on TACT */
memoryY ta2; /* Tracking actuator signal before AGC injection, but after offset addition */
memoryY hfl; /* Sum of AC and BD signals from OPU. */
/* These variables are located in the same order as listed here and */
/* are in some parts of the code treated as an array. */
memoryY fedec; /* Downsampled version of fe, see above */
memoryY fadec; /* Downsampled version of fa, see above */
memoryY fa2dec; /* Downsampled version of fa2, see above */
memoryY tedec; /* Downsampled version of te, see above */
memoryY tadec; /* Downsampled version of ta, see above */
memoryY ta2dec; /* Downsampled version of ta2, see above */
memoryY hfldec; /* Downsampled version of hf, see above */
memoryY hfdc;
/* These variables are located in the same order as listed here and */
/* are in some parts of the code treated as an array. */
memoryX fedec_var; /* Temporary value used to computer fedec, see above */
memoryX fadec_var; /* Temporary value used to computer fadec, see above */
memoryX fa2dec_var; /* Temporary value used to computer fa2dec, see above */
memoryX tedec_var; /* Temporary value used to computer tedec, see above */
memoryX tadec_var; /* Temporary value used to computer tadec, see above */
memoryX ta2dec_var; /* Temporary value used to computer ta2dec, see above */
memoryX hfldec_var; /* Temporary value used to computer hfldec, see above */
#if (1 == ALTERNATIVE_TEOK)
memoryX ntracks; /* Value of NRTRACKS register in RATE block during previous (fs/4) sample period. */
#else
memoryX telpf; /* Low pass filtered version of te */
#endif
memoryX hflpf; /* Low pass filtered version of hf */
memoryX tajump; /* Decimated values of the radial PID controller output (before adding offset and AGC oscillator) */
memoryY ta_filt; /* Filtered version of tajump */
memoryX oscout; /* Output of AGC oscillator */
memoryX osc; /* Output of AGC oscillator (osc) time vib_gain */
memoryX fosc; /* AGC oscillator signal for the focus loop */
memoryX tosc; /* AGC oscillator signal for the radial loop */
memoryY amp1; /* Amplitude of injected AGC oscillator signal before injection point */
memoryY amp2; /* Amplitude of injected AGC oscillator signal after injection point */
memoryY stima; /* Estimated quotient amp1 and amp2 */
integer close; /* Close flag */
integer fcrint; /* Internal flag for focus close */
integer count16; /* Counter modulo 16 */
integer sledcnt; /* Timer, when it expires (i.e. equals sledtime) a sledge step is made when necessary */
integer sledpulse_cnt; /* Counter for sledge pulse implementation */
integer disc_mode_int; /* Internal TTM controller mode: KICK/CLV/CAV/HOLD = 0x00/0x01/0x02/0x03 */
integer sw_time; /* TTM controller decimation timer, TTM controller is executed only every clv_ds fs/16 sample periods */
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -