Ejemplo n.º 1
0
void sys_init(void)
{
#if defined(UART_ENABLE)
    uart_init();
    deg_str("power on\n");
#endif
    SYS_POWER_OFF();	

    core_power_on();
    OTP_CLK_DIV2();
    DECODER_DIV2();
    SYSTEM_CLK_DIV4();
#if (NO_DISP != monitor)
    init_display();
#endif
    sd_speed_init(0,100);

//#if SDMMC_CMD_MODE
//    sd_chk_ctl(SET_SD_H_CHK);
//#endif
    init_port_sd();
    //kv_init(); ///按键音初始化函数

#if RTC_ENABLE
    rtc_init();			//RTC初始化,检测是否闹钟开机
    //{
        //work_mode = RTC_MODE;
    //}
#else
    {
        u8 rtc_reg = read_rtc_reg();
        if (rtc_reg & BIT(7))					//检测是否掉电
        {
            rtc_reg &= ~BIT(7); 				//清零PDFLAG
            write_rtc_reg(rtc_reg);
#if USE_RTC_RAM
            reset_rtc_ram();
#endif
        }
    }
#endif

    SYS_POWER_OFF();	
    key_init();
    bsp_init();
    SYS_POWER_OFF();	
    //interrupt_init(15, rtcisr);
    interrupt_init(3, timer3isr);
    interrupt_init(0, timer0isr);
#if defined(BLUE_TOOTH_UART_FUNC)
    interrupt_init(7, uart_isr);
#endif
    enable_interrupt();
   /// flashled(3);
}
Ejemplo n.º 2
0
void sys_init(void)
{
#if 0
    uart_init();
    deg_str("AC309N-C\n");
#endif	
    core_power_on();
    OTP_CLK_DIV2();
    DECODER_DIV2();
    sys_clk_div(4);//SYSTEM_CLK_DIV4();
    set_vol_tab_ptr(analog_vol_tab, digital_vol_tab);
                                    
#if (NO_DISP != monitor)
  	init_display();
#endif
    sd_speed_init(0,100);

//#if SDMMC_CMD_MODE
//    sd_chk_ctl(SET_SD_H_CHK);
//#endif
    init_port_sd();
    kv_init(); ///按键音初始化函数

#if RTC_ENABLE
    if (rtc_init())			//RTC初始化,检测是否闹钟开机
    {
        work_mode = RTC_MODE;
    }
#else
    {
        u8 rtc_reg = read_rtc_reg();
        if (rtc_reg & BIT(7))					//检测是否掉电
        {
            rtc_reg &= ~(BIT(7)); 				//清零PDFLAG
            write_rtc_reg(rtc_reg);
#if USE_RTC_RAM

#if RTC_ENABLE
            reset_rtc_ram();
#else
            {
                u8 i;
                for (i = 0; i < 64; i++)
                {
                    write_rtc_ram(i, 0);
                }
            }
#endif   ///<RTC_ENABLE
            

#endif ///<USE_RTC_RAM
        }
    }
#endif
    key_init();
    bsp_init();
#if ECHO_ENABLE
    dec_analog_vol_sel(1);
    echo_ptr = (REVERB_CTL _xdata *)get_echo_var_ptr(1);
    encode_msg = (ENCODE_MSG _xdata *)get_encode_msg_ptr();
    app_echo.strong = 150;
    app_echo.deep = 40;
#else
    dec_analog_vol_sel(0);
    get_echo_var_ptr(0);///<传参0,不适用混响功能
#endif
    interrupt_init(15, rtcisr);
    interrupt_init(3, timer3isr);
    interrupt_init(0, timer0isr);
    enable_interrupt();
}