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); }
/*----------------------------------------------------------------------------*/ void sys_init(void) { #ifdef UART_ENABLE uartInit(); printf("power up \r\n"); #endif #if RTC_ENABLE if (init_rtc()) { work_mode = SYS_RTC; } #else { u8 rtc_reg; rtc_reg=read_rtc_reg(); //printf("RTC reg:%02bx\n",rtc_reg); if (rtc_reg & BIT(6)) ///<RTC是否完全掉电 { #if (MEMORY_STYLE == USE_RTCRAM) reset_rtc_ram(); #endif rtc_reg &= ~(BIT(6)); //清零PDGLG write_rtc_reg(rtc_reg); } } #endif P0IE_init(); keyInit(); timer1Init(); timer3Init(); #ifdef USE_USB_SD_DECODE_FUNC #ifndef NO_SD_DECODE_FUNC sd_speed_init(1,100); init_port_sd(); #endif #endif #if SDMMC_CMD_MODE sd_chk_ctl(SET_SD_H_CHK); #endif DACCON0 |= 0x05; //打开DSP EA = 1; }
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(); }
/*----------------------------------------------------------------------------*/ void sys_init(void) { #ifdef UART_ENABLE uartInit(); printf("power up \r\n"); #endif #if RTC_ENABLE if (init_rtc()) { work_mode = SYS_RTC; } #else { u8 rtc_reg; rtc_reg=read_rtc_reg(); //printf("RTC reg:%02bx\n",rtc_reg); if (rtc_reg & BIT(6)) ///<RTC是否完全掉电 { #if (MEMORY_STYLE == USE_RTCRAM) reset_rtc_ram(); #endif rtc_reg &= ~(BIT(6)); //清零PDGLG write_rtc_reg(rtc_reg); } } #endif set_brightness_all_on(); P0IE_init(); keyInit(); timer1Init(); timer3Init(); #ifdef USE_USB_SD_DECODE_FUNC #ifndef NO_SD_DECODE_FUNC sd_speed_init(1,100); init_port_sd(); #endif #endif #if SDMMC_CMD_MODE sd_chk_ctl(SET_SD_H_CHK); #endif #ifdef USE_POWER_KEY sys_power_up(); #endif DACCON0 |= 0x05; //打开DSP EA = 1; #ifdef USE_POWER_KEY sys_power_up(); #endif work_mode = read_info(MEM_SYSMODE); #ifdef CUSTOMED_POWER_ON_AT_RADIO_MODE work_mode = SYS_FMREV; #endif if (work_mode == SYS_MP3DECODE_USB){ #ifdef REMOVE_USE_MODE work_mode = SYS_FMREV; Disp_Con(DISP_TUNER); return; #endif Disp_Con(DISP_SCAN_DISK); } else if ((work_mode == SYS_FMREV) #ifdef AM_RADIO_FUNC ||(work_mode == SYS_AMREV) #endif ){ #ifdef AM_RADIO_FUNC if(work_mode == SYS_AMREV){ cur_sw_fm_band = MW_MODE; } else #endif { cur_sw_fm_band = FM_MODE; } Disp_Con(DISP_TUNER); } else if (work_mode == SYS_MCU_CD){ Disp_Con(DISP_SCAN_TOC); } else if (work_mode == SYS_AUX){ Disp_Con(DISP_AUX); } #if defined(USE_BLUE_TOOTH_FUNC) else if (work_mode == SYS_BLUE_TOOTH){ Disp_Con(DISP_BT); } #endif CD_PWR_GPIO_CTRL_INIT(); CD_PWR_GPIO_OFF(); //TUNER_PWR_GPIO_CTRL_INIT(); //TUNER_PWR_GPIO_OFF(); AUX_GPIO_CTRL_INIT(); AUX_PWR_GPIO_OFF(); BT_GPIO_CTRL_INIT(); BT_PWR_GPIO_OFF(); }