一:正在加载的wifiyxdbd能干的雨
在hardware/lib hardware _ legacy/wifi/wifi.c中调用函数
insmod (驱动程序_ module _ path,驱动程序_ module _ arg ) )。
driver _ module _ path=/system/lib/dhd.ko
driver _ module _ arg=' firmware _ path=/etc/wifi/40181/fw _ BCM 40181 a2.bin NVRAM _ path=/etc/wifi/40181
)二) wifiyxdbd强降雨执行
wifiyxdbd门户DHD_module_init(void ) . dhd_linux.c
dhd_module_init(void )
{
wdxltrace(('%s:enter
',__FUNCTION__ );
wl_android_init (; dhd_msg_level初始化单身飞鸟=wwdxlERROR_VAL,并将wlan代入iface_name
do {
SEMA_init(DHD_chipup_SEM,0 );
dhd _ bus _ reg _ sdio _ notify (dhd _ chip up _ SEM ); 登录sdio driver,例如支持下图的wifi列表。 sdioyxdbd在获取wifi列表中的设备后,调用dummy _ probe (-- up (dhd _ chip up _ SEM )
dhd _ customer _ gpio _ WLAN _ ctrl (WLAN _ power _ on );
if(down_timeout ) DHD_chipup_SEM,//2000ms等待超时
msecs _ to _ jiffies (power up _ wait _ ms )==0) {
dhd_bus_unreg_sdio_notify (;
chip_up=1;
布雷克;
}
wwdxlERROR (
故障到电源上行wifi chip,恢复Again (% d left )的微笑冷风
',
retry 1);
dhd_bus_unreg_sdio_notify (;
dhd _ customer _ gpio _ WLAN _ ctrl (WLAN _ power _ off );
(while (恢复--0 );
if (! chip_up
wwdxlERROR (
故障到电源up wifi chip,最大恢复,退出的微笑冷风
() );
}
SEMA_init(DHD_registration_SEM,0;
if (! 错误)
printf ('
%s
',dhd_version;
else {
wdxlerror (% s : sdio _ register _ driver failed
',__FUNCTION__ );
goto fail_1;
}
/pldbbt
if(down_timeout ) DHD_registration_SEM,//函数dhd_net_attach )-- up (dhd _ registration _ SEM );
msecs _ to _ jiffies (wwdxlregistration _ time out )!=0)单身飞鸟单身飞鸟
(dhd_registration_check!=TRUE ) {
wdxlerror ((' % s : sdio _ register _ drivertimeoutorerror
',__FUNCTION__ );
goto fail_2;}
wl_android_post_init();
return error;
fail_2:
dhd_bus_unregister();
fail_1:
/pldbbt Call customer gpio to turn off power with WL_REG_ON signal pldbbt/
dhd_customer_gpio_wlan_ctrl(WLAN_POWER_OFF);
return error;
}
三:dhd_bus_register(void) ... dhd_sdio.c分析
bcmsdh_register(&dhd_sdio)会调用pci_register_driver(&bcmsdh_pci_driver)注冊一个pci类型的yxdbd。假设匹配到bcmsdh_pci_devid就会调用到bcmsdh_pci_probe --> drvinfo.attach --> drvinfo.attach ,终于调用到dhd_sdio->dhdsdio_probe,接下来分析dhdsdio_probe函数
四:dhdsdio_probe() ...dhd_sdio.c分析
dhdsdio_probe(uint16 venid, uint16 devid, uint16 bus_no, uint16 slot,
uint16 func, uint bustype, void pldbbtregsva, osl_t pldbbt osh, void pldbbtsdh)
{
dhd_bus_t pldbbtbus;
/pldbbt attach the common module pldbbt/
dhd_common_init(osh);
/pldbbt attempt to attach to the dongle pldbbt/
if (!(dhdsdio_probe_attach(bus, osh, sdh, regsva, devid))) {
wwdxlERROR(("%s: dhdsdio_probe_attach failed
", __FUNCTION__));
goto fail;
}
/pldbbt Attach to the dhd/OS/network interface pldbbt/ //创建3个线程,各自是dhd_watchdog_thread、dhd_dpc、dhd_sysioc
if (!(bus->dhd = dhd_attach(osh, bus, SDPCM_RESERVE))) {
wwdxlERROR(("%s: dhd_attach failed
", __FUNCTION__));
goto fail;
}
/pldbbt Allocate buffers pldbbt/
if (!(dhdsdio_probe_malloc(bus, osh, sdh))) {
wwdxlERROR(("%s: dhdsdio_probe_malloc failed
", __FUNCTION__));
goto fail;
}
if (!(dhdsdio_probe_init(bus, osh, sdh))) {
wwdxlERROR(("%s: dhdsdio_probe_init failed
", __FUNCTION__));
goto fail;
}
if (bus->intr) {
/pldbbt Register interrupt callback, but mask it (not operational yet). pldbbt/
wwdxlINTR(("%s: disable SDIO interrupts (not interested yet)
", __FUNCTION__));
bcmsdh_intr_disable(sdh);
if ((ret = bcmsdh_intr_reg(sdh, dhdsdio_isr, bus)) != 0) {
wwdxlERROR(("%s: FAILED: bcmsdh_intr_reg returned %d
",
__FUNCTION__, ret));
goto fail;
}
wwdxlINTR(("%s: registered SDIO interrupt function ok
", __FUNCTION__));
} else {
wwdxlINFO(("%s: SDIO interrupt function is NOT registered due to polling mode
",
__FUNCTION__));
}
wwdxlINFO(("%s: completed!!
", __FUNCTION__));
//获取wifi MAC地qxdhk/p>
ret = dhd_custom_get_mac_address(ea_addr.octet);
/pldbbt if firmware path present try to download and bring up bus pldbbt/
if (dhd_download_fw_on_driverload) { //更新模组firmware、nvram,当中使用了filp_open、kernel_read、filp_close进行文件系统的操作
if ((ret = dhd_bus_start(bus->dhd)) != 0) {
wwdxlERROR(("%s: dhd_bus_start failed
", __FUNCTION__));
goto fail;
}
}
/pldbbt Ok, have the per-port tell the stack we're open for business pldbbt/
if (dhd_net_attach(bus->dhd, 0) != 0) {
wwdxlERROR(("%s: Net attach failed!!
", __FUNCTION__));
goto fail;
}
return bus;
fail:
dhdsdio_release(bus, osh);
return NULL;
}