usb wifi移植

1、 内核配置

硬件上将USB的ID引脚接地

内核将DM365的USB配置成USB HOST工作模式

[*] USB_SUPPORT --->

<*>Inventra Highspeed Dual Role Controller (TI,ADI,...)

        *****Platform Glue Layer

<*>      Davinci

            Driver Mode  (USB Host)   ---->

配置DM368开启wifi的配置项

网络协议配置开启80211相关协议

[*] Networking support  --->

  -*-   Wireless  --->  

  --- Wireless                                                                                    | |  
  | |                         <*>   cfg80211 - wireless configuration API                                                     | |  
  | |                         [ ]     nl80211 testmode command                                                                | |  
  | |                         [ ]     enable developer warnings                                                               | |  
  | |                         [ ]     cfg80211 regulatory debugging                                                           | |  
  | |                         [*]     enable powersave by default                                                             | |  
  | |                         [ ]     cfg80211 DebugFS entries                                                                | |  
  | |                         [ ]     use statically compiled regulatory rules database                                       | |  
  | |                         [*]     cfg80211 wireless extensions compatibility                                              | |  
  | |                         [*]   Wireless extensions sysfs files                                                           | |  
  | |                         -*-   Common routines for IEEE802.11 drivers                                                    | |  
  | |                         [ ]   lib80211 debugging messages                                                               | |  
  | |                         <*>   Generic IEEE 802.11 Networking Stack (mac80211)                                           | |  
  | |                         [ ]   PID controller based rate control algorithm                                               | |  
  | |                         [*]   Minstrel                                                                                  | |  
  | |                         [*]     Minstrel 802.11n support                                                                | |  
  | |                               Default rate control algorithm (Minstrel)  --->                                           | |  
  | |                         [ ]   Enable mac80211 mesh networking (pre-802.11s) support                                     | |  
  | |                         [ ]   Export mac80211 internals in DebugFS                                                      | |  
  | |                         [ ]   Select mac80211 debugging features  ---> 

开启WIRELESS LAN

Device Drivers  --->    

[*] Network device support  ---> 

[*]   Wireless LAN  ---> 

 <*>   IEEE 802.11 for Host AP (Prism2/2.5/3 and WEP/TKIP/CCMP)                                                                    

关闭USB CPPI DMA功能(这里调试了很久,wifi连接上AP,ping也可以ping通一段时间后面就报错,后面尝试着将这个选项关掉,问题解决,但是有缺陷,cpu在做运算密集型操作的时候可能掉包,usb bulk传输有瓶颈)

[*]   Disable DMA (always use PIO) 


2、8188EUS驱动的编译

A、MAKEFILE的修改

驱动版本rtl8188EUS_rtl8189ES_linux_v4.1.7_1529.20140106_B

关闭CONFIG_PLATFORM_I386_PC= n

开启CONFIG_PLATFORM_TI_DM365= y

修改交叉编译器的路径和内核目录路径

ifeq ($(CONFIG_PLATFORM_TI_DM365), y)

EXTRA_CFLAGS += -DCONFIG_LITTLE_ENDIAN-DCONFIG_PLATFORM_TI_DM365

ARCH := arm

CROSS_COMPILE :=/usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-

KVER := 2.6.37

KSRC:=/usr/local/yourapp/Source/dvsdk_ipnctools/ipnc_psp_03_21_00_04/kernel

Endif

B、make生成的8188eu.ko拷贝到nfs的文件系统下面,运行下面的命令

加载ko:            insmod 8188eu.ko

打开wlan0:          ifconfig wlan0 up

设置一个同一网段的IP:ifconfig wlan0 192.168.2.103

后台运行wpa_supplicant:  ./wpa_supplicant -Dwext -iwlan0 -c./wpa_supplicant.conf -B &

测试ping网关:        ping 192.168.2.1 &

3、 wireless tools工具和wpa_supplicant工具的交叉编译

进入wireless_tools.30.rtl,

Gcc 改为/usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-gcc

AR改为/usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-ar

Ranlib改为RANLIB =/usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-ranlib

然后编译,将生成的iwconfig、iwevent、iwgetid、iwlist、iwpriv、iwspy拷贝到开发板中

进入wpa_supplicant-0.8

要编译wpa_supplicant工具前先要编译OPENSSL

(A)将openssl解压

Tar zxvf openssl-0.9.8e.tar.gz

(B)将wpa_supplicant下的patch中的openssl-0.9.8e-tls-extensions.patch拷贝到openssl目录下

Cp wpa_supplicant-0.8/patches/openssl-0.9.8e-tls-extensions.patchopenssl-0.9.8e/

(C)patch –p1 <oepnssl-0.9.8e-tls-extensions.patch

(D)Openssl工具的编译

1. 动态链接库

配置安装路径 ./config no-asm shared --prefix=/usr/local/openssl

2.

修改Makefile

CC=/usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-gcc

AR=  /usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-gcc-ar$(ARFLAGS) r

RANLIB=  /usr/local/ipnc/Source/dvsdk_ipnctools/linux-devkit/bin/arm-arago-linux-gnueabi-gcc-ranlib

make

3.

make install

产生libssl.a及libcrypto.a

 

 

 

 

 

 

Wpa_supplicant工具的编译

进入wpa_supplicant目录

#cp defconfig       .config

#vim .config

CC= arm-linux-gcc -L/usr/local/ssl/lib/

CFLAGS += -I/usr/local/ssl/include/

LIBS += -L/usr/local/ssl/lib/

#make

拷贝工具以及库到目标板

wpa_supplicant用法:

wpa_supplicant-D wext -c ./wpa_supplicant.conf -i wlan0 -B

其中wpa_supplicant.config 可参考内容如下:

ctrl_interface=/var/run/wpa_supplicant

ap_scan=1

network={

proto=RSN

key_mgmt=WPA-PSK

pairwise=CCMPTKIP

group=CCMP TKIP

ssid="TEST"       连接的ap

psk="123456"   密码

}

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 insmod 成功起来后的log

[ 114.210981] RTL871X: +871x_drv - drv_open, bup=0

[ 114.218021] RTL871X: rtl8188e_FirmwareDownload: fw_ver=11 fw_subver=1sig=0x88e1

[ 114.262131] RTL871X: _FWFreeToGo: Checksum report OK!REG_MCUFWDL:0x00030004

[ 114.272009] RTL871X: =====> _8051Reset88E(): 8051 reset success .

[ 114.279348] RTL871X: _FWFreeToGo: Polling FW ready success!!REG_MCUFWDL:0x000300c6

[ 114.625402] ==> rtl8188e_iol_efuse_patch

[  114.732880]RTL871X: ==>  _InitAntenna_Selection....

[ 114.740022] RTL871X: _InitAntenna_Selection,Cur_ant:(1)Antenna_A

[ 114.748694] RTL871X: pDM_Odm TxPowerTrackControl = 1

[ 115.075256] RTL871X: rtl8188eu_hal_init in 860ms

[ 115.086955] RTL871X: MAC Address = 00:95:69:07:a8:a0

[ 115.093032] RTL871X: -871x_drv - drv_open, bup=1

 

 

 

 

 

[ 109.449857] RTL871X: rtl8188eu driver version=v4.1.7_1529.20140106_B

[ 109.457328] RTL871X: build time: Feb 18 2014 16:40:00

[ 109.462726] RTL871X:

[ 109.462741] usb_endpoint_descriptor(0):

[ 109.471166] RTL871X: bLength=7

[ 109.475196] RTL871X: bDescriptorType=5

[ 109.478979] RTL871X: bEndpointAddress=81

[ 109.482913] RTL871X: wMaxPacketSize=512

[ 109.488377] RTL871X: bInterval=0

[ 109.491644] RTL871X: RT_usb_endpoint_is_bulk_in = 1

[ 109.497846] RTL871X:

[ 109.497869] usb_endpoint_descriptor(1):

[ 109.503987] RTL871X: bLength=7

[ 109.508659] RTL871X: bDescriptorType=5

[ 109.512439] RTL871X: bEndpointAddress=2

[ 109.517573] RTL871X: wMaxPacketSize=512

[ 109.521441] RTL871X: bInterval=0

[ 109.525962] RTL871X: RT_usb_endpoint_is_bulk_out = 2

[ 109.530965] RTL871X:

[ 109.530981] usb_endpoint_descriptor(2):

[ 109.538699] RTL871X: bLength=7

[ 109.541787] RTL871X: bDescriptorType=5

[ 109.546822] RTL871X: bEndpointAddress=3

[ 109.550692] RTL871X: wMaxPacketSize=512

[ 109.555824] RTL871X: bInterval=0

[ 109.559089] RTL871X: RT_usb_endpoint_is_bulk_out = 3

[ 109.564072] RTL871X: nr_endpoint=3, in_num=1, out_num=2

[ 109.564097]

[ 109.572734] RTL871X: USB_SPEED_HIGH

[ 109.577266] RTL871X: CHIP TYPE: RTL8188E

[ 109.581240] RTL871X: rtw_handle_dualmac(): pbuddy_padapter == NULL, Setpbuddy_padapter

[ 109.590624] RTL871X: register rtw_netdev_ops to netdev_ops

[ 109.597469] RTL871X: Chip Version Info: CHIP_8188E_Normal_Chip_TSMC_A_CUT_1T1R_RomVer(0)

[ 109.606497] RTL871X: RF_Type is 3!!

[ 109.610044] RTL871X: _ConfigNormalChipOutEP_8188E OutEpQueueSel(0x05),OutEpNumber(2)

[ 109.619572] RTL871X: EEPROM type is E-FUSE

[ 109.623710] RTL871X: ====> _ReadAdapterInfo8188EU

[ 109.629974] RTL871X: Boot from EFUSE, Autoload OK !

[ 109.640901] bFWReady == _FALSE call reset 8051...

[ 109.647912] RTL871X: =====> _8051Reset88E(): 8051 reset success .

[ 109.667933] RTL871X: efuse_read_phymap_from_txpktbuf bcnhead:0

[ 109.676398] RTL871X: efuse_read_phymap_from_txpktbuf len:104,lenbak:104, aaa:104, aaabak:104

[ 109.697570] RTL871X: efuse_read_phymap_from_txpktbuf read count:102

[ 109.705659] RTL871X: EEPROM ID=0x8129

[ 109.709370] RTL871X: VID = 0x0BDA, PID = 0x8179

[ 109.713914] RTL871X: Customer ID: 0x00, SubCustomer ID: 0xCD

[ 109.721197] RTL871X: T

[ 109.723616] RTL871X:Hal_ReadPowerSavingMode88E...bHWPwrPindetect(0)-bHWPowerdown(0),bSupportRemoteWakeup(1)

[ 109.735245] RTL871X: ### PS params=> power_mgnt(1),usbss_enable(0) ###

[ 109.741910] RTL871X: ======= Path 0, Channel 1 =======

[ 109.748444] RTL871X: Index24G_CCK_Base[0][1] = 0x28

[ 109.753362] RTL871X: Index24G_BW40_Base[0][1] = 0x2e

[ 109.759639] RTL871X: ======= Path 0, Channel 2 =======

[ 109.765728] RTL871X: Index24G_CCK_Base[0][2] = 0x28

[ 109.770644] RTL871X: Index24G_BW40_Base[0][2] = 0x2e

[ 109.776919] RTL871X: ======= Path 0, Channel 3 =======

[ 109.782096] RTL871X: Index24G_CCK_Base[0][3] = 0x28

[ 109.788291] RTL871X: Index24G_BW40_Base[0][3] = 0x2e

[ 109.793291] RTL871X: ======= Path 0, Channel 4 =======

[ 109.799748] RTL871X: Index24G_CCK_Base[0][4] = 0x28

[ 109.805570] RTL871X: Index24G_BW40_Base[0][4] = 0x2e

[ 109.810574] RTL871X: ======= Path 0, Channel 5 =======

[ 109.817027] RTL871X: Index24G_CCK_Base[0][5] = 0x28

[ 109.821941] RTL871X: Index24G_BW40_Base[0][5] = 0x2e

[ 109.828214] RTL871X: ======= Path 0, Channel 6 =======

[ 109.833393] RTL871X: Index24G_CCK_Base[0][6] = 0x28

[ 109.839592] RTL871X: Index24G_BW40_Base[0][6] = 0x2e

[ 109.845501] RTL871X: ======= Path 0, Channel 7 =======

[ 109.850680] RTL871X: Index24G_CCK_Base[0][7] = 0x28

[ 109.856879] RTL871X: Index24G_BW40_Base[0][7] = 0x2e

[ 109.861882] RTL871X: ======= Path 0, Channel 8 =======

[ 109.868333] RTL871X: Index24G_CCK_Base[0][8] = 0x28

[ 109.873249] RTL871X: Index24G_BW40_Base[0][8] = 0x2e

[ 109.879522] RTL871X: ======= Path 0, Channel 9 =======

[ 109.885606] RTL871X: Index24G_CCK_Base[0][9] = 0x28

[ 109.890522] RTL871X: Index24G_BW40_Base[0][9] = 0x2e

[ 109.896798] RTL871X: ======= Path 0, Channel 10 =======

[ 109.902064] RTL871X: Index24G_CCK_Base[0][10] = 0x28

[ 109.908351] RTL871X: Index24G_BW40_Base[0][10] = 0x2e

[ 109.913442] RTL871X: ======= Path 0, Channel 11 =======

[ 109.919985] RTL871X: Index24G_CCK_Base[0][11] = 0x28

[ 109.925896] RTL871X: Index24G_BW40_Base[0][11] = 0x2e

[ 109.930987] RTL871X: ======= Path 0, Channel 12 =======

[ 109.937523] RTL871X: Index24G_CCK_Base[0][12] = 0x28

[ 109.942525] RTL871X: Index24G_BW40_Base[0][12] = 0x2e

[ 109.948892] RTL871X: ======= Path 0, Channel 13 =======

[ 109.954155] RTL871X: Index24G_CCK_Base[0][13] = 0x28

[ 109.960434] RTL871X: Index24G_BW40_Base[0][13] = 0x2e

[ 109.966429] RTL871X: ======= Path 0, Channel 14 =======

[ 109.971696] RTL871X: Index24G_CCK_Base[0][14] = 0x28

[ 109.977976] RTL871X: Index24G_BW40_Base[0][14] = 0x2e

[ 109.983061] RTL871X: ======= TxCount 0 =======

[ 109.988819] RTL871X: CCK_24G_Diff[0][0]= 0

[ 109.992956] RTL871X: OFDM_24G_Diff[0][0]= 0

[ 109.998786] RTL871X: BW20_24G_Diff[0][0]= -1

[ 110.003092] RTL871X: BW40_24G_Diff[0][0]= 0

[ 110.008576] RTL871X: EEPROMRegulatory = 0x2

[ 110.012798] RTL871X: mlmepriv.ChannelPlan = 0x20

[ 110.018716] RTL871X: CrystalCap: 0x18

[ 110.022410] RTL871X: EEPROM Customer ID: 0x 0

[ 110.028070] RTL871X: EEPROM : AntDivCfg = 1, TRxAntDivType = 1

[ 110.033938] RTL871X: Board Type: 0x 0

[ 110.038907] RTL871X: ThermalMeter = 0x1a

[ 110.042876] RTL871X: <==== _ReadAdapterInfo8188EU in 420 ms

[ 110.052471] RTL871X: rtw_macaddr_cfg MAC Address  = 00:95:69:07:a8:a0

[ 110.059879] RTL871X: bDriverStopped:1, bSurpriseRemoved:0, bup:0,hw_init_completed:0

[ 110.072845] RTL871X: _rtw_drv_register_netdev, MAC Address (if1) = 00:95:69:07:a8:a0

[ 110.082585] usbcore: registered new interface driver rtl8188eu

root@192:/# ifconfig wlan0 up

[ 114.210981] RTL871X: +871x_drv - drv_open, bup=0

[ 114.218021] RTL871X: rtl8188e_FirmwareDownload: fw_ver=11 fw_subver=1sig=0x88e1

[ 114.262131] RTL871X: _FWFreeToGo: Checksum report OK!REG_MCUFWDL:0x00030004

[ 114.272009] RTL871X: =====> _8051Reset88E(): 8051 reset success .

[ 114.279348] RTL871X: _FWFreeToGo: Polling FW ready success!!REG_MCUFWDL:0x000300c6

[ 114.625402] ==> rtl8188e_iol_efuse_patch

[ 114.732880] RTL871X: ==> _InitAntenna_Selection ....

[ 114.740022] RTL871X: _InitAntenna_Selection,Cur_ant:(1)Antenna_A

[ 114.748694] RTL871X: pDM_Odm TxPowerTrackControl = 1

[ 115.075256] RTL871X: rtl8188eu_hal_init in 860ms

[ 115.086955] RTL871X: MAC Address = 00:95:69:07:a8:a0

[ 115.093032] RTL871X: -871x_drv - drv_open, bup=1

你可能感兴趣的:(usb wifi移植)