Design and Implementation of Ralink's Uclinux-Based Wireless Network Interface Card
Design and Implementation of Ralink's Uclinux-Based Wireless Network Interface Card
Interface Card"
Abstract—The design of Wireless Network Interface Card development tools can be free from http://www.uclinux.org.
device driver, based on PCI bus, is the key part of WMN(Wireles Through the analysis of the Linux operating system, the
Mesh Network). MIPS and uclinux based development realization of network protocol and the development of the
environment, Network Interface Card device driver RT2860 driver, the necessary cutting, transplanting and re compiling of
oriented are designed and realized. Combining to network the system are made, so that the development platform is
protocol of IEEE 802.11, this paper focuses on the initialization , simple and effective.
opening , transmission and receive, interrupt handling of
RT2860. The The data transmission rate and performance of the
network are tested and evaluated. The results shows that this III. UCLINUX NETWORK DEVICE
device driver works reliably, rebustly and efficiently In order to shield the diversity of physical network devices
in the network environment, Linux abstracts all physical
Keywords—uclinux; WMN(wireless mesh network); Wireless devices and defines a unified concept called interfaces. All
Network Interface Card, device driver
access to network hardware is done through interfaces, which
provide a set of operations that are consistent with all types of
I. INTRODUCTION hardware to handle the sending and receiving of basic data. A
Wireless Mesh network (WMN) is a multi hop wireless network interface is considered as an entity that sends and
network with self forming, self-healing and self-organizing receives packets. For each network interface, a device data
capabilities. It is composed of Mesh router and Mesh client structure is used to refer to the specific content of the data
node [1]. Since wireless Mesh networks do not need to set up structure, refer to include/linux/netdevice.h.
base stations, they can be deployed quickly and have high Generally, the network device is a physical device, this
reliability, so wireless Mesh networks can be applied to many article mainly aims at the wireless network card. When the
special fields, such as municipal, security, disaster relief, kernel is started, the network device will be registered through
mining, military, etc.. In this paper, through the deep the network device driver. All packets that are sent and
understanding and analysis of the 802.11 wireless received are represented by data structure sk_buff. This is a
communication protocol, using uClinux with MIPS embedded very flexible data structure, you can easily increase or delete
processor platform development, realizes the wireless network the network protocol packet header, please refer to the specific
card driver development, and to further implement the WMN content of include/linux/sk_buff.h.
on this platform and realize the wireless video surveillance
and lay a good foundation.
A. Uclinux network device driver architecture[2]
From top to bottom, it can be divided into 4 layers, which are
II. DEVELOPMENT ENVIROMENT
network protocol interface layer, network device interface
A. Hardware platform layer and practical function.Device drivers, functional layers,
and network devices and network media layers. When
The hardware platform chooses the RT2880 development designing
board based on the Mips4KEc processor, and the wireless
network card selects Ralink company
The WMIR-200N model wireless network card is developed
because the device has the characteristics of low power
consumption and low cost. It is the 32-bit mini-PCI interface,
supports the 802.11a/b/g/n wireless transmission protocol, the
main control chip is RT2860, and the RF chip is RT2850.
B. Software platform
UClinux is the most famous and most widely used a Linux
version used in embedded devices, it is also an open source
project, cyber source is very rich, uClinux source code and Fig. 1. Architecture of uClinux network device drivers
the NIC driver, the main task is to complete the device driver
function layer to meet the functions required.
B. Implementation model of device driver in uClinux network initialization of key operating functions such as rt2860_open (),
[3] RTMPSendPackets (), rt2860_close () and rt2860_ioctl ().
First of all, the calling module loading command to Net_dev->open = rt2860_open; / / open function set
insmod network device driver is loaded into the Net_dev->hanl_start_xmit = RTMPSendPackets; / / set the
kernel, then, insmod will call the init_module (init) send function
function pointer to a function of the network devices Net_dev->stop = rt2860_close; / / close function set
are initialized. Net_dev->priv = vmalloc (sizeof (RTMP_ADAPTER)); / / set
Then by calling the register_netdev () function to the private data for RTMP_ADAPI'ER
register the network device in Linux system. If Net_dev->get stats = rt2860_get_ether_stats; / / set the state
successful, call the network device initialization statistics function
function referred to by the init function pointer to C. Implementation of wireless NIC network interface
initialize the device and insert the device data
structure of the device to the end of the dev_base Device open method
chain. At this point, you can open the network device The opening of the device is achieved by calling the
to send and receive packets. open method in the file_operations structure, which is
Finally, you can uninstall the command rmmod implemented by RT2860_open (). RT2860_open
through the module, and we can uninstall the network (DMA) in need of resources allocation, register
driver module by calling the cleanup_module () interrupt handling function, read the PCI configuration
function in the network driver. space, hardware initialization settings, set up and start
AP services (channel and BSSID, using the rate card
set AP).
IV. MINI-PCI INTERFACE, RALINK WIRELESS NETWORK
CARD DRIVER DESIGN Device data transceiver
Now the general wireless network card supports 3 modes, The main work of network equipment is data sending
one is AP model (i.e. access point mode, can support the other and receiving. Correspondingly, the core of this driver
in STA mode wireless LAN and its connection), two is STA is the processing of sending and receiving data. Send
mode (this mode only connected with wireless network card in the packet is mainly hard_start_ XM it function pointer
AP mode), the three is the AD-HOC model, also called peer- calls in the device domain to complete the packet
to-peer mode in this mode, all the modes of the network card transmission, i.e. when the upper layer has a good
can be connected to each other [4]. package of data arrives, these packaged data will be
automatically invoked by the rt2860_probe () function
The design and implementation of a AP driver model, mainly
to send the corresponding function pointer
composed of the following parts: initialization module,
(RTMPSendPackets) to deal with, send packets from it
equipment module, open the read and write data and control is completed.
module, interrupt processing module, equipment release
module, load / unload equipment etc.. For applications, the When the transmission is successful, the network card
only three devices that deal with the application are the device generates a send completion interrupt, and the program
open module, the read and write control module, and the empties the ring_desc data structure successfully sent
device release module, and the [5]. to the TxRing end of the send buffer ring and combines
it with the frame head.The data sending interrupt is the
A. Wireless communication protocol 802.11 protocol cluster opposite. The data receiving interrupt is when the data
Wireless communication protocol 802.11 protocol cluster arrives the equipment, produces a data to receive the
specific instructions, see reference [6] interruption signal, then calls the interrupt handler.
B. Interface settings and initialization Shutdown and uninstall devices
According to the requirements of the linux2.4.x kernel, first The shutdown of the device is achieved through the
through the kernel call module_init (rt2860_init_module) to stop method in the device file. For a wireless network
register an initialization function (rt2860_init_module), then card, it is implemented by the rt2860_close () function.
the function rt2860_init_module () by pci_module_init Main is to stop the MLME state machine (used to
(&rt2860_driver) to be responsible for any facilities provided maintain the network card connection status), stop the
by the registration module, the actual work is mainly in AP function, release related resources, delete all timers,
release interrupts, release buffer rings and so on. The
rt2860_init_module () in the. The driver mainly completed the
equipment is unloaded in section 3.2.
following tasks: (1) initialize the miniPCI device; (2) system
resource allocation; (3) registration driver, through the kernel Implementation of IOCTL function of driver
function register_netdev () to complete. The primary task of
For the Ralink wireless network card, the specific
device initialization is to fill the net_ device structure of the
control operations are achieved by calling the IOCTL
device, which must be done when a modular driver is loaded. command through ifconfig and iwconfig. For example,
The pointer to the init function in the structure refers to the (Ra0 is the name of the wireless network card device in
the operating system):
$ifconfig, Ra0, 192.168.0.1, up RT2880 development board, the target board transplantation
$iwconfig, Ra0, ESSID, mywireless of Linux2.4.x and kernel Linux2.6.21, between the host and
target machines connected by serial port and Ethernet, easy to
In Linux, to make the network card work properly, at debug the application development environment Ralink
least you should configure the IP address, ESSID,
wireless network card driver design and development based on
working mode and working frequency band. The driver
the above.
through the IOCTL provides applications such as the
I/O memory address space, read and write access to the B. Development environment build
configuration space register read and write access, Linux device drivers are part of the kernel. You can compile
access to the data structure members and other
and load the Linux kernel in two ways. One is compiled
functions, through these functions, the application can
directly into the kernel and loaded with the Linux startup. The
carry on the corresponding operation of equipment. All
of its functions are implemented by the IOCTL other is the device driver for a compiler can be dynamically
command. The application passes the information to loaded and delete module, using insmod loading, rmmod
the driver kernel space through the IOCTL command, deleted, this controls the size of the kernel, and once the
and the driver processes its corresponding operations. module is inserted into the kernel, it and other parts of the
The code is as follows: kernel. The design of the wireless network card driver
compiled in second ways.
INT rt2860_ioctl (... First, the configuration of the kernel in the host computer, the
IN struct kernel function remove unnecessary, in the device driver
options, adding support for WLAN, and then enter a location
net_device*net_dev, IN of the location of the driver source code, modify the
struct ifreq*rq, Makefile[7] and Config.in files (increase compilation menu
items), cross compile the kernel, a new kernel. To the target
IN, INT, CMD)
board. Load this module with 'insmod' to the kernel, and check
{ the loaded module with 'lsmod' to see that the rt2860 module
has been successfully loaded. Then use the 'ifconfig Ra0
...
192.168.0.1 up' command to start the wireless network card.
}
C. Test result and analysis
This function is also registered when the network In the two to achieve the goal in the endpoint application
device processing method is registered during module (assuming IP = 192.168.1.10192.168.1.100), enter the
installation. Net_dev is the data structure that
command 'endpoint', and the wireless network card cable in
represents the network device. RQ is the data structure
pointer that is handed down by the application, and which a development board of the LAN port is connected with
CMD is the specific command of the request. To set a support 802.11b/g/n protocol notebook. Start the IxChariot
the ESSID as an example, when the setting command software, as shown in fig. 2.
arrives from the application layer driver layer, the
driver will call the IOCTL function, and then registered
in the initialization process, setting IOCTL function
according to call transfer over specific parameters,
when receiving the ESSID command set, the ESSID
reset, and then restart AP the effect of other commands
and it is exactly the same.
References
[1] I.F., Akyildiz, X., Wang, and, W., Wang, Wireless mesh networks: a
survey [J], Computer Networks, 2005, 47 (4): 445-487.
[2] Song Baohua. Detailed explanation to Linux device driver
development[M]. Beijing: Posts & Telecom Press, 2008.
[3] Wei Yongming, Geng Yue, Zhong Shuyi. Linux device driver [M].
(Third Edition). Beijing: China power press, 2005.
[4] Liu Naian, Li Xiaohui, et al. Wireless local area network (WLAN) -
principle, technology and application [M]. Shaanxi: Xi'an Electronic and
Science University press, 2004.
[5] DANIEL, P.BOVET&MARCO, CESATI, along. Chen Lijun, Feng Rui
Niu, Xin Xin. In depth understanding of Linux kernel [M]. (Second
Edition). China Electronic Publishing House, 2004.
[6] Yan, Zhang, Jijun, Luo, Honglin, Hu., Wireless, mesh, networking,
Fig. 3. Test bandwidth for indoor 5G and 2.4G bands Architectures, Protocols, and, Standards, [M], Auerbach, Publications,
Boca, Raton,
VI. CONCLUSION [7] Tian Junying et al. Complete Analysis the Make file in µClinux source
code [M]. Beijing: Mechanical Industry Press, 2005.
From the point of view in application, gives the
development method of Ralink wireless network card device
driver based on uClinux, which can be constructed based on
wireless Mesh network, can be used in wired network can not
be extended or difficult to install, requires flexible mobile and
temporary use of other occasions. Such as additional camera
and image processing chip, it can be used in remote wireless