[go: up one dir, main page]

CN1317654C - Edge Triggered Interrupt Sharing Method - Google Patents

Edge Triggered Interrupt Sharing Method Download PDF

Info

Publication number
CN1317654C
CN1317654C CNB2004100087656A CN200410008765A CN1317654C CN 1317654 C CN1317654 C CN 1317654C CN B2004100087656 A CNB2004100087656 A CN B2004100087656A CN 200410008765 A CN200410008765 A CN 200410008765A CN 1317654 C CN1317654 C CN 1317654C
Authority
CN
China
Prior art keywords
interrupt
equipment
interruption
triggers
sharing method
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.)
Expired - Fee Related
Application number
CNB2004100087656A
Other languages
Chinese (zh)
Other versions
CN1670719A (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.)
Primax Electronics Ltd
Original Assignee
Primax Electronics 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 Primax Electronics Ltd filed Critical Primax Electronics Ltd
Priority to CNB2004100087656A priority Critical patent/CN1317654C/en
Publication of CN1670719A publication Critical patent/CN1670719A/en
Application granted granted Critical
Publication of CN1317654C publication Critical patent/CN1317654C/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Bus Control (AREA)

Abstract

The invention discloses an edge triggered interrupt sharing method, which realizes edge triggered interrupt sharing by circularly calling an interrupt routine of equipment for multiple times, and comprises the following steps: step 1, detecting each equipment interrupt request to enter a main interrupt process; step 2, calling each device interrupt routine in sequence to process device interrupt; and step 3, determining whether to execute the step of calling the interrupt routine of each device in sequence in step 2 again according to the interrupt processing result. In each interrupt routine of the circular call equipment, if the interrupt is detected and processed, the interrupt is required to be circularly detected again, and the interrupt processing can be quitted only if the interrupt is not detected in one circulation, so that the interrupt loss or the interrupt deadlock can be avoided, and the edge triggered interrupt sharing is realized.

Description

The edge triggers and interrupts sharing method
Technical field
The present invention relates to a kind of interruption and share method, particularly relate to a kind of edge and trigger the shared method of interruption.
Background technology
For the interrupt request that external unit proposes, can use two kinds of detection methods: level triggers and edge trigger.
1, level triggering mode
On IR (interrupt request) incoming line, detect a significant level (high level or low level), and after interrupting the sampling pulse arrival, first can keep significant level, just thinking has external unit to propose interrupt request, and make SR (Interrupt Status Register, interrupt status register) corresponding positions continue to put 1.Level triggering mode provides the interruption that repeats to produce, and is used for the situation of the continuous execution subroutine of needs till interrupt request IR neutralizes.This mode allow to interrupt request line by " or " relation connects, promptly several interrupt request are imported with same IR.
2, edge triggering mode
When detect from low to high at the IR input end (or from high to low) go up (or down) saltus step the time, and level remains to first and interrupts after sampling pulse arrives, just thinking has interrupt request.
Yet the edge triggering mode designs for connecting single interrupt source.In this case, expanding extra interruption input if desired, is very difficult.Because the edge triggering mode that interrupts is not supported to interrupt sharing, do not allow a plurality of interrupt sources to be connected to the same interrupting input end of interruptable controller.
Interrupt sharing problem for solving the edge triggering, U.S. Pat 4631670 has disclosed a kind of edge triggering of using hardware approach to realize and has interrupted shared method.
Summary of the invention
Technical matters to be solved by this invention provides a kind of edge and triggers the shared method of interruption, and the edge triggering mode that the solution prior art is interrupted is not supported to interrupt shared, does not allow a plurality of interrupt sources to be connected to the problem of the same interrupting input end of interruptable controller.
For achieving the above object, the invention provides a kind of edge and trigger the shared method of interruption, its characteristics are, realize that by repeatedly recursive call device interrupt routine the edge triggers interruption and shares, comprise: step 1, detect each device interrupt request and enter main Interrupt Process; Step 2 is called out each device interrupt routine treatment facility successively and is interrupted; Step 3, the result carry out step 2 once more according to Interrupt Process.
Above-mentioned edge triggers and interrupts sharing method, and its characteristics are that this step 2 is to detect per unit interruption status one by one, and this interruption is handled.
Above-mentioned edge triggers and interrupts sharing method, its characteristics are, this step 3 is meant as long as detect arbitrary equipment after this step 2 that finishes interrupts, then carry out this step 2 again, and after this step 2 that is finished, when not detecting any equipment and taking place to interrupt, just stop to carry out this step 2, and withdraw from main Interrupt Process.
Above-mentioned edge triggers and interrupts sharing method, and its characteristics are, before this step 2, comprise that also one forbids the step of main interrupt line.
Above-mentioned edge triggers and interrupts sharing method, and its characteristics are that this device interrupt routine treatment facility must return a state value when interrupting, if this equipment does not interrupt, then returns vacation, if taken place to interrupt then return true.
Above-mentioned edge triggers and interrupts sharing method, and its characteristics are, after this step 2, as long as the return state value that an equipment is arranged is then carried out recursive call once more and handled for true.
Technique effect of the present invention is: the present invention is in the routine of recursive call device interrupt each time (Routine), if detected and handled the interruption of some or a plurality of equipment, then must recycle once detect, only once do not detecting the interruption generation in the circulation, just can withdraw from Interrupt Process, so just can avoid interrupting losing or interrupting deadlock, realize that the edge triggers interruption and shares.
Further describe specific embodiments of the invention below in conjunction with accompanying drawing.
Description of drawings
Fig. 1 is a hardware environment synoptic diagram of the present invention;
Fig. 2 is traditional interrupt handling routine process flow diagram;
Fig. 3 loses sequential chart for the interruption of using traditional interrupt handling routine to cause;
The interruption deadlock sequential chart of Fig. 4 for using traditional interrupt handling routine to cause;
Fig. 5 is that method flow diagram is shared in interruption of the present invention;
Fig. 6 is the overall flow figure that contains the device interrupt routine of the present invention;
Fig. 7 solves the sequential chart that interruption is lost for adopting the present invention; And
Fig. 8 solves the sequential chart that interrupts deadlock for adopting the present invention.
Wherein, description of reference numerals is as follows:
Tri-state gate circuit 10
Step 201 is removed the INTx state
The ISR of step 202 calling device 1
Step 203 is called out successively, until equipment n
Step 501 detects each device interrupt request and enters main Interrupt Process
Step 502 is called out each device interrupt routine treatment facility successively and is interrupted
Step 503 is called out each device interrupt routine once more successively according to the Interrupt Process result
Step 601 is forbidden main interrupt line
Step 602 is removed main interruption status and is installed and is equipped with interrupt identification RV for false
Step 603 is called out each device interrupt routine successively, promptly at first reads this device interrupt state
Step 604 judges whether to interrupt
If step 605 has taken place to interrupt then has carried out Interrupt Process
Step 606 is removed this device interrupt state
Step 607 is returned very
If step 608 does not take place to interrupt then returns vacation
If step 609 rreturn value is for very then put the RV value for true
Step 610 judges whether the RV sign is true
Step 611 allows main interrupt line
Embodiment
As shown in Figure 1, be hardware environment synoptic diagram of the present invention, equipment 1 to many device interrupt of equipment n with " or " relation connect, as long as any one device interrupt state becomes " produce and interrupt ", then the interruption status of INTx line just becomes " produce interrupt ", is handled by the main interrupt handling program (Routine) of the Interrupt Process of interruptable controller.The interrupting input end of supposing the edge triggering of interruptable controller is that negative edge triggers, and the output of interrupt source can be pulse output, also can be level output, if pulse output, requirement is that the negative pulse negative edge is effective, if level output, requirement is that low level is effective.If signal does not meet above condition, then add a phase inverter and get final product.If the output of interrupt source is not OC (Open-Collector, open collector) output, then need to add a tri-state gate circuit (tri-state buffer) 10.
Traditional interrupt handling routine, as shown in Figure 2, after INTx interrupted entering, main routine was at first removed INTx state (step 201); The ISR of calling device 1 (Interrupt Service Routine, Interrupt Service Routine) (step 202) then; Call out successively then, until equipment n (step 203); Last INTx withdraws from.
But, connect for hardware as shown in Figure 1, if adopt interruption shared routing shown in Figure 2 to handle, will produce many problems.As shown in Figure 3, when the interruption of equipment is output as pulse output, can causes and interrupt losing.With reference to this sequential chart, in taking place, equipment n has no progeny, interrupt line produces negative edge and triggers main interrupt routine, traditional program adopts training in rotation mechanism, interrupt handling program at t1 moment calling device 1, but when equipment 1 reads self interruption status, equipment 1 does not interrupt as yet, and when it take place to interrupt, the interruption that interrupt line can the output negative edge come response apparatus 1, that is to say, at the A point, interrupt line remains low, can not produce negative edge, therefore, the interruption that main interrupt routine can treatment facility 1.
When the interruption of equipment was output as level output, its sequential chart was shown in Figure 4, can cause the interruption deadlock.With reference to its sequential chart, by the same token, at the B point, it is low that interrupt line keeps always, can not produce negative edge, the interruption of equipment 2 will can not get handling, and therefore also just the level of equipment 2 can not be retracted high level, like this, because level output, it is low that interrupt line will keep, and causes deadlock.
Interruption provided by the present invention is shared method and has been solved the problems referred to above, please refer to Fig. 5, and at first step 501 enters main Interrupt Process because of detecting each device interrupt request, as long as there is any one equipment that main Interrupt Process takes place to interrupt promptly entering; Step 502 is called out each device interrupt routine treatment facility successively and is interrupted, and just detects per unit interruption status one by one, and this interruption is handled; Final step 503 is called out each device interrupt routine once more successively according to the Interrupt Process result, as long as detecting arbitrary equipment in this time circulation took place to interrupt, each device interrupt routine of recursive call does not once more then only detect any equipment main Interrupt Process takes place to interrupt just withdrawing from circulation once.
See also Fig. 6, be the present invention's the overall flow figure that comprises the device interrupt routine, at first forbid (Disable) main interrupt line (step 601) after entering Interrupt Process; The processing sign RV that removes main interruption status (being the Status Flag of the interrupt INT x of interruptable controller) then and put main interruption routine is false (step 602); Call out each device interrupt routine then successively, promptly at first read the interruption status (step 603) of this equipment; Judge whether then to interrupt (step 604); If taken place to interrupt then carried out Interrupt Process (step 605); Removing this device interrupt state promptly notifies this equipment release interrupt line (step 606) and returns true (step 607); If generation is interrupted then is returned vacation (step 608); If rreturn value is for very then put the RV value and be true (step 609); After treating that armamentarium all detects, judge whether the RV sign is true (step 610); If be true, then return step 602, cycle detection interrupting device again, otherwise allow (Enable) main interrupt line (step 611), withdraw from then.
The unique distinction that device interrupt in the present embodiment is handled routine is to require each device interrupt to handle routine to return a state value, if this equipment does not interrupt, then return vacation (False), if taken place to interrupt then return true (True).In main interrupt routine, if the rreturn value of any one equipment is true, then set handling sign RV is true.When the loop ends each time of main interrupt routine, judge the state of RV, if RV is true, then returns round-robin and begin, handle the interruption of each equipment again, if RV is false, then withdraws from circulation, and withdraw from interruption routine.
If when detecting Dev_n in the circulation the last time, Dev_1 ... or interruption taken place in Dev_ (n-1), and so current interruption can't obtain handling, and interrupting master routine can directly withdraw from.Current interruption can be provided with the interruption status sign of interruptable controller, after the interruption master routine withdraws from, can reenter the interruption master routine immediately, so this interruption can not lost yet.
Processing procedure of the present invention please refer to Fig. 7 Fig. 8, in contrast to Fig. 2, Fig. 3, adopts this method, and all interruptions all can be processed, can not lose to interrupt or generation level deadlock.For example, the C point in Fig. 7, equipment 1 interrupts, and through the cycle detection second time, at the D point, the interruption of equipment 1 is processed.E point in Fig. 8, equipment 2 interrupts, and through the cycle detection second time, at the F point, the interruption of equipment 2 is processed.
The above is preferred embodiment of the present invention only, is not to be used for limiting practical range of the present invention; Every according to equivalence variation and modification that the present invention did, all contained by claim of the present invention.

Claims (6)

1, a kind of edge triggers and interrupts sharing method, it is characterized in that, realizes that by repeatedly recursive call device interrupt routine the edge triggers interruption and shares, and comprising:
Step 1 detects each device interrupt request and enters main Interrupt Process;
Step 2 is called out each device interrupt routine treatment facility successively and is interrupted; And
Step 3, according to the Interrupt Process result, whether once more decision calls out the step of each device interrupt routine in the execution in step 2 successively.
2, edge according to claim 1 triggers and interrupts sharing method, it is characterized in that this step 2 is to detect per unit interruption status one by one, and this interruption is handled.
3, edge according to claim 1 triggers and interrupts sharing method, it is characterized in that, this step 3 is meant as long as detect arbitrary equipment after this step 2 that finishes interrupts, then carry out this step 2 again, and after this step 2 that is finished, when not detecting any equipment and taking place to interrupt, just stop to carry out this step 2, and withdraw from this main Interrupt Process.
4, edge according to claim 1 triggers and interrupts sharing method, it is characterized in that, before this step 2, comprises that also one forbids the step of main interrupt line.
5, edge according to claim 1 triggers and interrupts sharing method, it is characterized in that this device interrupt routine treatment facility must return a state value when interrupting, if this equipment does not interrupt, then returns vacation, if taken place to interrupt then return true.
6, edge according to claim 5 triggers and interrupts sharing method, it is characterized in that, after this step 2, as long as the return state value that an equipment is arranged is then carried out recursive call once more and handled for true.
CNB2004100087656A 2004-03-17 2004-03-17 Edge Triggered Interrupt Sharing Method Expired - Fee Related CN1317654C (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CNB2004100087656A CN1317654C (en) 2004-03-17 2004-03-17 Edge Triggered Interrupt Sharing Method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CNB2004100087656A CN1317654C (en) 2004-03-17 2004-03-17 Edge Triggered Interrupt Sharing Method

Publications (2)

Publication Number Publication Date
CN1670719A CN1670719A (en) 2005-09-21
CN1317654C true CN1317654C (en) 2007-05-23

Family

ID=35041988

Family Applications (1)

Application Number Title Priority Date Filing Date
CNB2004100087656A Expired - Fee Related CN1317654C (en) 2004-03-17 2004-03-17 Edge Triggered Interrupt Sharing Method

Country Status (1)

Country Link
CN (1) CN1317654C (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4631670A (en) * 1984-07-11 1986-12-23 Ibm Corporation Interrupt level sharing
CN1294707A (en) * 1998-01-21 2001-05-09 英特尔公司 Method and appts. for handling multiple level-triggered and edge-triggered interrupts
JP2001344115A (en) * 2000-06-02 2001-12-14 Toshiba Corp Interrupt control device

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US4631670A (en) * 1984-07-11 1986-12-23 Ibm Corporation Interrupt level sharing
CN1294707A (en) * 1998-01-21 2001-05-09 英特尔公司 Method and appts. for handling multiple level-triggered and edge-triggered interrupts
JP2001344115A (en) * 2000-06-02 2001-12-14 Toshiba Corp Interrupt control device

Also Published As

Publication number Publication date
CN1670719A (en) 2005-09-21

Similar Documents

Publication Publication Date Title
US10970144B2 (en) Packet processing on a multi-core processor
CN1251077C (en) Method for implementing interrupt in data processing and data processing system
CN1098487C (en) Method and apparatus for affecting subsequent instruction processing in data processor
WO2014044109A1 (en) Method and apparatus for virus scanning
CN113366457A (en) Handling input/output store instructions
CN101036413A (en) High-resolution timer-efficient sliding window
CN108762905B (en) Method and device for processing multitask events
CN100345132C (en) Parallel processing method and system
RU2641250C2 (en) Device and method of queue management
CN1100294C (en) Central processing unit for preventing program malfunction
CN1081776A (en) The circuit and the method for disabled interrupt shielding
CN1317654C (en) Edge Triggered Interrupt Sharing Method
US10762207B2 (en) Method and device for scanning virus
US11582133B2 (en) Apparatus and method for distributed processing of identical packet in high-speed network security equipment
CN1232219A (en) Pipeline-type multi-processor system
CN111176811B (en) A device and method for realizing rapid aging of large batch entries based on multi-core processor
US8561079B2 (en) Inter-thread load arbitration control detecting information registered in commit stack entry units and controlling instruction input control unit
WO2020080882A1 (en) Method for handling kernel service request for interrupt routines in multi-core environment and electronic device thereof
CN115982311B (en) Method and device for generating linked list, terminal equipment and storage medium
CN1588639A (en) Reset method and reset system for integrated circuit
CN1270251C (en) Method for realizing interrupt request preprocessing
CN1218211A (en) Timer device having timer counter
CN111324438B (en) Request scheduling method and device, storage medium and electronic equipment
CN1532704A (en) A detection method of dead loop
CN1752949A (en) Internal storage management system and method

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
ASS Succession or assignment of patent right

Owner name: ZHISHEN SCIENCE & TECHNOLOGY CO. LTD.

Free format text: FORMER OWNER: DEXIN SCIENCE + TECHNOLOGY CO., LTD.

Effective date: 20061020

C41 Transfer of patent application or patent right or utility model
TA01 Transfer of patent application right

Effective date of registration: 20061020

Address after: Taipei city of Taiwan Province

Applicant after: Zhishen Science and Technology Co., Ltd.

Address before: Taipei city of Taiwan Province

Applicant before: Destiny Technology Corporation

C14 Grant of patent or utility model
GR01 Patent grant
C17 Cessation of patent right
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20070523

Termination date: 20140317