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

📄 capture.c

📁 本程序为ST公司开发的源代码
💻 C
📖 第 1 页 / 共 5 页
字号:
}#endif/******************************************************************************//* Function:  cap_esp_buf_init                                                *//*                                                                            *//*! \brief    init buffer *  \param *  \return *  \remark *//******************************************************************************/void cap_esp_buf_init(void){#if 0  cap_esp_buf.curr.lba = 0;  cap_esp_buf.curr.pos = 0;  cap_esp_buf.curr.first_byte = 0;#endif  cap_esp_buf.first.lba = 0;  cap_esp_buf.first.pos = 0;  cap_esp_buf.last.lba = 0;  cap_esp_buf.last.pos = 0;  cap_status.write.xfer_pointer = 0;  cap_status.write.last_good_lba = 150;  cap_status.write.last_good_ptr = 0;  cap_status.write.xfer_sector_end = 0;  cap_status.write.xfer_condition = 0;  cap_status.write.xfer_chunk_level = 0;  cap_status.read.xfer_pointer = 0;  cap_status.read.xfer_condition = 0;  cap_status.read.xfer_chunk_level = 0;  cap_status.read.data_type = local_cap_cmd_event.command_params.xfer_params.data_type;    cap_status.count.g_good_sectors = 0;  cap_status.count.chk_lba = 0; /* To count invalid sector on CDDA [FH] 25/Sep/2007 */  cap_esp_margin = 0;}/******************************************************************************//* Function:  cap_config_esp_params_on                                        *//*                                                                            *//*! \brief    ESP ON configuration *  \param *  \return *  \remark *//******************************************************************************/void cap_config_esp_params_on(void){#if (1 == HAVE_SHOCK_MEMORY)  cap_config.esp_params.input_buffer = cap_input_buffer_SDRAM;  cap_config.esp_params.input_buffer_size = CAP_INPUT_BUFFER_SIZE_SDRAM;  cap_config.esp_params.warning_overflow_thrs = CAP_ESP_ON_OVERFLOW_THRS;  cap_config.esp_params.warning_underflow_thrs = CAP_ESP_ON_UNDERFLOW_THRS;  if (ADPCM_ON == cap_config.adpcm)  {    cap_config.esp_params.input_buffer_size = CAP_INPUT_BUFFER_SIZE << 2;    cap_config.esp_params.input_sector_size = CAP_CHIN_SECTOR_SIZE >> 2;    cap_config.esp_params.warning_overflow_thrs = cap_config.esp_params.warning_overflow_thrs << 2;    cap_config.esp_params.warning_underflow_thrs = cap_config.esp_params.warning_underflow_thrs                                                << 2;  }  else  {    cap_config.esp_params.input_sector_size = CAP_CHIN_SECTOR_SIZE;  }#endif}/******************************************************************************//* Function:  cap_config_esp_params_off                                       *//*                                                                            *//*! \brief    ESP OFF configuration *  \param *  \return *  \remark *//******************************************************************************/void cap_config_esp_params_off(void){#if (0 == HAVE_SHOCK_MEMORY)  cap_config.esp_params.input_buffer = cap_input_buffer_IntRAM; // MM#else  cap_config.esp_params.input_buffer = cap_input_buffer_SDRAM;#endif  cap_config.esp_params.input_buffer_size = CAP_INPUT_BUFFER_SIZE_INTRAM;  cap_config.esp_params.input_sector_size = CAP_CHIN_SECTOR_SIZE;  cap_config.esp_params.warning_overflow_thrs = CAP_ESP_OFF_OVERFLOW_THRS;  cap_config.esp_params.warning_underflow_thrs = CAP_ESP_OFF_UNDERFLOW_THRS;}/******************************************************************************//* Function:  cap_reset_config                                                *//*                                                                            *//*! \brief    cap reset configuration *  \param *  \return *  \remark *//******************************************************************************/void cap_reset_config(void){#if (1 == HAVE_SHOCK_MEMORY)  cap_config.esp = CNF_ESP;  cap_config.adpcm = CNF_ADPCM;#else  cap_config.esp = ESP_OFF;  cap_config.adpcm = ADPCM_OFF;#endif  local_cap_cmd_event.command_params.xfer_params.data_type = DATA_TYPE_CDDA;  cap_config.new_config = 1;  cap_device_id = DEV_CD_ID;}/******************************************************************************//* Function:  cap_config_sector_size_offset                                   *//*                                                                            *//*! \brief    cap set configuration of sector size/offset *  \param *  \return *  \remark *//******************************************************************************/void cap_config_sector_size_offset(void){  if (DATA_TYPE_CDDA == local_cap_cmd_event.command_params.xfer_params.data_type)  {    /* disc is CDDA */    cap_sector_offset = STD_CDDA_OFFSET;#if (1 == HAVE_SHOCK_MEMORY)    if (ADPCM_ON == cap_config.adpcm)    {      cap_sector_size = STD_CDDA_ADPCM_SECTOR_SIZE;    }    else#endif    {      cap_sector_size = STD_CDDA_SECTOR_SIZE;    }  }  else  {    /* disc is CDROM */    /* CDROM Mode1 */    cap_sector_offset = STD_CDROM_OFFSET;    cap_sector_size = STD_CDROM1_SECTOR_SIZE;    if (DATA_TYPE_CDROM_M2 == local_cap_cmd_event.command_params.xfer_params.data_type)    {      /* CDROM Mode2 */      cap_sector_size = STD_CDROM2_SECTOR_SIZE;    }    else if (DATA_TYPE_CDROM_XA_F1 == local_cap_cmd_event.command_params.xfer_params.data_type)    {      /* CDROM XA Form 1 */      cap_sector_offset = STD_CDROM_XA_OFFSET;      cap_sector_size = STD_CDROM_XA1_SECTOR_SIZE;    }    else if (DATA_TYPE_CDROM_XA_F2 == local_cap_cmd_event.command_params.xfer_params.data_type)    {      /* CDROM XA Form 2 */      cap_sector_offset = STD_CDROM_XA_OFFSET;      cap_sector_size = STD_CDROM_XA2_SECTOR_SIZE;    }    /* else Do nothing */  } /* if (DATA_TYPE_CDDA == local_cap_cmd_event.command_params.xfer_params.data_type) */}/******************************************************************************//* Function:  cap_check_new_config                                            *//*                                                                            *//*! \brief    configuration check and update update *  \param *  \return *  \remark *//******************************************************************************/void cap_check_new_config(void){  uint8 config_update;  config_update = 0;  if (1 == cap_config.new_config)  {    cap_config.new_config = 0;    if (ESP_ON == cap_config.esp)    {      if (cap_config.esp_params.input_buffer_size != CAP_INPUT_BUFFER_SIZE_SDRAM)      {        /* Configuration CHANGE !! */        cap_esp_buf_init();                    /* Reset ESP Buffer */        cap_config_esp_params_on();            /* Set esp_params for SDRAM (ESP ON). */      }    }    else    {      if (cap_config.esp_params.input_buffer_size != CAP_INPUT_BUFFER_SIZE_INTRAM)      {        /* Configuration CHANGE !! */        cap_esp_buf_init();                    /* Reset ESP Buffer */        cap_config_esp_params_off();           /* Set esp_params for SDRAM (ESP OFF). */      }    }#if (1 == HAVE_SHOCK_MEMORY)    if (ADPCM_ON == cap_config.adpcm)    {      if (CAP_INPUT_SECTOR_SIZE == CAP_CHIN_SECTOR_SIZE)      {        /* Configuration CHANGE (Only adpcm ON/OFF) !! */        cap_esp_buf_init();                    /* Reset ESP Buffer */        cap_config.esp_params.input_buffer_size = CAP_INPUT_BUFFER_SIZE << 2;  /* 720 => 2880 sectors */        cap_config.esp_params.input_sector_size = CAP_CHIN_SECTOR_SIZE >> 2;        cap_config.esp_params.warning_overflow_thrs = cap_config.esp_params.warning_overflow_thrs                                                   << 2;        cap_config.esp_params.warning_underflow_thrs = cap_config.esp_params.warning_underflow_thrs                                                    << 2;      }    }    else    {      if (CAP_INPUT_SECTOR_SIZE != CAP_CHIN_SECTOR_SIZE)      {        /* Configuration CHANGE (Only adpcm ON/OFF) !! */        cap_esp_buf_init();                    /* Reset ESP Buffer */        cap_config.esp_params.input_buffer_size = CAP_INPUT_BUFFER_SIZE >> 2;  /* 2880 => 720 sectors */        cap_config.esp_params.input_sector_size = CAP_CHIN_SECTOR_SIZE;        cap_config.esp_params.warning_overflow_thrs = cap_config.esp_params.warning_overflow_thrs                                                   >> 2;        cap_config.esp_params.warning_underflow_thrs = cap_config.esp_params.warning_underflow_thrs                                                    >> 2;      }    }#endif    bd_params.esp = cap_config.esp;    bd_params.esp_params.input_buffer = cap_config.esp_params.input_buffer;    bd_params.esp_params.input_buffer_size = cap_config.esp_params.input_buffer_size;    bd_params.esp_params.warning_overflow_thrs = cap_config.esp_params.warning_overflow_thrs;    config_update = 1;  }  if ((DEV_CD_ID == cap_device_id) && (local_cap_cmd_event.command == CAP_CMD_XFER_DATA)     && ((bd_params.data_type != local_cap_cmd_event.command_params.xfer_params.data_type)        || ((cap_status.read.data_type != local_cap_cmd_event.command_params.xfer_params.data_type)          && local_cap_cmd_event.command_params.xfer_params.force_execution))) /* Fix 13/Sep/06 */  {    bd_params.data_type = local_cap_cmd_event.command_params.xfer_params.data_type;        /* When no chunk level gap between write controller and read controller. */    if ((cap_status.write.xfer_chunk_level == cap_status.read.xfer_chunk_level)       || local_cap_cmd_event.command_params.xfer_params.force_execution)  /* Fix 13/Sep/06 */    {      cap_status.read.data_type = local_cap_cmd_event.command_params.xfer_params.data_type;      cap_config_sector_size_offset();  /* Config sector size/offset, according to local_cap_cmd_event.command_params.xfer_params.data_type. */    }    else    {      /* Chunk level gap !! between write controller and read controller. */      /* cap_sector_offset, cap_sector_size initialization will be done in read controller. */      cap_status.read.xfer_condition |= CAP_ESP_SECTOR_SIZE_CHANGE;      /* Re-using xfer_sector_end variable for indicating chunk data level for new data_type. */      cap_status.read.xfer_sector_end = (uint32) cap_status.write.xfer_chunk_level;    }    cap_status.count.g_good_sectors = 0;      /* Fixed bug with scratched Mixed mode disc [FH] 23/Mar/2007 */     config_update = 1;  }  if (config_update)  {    bd_dma_init(&bd_params);  }}/******************************************************************************//* Function:  cap_update_fsm_result                                           *//*                                                                            *//*! \brief    cap task update fsm result (and error reason) *  \param *  \return *  \remark *//******************************************************************************/void cap_update_fsm_result(RETVAL cap_result) /* BB060926b */{  cap_status.result.error_reason = cap_result;  if (NO_ERROR_REASON == cap_status.result.error_reason)  {    cap_status.result.fsm_result = READY;  }  else  {    cap_status.result.fsm_result = cap_status.result.error_reason;  }}/******************************************************************************//* capture buffer management                                                  *//******************************************************************************/#if 0/******************************************************************************//* Function:  cap_force_fill                                                  *//*                                                                            *//*! \brief    force all the conditions to seek and completely fill buffer *  \param *  \return *  \remark *//******************************************************************************/void cap_force_fill(void){  cap_esp_buf.last.lba = cap_esp_buf.curr.lba - 1;  cap_esp_buf.last.pos = CAP_INPUT_BUFFER_SIZE - 1;  cap_esp_buf.fill = 1;}/******************************************************************************//* Function:  cap_esp_buf_update_first                                        *//*                                                                            *//*! \brief    update first block *  \param *  \return *  \remark *//******************************************************************************/void cap_esp_buf_update_first(void){  cap_esp_buf.first.lba = cap_esp_buf.curr.lba;  cap_esp_buf.first.pos = cap_esp_buf.curr.pos;}/******************************************************************************//* Function:  cap_esp_buf_estim_last                                          *//*                                                                            *//*! \brief    estimate last block *  \param *  \return *  \remark *//******************************************************************************/

⌨️ 快捷键说明

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