/******************************************************************************* * FUNCTION * RMMI_UART_SetOwner * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_SetOwner(UART_PORT port, module_type ownerid) { UART_CTRL_OWNER_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); data.u4OwenrId = ownerid; DclSerialPort_Control(handle, SIO_CMD_SET_OWNER, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_GetFlowCtrl * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ UART_FLOW_CTRL_MODE_T RMMI_UART_GetFlowCtrl(UART_PORT uart_port) { UART_CTRL_GET_FC_T data; DCL_HANDLE handle = DclSerialPort_Open(uart_port,0); DclSerialPort_Control(handle, UART_CMD_GET_FLOW_CONTROL, (DCL_CTRL_DATA_T*) &data); return (UART_FLOW_CTRL_MODE_T)(data.FlowCtrlMode); // return FC_NONE; }
/******************************************************************************* * FUNCTION * RMMI_UART_SetAutoBaud_Div * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_SetAutoBaud_Div(UART_PORT port, module_type ownerid) { UART_CTRL_AUTO_BAUDDIV_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); //data.u4Port = port; //NEED_CONFIRM data.u4OwenrId = ownerid; DclSerialPort_Control(handle, SIO_CMD_SET_AUTOBAUD_DIV, (DCL_CTRL_DATA_T*) &data); }
void gps_clr_tx_buf(DCL_DEV port) { UART_CTRL_CLR_BUFFER_T data; DCL_HANDLE handle; data.u4OwenrId = MOD_MMI; handle = DclSerialPort_Open(port,0); DclSerialPort_Control( handle,SIO_CMD_CLR_TX_BUF, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); }
/******************************************************************************* * FUNCTION * RMMI_UART_ClrTxBuffer * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_ClrTxBuffer(UART_PORT port, module_type ownerid) { UART_CTRL_CLR_BUFFER_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); data.u4OwenrId = ownerid; //data.u4Port = port; //NEED_CONFIRM DclSerialPort_Control(handle, SIO_CMD_CLR_TX_BUF, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_SleepOnTx_Enable * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_SleepOnTx_Enable(UART_PORT port, UART_SLEEP_ON_TX enable_flag) { UART_CTRL_SLEEP_ON_TX_ENABLE_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); //data.u4Port = port; //NEED_CONFIRM data.bFlag = (UART_SLEEP_ON_TX_T)enable_flag; DclSerialPort_Control(handle, UART_CMD_SLEEP_TX_ENABLE, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_CtrlRI * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_CtrlRI(UART_PORT port, IO_level SRI, module_type ownerid) { UART_CTRL_RI_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); data.u4OwenrId = ownerid; //data.u4Port = port; //NEED_CONFIRM data.rIOLevelSRI = (IO_LEVEL_T)SRI; DclSerialPort_Control(handle, SIO_CMD_CTRL_RI, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_SetDCBConfig * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_SetDCBConfig(UART_PORT port, UART_CONFIG_T * UART_Config, module_type ownerid) { UART_CTRL_DCB_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); //data.u4Port = port; //NEED_CONFIRM data.u4OwenrId = ownerid; kal_mem_cpy((char*)(&(data.rUARTConfig)), (const char*)UART_Config, sizeof(UART_CONFIG_T)); DclSerialPort_Control(handle, SIO_CMD_SET_DCB_CONFIG, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_ReadDCBConfig * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_ReadDCBConfig(UART_PORT port, UART_CONFIG_T * DCB, module_type ownerid) //uart_hal_need_review { UART_CTRL_DCB_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); //data.u4Port = port; //NEED_CONFIRM data.u4OwenrId = ownerid; DclSerialPort_Control(handle, SIO_CMD_READ_DCB_CONFIG, (DCL_CTRL_DATA_T*) &data); kal_mem_cpy((char*) DCB, (const char*)&(data.rUARTConfig), sizeof(UART_CONFIG_T)); }
void SP_Strm_Disable( void ) { #if !defined(SS_UNIT_TEST) UART_CTRL_CLOSE_T data; data.u4OwenrId = MOD_MED; DclSerialPort_Control( intSStrmControl->cmux_handle, SIO_CMD_CLOSE, (DCL_CTRL_DATA_T*)&data); #endif free_ctrl_buffer(intSStrmControl); intSStrmControl = NULL; L1SP_UnRegister_Strm_Handler(); }
void gps_UART_turnon_power(UART_PORT port, kal_bool on) { DCL_HANDLE handle; UART_CTRL_POWERON_T data; handle = DclSerialPort_Open(port, 0); data.bFlag_Poweron = on; DclSerialPort_Control(handle, UART_CMD_POWER_ON, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); }
void gps_uart_set_owner_id(UART_PORT port, module_type ownerid) { DCL_HANDLE handle; UART_CTRL_OWNER_T data; data.u4OwenrId = ownerid; handle = DclSerialPort_Open(port,0); DclSerialPort_Control(handle,SIO_CMD_SET_OWNER, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); }
/******************************************************************************* * FUNCTION * RMMI_UART_ConfigEscape * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_ConfigEscape(UART_PORT port, kal_uint8 EscChar, kal_uint16 ESCGuardtime, module_type ownerid) { UART_CTRL_CONFIG_ESP_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); data.u4OwenrId = ownerid; //data.u4Port = port; //NEED_CONFIRM data.u2ESCGuardtime = ESCGuardtime; data.uEscChar = EscChar; DclSerialPort_Control(handle, SIO_CMD_CONFIG_ESCAPE, (DCL_CTRL_DATA_T*) &data); }
/******************************************************************************* * FUNCTION * RMMI_UART_is_usb_active * DESCRIPTION * 1. to check if USB is still plug-in or not. * If USB is in the suspend mode, it will send plug-out indication, too. * So we need this API to check it. * 2. only support by USB COM driver * 3. Called when we want to close UART port * 4. If the port is not USB port, default is KAL_FALSE * 5. This function could be used only when handling plug-out * PARAMETERS * * RETURNS * KAL_TRUE : USB is reset and in the suspend mode * KAL_FALSE : USB is plugout * *******************************************************************************/ kal_bool RMMI_UART_is_usb_active(UART_PORT port) { USB_DRV_CTRL_COM_TYPE_QUERY_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); data.is_cdcacm = KAL_FALSE; DclSerialPort_Control(handle, USB_CMD_IS_CDCACM_ACTIVE, (DCL_CTRL_DATA_T*) &data); kal_brief_trace(TRACE_INFO, INFO_RMMI_USB_ACTIVE, port, data.is_cdcacm); return ((data.is_cdcacm==DCL_TRUE)?(KAL_TRUE):(KAL_FALSE)); } /* MAUI_02738549: 2011/03/02, avoid dialup on 1T1R USB COM */
/******************************************************************************* * FUNCTION * RMMI_UART_Open * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ kal_bool RMMI_UART_Open(UART_PORT port,module_type ownerid) { UART_CTRL_OPEN_T data; DCL_STATUS result = STATUS_OK; DCL_HANDLE handle = DclSerialPort_Open(port, 0); //data.u4Port = port; //NEED_CONFIRM data.u4OwenrId = ownerid; result = DclSerialPort_Control(handle, SIO_CMD_OPEN, (DCL_CTRL_DATA_T*) &data); return ((result == STATUS_OK)?(KAL_TRUE):(KAL_FALSE)); }
void gps_putUARTByte(DCL_DEV port, DCL_UINT8 data) { DCL_HANDLE handle; UART_CTRL_PUT_UART_BYTE_T data1; data1.uData = data; handle = DclSerialPort_Open(port,0); DclSerialPort_Control(handle,SIO_CMD_PUT_UART_BYTE, (DCL_CTRL_DATA_T*)&data1); DclSerialPort_Close(handle); }
module_type gps_UART_GetOwnerID(UART_PORT port) { DCL_HANDLE handle; UART_CTRL_OWNER_T data; handle = DclSerialPort_Open(port,0); DclSerialPort_Control(handle,SIO_CMD_GET_OWNER_ID, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); return data.u4OwenrId; }
DCL_UINT8 gps_getUARTByte(DCL_DEV port) { DCL_HANDLE handle; UART_CTRL_PUT_UART_BYTE_T data1; handle = DclSerialPort_Open(port,0); DclSerialPort_Control(handle,SIO_CMD_GET_UART_BYTE, (DCL_CTRL_DATA_T*)&data1); DclSerialPort_Close(handle); return data1.uData; }
/******************************************************************************* * FUNCTION * RMMI_UART_GetBytes * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ kal_uint16 RMMI_UART_GetBytes(UART_PORT port, kal_uint8 * Buffaddr, kal_uint16 Length, kal_uint8 * status, module_type ownerid) { UART_CTRL_GET_BYTES_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); data.u2Length = Length; data.u4OwenrId = ownerid; data.puBuffaddr = Buffaddr; data.pustatus = status; DclSerialPort_Control(handle, SIO_CMD_GET_BYTES, (DCL_CTRL_DATA_T*) &data); //*status = *(data.pustatus); return data.u2RetSize; }
/******************************************************************************* * FUNCTION * RMMI_UART_is_usb_cdc_acm * DESCRIPTION * 1. to check if this is a normal 2T1R USB COM port * 2. only support by USB COM driver * 3. if the port is not USB port, then assume it is normal (be able to do CtrlDCD/DTR/RI and not cause exception) * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ kal_bool RMMI_UART_is_usb_cdc_acm(UART_PORT port) { #ifdef __USB_MULTIPLE_COMPORT_SUPPORT__ USB_DRV_CTRL_COM_TYPE_QUERY_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); data.is_cdcacm = KAL_TRUE; DclSerialPort_Control(handle, USB_CMD_IS_CDCACM, (DCL_CTRL_DATA_T*) &data); return ((data.is_cdcacm==DCL_TRUE)?(KAL_TRUE):(KAL_FALSE)); #else return KAL_TRUE; #endif } /* MAUI_02738549: 2011/03/02, avoid dialup on 1T1R USB COM */
/******************************************************************************* * FUNCTION * RMMI_UART_GetOwnerID * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ module_type RMMI_UART_GetOwnerID(UART_PORT port) { #if !defined(__MTK_TARGET__) && defined(__RMMI_UT__) return MOD_ATCI; #else UART_CTRL_OWNER_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); //data.u4Port = port; //NEED_CONFIRM DclSerialPort_Control(handle, SIO_CMD_GET_OWNER_ID, (DCL_CTRL_DATA_T*) &data); return (module_type)(data.u4OwenrId); #endif }
kal_bool gps_UART_open(UART_PORT port, module_type ownerid) { DCL_HANDLE handle; UART_CTRL_OPEN_T data; DCL_STATUS status; data.u4OwenrId = ownerid; handle = DclSerialPort_Open(port, 0); status = DclSerialPort_Control(handle, SIO_CMD_OPEN, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); if(STATUS_OK != status) return KAL_FALSE; else return KAL_TRUE; }
/******************************************************************************* * FUNCTION * RMMI_UART_CtrlDCD * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ void RMMI_UART_CtrlDCD(UART_PORT port, IO_level SDCD, module_type ownerid) { UART_CTRL_DCD_T data; DCL_HANDLE handle = DclSerialPort_Open(port, 0); #if defined(__USB_MULTIPLE_COMPORT_SUPPORT__) if (KAL_FALSE == RMMI_UART_is_usb_cdc_acm(port)) { kal_brief_trace(TRACE_WARNING, WARNING_DIALUP_NOT_ALLOWED_ON_1T1R, port); return; } #endif /* __USB_MULTIPLE_COMPORT_SUPPORT__ */ data.u4OwenrId = ownerid; //data.u4Port = port; //NEED_CONFIRM data.rIOLevelDCD = (IO_LEVEL_T)SDCD; DclSerialPort_Control(handle, SIO_CMD_CTRL_DCD, (DCL_CTRL_DATA_T*) &data); }
void gps_UART_SetDCBConfig(DCL_DEV port, UART_CONFIG_T *UART_Config, DCL_UINT32 ownerid) { DCL_HANDLE handle; UART_CTRL_DCB_T data; data.u4OwenrId = ownerid; data.rUARTConfig.u4Baud = UART_Config->u4Baud; data.rUARTConfig.u1DataBits = UART_Config->u1DataBits; data.rUARTConfig.u1StopBits = UART_Config->u1StopBits; data.rUARTConfig.u1Parity = UART_Config->u1DataBits; data.rUARTConfig.u1FlowControl = UART_Config->u1FlowControl; data.rUARTConfig.ucXonChar = UART_Config->ucXonChar; data.rUARTConfig.ucXoffChar = UART_Config->ucXoffChar; data.rUARTConfig.fgDSRCheck = UART_Config->fgDSRCheck; handle = DclSerialPort_Open(port,0); DclSerialPort_Control(handle,SIO_CMD_SET_DCB_CONFIG, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Close(handle); }
/******************************************************************************* * FUNCTION * RMMI_UART_PutBytes * DESCRIPTION * * * PARAMETERS * * RETURNS * * GLOBALS AFFECTED * *******************************************************************************/ kal_uint16 RMMI_UART_PutBytes(UART_PORT port, kal_uint8 * Buffaddr, kal_uint16 Length, module_type ownerid) { UART_CTRL_PUT_BYTES_T data; DCL_HANDLE handle = DclSerialPort_Open(port,0); #if defined(__DUAL_TALK_MODEM_SUPPORT__) DCL_HANDLE gpio_handle; if (RMMI_PTR->wake_up_ap == KAL_FALSE) { kal_brief_trace(TRACE_INFO, INFO_PULL_GPIO, GPIO_CMD_WRITE_LOW); gpio_handle = DclGPIO_Open(DCL_GPIO, gpio_dtk_wakeup_pin); DclGPIO_Control(gpio_handle, GPIO_CMD_WRITE_LOW, NULL); rmmi_start_wakeup_timer_hdlr(RMMI_WAKE_UP_AP); RMMI_PTR->wake_up_ap = KAL_TRUE; } #endif data.u2Length = Length; data.u4OwenrId = ownerid; data.puBuffaddr = Buffaddr; DclSerialPort_Control(handle, SIO_CMD_PUT_BYTES, (DCL_CTRL_DATA_T*) &data); return data.u2RetSize; }
void SP_Strm_Audl_Handler( ilm_struct *ilm_ptr ) { switch (ilm_ptr->msg_id) { case MSG_ID_CMUX_DLC_CONNECT_IND: SP_Strm_Enable(ilm_ptr); break; case MSG_ID_UART_PLUGOUT_IND: SP_Strm_Disable(); break; case MSG_ID_SPEECH_ON_ACK: case MSG_ID_SPEECH_OFF_ACK: { UART_CTRL_CLR_BUFFER_T data; data.u4OwenrId = MOD_MED; DclSerialPort_Control( intSStrmControl->cmux_handle,SIO_CMD_CLR_RX_BUF, (DCL_CTRL_DATA_T*)&data); DclSerialPort_Control( intSStrmControl->cmux_handle,SIO_CMD_CLR_TX_BUF, (DCL_CTRL_DATA_T*)&data); break; } #if !defined(SS_UNIT_TEST) case MSG_ID_UART_READY_TO_READ_IND: case MSG_ID_STRM_SPEECH_UL_DATA_REQUEST: { UART_CTRL_GET_BYTES_T data; kal_uint8 status; if( intSStrmControl->ul_ready == KAL_TRUE ) return; data.u4OwenrId = MOD_MED; data.u2Length = WB_FRAME_SIZE * sizeof(kal_int16) - intSStrmControl->ul_sample_count; data.puBuffaddr = (DCL_UINT8 *)intSStrmControl->ul_pcm + intSStrmControl->ul_sample_count; data.pustatus = &status; DclSerialPort_Control( intSStrmControl->cmux_handle,SIO_CMD_GET_BYTES, (DCL_CTRL_DATA_T*)&data); kal_prompt_trace(MOD_L1SP,"Audl Get %d Bytes from CMUX, ori req %d", data.u2RetSize, data.u2Length); intSStrmControl->ul_sample_count += data.u2RetSize; if( intSStrmControl->ul_sample_count >= WB_FRAME_SIZE * sizeof(kal_int16) ) { intSStrmControl->ul_sample_count = 0; intSStrmControl->ul_ready = KAL_TRUE; } break; } case MSG_ID_UART_READY_TO_WRITE_IND: case MSG_ID_STRM_SPEECH_DL_DATA_NOTIFY: { UART_CTRL_PUT_BYTES_T data; data.u4OwenrId = MOD_MED; data.u2Length = WB_FRAME_SIZE * sizeof(kal_int16); data.puBuffaddr = (DCL_UINT8 *)intSStrmControl->dl_pcm; DclSerialPort_Control( intSStrmControl->cmux_handle, SIO_CMD_PUT_BYTES, (DCL_CTRL_DATA_T*)&data ); kal_prompt_trace(MOD_L1SP,"Audl Put %d Bytes to CMUX", data.u2RetSize); break; } #else case MSG_ID_STRM_SPEECH_UL_DATA_REQUEST: { break; } case MSG_ID_STRM_SPEECH_DL_DATA_NOTIFY: { //loopback from DL to UL directly. memcpy(SS_BUFF[ss_buf_idx & SS_BUF_MASK], intSStrmControl->dl_pcm, WB_FRAME_SIZE * sizeof(kal_int16)); memcpy(intSStrmControl->ul_pcm, SS_BUFF[(ss_buf_idx-7) & SS_BUF_MASK] , WB_FRAME_SIZE * sizeof(kal_int16)); ss_buf_idx++; kal_prompt_trace(MOD_L1SP, "ss_buf_idx", ss_buf_idx); break; } #endif default: ASSERT(0); } }
/* * FUNCTION * Drv_Init_Phase2 * * DESCRIPTION * This function is the NFB phase2 (Secondary ROM) initial function for * all device drivers. * This function is called once to initialize the device driver. * * CALLS * * PARAMETERS * None * * RETURNS * None * * GLOBALS AFFECTED * external_global * * NOTE XXX * All sub functions reference by this function should be placed on * Secondary ROM for NFB projects. */ void Drv_Init_Phase2(void) { DCL_HANDLE uart_handle; #ifdef __USB_COM_PORT_ENABLE__ DCL_CTRL_DATA_T data; #endif /*__USB_COM_PORT_ENABLE__*/ #ifndef DRV_RTC_NOT_EXIST DCL_HANDLE rtc_handler; #endif /*DRV_RTC_NOT_EXIST*/ #if defined(IC_BURNIN_TEST) || defined(DRV_MISC_GPT1_AS_OS_TICK) /*AB: Enable GPT1 for OS tick in the burn-in test load*/ extern void GPT_init(kal_uint8 timerNum, void (*GPT_Callback)(void)); extern void GPT_ResetTimer(kal_uint8 timerNum,kal_uint16 countValue,kal_bool autoReload); extern void GPT_Start(kal_uint8 timerNum); GPT_init(1, INT_Timer_Interrupt); GPT_ResetTimer(1, 4, KAL_TRUE); GPT_Start(1); #endif //IC_BURNIN_TEST //#ifdef __SWDBG_SUPPORT__ // UART_Register(uart_port_swdbg, UART_TYPE, (UartDriver_strcut *)&swdbgdrv); //#endif /* __SWDBG_SUPPORT__ */ #ifdef __USB_COM_PORT_ENABLE__ print_bootup_trace_enter(SST_INIT_DRV2_USB2UART); uart_handle = DclSerialPort_Open(uart_port_usb, 0); DclSerialPort_RegisterCallback(uart_handle, &USB2Uart_Drv_Handler); #if defined(__USB_MULTIPLE_COMPORT_SUPPORT__) uart_handle = DclSerialPort_Open(uart_port_usb2, 0); DclSerialPort_RegisterCallback(uart_handle, &USB2Uart_Drv_Handler); #if defined (__USB_MODEM_CARD_SUPPORT__) uart_handle = DclSerialPort_Open(uart_port_usb3, 0); DclSerialPort_RegisterCallback(uart_handle, &USB2Uart_Drv_Handler); #endif #endif DclSerialPort_Control(uart_handle,SIO_CMD_INIT,&data);// Initialization print_bootup_trace_exit(SST_INIT_DRV2_USB2UART); #endif /*__USB_COM_PORT_ENABLE__*/ //#if defined(__IRDA_SUPPORT__) && !defined(__MEUT__) && !defined(__MEIT__) /*TY adds this 2004/10/27*/ /* Register UART API */ // UART_Register(uart_port_irda, IRDA_TYPE, &ircomm_uart_api); //#endif #if defined(__BTMTK__) && (defined(__BT_SPP_PROFILE__) || defined(__BT_HFG_PROFILE__)) { kal_uint16 i; for(i = (kal_uint16)start_of_virtual_port; i < (kal_uint16)end_of_virtual_port + 1; i++) { uart_handle = DclSerialPort_Open((DCL_DEV)i, 0); DclSerialPort_RegisterCallback(uart_handle, &SPPA_Uart_Drv_Handler); } } #elif defined __CMUX_SUPPORT__ { kal_uint16 i; for(i = (kal_uint16)start_of_virtual_port; i < (kal_uint16)end_of_virtual_port + 1; i++) { uart_handle = DclSerialPort_Open((DCL_DEV)i, 0); DclSerialPort_RegisterCallback(uart_handle, &CmuxUart_Drv_Handler); } } #endif #ifndef DRV_KBD_NOT_EXIST print_bootup_trace_enter(SST_INIT_DRV2_KBD); DclSKBD_Initialize(); print_bootup_trace_exit(SST_INIT_DRV2_KBD); #endif /*DRV_KBD_NOT_EXIST*/ #ifndef DRV_RTC_NOT_EXIST print_bootup_trace_enter(SST_INIT_DRV2_RTCSW); rtc_handler = DclRTC_Open(DCL_RTC,FLAGS_NONE); DclRTC_Control(rtc_handler, RTC_CMD_INIT_TC_AL_INTR, (DCL_CTRL_DATA_T *)NULL); print_bootup_trace_exit(SST_INIT_DRV2_RTCSW); #endif /*DRV_RTC_NOT_EXIST*/ #ifdef __SIM_DRV_MULTI_DRV_ARCH__ print_bootup_trace_enter(SST_INIT_DRV2_SIM); DclSIM_Initialize(); print_bootup_trace_exit(SST_INIT_DRV2_SIM); #endif #if (defined( DRV_MULTIPLE_SIM) && (!defined(DRV_2_SIM_CONTROLLER))) print_bootup_trace_enter(SST_INIT_DRV2_SIMMT6302); sim_MT6302_init(); print_bootup_trace_exit(SST_INIT_DRV2_SIMMT6302); #endif #if (defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined (__MSDC_MSPRO__)) print_bootup_trace_enter(SST_INIT_DRV2_MSDC); #if !defined(DCL_MSDC_INTERFACE) MSDC_Initialize(); #else DclSD_Initialize(); #endif//!defined(DCL_MSDC_INTERFACE) print_bootup_trace_exit(SST_INIT_DRV2_MSDC); #if defined(__MSDC2_SD_MMC__) || defined(__MSDC2_SD_SDIO__) print_bootup_trace_enter(SST_INIT_DRV2_MSDC2); #if !defined(DCL_MSDC_INTERFACE) MSDC_Initialize2(); #endif//!defined(DCL_MSDC_INTERFACE) print_bootup_trace_exit(SST_INIT_DRV2_MSDC2); #endif//defined(__MSDC2_SD_MMC__) || defined(__MSDC2_SD_SDIO__) #endif//(defined(__MSDC_MS__) || defined(__MSDC_SD_MMC__) || defined (__MSDC_MSPRO__)) #ifdef IC_MODULE_TEST IC_ModuleTest_Start(); #endif /*IC_MODULE_TEST*/ print_bootup_trace_enter(SST_INIT_DRV2_EINTSWDBNC); EINT_SW_Debounce_Init(); print_bootup_trace_exit(SST_INIT_DRV2_EINTSWDBNC); #ifdef MT6218B/*only 6218B has this */ GCU_Disable_ReverseBit(); #endif #ifdef __SWDBG_SUPPORT__ /* initialize SWDBG */ print_bootup_trace_enter(SST_INIT_DRV2_SWDBG); swdbg_init(); print_bootup_trace_exit(SST_INIT_DRV2_SWDBG); #endif /* __SWDBG_SUPPORT__ */ /* Cipher/Hash engine initialize */ print_bootup_trace_enter(SST_INIT_DRV2_CHE); che_hw_init(); print_bootup_trace_exit(SST_INIT_DRV2_CHE); /* ISP/Camera initialize */ #if defined(ISP_SUPPORT) print_bootup_trace(SST_INIT_DRV2_CIS_ENTER); #if defined(__MM_DCM_SUPPORT__) DCM_Load(DYNAMIC_CODE_COMPRESS_CAMCAL, NULL, NULL); #endif CalInit(); #if defined(__MM_DCM_SUPPORT__) DCM_Unload(DYNAMIC_CODE_COMPRESS_CAMCAL); #endif print_bootup_trace(SST_INIT_DRV2_CIS_EXIT); #endif #ifdef __WIFI_SUPPORT__ print_bootup_trace_enter(SST_INIT_DRV2_WN); wndrv_HWinit(); print_bootup_trace_exit(SST_INIT_DRV2_WN); #endif //#if (defined(_USE_SCCB_V2_DRIVER_)) #if defined(DRV_I2C_25_SERIES) print_bootup_trace_enter(SST_INIT_DRV2_I2C); DclSI2C_Initialize(); print_bootup_trace_exit(SST_INIT_DRV2_I2C); #endif // PXS is init at phase2 because it is external devices // Currently, do NOT think it should be put in phase1 #if defined(__PXS_ENABLE__) && !defined(IC_MODULE_TEST) && !defined(IC_BURNIN_TEST) DclPXS_Initialize(); #endif // #if defined(__PXS_ENABLE__) && !defined(IC_MODULE_TEST) && !defined(IC_BURNIN_TEST) #if defined(__L1_STANDALONE__)&&defined(__CLKG_DEFINE__)&&!defined(IC_BURNIN_TEST) mm_disable_power(MMPWRMGR_LCD); #endif #ifdef CAS_SMD_SUPPORT print_bootup_trace_enter(SST_INIT_DRV2_ICC); DalIccInit(); print_bootup_trace_exit(SST_INIT_DRV2_ICC); #endif #if 0 // Init BTIF_HWInit_VFIFO(); in bluetooth module #if defined(__BTMODULE_MT6236__) /* under construction !*/ /* under construction !*/ /* under construction !*/ #elif defined(__BTMODULE_MT6256__) || defined(__BTMODULE_MT6276__) /* under construction !*/ #endif /* under construction !*/ #endif // 0 #if defined(__HW_PFC_SUPPORT__) print_bootup_trace_enter(SST_INIT_DRV2_PFC); DclPFC_Initialize(); print_bootup_trace_exit(SST_INIT_DRV2_PFC); #endif //#if defined(__HW_PFC_SUPPORT__) #ifdef DRV_HIF_SUPPORT hif_init(); #endif #ifdef DRV_SPI_SUPPORT spi_init(); #endif #if defined(TOUCH_PANEL_SUPPORT) DclSTS_Initialize();//always call --- remove the init function from touch_panel_main() #endif #if defined(MOTION_SENSOR_SUPPORT) print_bootup_trace_enter(SST_INIT_DRV2_MSENS); motion_sensor_init(); print_bootup_trace_exit(SST_INIT_DRV2_MSENS); #endif brt_drv_init(); }
void Drv_Init_Phase1(void) { #if defined(DRV_GPT_GPT3) DCL_HANDLE gpt_handle; #endif //defined(DRV_GPT_GPT3) #ifndef DRV_RTC_NOT_EXIST DCL_HANDLE rtc_handler; #endif //#ifndef DRV_RTC_NOT_EXIST DCL_HANDLE uart_handle; UART_CTRL_INIT_T data_init; extern Seriport_HANDLER_T Uart_Drv_Handler; #ifdef __USB_COM_PORT_ENABLE__ DCL_HANDLE usb_dcl_handle; DCL_BOOL dcl_data; kal_bool b_is_dl_mode; usb_dcl_handle = DclUSB_DRV_Open(DCL_USB, FLAGS_NONE); DclUSB_DRV_Control(usb_dcl_handle, USB_DRV_CMD_USBDL_UPDATE_USB_DL_MODE, NULL); DclUSB_DRV_Control(usb_dcl_handle, USB_DRV_CMD_USBDL_IS_USB_DL_MODE, (DCL_CTRL_DATA_T *)&dcl_data); b_is_dl_mode = (kal_bool)dcl_data; if(b_is_dl_mode == KAL_TRUE) { UPLL_Enable(UPLL_OWNER_USB); } DclUSB_DRV_Close(usb_dcl_handle); #endif //__USB_COM_PORT_ENABLE__ #if defined(__HW_US_TIMER_SUPPORT__ ) USC_Start(); #endif #ifdef __BACKUP_DOWNLOAD_RESTORE_WITHOUT_BATTERY__ if (INT_GetSysStaByCmd(CHK_USB_META_WO_BAT, NULL)==KAL_TRUE) { DCL_HANDLE handle; DclPMU_Initialize(); handle = DclPMU_Open(DCL_PMU, FLAGS_NONE); DclPMU_Control(handle, CHR_SET_CHARGE_WITHOUT_BATTERY, NULL); DclPMU_Close(handle); } #endif //#ifdef __BACKUP_DOWNLOAD_RESTORE_WITHOUT_BATTERY__ print_bootup_trace_enter(SST_INIT_DRV1_DRVHISR); drv_hisr_init(); print_bootup_trace_exit(SST_INIT_DRV1_DRVHISR); #if defined(__DSP_FCORE4__) print_bootup_trace_enter(SST_INIT_DRV1_MDCIHW); mdci_hw_init(1,0x0); print_bootup_trace_exit(SST_INIT_DRV1_MDCIHW); #endif #if defined(__SMART_PHONE_MODEM__) print_bootup_trace_enter(SST_INIT_DRV1_CCCI); ccif_init(1,0x0); ipc_msgsvc_init(); FS_CCCI_Init(); ccci_init(CCCI_FS_CHANNEL, FS_CCCI_Callback); ccci_init(CCCI_FS_ACK_CHANNEL, FS_CCCI_Callback); uart_handle = DclSerialPort_Open(uart_port_tst_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); uart_handle = DclSerialPort_Open(uart_port_at_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); #if defined(__UPS_SUPPORT__) uart_handle = DclSerialPort_Open(uart_port_ccmni1_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); uart_handle = DclSerialPort_Open(uart_port_ccmni2_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); uart_handle = DclSerialPort_Open(uart_port_ccmni3_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); #endif /* __UPS_SUPPORT__ */ uart_handle = DclSerialPort_Open(uart_port_gps_ccci, 0); DclSerialPort_RegisterCallback(uart_handle, &CCCI_Uart_Drv_Handler); print_bootup_trace_exit(SST_INIT_DRV1_CCCI); #endif /* __SMART_PHONE_MODEM__ */ #if defined(DRV_EMIMPU) print_bootup_trace_enter(SST_INIT_DRV1_EMIMPU); emimpu_init(); print_bootup_trace_exit(SST_INIT_DRV1_EMIMPU); #endif /* DRV_EMIMPU */ print_bootup_trace_enter(SST_INIT_DRV1_LPWR); lpwr_init(); print_bootup_trace_exit(SST_INIT_DRV1_LPWR); print_bootup_trace_enter(SST_INIT_DRV1_DRVPDN); DRVPDN_ini(); print_bootup_trace_exit(SST_INIT_DRV1_DRVPDN); print_bootup_trace_enter(SST_INIT_DRV1_PWM); DclPWM_Initialize(); print_bootup_trace_exit(SST_INIT_DRV1_PWM); /*To get all customized data*/ print_bootup_trace_enter(SST_INIT_DRV1_CUSTOM); DclSADC_Initialize(); Drv_Customize_Init(); custom_drv_init(); print_bootup_trace_exit(SST_INIT_DRV1_CUSTOM); #if defined(DRV_GPT_GPT3) print_bootup_trace_enter(SST_INIT_DRV1_GPT3); /*turn on gpt3 to count powen on period*/ DclFGPT_Initialize(); gpt_handle=DclFGPT_Open(DCL_GPT_FreeRUN3,0); DclFGPT_Control(gpt_handle,FGPT_CMD_START,0); DclFGPT_Close(gpt_handle); print_bootup_trace_exit(SST_INIT_DRV1_GPT3); #endif #if !defined(__L1_STANDALONE__) && !defined(__MAUI_BASIC__) && !defined(__SMART_PHONE_MODEM__) print_bootup_trace_enter(SST_INIT_DRV1_VISUAL); Visual_Init(); print_bootup_trace_exit(SST_INIT_DRV1_VISUAL); #endif /*!defined(__L1_STANDALONE__) && !defined(__MAUI_BASIC__) && !defined(__SMART_PHONE_MODEM__)*/ #if defined(DRV_TIMING_DEBUG) && defined(DRV_GPT_6218B_GPT3_TIMING_DEBUG) DRV_MISC_WriteReg(0x8010001c,1); DRV_MISC_WriteReg(0x80100024,0x04); //DRV_WriteReg(0x80100024,1); // (1/16K) #endif #ifdef DRV_MISC_DMA_NO_MEMCPY DRV_MEMCPY = (MEMCPY_FUNC)0x48000150; #elif defined(DRV_MISC_DMA_MEMCPY) DRV_MEMCPY_PTR = (MEMCPY_FUNC)0x48000134; #endif print_bootup_trace_enter(SST_INIT_DRV1_GPTI); DclSGPT_Initialize(); print_bootup_trace_exit(SST_INIT_DRV1_GPTI); print_bootup_trace_enter(SST_INIT_DRV1_WDT); WDT_init(); print_bootup_trace_exit(SST_INIT_DRV1_WDT); print_bootup_trace_enter(SST_INIT_DRV1_DMA); DMA_Ini(); print_bootup_trace_exit(SST_INIT_DRV1_DMA); #ifndef DRV_RTC_NOT_EXIST // need to set XOSC earlier print_bootup_trace_enter(SST_INIT_DRV1_XOSC); rtc_handler = DclRTC_Open(DCL_RTC,FLAGS_NONE); DclRTC_Control(rtc_handler, RTC_CMD_SETXOSC, (DCL_CTRL_DATA_T *)NULL); print_bootup_trace_exit(SST_INIT_DRV1_XOSC); #endif /*DRV_RTC_NOT_EXIST*/ print_bootup_trace_enter(SST_INIT_DRV1_ADC); DclHADC_Initialize( ); print_bootup_trace_exit(SST_INIT_DRV1_ADC); #ifdef __CS_FAC_DET__ print_bootup_trace_enter(SST_INIT_DRV1_CSFACDET); cs_fac_det = cs_fac_det_get_interface(); cs_fac_det->drv_init(); print_bootup_trace_exit(SST_INIT_DRV1_CSFACDET); #endif // #ifdef __CS_FAC_DET__ #ifdef __DRV_EXT_ACCESSORY_DETECTION__ #ifdef __USB_COM_PORT_ENABLE__ usb_dcl_handle = DclUSB_DRV_Open(DCL_USB, FLAGS_NONE); DclUSB_DRV_Control(usb_dcl_handle, USB_DRV_CMD_USBDL_IS_USB_DL_MODE, (DCL_CTRL_DATA_T *)&dcl_data); b_is_dl_mode = (kal_bool)dcl_data; DclUSB_DRV_Close(usb_dcl_handle); if(b_is_dl_mode == KAL_FALSE) #endif { print_bootup_trace_enter(SST_INIT_DRV1_EXTACCDET); aux_ext_acc_det = aux_custom_get_ext_accessory_det(); aux_ext_acc_det->drv_init(); print_bootup_trace_exit(SST_INIT_DRV1_EXTACCDET); } #endif // #ifdef __DRV_EXT_ACCESSORY_DETECTION__ //#if (defined(__ACCDET_SUPPORT__) && !defined(__L1_STANDALONE__)) print_bootup_trace_enter(SST_INIT_DRV1_ACCDET); DclAUX_Initialize(); print_bootup_trace_exit(SST_INIT_DRV1_ACCDET); //#endif //#if defined(__ACCDET_SUPPORT__) #if defined(__RESOURCE_MANAGER__) print_bootup_trace_enter(SST_INIT_DRV1_RM); RMInit(); print_bootup_trace_exit(SST_INIT_DRV1_RM); #endif //__RESOURCE_MANAGER__ #ifndef DRV_LCD_NOT_EXIST print_bootup_trace_enter(SST_INIT_DRV1_LCD); lcd_system_init(); print_bootup_trace_exit(SST_INIT_DRV1_LCD); #endif /*DRV_LCD_NOT_EXIST*/ #ifndef DRV_RTC_NOT_EXIST #ifdef DRV_RTC_HW_CALI print_bootup_trace_enter(SST_INIT_DRV1_RTCHW); DclRTC_Control(rtc_handler, RTC_CMD_HW_INIT, (DCL_CTRL_DATA_T *)NULL); print_bootup_trace_exit(SST_INIT_DRV1_RTCHW); #endif #endif /*DRV_RTC_NOT_EXIST*/ DclPW_Initialize(); DclPMU_Initialize(); Drv_PW_Init(); /* update the system boot mode */ /*lint -e552*/ system_boot_mode = Drv_query_boot_mode(); /*lint +e552*/ print_boot_mode(); #ifdef __DMA_UART_VIRTUAL_FIFO__ // print_bootup_trace_enter(SST_INIT_DRV1_DMAVFIFO); // DMA_Vfifo_init(); // print_bootup_trace_exit(SST_INIT_DRV1_DMAVFIFO); #if defined(__MD_STANDALONE__) // This is to configure AP side VFIFO ALT register, to avoid un-init AP side DMA setting // conflict MD side setting // This is only used in MD DVT load, when both side are ready, we shouldn't overwrite AP side setting via back door // Hack DMA channel 13 (VFIFO channel) in AP side in order to avoid conflict *(volatile kal_uint32 *)(0xF0022000 + 0xD40) = 0x3F; // Hack DMA channel 14 (VFIFO channel) in AP side in order to avoid conflict *(volatile kal_uint32 *)(0xF0022000 + 0xE40) = 0x3F; #endif // #if defined(__MD_STANDALONE__) #endif print_bootup_trace_enter(SST_INIT_DRV1_UART1); data_init.u4Flag = KAL_FALSE; uart_handle = DclSerialPort_Open(uart_port1, 0); DclSerialPort_RegisterCallback(uart_handle, &Uart_Drv_Handler); // Initialization DclSerialPort_Control(uart_handle,SIO_CMD_INIT,(DCL_CTRL_DATA_T *)&data_init); print_bootup_trace_exit(SST_INIT_DRV1_UART1); // Register the callback function print_bootup_trace_enter(SST_INIT_DRV1_UART2); uart_handle = DclSerialPort_Open(uart_port2, 0); DclSerialPort_RegisterCallback(uart_handle, &Uart_Drv_Handler); // Initialization DclSerialPort_Control(uart_handle,SIO_CMD_INIT,(DCL_CTRL_DATA_T *)&data_init); print_bootup_trace_exit(SST_INIT_DRV1_UART2); #ifdef __UART3_SUPPORT__ print_bootup_trace_enter(SST_INIT_DRV1_UART3); // Register the callback function uart_handle = DclSerialPort_Open(uart_port3, 0); DclSerialPort_RegisterCallback(uart_handle,&Uart_Drv_Handler); DclSerialPort_Control(uart_handle,SIO_CMD_INIT,(DCL_CTRL_DATA_T *)&data_init); print_bootup_trace_exit(SST_INIT_DRV1_UART3); #endif }