CN114253681A - Interrupt registration and sharing management method and electronic equipment - Google Patents
Interrupt registration and sharing management method and electronic equipment Download PDFInfo
- Publication number
- CN114253681A CN114253681A CN202111367482.0A CN202111367482A CN114253681A CN 114253681 A CN114253681 A CN 114253681A CN 202111367482 A CN202111367482 A CN 202111367482A CN 114253681 A CN114253681 A CN 114253681A
- Authority
- CN
- China
- Prior art keywords
- interrupt
- management
- registration
- node
- information
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F9/00—Arrangements for program control, e.g. control units
- G06F9/06—Arrangements 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/46—Multiprogramming arrangements
- G06F9/48—Program initiating; Program switching, e.g. by interrupt
- G06F9/4806—Task transfer initiation or dispatching
- G06F9/4812—Task transfer initiation or dispatching by interrupt, e.g. masked
Landscapes
- Engineering & Computer Science (AREA)
- Software Systems (AREA)
- Theoretical Computer Science (AREA)
- Physics & Mathematics (AREA)
- General Engineering & Computer Science (AREA)
- General Physics & Mathematics (AREA)
- Bus Control (AREA)
Abstract
The invention discloses an interrupt registration and sharing management method and electronic equipment, wherein, the invention firstly initializes an interrupt vector table, a mapping address management table, a registration interrupt management table and a node management linked list; when an application program registers an external interrupt, setting the current external interrupt as a first interrupt or a second interrupt; and then the registration and sharing management of the external interrupt are realized by calling the interrupt vector table, the mapping address management table, the registration interrupt management table and the node management linked list. The invention solves the defects of the embedded real-time operating system in the aspects of dynamic interrupt registration and management, simultaneously supports interrupt information inquiry and hardware sharing interrupt numbers, provides an interrupt registration and sharing management mode for application program configuration and saves system resources.
Description
Technical Field
The invention relates to the technical field of embedded lightweight RTOS (real time operating system), in particular to an interrupt registration and sharing management method and electronic equipment.
Background
The interrupt is a real-time controlled interface opened to the outside by the processor, and is an important guarantee mechanism for the application program in the embedded system to quickly respond to and process the external request. The interruption mechanism can ensure the real-time performance of the system, meet the processing requirement of the system on emergency tasks and improve the processing capacity of CPU multitask events. The operating system and the application program have the requirement of using system interrupt service, the operating system can drive the system to schedule the application program in real time through an interrupt mechanism, and the application program can realize asynchronous data transmission, user request and emergency task processing by registering an interrupt service function to the system.
The Linux interrupt management program is not suitable for being transplanted to a lightweight real-time operating system for use, and the lightweight real-time operating system often does not support management service for system interrupt due to the fact that the system is relatively simple, system resources are limited and the like. If an application program developed based on the lightweight real-time operating system needs to use a hardware interrupt service mechanism, registers related to hardware need to be directly operated or a driver needs to be called, so that the compiling difficulty of the application program is often improved, and the portability of the developed application program is reduced; meanwhile, the use of the non-uniform interfaces is not beneficial to subsequent transplantation.
Most of the existing open-source Real-Time Operating systems (RTOS) do not provide the function of registering hardware interrupt service functions, few RTOSs support the dynamic registration of simple interrupt service functions, the System interrupt service is managed by using two identical interrupt vector tables A, B, when the System is started, the address of the System interrupt vector table is set as the designated address of the vector table A, the corresponding System interrupt default processing function is stored in the vector table A according to the interrupt vector number, after the System is started, the application program registers the service function corresponding to the interrupt number to be used through the interrupt registration interface provided by the System, the System stores the service function registered by the application program into another interrupt vector table B corresponding to the interrupt vector table A one by one, when the external interrupt occurs, the System interrupt default processing function in the vector table A is triggered and called first, the program calls the service function registered by the application program in the interrupt vector table B according to the generated interrupt number, so that the application program realizes the response to the registration interrupt. However, the occurrence condition of each interrupt is not managed, and the debugging is inconvenient when the problems of interrupt loss and the like occur, and because one interrupt number only corresponds to one interrupt service function, the scene that peripheral hardware uses shared interrupt numbers is not supported; using two identical interrupt vector tables to store the interrupt service function information, there is a spatial penalty in the corresponding interrupt vector table B1 for interrupt numbers that are not needed or can not be registered by the application.
Disclosure of Invention
The invention mainly aims to provide an interrupt registration and sharing management method and electronic equipment, aiming at solving the defect of an embedded RTOS in dynamic interrupt management service, supporting interrupt information inquiry and hardware sharing interrupt numbers, providing an interrupt registration management mode capable of being configured by an application program and saving system resources.
In order to achieve the above object, the present invention provides an interrupt registration and sharing management method, wherein the interrupt registration and sharing management method includes the following steps:
s1, the system is powered on, the interrupt vector table, the mapping address management table, the registration interrupt management table and the node management linked list are initialized;
s2, when the application program registers the external interrupt, setting the current external interrupt as a first interrupt or a second interrupt;
s3, when the external interrupt is the first interrupt, if the address value of the corresponding interrupt number in the mapping address management table is empty, registering the first interrupt, and executing the step S5; otherwise, returning failure;
s4, when the external interrupt is the second interrupt, if the address value of the corresponding interrupt number in the mapping address management table is null, registering the second interrupt, and executing the step S5; if the address value corresponding to the interrupt number in the mapping address management table is not empty, judging whether the current second interrupt is registered, if so, returning to fail; otherwise, registering the second interrupt, and executing step S5;
s5, when the external interrupt finishes registering, using the interrupt vector table, the mapping address management table, the register interrupt management table and the information stored in the node management linked list to process interrupt processing;
s6, log out the first interrupt and/or the second interrupt that has completed the registration and processing.
Further, the first interrupt is a non-shared interrupt; the second interrupt is a shared interrupt;
further, in the step S1, the address of the interrupt vector table is set as the offset address of the system interrupt vector, the interrupt numbers 0 to 15 are set as the specific internal interrupt service functions of the system, and the interrupt numbers 16 and above are collectively set as the default processing functions of the system.
Further, the interrupt number of the mapping address management table and the interrupt number 16 of the interrupt vector table start to increment one by one according to the interrupt number.
Further, the interrupt number of the mapping address management table can set the size of the mapping address management table according to the maximum interrupt number which needs to be registered by the application program.
Further, the step S3 is specifically:
s31, judging whether the address value in the mapping address management table corresponding to the interrupt number of the first interrupt is empty, if not, returning failure, indicating that the first interrupt is registered and not needing to be registered repeatedly;
s32, if it is empty, obtaining the first interrupt management node from the node management linked list, and storing the address of the first interrupt management node to the position corresponding to the interrupt number of the first interrupt in the mapping address management table;
s33, setting a system default processing function corresponding to the interrupt number of the first interrupt in the interrupt vector table as a first interrupt processing function;
s34, applying for the registration information node space to the interrupt registration management table, adding the first interrupt management node to the information management linked list of the interrupt registration management table, and storing the registered information such as the first interrupt processing function, the equipment ID and the registration task to the information node of the interrupt registration management linked list to complete the registration.
Further, the step S4 is specifically:
s41, judging whether the address value in the mapping address management table corresponding to the interrupt number of the second interrupt is null;
s42, if it is empty, obtaining a second interrupt management node from the node management linked list, and storing the address of the second interrupt management node to the position corresponding to the interrupt number of the second interrupt in the mapping address management table; setting a system default processing function corresponding to the interrupt number of the second interrupt in the interrupt vector table as a second interrupt processing function; applying for a registered information node space to the interrupt registration management table, adding the second interrupt management node to an information management linked list of the interrupt registration management table, and storing registered information such as a second interrupt processing function, a device ID and a registration task into the information node of the interrupt registration management linked list to complete registration;
s43, if not, judging whether the registration is carried out according to the equipment ID, if so, returning failure, indicating that the second interruption is registered, and not needing to carry out the registration repeatedly; if not, applying for registration information node space to the interrupt registration management table, storing registration information into the information node of the interrupt registration management linked list, and adding the registration information to the tail part of the second interrupt management node information management linked list to complete registration.
Further, the step S5 is specifically:
when the external interrupt finishes registering, calling a system default processing function in the interrupt vector table, and searching the first interrupt management node address and/or the second interrupt management node address in the mapping address management table according to the interrupt number of the first interrupt and/or the interrupt number of the second interrupt in the system default processing function; and updating the node information of the first interrupt management node and/or the second interrupt management node in the registered interrupt management table, and calling a callback function in an information management linked list according to the equipment ID for processing.
Further, the deregistration of the registered first interrupt in the step S6 specifically includes:
s611, restoring the first interrupt processing function in the interrupt vector table corresponding to the interrupt number of the first interrupt to a system default processing function;
and S612, emptying the first interrupt management node, recovering the first interrupt management node to the node management linked list, and finishing logout.
Further, the deregistration of the registered second interrupt in the step S6 specifically includes:
s621, in an information management linked list of a second interrupt management node corresponding to an interrupt number of a second interrupt, searching an information node according to a device ID required to be cancelled, and if the information node is matched with the device ID, clearing the content stored in the information node and recovering the memory of the information node; if not, returning failure;
s622, determining whether the information management linked list managed by the second interrupt management node is empty, and if so, recovering the second interrupt management node to the node management linked list; if not, the logout is completed.
An electronic device comprising a controller, a peripheral module, a memory module, and an application stored on the memory module and operable on the controller; the peripheral module triggers the controller to enter an interrupt processing mode; the application program realizes the steps of the interrupt registration and sharing management method when being executed by the controller.
In the above technical solution of the present invention, the interrupt registration and sharing management method and the electronic device include: the system is powered on, and an interrupt vector table, a mapping address management table, a registration interrupt management table and a node management linked list are initialized; when an application program registers an external interrupt, setting the current external interrupt as a first interrupt or a second interrupt; when the external interrupt is a first interrupt, if the address value corresponding to the interrupt number in the mapping address management table is null, registering the first interrupt, and executing step S5; otherwise, returning failure; when the external interrupt is a second interrupt, if the address value corresponding to the interrupt number in the mapping address management table is null, registering the second interrupt, and executing step S5; if the address value corresponding to the interrupt number in the mapping address management table is not empty, judging whether the current second interrupt is registered, if so, returning to fail; otherwise, registering the second interrupt, and executing step S5; when the external interrupt finishes registering, the interrupt handling is carried out by using the information stored in the interrupt vector table, the mapping address management table, the registration interrupt management table and the node management linked list; and logging off the first interrupt and/or the second interrupt after the registration and the processing are completed. The invention solves the problems of high difficulty in developing the application program and low portability of the application program for the system which does not support interrupt registration and sharing management; and using two identical interrupt vector tables A, B to manage system interrupt service, support application program to register interrupt service program but not support sharing hardware interrupt number, do not record and manage interrupt occurrence information, and not support peripheral hardware to use sharing interrupt number and space fee.
In the invention, the simultaneous registration of the shared interrupt and the non-shared interrupt is realized by respectively registering the first interrupt and the second interrupt, namely the application program interrupt registration management mechanism can be compatible with the shared interrupt and the common interrupt processing.
In the invention, the interrupt number of the mapping address management table and the interrupt number 16 of the interrupt vector table start to be in increment one-to-one correspondence according to the interrupt number, the address of the registered interrupt management node is stored by using the mapping address management table, and the size of the mapping address management table can be set according to the maximum interrupt number which needs to be registered by an application program.
In the invention, the common attribute information of the interrupt is stored in the interrupt management node by mapping the address management table and registering the interrupt management table, and the special information, including the equipment ID, the registration task and the like, is stored in the information management linked list managed by the node.
In the invention, the information management linked list in the registered interrupt management table is set to realize the compatibility of the shared interrupt and the non-shared interrupt data structure and management mode, namely the information management linked list in the registered interrupt management table is set to realize the compatibility of the shared interrupt and the common interrupt data structure and management mode.
In the invention, the information of the interrupt management node can be directly accessed by using the address stored in the mapping address management table corresponding to the interrupt number, the speed is higher, and the real-time response capability of the system is improved.
In the invention, the number of elements in the mapping address management table and the registration interrupt management table can be configured according to the use requirement, and the system resources are saved on the basis of fully utilizing the limited hardware interrupt resources.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only some embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the structures shown in the drawings without creative efforts.
Fig. 1 is a flowchart illustrating an interrupt registration and sharing management method according to embodiment 1 of the present invention;
fig. 2 is a schematic structural diagram of a system applying an interrupt registration and sharing management method according to embodiment 2 of the present invention.
The reference numbers illustrate:
an MCU module 1; a key module 2; an LCD module 3; a serial port module 4; and a network port module 5.
The implementation, functional features and advantages of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the accompanying drawings in the embodiments of the present invention, and it is apparent that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without any inventive step based on the embodiments of the present invention, are within the scope of the present invention.
It should be noted that the description in the present invention as referring to "first", "second", etc. is for descriptive purposes only and is not to be construed as indicating or implying relative importance or implicitly indicating the number of technical features indicated. Thus, a feature defined as "first" or "second" may explicitly or implicitly include at least one such feature.
Moreover, the technical solutions in the embodiments of the present invention may be combined with each other, but it is necessary to be able to be realized by a person skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be considered to be absent, and is not within the protection scope of the present invention.
Example 1:
referring to fig. 1, according to an aspect of the present invention, the present invention provides an interrupt registration and sharing management method, wherein the interrupt registration and sharing management method specifically includes the following steps:
s1, the system is powered on, the interrupt vector table, the mapping address management table, the registration interrupt management table and the node management linked list are initialized;
s2, when the application program registers the external interrupt, setting the current external interrupt as a first interrupt or a second interrupt;
s3, when the external interrupt is the first interrupt, if the address value of the corresponding interrupt number in the mapping address management table is empty, registering the first interrupt, and executing the step S5; otherwise, returning failure;
s4, when the external interrupt is the second interrupt, if the address value of the corresponding interrupt number in the mapping address management table is null, registering the second interrupt, and executing the step S5; if the address value corresponding to the interrupt number in the mapping address management table is not empty, judging whether the current second interrupt is registered, if so, returning to fail; otherwise, registering the second interrupt, and executing step S5;
s5, when the external interrupt finishes registering, using the interrupt vector table, the mapping address management table, the register interrupt management table and the information stored in the node management linked list to process interrupt processing;
s6, log out the first interrupt and/or the second interrupt that has completed the registration and processing.
Specifically, in this embodiment, the first interrupt is an unshared interrupt, and the unshared interrupt is also a normal interrupt; the second interrupt is a shared interrupt;
specifically, in this embodiment, in the step S1, the address of the interrupt vector table is set as the offset address of the system interrupt vector, the interrupt numbers 0 to 15 are set as the specific internal interrupt service functions of the system, and the interrupt numbers 16 and above interrupt service functions are collectively set as the default processing functions of the system; the interrupt number of the mapping address management table and the interrupt number 16 of the interrupt vector table start to be in increment one-to-one correspondence according to the interrupt number, and the interrupt number of the mapping address management table can set the size of the mapping address management table according to the maximum interrupt number which needs to be registered by an application program; the mapping address management table and the interrupt registration management table can be configured according to the use requirements of the application program, and the system is effectively saved.
Specifically, in this embodiment, the step S3 specifically includes:
s31, judging whether the address value in the mapping address management table corresponding to the interrupt number of the first interrupt is empty, if not, returning failure, indicating that the first interrupt is registered and not needing to be registered repeatedly;
s32, if it is empty, obtaining the first interrupt management node from the node management linked list, and storing the address of the first interrupt management node to the position corresponding to the interrupt number of the first interrupt in the mapping address management table;
s33, setting a system default processing function corresponding to the interrupt number of the first interrupt in the interrupt vector table as a first interrupt processing function;
s34, applying for the registration information node space to the interrupt registration management table, adding the first interrupt management node to the information management linked list of the interrupt registration management table, and storing the registered information such as the first interrupt processing function, the equipment ID and the registration task to the information node of the interrupt registration management linked list to complete the registration.
Specifically, in this embodiment, the step S4 specifically includes:
s41, judging whether the address value in the mapping address management table corresponding to the interrupt number of the second interrupt is null;
s42, if it is empty, obtaining a second interrupt management node from the node management linked list, and storing the address of the second interrupt management node to the position corresponding to the interrupt number of the second interrupt in the mapping address management table; setting a system default processing function corresponding to the interrupt number of the second interrupt in the interrupt vector table as a second interrupt processing function; applying for a registered information node space to the interrupt registration management table, adding the second interrupt management node to an information management linked list of the interrupt registration management table, and storing registered information such as a second interrupt processing function, a device ID and a registration task into the information node of the interrupt registration management linked list to complete registration;
s43, if not, judging whether the registration is carried out according to the equipment ID, if so, the registration fails, indicating that the second interruption is completely registered, and the registration does not need to be repeated; if not, applying for registration information node space to the interrupt registration management table, storing registration information into the information node of the interrupt registration management linked list, and adding the registration information to the tail part of the second interrupt management node information management linked list to complete registration.
Specifically, in this embodiment, the step S5 specifically includes:
when the external interrupt finishes registering, calling a system default processing function in the interrupt vector table, and searching the first interrupt management node address and/or the second interrupt management node address in the mapping address management table according to the interrupt number of the first interrupt and/or the interrupt number of the second interrupt in the system default processing function; and updating the node information of the first interrupt management node and/or the second interrupt management node in the registered interrupt management table, and calling a callback function in an information management linked list according to the equipment ID for processing.
Specifically, in this embodiment, the deregistering the registered first interrupt in step S6 specifically includes:
s611, restoring the first interrupt processing function in the interrupt vector table corresponding to the interrupt number of the first interrupt to a system default processing function;
and S612, emptying the first interrupt management node, recovering the first interrupt management node to the node management linked list, and finishing logout.
Specifically, in this embodiment, the deregistration of the registered second interrupt in the step S6 specifically includes:
s621, in an information management linked list of a second interrupt management node corresponding to an interrupt number of a second interrupt, searching an information node according to a device ID required to be cancelled, and if the information node is matched with the device ID, clearing the content stored in the information node and recovering the memory of the information node; if not, returning failure;
s622, determining whether the information management linked list managed by the second interrupt management node is empty, and if so, recovering the second interrupt management node to the node management linked list; if not, the logout is completed.
Example 2:
the invention also provides an electronic device which is provided with the interrupt registration and sharing management method and is used for the concentrator device. The electronic equipment comprises a controller, a peripheral module, a storage module and an application program which is stored on the storage module and can run on the controller; the peripheral module triggers the controller to enter an interrupt processing mode; the application program realizes the steps of the interrupt registration and sharing management method when being executed by the controller. The peripheral module comprises peripheral devices such as an infrared unit, an NB-IOT unit, a USB interface and the like, external interruption is triggered through the peripheral module, an application program judges the type of the external interruption, an interruption service function corresponding to an unregistered interruption number is uniformly stored as a system default processing function through an interruption vector table, a management node address information of registered interruption is stored by using a mapping address management table, when the application program is registered and interrupted, information such as the maintenance interruption priority and the interruption triggering times of the management node is obtained from the registered interruption management table, an information storage node space is applied, and the information storage node space is inserted into a management node information management linked list in a linked list mode to realize real-time processing of the external interruption, time-sharing multiplexing of hardware interruption resources is realized by the application program, system interruption management information can be checked, and debugging and problem positioning are facilitated.
Specifically, in embodiment 2, a system including an interrupt registration and sharing management method of the present invention is taken as an example, where the system includes a Micro Control Unit (MCU) module and a peripheral module; the peripheral module comprises a key module, an LCD module, a serial port module and a network port module; the key module, the LCD module, the serial port module and the network port module are electrically connected with the MCU module; the MCU module has an interrupt processing function; the system runs on an RTOS.
The system is powered on to initialize an interrupt registration management unit in the MCU module, a system interrupt vector offset address is set, an application program registers interrupt service functions of an upper key, a lower key, a left key and a right key of the key module in a shared interrupt mode, registers an LCD module touch interrupt processing function in a common interrupt mode, and registers a receiving and sending interrupt processing function of the serial port module in the shared interrupt mode. When a case interrupt occurs, calling a registered interrupt processing function to acquire key value information, and displaying a corresponding LCD menu according to the key value; the application program enables the serial port to be interrupted to send data, when the serial port generates receiving interruption, the data is received and processed, and when the LCD is touched, the contact position information is read to perform corresponding processing. In the actual use process, the number of the peripheral devices of the system is not limited, and the number and the types of the registered interrupts are not limited, and the invention is not limited specifically.
Specifically, in this embodiment, the interrupt registration and sharing management method of the present invention sets the interrupt service function corresponding to the interrupt number of the unregistered first interrupt and/or second interrupt as the system default processing function, uses the mapping address management table to store the management node address information of the first interrupt and/or second interrupt, when the application registers an interrupt, obtains the information stored by the first interrupt and/or second interrupt management node, such as the first interrupt and/or second interrupt processing function, the device ID, and the information of the registration task, the interrupt priority, the interrupt trigger times, etc., from the registration interrupt management table, and applies for the information storage node space to be inserted into the management node information management linked list in the form of linked list, so as to implement the effective management of the interrupt registration use condition of the system application, the system has the advantages that limited hardware interrupt resources are fully utilized, the real-time response capability of the system is improved, resource allocation is carried out according to actual use conditions so as to save system resources, and the operations of registration, logout, enabling, forbidding and the like of external interrupts by application programs are supported. The method can be used for managing the use condition of system interrupt registration in an RTOS, and can also be used in embedded equipment without an operating system.
To facilitate understanding of terms related to the present invention, explanations are made herein:
RTOS: a Real Time Operating System (RTOS) can receive and process external events or data at a fast enough speed, and the processed result can control the production process or make a fast response to the processing System in a specified Time, schedule all available resources to complete Real-Time tasks, and control all Real-Time tasks to run in a coordinated and consistent manner. Providing timely response and high reliability are the main features of real-time operating systems.
Interrupting: when some accident occurs and the host needs to intervene in the running process of the computer, the machine can automatically stop the running program and transfer to the program for processing the new condition, and returns to the original suspended program to continue running after the processing is finished. Interrupts can be divided into hardware interrupts and software interrupts, processor interrupts refer to hardware/software processing that is performed by receiving asynchronous information from peripheral hardware or synchronous signals from software, these signals are called interrupt requests. Hardware interrupts cause the processor to save the execution state (dominated by register information such as program counters and program status words) by a context switch; a software interrupt is typically an instruction in the CPU instruction set that programmatically directs such context switching directly and directs processing to a piece of interrupt handling code.
Interrupting the system: the interrupt device and the interrupt processing program are collectively called as an interrupt system, the interrupt system is an important component of the computer, and the interrupt system is often adopted for real-time control, automatic fault processing and data transmission between the computer and peripheral equipment.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications and equivalents of the present invention, which are made by the contents of the present specification and the accompanying drawings, or directly/indirectly applied to other related technical fields, are included in the scope of the present invention.
Claims (10)
1. An interrupt registration and sharing management method is characterized by comprising the following steps:
s1, the system is powered on, the interrupt vector table, the mapping address management table, the registration interrupt management table and the node management linked list are initialized;
s2, when the application program registers the external interrupt, setting the current external interrupt as a first interrupt or a second interrupt;
s3, when the external interrupt is the first interrupt, if the address value of the corresponding interrupt number in the mapping address management table is empty, registering the first interrupt, and executing the step S5; otherwise, returning failure;
s4, when the external interrupt is the second interrupt, if the address value of the corresponding interrupt number in the mapping address management table is null, registering the second interrupt, and executing the step S5; if the address value corresponding to the interrupt number in the mapping address management table is not empty, judging whether the current second interrupt is registered, if so, returning to fail; otherwise, registering the second interrupt, and executing step S5;
s5, when the external interrupt finishes registering, using the interrupt vector table, the mapping address management table, the register interrupt management table and the information stored in the node management linked list to process interrupt processing;
s6, log out the first interrupt and/or the second interrupt that has completed the registration and processing.
2. The method for interrupt registration and sharing management according to claim 1, wherein in step S1, the address of the interrupt vector table is set as the offset address of the system interrupt vector, the interrupt numbers 0 to 15 are set as the specific internal interrupt service function of the system, and the interrupt numbers 16 and above are set as the default processing function of the system.
3. The interrupt registration and sharing management method according to claim 2, wherein the interrupt numbers of the mapping address management table and the interrupt numbers 16 of the interrupt vector table start to increment one-to-one according to the interrupt numbers.
4. The interrupt registration and sharing management method according to claim 3, wherein the interrupt number of the management table can be set to the size of the management table according to the maximum interrupt number that the application needs to register.
5. The method for interrupt registration and sharing management according to any one of claims 1 to 4, wherein the step S3 specifically includes:
s31, judging whether the address value in the mapping address management table corresponding to the interrupt number of the first interrupt is empty, if not, returning failure;
s32, if it is empty, obtaining the first interrupt management node from the node management linked list, and storing the address of the first interrupt management node to the position corresponding to the interrupt number of the first interrupt in the mapping address management table;
s33, setting a system default processing function corresponding to the interrupt number of the first interrupt in the interrupt vector table as a first interrupt processing function;
s34, applying for the registration information node space to the interrupt registration management table, adding the first interrupt management node to the information management linked list of the interrupt registration management table, and storing the registered information such as the first interrupt processing function, the equipment ID and the registration task to the information node of the interrupt registration management linked list to complete the registration.
6. The method for interrupt registration and sharing management according to any one of claims 1 to 4, wherein the step S4 specifically includes:
s41, judging whether the address value in the mapping address management table corresponding to the interrupt number of the second interrupt is null;
s42, if it is empty, obtaining a second interrupt management node from the node management linked list, and storing the address of the second interrupt management node to the position corresponding to the interrupt number of the second interrupt in the mapping address management table; setting a system default processing function corresponding to the interrupt number of the second interrupt in the interrupt vector table as a second interrupt processing function; applying for a registered information node space to the interrupt registration management table, adding the second interrupt management node to an information management linked list of the interrupt registration management table, and storing registered information such as a second interrupt processing function, a device ID and a registration task into the information node of the interrupt registration management linked list to complete registration;
s43, if not, judging whether the registration is carried out according to the equipment ID, if so, repenting failure; if not, applying for registration information node space to the interrupt registration management table, storing registration information into the information node of the interrupt registration management linked list, and adding the registration information to the tail part of the second interrupt management node information management linked list to complete registration.
7. The method for interrupt registration and sharing management according to any one of claims 1 to 4, wherein the step S5 specifically includes:
when the external interrupt finishes registering, calling a system default processing function in the interrupt vector table, and searching the first interrupt management node address and/or the second interrupt management node address in the mapping address management table according to the interrupt number of the first interrupt and/or the interrupt number of the second interrupt in the system default processing function; and updating the node information of the first interrupt management node and/or the second interrupt management node in the registered interrupt management table, and calling a callback function in an information management linked list according to the equipment ID for processing.
8. The interrupt registration and sharing management method according to any one of claims 1 to 4, wherein the deregistration of the registered first interrupt in step S6 is specifically:
s611, restoring the first interrupt processing function in the interrupt vector table corresponding to the interrupt number of the first interrupt to a system default processing function;
and S612, emptying the first interrupt management node, recovering the first interrupt management node to the node management linked list, and finishing logout.
9. The interrupt registration and sharing management method according to any one of claims 1 to 4, wherein the deregistration of the registered second interrupt in step S6 is specifically:
s621, in an information management linked list of a second interrupt management node corresponding to an interrupt number of a second interrupt, searching an information node according to a device ID required to be cancelled, and if the information node is matched with the device ID, clearing the content stored in the information node and recovering the memory of the information node; if not, returning failure;
s622, determining whether the information management linked list managed by the second interrupt management node is empty, and if so, recovering the second interrupt management node to the node management linked list; if not, the logout is completed.
10. An electronic device comprising a controller, a peripheral module, a storage module, and an application stored on the storage module and operable on the controller; the peripheral module triggers the controller to enter an interrupt processing mode; the application program, when executed by the controller, performs the steps of the interrupt registration and sharing management method of any one of claims 1-9.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111367482.0A CN114253681A (en) | 2021-11-18 | 2021-11-18 | Interrupt registration and sharing management method and electronic equipment |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111367482.0A CN114253681A (en) | 2021-11-18 | 2021-11-18 | Interrupt registration and sharing management method and electronic equipment |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114253681A true CN114253681A (en) | 2022-03-29 |
Family
ID=80792678
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111367482.0A Pending CN114253681A (en) | 2021-11-18 | 2021-11-18 | Interrupt registration and sharing management method and electronic equipment |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114253681A (en) |
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117331701A (en) * | 2023-10-31 | 2024-01-02 | 中科驭数(北京)科技有限公司 | Resource allocation recovery method, device, equipment and medium |
-
2021
- 2021-11-18 CN CN202111367482.0A patent/CN114253681A/en active Pending
Cited By (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN117331701A (en) * | 2023-10-31 | 2024-01-02 | 中科驭数(北京)科技有限公司 | Resource allocation recovery method, device, equipment and medium |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3659062B2 (en) | Computer system | |
US9798595B2 (en) | Transparent user mode scheduling on traditional threading systems | |
JP4842210B2 (en) | Failover method, computer system, management server and spare server setting method | |
US6772419B1 (en) | Multi OS configuration system having an interrupt process program executes independently of operation of the multi OS | |
US9304794B2 (en) | Virtual machine control method and virtual machine system using prefetch information | |
CN105190550B (en) | Method for starting the computer system with multiple central processing units | |
EP1031924A2 (en) | Computer executing multiple operating system | |
US11126575B1 (en) | Interrupt recovery management | |
JPH11149385A (en) | Multi-os constituting method | |
CN111669284B (en) | OpenStack automatic deployment method, electronic device, storage medium and system | |
US20110219373A1 (en) | Virtual machine management apparatus and virtualization method for virtualization-supporting terminal platform | |
EP4195020A1 (en) | Computer device, abnormality processing method and interrupt processing method | |
US7552434B2 (en) | Method of performing kernel task upon initial execution of process at user level | |
JP2000076087A (en) | Multioperating system control method | |
JP3765201B2 (en) | Computer system | |
EP3701373A1 (en) | Virtualization operations for directly assigned devices | |
JPS63310051A (en) | Method and apparatus for executing input/output process containing program input/output instruction | |
CN116339836A (en) | Resource access method, device, readable storage medium and BMC chip | |
CN114253681A (en) | Interrupt registration and sharing management method and electronic equipment | |
JP2001290665A (en) | Processor system | |
WO2024007934A1 (en) | Interrupt processing method, electronic device, and storage medium | |
US9088569B2 (en) | Managing access to a shared resource using client access credentials | |
JP2001236237A (en) | Method for constituting multi-os | |
JP2001216172A (en) | Multi-os constituting method | |
CN112559117B (en) | Timer processing method and device, electronic equipment and computer storage medium |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
PB01 | Publication | ||
PB01 | Publication | ||
SE01 | Entry into force of request for substantive examination | ||
SE01 | Entry into force of request for substantive examination |