wifi移植

平台:全志 A40I
源码:Android 7.1  Linux 3.10
模块:AP6255    台湾正基模块,美国博通方案

固件(系列不同,固件不同) + 驱动(原厂提供,一般通用)
固件:Android/hardware/broadcom/wlan/bcmdhd/firmware/
驱动: Android\out\target\product\a40-p1\system\vendor\modules


WiFi 
--------------------------------------------------------------------------------------------------
接口: USB   SDIO 
功能:station        softap         wifi direct
    
    
正基驱动:            lichee\linux-3.10\drivers\net\wireless\bcmdhd
电源与GPIO控制API:    lichee\linux-3.10\drivers\misc\sunxi-rf\sunxi-wlan.c.c
                    linux-3.10\drivers\misc\sunxi-rf\sunxi-wlan.c

正基固件:            fw_bcm43456c5_ag.bin
(AP62565)            fw_bcm43456c5_ag_apsta.bin
                    fw_bcm43456c5_ag_p2p.bin
                    BCM4345C5.hcd
                    config.txt
                    device-bcm.mk
    

    #.config  
        1.一定要注意下面一定要改过来呀!!!
            CONFIG_BCMDHD_FW_PATH="/system/vendor/modules/fw_bcm43456c5_ag.bin"
            CONFIG_BCMDHD_NVRAM_PATH="/system/vendor/modules/nvram_ap6256.txt"

     
    # BoardConfig.mk (android\device\softwinner\a40-p1)   /   wifi_hardware_info.c(无)
        (决定 android 要加载哪一款 wifi 模组、是否开启蓝牙和使用哪一款蓝牙模组)
        1.把ap对应的固件编译进去   //include hardware/broadcom/wlan/bcmdhd/firmware/ap6255/device-bcm.mk
        

        
    # config.xml (\android\device\softwinner\tulip-t1\overlay\frameworks\base\core\res\res\values\config.xml)       
        (要打开 WIFI 功能, 需要在 config.xml 中把 WIFI 网口打开)
            
      <string-array translatable="false" name="networkAttributes">
        <item>"wifi,1,1,1,-1,true"</item>
        <item>"mobile,0,0,0,-1,true"</item>
        <item>"wifi_p2p,13,1,0,-1,true"</item>
        <item>"bluetooth,7,7,1,60000,true"</item>
        <item>"ethernet,9,9,2,-1,true"</item>
      </string-array>
    
        1.还可以配置wifi模块的三种模式
        
        
    # init.rc(android\system\core\rootdir\init.rc) 
    (资源和服务配置相关的文件)
        1.开机脚本加载驱动    
        
        

    # bt_vendor.conf    (android\device\softwinner\a40-p1\configs\bluetooth)
        (蓝牙配置文件 设置波特率,uart 设备文件和 firmware 路径(初始值),调试信息配置)
        UartPort = /dev/ttyS3(这个是蓝牙模块的串口,需根据硬件配置)
        FwPatchFilePath = /system/vendor/modules/(这个表示蓝牙hcd固件所放的位置)
        FwPatchFileName = BCM4345C0.hcd (指定蓝牙hcd固件)
        
        
    # hostapd.conf  (lichee\linux-3.10\Documentation\networking\mac80211_hwsim\hostapd.conf)
        (配置AP5G模式)
    
        
    # bdroid_buildcfg.h     (android\device\softwinner\tulip-t1\bluetooth\bdroid_buildcfg.h)
        (配置打开蓝牙时显示的本机名字)
        

    # sys_config.fex
        (设备树)



--------------------------------------------------------------------------------------------------

AP模式网段:  AP_2.4  AP_5
    AP_2.4: 信号频宽较窄干扰差,穿透能力强,传播距离远
    AP_5:   信号频宽较宽抗干扰,穿透能力弱,传播距离近

    
--------------------------------------------------------------------------------------------------    
    
正基驱动跟读:
    dhd_linux.c    
        dhd_module_init为驱动模块初始化函数,调用dhd_linux_platdev.c中dhd_wifi_platform_register_drv查找设备,注册驱动等
    dhd_linux_platdev.c
        
    
--------------------------------------------------------------------------------------------------    
    
开发过程问题:
1. dhd_gpio.c:134:25: error: ‘wlan_bus_index’ undeclared (first use in this function):已解决
2. dhd_gpio.c:174:2: error: implicit declaration of function ‘sunxi_wlan_custom_mac_address’:已解决
3. 驱动放入脚本init.rc,系统启动无加载成功:已解决    
4. Android的AP模式有时出现有时消失
5. wifi sta正常,蓝牙不通:已解决    
6. 设备sta连接路由器wifi的5G频段容易掉线?
    
    

--------------------------------------------------------------------------------------------------    
    
优质博客:https://blog.csdn.net/ylyuanlu/article/details/7711396
          https://blog.csdn.net/gabbzang/article/details/11100211
          https://blog.csdn.net/fenzhi1988/article/details/44809779
          https://blog.csdn.net/zpzyf/article/details/53326545


1.无论USB接口还是SDIO接口,驱动都能做到自适应
2./system/vendor/modules (存放驱动和固件)



BT
--------------------------------------------------------------------------------
接口:    UART




#蓝牙不通?
    示波器检测蓝牙 BT_RTS_N (34引脚) 
        调试打开BT,查看 BT_RTS_N  是不是高电平? 正常高电平,异常中间会跳变为低电平
    解决:wifi固件影响引脚,更新了最新固件正常






笔记:
--------------------------------------------------------------------------------
wifi编译成了模块
a40-p1:/vendor/modules
蓝牙对应的设备节点为/dev/ttyS3
pl2303解决方案:
https://jingyan.baidu.com/album/3d69c551585b89f0cf02d7b2.html?picindex=7

 

 

1. .config
CONFIG_BCMDHD_FW_PATH="/system/vendor/modules/fw_bcm43456c5_ag.bin"
CONFIG_BCMDHD_NVRAM_PATH="/system/vendor/modules/nvram_ap6256.txt"


2. android\hardware\broadcom\wlan\bcmdhd\firmware
加入AP6256固件


3. F:\F3\android\device\softwinner\a40-p1
修改BoardConfig.mk


4. lichee\tools\pack\chips\sun8iw11p1\configs\a40-p1
打开bt


5. android\system\core\rootdir\init.rc
脚本加载驱动


6. android\device\softwinner\a40-p1\configs\bluetooth\rtkbt.conf
BtDeviceNode=/dev/ttyS3


7. F:\F3\android\device\softwinner\a40-p1
BoardConfig.mk
BOARD_HAVE_BLUETOOTH_NAME := ap6255 这个问题很奇怪,待搞透

 

posted @ 2019-09-04 19:09  panda_w  阅读(2551)  评论(0编辑  收藏  举报