An information interaction method, device, equipment and computer readable storage medium
Patent Information
- Application Number
- CN202310501142.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2023-04-27
- Publication Date
- 2026-09-25
- Estimated Expiration
- 2043-04-27
AI Technical Summary
并且超声诊断软件收到中断事件后,还需要再次和下位机模块交互,判断当次中断事件属于哪一类事件,增加了完成中断传递下位机模块和上位机模块两者交互的次数,造成下位机模块和上位机模块的交互效率偏低
[0041]由上述技术方案可以看出,下位机模块中部署有不同类型的中断向量,通过调用与当前数据交互类型匹配的中断向量向上位机模块传输中断请求;上位机模块获取到下位机模块传输的中断请求时,调用中断处理函数对中断变量中的目标位设置中断标识;其中,目标位为中断变量中与中断请求的中断类型匹配的位。中断处理函数运行在内核态,为了便于用户态访问中断变量,在加载设备驱动时会将中断变量映射到文件系统中,以便于用户态可以访问中断变量。上位机模块用户态软件检测到设备驱动传输的中断信息时,可以访问映射在文件系统的中断变量,从而处理中断变量中设置有中断标识的目标位所对应的中断事件。在该技术方案中,通过增加一个中断变量来辅助下位机模块和上位机模块之间中断类型的辨别区分,并将中断变量进行文件映射,避免了下位机模块内部的中断线复用等复杂逻辑,解决了下位机模块和上位机模块中断交互过程为了区分中断类型而耗用系统资源的问题,有效的提升了下位机模块和上位机模块的交互效率。
Smart Images

Figure CN118860916B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of ultrasonic systems technology, and in particular to an information interaction method, apparatus, device, and computer-readable storage medium. Background Technology
[0002] Ultrasound diagnostic equipment can be divided into two main hardware modules: a lower-level module and a higher-level module. The lower-level module is responsible for transmission, reception, signal processing, and scanning imaging; the higher-level module is responsible for calculation, storage, and human-computer interaction. Data exchange between the lower-level and higher-level modules uses PCIe (Peripheral Component Interconnect Express, third-generation input / output bus). Furthermore, peripherals such as ultrasound probes and ECG electrodes connected to the lower-level module need to provide timely feedback to the higher-level module for human-computer interaction. Therefore, the efficiency of the interaction between the lower-level and higher-level modules reflects the product's performance to a certain extent.
[0003] In Linux systems, to ensure system security and reliability, the software runtime environment is divided into kernel mode and user mode. Interrupt events can only be handled by the kernel and passed to user-mode programs through pre-defined methods. During event interaction between the lower-level and upper-level modules, the completion of the event interaction is reported via the PCIe bus's MSI (Message Signal Interrupt). When the interrupt controller of the upper-level module detects the arrival of an interrupt event, it triggers the interrupt handler function registered for that interrupt in the PCIe device driver. The interrupt handler function then feeds back the interrupt event to the user-mode program.
[0004] The data types processed by the lower-level computer module differ in different operating modes, and each data type has its own corresponding interrupt source. Therefore, the lower-level computer module has multiple interrupt sources. However, in the Linux system, interrupt information can only be passed to the ultrasound diagnostic software of the upper-level computer module synchronously or asynchronously. Due to the limitations of the operating system's interrupt transmission method, the lower-level computer module needs to time-multiplex the interrupt lines. Furthermore, after receiving an interrupt event, the ultrasound diagnostic software needs to interact with the lower-level computer module again to determine which type of event the interrupt event belongs to. This increases the number of interactions between the lower-level computer module and the upper-level computer module to complete interrupt transmission, resulting in low interaction efficiency between the two modules.
[0005] It is evident that improving the interaction efficiency between the lower-level computer module and the upper-level computer module is a problem that needs to be solved by those skilled in the art. Summary of the Invention
[0006] The purpose of this application is to provide an information interaction method, apparatus, device, and computer-readable storage medium that can improve the interaction efficiency between the lower-level computer module and the upper-level computer module.
[0007] To address the aforementioned technical problems, embodiments of this application provide an information interaction method, comprising:
[0008] When the host computer module receives an interrupt request transmitted by the slave computer module, the kernel-mode device driver calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the slave computer module has different types of interrupt vectors deployed, and the interrupt request is transmitted to the host computer module by the slave computer module calling the interrupt vector that matches the current data interaction type;
[0009] When the host computer module's user-mode software detects an interrupt signal from the device driver transmission, it accesses the interrupt variable mapped in the file system and processes the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt identifier set.
[0010] Optionally, before the interrupt handler function is called to set the interrupt flag in the target bit of the interrupt variable, the method further includes:
[0011] When the device driver is loaded, an interrupt handler function for accessing interrupt variables is registered in kernel mode, and the interrupt variables are mapped to the file system; wherein, each bit of the interrupt variable is used to represent the corresponding interrupt event type.
[0012] Optionally, after the interrupt handler function is called to set the interrupt flag in the target bit of the interrupt variable, the method further includes:
[0013] Load the interrupt variables mapped in the file system into memory;
[0014] Accordingly, the access mapping in the file system interrupt variables includes:
[0015] Access the interrupt variable recorded in the memory.
[0016] Optionally, loading the interrupt variable mapped in the file system into memory includes:
[0017] Upon detecting a lower-level module connection, load the device driver to obtain the interrupt variable mapped in the file system;
[0018] The interrupt variable is mapped to a pre-selected memory location.
[0019] Optionally, after processing the interrupt event corresponding to the target bit in the interrupt variable that has the interrupt flag set, the method further includes:
[0020] Adjust the interrupt flag corresponding to the target bit in the interrupt variable to a non-interrupt flag.
[0021] This application also provides an information interaction device, including a setting unit, an access unit, and a processing unit;
[0022] The setting unit is used to, when an interrupt request is received from the lower-level module, call the interrupt handling function in the kernel mode to set the interrupt flag in the target bit of the interrupt variable; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the lower-level module has different types of interrupt vectors deployed, and the interrupt request is transmitted to the upper-level module by the lower-level module calling the interrupt vector that matches the current data interaction type;
[0023] The access unit is used to access interrupt variables mapped in the file system when user-mode software detects interrupt information transmitted by kernel-mode device drivers.
[0024] The processing unit is used to process the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt identifier.
[0025] Optionally, it may also include a registration unit and a mapping unit;
[0026] The registration unit is used to register an interrupt handling function for accessing interrupt variables in kernel mode when the device driver is loaded.
[0027] The mapping unit is used to map the interrupt variable to the file system; wherein each bit of the interrupt variable is used to represent the corresponding interrupt event type.
[0028] Optionally, it also includes a loading unit;
[0029] The loading unit is used to load the interrupt variable mapped in the file system into memory after the interrupt handling function is called to set the interrupt flag in the target bit of the interrupt variable;
[0030] Correspondingly, the access unit is used to access the interrupt variables recorded in the memory.
[0031] Optionally, the loading unit is used to load the device driver to obtain the interrupt variable mapped in the file system when the lower-level machine module is detected to be connected; and to map the interrupt variable to a pre-selected memory.
[0032] Optionally, it also includes an identification adjustment unit;
[0033] The identifier adjustment unit is used to adjust the interrupt identifier corresponding to the target bit in the interrupt variable to a non-interrupt identifier after completing the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt identifier set in the interrupt variable.
[0034] This application also provides a medical device, including a lower-level computer module and a higher-level computer module;
[0035] The lower-level module is used to send an interrupt request to the upper-level module by calling an interrupt vector that matches the current data interaction type when the data interaction is completed.
[0036] The host computer module is used to execute the steps of the above-mentioned information interaction method.
[0037] This application also provides an electronic device, including:
[0038] Memory, used to store computer programs;
[0039] A processor for executing the computer program to implement the steps of the information interaction method described above.
[0040] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the information interaction method described above.
[0041] As can be seen from the above technical solution, the lower-level module deploys different types of interrupt vectors. It transmits interrupt requests to the upper-level module by calling the interrupt vector that matches the current data interaction type. When the upper-level module receives the interrupt request from the lower-level module, it calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable. The target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request. The interrupt handling function runs in kernel mode. To facilitate user-mode access to the interrupt variables, the interrupt variables are mapped to the file system when the device driver is loaded, allowing user-mode access. When the user-mode software of the upper-level module detects the interrupt information transmitted by the device driver, it can access the interrupt variables mapped to the file system, thereby handling the interrupt event corresponding to the target bit in the interrupt variable where the interrupt flag is set. In this technical solution, an interrupt variable is added to assist in the identification and differentiation of interrupt types between the lower-level and upper-level modules. The interrupt variable is also mapped to a file, which avoids complex logic such as interrupt line reuse within the lower-level module. This solves the problem of system resources being consumed in the interrupt interaction process between the lower-level and upper-level modules in order to distinguish interrupt types, and effectively improves the interaction efficiency between the lower-level and upper-level modules. Attached Figure Description
[0042] To more clearly illustrate the embodiments of this application, the accompanying drawings used in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0043] Figure 1 A flowchart illustrating an information interaction method provided in an embodiment of this application;
[0044] Figure 2 This is a schematic diagram of the structure of an information interaction device provided in an embodiment of this application;
[0045] Figure 3 This is a schematic diagram of the structure of a medical device provided in an embodiment of this application;
[0046] Figure 4 This is a structural diagram of an electronic device provided in an embodiment of this application. Detailed Implementation
[0047] The technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, and not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those of ordinary skill in the art without creative effort are within the protection scope of this application.
[0048] The terms “comprising” and “having” in the specification, claims, and accompanying drawings of this application, and any variations thereof, are intended to cover a non-exclusive inclusion. For example, a process, method, system, product, or apparatus that includes a series of steps or units is not limited to the steps or units listed, but may include steps or units not listed.
[0049] To enable those skilled in the art to better understand the present application, the present application will be further described in detail below with reference to the accompanying drawings and specific embodiments.
[0050] Next, we will describe in detail an information interaction method provided by an embodiment of this application. Figure 1 A flowchart of an information interaction method provided in this application embodiment, the method including:
[0051] S101: When the host computer module receives an interrupt request transmitted by the slave computer module, the kernel-mode device driver calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable; the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the slave computer module has different types of interrupt vectors deployed, and the interrupt request is transmitted to the host computer module by the slave computer module calling the interrupt vector that matches the current data interaction type.
[0052] The lower-level computer module can be an ultrasound module. The upper-level computer module can be a terminal device with user-space software deployed. Depending on the actual application scenario, the user-space software can be ultrasound diagnostic software.
[0053] To address the issue of low interrupt interaction efficiency caused by the time-sharing multiplexing of interrupt lines in traditional methods, this application proposes an interrupt routing optimization scheme based on file mapping. An interrupt handling function for accessing interrupt variables is registered in the kernel mode of the host module, and these interrupt variables are mapped to the file system. The interrupt variable represents the currently generated interrupt type. By mapping the interrupt variable to the file system, the user mode of the host module can directly access the interrupt variable, thereby obtaining the interrupt type currently reported by the slave module.
[0054] Based on the actual number of interrupt types required, interrupt variables can be integer (int), short integer (short), long integer (long int), etc.
[0055] Taking an integer variable as an example, an integer variable has 32 bits, which can represent up to 32 types of interrupts. In practical applications, the lower-level module requests multiple interrupt vectors based on the data interaction type. After completing the data interaction, the lower-level module can send an interrupt request to the upper-level module by calling the interrupt vector that matches the current data interaction type. After the interrupt detector of the upper-level module detects the arrival of the interrupt event, it calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable. The target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request.
[0056] S102: When the host computer module user-mode software detects interrupt information transmitted by the kernel-mode device driver, it accesses the interrupt variable mapped in the file system and processes the interrupt event corresponding to the target bit with the interrupt flag set in the interrupt variable.
[0057] Interrupt handling functions belong to kernel-mode programs and cannot be directly accessed by user-mode programs. Therefore, in this embodiment of the application, in order to facilitate user-mode access to interrupt variables, the interrupt handling functions are registered when the device driver is loaded, and the interrupt variables are mapped to the sys file system.
[0058] When the user-mode software of the host computer module detects an interrupt signal transmitted by the kernel-mode device driver, it can directly access the interrupt variable mapped in the file system, thereby handling the interrupt event corresponding to the target bit with the interrupt flag set in the interrupt variable.
[0059] In practice, numbers, letters, or a combination of both can be used as interrupt identifiers.
[0060] For example, the number "1" can be used as the interrupt flag, and the number "0" as the non-interrupt flag. An integer variable has 32 bits. Each interrupt access function controls a fixed bit; when that bit is 1, it indicates an interrupt; when it is 0, it indicates no interrupt. By checking how many bits in this global integer variable are set to 1, we can determine the number of interrupts. The position of the bit can be simply described as which interrupt it represents. For example, when the variable is 0100 0110(b), it indicates 3 interrupts, which, from right to left, are interrupts number 1, 2, and 6.
[0061] Different types of interrupt events require different handling methods. In this embodiment, the lower-level module only needs to send the interrupt event to the upper-level module via an interrupt request. The upper-level module can determine the interrupt type of the interrupt event based on which bit in the interrupt variable has an interrupt flag set. There is no need to perform another interrupt interaction with the lower-level module to identify the interrupt type, which greatly improves the interaction efficiency between the lower-level module and the upper-level module.
[0062] After processing the interrupt event corresponding to the target bit of the interrupt variable that has an interrupt flag set in the interrupt variable, the interrupt flag corresponding to the target bit in the interrupt variable can be adjusted to a non-interrupt flag.
[0063] As can be seen from the above technical solution, the lower-level module deploys different types of interrupt vectors. It transmits interrupt requests to the upper-level module by calling the interrupt vector that matches the current data interaction type. When the upper-level module receives the interrupt request from the lower-level module, the kernel-mode device driver calls the interrupt handler function to set the interrupt flag in the target bit of the interrupt variable. The target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request. The interrupt handler function runs in kernel mode. To facilitate user-mode access to the interrupt variables, the interrupt variables are mapped to the file system when the device driver is loaded, allowing user-mode access. When the upper-level module's user-mode software detects the interrupt information transmitted by the device driver, it can access the interrupt variables mapped to the file system, thereby handling the interrupt event corresponding to the target bit in the interrupt variable where the interrupt flag is set. In this technical solution, an interrupt variable is added to assist in the identification and differentiation of interrupt types between the lower-level and upper-level modules. The interrupt variable is also mapped to a file, which avoids complex logic such as interrupt line reuse within the lower-level module. This solves the problem of system resources being consumed in the interrupt interaction process between the lower-level and upper-level modules in order to distinguish interrupt types, and effectively improves the interaction efficiency between the lower-level and upper-level modules.
[0064] In this embodiment, the lower-level module requests multiple interrupt vectors based on the data interaction type. Correspondingly, the upper-level module deploys a device driver for resource management and registers an interrupt handling function in kernel mode for accessing interrupt variables. Each bit of the interrupt variable is used to represent the corresponding interrupt event type.
[0065] The code for the registered interrupt handler is as follows:
[0066] static irqreturn_t fpga_isr(int irq,void*dev_id)
[0067] {
[0068] struct ape_dev*ape=(struct ape_dev*)dev_id;
[0069] wake_up_interruptible(&ape->readQ);
[0070] mutex_lock(&ape->intr_mutex);
[0071] ape->intr_type=ape->intr_type|(1< <irq%(sizeof(unsigned int)));
[0072] mutex_unlock(&ape->intr_mutex);
[0073] return IRQ_HANDLED;
[0074] }
[0075] Meanwhile, to facilitate access to interrupt variables in kernel mode by user-mode ultrasound diagnostic software, interrupt variables can be mapped to the sys file system. This mapping process can be implemented through the corresponding interface (kobject) in the Linux driver model, thereby mapping interrupt variables to a file in the sys file system.
[0076] In this embodiment of the application, the process of setting the interrupt variable may include selecting a variable type that matches the number of interrupt types requested by the lower-level module; establishing an interrupt variable under the variable type; and recording the interrupt type corresponding to each bit in the interrupt variable.
[0077] For example, when the number of interrupt types is less than 16, the variable type can be short; when the number of interrupt types is in the range of 16 to 32, the variable type can be int; when the number of interrupt types is in the range of 32 to 64, the variable type can be long int.
[0078] Considering that in practical applications, after selecting the interrupt variable, the number of interrupt types requested by the lower-level module may increase or decrease as requirements change, the variable type can be adjusted to match the number of interrupt types requested by the lower-level module after selecting the interrupt variable type.
[0079] For example, assuming the interrupt variable is initially a short type variable, capable of representing a maximum of 16 interrupts, and the number of interrupt types requested by the lower-level module becomes 24 bits, the interrupt variable can be adjusted to an int type variable, capable of representing a maximum of 32 interrupts. Alternatively, if the interrupt variable is a long int type variable, capable of representing a maximum of 64 interrupts, and the number of interrupt types requested by the lower-level module becomes 32 bits, the interrupt variable can be adjusted to an int type variable to reduce its memory usage.
[0080] In this embodiment, to further improve the access efficiency of interrupt variables, after calling the interrupt handler function to set the interrupt flag in the target bit of the interrupt variable, the interrupt variable mapped in the file system can be loaded into memory. Correspondingly, when user-mode software detects an interrupt signal transmitted by the device driver, it can directly access the interrupt variable recorded in memory.
[0081] The implementation of loading interrupt variables into memory can include loading the device driver to obtain interrupt variables mapped in the file system when a lower-level module connection is detected; and mapping the interrupt variables into a pre-selected memory location.
[0082] In practical implementation, mmap can be used to map interrupt variables into memory. Assuming the size of the interrupt variable mapped in the file system is 32 bits, then the memory mapped in the software will also be only 32 bits.
[0083] After receiving an interrupt signal from the device driver via poll, the ultrasound diagnostic software can directly access the interrupt type file mapped to the interrupt variables in the ultrasound diagnostic user-level software, thus quickly determining the event corresponding to the current interrupt. `poll` refers to a function in the Linux device driver. By mapping system files to memory, the user-level software can distinguish specific interrupt types as if accessing ordinary memory, avoiding resource and performance losses caused by secondary interactions.
[0084] Figure 2 A schematic diagram of an information interaction device provided in an embodiment of this application includes a setting unit 21, an access unit 22, and a processing unit 23;
[0085] Setting unit 21 is used to call the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable when an interrupt request is received from the lower-level module; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the lower-level module has different types of interrupt vectors deployed, and the interrupt request is transmitted to the upper-level module by the lower-level module calling the interrupt vector that matches the current data interaction type.
[0086] Access unit 22 is used to access interrupt variables mapped in the file system when user-mode software detects an interrupt signal from the device driver transmission.
[0087] Processing unit 23 is used to process the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt flag set.
[0088] Optionally, it may also include a registration unit and a mapping unit;
[0089] The registration unit is used to register interrupt handler functions for accessing interrupt variables in kernel mode when the device driver is loaded.
[0090] The mapping unit is used to map interrupt variables to the file system; each bit of the interrupt variable is used to represent the corresponding interrupt event type.
[0091] Optionally, it also includes a loading unit;
[0092] The loading unit is used to load the interrupt variable mapped in the file system into memory after the interrupt handler function is called to set the interrupt flag in the target bit of the interrupt variable;
[0093] Correspondingly, the access unit is used to access interrupt variables recorded in memory.
[0094] Optionally, the loading unit is used to load the device driver to obtain the interrupt variable mapped in the file system when the lower-level module connection is detected; and to map the interrupt variable to a pre-selected memory.
[0095] Optionally, it also includes an identification adjustment unit;
[0096] The flag adjustment unit is used to adjust the interrupt flag corresponding to the target bit in the interrupt variable to a non-interrupt flag after completing the interrupt event corresponding to the interrupt event for which the interrupt flag is set in the interrupt variable.
[0097] Figure 2 The description of the features in the corresponding embodiments can be found in [reference needed]. Figure 1 The relevant descriptions of the corresponding embodiments will not be repeated here.
[0098] As can be seen from the above technical solution, the lower-level module deploys different types of interrupt vectors. It transmits interrupt requests to the upper-level module by calling the interrupt vector that matches the current data interaction type. When the upper-level module receives the interrupt request from the lower-level module, the kernel-mode device driver calls the interrupt handler function to set the interrupt flag in the target bit of the interrupt variable. The target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request. The interrupt handler function runs in kernel mode. To facilitate user-mode access to the interrupt variables, the interrupt variables are mapped to the file system when the device driver is loaded, allowing user-mode access. When the upper-level module's user-mode software detects the interrupt information transmitted by the device driver, it can access the interrupt variables mapped to the file system, thereby handling the interrupt event corresponding to the target bit in the interrupt variable where the interrupt flag is set. In this technical solution, an interrupt variable is added to assist in the identification and differentiation of interrupt types between the lower-level and upper-level modules. The interrupt variable is also mapped to a file, which avoids complex logic such as interrupt line reuse within the lower-level module. This solves the problem of system resources being consumed in the interrupt interaction process between the lower-level and upper-level modules in order to distinguish interrupt types, and effectively improves the interaction efficiency between the lower-level and upper-level modules.
[0099] Figure 3 A schematic diagram of the structure of a medical device provided in an embodiment of this application includes a lower-level computer module 31 and a higher-level computer module 32;
[0100] The lower-level module 31 is used to send an interrupt request to the upper-level module 32 by calling the interrupt vector that matches the current data interaction type when the data interaction is completed.
[0101] When the host computer module 32 receives an interrupt request transmitted by the slave computer module 31, the kernel-mode device driver calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; when the user-mode software of the host computer module 32 detects the interrupt information transmitted by the kernel-mode device driver, it accesses the interrupt variable mapped in the file system and processes the interrupt event corresponding to the target bit in the interrupt variable that has the interrupt flag set.
[0102] Figure 3 The lower-level computer module 31 and the upper-level computer module 32 interact via a PCIe driver. The interaction between the lower-level computer module 31 and the upper-level computer module 32 can be synchronous or asynchronous. The lower-level computer module 31 can request multiple interrupts in the interrupt generator based on the data interaction type, and multiple control units within the lower-level computer module 31 can simultaneously issue interrupt requests. The upper-level computer module 32 can load interrupt variables into memory through memory mapping, allowing it to access these interrupt variables when an interrupt signal transmitted by the device driver is detected. The corresponding business logic deployed on the upper-level computer module 32 can be used to handle interrupt events corresponding to the target bits of the interrupt variables that have interrupt flags set.
[0103] As can be seen from the above technical solution, the lower-level module deploys different types of interrupt vectors. It transmits interrupt requests to the upper-level module by calling the interrupt vector that matches the current data interaction type. When the upper-level module receives the interrupt request from the lower-level module, the kernel-mode device driver calls the interrupt handler function to set the interrupt flag in the target bit of the interrupt variable. The target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request. The interrupt handler function runs in kernel mode. To facilitate user-mode access to the interrupt variables, the interrupt variables are mapped to the file system when the device driver is loaded, allowing user-mode access. When the upper-level module's user-mode software detects the interrupt information transmitted by the device driver, it can access the interrupt variables mapped to the file system, thereby handling the interrupt event corresponding to the target bit in the interrupt variable where the interrupt flag is set. In this technical solution, an interrupt variable is added to assist in the identification and differentiation of interrupt types between the lower-level and upper-level modules. The interrupt variable is also mapped to a file, which avoids complex logic such as interrupt line reuse within the lower-level module. This solves the problem of system resources being consumed in the interrupt interaction process between the lower-level and upper-level modules in order to distinguish interrupt types, and effectively improves the interaction efficiency between the lower-level and upper-level modules.
[0104] Figure 4 A structural diagram of an electronic device provided in an embodiment of this application, such as... Figure 4 As shown, the electronic device includes: a memory 40 for storing computer programs;
[0105] The processor 41 is used to implement the steps of the information interaction method as described in the above embodiments when executing a computer program.
[0106] The electronic devices provided in this embodiment may include, but are not limited to, smartphones, tablets, laptops, or desktop computers.
[0107] The processor 41 may include one or more processing cores, such as a quad-core processor or an octa-core processor. The processor 41 may be implemented using at least one hardware form selected from DSP (Digital Signal Processing), FPGA (Field-Programmable Gate Array), and PLA (Programmable Logic Array). The processor 41 may also include a main processor and a coprocessor. The main processor, also known as a CPU (Central Processing Unit), is used to process data in the wake-up state; the coprocessor is a low-power processor used to process data in the standby state. In some embodiments, the processor 41 may integrate a GPU (Graphics Processing Unit), which is responsible for rendering and drawing the content to be displayed on the screen. In some embodiments, the processor 41 may also include an AI (Artificial Intelligence) processor, which is used to handle computational operations related to machine learning.
[0108] The memory 40 may include one or more computer-readable storage media, which may be non-transitory. The memory 40 may also include high-speed random access memory and non-volatile memory, such as one or more disk storage devices or flash memory devices. In this embodiment, the memory 40 is used to store at least the following computer program 401, which, after being loaded and executed by the processor 41, is capable of implementing the relevant steps of the information interaction method disclosed in any of the foregoing embodiments. In addition, the resources stored in the memory 40 may also include an operating system 402 and data 403, and the storage method may be temporary storage or permanent storage. The operating system 402 may include Windows, Unix, Linux, etc. The data 403 may include, but is not limited to, interrupt variables and the interrupt type matched by each bit in the interrupt variables.
[0109] In some embodiments, the electronic device may further include a display screen 42, an input / output interface 43, a communication interface 44, a power supply 45, and a communication bus 46.
[0110] Those skilled in the art will understand that Figure 4 The structures shown do not constitute a limitation on electronic devices and may include more or fewer components than those shown.
[0111] It is understood that if the information interaction methods in the above embodiments are implemented as software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and executes all or part of the steps of the methods in the various embodiments of this application. The aforementioned storage medium includes: USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), electrically erasable programmable ROM, registers, hard disks, removable disks, CD-ROMs, magnetic disks, or optical disks, and other media capable of storing program code.
[0112] Based on this, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the information interaction method described above.
[0113] The foregoing has provided a detailed description of an information interaction method, apparatus, device, and computer-readable storage medium provided in the embodiments of this application. The various embodiments are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.
[0114] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.
[0115] The foregoing has provided a detailed description of an information interaction method, apparatus, device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and its core ideas. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.
Claims
1. An information exchange method, characterized in that, include: When the host computer module receives an interrupt request transmitted by the slave computer module, the kernel-mode device driver calls the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the slave computer module has different types of interrupt vectors deployed, and the interrupt request is transmitted to the host computer module by the slave computer module calling the interrupt vector that matches the current data interaction type; When the host computer module's user-mode software detects interrupt information transmitted by the kernel-mode device driver, it accesses the interrupt variable mapped in the file system and processes the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt flag set. Before the interrupt handler function is called to set the interrupt flag in the target bit of the interrupt variable, the following steps are also included: When the device driver is loaded, an interrupt handler function for accessing interrupt variables is registered in kernel mode, and the interrupt variables are mapped to the file system; wherein, each bit of the interrupt variable is used to represent the corresponding interrupt event type; The process of setting interrupt variables includes selecting a variable type that matches the number of interrupt types requested by the lower-level module; establishing interrupt variables under the variable type; and recording the interrupt type corresponding to each bit in the interrupt variable.
2. The information interaction method according to claim 1, characterized in that, After the interrupt handler function is called to set the interrupt flag in the target bit of the interrupt variable, the following is also included: Load the interrupt variables mapped in the file system into memory; Accordingly, the access mapping in the file system interrupt variables includes: Access the interrupt variable recorded in the memory.
3. The information interaction method according to claim 2, characterized in that, Loading the interrupt variables mapped in the file system into memory includes: Upon detecting a lower-level module connection, load the device driver to obtain the interrupt variable mapped in the file system; The interrupt variable is mapped to a pre-selected memory location.
4. The information interaction method according to any one of claims 1 to 3, characterized in that, After processing the interrupt event corresponding to the target bit with the interrupt flag set in the interrupt variable, the process further includes: Adjust the interrupt flag corresponding to the target bit in the interrupt variable to a non-interrupt flag.
5. An information interaction device, characterized in that, It includes a setting unit, an access unit, and a processing unit; The setting unit is used to call the interrupt handling function to set the interrupt flag in the target bit of the interrupt variable when an interrupt request is received from the lower-level module; wherein, the target bit is the bit in the interrupt variable that matches the interrupt type of the interrupt request; the lower-level module is equipped with different types of interrupt vectors, and the interrupt request is transmitted to the upper-level module by the lower-level module calling the interrupt vector that matches the current data interaction type; The access unit is used to access the interrupt variable mapped in the file system when the user-mode software detects an interrupt signal from the device driver transmission. The processing unit is used to process the interrupt event corresponding to the target bit in the interrupt variable that has an interrupt flag set; It also includes a registration unit and a mapping unit; The registration unit is used to register an interrupt handling function for accessing interrupt variables in kernel mode when the device driver is loaded. The mapping unit is used to map the interrupt variable to the file system; wherein each bit of the interrupt variable is used to represent the corresponding interrupt event type. The process of setting interrupt variables includes selecting a variable type that matches the number of interrupt types requested by the lower-level module; establishing interrupt variables under the variable type; and recording the interrupt type corresponding to each bit in the interrupt variable.
6. A medical device, characterized in that, Includes a lower-level machine module and a higher-level machine module; The lower-level module is used to send an interrupt request to the upper-level module by calling an interrupt vector that matches the current data interaction type when the data interaction is completed. The host computer module is used to execute the steps of the information interaction method according to any one of claims 1 to 4.
7. An electronic device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the information interaction method as described in any one of claims 1 to 4.
8. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the information interaction method as described in any one of claims 1 to 4.
Citation Information
Patent Citations
Cooperative work system and method of user mode drive and kernel mode drive
CN112732344A
User-level inter-processor interrupts
CN115904649A