Exemplo n.º 1
0
sint8 m2m_wifi_init(tstrWifiInitParam * param)
{
	sint8 ret = M2M_SUCCESS;

	gpfAppWifiCb = param->pfAppWifiCb;

#ifdef ETH_MODE
 	gpfAppEthCb  	    = param->strEthInitParam.pfAppEthCb;
	gau8ethRcvBuf       = param->strEthInitParam.au8ethRcvBuf;
	gu16ethRcvBufSize	= param->strEthInitParam.u16ethRcvBufSize;
#endif

#ifdef CONF_MGMT
	gpfAppMonCb  = param->pfAppMonCb;
#endif
	gu8scanInProgress = 0;
	/* Apply device specific initialization. */
	ret = nm_drv_init(NULL);
	if(ret != M2M_SUCCESS) 	goto _EXIT0;
	/* Initialize host interface module */
	ret = hif_init(NULL);
	if(ret != M2M_SUCCESS) 	goto _EXIT1;

	hif_register_cb(M2M_REQ_GRP_WIFI,m2m_wifi_cb);

	return ret;

_EXIT1:
	nm_drv_deinit(NULL);
_EXIT0:
	return ret;
}
void xmpl_init(void)
{
    LED_INIT();
    hif_init(HIF_DEFAULT_BAUDRATE);
    timer_init();
    sei();
}
Exemplo n.º 3
0
sint8 m2m_wifi_init(tstrWifiInitParam * param)
{
	tstrM2mRev strtmp;
	sint8 ret = M2M_SUCCESS;
	uint8 u8WifiMode = M2M_WIFI_MODE_NORMAL;
	
	if(param == NULL) {
		ret = M2M_ERR_FAIL;
		goto _EXIT0;
	}
	
	gpfAppWifiCb = param->pfAppWifiCb;

#ifdef ETH_MODE
	gpfAppEthCb  	    = param->strEthInitParam.pfAppEthCb;
	gau8ethRcvBuf       = param->strEthInitParam.au8ethRcvBuf;
	gu16ethRcvBufSize	= param->strEthInitParam.u16ethRcvBufSize;
	u8WifiMode = param->strEthInitParam.u8EthernetEnable;
#endif /* ETH_MODE */

#ifdef CONF_MGMT
	gpfAppMonCb  = param->pfAppMonCb;
#endif
	gu8scanInProgress = 0;
	/* Apply device specific initialization. */
	ret = nm_drv_init(&u8WifiMode);
	if(ret != M2M_SUCCESS) 	goto _EXIT0;
	/* Initialize host interface module */
	ret = hif_init(NULL);
	if(ret != M2M_SUCCESS) 	goto _EXIT1;

	hif_register_cb(M2M_REQ_GROUP_WIFI,m2m_wifi_cb);

	ret = nm_get_firmware_info(&strtmp);

	M2M_INFO("Firmware ver   : %u.%u.%u\n", strtmp.u8FirmwareMajor, strtmp.u8FirmwareMinor, strtmp.u8FirmwarePatch);
	M2M_INFO("Min driver ver : %u.%u.%u\n", strtmp.u8DriverMajor, strtmp.u8DriverMinor, strtmp.u8DriverPatch);
	M2M_INFO("Curr driver ver: %u.%u.%u\n", M2M_DRIVER_VERSION_MAJOR_NO, M2M_DRIVER_VERSION_MINOR_NO, M2M_DRIVER_VERSION_PATCH_NO);
	if(M2M_ERR_FW_VER_MISMATCH == ret)
	{
		M2M_ERR("Mismatch Firmawre Version\n");
	}

	goto _EXIT0;

_EXIT1:
	nm_drv_deinit(NULL);
_EXIT0:
	return ret;
}
Exemplo n.º 4
0
void app_init(void)
{
    LED_INIT();
    KEY_INIT();
    hif_init(HIF_DEFAULT_BAUDRATE);
    timer_init();
    radio_init(RxFrame, sizeof(RxFrame));
    radio_set_state(STATE_OFF);
    radio_set_param(RP_CHANNEL(CHANNEL));
    radio_set_param(RP_IDLESTATE(STATE_RXAUTO));
    radio_set_param(RP_SHORTADDR(RT_ADDR));
    radio_set_param(RP_PANID(RT_PANID));
#if RADIO_TYPE == RADIO_AT86RF212
    radio_set_param(RP_DATARATE(OQPSK100));
#endif
}
Exemplo n.º 5
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();
}