📄 main.c
字号:
/************************************************** * * main.c * * CVS ID: $Id: main.c,v 1.49 2007/11/09 08:47:01 marcucci Exp $ * Author: Raffaele Belardi [RB] - STM * Date: $Date: 2007/11/09 08:47:01 $ * Revision: $Revision: 1.49 $ * * Description: * * Main entry point for Accordo+ firmware. * *************************************************** * * COPYRIGHT (C) ST Microelectronics 2005 * All Rights Reserved * ******************************************************************************* * \brief Player * * \par Change History: * * - BB060907a Added printf to ASSERT and removed while loop * *************************************************** * * STM CVS Log: * * $Log: main.c,v $ * Revision 1.49 2007/11/09 08:47:01 marcucci * Modification to allow patching of FIQ interrupt procedure * * Revision 1.48 2007/10/22 13:40:50 marcucci * Fixed bug on HAVE_USB_CLOCK_CHECK * * Revision 1.47 2007/10/22 10:13:27 marcucci * USB initialization performed on setting of of CFG0 pins to accomplish CD * only application without 48Mhz mounted * * Revision 1.46 2007/08/14 15:28:13 dellorto * multiple mechanisms * * Revision 1.45 2007/08/01 10:18:18 belardi * Modifications to support run-time configurable ESP size * - changed parameter meaning for sdram_layout() * * Revision 1.44 2007/06/28 20:53:52 longauer * 1.Usb restructuralization in order to supports more LUNs and interface preparation * for iAP; 2.PHY emulation moved; 3.compilation works with IPOD_PASSTHROUGH==0; 4. * usb patching init moved from main.c * * Revision 1.43 2007/04/11 14:19:59 belardi * Integration of HAVE_CD_MECHA modification by [GP] * * Revision 1.42 2007/02/22 14:31:17 marcucci * Modified to patch MGC structures * * Revision 1.41 2007/02/15 13:11:31 marcucci * Bootloader Optimization * * Revision 1.40 2007/02/06 11:13:18 belardi * Added dynamic remapping of SDRAM for ESP vs. X_array * * Revision 1.39 2007/01/30 13:30:11 marcucci * 16/32 bit run-time selection * * Revision 1.38 2006/12/14 13:39:40 marcucci * update_status variable nitialized to 1 * * Revision 1.37 2006/10/18 12:39:31 belardi * Removed USE_STM_HOSTIF, changed to APM_PICKUP * * Revision 1.36 2006/10/10 06:56:58 belardi * Integration of m8_cav2_cm80507 - Changed ASSERT * * Revision 1.35 2006/09/15 19:56:22 belardi * Merged the m8_cav2_cm80506_cs3563. * - ASSERT * * ******************************************************************************/#include "gendef.h"#include "blgendef.h"#include "osal.h"#include "plyinc.h"#include "srvinc.h"#include "hwreg.h"#include "monitor.h"#include "player.h"#include "loader.h"#include "bkdhdl.h"#include "capture.h"#include "controller.h"#include "decoder_task.h"#include "xfile.h"#include "filesys.h"#ifndef APM_PICKUP #include "hostif_high.h" #include "i2c.h"#endif#include "utility.h"#include "pcdeb.h"#include "hwinit.h"#include "memutil.h"#if (0 != HAVE_USB)#include "usb.h"#endif#if (0 != HAVE_SDC)#include "sdc.h"#endif /* HAVE_SDC */#if (OS20_MALLOC == 1)#include "system.h"#else#include "types.h"#endif#if (OS20_OUTPUT==1)#include "lld_uart.h"#endif#include "isrchdl.h"extern void dma_ch0_isr_fiq_hdl(void); void (*fiq_hdl)(void);// System partition#if (0 != HAVE_WMA) || (0 != HAVE_AAC) /* STTODO remove */static unsigned char block1[0x8000];#elsestatic unsigned char block1[0x4000]; // internal, simple#endifstatic partition_t the_internal_partition;volatile uint32 sf_type;void DEBUG_printf_version(void){#ifdef APM_PICKUP extern uint16 service_get_crc(void); uint16 sum = service_get_crc(); DEBUG_printf(("CD-Module CDM-M8 CAV2. SW version:", 1, 1, CIS_M8CAV_VER_SW_VERSION_MAJOR)); DEBUG_printf((" Checksum:", 2, 1, sum));#endif}/******************************************************************************//* Function: mymain *//* *//*! \brief Entry point for C language routines * \param void * \return void * \remark *//******************************************************************************/extern void SelectDecodersPCMSampleSize(void);void mymain(void){ // To make possible to patch the FIQ interrupt procedure //fiq_hdl = (void *)dma_ch0_isr_fiq_hdl; fiq_hdl = (void (*)(void))dma_ch0_isr_fiq_hdl; SelectDecodersPCMSampleSize(); hw_init(); ResetEic(); //sdram_init(0x40000000); [MM] sdram_layout(DFLT_ESP_SIZE); mechanism_model = detect_mechanism(); InitProfile();#if (OS20_MALLOC == 1) SYS_Init();#endif #if (OS20_OUTPUT==1) LLD_UART_Setup();#endif mconfig_init(); sf_type = (GCR2.field.cfg & BL_CFG_BIT_1) >> 1; OSAL_start(); kernel_timeslice(0); // *** [OK]: init memory for Decoder *** // partition_init_simple(&the_internal_partition,block1,sizeof(block1)); internal_partition = &the_internal_partition; //partition_init_heap(&the_system_partition,block2,sizeof(block2)); //system_partition = &the_system_partition;#if (DEBUG_INCLUDE_PCDEB == 1) pcint_init(); // USING UART 1#endif OSAL_timer_init();#ifndef APM_PICKUP i2c_init();#endif cap_fsm_init();#if (HAVE_CD_MECHA == 1) init_servo_fsm();#endif player_init();#if (0 != DEBUG_DSP) /* Turns the monitor outputs on and selects: * testpwm1 -> mon0 * gpio -> mon1 * testpwm2 -> mon2 *//*-------- Settings ---------- MON_0 - MON_1 0x0B: testpwm1 0x0C: testpwm2 0x17: gpio_out1 0x0D: Acquisition Defect 0x28: DSP mailbox interrupt MON2 0x01: testpwm1----------------------------*/ GCR5.field.mon_0 = 0x0B; GCR5.field.mon_1 = 0x0C; GCR5.field.mon_2 = 0x01; GCR5.field.mon_sel = 0x00; /* DRD[12:10] lines are used for SDRAM */#endif //src_init(); //SRCSetFrequency(kDecoderSampleRate_8000Hz); //set_DMA2((uint32*)&SIN20008K, 64); //OIF_SP_CTRL.field.en_shockproof = 1; // To enable buffer Data //oif_init(); //audio_on(); //enable_DMA0(); //enable_SRC(); InitMonitor(); InitControllerTask(); InitDecoderTask(); InitFileSystemTask();#if (0 != HAVE_USB) #if (DEBUG_INCLUDE_PCDEB == 1) configure_gpio(PORT_B, GPIO_6, GPIO_AF_PP); // TX1 configure_gpio(PORT_B, GPIO_7, GPIO_IN); // RX1 #else #if (0 != HAVE_USB_XTAL_CHECK)if((GCR2.field.cfg & 0x01) == 0){ InitUSBTask();} #else InitUSBTask(); #endif #endif #endif#if (0 != HAVE_SDC) InitSDCTask();#endif /* HAVE_SDC */#ifndef APM_PICKUP InitHostIfTask();#if (0 != HAVE_POSITION) || (0 != HAVE_UPDATE) //update_status = (0x0818 & PDA); // Check SW update_status = 1;#endif /* HAVE_UPDATE */#endif DEBUG_printf_version(); (void)task_priority_set(task_id(), MIN_USER_PRIORITY); while (1) {/* #if (OS20_OUTPUT==1) report_os20_state(); #endif task_delay( ticks_per_sec() );*/ }}/******************************************************************************//* Function: ASSERT *//* *//*! \brief Debug routine, provides assertion functionality * \param[in] cond A boolean condition * \param[in] msg A string * \return void * \remark If the condition is not true, echo the message string and enter * an endless loop. *//******************************************************************************/#if (0 != USE_ASSERT)void ASSERT(int cond, char *msg){ if (cond == 0) { /* echo message on UART? */ // .... // TODO: At least do something with msg, e.g. store in a global // variable otherwise it is optimized away and not visible // in TRACE32. /* endless loop, put breakpoint */ DEBUG_printf(("ASSERT:",0,1,msg)); /* BB060907a */ _OSAL_thread_priority_set(OSAL_THREAD_IdleTask, MAX_USER_PRIORITY); }}#endif#ifndef QAC_CHECK/* this functions will be called instead of the original *div0 */int $Sub$$__aeabi_idiv0(int return_value){ return return_value;}long long $Sub$$__aeabi_ldiv0(long long return_value){ return return_value;}#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -