Basic concepts
embOS/IP structure
embOS/IP is organized in different layers, illustrated in the follwoing diagram. A
short description of each layer's functionality follows below.
Application layer
The API Layer is the interface between embOS/IP
and the user application. It uses the embOS/IP API to transmit data
over an TCP/IP network. The embOS/IP API provides functions in Berkley
socket style, such as connect(), bind(), listen(), etc.
Transport layer
The transport layer provides end-to-end communication
services for applications. The two relevant protocols of the transport
layer protocol are the Transmission Control Protocol (TCP) and the
User Datagram Protocol (UDP). TCP is a reliable connection-oriented
transport service. It provides end-to-end reliability, resequencing,
and flow control. UDP is a connectionless transport service.
Internet layer
All protocols of the Transport layer use the
Internet Protocol (IP) to carry data from source host to destination
host. IP is a connectionless service, providing no end-to-end delivery
guarantees. IP datagrams may arrive at the destination host damaged,
duplicated, out of order, or not at all. The Transport layer is
responsible for reliable delivery of the datagrams when it is required.
The IP protocol includes provision for addressing, type-of-service
specification, fragmentation and reassembly, and security information.
Link layer
The Link layer provides the implementation of
the communication protocol used to interface to the directly-connected
network. A variety of communication protocols have been developed
and standadized. The most commonly used protocol is Ethernet (IEEE
802.3). In this version of embOS/IP is only Ethernet supported.
Encapsulation
The four layers structure is defined in RFC 1122. The data flow starts at application layer goes over the transport layer, the network layer,
and the link layer. Every protocol adds an protocol-specific header and encapsulates the data and header from the layer above as data.
On the receiving side the data will be extracted in the complementary direction. The opposed protocols does not know which protocol on the layers
above and below are used. The following illustration shows the encapsulation of data within an UDP datagram within an IP packet.
Tasks and interrupt usage
embOS/IP can be used in an application in three different ways.
- One task dedicated to the stack
- Two tasks dedicated to the stack
- Zero tasks dedicated to the stack (Superloop)
The default task structure is one task dedicated to the stack.
One task dedicated to the stack
This is the simplest way to use the TCP/IP stack. One task is dedicated to the stack.
It is called IP_Task and handles housekeeping operations, resends and handling of
incoming packets. The "Read packet" operation is performed from within the ISR.
Since the "Read packet" operation is called directly from the ISR, no additional task
is required. The length of the interrupt latency will be extended for the time period
which is required to process the "Read packet" operation.
Two tasks dedicated to the stack
Two tasks are dedicated to the stack. The first is called IP_Task and handles housekeeping operations, resends and handling of incoming packets.
The second one is called IP_RxTask and handles the "Read packet" operation. IP_RxTask is woken up from the interrupt service routine, if new
packets are available. The interrupt latency is not extended, since the "Read packet" operation has been moved from the interrupt service
routine to IP_RxTask.
Zero tasks dedicated to the stack (Superloop)
embOS/IP can also be used without any additonal task for the stack, if an application task calls periodically IP_Exec(). The "Read packet" operation
is performed from within the ISR. Since the "Read packet" operation is called directly from the ISR, no additional task is required. The length of the
interrupt latency will be extended for the time period which is required to process the "Read packet" operation.
|