WO2018129757A1 - 一种基于龙芯平台的通信控制框架 - Google Patents

一种基于龙芯平台的通信控制框架 Download PDF

Info

Publication number
WO2018129757A1
WO2018129757A1 PCT/CN2017/071378 CN2017071378W WO2018129757A1 WO 2018129757 A1 WO2018129757 A1 WO 2018129757A1 CN 2017071378 W CN2017071378 W CN 2017071378W WO 2018129757 A1 WO2018129757 A1 WO 2018129757A1
Authority
WO
WIPO (PCT)
Prior art keywords
layer
module
management
interface
service
Prior art date
Application number
PCT/CN2017/071378
Other languages
English (en)
French (fr)
Inventor
邱烽林
Original Assignee
邦彦技术股份有限公司
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by 邦彦技术股份有限公司 filed Critical 邦彦技术股份有限公司
Publication of WO2018129757A1 publication Critical patent/WO2018129757A1/zh

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/544Buffers; Shared memory; Pipes
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/542Event management; Broadcasting; Multicasting; Notifications
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/545Interprogram communication where tasks reside in different layers, e.g. user- and kernel-space
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues

Definitions

  • the invention relates to the field of Loongson communication, and particularly relates to a communication control framework based on a Loongson platform.
  • Loongson is a general-purpose CPU designed by the Institute of Computing Technology of the Chinese Academy of Sciences. It uses the MIPS reduced instruction set architecture and obtained the patent license of MIPS Technologies.
  • the frequency of Godson-1 is 266MHz, which was first used in 2002.
  • the Godson 2 has a frequency of up to 1 GHz.
  • the Godson 3A is the first domestic commercial 4-core processor with an operating frequency of 900MHz to 1GHz.
  • the peak computing power of Godson 3A reaches 16GFLOPS.
  • Godson 3B is the first domestic commercial 8-core processor with a frequency of 1GHz, support vector operation acceleration, peak computing capacity of 128GFLOPS, and high performance-to-power ratio.
  • the object of the present invention is to overcome the above problems existing in the prior art, and to provide a communication control framework based on the Loongson platform for supporting business development in the field of data communication, and greatly improving software development efficiency.
  • a communication control framework based on a Loongson platform comprising a communication control architecture based on a Loongson operating system and hardware;
  • the communication control architecture includes an interface encapsulation layer, a driver layer, a common framework layer, a protocol distribution layer, and a service layer;
  • the common framework layer manages the communication response and processing instruction mechanism;
  • the service layer responds to the common framework layer instruction;
  • the service layer and the common framework layer perform two-way data interaction through the protocol distribution layer;
  • the interface encapsulation layer respectively provides an API interface to the common framework layer, the protocol distribution layer, and the service layer;
  • the interface encapsulation layer receives the data transmitted by the common framework layer, the protocol distribution layer, and the service layer;
  • the public framework layer, the protocol distribution layer, and the service layer receive the interface encapsulation layer to transmit data from the Loongson-based operating system and hardware;
  • the driver layer provides driving support for the service layer.
  • the common framework layer includes module management; the module management adopts a module to enter The module management includes module startup management and module state monitoring; the module startup management adopts a hierarchical management mechanism; the module startup management processing module sequentially starts; the module state monitoring timing monitoring module process status.
  • the module startup management includes acquiring module information, a module control block structure type definition, a storage module control block information, a module information filling, and a hierarchical operation module.
  • the module status monitoring includes acquiring the monitored module information, creating a monitoring task, sending a test activation message, starting timing, determining a status of the monitored module, and restarting the module.
  • the common framework layer further includes a basic data structure package; the basic data structure package includes a linked list clink package, a hash table hash package, and a tree ctree package.
  • the common framework layer further includes log management; the log management includes log hierarchical printing, log file storage, and log file backup.
  • the common framework layer further includes configuration management; the configuration management adopts a json open source component, and the json open source component reads the local json format configuration file and saves the configuration data.
  • the common framework layer further includes a third-party library; the third-party library provides support for configuration management; and the communication control framework supports third-party library extension.
  • the protocol distribution layer includes a message distribution mechanism and an event distribution mechanism; the message distribution mechanism is one-to-one distribution; and the event distribution mechanism is one-to-many distribution.
  • the interface encapsulation layer is encapsulated with an in-process/inter-process IPC communication interface, a multi-tasking management interface, a timing management interface, a time management interface, and a unified data type;
  • the service layer includes an application layer and a network management service;
  • the driver layer communicates with the network management service in two directions, and the application layer communicates with the network management service in two directions; the application layer interacts with the driver layer through the network management service in two directions.
  • the present invention provides a communication control framework based on a Loongson platform, including a communication control architecture based on a Loongson operating system and hardware;
  • the communication control architecture includes an interface encapsulation layer, a driving layer, and a common framework layer, a protocol distribution layer, a service layer;
  • the common framework layer manages a communication response and a processing instruction mechanism;
  • the service layer responds to the common framework layer instruction;
  • the service layer and the common framework layer pass the
  • the protocol distribution layer performs bidirectional data interaction;
  • the interface encapsulation layer respectively provides an API interface to the common framework layer, the protocol distribution layer, and the service layer; and the interface encapsulation layer receives the common framework layer and protocol distribution
  • the data transmitted by the layer and the service layer; the common frame layer, the protocol distribution layer, and the service layer receiving the interface encapsulation layer are transmitted from the data in the Loongson-based operating system and hardware;
  • the driving layer Provide driving support for the business layer hold.
  • the framework provides log function and debugging means based on log4cplus third-party library, which improves the efficiency of problem location;
  • FIG. 1 is a schematic diagram of a communication control framework based on a Loongson platform of the present invention
  • FIG. 2 is a logic diagram of monitoring of a communication module based on a Godson platform according to the present invention
  • FIG. 3 is a flow chart of monitoring a communication module based on a Godson platform according to the present invention.
  • FIG. 4 is a flow chart of determining a monitoring state of a communication module based on a Godson platform according to the present invention
  • FIG. 5 is a schematic diagram of a communication message distribution mechanism based on the Loongson platform of the present invention.
  • FIG. 6 is a schematic diagram of a communication event distribution mechanism based on the Loongson platform of the present invention.
  • a communication control framework and system based on the Loongson platform includes a communication control architecture based on a Loongson operating system and hardware; as shown in FIG. 1, the communication control architecture includes an interface encapsulation layer. , a driver layer, a common framework layer, a protocol distribution layer, a service layer; the common framework layer manages a communication response and processing instruction mechanism; the service layer responds to the common framework layer instruction; the service layer and the The common framework layer performs bidirectional data interaction through the protocol distribution layer; the interface encapsulation layer provides an API interface to the common framework layer, the protocol distribution layer, and the service layer respectively; the interface encapsulation layer receiving station Data transmitted by the common framework layer, the protocol distribution layer, and the service layer; The common framework layer, the protocol distribution layer, and the service layer receive the interface encapsulation layer to transmit data from the Loongson-based operating system and hardware; the driver layer provides a driver for the service layer.
  • the communication control architecture includes an interface encapsulation layer. , a driver layer, a common
  • the interface encapsulation layer provides a calling API interface, which not only receives the data sent by the upper layer, but also notifies the upper layer application through the callback function.
  • the common framework layer further includes configuration management; the configuration management uses a json open source component, and the json open source component reads the local json format configuration file and saves the configuration data.
  • the common framework layer further includes a third party library; the third party library provides support for configuration management, and the communication control framework supports third party library extension.
  • the common framework layer includes module management; ensuring uniqueness of the module process in the global, the module management adopts a module process unique interface; the module management includes module startup management, module state monitoring; The module startup management adopts a hierarchical management mechanism; the module startup management processing module is sequentially started; and the module state monitoring timing monitoring module process state.
  • the module startup management includes acquiring module information, a module control block structure type definition, a storage module control block information, a module information filling, and a hierarchical operation module.
  • Get module information including the ID of the acquisition module, module name, entry function, and entry function name. The above information will provide the basis for the establishment and operation of the module.
  • Module control block structure type definition Defines the module control block structure type, which is used to manage module description information, status information, and so on. Each entry in the module table is a module control block structure node.
  • the module control block structure type definition uses macro definitions. The specific macros are defined as follows:
  • the storage module control block information stores all module control block information, and stores information of all modules of the system by defining a global array.
  • the global array is defined as follows:
  • Hierarchical operation module Starts according to 0 ⁇ 8 level, 0 level starts first, and so on; to solve the dependency problem between modules at startup, the startup is divided into eight levels. Start each module in turn according to the system startup sequence requirements.
  • the module status monitoring includes acquiring the monitored module information, creating a monitoring task, sending a test activation message, starting timing, determining a status of the monitored module, and restarting the module. If the critical module runs into a state where the service cannot be provided (the module hangs), for simplicity, the module management can choose to restart the system. Since the module status monitoring is based on the tasks in the module, considering that one module can have multiple tasks, it is required that the application module needs to register the module status monitoring for its own management tasks after startup. As shown in FIG. 2 and FIG. 3, the module status monitoring is implemented by starting an independent task, creating a new receiving message queue, and sending a test activation message to the monitored module.
  • the monitoring task After the monitoring task sends the activation message ACTIVITY_TEST, it immediately starts a timer. When the timer expires, the callback function will be called to read all the messages in the received message queue. For example, all the tested modules replied to the response activation message ACTIVITY_OK within the specified time. The system is normal; if the corresponding monitored module response message is missing in the receiving message queue, the module monitoring task will take corresponding action, that is, restart the system. As an independent task, monitoring, like the module being monitored, has the general characteristics of the module, such as the startup function, module ID, module name, etc., so the heartbeat and reply message communication between the monitoring module and the monitored module can use the message distribution mechanism. carry out.
  • the timer callback function is used to verify whether the monitored module is alive.
  • a new timer is established, and the module is again activated within the specified time.
  • Test message when the module response message is not received, it indicates that the tested module may be faulty, and the callback function should complete the system restart function.
  • the callback function After the retransmission timer expires, the callback function resends the activation message to all modules, then turns off the retransmission timer and starts a new activation timer.
  • the common framework layer further includes a basic data structure package; the basic data structure package includes a linked list clink package, a hash table hash package, and a tree ctree package.
  • the hash function is constructed by the direct addressing method, the prime number remainder method, the squared subtraction method, and the folding method, and the hash addresses of any set of keywords are distributed as evenly as possible in the entire address space.
  • the calculation results are randomly distributed to reduce the possibility of occurrence of the conflict. And resolve conflicts through open addressing, chain address method, re-hash method, and overflow area method.
  • the open addressing method when a collision occurs, finds an idle unit that can store records near the front and back of the conflict location. To resolve conflicts in this way, a sequence of probes is generated along which to find the free cells that can hold the records.
  • the simplest detection sequence generation method is to perform linear detection, that is, when a collision occurs, the idle cells are sequentially detected in order from the next storage location of the conflicting storage location.
  • the chain address method links all records whose synonyms are synonymous into a linear linked list, and links its chain to the storage unit indicated by the hash address determined by the hash function.
  • hash when a conflict occurs, use another hash function to calculate another hash address. If there is another conflict, use another hash function until no conflict occurs. This method requires a sequence of hash functions to be set in advance.
  • the overflow area method in addition to the basic storage area (called the basic table), creates a common overflow area (called the overflow table), and when a conflict occurs, the record can be stored in the public overflow area.
  • the search process of the hash table is basically consistent with the construction process of the hash table.
  • the hash address is obtained according to the hash function set when the table is built; if the location of the hash address is already Recording, and its key value is not equal to the given value k, then the next address of the synonym is obtained according to the conflict processing method set when the table is built, until the position of the obtained hash address is idle or the key of the record therein
  • the value of the word is equal to the given value k; if the memory space corresponding to the obtained hash address is idle, the search fails; if the value of the record key in the memory space corresponding to the obtained hash address is equal to the given value k, Then the search is successful.
  • the average search time depends on the loading factor of the hash table.
  • the degree of the node, the number of branches of the node is the degree of the node, the number of branches of the node.
  • a non-terminal node a node whose degree is not zero.
  • the level of the node, the level of the root node in the tree is 1, the root of the root node is the second layer, and so on.
  • the degree of the tree the maximum value of all nodes in the tree.
  • the depth of the tree the maximum of all node levels in the tree.
  • Ordered tree unordered tree, if each subtree in the tree has a certain order from left to right, and cannot be interchanged, it is called an ordered tree, otherwise it is called an unordered tree.
  • the forest is a collection of mutually disjoint trees of m (m ⁇ 0).
  • the root of the child and parent node subtree is called the child of this node, and this node is also called the child's parents.
  • the descendants, all nodes in the subtree rooted at a node are called descendants of the node.
  • An ancestor from the root node to all nodes on the path to that node.
  • the common framework layer further includes log management; the log management includes log hierarchical printing, log file storage, and log file backup.
  • the log output uses the third-party library log4plus, and on this basis, a layer of interfaces is encapsulated and output to the application execution directory according to the level through the file mode.
  • the protocol distribution layer includes a message distribution mechanism and an event distribution mechanism; the message distribution mechanism is one-to-one distribution; and the event distribution mechanism is one-to-many distribution.
  • the inter-module message is distributed one-to-one according to the module ID to ensure the accuracy of message distribution.
  • FIG. 6 for the event distribution mechanism, multiple modules may focus on the same event type, one-to-many; register the event ID number of interest and its own callback function to the event distribution layer through each module; after the event distribution layer receives the event The response module is notified by the callback function according to the registered event ID.
  • the interface encapsulation layer is encapsulated with an in-process/inter-process IPC communication interface, a multi-tasking management interface, a timing management interface, a time management interface, and a unified data type;
  • the service layer includes an application layer and a network management service;
  • the driver layer is in two-way communication with the network management service, and the application layer communicates with the network management service in two directions; the application layer and the driver layer pass the network management service Two-way interaction.
  • Cross-platform system API package respectively implemented a set of system API functions under Linux/Windows/Vxworks, perfect support for Linux/Windows/Vxworks operating system
  • Multi-task management interface interface for creating and destroying threads (tasks);
  • Timer management interface timer creation, destruction and other interfaces
  • Time management interface obtain current UTC time, standard time, time conversion interface, etc.
  • Table 1 is based on the basic data type of 32-bit package platform
  • the invention provides a communication control framework based on the Loongson platform, including a Loongson-based operating system a communication control architecture with hardware;
  • the communication control architecture includes an interface encapsulation layer, a driver layer, a common framework layer, a protocol distribution layer, and a service layer;
  • the common framework layer manages a communication response and a processing instruction mechanism;
  • the service layer and the common framework layer perform bidirectional data interaction through the protocol distribution layer;
  • the interface encapsulation layer respectively refers to the common framework layer and protocol
  • the distribution layer and the service layer provide an API interface;
  • the interface encapsulation layer receives the data transmitted by the common framework layer, the protocol distribution layer, and the service layer; and the common framework layer, the protocol distribution layer, and the service layer receive the
  • the interface encapsulation layer transmits data from the Loongson-based operating system and hardware;
  • the driver layer provides drive support for the service layer.
  • the framework provides log function and debugging means based on log4cplus third-party library, which improves the efficiency of problem location;

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Multimedia (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

本发明提供一种基于龙芯平台的通信控制框架,包括基于龙芯的操作系统与硬件的通信控制架构;所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;本发明采用模块化、低耦合的框架设计,模块之间统一通过消息机制通信,低耦合特点也提高了系统的可扩展性;本发明提供各种基础服务和接口,同时采用宏将各种系统独立的API隔离起来,形成对上统一的接口,支持跨平台操作系统,如Linux/Windows/Vxworks操作系统;本发明框架可调试性强,框架提供了包括基于log4cplus第三方库的日志功能和调试手段,提高了问题定位的效率。

Description

一种基于龙芯平台的通信控制框架 技术领域
本发明涉及龙芯通信领域,具体涉及一种基于龙芯平台的通信控制框架。
背景技术
龙芯是中国科学院计算技术研究所设计的通用CPU,采用MIPS精简指令集架构,获得了MIPS科技公司专利授权。龙芯1号的频率为266MHz,最早在2002年开始使用。龙芯2号的频率最高为1GHz。龙芯3A是首款国产商用4核处理器,其工作频率为900MHz~1GHz。龙芯3A的峰值计算能力达到16GFLOPS。龙芯3B是首款国产商用8核处理器,主频达到1GHz,支持向量运算加速,峰值计算能力达到128GFLOPS,具有很高的性能功耗比。
目前业界有许多优秀的开源和非开源的技术框架,如MFC、.NET、Poco、Boost、struct、hibernate等;或者针对特定业务的开发软件框架,但这些框架都是针对某一领域特定方面或者是定位于基础工具框架类的,而无法做到在数据通信领域很好的支持代码重用和业务开发,特别是急需一种基于龙芯平台的通信控制框架。
发明内容
本发明的目的在于克服现有技术存在的以上问题,提供一种基于龙芯平台的通信控制框架,用于支撑数据通信领域的业务开发,极大的提高软件开发效率。
为实现上述技术目的,达到上述技术效果,本发明通过以下技术方案实现:
一种基于龙芯平台的通信控制框架,包括基于龙芯的操作系统与硬件的通信控制架构;所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的公共框架层管理通信响应与处理指令机制;所述的业务层响应所述的公共框架层指令;所述的业务层与所述的公共框架层通过所述的协议分发层进行双向数据交互;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;所述的接口封装层接收所述的公共框架层、协议分发层、业务层传输的数据;所述的公共框架层、协议分发层、业务层接收所述的接口封装层传输源于所述的基于龙芯的操作系统与硬件中的数据;所述的驱动层为所述的业务层提供驱动支持。
进一步的,所述的公共框架层包括模块管理;所述的模块管理采用模块进 程唯一接口;所述的模块管理包括模块启动管理、模块状态监测;所述的模块启动管理采用分级管理机制;所述的模块启动管理处理模块顺序启动;所述的模块状态监测定时监测模块进程状态。
进一步的,所述的模块启动管理包括获取模块信息、模块控制块结构体类型定义、存储模块控制块信息、模块信息填写、分级运行模块。
进一步的,所述的模块状态监测包括获取被监测模块信息、创建监测任务、发送测试激活消息、启动定时、判断被监测模块状态、重启模块。
进一步的,所述的公共框架层还包括基本数据结构封装;所述的基本数据结构封装包括链表clink封装、哈希表chash封装、树ctree封装。
进一步的,所述的公共框架层还包括日志管理;所述的日志管理包括日志分级打印、日志文件存储、日志文件备份。
进一步的,所述的公共框架层还包括配置管理;所述的配置管理采用json开源组件,所述的json开源组件读取本地的json格式配置文件并保存配置数据。
进一步的,所述的公共框架层还包括第三方库;所述的第三方库为配置管理提供支持;所述的通信控制框架支持第三方库扩展。
进一步的,所述的协议分发层包括消息分发机制、事件分发机制;所述的消息分发机制为一对一分发;所述的事件分发机制为一对多分发。
进一步的,所述的接口封装层封装有进程内/进程间IPC通信接口、多任务管理接口、定时管理接口、时间管理接口、统一数据类型;所述的业务层包括应用层与网管服务;所述的驱动层与所述的网管服务双向通信,所述的应用层与所述的网管服务双向通信;所述的应用层与所述的驱动层通过所述的网管服务双向交互。
本发明的有益效果:本发明提供一种基于龙芯平台的通信控制框架,包括基于龙芯的操作系统与硬件的通信控制架构;所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的公共框架层管理通信响应与处理指令机制;所述的业务层响应所述的公共框架层指令;所述的业务层与所述的公共框架层通过所述的协议分发层进行双向数据交互;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;所述的接口封装层接收所述的公共框架层、协议分发层、业务层传输的数据;所述的公共框架层、协议分发层、业务层接收所述的接口封装层传输源于所述的基于龙芯的操作系统与硬件中的数据;所述的驱动层为所述的业务层提供驱动支 持。与现有技术相比,本发明的优点如下:
1)模块化、低耦合,框架采用模块化设计,模块之间统一通过消息机制通信,低耦合特点也提高了系统的可扩展性;
2)支持跨平台,通过宏将各种系统独立的API隔离起来,形成对上统一的接口,支持Linux/Windows/Vxworks操作系统;
3)可调试性,框架提供了包括基于log4cplus第三方库的日志功能和调试手段,提高了问题定位的效率;
4)提供各种基础服务和接口,如socket套接字、命名管道等IPC进程间通讯机制;同时还封装有基本数据结构、定时器。
上述说明仅是本发明技术方案的概述,为了能够更清楚了解本发明的技术手段,并可依照说明书的内容予以实施,以下以本发明的较佳实施例并配合附图详细说明如后。本发明的具体实施方式由以下实施例及其附图详细给出。
附图说明
此处所说明的附图用来提供对本发明的进一步理解,构成本申请的一部分,本发明的示意性实施例及其说明用于解释本发明,并不构成对本发明的不当限定。在附图中:
图1是本发明的一种基于龙芯平台的通信控制框架示意图;
图2是本发明的一种基于龙芯平台的通信模块监测逻辑图;
图3是本发明的一种基于龙芯平台的通信模块监测流程图;
图4是本发明的一种基于龙芯平台的通信模块监测状态判断流程图;
图5是本发明的一种基于龙芯平台的通信消息分发机制示意图;
图6是本发明的一种基于龙芯平台的通信事件分发机制示意图。
具体实施方式
下面将参考附图并结合实施例,来详细说明本发明。
参照图1-6所示,一种基于龙芯平台的通信控制框架及其系统,包括基于龙芯的操作系统与硬件的通信控制架构;如图1所示,所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的公共框架层管理通信响应与处理指令机制;所述的业务层响应所述的公共框架层指令;所述的业务层与所述的公共框架层通过所述的协议分发层进行双向数据交互;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;所述的接口封装层接收所述的公共框架层、协议分发层、业务层传输的数据; 所述的公共框架层、协议分发层、业务层接收所述的接口封装层传输源于所述的基于龙芯的操作系统与硬件中的数据;所述的驱动层为所述的业务层提供驱动支持。接口封装层对上提供了调用的API接口,既接收上层下发的数据,也会将底层数据通过回调函数等方式通知到上层应用。所述的公共框架层还包括配置管理;所述的配置管理采用json开源组件,所述的json开源组件读取本地的json格式配置文件并保存配置数据。优选地,所述的公共框架层还包括第三方库;所述的第三方库为配置管理提供支持,所述的通信控制框架支持第三方库扩展。
进一步的,所述的公共框架层包括模块管理;确保模块进程在全局中的唯一性,所述的模块管理采用模块进程唯一接口;所述的模块管理包括模块启动管理、模块状态监测;所述的模块启动管理采用分级管理机制;所述的模块启动管理处理模块顺序启动;所述的模块状态监测定时监测模块进程状态。
进一步的,所述的模块启动管理包括获取模块信息、模块控制块结构体类型定义、存储模块控制块信息、模块信息填写、分级运行模块。
获取模块信息:包括获取模块的ID、模块名称、入口函数、入口函数名称。上述信息将为模块的建立、运行提供依据。
模块控制块结构体类型定义:定义模块控制块结构体类型,用于管理模块描述信息、状态信息等。模块表中的每一表项都是一个模块控制块结构结点。模块控制块结构体类型定义采用宏定义,具体宏定义如下:
typedef struct_mm_task_{
osa_task_id tid;
char*name;
}mm_task_t;
typedef struct_mm_mod_des_{
INT32status;/*用于指示模块当前状态*/
char*name;
mm_task_t t[MDL_MM_TASK_MAXNUM];
}mm_module_t;
存储模块控制块信息:存储所有模块控制块信息,通过定义一个全局数组来存储系统所有模块的信息,全局数组定义如下:
static mm_module_t gs_module[MDL_MAX_MODULE_NUM];
模块信息的填写:在mm_read_cfg()内部函数中,为所有需要运行的模块填写模块信息。
分级运行模块:按照0~8分级启动,0级最先启动,以此类推;为解决启动时模块之间依赖问题,将启动分为八个等级。按系统启动顺序需求,依次启动各模块。
进一步的,所述的模块状态监测包括获取被监测模块信息、创建监测任务、发送测试激活消息、启动定时、判断被监测模块状态、重启模块。如关键模块运行过程中进入不能提供服务的状态(模块挂死),简单起见,模块管理可以选择重启系统。由于模块状态监测是基于模块中的任务,考虑到一个模块可功能存在多个任务,因此要求应用模块在启动后,需要为自身管理的任务向模块状态监测进行注册。如图2、图3所示,模块状态监测的实现,通过启动一个独立的任务,新建一个接收消息队列,向被监测模块发送测试激活消息。监测任务发送完激活消息ACTIVITY_TEST后,立即启动一个定时器,当定时器超时,将调用回调函数读取接收消息队列中所有消息,如所有被测试模块均在规定时间内回复了响应激活消息ACTIVITY_OK,则表明系统正常;若接收消息队列中缺失相应的被监测模块响应消息,模块监测任务将采取相应的处理措施,即重启系统。监测作为一个独立的任务,与被监测模块一样,具备模块的一般特性,如启动函数、模块ID、模块名称等,所以监测模块与被监测模块间的心跳与回复消息通讯就可以使用消息分发机制完成。
如图4所示,为模块监测状态判断流程图,定时器回调函数用于验证被监测模块是否存活,当收到模块响应消息后,建立新的定时器,在指定时间内再次向模块发送激活测试消息;当未收到模块响应消息时,表明被测试模块可能出现故障,回调函数应完成系统重启功能。重发定时器超时后,回调函数向所有模块重发激活消息,之后关闭重发定时器,并启动一个新的激活定时器。
进一步的,所述的公共框架层还包括基本数据结构封装;所述的基本数据结构封装包括链表clink封装、哈希表chash封装、树ctree封装。
如哈希表chash封装中,通过直接定址法、质数取余法、平方取中法、折叠法构建哈希函数,尽可能地使任意一组关键字的哈希地址均匀地分布在整个地址空间中,即用任意关键字作为哈希函数的自变量其计算结果随机分布,以便减少冲突的发生可能性。并通过开放定址法、链地址法、再哈希法、溢出区法解决冲突
开放定址法,当发生冲突时,在冲突位置的前后附近寻找可以存放记录的空闲单元。用此法解决冲突,要产生一个探测序列,沿着此序列去寻找可以存放记录的空闲单元。最简单的探测序列产生方法是进行线性探测,即当发生冲突时,从发生冲突的存储位置的下一个存储位置开始依次顺序探测空闲单元。
链地址法,将所有关键字是同义词的记录链接成一个线性链表,将其链头链接在由哈希函数确定的哈希地址所指示的存储单元中。
再哈希法,当发生冲突时,用另一个哈希函数再计算另一个哈希地址,如果再发生冲突,再使用另一个哈希函数,直至不发生冲突为止。这种方法要求预先要设置一个哈希函数的序列。
溢出区法,除基本的存储区外(称为基本表),另外建立一个公共溢出区(称为溢出表),当发生冲突时,记录可以存入这个公共溢出区。
哈希表的查找过程与哈希表的构造过程基本一致,对于给定的关键字值k,按照建表时设定的哈希函数求得哈希地址;若哈希地址所指位置已有记录,并且其关键字值不等于给定值k,则根据建表时设定的冲突处理方法求得同义词的下一地址,直到求得的哈希地址所指位置为空闲或其中记录的关键字值等于给定值k为止;如果求得的哈希地址对应的内存空间为空闲,则查找失败;如果求得的哈希地址对应的内存空间中的记录关键字值等于给定值k,则查找成功。
上述查找过程可以描述如下:
(1)计算出给定关键字值对应的哈希地址addr=H(k);
(2)while((addr中不空)&&(addr中关键字值!=k))按冲突处理方法求得下一地址addr;
(3)如果(addr中为空),则查找失败,返回失败信息;
(4)否则查找成功,并返回地址addr;
在处理冲突方法相同的哈希表中,其平均查找时间,还依赖于哈希表的装填因子,哈希表的装填因子为:α=表中填入的记录数/哈希表的长度,装填因子越小,表中填入的记录就越少,发生冲突的可能性就会小,反之,表中已填入的记录越多,再填充记录时,发生冲突的可能性就越大,则查找时进行关键字的比较次数就越多。
树ctree的封装中,树是n(n≥0)个节点的有限集合。若n=0,则称为空树;否则,有且仅有一个特定的节点被称为根,当n>1时,其余节点被分成m(m>0)个互不相交的子集T1,T2,...,Tm,每个子集又是一棵树。由此可以看出,树 的定义是递归。节点,数据元素的内容及其指向其子树根的分支统称为节点。
节点的度,节点的分支数。
终端节点(叶子),度为0的节点。
非终端节点,度不为0的节点。
节点的层次,树中根节点的层次为1,根节点子树的根为第2层,以此类推。
树的度,树中所有节点度的最大值。
树的深度,树中所有节点层次的最大值。
有序树、无序树,如果树中每棵子树从左向右的排列拥有一定的顺序,不得互换,则称为有序树,否则称为无序树。
森林,是m(m≥0)棵互不相交的树的集合。
在树结构中,节点之间的关系又可以用家族关系描述,定义如下:
孩子、双亲节点子树的根称为这个节点的孩子,而这个节点又被称为孩子的双亲。
子孙,以某节点为根的子树中的所有节点都被称为是该节点的子孙。
祖先,从根节点到该节点路径上的所有节点。
兄弟,同一个双亲的孩子之间互为兄弟。
堂兄弟,双亲在同一层的节点互为堂兄弟。
进一步的,所述的公共框架层还包括日志管理;所述的日志管理包括日志分级打印、日志文件存储、日志文件备份。日志输出采用第三方库log4plus,并在此基础上封装了一层接口,按照级别通过文件方式输出到应用程序执行目录下。
进一步的,所述的协议分发层包括消息分发机制、事件分发机制;所述的消息分发机制为一对一分发;所述的事件分发机制为一对多分发。如图5所示,为消息分发机制,模块间消息根据模块ID进行一对一消息分发,确保消息分发的准确性。如图6所示,为事件分发机制,多个模块可能关注同一事件类型,一对多;通过各模块向事件分发层注册关注的事件ID号以及自身的回调函数;事件分发层收到事件后,会根据注册的事件ID,通过回调函数通知到响应模块。
进一步的,所述的接口封装层封装有进程内/进程间IPC通信接口、多任务管理接口、定时管理接口、时间管理接口、统一数据类型;所述的业务层包括应用层与网管服务;所述的驱动层与所述的网管服务双向通信,所述的应用层与所述的网管服务双向通信;所述的应用层与所述的驱动层通过所述的网管服 务双向交互。跨平台系统API封装,分别在Linux/Windows/Vxworks下实现了一套系统API功能,完美支持Linux/Windows/Vxworks操作系统
平台无关系统API封装:
1)进程内/进程间IPC通信接口:消息队列、命名管道、Socket套接字;
2)多任务管理接口:线程(任务)的创建、销毁等接口;
3)定时器管理接口:定时器创建、销毁等接口;
4)时间管理接口:获取当前UTC时间、标准时间,时间转换接口等;
5)统一类型定义:UINT8/16/32/64、INT8/16/32/64、IPV4ADDR;如下表
表1基于32位封装平台基本数据类型
Figure PCTCN2017071378-appb-000001
本发明提供一种基于龙芯平台的通信控制框架,包括基于龙芯的操作系统 与硬件的通信控制架构;所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的公共框架层管理通信响应与处理指令机制;所述的业务层响应所述的公共框架层指令;所述的业务层与所述的公共框架层通过所述的协议分发层进行双向数据交互;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;所述的接口封装层接收所述的公共框架层、协议分发层、业务层传输的数据;所述的公共框架层、协议分发层、业务层接收所述的接口封装层传输源于所述的基于龙芯的操作系统与硬件中的数据;所述的驱动层为所述的业务层提供驱动支持。与现有技术相比,本发明的优点如下:
1)模块化、低耦合,框架采用模块化设计,模块之间统一通过消息机制通信,低耦合特点也提高了系统的可扩展性;
2)支持跨平台,通过宏将各种系统独立的API隔离起来,形成对上统一的接口,完美支持Linux/Windows/Vxworks操作系统;
3)可调试性,框架提供了包括基于log4cplus第三方库的日志功能和调试手段,提高了问题定位的效率;
4)提供各种基础服务和接口,如socket套接字、命名管道等IPC进程间通讯机制;同时还封装有基本数据结构、定时器。
以上所述,仅为本发明的较佳实施例而已,并非对本发明作任何形式上的限制;凡本行业的普通技术人员均可按说明书附图所示和以上所述而顺畅地实施本发明;但是,凡熟悉本专业的技术人员在不脱离本发明技术方案范围内,利用以上所揭示的技术内容而做出的些许更动、修饰与演变的等同变化,均为本发明的等效实施例;同时,凡依据本发明的实质技术对以上实施例所作的任何等同变化的更动、修饰与演变等,均仍属于本发明的技术方案的保护范围之内。

Claims (9)

  1. 一种基于龙芯平台的通信控制框架,其特征在于:包括基于龙芯的操作系统与硬件的通信控制架构;所述的通信控制架构包括接口封装层、驱动层、公共框架层、协议分发层、业务层;所述的公共框架层管理通信响应与处理指令机制;所述的业务层响应所述的公共框架层指令;所述的业务层与所述的公共框架层通过所述的协议分发层进行双向数据交互;所述的接口封装层分别对所述的公共框架层、协议分发层、业务层提供API接口;所述的接口封装层接收所述的公共框架层、协议分发层、业务层传输的数据;所述的公共框架层、协议分发层、业务层接收所述的接口封装层传输源于所述的基于龙芯的操作系统与硬件中的数据;所述的驱动层为所述的业务层提供驱动支持。
  2. 根据权利要求1所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的公共框架层包括模块管理;所述的模块管理采用模块进程唯一接口;所述的模块管理包括模块启动管理、模块状态监测;所述的模块启动管理采用分级管理机制;所述的模块启动管理处理模块顺序启动;所述的模块状态监测定时监测模块进程状态。
  3. 根据权利要求2所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的模块启动管理包括获取模块信息、模块控制块结构体类型定义、存储模块控制块信息、模块信息填写、分级运行模块。
  4. 根据权利要求2所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的模块状态监测包括获取被监测模块信息、创建监测任务、发送测试激活消息、启动定时、判断被监测模块状态、重启模块。
  5. 根据权利要求2所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的公共框架层还包括基本数据结构封装;所述的基本数据结构封装包括链表clink封装、哈希表chash封装、树ctree封装。
  6. 根据权利要求2所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的公共框架层还包括日志管理;所述的日志管 理包括日志分级打印、日志文件存储、日志文件备份。
  7. 根据权利要求2所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的公共框架层还包括配置管理;所述的配置管理采用json开源组件,所述的json开源组件读取本地的json格式配置文件并保存配置数据。
  8. 根据权利要求7所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的公共框架层还包括第三方库;所述的第三方库为配置管理提供支持;所述的通信控制框架支持第三方库扩展。
  9. 根据权利要求1至8其中之一所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的协议分发层包括消息分发机制、事件分发机制;所述的消息分发机制为一对一分发;所述的事件分发机制为一对多分发。
    根据权利要求1至8其中之一所述的一种基于龙芯平台的通信控制框架,其特征在于:所述的接口封装层封装有进程内/进程间IPC通信接口、多任务管理接口、定时管理接口、时间管理接口、统一数据类型;所述的业务层包括应用层与网管服务;所述的驱动层与所述的网管服务双向通信,所述的应用层与所述的网管服务双向通信;所述的应用层与所述的驱动层通过所述的网管服务双向交互。
PCT/CN2017/071378 2017-01-13 2017-01-17 一种基于龙芯平台的通信控制框架 WO2018129757A1 (zh)

Applications Claiming Priority (2)

Application Number Priority Date Filing Date Title
CN2017100254800 2017-01-13
CN201710025480.0A CN106815086B (zh) 2017-01-13 2017-01-13 一种基于龙芯平台的通信控制装置

Publications (1)

Publication Number Publication Date
WO2018129757A1 true WO2018129757A1 (zh) 2018-07-19

Family

ID=59110919

Family Applications (1)

Application Number Title Priority Date Filing Date
PCT/CN2017/071378 WO2018129757A1 (zh) 2017-01-13 2017-01-17 一种基于龙芯平台的通信控制框架

Country Status (2)

Country Link
CN (1) CN106815086B (zh)
WO (1) WO2018129757A1 (zh)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124488A (zh) * 2019-12-11 2020-05-08 山东超越数控电子股份有限公司 一种基于龙芯处理器的Debian系统移植方法
CN111581006A (zh) * 2020-05-09 2020-08-25 中国航空无线电电子研究所 一种面向显控系统控制器的面板构架
CN113378006A (zh) * 2021-07-04 2021-09-10 芯河半导体科技(无锡)有限公司 一种基于xml存储的配置管理框架
CN115706849A (zh) * 2021-08-05 2023-02-17 北京小米移动软件有限公司 相机软件架构、平台和终端设备

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN108768717A (zh) * 2018-05-23 2018-11-06 广州慧睿思通信息科技有限公司 一种网络通信框架的设计方法
CN109189373B (zh) * 2018-08-31 2022-01-21 南京怡化信息技术有限公司 一种基于独立业务应用模式的多人协同开发平台及方法
CN111459534A (zh) * 2019-01-18 2020-07-28 杭州明特科技有限公司 一种能源信息网关的应用系统架构
CN111258684B (zh) * 2020-01-22 2023-09-29 北京和利时控制技术有限公司 一种控制方法和装置
CN112422411A (zh) * 2020-11-09 2021-02-26 天津卓越信通科技有限公司 一种基于大型通信系统的消息分发机制
CN115242563B (zh) * 2021-06-25 2023-11-14 统信软件技术有限公司 一种网络通信方法、计算设备及可读存储介质

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1161045A2 (en) * 2000-04-10 2001-12-05 International Business Machines Corporation Network processor architecture
CN101277303A (zh) * 2008-05-16 2008-10-01 东南大学 一种可信可控网络体系结构的控制方法
CN102323879A (zh) * 2011-06-07 2012-01-18 北京大学 完整网络中间件运行支撑平台及异构中间件的集成方法
CN104572061A (zh) * 2014-03-21 2015-04-29 中电科技(北京)有限公司 一种基于龙芯服务器的uefi固件实现方法

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103034545B (zh) * 2012-12-10 2016-08-03 上海斐讯数据通信技术有限公司 基于ace的通信框架和方法、及功能模块间的通信方法
CN104506365A (zh) * 2014-12-24 2015-04-08 上海市共进通信技术有限公司 无源光网络中实现多种芯片业务兼容分析的方法

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
EP1161045A2 (en) * 2000-04-10 2001-12-05 International Business Machines Corporation Network processor architecture
CN101277303A (zh) * 2008-05-16 2008-10-01 东南大学 一种可信可控网络体系结构的控制方法
CN102323879A (zh) * 2011-06-07 2012-01-18 北京大学 完整网络中间件运行支撑平台及异构中间件的集成方法
CN104572061A (zh) * 2014-03-21 2015-04-29 中电科技(北京)有限公司 一种基于龙芯服务器的uefi固件实现方法

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111124488A (zh) * 2019-12-11 2020-05-08 山东超越数控电子股份有限公司 一种基于龙芯处理器的Debian系统移植方法
CN111581006A (zh) * 2020-05-09 2020-08-25 中国航空无线电电子研究所 一种面向显控系统控制器的面板构架
CN111581006B (zh) * 2020-05-09 2023-08-01 中国航空无线电电子研究所 一种面向显控系统控制器的面板构架系统
CN113378006A (zh) * 2021-07-04 2021-09-10 芯河半导体科技(无锡)有限公司 一种基于xml存储的配置管理框架
CN113378006B (zh) * 2021-07-04 2024-02-09 芯河半导体科技(无锡)有限公司 一种基于xml存储的配置管理框架
CN115706849A (zh) * 2021-08-05 2023-02-17 北京小米移动软件有限公司 相机软件架构、平台和终端设备
CN115706849B (zh) * 2021-08-05 2024-01-30 北京小米移动软件有限公司 相机软件架构、平台和终端设备

Also Published As

Publication number Publication date
CN106815086A (zh) 2017-06-09
CN106815086B (zh) 2020-04-14

Similar Documents

Publication Publication Date Title
WO2018129757A1 (zh) 一种基于龙芯平台的通信控制框架
TWI738722B (zh) 應用程式介面死鎖監控方法和裝置
US9600411B2 (en) System and method for determining an object's lifetime in an object oriented environment
US9092247B2 (en) Persistent and resilient worker processes
US8341643B2 (en) Protecting shared resources using shared memory and sockets
BRPI0611726A2 (pt) aparelho para realizar um ciclo de operação útil em um artigo fìsico
CN110716748A (zh) 业务处理方法、装置、计算机可读介质及电子设备
US20110067007A1 (en) Automatic thread dumping
CN111355622A (zh) 容器的业务监控方法、系统和计算机可读存储介质
US11294740B2 (en) Event to serverless function workflow instance mapping mechanism
CN114153783B (zh) 多核通信机制的实现方法、系统、计算机设备及存储介质
CN113542390B (zh) 一种采用内存数据模型的物联网设备管理方法及系统
Yao et al. Design and implementation of IOT gateway based on embedded μTenux operating system
US20170041402A1 (en) Method for transparently connecting augmented network socket operations
Su et al. To delay instantiation of a smart contract to save calculation resources in IoT
CN113938527B (zh) Api网关的扩展处理方法、计算设备及存储介质
CN115421693A (zh) 微前端架构的实现方法、装置、计算机设备和存储介质
CN114547206A (zh) 一种数据同步方法和数据同步系统
Rathore et al. Efficient checkpoint Algorithm for distributed system
Hawkridge et al. Comparison of Erlang/OTP and JADE implementations for standby redundancy in a holonic controller
CN113377446B (zh) 一种线程池的运行状态获取方法、装置和电子设备
Padilha et al. WED-SQL: a relational framework for design and implementation of process-aware information systems
CN111476663B (zh) 一种数据处理方法、装置、节点设备及存储介质
Shi CoAP infrastructure for IoT
Acharya et al. Specifying a mobile computing application environment using rsl

Legal Events

Date Code Title Description
121 Ep: the epo has been informed by wipo that ep was designated in this application

Ref document number: 17891543

Country of ref document: EP

Kind code of ref document: A1

NENP Non-entry into the national phase

Ref country code: DE

122 Ep: pct application non-entry in european phase

Ref document number: 17891543

Country of ref document: EP

Kind code of ref document: A1