1 Hardware system composition
1.1 Introduction of USB wireless network card The wireless network card is an important part of the wireless local area network (WLAN). The physical layer and MAC layer of the WLAN are completed by the hardware and software of the wireless network card, and each layer above the LLC layer is composed of computer software. achieve. WLAN includes a network interface card (wireless network card for short) and access point / bridge (AP / bridge) for communication. Among them, the wireless network card provides the interface between the end user device (handheld device) and the access point / bridge. At present, wireless network cards are widely used in the form of PCMCIA and CompactFlash (CF) cards. Most available wireless network cards are based on the Intersil Prism or Lucent Hermes chipset, and the wireless network card of the USB device is supported by the Ateml chipset. The system uses D-Link's WLG-122 wireless network card, the chipset is Prism2, which is accessed through the USB host port.
1.2 System configuration The main controller uses Atmel 9261, working frequency 180 MHz, with 16 KB data cache and 16 KB instruction cache, external 64 MB NAND FLASH and 64 MB SDRAM, the peripheral interface is adaptive Ethernet card by 10/100 Mb / s , 3 USB 2.0 interfaces, 2 universal asynchronous transceivers (UART), LCD interface and serial peripheral interface (SPI), etc., can be easily connected to work equipment. The operating system uses Linux 2.6.15; the bootloader uses U-boot; the root file system uses ramdisk. After the system is started, the yaffs file system is mounted. The system uses the Atmel 9261 development board from Ateml. The peripheral interfaces include 2 USB host interfaces, one of which is connected to a USB wireless network card. The wireless router adopts WRTl60N of Cisco-Linksys, supports 802.11g standard, TCP agreement and TFTP agreement, as shown in Fig. 1.
2 USB wireless network card driver
2.1 Linux USB driver module structure For the USB wireless network card connected to the system, the USB bus is the first to be seen from the perspective of the CPU, and then the network card chip, so the USB driver must be implemented before the network card driver. The USB device interface is different from the host end and the device end, so the USB driver is also divided into a USB host end driver and a USB device end driver. In terms of host computer, there are two specifications of UHCI and OHCI.
The upper-layer application software accesses the system's USB devices through a file system. Each USB device connected to the system bus can correspond to one or more drivers at the same time, that is, each USB device can be provided with one or more nodes on the Linux system for application use.
Since the USB interface is a master-slave mode and a tree-like network structure with multiple devices connected, the USB host must have the configuration management function for all different types of USB devices connected to the bus. The LinuxUSB host driver can simultaneously support multiple USB bus functions, and each USB bus works independently. The USB host driver consists of three parts: USB host controller driver (HCD), USB driver (USBD) and different USB device type drivers. Figure 2 describes the structure of the Linux USB driver. Linux defines a Universal Request Block (Universal Reqlaest Block, URB), which is used to transfer data between USB device class drivers and USBD, USBD and HCD.
2.2 LinUX network driver structure All Linux network drivers follow a common interface. The design uses an object-oriented method, that is, a device is an object (net device structure), which has its own data and methods. The most basic methods of a network device are initialization, transmission and reception. The structure of Linux network driver can be divided into four layers: network protocol interface, network device interface, device driver function and network media. The main job of the network driver is to complete the function of the device driver layer so that it meets the required functions.
2.2.1 The access and control of USB wireless network card drive devices are different from PCI, ISA and other devices. The new generation buses such as USB and 1394 do not have IO / MEM mapping, interrupt and DMA hardware resources, and are replaced by abstract hardware resource concepts. . For USB devices, resources mainly include configuration (configuraTIon), interface (interface) and endpoint (endpoint). Among these resources, the endpoint has the most important significance for the USB device, and the actual data transmission is achieved by reading and writing the endpoint. The driver obtains these resources through descriptors. During initialization, the USB driver reads the descriptor from device endpoint 0, saves the attributes of these resources after parsing, and prepares for data transfer.
2.2.2 Design of USB network device driver
The USB wireless network card driver first registers itself with the USB subsystem, and then uses the vendor id and device id to determine whether the hardware device has been inserted into the bus. The camera driver needs to create a
When the wireless network card is inserted into the USB bus, the USB core will call the Probe method to detect the information passed in to determine whether the wireless network card device matches the driver, and fill struct net_device to complete the initialization of the network device. When the wireless network card is unplugged, the USB core will call the Disconnect method to complete the removal. The driver initializes a module by calling module_init through the initialization and elimination functions of the display module, and registering and unregistering the module, and calls the moduel_exit function when uninstalling.
Among them, the open function mainly completes the initialization of the pAd describing the hardware data structure of the network card, including the urb packet receiving function, interface configuration function, initial sending and receiving data structure and MAC address copy function, and finally the net_dev data sending and receiving function. The RTMPSend-Packets function is responsible for sending packed network packets. The communication between the wireless network card driver and the USB core is transmitted through the interrupt / batch method.
3 Compile and test
3.1 The wireless network card driver compiles the Linux kernel version of the system to 2.6.15, configure the kernel on the host machine, remove unnecessary functions in the kernel through "make menuconfig", and increase the support for WLAN. Click De-Vice Driver → Network device suppor → Wireless LAN (non-hamradio) → Select Wireless Lan driners (non-hamradio) & Wireless Extensions; then enter the universal USB-WLAN driver source code, modify the makefile, and change the kernel folder option Position under the Linux kernel just compiled, and compile rt73 in this folder through "make". ko driver module.
There are various file transfer methods in ARM embedded Linux development, such as TFTP service and NFS file system. In this case, rt73 will be used. The ko driver module is downloaded to the development board. Since Linux supports dynamic loading of the module, it can be easily loaded into the kernel with "insmod", and the loaded module can be viewed through "lstood". After that, the rt73 module has been successfully loaded.
Add wireless management applications to the development board file system, and iwconfig, iwapy, iwlist, etc., used to configure frequency, network, ID, ES-SID, acceptance sensitivity, access mode, wireless network standard, encryption switch.
Finally, write a wireless network startup and self-configuration program to automatically configure the IP address and wireless network card. At this point, the entire wireless network card driver has been compiled.
3.2 Test results and analysis Start the wireless network and write a test bandwidth program. The test program uses the C / S design mode, the client runs on the ARM development board, and the server runs on a Linux PC in the LAN. The workflow of changing the test program is mainly as follows. The client sends byte streams of different sizes, and the corresponding bandwidth is calculated by the server. A broadband curve can be obtained, and then the maximum bandwidth that the network can actually reach is obtained. After repeated testing, the wireless network card can work steadily, with a bandwidth of 6 Mb / s within a radius of 50 m from the AP, and a certain distance from the theoretical value of 54 Mb / s. The specific reason is being analyzed. The test results are shown in Figure 3.
4 Conclusion
Linux is the operating system with the highest proportion of embedded systems on the market today. Its driver mode supports module stacking technology, and kernel developers have provided some common modules. Based on the engineering application, the device driver of the USB wireless network card under Linux is researched and transplanted. Based on this, the embedded wireless local area network can be built, and it can be used for the wired network that cannot be extended or difficult to install. It can also be used for remote wireless video surveillance in industrial scenes where it is required for sexual use, such as additional cameras and image processing chips.
General-purpose rectifiers belong to the most widely used category of rectifiers, and their classification is relative to those with special functions, such as fast, high-frequency, and so on.
Our universal rectifiers are of original quality, complete models, high visibility, affordable prices, and fast shipping!
Rectifiers,General Purpose Rectifiers,Rectifier Diode,General Purpose Rectifier Diodes
Changzhou Changyuan Electronic Co., Ltd. , https://www.changyuanelectronic.com