⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 mainfile.c

📁 本程序为ST公司开发的源代码
💻 C
📖 第 1 页 / 共 2 页
字号:
memoryY       clv_freq_err;         /* Difference between target and measured PLL frequency in the TTM controller.*/
memoryY       clv_phase_err;        /* Difference between the actual fullness of the CLV buffer and the target value, which is a halffull CLV buffer. */
memoryY       ratefreq;             /* TO DO: Not used but if corresponding is removed the white scratch performance magically deteriorates. */
integer       counter_down;         /* Counter used in generation of fok */
integer       counter_up;           /* Counter used in generation of fok */
integer       counter_def_up;       /* Counter used in generation of hfok */
integer       counter_def_down;     /* Counter used in generation of hfok */
memoryY       agc_minmax_state;     /* Internal state of the AGC: 0x7fff/0x8000 = searching for maximum/minimum is the estimated loopgain 'stima' */
integer       agc_minmax_cnt;       /* Measures the time since the detection of the last minimum/maximum in the esimated loopgain 'stima' */
memoryX       agc_minmax_extreme;   /* The last minimum/maximum value found in 'stima' */
integer       bd_defect;            /* Active 0x0001 when a black dot defect has been detected, otherwise 0x0000 */
integer       wd_defect;            /* Active 0x0001 when a white dot defect has been detected, otherwise 0x0000 */
integer       wd_cnt;               /* Measures the length of a white dot defect, after the defect the generation of the black dot defect signal is masked for the same amount of time */
integer       bd_cnt;               /* Measures the length of a black dot defect, after the defect the generation of the white dot defect signal is masked for the same amount of time */
integer       wd_defect_m;          /* Masked version of wd_defect, masks the detection of a white dot defect and the end of a black dot defect */
integer       bd_defect_m;          /* Masked version of bd_defect, masks the detection of a black dot defect and the end of a white dot defect */
integer       fcs_defect;           /* Combination of defect signals on which the focus controller must react */
integer       trk_defect;           /* Combination of defect signals on which the radial tracking controller must react */
memoryY       te_pid_in;            /* Input of the radial tracking PID controller. */
memoryX       flags;                /* Flags used in ARM/DSP communication for accessing X and Y RAM */
integer       fok;                  /* Flag for focus OK (okay/not okay = 0x0001/0x0000 */
memoryY       ac_in;
memoryY       bd_in;
memoryY       e_in;
memoryY       f_in;
memoryY       hf_deb;

integer       dsp_state_last_sent;    /* Last sent state of the DSP, used to detect changes in state. */
integer       dsp_state_change_mask;  /* Mask containing changes between current and last sent state of the DSP. */
integer       dsp_event_code;         /* Code for the management of DSP event acknowledge */

/* Extra signal, used for debuging only */
/* -------------------------------------*/
#if (1 == DEBUG_DSP || 2 == DEBUG_DSP)
  integer       pdm_out1;             /* Test output for observing signals */
  integer       pdm_out2;             /* Test output for observing signals */
#endif

#if (2 == DEBUG_DSP)
  memoryY       pdm_out1c;            /* Test output control for observing signals */
  memoryY       pdm_out2c;            /* Test output control for observing signals */
  integer       gpio_out;             /* Bit test output */
  memoryY       gpio_outc;            /* Test output control for observing signals */
  memoryY       gpio_mask;            /* Bit test output mask */
#endif

#include "int_proc.h"   /* Includes interrupt procedures */


void _INTERRUPT i_function_1()
{
  /* External interrupt */
}

void _INTERRUPT i_function_2()
{
  /* Decimation interrupt 1 */
  interrupt_decimation2_handle();
}

void _INTERRUPT i_function_3()
{
  /* RATE interrupt */
}

void _INTERRUPT i_function_4()
{
  /* Mailbox interrupt */
}

void _INTERRUPT i_function_5()
{
  /* CAV interrupt (FG pulse from TTM) */
}

void _INTERRUPT i_function_6()
{
  /* SLEDGE interrupt  */
}

void _INTERRUPT i_function_7()
{
  /* Timer interrupt */
}




MACRO init()
{

#if (1 == OPTIMIZED_INIT)
  memoryX *xptr;
  memoryY *yptr;

  /* Reset the contents of the X memory to zero. */
  xptr = (memoryX *)XMEM_START_ADD;
  loop(XMEM_END_ADD - XMEM_START_ADD + 1) *xptr++ = 0;

  /* Reset the contents of the Y memory to zero. */
  yptr = (memoryY *)YMEM_START_ADD;
  loop(YMEM_END_ADD - YMEM_START_ADD + 1) *yptr++ = 0;
#else
  int_mode = 0;
  fok = 0;
  gainadj = 0;
  jump_mode = 0;
  bd_cnt = 0;
  wd_cnt = 0;
#endif

#if (1 == DSP_PROC_ENABLE)
  /* Do nothing, initialization of framp_min/framp_max done by ARM. */
#else
  framp_max = 0x2000;
  framp_min = 0xf000;
#endif

  ramp_mode = 0;

  dsp_event_code = 0;
  dsp_state = 0x0338;
  dsp_state_last_sent = 0x00CC;
  dsp_state_change_mask = 0;

  def_ena = 1;         /* Defect detection on.  */
  wd_cnt_max = 70;     /* Set the maximum duration of a white dot defect (duration: wd_cnt_max*Ts) */

  sledpulse_cnt = 0;
  init_focus();
  init_adjust();
  init_track();
  init_misc();

#if (1 == DEBUG_DSP)
  pdm_out1 = FE_ADD;      /* Focus error fe */
  pdm_out2 = TE_ADD;      /* Tracking error te */
#endif

}
#endm




void main(void)
{

  sr_irq(0x00, 0xFF);    /* Disable all interrupts. */

  GPIO_CTRL = 0x00;

  /* Initialize parameters in X and Y memory. */
  init();

  /* Enable interrupts and automatic satutation upon storing results in X and Y memory. */
  sr_mode(INTERRUPT_EN | SATURATION, 0);
  /* Enable only decimation interrupt 1 */
  sr_irq(0x04, 0x00);

  /* Wait forever, processing done in decimation interrupt. */
  while (1);
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -