SDL-based communication protocol development platform time: 14:43:35 Source: modern electronic technology Author: Shuiquan, Song Bo, Min Xiaoqing
L Introduction
SDL is an international standard language used to describe and describe the system. It combines intuitive graphics with fixed formats, allowing developers to describe standards and protocols in a concise and efficient manner. The application of SDL can shorten the development cycle and reduce the error rate of the system, improve software quality. Now more and more telecom equipment developers are using SDL for protocol software development.
However, SDL is not a programming language. It makes sense to Use SDL to describe the system and then map the SDL system into an actual program, at present, it is generally accomplished by some foreign development tools such as SDT's SDL and C language conversion tools, developers can compile SDL system and environment interface functions to integrate the generated code with RTOS. This method improves the efficiency of protocol development, but it also has some disadvantages: The design relies on tools, the code is difficult to maintain, the code generated by SDL is very complex, and it is not easy to modify and read, in practice, these tools are often used for protocol verification.
To improve protocol development efficiency, we have established an independent SDL-based communication protocol development platform in the development of wireless communication systems, through this platform, the basic element processes of SDL and communication between processes and RTOS tasks can be realized, and common timer management and memory management functions in the protocol can be integrated.
2 SDL Introduction
SDL (specification and Description Language) is a language for describing system behavior developed and standardized by ITU-T from 1976 to 1992. The mathematical model of SDL is an extended finite state machine (EFSM ), it is a high-level generic descriptive language for event-driven, real-time, and communication systems. telecommunications systems and protocols are one of its main application fields. SDL has two representation forms: Image and text, SDL/GR and SDL/PR. It can be used to describe the functions of the system, and describe the internal structure and behavior of the system. Therefore, it has a wide range of applications and can be used in various stages of protocol engineering. SDL uses a hierarchy to describe and describe the system. The structure and functions are clearly divided. The system can be divided into multiple functional blocks, which indicate several modules with relatively independent internal functions. They are connected through channels. Based on the size of the system, each function block can also be divided into sub-functional blocks or processes. Similar to traditional FSM, SDL processes have a limited number of macro control states connected by a limited number of transitions. The transition can be triggered by receiving an input signal (which can also be called an enabling condition), setting a timer in advance, or confirming the conditions specified by the current state variable (continuous signal) value. In SDL, some basic data types and operations are defined, and new types are constructed, so that SDL has the same data operation capabilities as C/C ++, therefore, it can be used for system design and implementation.
3. structure and implementation of the sdl communication protocol development platform
The SDL communication protocol development platform is built on an embedded real-time operating system. It consists of four modules: process management, Message Management, timer management, and cache management, as shown in 1. The process management module provides database functions such as creating and deleting SDL processes, and provides SDL functional blocks and process descriptions, you can use this table to determine the subordination between task blocks and processes. The message management module provides message communication functions between processes, between processes and functional blocks, and between processes and external tasks; the timer management and buffer management module provides the timer creation and deletion functions as well as the buffer creation and release functions.
3.1 Implementation of function blocks and processes
3.1.1 function block implementation
The system described in SDL contains several functional blocks, each of which contains at least one process ), function blocks are directly implemented by RTOS tasks without being created by developers. You only need to define the processes included in the function blocks in advance. The SDL system can directly create function blocks during initialization. Concurrent scheduling of processes in each function block is implemented by a scheduling function of the function block, and scheduling between function blocks is completed by the operating system. In addition to round-robin scheduling of process state machines, function block tasks are also responsible for receiving messages from external environments and distributing messages to various process state machines; in addition, the function block task is responsible for the timer management of all processes in the function block. The internal workflow 2 of the function block is shown in.
3.1.2 implementation of the process state machine
A process is a finite state machine that extends execution in parallel. It specifies the dynamic behavior of a system. A process is basically in the waiting state. When a signal is received, it is immediately transferred between States, the process concept is very similar to the process or task concept in the operating system. Processes communicate with the system environment through asynchronous signals. These signals can carry different types of parameters. Although the process features a little similar to the tasks in RTOs, in actual development, an SDL process may have hundreds or even thousands of tasks at the same time, which obviously cannot be used to directly implement the SDL process.
On the SDL platform, a C function is used to correspond to an SDL process. The function block of the process is responsible for scheduling the process. In the SDL language, a process can be considered as a finite state machine. The state transition of a state machine is triggered by a series of signals. The entry function of the process uses the swicht-case architecture to implement the state machine. A standard process state machine function template is defined on the platform. In protocol development, each process writes the SDL Process Code according to this template.
3.1.3 Implementation of process concurrency
Process concurrency is implemented by the process scheduling function in the function block task. In the scheduling function, the state machine function of the process is called in turn according to the trigger order of messages. In actual applications, a state machine function needs to be called concurrently. For example, in the WiMAX system, each user station has the same inbound process, including downlink synchronization parameter acquisition, upstream parameter acquisition, initial ranging, capability negotiation, registration, and other status transition processes, therefore, for a base station, only one process state machine can complete the inbound access process of a user station, but for the base station, multiple users need to be connected at the same time, this requires that the process state machine function be allowed to be reused, just as the object orientation is the relationship between classes and objects. we name the process to be reused as the process type, each actually used process is called a process instance. During protocol development, developers can create one or more process instances by calling the interface functions provided by the platform. To realize the reuse of state machine functions in a program, you must solve the function re-entry problem, we use the method of retaining a private storage area in each state machine function to save private variables during the process of function duplication, as shown in figure 3.
3.2 Implementation of Communication Mechanism
In SDL, the system is connected to the environment through a channel. The system consists of many function blocks connected by channels. Each function block is independent of other function blocks. The only means of communication between processes in two different functional blocks is to transmit signals through channels. Signals are the means of communication between different functional blocks of the system or between functional blocks and the environment.
Based on the purpose of sending signals, two different methods are used for SDL communication:
(1) process communication within the same functional block. In this case, the communication between processes is implemented by the message distribution mechanism within the functional block;
(2) process communication between different functional blocks. In this case, messages are sent to the functional block where the target process is located by calling the message sending mechanism of the operating system, the function block is then distributed to the process.
Either method uses the unified message sending interface function, which is transparent to developers.
3.3 timer management
Timer is an important element in SDL language and is widely used in communication protocol development. For example, in WiMAX system development, periodic ranging requires a timer to trigger periodic ranging process for signal quality detection, in the network port address filtering, address aging is required periodically. In the SDL protocol development platform, we bind the timer to the process state machine, and assign the timer to each process during the initialization of the platform through the static allocation method, the timer function is maintained by the function block task of the process. This method avoids the problem of excessive task load caused by the use of a task to manage all the timers. In addition, in order to reduce the task load of the function block, the traditional method of checking whether there is a timer timeout in a fixed tick cycle is not used in the function task, instead, you can use the function block task to wait for the external task message to time out to implement Timer timed checks. Specifically, the difference timer method is used to maintain the timer in the SDL function task, and a timer linked list is maintained in each function block task, when the timer starts, it is inserted into the timer linked list and sorted by time. After the function block task waits for the external message to time out, it checks whether there is a timer timeout in the linked list. If yes, it sends a timeout message to the corresponding process _ and deletes the timer, then, update the next timer timeout period and set the period to wait for external message timeout. The advantage of using this timer management mechanism is that the timer management task is activated only when the next timer times out, instead of needing to be activated every fixed cycle to check the timer linked list, this greatly saves the task switching time.
4 knots
Based on the SDL protocol development platform, it provides an efficient method to directly map the SDL language into protocol code, enables communication protocol software developers to focus on the system description stage in the early stage of protocol development, without the need to care about the implementation of the system underlying layer, this improves protocol development efficiency and code maintainability and portability. These advantages have been fully reflected in the development of a Fixed Broadband Wireless Access System Based on 802.16d. Currently, the SDL protocol development platform only implements basic SDL processes, function blocks, timers, and other elements. It only implements message interaction for communication in SDL, remote pro-eedure calls and remote variables are not implemented, which limits the use of the SDL platform in the development of complex communication protocols, we will gradually improve these problems in the future.