📄 capture.c
字号:
/****************************************************************************** * * capture.c * * CVS ID: $Id: capture.c,v 1.130 2007/11/20 13:10:11 marcucci Exp $ * Author: Filippo Brenna [FB] - STM * Date: $Date: 2007/11/20 13:10:11 $ * Revision: $Revision: 1.130 $ * * Description: * * Main entry point for the capture task * ****************************************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * ******************************************************************************* * \brief Channel management procedures (Acquisition / ECC / Audio) * * \par Change History: * * - BB060822b Organized subcode and endplay flags * - DR060912 Re-structured the sector processing request function * during Playback and FS/Playlist access. * - DR060919a Enabled CAP_ESP_WAKEUP_TO_RESTART buffering, fixed playback * (WUT74-18-10232) * - BB060926b Improved error reporting * - BB060929a Improved no TOC and Copyprotected CD support * ****************************************************************************** * * STM CVS Log: * * $Log: capture.c,v $ * Revision 1.130 2007/11/20 13:10:11 marcucci * Fix for FW issue if enabled at the beginning of a CDDA Track * * Revision 1.129 2007/11/13 15:39:13 marcucci * Fix Missing Sector issu on FF/FW * * Revision 1.128 2007/11/09 08:48:32 marcucci * Added modification discovered during Reset Investigation done on 3.1 * * Revision 1.127 2007/09/26 12:00:13 marcucci * Fixed: Issue#122, Bad Time Info, Last Sector Repeat * * Revision 1.126 2007/09/21 11:59:48 belardi * Removed compiler warning * * Revision 1.125 2007/09/19 13:54:22 marcucci * Added a software function to make crc check because BD information is not * reliable * * Revision 1.124 2007/08/01 10:17:14 belardi * Modifications to support run-time configurable ESP size * - made the ESP thresholds variables * * Revision 1.123 2007/04/13 09:52:57 hara * Put same modification for the issue on B_3_1_P3. * - #72 issue and the issue of Repeating playback some seconds. * * Revision 1.122 2007/04/11 14:19:05 belardi * Integration of HAVE_CD_MECHA modification by [GP] * * Revision 1.121 2007/04/06 06:33:10 hara * To handle _EVENT_TEP_HAD_TIME_BEFORE for robust TOC reading. * * Revision 1.120 2007/04/06 05:28:21 hara * Fix two problems to make no target sector even ESP buffer is almost full. * (This situation happen on FF/FB mode with very large scratch CDDA disc.) * Fix one problem to make no target sector due to error sector at track boundary. (SCD-4249) * Put error detection program if the above situation happen. * * Revision 1.119 2007/03/28 08:34:44 hara * Fixed the bug of Capture re-schuduled problem. * Fixed the bug of no BD initialization after stop by error -> play. * Added to protect miss detection of track change by error sector during BD_CTL.field.allow_all_errors = 1. * * Revision 1.118 2007/03/26 02:11:16 hara * Fixed the bug of scratched Mixed mode disc. Reset error counter when data_type is changed. * * Revision 1.117 2007/03/16 07:18:59 hara * Fixed the issue of SCD-4007 FF/FW mode. * Fixed the issue of track skip during scan forward. * Modified for secure subcode mode on CDDA * * Revision 1.116 2007/03/08 12:59:47 belardi * [FH] bug fix for issue 83 (track skip on scratched CDDA during FF) * * Revision 1.115 2007/03/07 17:20:08 belardi * [FH] fix for issue with FF/FBW stopping on defect CDDA * * Revision 1.114 2007/02/22 18:43:11 belardi * Removed compiler warning * * Revision 1.113 2007/02/22 01:41:03 hara * Fixed bug in new CTR - CAP interface : Sending error sector on CD-ROM scratch disc. * SW Stuck problem on SCD-5339 #22 song with FB mode. * * Revision 1.112 2007/02/21 09:15:42 chlapik * new CTR - CAP interface: ESP history removed from CTR * * Revision 1.110 2007/01/25 00:30:33 hara * Fixed bug - Endless try to recover with special error disc. * * Revision 1.109 2007/01/17 11:11:56 chlapik * fixed bug - to avoid underflow don't mark with EOS flag last sector of current chunk but first sector of next chunk - dummy chunk * * Revision 1.108 2007/01/17 08:29:56 hara * Fixed bug - for bad timing of BD sector error after TNO change. * Bug #52 in "SW OpenIssues 122106.xls" * * Revision 1.107 2007/01/16 05:46:24 hara * Fixed bug - no good error counter initialization, Bug for Video CD. * * Revision 1.106 2007/01/15 16:08:59 belardi * Fixes by FH for the following bugs: * * - application abort if play issued after 3/4s of playback * DMA routine gets uninitialized variable and writes to non-existing memory address. * Bug #59 in "SW OpenIssues 122106.xls" * * - skip first 7s of first CDDA track after short rewind * Bug in the ESP optimization routine highlighted by the uncommon use case. * Bug #62 in "SW OpenIssues 122106.xls" * * Revision 1.105 2007/01/09 08:28:57 chlapik * fixed bug - cap_write_q_tno keeps track number in bcd mode, not hex as CTR uses * * Revision 1.104 2007/01/03 09:52:15 chlapik * fixed bug - if fast seek cmd coming while prebuffering of next song for CDDA, modify cap_write_q_tno inside CAP from CTR to current played song * * Revision 1.103 2006/12/06 13:33:57 marcucci * Have Update Fix * * Revision 1.102 2006/12/06 07:35:23 belardi * Fix by [FH] to cope with ABEX test discs containing bad subQ data. Ignores bad subQ after a number of retries. * * Revision 1.101 2006/12/04 09:13:07 chlapik * - reverted back Maurizio's modification of optimalization in cap_process_sector_request() * - added Fumio's fix for scratched CDs (issue with cap_status.count.g_retries) * * Revision 1.100 2006/11/07 13:43:55 belardi * Added 'volatile' to remove compiler warning * * Revision 1.99 2006/10/31 11:13:38 marcucci * No more static functions for Jump Table and if condition restored for ESP Wake Up * * Revision 1.98 2006/10/10 12:02:49 belardi * Merge of m8_cav2_cm80507 * - renamed event * - removed buffering_mode from struct * - TOC robustness * * Revision 1.97 2006/10/09 15:19:27 dellorto * added CaptureTask, moved from osal.c * * Revision 1.96 2006/09/27 19:48:10 belardi * Removed (global) unused variables * * Revision 1.95 2006/09/27 13:06:58 belardi * Re-introduced code commented out by DR for testing * * Revision 1.94 2006/09/19 11:03:57 chlapik * solved misunderstanding of Play_Mode and buffering_mode bits in cmd to CAP - buffering_mode is again present in cmd structure * * Revision 1.93 2006/09/18 13:18:50 chlapik * if ESP memory is empty and there is read request from CTR, instead of sending no event back, send read error * * Revision 1.92 2006/09/15 19:27:00 belardi * Merged the m8_cav2_cm80506_cs3563. * - APM modifications for Playlist processing * * ******************************************************************************/#include "gendef.h"#include "hwreg.h"#include "osal.h"#include "capture.h"#include "utility.h"#include "memutil.h"#include "bkdhdl.h"#include "srvinc.h"#include "debug.h"#ifdef APM_PICKUP #include "service.h"#endif//#define CTR_CAP_CMD_DEBUG//#define SEC_INDEXES_DEBUG#ifndef APM_PICKUP#include "plr_conf.h" //[OK] to know CNF_ESP and CNF_ADPCM, APM haves it in configuration.h#endif//#define ESP_DEBUGGING#ifdef QAC_CHECK#define CAP_PRINTF(x)#else//#define CAP_PRINTF(...) dprintf(__VA_ARGS__)#define CAP_PRINTF(...) do{}while(0)#endif/******************************************************************************//* Capture extern *//******************************************************************************/extern void get_xfer_params(uint32 *count, uint8 **dest);extern void SetUpDMA(uint32 DmaCh, uint32 *Source, uint32 *Dest, uint32 SourceWordSize, uint32 DestWordSize, uint32 WordsNo, uint32 BurstSize, uint32 SourceInc, uint32 DestInc, uint32 Per, uint32 Mem2Mem);/******************************************************************************//* Capture global vars *//******************************************************************************/uint8 new_cap_config;t_cap_config cap_config;int16 cap_esp_margin;#if (1 == HAVE_SHOCK_MEMORY)uint8 *cap_input_buffer_SDRAM;uint16 CAP_CHIN_SECTOR_SIZE;uint16 CAP_INPUT_BUFFER_SIZE_SDRAM;#else#pragma arm section zidata = "Cap_input_buffer_map"uint8 cap_input_buffer_SDRAM[1]; // Dummy section for scatter configuration.#pragma arm section zidata#pragma arm section zidata = "Cap_internal_input_buffer_map"__align(4) uint8 cap_input_buffer_IntRAM[CAP_INPUT_BUFFER_SIZE_INTRAM *CAP_CHIN_SECTOR_SIZE];#pragma arm section zidata#endifuint16 CAP_ESP_ON_OVERFLOW_THRS;uint16 CAP_ESP_ON_UNDERFLOW_THRS;/******************************************************************************//* Capture data events *//******************************************************************************/t_cap_cmd_event capture_cmd_event_data[EVENT_MAX_STAGES];t_cap_read_event capture_read_event_data[EVENT_MAX_STAGES];tQsubcode_event capture_subcode_event[EVENT_MAX_STAGES];tCaptEndPlay_event capture_pre_endplay_event[EVENT_MAX_STAGES];t_bd_event capture_bd_event_data[EVENT_MAX_STAGES];/******************************************************************************//* DEBUG Capture stuff *//******************************************************************************/uint8 cap_debug_to_hostif;#if (1 == CAP_DEBUG)uint32 cap_debug_overflow;uint32 cap_debug_underflow;#endif#ifdef ESP_DEBUGGINGstatic uint16 cap_esp_margin_old;static void DEBUG_ESP_MARGIN(void){ if ((absi(cap_esp_margin_old - cap_esp_margin)) > 0x10) { cap_esp_margin_old = cap_esp_margin; DEBUG_printf(("ESP margin:", 2, 1, cap_esp_margin)); }}#else#define DEBUG_ESP_MARGIN(s) do{}while(0)#endif/******************************************************************************//* Capture local vars *//******************************************************************************//* local copy of capture command event */static t_cap_cmd_event local_cap_cmd_event;/* local copy of capture read event */ //to be removedstatic t_cap_read_event local_cap_read_event;/* local copy of bd status */static t_bd_event local_bd_event;static t_cap_status cap_status;static t_cap_esp_buf cap_esp_buf;static t_duid cap_device_id;static RETVAL cap_result; /* BB060926b */static uint16 cap_sector_offset;static uint16 cap_sector_size;static uint8 cap_read_q_amin;static uint8 cap_read_q_asec;static uint8 cap_read_q_rmin;static uint8 cap_read_q_rsec;static uint8 cap_read_q_tno;static uint8 cap_write_q_amin;static uint8 cap_write_q_asec;static uint8 cap_write_q_rmin;static uint8 cap_write_q_rsec;static uint8 cap_write_q_tno;static uint8 cap_tno_ignore_chg;//DEBUG ONLY#ifdef SEC_INDEXES_DEBUGuint32 zero_sectors;typedef struct{ uint32 index; uint32 track_number; uint32 frame;} debug_struct;debug_struct debug_array[100];#endif#if (HAVE_CD_MECHA == 1)static SEEK_STRUCT_SID cap_seek_param;static t_servo_cmd_event servo_cmd_event;/* device utility pointers */RETVAL (* cap_start_device_xfer) (void);RETVAL (* cap_start_device_pause) (void);RETVAL (* cap_forward_device_command_event) (void);void (* cap_process_device_command_event) (void);void (* cap_process_device_status_event) (void); #else# define cap_start_device_pause() READY# define cap_start_device_xfer() READY# define cap_forward_device_command_event() READY# define cap_process_device_command_event() do{} while(0)# define cap_process_device_status_event() do{} while(0)#endif // HAVE_CD_MECHAvoid cap_esp_set_dummy_address(uint16 local_xfer_pointer, uint32 valid_sid);uint32 cap_esp_get_valid_address(uint16 local_xfer_pointer, uint8 data_type);uint8 CrcCheck(uint8* subQ_ptr);/******************************************************************************//* capture configuration *//******************************************************************************//******************************************************************************//* Function: cap_update_config *//* *//*! \brief configuration update * \param * \return * \remark *//******************************************************************************/#if 0 // [RB] commented out to reduce ROM spacevoid cap_update_config(void){ new_cap_config = 1;
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -