startup_main.c 2.43 KB
#include "os_config.h"

#include "regmap.h"

#include "c_def.h"
#include "debug.h"
#include "oem.h"

#include "hw_pll.h"
#include "hw_misc.h"


#include "app_uart.h"
#include "app_timer.h"

#include "App_main.h"

//! \brief The globally available command line argument count.
//int ARGC;

//! \brief The globally available command line arguments.
//char ** ARGV;


///////////////////////////////////////////////////////////////////////////////
//!
//!     \brief       main() - Start the RTOS kernel.
//!
//!     \fntype     Non-Reentrant function
//!
//!     Description: This function is the entry point for the program.
//!
//!     \param[in]   argc  The number of arguments passed in.
//!     \param[in]   argv  The values of arguments passed in.
//!
//!     \retval      0  SUCCESS (always return SUCCESS).
//!
//!
/////////////////////////////////////////////////////////////////////////////////
void main_power_on(void);

int main(void)
{
	U32 temp;

	misc_clkgate_init();
	hw_pll_set(1, SYS_CLK_FREQ_DEFAULT);

#ifdef POWER_KEY_ENABLE
	hw_rtc_init();
#endif	

#ifdef CLKSSCG_ENABLE
#if (SHARE_LINK_MODE == SL_SUBWOOFER)
	if (app_main_data.share_link_role == SL_ROLE_SLAVE)
	{
		hw_audio_pll_set(1,1,SF_BASE_44100,1,PWM_384,0,SPDIF_SF_1x,1,1);
	}
	else
#endif
	{
		#if defined PWM_768_2048
		hw_audio_pll_set(1,1,SF_BASE_44100,1,PWM_768_2048x,0,SPDIF_SF_1x,1,1);
		#elif defined PWM_768_4096
		hw_audio_pll_set(1,1,SF_BASE_44100,1,PWM_768_4096x,0,SPDIF_SF_1x,1,1);
		#elif defined PWM_2304x
		hw_audio_pll_set(1,1,SF_BASE_44100,1,PWM_2304,0,SPDIF_SF_1x,1,1);
		#else
		hw_audio_pll_set(1,1,SF_BASE_44100,1,PWM_384,0,SPDIF_SF_1x,1,1);
		#endif
	}
#else
#if (SHARE_LINK_MODE == SL_SUBWOOFER)
	if (app_main_data.share_link_role == SL_ROLE_SLAVE)
	{
		hw_audio_pll_set(1,0,SF_BASE_48000,1,PWM_384,1,SPDIF_SF_1x,1,1);
	}
	else
#endif
	{
		#if defined PWM_768_2048
		hw_audio_pll_set(1,0,SF_BASE_48000,1,PWM_768_2048x,1,SPDIF_SF_1x,1,1);
		#elif defined PWM_768_4096
		hw_audio_pll_set(1,0,SF_BASE_48000,1,PWM_768_4096x,1,SPDIF_SF_1x,1,1);
		#elif defined PWM_2304x
		hw_audio_pll_set(1,0,SF_BASE_48000,1,PWM_2304,1,SPDIF_SF_1x,1,1);
		#else
		hw_audio_pll_set(1,0,SF_BASE_48000,1,PWM_384,1,SPDIF_SF_1x,1,1);
		#endif
	}
#endif

	os_init();
	os_entry(NULL);


	while (1)
	{
		asm("nop"); 
	}

	return 0;
}

////////////////////////////////////////////////////////////////////////////////
// End of file
////////////////////////////////////////////////////////////////////////////////