CN102937893B - A kind of software timing method of dynamic heavy duty timed length - Google Patents

A kind of software timing method of dynamic heavy duty timed length Download PDF

Info

Publication number
CN102937893B
CN102937893B CN201210383235.4A CN201210383235A CN102937893B CN 102937893 B CN102937893 B CN 102937893B CN 201210383235 A CN201210383235 A CN 201210383235A CN 102937893 B CN102937893 B CN 102937893B
Authority
CN
China
Prior art keywords
timer
software
timing
hardware
software timer
Prior art date
Legal status (The legal status 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 status listed.)
Active
Application number
CN201210383235.4A
Other languages
Chinese (zh)
Other versions
CN102937893A (en
Inventor
温权
陈新
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
FUJIAN KIRISUN COMMUNICATIONS Co.,Ltd.
Original Assignee
KIRISUN COMMUNICATION CO Ltd
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 KIRISUN COMMUNICATION CO Ltd filed Critical KIRISUN COMMUNICATION CO Ltd
Priority to CN201210383235.4A priority Critical patent/CN102937893B/en
Publication of CN102937893A publication Critical patent/CN102937893A/en
Application granted granted Critical
Publication of CN102937893B publication Critical patent/CN102937893B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Landscapes

  • Executing Machine-Instructions (AREA)
  • Debugging And Monitoring (AREA)

Abstract

The invention provides a kind of software timing method of dynamic heavy duty timed length, including step: a: create a hardware timer, concurrently set base during minimum reference, and hardware timer is initialized;B: after obtaining the object success of a hardware timer, the software timer of initialization services layer;C: create a software timer, arranges timing, starts software timer;D: according to timing, carries out corresponding thread process, in the task of corresponding software timer, the message received is judged, if timer message, just processes the message of software timer.Invention software timing method and software timer, based on hardware timer, utilize the Interruption of hardware timer to realize.Its timing is long, flexible and convenient to use, in the application scenario that complication system or runs mode are complicated, solves the problem that hardware resource is not enough, is greatly simplified software complexity, accelerate design process.

Description

A kind of software timing method of dynamic heavy duty timed length
Technical field
The present invention relates to embedded system field, particularly relate to a kind of software timing method of dynamic heavy duty timed length.
Background technology
In high-speed data acquisition and industrial control system, for meeting the requirement of reliability and real-time, the high precision timing as time reference always is very crucial problem.NucleusPLUS is the extendible multitask designed for real-time embedding system, is a kind of preemptive type operating system based on priority, and real-time is very strong, convenient transplanting.It is made to have good application at numerous areas.
In the design of embedded system, time response is all a critically important parameter in many applications, a lot of realizations controlling logic and agreement, needing to use timing, time-out and statistical function, the setting of the timing of time length and precision, cycle timing and time-out becomes some key condition controlling logic and agreement.The delay function of task and software timer function, being required for bottom has the enumerator support of a hardware.
Currently, the software code of embedded system is increasingly sophisticated.But, owing to the hardware resource such as memorizer, intervalometer is still relatively limited.How when not influential system overall performance, provide excellent detector timing properties b for embedded system, enable a system to Effec-tive Function, be a problem merited attention.
Summary of the invention
It is an object of the invention to provide a kind of software timing method of dynamic heavy duty timed length, the advantages such as it is many that it has resource, and timing is long, flexible and convenient to use.
Another object of the present invention is to provide a kind of software timing method of dynamic heavy duty timed length, the problem not enough to solve hardware resource, be greatly simplified software complexity, accelerate design process.
It is an object of the invention to be achieved through the following technical solutions.
A kind of software timing method of dynamic heavy duty timed length, including step:
A: create a hardware timer, concurrently sets base during minimum reference, and hardware timer is initialized;
B: after obtaining the object success of a hardware timer, the software timer of initialization services layer;
C: create a software timer, arranges timing, starts software timer;
D: according to timing, carries out corresponding thread process, in the task of corresponding software timer, the message received is judged, if timer message, just processes the message of software timer.
Preferably, step b specifically includes: the action listener of registration software timer, arranges base during benchmark, creates semaphore, mutual exclusion lock and establishment for service layer's software timer and processes the task of software timer message.
Preferably, step c specifically includes:
C1: judge whether it is that hardware is timed to, if timing is less than, continues to timing and waits;If it is, enter step c2;
C2: whether the chained list judging software timer is empty, if be sky, returns to the judgement that hardware is timed to;If not being empty, then enter step c3;
C3: take out the software timer of an assigned I D from chain the exterior and the interior, the count value of software timer subtracts one;
C4: judge whether current count value is zero, if be not zero, then returns to the judgement that hardware is timed to;If being zero, then enter step c5;
C5: send the message of a software timer, processes the task of corresponding software timer.
Preferably, in step d, the message received is judged, if not timer message, then other message of respective handling.
The present invention compared with prior art, has the beneficial effects that: the software timing method of dynamic heavy duty timed length provided by the invention and software timer, based on hardware timer, utilizes the Interruption of hardware timer to realize.Software timer needs to take cpu resource, but its resource is many, and timing is long, flexible and convenient to use, in the application scenario that complication system or runs mode are complicated, solves the problem that hardware resource is not enough, is greatly simplified software complexity, accelerate design process.
Accompanying drawing explanation
Fig. 1 is invention software timer construction block diagram.
Fig. 2 is the software timing method flow diagram of the present invention dynamically heavy duty timed length.
Fig. 3 is that software timer processes flow graph according to timing.
Detailed description of the invention
Core concept of the present invention: the present invention adds priority in software timer, it is provided that the mechanism of a kind of event notice-monitoring, the interrupt management module for operating system uses.After interrupting generation, interrupt management module can adjust back the function of user, and user judges whether that the task of requiring over interrupt management goes distribution, if need not, user process, otherwise it can manage module distributed tasks by triggered interrupts, and this task can notify away corresponding for this interrupt number event.Interrupt management module can to need Schedule Interrupt be directly adjust back the process function of user or being put in task processes when producing according to different.And intervalometer is then judged and process, create a higher timer management task of priority ratio, this task is timed then judgement and the process of device.Action listener function gives the task of this high priority by signal release semaphore so that it is obtain semaphore.This method shortens the execution time of interrupt service routine, thus improving the real-time of system.
In order to make the purpose of the present invention, technical scheme and advantage clearly understand, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein is only in order to explain the present invention, is not intended to limit the present invention.
Software timer is the set of one group of timer entity, is a kind of multitask chained list type data structure carrying out unified management for different timing service.Software timer can make system determine that the moment performs assigned operation a certain.It is based on programmable Timer/enumerator or single stabilization delay circuit, utilizes the Interruption that hardware timer produces to realize.
Referring to shown in Fig. 1, invention software intervalometer includes:
1, the establishment of software timer: create a software timer, obtains No. ID of a software timer simultaneously, and No. ID within 0-128, it is impossible to exceed, and is otherwise considered as establishment unsuccessful.There is single use or recycle two ways.
2, the base during benchmark of software timer is set: minimum timing unit.According to system, the requirement of timing can be set.The timing of same time span, different time bases has different timing accuracies.
3, software timer is started: obtain corresponding No. ID after creating an intervalometer and start timework.There is different entry conditions different application scenarios: pulse, level, event, interruption etc..
4, software timer is stopped: stopping the timing of software timer, namely reset.
5, the preset value of software timer: set timing initial value to software timer.After starting software timer, start timing on this basis.
6, software timer currency is obtained: obtain software timer count value of current time in timing course.Can be used to test timing etc..
The Interruption realizing mainly being produced by hardware timer of software timer, hardware timer provides two kinds of Interrupt Processing Models, one is then direct call back function in the direct, mode, another is the member function interpolation event functions that non-Direct Model then needs to call interrupt management class, is put into event-monitoring mechanism and realizes interrupt mechanism.And the mode that here software timer realizes is mainly event-monitoring mechanism.It is by processing release semaphore in function at event interrupt, obtains semaphore and process various event in thread.
Software timer is before creating, first pass through hardware timer and base value when one (minimum Tick) is set, then generate a software timer, designated software intervalometer timing time is set, start intervalometer, if timing arrives, it is put in corresponding thread going processing, first passes through and judge whether it is the message of intervalometer, if the message of intervalometer just removes to process the Message function of intervalometer, if it is not, just do other process.
Refer to shown in Fig. 2, the software timing method of the present invention dynamically heavy duty timed length, including:
Step 201: create a hardware timer, concurrently set base during minimum reference.Start hardware timer, given hard intervalometer base class sub-object is timed device encapsulation simultaneously and initializes.
Step 202: after obtaining the object success of a hardware timer, the software timer of initialization services layer.Including the action listener of registration software timer, base during benchmark is set, creates semaphore, mutual exclusion lock and the establishment task of processing software timer message etc. for service layer's software timer.
Step 203: create a software timer, arranges timing, starts software timer.
Step 204: according to timing, carries out corresponding thread process.
As it is shown on figure 3, concrete thread process includes:
Step 301: judge whether it is that hardware is timed to, if timing is less than, continues to timing and waits;If it is, enter step 302.
Step 302: whether the chained list judging software timer is empty, if be sky, returns to the judgement that hardware is timed to;If not being empty, then enter step 303.
Step 303: take out the software timer of an assigned I D from chain the exterior and the interior, the count value of software timer subtracts one.
Step 304: judge whether current count value is zero, if be not zero, then returns to the judgement that hardware is timed to;If being zero, then enter step 305.
Step 305: send the message of a software timer, processes the task of corresponding software timer.
Step 205: in the task of corresponding software timer, judges the message received, if timer message, just processes the message of software timer;If it is not, with regard to other message of respective handling.
In the present invention, hardware timer (OMAP-L137) is the processor with ARM926EJ-S and C674x Floating-point DSP kernel, each core dominant frequency can reach 300MHz clock, and the timer/counter module of this hardware timer contains two identical 64 bit timing devices/enumerator passages of function.This intervalometer has four kinds of timing modes: the general timing mode of 64, double; two 32 general timing modes of non-chain type, double; two 32 chain type timing modes, house dog timing mode;Timing mode of the present invention adopts double; two 32 general timing modes of non-chain type, the intervalometers of two 64 is divided into the intervalometer of four 32.
The software timing method of dynamic heavy duty timed length provided by the invention and software timer, based on hardware timer, utilize the Interruption of hardware timer to realize.Software timer needs to take cpu resource, but its resource is many, and timing is long, flexible and convenient to use, in the application scenario that complication system or runs mode are complicated, solves the problem that hardware resource is not enough, is greatly simplified software complexity, accelerate design process.
The foregoing is only presently preferred embodiments of the present invention, not in order to limit the present invention, all any amendment, equivalent replacement and improvement etc. made within the spirit and principles in the present invention, should be included within protection scope of the present invention.

Claims (2)

1. the software timing method of a dynamic heavy duty timed length, it is characterised in that include step:
A: create a hardware timer, concurrently sets base during minimum reference, and hardware timer is initialized;
B: after obtaining the object success of a hardware timer, the software timer of initialization services layer;
C: create a software timer, arranges timing, starts software timer;
D: according to timing, carries out corresponding thread process, in the task of corresponding software timer, the message received is judged, if timer message, just processes the message of software timer;
Described step b specifically includes: the action listener of registration software timer, arranges base during benchmark, creates semaphore, mutual exclusion lock and establishment for service layer's software timer and processes the task of software timer message;
Described step c specifically includes:
C1: judge whether it is that hardware is timed to, if timing is less than, continues to timing and waits;If it is, enter step c2;
C2: whether the chained list judging software timer is empty, if be sky, returns to the judgement that hardware is timed to;If not being empty, then enter step c3;
C3: take out the software timer of an assigned I D from chain the exterior and the interior, the count value of software timer subtracts one;
C4: judge whether current count value is zero, if be not zero, then returns to the judgement that hardware is timed to;If being zero, then enter step c5;
C5: send the message of a software timer, processes the task of corresponding software timer.
2. the software timing method of dynamically heavy duty timed length as claimed in claim 1, it is characterised in that in step d, the message received is judged, if not timer message, then other message of respective handling.
CN201210383235.4A 2012-10-11 2012-10-11 A kind of software timing method of dynamic heavy duty timed length Active CN102937893B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210383235.4A CN102937893B (en) 2012-10-11 2012-10-11 A kind of software timing method of dynamic heavy duty timed length

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210383235.4A CN102937893B (en) 2012-10-11 2012-10-11 A kind of software timing method of dynamic heavy duty timed length

Publications (2)

Publication Number Publication Date
CN102937893A CN102937893A (en) 2013-02-20
CN102937893B true CN102937893B (en) 2016-07-06

Family

ID=47696792

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210383235.4A Active CN102937893B (en) 2012-10-11 2012-10-11 A kind of software timing method of dynamic heavy duty timed length

Country Status (1)

Country Link
CN (1) CN102937893B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834347B (en) * 2015-04-29 2017-08-25 杭州东信捷峻科技有限公司 Be conducive to the dynamic duration timer realization method without cumulative errors of low-power consumption
CN105528015A (en) * 2015-12-22 2016-04-27 恒宝股份有限公司 Implementation method of soft clock and application device thereof
CN106201692B (en) * 2016-07-11 2020-02-04 苏州浪潮智能科技有限公司 Timing task processing system and method
CN106445668B (en) * 2016-09-28 2020-04-10 深圳Tcl数字技术有限公司 Timing method and device of timer
CN109032772A (en) * 2018-06-19 2018-12-18 山东省科学院自动化研究所 A kind of embedded software method for managing timer and system
CN110333938A (en) * 2019-05-31 2019-10-15 苏州简约纳电子有限公司 A method of improving embedded timer efficiency

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101534243A (en) * 2008-12-04 2009-09-16 苏州迈科网络安全技术有限公司 Method for dispatching timer under IP network environment
CN101727352A (en) * 2009-12-15 2010-06-09 四川长虹电器股份有限公司 Method for realizing timer

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8447657B2 (en) * 2007-12-31 2013-05-21 Sap Ag Architectural design for service procurement application software

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101534243A (en) * 2008-12-04 2009-09-16 苏州迈科网络安全技术有限公司 Method for dispatching timer under IP network environment
CN101727352A (en) * 2009-12-15 2010-06-09 四川长虹电器股份有限公司 Method for realizing timer

Also Published As

Publication number Publication date
CN102937893A (en) 2013-02-20

Similar Documents

Publication Publication Date Title
CN102937893B (en) A kind of software timing method of dynamic heavy duty timed length
TWI541725B (en) Resource management in a multicore architecture
CN105657639B (en) Dual-mode equipment and its method realized while communicated
TWI738722B (en) Application program interface deadlock monitoring method and device
TW201837733A (en) Blockchain consensus method, equipment, and system in which a consensus algorithm is arranged as an independent consensus unit and multiple consensus units collectively form a consensus unit set
CN103209439A (en) Method, apparatus and device for monitoring data traffic
CN108804238B (en) Soft bus communication method based on remote procedure call
KR20140127341A (en) Method and system for scheduling requests in a portable computing device
CN104102540B (en) The management method and mobile terminal of a kind of operation process
CN102711139A (en) Data flow counting method and terminal
CN102270156A (en) Method for managing real-time embedded system timers
Garbugli et al. TEMPOS: QoS management middleware for edge cloud computing FaaS in the Internet of Things
CN103593192A (en) Algorithm integration and evaluation platform and method based on SLURM scheduling
CN102420709A (en) Method and equipment for managing scheduling task based on task frame
CN113032166A (en) Inter-core communication method, processor, inter-core communication system, and computer-readable storage medium
WO2019141151A1 (en) Method and device for configuring base station
US20120089990A1 (en) System and method for reporting a synchronization event in a runtime system of a computer system
González et al. μ DDS: a middleware for real-time wireless embedded systems
Haikun et al. Research and Application of the IOT Gateway Based on the Real-Time Specification for Java.
CN103257942B (en) A kind of method of SOC (system on a chip) shared bus request process and device
De Munck et al. Design and performance evaluation of a conservative parallel discrete event core for GES
Adamczewski-Musch et al. Dataflow engine in DAQ backbone DABC
CN106293884B (en) The detection method of invalid time exceeded message in a kind of message-driven system
Noguero et al. The design of an Orchestrator for a middleware architecture based on FTT-CORBA
Zhou et al. LIMOS: a tiny real-time micro-kernel for wireless objects

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20180402

Address after: 518057 Guangdong city of Shenzhen province Nanshan District Xili Street Lang Road No. 11, Tongfang information port A on the third floor

Patentee after: Shenzhen kelixun Communication Co., Ltd.

Address before: 518057 Guangdong city of Shenzhen province Nanshan District Science Park Song Ping Shan Qi Min Road No. three Betel building six floor

Patentee before: Kirisun Communication Co., Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200511

Address after: 362000 Fujian province Quanzhou Fengze District Science and Technology Industrial Park Road, Haixi electronic information industry incubation base building C

Patentee after: FUJIAN KIRISUN COMMUNICATIONS Co.,Ltd.

Address before: 518057 Guangdong city of Shenzhen province Nanshan District Xili Street Lang Road No. 11, Tongfang information port A on the third floor

Patentee before: SHENZHEN KIRISUN COMMUNICATIONS Co.,Ltd.

TR01 Transfer of patent right