?? mconfig.c
字號(hào):
/************************************************** * * mconfig.c * * CVS ID: $Id: mconfig.c,v 1.49 2007/11/15 14:23:01 trubac Exp $ * Author: Fabio Dell'orto [FD] - STM * Date: $Date: 2007/11/15 14:23:01 $ * Revision: $Revision: 1.49 $ * * Description: * * * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * *************************************************** * * STM CVS Log: * * $Log: mconfig.c,v $ * Revision 1.49 2007/11/15 14:23:01 trubac * added error limits for CD sector acquisition * * Revision 1.48 2007/11/08 17:30:48 sedmik * if IPOD_AP=1 - added DFLT_IPOD_CFG to module config * * Revision 1.47 2007/10/22 08:30:51 marcucci * More robust waiting for DMA complete * * Revision 1.46 2007/10/12 13:19:40 marcucci * Added the possibility to set I2S in Philips or Sony LSImode * Added the possibility to change OIF parameter also in PAUSE. * * Revision 1.45 2007/10/12 07:00:33 belardi * Added comments * * Revision 1.44 2007/10/09 15:58:48 belardi * Add check on configuration write length to avoid overwriting outside of the configuration object * Added missing CADDR_FILESYSTEM_LIMIT * * Revision 1.43 2007/09/27 11:06:14 trubac * New configuration option for filesystem items limit * * Revision 1.42 2007/08/27 09:08:39 belardi * Reinserted the following functionality removed by mistake from 1.40 to 1.41: * Put GPB4 in High-Z when the 'VBUS control' option is disabled from SetUsbUption * * Revision 1.41 2007/08/20 16:30:32 longauer * more robust HIGH_Z setting (proper timers handling) * * Revision 1.40 2007/08/14 15:29:35 dellorto * multiple mechanisms * * Revision 1.39 2007/08/10 11:37:21 belardi * Put GPB4 in High-Z when the 'VBUS control' option is disabled from SetUsbUption * * Revision 1.38 2007/08/07 07:59:38 belardi * - Removed 'case' unused code * - Fixed error in usb_options * * Revision 1.37 2007/08/06 07:49:42 belardi * Longer HOST UPDATE string definition * * Revision 1.36 2007/08/01 18:10:17 trubac * host_update_method added to module_config * * Revision 1.35 2007/08/01 15:27:06 belardi * Modifications to support run-time configurable ESP size * - when ESP is disabled, allocate all memory to X_array except 9 sectors for ESP * * Revision 1.34 2007/08/01 10:23:02 belardi * Modifications to support run-time configurable ESP size * - added new configuration item * * Revision 1.33 2007/07/24 09:24:24 belardi * Changed 2-byte config item from Flash- to SDRAM -size * Changed EEPROM-size to Flash-size * * Revision 1.32 2007/07/12 12:23:26 trubac * Host update file is configurable through module config * * Revision 1.31 2007/07/05 07:59:38 belardi * Modifications to support ID3 selection * * Revision 1.30 2007/03/28 17:53:22 belardi * Bug fix for UsbOptions configuration object * * Revision 1.29 2007/03/28 14:28:53 belardi * Added missing default configuration for UsbOptions condig object * * Revision 1.28 2007/03/28 14:20:47 belardi * Added configuration option to enable/disable USB HUB support from the Radio * * Revision 1.27 2007/03/13 09:33:29 belardi * Added one line to communicate config change to Cap for ADPCM, commented out because ADPCM does not work * * Revision 1.26 2007/02/26 19:07:17 belardi * Added configuration item to select whether filename extension should be sent with MsgEntryName * * Revision 1.25 2007/02/22 16:50:48 marcucci * Added some modification to allow I2S Word Clock and Bit Clock Level Programmable * Through CIS command * * Revision 1.24 2007/02/15 15:51:48 belardi * - Added configuration items for HAVE_FSHRINK * - reduced size of variable allocated on the stack * * Revision 1.23 2007/02/15 13:12:11 marcucci * Bootloader Optimization * * Revision 1.22 2007/02/06 11:16:20 belardi * Added dynamic remapping of SDRAM for ESP vs. X_array * * Revision 1.21 2006/11/27 19:53:27 belardi * Removed unused variables * Added #include * * Revision 1.20 2006/11/27 15:46:29 sedmik * fix for default values in cofiguration table * * Revision 1.19 2006/11/24 16:28:23 sedmik * added checking of decoder formats enabling (according to defines) * * Revision 1.18 2006/11/24 02:14:47 zhong * no message * * Revision 1.17 2006/11/21 15:35:46 sedmik * added new config param ( CF23 search play time) * * Revision 1.16 2006/11/21 13:58:57 dellorto * improved hostif reporting of servo parameters in case of restart * * Revision 1.15 2006/11/20 14:00:13 marcucci * Audio Config Command * * Revision 1.14 2006/11/20 13:28:27 sedmik * mconfig_update_params - added checking of playlists, seek speed and shuffle setting * * Revision 1.13 2006/11/17 16:40:05 dellorto * updated configuration table * added configurable text item length * * Revision 1.12 2006/11/07 18:59:10 sedmik * added 3 configuration bytes - folder numbering sort, seek speeed, playlist mode * * Revision 1.11 2006/09/18 09:55:24 belardi * Corrected CVS keyword usage * * Revision 1.10 2006/09/18 09:25:15 belardi * Added Log CVS keyword into file header * * ***************************************************/#include "gendef.h"#include "mconfig.h"#include "hwreg.h"#include "srvcfg.h"#include "plyinc.h"#include "plr_conf.h"#include "srvchn.h" // for oif_init()#include "hostif_high.h"#include "osal.h"#include "blgendef.h"#include "bspi_util.h"#include "hostif_low.h"#include "utility.h"#include "capture.h"#include "audiobuffer.h"extern void Init_X_array(void);MODULE_CONFIGURATION_UNION module_config;AUDIO_OUTPUT_CFG_UNION prev_audio_output_cfg; //[MM_AUDIO_OUTPUT_CONFIG]extern volatile uint32 sf_type;extern volatile uint8 dma_ch0_fiq;/***********************************//* default CD module configuration *//***********************************/static const MODULE_CONFIGURATION_UNION factory_module_config ={ DFLT_I2C_ADDRESS , DFLT_AUDIO_OUTPUT_CFG , DFLT_ROM_DATA_CFG , DFLT_LOAD_ACTION , DFLT_LANGUAGE_CFG_1 , DFLT_LANGUAGE_CFG_2 , DFLT_LANGUAGE_CFG_3 , DFLT_LANGUAGE_CFG_4 , DFLT_LANGUAGE_CFG_5 , DFLT_TEXT_INFO_SETTING_ITEM , DFLT_TEXT_INFO_SETTING_CODE , DFLT_TEXT_INFO_SETTING_LENGTH , DFLT_MEDIA_INFO_SETTING , DFLT_LAST_FILE_REPORTING_CFG , DFLT_AUDIO_FORMAT , DFLT_FUNCTION_CFG , DFLT_HYBRID_DISC_CFG , DFLT_WRAP_CFG , DFLT_PLAY_MODE , DFLT_AUTO_MODE , DFLT_PLAYBACK_SCOPE , DFLT_LOADER_CFG_1 , DFLT_LOADER_CFG_2 , DFLT_FOLDER_NUMBERING_SORT , DFLT_SEARCH_SPEED , DFLT_SIZE_OF_SDRAM_H , DFLT_SIZE_OF_SDRAM_L , DFLT_SIZE_OF_FLASH , DFLT_MEM_CHECK_CFG , DFLT_PLAYLIST_CFG , DFLT_SEARCH_PLAY_TIME , DFLT_FSHRINK_FILE_STEP , DFLT_FSHRINK_FILE_MAX , DFLT_FSHRINK_FILE_MIN , DFLT_FSHRINK_DIR_STEP , DFLT_FSHRINK_DIR_MAX , DFLT_FSHRINK_DIR_MIN , DFLT_MSG_ENTRY_NAME , DFLT_USB_OPTIONS_CFG , DFLT_ID3_CFG , DFLT_UPDATE_NAME , DFLT_HOST_UPDATE_METHOD , DFLT_ESP_SIZE , DFLT_FILESYSTEM_LIMIT , DFLT_ERR_SECTORS_MP3 , DFLT_ERR_SECTORS_AAC , DFLT_ERR_SECTORS_WMA , #if (0 != IPOD_AP) DFLT_IPOD_CFG#endif /* IPOD_AP */ };/******************************************************************************//* Function: mconfig_write_byte *//* *//*! \brief Write one byte to module configuration array * \param uint8 addr, uint8 data * \return void * \see uint8 * \remark *//******************************************************************************/void mconfig_write_byte(uint8 addr, uint8 data){ if (addr < MODULE_CONFIG_SIZE) { module_config.raw[addr] = data; }}/******************************************************************************//* Function: mconfig_read_byte *//* *//*! \brief Read one byte to module configuration array * \param uint8 addr * \return uint8 data * \see uint8 * \remark *//******************************************************************************/uint8 mconfig_read_byte(uint8 addr){ if (addr < MODULE_CONFIG_SIZE) { return module_config.raw[addr]; } else { return 0; }}/******************************************************************************//* Function: mconfig_write_bits *//* *//*! \brief Set/Reset module configuration parameters bits according to masks * \param uint8 addr, uint8 mask_0, uint8 mask_1 * \return void * \see uint8 * \remark *//******************************************************************************/void mconfig_write_bits(uint8 addr, uint8 mask_0, uint8 mask_1){ if (addr < MODULE_CONFIG_SIZE) { module_config.raw[addr] |= mask_1; module_config.raw[addr] &= (~mask_0); }}/******************************************************************************//* Function: loader_cfg_init *//* *//*! \brief write loader configurations according to * the selected mechanism * \param void * \return void * \see * \remark *//******************************************************************************/void loader_cfg_init(void){ if (mechanism_model == M0_SHINWA_CDC02) { module_config.data.loader_cfg_1.field.additional_eject_distance = MAX_SAFE_EJECT_DISTANCE_SHINWA_CDC02; } else if (mechanism_model == M1_SHINWA_CLC01) { module_config.data.loader_cfg_1.field.additional_eject_distance = MAX_SAFE_EJECT_DISTANCE_SHINWA_CLC01; } else { module_config.data.loader_cfg_1.field.additional_eject_distance = 0x00; } module_config.data.loader_cfg_1.field.conservative_behavior_Shinwa_CDC02 = 0x00; module_config.data.loader_cfg_1.field.conservative_behavior_Tanashin = 0x00; module_config.data.loader_cfg_1.field.reserved_7 = 0x00; module_config.data.loader_cfg_2.field.loader_retries = 0x03; module_config.data.loader_cfg_2.field.reverse_direction = 0x01; module_config.data.loader_cfg_2.field.eject_repositioning = 0x00; if (IS_TANASHIN_MECHANISM(mechanism_model)) { module_config.data.loader_cfg_2.field.eject_without_disc = 0x01; if (IS_TANASHIN_MECHANISM_8CM(mechanism_model)) { module_config.data.loader_cfg_2.field.insert_without_disc = 0x01; } else { module_config.data.loader_cfg_2.field.insert_without_disc = 0x00; } } else { module_config.data.loader_cfg_2.field.eject_without_disc = 0x00; }}/******************************************************************************//* Function: mconfig_init *//* *//*! \brief Reset module configuration parameters to factory settings * \param void * \return void * \see * \remark *//******************************************************************************/void mconfig_init(void){ uint8 i; for (i = 0; i < sizeof(MODULE_CONFIGURATION_UNION); i++) { module_config.raw[i] = factory_module_config.raw[i]; } loader_cfg_init(); CNF_AUDIO_OUTPUT_PREV = CNF_AUDIO_OUTPUT_DFLT; CNF_I2S_OUTPUT_FORMAT_PREV = CNF_I2S_OUTPUT_FORMAT_DFLT; CNF_I2S_FS_PREV = CNF_I2S_FS_DFLT; }/******************************************************************************//* Function: CheckSDRAM *//* *//*! \brief * \param void * \return uint32 * \remark *//******************************************************************************/uint32 CheckSDRAM(void){ volatile uint32 RAMBackup; volatile uint32 *pSDRAM; uint32 i; uint32 Error=0; pSDRAM=(uint32 *)0x80000000; for(i=1;i<=0x80000;i++) { RAMBackup=*pSDRAM; *pSDRAM=0xFFFFFFFF; if(*pSDRAM!=0xFFFFFFFF) { Error=i; break; } *pSDRAM=0; if(*pSDRAM!=0)
?? 快捷鍵說(shuō)明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號(hào)
Ctrl + =
減小字號(hào)
Ctrl + -