CN102937893A - Software timing method of dynamic overload timing length - Google Patents

Software timing method of dynamic overload timing length Download PDF

Info

Publication number
CN102937893A
CN102937893A CN2012103832354A CN201210383235A CN102937893A CN 102937893 A CN102937893 A CN 102937893A CN 2012103832354 A CN2012103832354 A CN 2012103832354A CN 201210383235 A CN201210383235 A CN 201210383235A CN 102937893 A CN102937893 A CN 102937893A
Authority
CN
China
Prior art keywords
timer
software
timing
hardware
message
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.)
Granted
Application number
CN2012103832354A
Other languages
Chinese (zh)
Other versions
CN102937893B (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

Images

Landscapes

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

Abstract

The invention provides a software timing method of a dynamic overload timing length. The software timing method comprises the following steps of: a, establishing a hardware timer, and simultaneously setting a minimum reference time base and initializing the hardware timer; b, after successfully obtaining a target of the hardware timer, initializing a software timer module of a service layer; c, establishing the software timer, setting timing time and starting the software timer; and d, carrying out corresponding thread treatment according to the timing time; judging received information in a task corresponding to the software timer; and if judging that the received information is timer information, processing information of the software timer. By using the hardware timer as a base, the software timing method and the software timer provided by the invention can be realized by timing interruption of the hardware timer, so that the timing time is long; and the software timing method is flexible and convenient to use. The problem that hardware resources are not enough can be solved in application fields with a complex system or a complex timer working manner can be solved; the software complexity can be greatly simplified; and the design process can be accelerated.

Description

A kind of dynamic heavy duty is the software timing method of length regularly
Technical field
The present invention relates to the embedded system field, relate in particular to the regularly software timing method of length of a kind of dynamic heavy duty.
Background technology
In high-speed data acquisition and industrial control system, for satisfying the requirement of reliability and real-time, always be very crucial problem as the high precision timing of time reference.Nucleus PLUS is the extendible multitask that designs for real-time embedding system, is a kind of preemptive type operating system of Priority-based, and real-time is very strong, the convenient transplanting.It is had preferably at numerous areas uses.
In the design of embedded system, time response all is a very important parameter in a lot of the application, the realization of a lot of steering logics and agreement, need to use timing, overtime and statistical function, the timing of time length and precision, cycle timing and overtime setting become the key condition of some steering logic and agreement.The delay function of task and software timer function all need bottom that the counter support of a hardware is arranged.
Current, the software code of embedded system is increasingly sophisticated.Yet, because the hardware resources such as storer, timer are still relatively limited.How in the situation that do not affect the entire system performance, for embedded system provides excellent detector timing properties b, system can efficiently being moved, has been a problem that merits attention.
Summary of the invention
The object of the present invention is to provide the regularly software timing method of length of a kind of dynamic heavy duty, the advantage such as it is many that it has resource, and timing is long, and is flexible and convenient to use.
Another object of the present invention is to provide the regularly software timing method of length of a kind of dynamic heavy duty, to solve the problem of hardware resource deficiency, greatly simplify software complexity, accelerate design process.
The objective of the invention is to be achieved through the following technical solutions.
A kind of dynamic heavy duty is the software timing method of length regularly, comprises step:
A: create a hardware timer, base when setting minimum reference simultaneously, and to the hardware timer initialization;
B: after obtaining the object success of a hardware timer, the soft timer module of initialization service layer;
C: create a soft timer, timing is set, start soft timer;
D: according to timing, carry out corresponding thread process, in the task of corresponding software timer, the message that receives is judged, if timer message, just process the message of soft timer.
Preferably, step b specifically comprises: the action listener of registration soft timer, base when benchmark is set is for the service layer soft timer creates semaphore, mutual exclusion institute and creates the task of processing soft timer message.
Preferably, step c specifically comprises:
C1: judge whether it is that hardware is timed to, if regularly be less than, just continue timing and wait for; If so, enter step c2;
C2: whether the chained list of judging software timer is empty, if be empty, just gets back to the judgement that hardware is timed to; If be not empty, then enter step c3;
C3: take out the software timer of an assigned I D in the chained list, the count value of software timer subtracts one;
C4: judge that whether current count value is zero, if non-vanishing, then gets back to the judgement that hardware is timed to; If be zero, then enter step c5;
C5: the task of sending the corresponding software timer of Message Processing of a soft timer.
Preferably, in the steps d, the message that receives is judged, if not timer message, other message of respective handling then.
The present invention compared with prior art, beneficial effect is: dynamic heavy duty provided by the invention is software timing method and the software timer of length regularly, is the basis by hardware timer, utilizes the Interruption of hardware timer to realize.Software timer need to take cpu resource, but its resource is many, and timing is long, and is flexible and convenient to use, in the application scenario of complication system or timer working method complexity, solves the problem of hardware resource deficiency, greatly simplifies software complexity, accelerates design process.
Description of drawings
Fig. 1 is software timer structured flowchart of the present invention.
Fig. 2 is the dynamically software timing method flow diagram of heavy duty timing length of the present invention.
Fig. 3 is that software timer is processed flow graph according to timing.
Embodiment
Core concept of the present invention: the present invention adds priority in software timer, and the mechanism of a kind of event notice-monitoring is provided, for the interrupt management module of operating system is used.After interrupting generation, the interrupt management module can be adjusted back user's function, and the user judges whether and need to go distribution by the task of interrupt management, if do not need then processed by the user, otherwise it can trigger interrupt management module distributed tasks, and this task can be gone out the corresponding event notice of this interrupt number.It is directly to adjust back user's processing function or be put in the task to process that the interrupt management module can be gone according to different needs to dispatch when interrupting producing.And to timer estimation ﹠ disposing then, created a timer management task that priority ratio is higher, in this task, carry out then judgement and the processing of timer.The action listener function is given the task of this high priority by the signal release semaphore, make its picked up signal amount.This method has shortened the execution time of interrupt service routine, thereby improves the real-time of system.
In order to make purpose of the present invention, technical scheme and advantage clearer, below in conjunction with drawings and Examples, the present invention is further elaborated.Should be appreciated that specific embodiment described herein 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 categorical data structure of carrying out unified management for the different timing service.Software timer can make system carry out assigned operation in a certain definite moment.It is take programmable Timer/counter or single stabilization delay circuit as the basis, and the Interruption that utilizes hardware timer to produce is realized.
See also shown in Figure 1ly, software timer of the present invention comprises:
1, the establishment of software timer: create a software timer, obtain simultaneously ID number an of software timer, within 0-128, can not surpass, otherwise be considered as creating unsuccessful for ID number.There is single to use or recycle dual mode.
Base when 2, the benchmark of soft timer being set: minimum timing unit.Can set requirement regularly according to system.The timing of same time span, different time bases have different timing accuracies.
3, start soft timer: obtain corresponding ID number beginning timework after having created a timer.There is different entry conditions different application scenarios: pulse, level, event, interruption etc.
4, stop soft timer: stop the timing of software timer, namely reset.
5, the prevalue of software timer: set the timing initial value to soft timer.After starting soft timer, begin on this basis timing.
6, obtain the soft timer currency: the count value that obtains soft timer current time in timing course.Can be used for testing timing etc.
The realization of software timer mainly is the Interruption that is produced by hardware timer, hardware timer provides two kinds of Interrupt Processing Models, a kind of is at the next direct call back function of Direct Model, another member function that is non-Direct Model then needs to call the interrupt management class adds event functions, just enters event-monitoring mechanism and realizes interrupt mechanism.And the mode of software timer realization here mainly is event-monitoring mechanism.It is by processing release semaphore in the function in event interrupt, and the picked up signal amount is processed variety of event in thread.
Software timer is before creating, base value when arranging one by hardware timer first (minimum Tick), then generate a software timer, designated software timer timing time is set, start timer, if timing has arrived, just enter and go in the corresponding thread to process, at first by judging whether it is the message of timer, if the message of timer just removes to process the Message function of timer, if not, just do other processing.
See also shown in Figure 2ly, the present invention is the heavy duty software timing method of length regularly dynamically, comprising:
Step 201: create a hardware timer, base when setting minimum reference simultaneously.Start hardware timer, simultaneously given hard timer base class sub-object is carried out timer encapsulation initialization.
Step 202: after obtaining the object success of a hardware timer, the soft timer module of initialization service layer.Comprise the action listener of registering soft timer, base when benchmark is set is for the service layer soft timer creates semaphore, mutual exclusion institute and creates task of processing soft timer message etc.
Step 203: create a soft timer, timing is set, start soft timer.
Step 204: according to timing, carry out corresponding thread process.
As shown in Figure 3, concrete thread process comprises:
Step 301: judge whether it is that hardware is timed to, if regularly be less than, just continue timing and wait for; If so, enter step 302.
Step 302: whether the chained list of judging software timer is empty, if be empty, just gets back to the judgement that hardware is timed to; If be not empty, then enter step 303.
Step 303: take out the software timer of an assigned I D in the chained list, the count value of software timer subtracts one.
Step 304: judge that whether current count value is zero, if non-vanishing, then gets back to the judgement that hardware is timed to; If be zero, then enter step 305.
Step 305: the task of sending the corresponding software timer of Message Processing of a soft timer.
Step 205: in the task of corresponding software timer, the message that receives is judged, if timer message, just processed the message of soft timer; If not, with regard to other message of respective handling.
Among the present invention, hardware timer (OMAP-L137) is for having the processor of ARM926EJ-S and C674x Floating-point DSP kernel, each examines dominant frequency can reach the 300MHz clock, and the timer/counter module of this hardware timer contains two the identical 64 bit timings device of function/counter passages.This timer has four kinds of timing modes: 64 general timing mode, two 32 general timing modes of non-chain type, two 32 chain type timing modes, house dog timing mode; Timing mode of the present invention adopts two 32 general timing modes of non-chain type, two 64 timers is divided into four 32 timer.
Dynamic heavy duty provided by the invention is software timing method and the software timer of length regularly, is the basis by hardware timer, utilizes the Interruption of hardware timer to realize.Software timer need to take cpu resource, but its resource is many, and timing is long, and is flexible and convenient to use, in the application scenario of complication system or timer working method complexity, solves the problem of hardware resource deficiency, greatly simplifies software complexity, accelerates design process.
The above only is preferred embodiment of the present invention, not in order to limiting the present invention, all any modifications of doing within the spirit and principles in the present invention, is equal to and replaces and improvement etc., all should be included within protection scope of the present invention.

Claims (4)

1. the software timing method of a dynamic heavy duty timing length is characterized in that, comprises step:
A: create a hardware timer, base when setting minimum reference simultaneously, and to the hardware timer initialization;
B: after obtaining the object success of a hardware timer, the soft timer module of initialization service layer;
C: create a soft timer, timing is set, start soft timer;
D: according to timing, carry out corresponding thread process, in the task of corresponding software timer, the message that receives is judged, if timer message, just process the message of soft timer.
2. the dynamic heavy duty as claimed in claim 1 software timing method of length regularly, it is characterized in that, step b specifically comprises: the action listener of registration soft timer, base when benchmark is set is for the service layer soft timer creates semaphore, mutual exclusion institute and creates the task of processing soft timer message.
3. the software timing method of dynamic heavy duty timing length as claimed in claim 2 is characterized in that, step c specifically comprises:
C1: judge whether it is that hardware is timed to, if regularly be less than, just continue timing and wait for; If so, enter step c2;
C2: whether the chained list of judging software timer is empty, if be empty, just gets back to the judgement that hardware is timed to; If be not empty, then enter step c3;
C3: take out the software timer of an assigned I D in the chained list, the count value of software timer subtracts one;
C4: judge that whether current count value is zero, if non-vanishing, then gets back to the judgement that hardware is timed to; If be zero, then enter step c5;
C5: the task of sending the corresponding software timer of Message Processing of a soft timer.
4. the dynamic heavy duty as claimed in claim 2 software timing method of length regularly is characterized in that, in the steps d, the message that receives is judged, and if not timer message, other message of respective handling then.
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 true CN102937893A (en) 2013-02-20
CN102937893B 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)

Cited By (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834347A (en) * 2015-04-29 2015-08-12 杭州东信捷峻科技有限公司 Implementation method for dynamic time duration timer in favor of low power consumption and free of accumulated error
CN105528015A (en) * 2015-12-22 2016-04-27 恒宝股份有限公司 Implementation method of soft clock and application device thereof
CN106201692A (en) * 2016-07-11 2016-12-07 浪潮(北京)电子信息产业有限公司 A kind of timing task processing system and method
WO2018058830A1 (en) * 2016-09-28 2018-04-05 深圳Tcl数字技术有限公司 Timing method and device for 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 (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172699A1 (en) * 2007-12-31 2009-07-02 Christoph Jungkind Architectural Design for Service Procurement Application Software
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

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20090172699A1 (en) * 2007-12-31 2009-07-02 Christoph Jungkind Architectural Design for Service Procurement Application Software
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

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104834347A (en) * 2015-04-29 2015-08-12 杭州东信捷峻科技有限公司 Implementation method for dynamic time duration timer in favor of low power consumption and free of accumulated error
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
CN106201692A (en) * 2016-07-11 2016-12-07 浪潮(北京)电子信息产业有限公司 A kind of timing task processing system and method
WO2018058830A1 (en) * 2016-09-28 2018-04-05 深圳Tcl数字技术有限公司 Timing method and device for 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

Also Published As

Publication number Publication date
CN102937893B (en) 2016-07-06

Similar Documents

Publication Publication Date Title
CN102937893A (en) Software timing method of dynamic overload timing length
Landsiedel et al. Chaos: Versatile and efficient all-to-all data sharing and in-network processing at scale
CN101452404B (en) Task scheduling apparatus and method for embedded operating system
CN105657639B (en) Dual-mode equipment and its method realized while communicated
US20220400028A1 (en) Operation control method and device, household electrical appliance, and storage medium
CN103209439A (en) Method, apparatus and device for monitoring data traffic
CN101546277B (en) Multiple core processor platform and multiple core processor synchronization method
TWI738722B (en) Application program interface deadlock monitoring method and device
CN102622208B (en) Multi-core reconfigurable processor cluster and reconfiguration method thereof
CN111506430B (en) Method and device for processing data under multitasking and electronic equipment
CN105024942B (en) A kind of dynamic flow monitoring method
CN105187327A (en) Distributed message queue middleware
CN102609237A (en) Scalable random number generation
CN107977302B (en) CPU utilization rate output method and device
CN102711139A (en) Data flow counting method and terminal
CN109921915A (en) Test the method, apparatus and electronic equipment of real-time clock module arousal function
CN111258247A (en) Embedded management and control platform of intelligent turn-off control switch of 5G communication base station
CN107704317B (en) Intelligent device and application management method thereof and device with storage function
WO2016149945A1 (en) Life cycle event processing method and vnfm
CN114153783B (en) Method, system, computer device and storage medium for implementing multi-core communication mechanism
Zhao et al. Research on the priority-based soft real-time task scheduling in TinyOS
WO2012174838A1 (en) Method and system of parallel transmitting network element messages
CN101692737B (en) Light weight data synchronization system and method
WO2011131010A1 (en) Method and apparatus for timing
CN101976206A (en) Interrupt handling method and device

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