概述
1:关于wifi 总线sdio的配置,前面的博客已经说过
2:这一章主要描述wifi移植
WL_REG_ON 主要用于上电,休眠的时候,请保持该GPIO上电,否则会丢失wifi内部的状态,导致wifi唤醒失败;
WL_HOST_WAKE 主要用于wifi设备有数据的时候,唤醒CPU,进入中断,关于中断流程上面已经说过。
3:主要包含的文件有:
1>: bcmdhd.ko wifi驱动模块
2>:fw_bcmdhd_bin; wifi固件
3>nvram.txt wifi的配置信息
4>dhd 或者wl 用于用户测试
4:make menuconfig
CONFIG_CFG80211=m
使用cfg80211.ko
5:将驱动加入内核 kernel/driver/net/wireless/bcmdhd/
6: 在kernel/driver/net/wireless/Kconfig
加入 source "driver/net/wireless/bcmdhd/Kconfig"
7: 在kernel/driver/net/wireless/Makefile
加入 obj-$(CONFIG_BCMDHD) += bcmdhd/
8:make menuconfig
9:wifi GPIO配置 host_wake
WL_REG_ON
10:修改BroadConfig.mk
# Wifi
BOARD_WLAN_VENDOR := broadcom
#for broadcom vendor
ifeq ($(BOARD_WLAN_VENDOR),broadcom)
BOARD_WLAN_DEVICE := bcmdhd
WPA_SUPPLICANT_VERSION := VER_0_8_X
TARGET_KERNEL_MODULES :=
kernel_imx/drivers/net/wireless/bcmdhd/bcmdhd.ko:system/lib/modules/bcmdhd.ko
kernel_imx/net/wireless/cfg80211.ko:system/lib/modules/cfg80211.ko
BOARD_WPA_SUPPLICANT_DRIVER := NL80211
BOARD_HOSTAPD_DRIVER := NL80211
BOARD_HOSTAPD_PRIVATE_LIB_BCM := lib_driver_cmd_bcmdhd
BOARD_WPA_SUPPLICANT_PRIVATE_LIB_BCM := lib_driver_cmd_bcmdhd
WIFI_DRIVER_FW_PATH_PARAM := "/sys/module/bcmdhd/parameters/firmware_path"
WIFI_DRIVER_MODULE_PATH := "/system/lib/modules/bcmdhd.ko"
WIFI_DRIVER_MODULE_NAME := "bcmdhd"
WIFI_DRIVER_MODULE_ARG := "iface_name=wlan firmware_path=/system/vendor/firmware/fw_bcmdhd.bin nvram_path=/system/vendor/firmware/nvram.txt"
SW_BOARD_USR_WIFI := bcm4335
WIFI_DRIVER_FW_PATH_STA := "/system/vendor/firmware/fw_bcmdhd.bin"
WIFI_DRIVER_FW_PATH_AP := "/system/vendor/firmware/fw_bcmdhd_ap.bin"
BCM_NVRAM_SRC_FILE := "/system/vendor/firmware/nvram.txt"
BCM_CONFIG_SRC_FILE := "/system/etc/firmware/config.txt"
11:修改init.rc
service p2p_supplicant /system/bin/wpa_supplicant
-ip2p0 -Dnl80211 -c/data/misc/wifi/p2p_supplicant.conf
-I/system/etc/wifi/p2p_supplicant_overlay.conf -N
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf
-I/system/etc/wifi/wpa_supplicant_overlay.conf
-O/data/misc/wifi/sockets -puse_p2p_group_interface=1
-e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
class main
socket wpa_wlan0 dgram 660 wifi wifi
disabled
oneshot
service wpa_supplicant /system/bin/wpa_supplicant
-iwlan0 -Dnl80211 -c/data/misc/wifi/wpa_supplicant.conf
-I/system/etc/wifi/wpa_supplicant_overlay.conf
-O/data/misc/wifi/sockets
-e/data/misc/wifi/entropy.bin -g@android:wpa_wlan0
socket wpa_wlan0 dgram 660 wifi wifi
class main
disabled
oneshot
wpa_ctil 与wpa_supplicant 主要使用socket通信,套接字目录:
1:/dev/socket/wpa_wlan0
2:/data/misc/wifi/sockets/
int wifi_connect_on_socket_path(const char *path)
{
char supp_status[PROPERTY_VALUE_MAX] = {'