Design and Analysis of Embedded Ethernet Based on S3C44B0X+μcLinux

Publisher:WanderlustGazeLatest update time:2013-03-30 Source: dzscKeywords:S3C44B0X  μcLinux  Ethernet Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
  With the rapid development of semiconductor technology, embedded products have been widely used in various fields such as military, consumer electronics, network communication, industrial control, etc. Networking is an inevitable trend in the development of embedded systems. As an operating system with many advantages such as open source code, excellent network performance, and scalability, embedded Linux is very suitable for embedded systems with network functions. This article introduces the network interface design based on the S3C44B0X ARM processor and the RTL8019AS Ethernet controller, and explains how to realize the driver of the network card under the embedded operating system μcLinux.

  S3C44B0X processor introduction

  ARM is a well-known chip design IP supplier in the industry, and its 32-bit RISC microprocessors occupy more than 80% of the global market share. The ARM7 series processors are also the most mature and widely used processors on the market. The S3C44B0X launched by SAMSUNG is a 16/32-bit RISC processor with ARM7TDMI as the core. It is manufactured using 0.25μm CMOS technology and provides cost-effective and high-performance microprocessor solutions for handheld devices and general applications. The S3C44B0X greatly reduces the configuration of peripheral components by providing comprehensive and universal on-chip peripherals, thereby greatly reducing system costs. The internal structure of the S3C44B0X chip is shown in Figure 1.

Internal structure of the S3C44B0X chip

Circuit Design of Network Interface

  Before introducing the circuit design, let's briefly introduce the network controller RTL8019AS. RTL8019AS is a full-duplex Ethernet controller with high cost performance and plug-and-play function produced by Taiwan REALTEK Company. It integrates two RAMs, one 16KB with address 0x4000~0x7FFF and one 32 bytes with address 0x0000~0x001F. The 16K RAM is used as a buffer for sending and receiving data. Generally, 0x4000~0x46FF is used as the sending buffer and 0x4700~0x7FFF is used as the receiving buffer. Figure 2 is an Ethernet interface circuit designed for S3C44B0X using RTL8019AS, 74LV138 (3-8 decoder) and FB2022 (network card transformer).

Ethernet interface circuit

  The data width of this circuit is 16 bits, and it uses the external interrupt EXINT3. The chip select signals nGCS1 and A16, A17, and A18 of the processor are output as the enable control terminal of the network card through 74LV138. nOE and nWE control the reading and writing of the network card, nRESET controls the reset of the network card, and FB2022 plays the role of voltage conversion and filtering. [page]


  Introduction to μcLinux operating system and network driver development

  Why choose μcLinux for this system

  Linux has become one of the most popular operating systems today with its open source code, powerful network functions and many other advantages. μcLinux is derived from the Linux kernel and inherits most of the features of Linux. It is specifically designed for CPUs without MMU (memory management unit) and has done a lot of miniaturization work for embedded systems. It has a small kernel, but powerful functions, a robust system, and a wide range of hardware support features. It is an excellent embedded operating system. S3C44B0X is a processor without MMU, so in this system, μcLinux is a very suitable operating system.

  Introduction to Network Driver Development under μcLinux

  The implementation process of drivers under μcLinux and Linux is basically the same. Linux regards all devices as specific files and accesses devices through the file system layer. Therefore, in the framework structure of Linux/UCLinux, device-related processing can be divided into two levels - the file system layer and the device driver layer. The device driver layer shields the details of specific devices, and the file system layer provides users with a set of unified and standardized user interfaces. This device management method can achieve "device independence" very well, so that Linux/UCLinux can be easily expanded according to the development of hardware peripherals. For example, to implement a device driver, it is only necessary to provide a set of access interfaces to the file system according to the specific hardware characteristics. The structure of the entire device management subsystem is shown in Figure 3.

The structure of the entire equipment management subsystem

  In Linux/μclinux, the framework of the entire network interface driver can be divided into four layers, from top to bottom, they are the protocol interface layer, the network device interface layer, the device driver function layer that provides actual functions, and the network device and network media layer. This framework has been built in the kernel network module. When we design a network driver, the main work to be done is to complete the function of the device driver according to the net_device structure defined by the upper network device interface layer and the specific hardware characteristics of the underlying layer. There are two main data structures in the network driver part, one is sk_buff. The transmission of data packets between different protocol layers in TCP/IP and between network drivers is completed through this structure. This structure mainly includes variables required by the transport layer, network layer, and connection layer, pointers that determine the location and size of the data area, and specific device information used to send and receive data packets. Its detailed definition can be found in the kernel source code.

  The other is the net_device structure, which is defined in . This structure is the core of the network driver, which defines many device standard methods for system access and protocol layer calls, including the init function for device initialization and system registration, the open and stop functions for opening and closing network devices, the hard_start_xmit function for processing data packet transmission, as well as the interrupt processing function, the interface status statistics function, etc.

Implementation of RTL8019AS driver

  In embedded system development, writing device drivers takes up a lot of work. The following is a detailed introduction to the steps of designing the network card driver in this system.

  * Initialization function

  static int RTL8019_init(struct net_device *dev)

  Call the ether_setup (dev) function to set up the general Ethernet interface;

  Fill the attribute fields of the net_device data structure;

  Call kmalloc to apply for the required memory space;

  Manually set the MAC address;

  * Device opening and closing functions

  static int RTL8019_open(struct net_device *dev)

  Disable interrupts;

  Register interrupt number and I/O address;

  Initialize the device's registers;

  Enable interrupt; [page]

  The device close function performs the opposite action of the open function.

  * Data packet sending function

  static int RTL8019_sendpacket(struct sk_buff *skb,

  struct net_device *dev)

  Turn on the flag tbusy;

  Write the data packet into the RTL8019's send buffer and start the DMA send function;

  Release the buffer;

  * Data packet receiving function

  static int RTL8019_rx( int irq, void *dev_id, structpt_regs *regs)

  Apply for skb buffer to store new data packets;

  Read newly arrived data from the hardware;

  Call the function netif_rx() to transmit the new data packet to the upper layer of the network protocol;

  finally, compile the driver into the kernel. Since μcLinux does not support dynamic module loading, static compilation must be used. If everything is normal, use the ifconfig and route add commands to set the IP address and subnet mask, and the network card will work normally.

  Conclusion

  RTL8019AS Ethernet controller has been widely used in embedded systems for its excellent performance, and μcLinux is used for communication and data exchange. Experiments show that the communication between C5416 and S3C4510B using HPI interface meets the real-time requirements of embedded systems.

References:

[1]. S3C44B0X datasheet http://www.dzsc.com/datasheet/S3C44B0X+_589522.html.
[2]. RTL8019AS datasheet http://www.dzsc.com/datasheet/RTL8019AS+_1096173.html.
[3 ]. RISC datasheet http://www.dzsc.com/datasheet/RISC+_1189725.html.
[4]. ARM7TDMI datasheet http://www.dzsc.com/datasheet/ARM7TDMI+_139812.html.
[5]. 74LV138 datasheet http://www.dzsc.com/datasheet/74LV138_1082898.html.
[6]. A16 datasheet http://www.dzsc.com/datasheet/A16_1819409.html.
[7]. A17 datasheet http://www.dzsc.com/datasheet/A17_1819429.html.
[8]. RTL8019 datasheet http://www.dzsc.com/datasheet/RTL8019+_1063656.html.
[9]. S3C4510B datasheet http:/ /www.dzsc.com/datasheet/S3C4510B+_589499.html.

Keywords:S3C44B0X  μcLinux  Ethernet Reference address:Design and Analysis of Embedded Ethernet Based on S3C44B0X+μcLinux

Previous article:Analysis and design of startup process based on embedded uCLinux kernel
Next article:Construction of Embedded Linux System Based on S3C2410

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号