📄 dbgprc.c
字号:
/************************************************** * * dbgprc.c * * CVS ID: $Id: dbgprc.c,v 1.39 2007/10/02 14:22:05 dellorto Exp $ * Author: Raffaele Belardi [RB] - STM * Date: $Date: 2007/10/02 14:22:05 $ * Revision: $Revision: 1.39 $ * * Description: * * Serial interface debugging. * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * *************************************************** * * STM CVS Log: * * $Log: dbgprc.c,v $ * Revision 1.39 2007/10/02 14:22:05 dellorto * added compiling conditions related to DSP debugging * * Revision 1.38 2007/08/14 15:28:41 dellorto * multiple mechanisms * * Revision 1.35 2006/12/04 14:51:00 dellorto * no message * * Revision 1.34 2006/10/18 12:41:39 belardi * Removed USE_STM_HOSTIF, changed to APM_PICKUP * * Revision 1.33 2006/09/18 09:55:24 belardi * Corrected CVS keyword usage * * Revision 1.32 2006/09/18 09:25:05 belardi * Added Log CVS keyword into file header * * ***************************************************/#include "gendef.h"#if (DEBUG_INCLUDE_PCDEB == 1)#include "osal.h"#include "msgdef.h"#include "dbgdef.h"#include "dbgext.h"#include "hwreg.h"#include "scidef.h"#include "srvinc.h"#include "controller.h"#include "capture.h"#include "loader.h"#include "player.h"#include "xfile.h"#ifndef APM_PICKUP#include "hostif_high.h"#endif#include "pcdeb.h"uint8 RS232_TxBuffer[MAX_MSG_LEN];uint8 RS232_RxBuffer[MAX_MSG_LEN];uint8 RS232_Status;uint8 RS232_TxIndex;uint8 RS232_RxIndex;static t_servo_cmd_event servo_cmd_event;static SEEK_STRUCT_SID debug_seek_param;static t_loader_cmd_event loader_cmd_event;#if (DEBUG_DSP != 0)static uint16 output_signal;#endif#if (OS20_PROFILING==1)STAT_PROF_t* Get_task_address(int);STAT_PROF_t* Get_int_address(int vector);#endifconst uint32 BaseAddrTbl[] = // [MM] Put in ROM not in RAM!!{ 0x00000000 , // 0 Not Used 0xE8020000 , // 1 Block Decoder 0xE801C000 , // 2 OIF 0xE0020000 , // 3 BSPI 0xE0068000 , // 4 I2C 0xE8014000 , // 5 AFE 0xE8018140 , // 6 ACQUISITION 0xE8008500 , // 7 DSP 0xE800C480 , // 8 Decimatiom 0xE8004000 , // 9 WDT 0xE801046C , // A CLV 0xE8010440 , // B ECC 0xE0058000 , // C GPIOA 0xE0060000 , // D GPIOB 0xE8000000 , // E AAB_BSR 0x0000000F , // F 0xa007f000 , // 10 Debug 0xa007f100 , // 11 Profiling // was 0x0007f100 in MM code, a bug? 0x00000012 , // 12 0x00000013 , // 13 0x00000014 , // 14 0xE0010000 , // 15 DMA 0x00000016 , // 16 0xD8000000 , // 17 Sample Rate Converter 0x00000018 , // 18 0xC0000000 , // 19 Channel Interface 0x0000001A , // 1A 0x0000001B , // 1B 0xAC000000 , // 1C SPDIF Receiver 0x0000001D , // 1D 0x0000001E , // 1E 0x0000001F // 1F};volatile uint32 sid;#ifndef APM_PICKUPuint8 current_micro_command;RETVAL micro_command_result;RETVAL debug_error_reason;t_buffer_mode buffer_mode;#endifvoid oif_init_debug(void){ if (buffer_mode == BUFFER_MODE_CLV) { OIF_SP_CTRL.field.en_shockproof = 0; OIF_AP_CONTROL_PART_2.field.enable_deemphasis = 0; OIF_I2S_SPDIF_REG_2.mux_0_field.word_ratio = 1; if ((((current_ttm_speed & DISC_MODE) == CLV) || ((current_ttm_speed & DISC_MODE) == SCP_CLV)) && ((current_ttm_speed & DISC_SPEED) == CLV_2X)) { OIF_I2S_SPDIF_REG_1.mux_0_field.spdif_ratio = 0x06; OIF_I2S_SPDIF_REG_2.mux_0_field.i2s_ratio = 0x0C; } else { OIF_I2S_SPDIF_REG_1.mux_0_field.spdif_ratio = 0x0C; OIF_I2S_SPDIF_REG_2.mux_0_field.i2s_ratio = 0x18; } }} static void init_servo_for_new_disc_debug(void){ dsp_init(); nlc_init(); afe_init(); rate_init(); acq_init(); ecc_init(); clv_init();}static RETVAL stop_servo_debug(void){ RETVAL stop_servo_debug_result; stop_servo_debug_result = IN_PROGRESS; switch (stop_servo_debug_state) { case STATE_1: stop_activity(); stop_servo_debug_state = STATE_2; /* fall through */ case STATE_2: if (short_jump_braking() == OK) { track_off(); brake_ttm(); stop_sledge(SLEDGE_PRO_ACCELERATION_NORMAL); stop_servo_debug_state = STATE_3; } break; case STATE_3: if (focus_off() == OK) { laser_off(); abcdef_off(); stop_servo_debug_state = STATE_4; } break; case STATE_4: if (sledge_stopped()) { stop_servo_debug_state = STATE_5; } break; //case STATE_5: default: switch (check_ttm_braking()) { case IN_PROGRESS: break; //case STOP_TTM_ERROR: //case OK: default: DRIVER_OFF; stop_servo_debug_result = OK; } break; } return stop_servo_debug_result;}RETVAL start_ttm_debug(void){ RETVAL start_ttm_debug_result; start_ttm_debug_result = IN_PROGRESS; switch (start_ttm_debug_state) { case STATE_1: set_speed(CDV_PREPARED | CDV_1X_IN_DISC); /* prepare the speed used after the kick */ kick_ttm(); start_ttm_debug_state = STATE_2; break; case STATE_2: switch (check_ttm_speed()) { case IN_PROGRESS: break; case OK: servo_startup_flags.field.ttm_started = 1; start_ttm_debug_result = OK; break; } } return start_ttm_debug_result;}static RETVAL stop_ttm_debug(void){ RETVAL stop_ttm_debug_result; stop_ttm_debug_result = IN_PROGRESS; switch (stop_ttm_debug_state) { case STATE_1: brake_ttm(); stop_ttm_debug_state = STATE_2; break; //case STATE_2: default: switch (check_ttm_braking()) { case IN_PROGRESS: break; //case STOP_TTM_ERROR: //case OK: default: stop_ttm_debug_result = OK; } break; } return stop_ttm_debug_result;}void pcintf(void){ volatile uint32 addr; volatile uint32 data;#if (OS20_PROFILING==1) uint32 i; uint32 * tmp_task_prof; uint32 idx;#endif#ifndef APM_PICKUP if ((MC_TE_ADJUST == current_micro_command) || (MC_TRACK_ON == current_micro_command)) { DFCR.field.df_te_mux = 1; } switch (current_micro_command) { case MC_CLV_BUFFER: buffer_mode = BUFFER_MODE_CLV; target_ttm_speed = INIT_SPEED_DEBUG; oif_init_debug(); micro_command_result = OK; break; case MC_ESP_BUFFER: buffer_mode = BUFFER_MODE_ESP; target_ttm_speed = INIT_SPEED; oif_init(); micro_command_result = OK; break; case MC_INIT_ALL: init_servo_for_new_disc_debug(); micro_command_result = OK; break; case MC_STOP_ALL: micro_command_result = stop_servo_debug(); break; case MC_ACT_ON: DRIVER_ON; micro_command_result = OK; break; case MC_ACT_OFF: DRIVER_OFF; micro_command_result = OK; break; case MC_LASER_ON: laser_on(); abcdef_on(); micro_command_result = OK; break; case MC_LASER_OFF: laser_off(); abcdef_off(); micro_command_result = OK; break; case MC_FE_ADJUST: servo_startup_flags.field.fe_adjust_done = 0; micro_command_result = fe_adjust(); if (micro_command_result != IN_PROGRESS) { debug_error_reason = micro_command_result; micro_command_result = IN_PROGRESS; current_micro_command = MC_FOCUS_OFF; } break; case MC_TT_ON: micro_command_result = start_ttm_debug(); break; case MC_TT_OFF: micro_command_result = stop_ttm_debug(); break; case MC_FOCUS_ON: micro_command_result = focus_closing(); if ((micro_command_result != IN_PROGRESS) && (micro_command_result != OK)) { debug_error_reason = micro_command_result; micro_command_result = IN_PROGRESS; current_micro_command = MC_FOCUS_OFF; } break; case MC_FOCUS_OFF: micro_command_result = focus_off(); break; case MC_FOCUS_RAMPING: focus_ramping(); // debug monitoring only micro_command_result = OK; break; case MC_TE_ADJUST: servo_startup_flags.field.te_adjust_done = 0; micro_command_result = te_adjust(); break; case MC_TRACK_ON: micro_command_result = track_closing(); break; case MC_TRACK_OFF: track_off(); micro_command_result = OK; break; case MC_AGC_FOCUS: servo_startup_flags.field.agc_focus_done = 0; micro_command_result = agc(AGC_FOCUS_LOOP); break; case MC_AGC_TRACKING: servo_startup_flags.field.agc_tracking_done = 0; micro_command_result = agc(AGC_TRACKING_LOOP); break; case MC_RELOCK_PLL: micro_command_result = jump_ttm_check(); break; case MC_CLV_1X: set_speed(CLV | CLV_1X); micro_command_result = IN_PROGRESS;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -