Data input and output method, device and system
By introducing general output and input interfaces in the AUTOSAR system, combining FIFO memory and hardware driver interfaces, the high cost, inconvenient portability and poor multithread safety of data input and output solutions in the prior art are solved, and any hardware interface is realized efficient and secure data input and output.
Patent Information
- Application Number
- CN202110324411.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-03-26
- Publication Date
- 2025-02-21
- Estimated Expiration
- 2041-03-26
AI Technical Summary
The existing AUTOSAR-based data input and output solutions have problems such as high cost, inconvenience in software portability, poor multithread security and low efficiency, especially when using UART or Ethernet interfaces.
Provide a data input and output method, using preset general output and input interfaces in Autosar OS, realize data input and output of any hardware interface through FIFO memory and hardware driver interface, and ensure multi-tasking through resource lock and priority mechanism. Security.
It realizes data input and output of any hardware interface, reduces development costs, simplifies software portability, improves multi-threaded safety and efficiency, and supports multiple hardware interfaces.
Smart Images

Figure CN113031927B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of software technology, and in particular to a data input and output method, device and system. Background Art
[0002] Currently, there are two data input and output solutions based on AUTOSAR (Automotive Open System Architecture). One is to use DLT (Diagnostic Log and Trace) to implement data input and output, and the other is to directly use UART (Universal Asynchronous Receiver Transmitter) or Ethernet interface to implement data input and output through custom driver.
[0003] DLT is a standard module in AUTOSAR, but DLT needs static configuration and a dedicated host computer for data interaction during use. The dedicated host computer is expensive and requires systematic training. The cost of use is high. The interface is incompatible with the C language standard library, which is not conducive to software transplantation. DLT does not support formatted data output, and cannot directly output integers, floating-point numbers, etc., which is inconvenient to use. DTL only supports the hardware interfaces UART, ETH and CAN defined by AUTOSAR.
[0004] Directly using UART or Ethernet for data input and output will result in problems such as failure to meet multi-threaded security and low efficiency. If multiple tasks call the hardware interface at the same time, the printed data will be disordered. If the hardware is operated in a synchronous waiting manner, a large amount of CPU time will be occupied. Directly calling the hardware driver interface for data output is inconvenient for maintenance and code transplantation. A large number of code modifications are required after changing the hardware environment. Summary of the invention
[0005] The purpose of the present application is to provide a data input and output method, device and system, which can realize data input and output for any hardware interface, facilitate transplantation and have low cost.
[0006] In a first aspect, an embodiment of the present application provides a data output method, which is applied to Autosar OS; the method includes: calling a preset general output interface to store the data to be output of the upper-layer application in a first target FIFO memory; reading the data to be output from the first target FIFO memory by interruption or polling, and outputting the data to be output to the underlying hardware through a specified hardware driver interface.
[0007] Furthermore, if there are multiple data output tasks at the same time, before the step of storing the data to be output of the upper-layer application in the first target FIFO memory, it also includes: obtaining a resource lock and using the resource mechanism of the Autosar OS to prevent multiple data output tasks from being performed simultaneously; closing the hardware driver output task or closing related interrupts to prevent the upper-layer application and the underlying interface from reading and writing at the same time.
[0008] Furthermore, the above-mentioned Autosar OS runs on an MCU, and the MCU includes multiple CPUs, each CPU is configured with a first FIFO memory; before the step of storing the to-be-output data of the upper-layer application in the first target FIFO memory, the method also includes: determining the first target FIFO memory according to the priority corresponding to each first FIFO memory.
[0009] In a second aspect, an embodiment of the present application also provides a data input method, which is applied to Autosar OS; the method includes: writing the data to be input of the underlying hardware into a second target FIFO memory through an interrupt or polling method through a specified hardware driver interface; calling a preset universal input interface, reading the data to be input from the second target FIFO memory, and inputting the data to be input into an upper-level application.
[0010] Furthermore, if there are multiple data input tasks at the same time, before the step of reading the data to be input from the second target FIFO memory, it also includes: acquiring a resource lock and using the resource mechanism of the Autosar OS to prevent multiple data input tasks from being performed simultaneously; closing the hardware driver input task or closing related interrupts to prevent the upper-layer application and the underlying interface from reading and writing simultaneously.
[0011] Furthermore, the Autosar OS runs on an MCU, which includes multiple CPUs, each of which is configured with a second FIFO memory; before the step of reading the data to be input from the second target FIFO memory, the method also includes: determining the second target FIFO memory according to the priority corresponding to each second FIFO memory.
[0012] In a third aspect, an embodiment of the present application further provides a data output device, which is applied to Autosar OS; the device includes: an output interface calling module, which is used to call a preset general output interface and store the data to be output of the upper-layer application in a first target FIFO memory; a data output module, which is used to read the data to be output from the first target FIFO memory by interruption or polling, and output the data to be output to the underlying hardware through a specified hardware driver interface.
[0013] In a fourth aspect, an embodiment of the present application further provides a data input device, which is applied to Autosar OS; the device includes: a data writing module, which is used to write the data to be input of the underlying hardware into a second target FIFO memory through an interrupt or polling method through a specified hardware driver interface; an interface calling module, which is used to call a preset universal input interface, read the data to be input from the second target FIFO memory, and input the data to be input to an upper-level application.
[0014] In a fifth aspect, an embodiment of the present application further provides a data input and output system, the system comprising: an MCU installed with Autosar OS, each CPU of the MCU is configured with a first FIFO memory and a second FIFO memory; the Autosar OS is used to execute the methods described in the first aspect and the second aspect.
[0015] In a sixth aspect, an embodiment of the present application further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the methods described in the first and second aspects.
[0016] In the data input and output method, device and system provided by the embodiment of the present application, the data output method is applied to Autosar OS; by calling the preset universal output interface, the data to be output of the upper layer application is stored in the first target FIFO memory; then the data to be output is read from the first target FIFO memory by interruption or polling, and the data to be output is output to the underlying hardware by specifying the hardware driver interface. This method can output data for any hardware interface without modifying the application layer code, which is convenient for transplantation and low cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0017] In order to more clearly illustrate the specific implementation methods of the present application or the technical solutions in the prior art, the drawings required for use in the specific implementation methods or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some implementation methods of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0018] Figure 1 A schematic diagram of a data input and output system provided in an embodiment of the present application;
[0019] Figure 2 A schematic diagram of a software FIFO implementation process provided in an embodiment of the present application;
[0020] Figure 3 A schematic diagram of a protection mechanism provided in an embodiment of the present application;
[0021] Figure 4 A schematic diagram of a FIFO priority provided in an embodiment of the present application;
[0022] Figure 5 A flowchart of a data output method provided in an embodiment of the present application;
[0023] Figure 6 A flow chart of a data input method provided in an embodiment of the present application;
[0024] Figure 7 A structural block diagram of a data output device provided in an embodiment of the present application;
[0025] Figure 8 A structural block diagram of a data input device provided in an embodiment of the present application. DETAILED DESCRIPTION
[0026] The technical solution of the present application will be described clearly and completely below in conjunction with the embodiments. Obviously, the described embodiments are part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in the field without creative work are within the scope of protection of the present application.
[0027] Currently, there are two data input and output solutions based on AUTOSAR (Automotive Open System Architecture). One is to use DLT (Diagnostic Log and Trace) to implement data input and output, and the other is to directly use UART (Universal Asynchronous Receiver Transmitter) or Ethernet interface to implement data input and output through custom driver.
[0028] DLT is a standard module in AUTOSAR, but DLT needs static configuration and a dedicated host computer for data interaction during use. The dedicated host computer is expensive and requires systematic training. The cost of use is high. The interface is incompatible with the C language standard library, which is not conducive to software transplantation. DLT does not support formatted data output, and cannot directly output integers, floating-point numbers, etc., which is inconvenient to use. DTL only supports the hardware interfaces UART, ETH and CAN defined by AUTOSAR.
[0029] Directly using UART or Ethernet for data input and output will result in problems such as failure to meet multi-threaded security and low efficiency. If multiple tasks call the hardware interface at the same time, the printed data will be disordered. If the hardware is operated in a synchronous waiting manner, a large amount of CPU time will be occupied. Directly calling the hardware driver interface for data output is inconvenient for maintenance and code transplantation. A large number of code modifications are required after changing the hardware environment.
[0030] Based on this, an embodiment of the present application provides a data input and output method, device and system. To facilitate understanding of the present embodiment, a data input and output system disclosed in an embodiment of the present application is first introduced in detail.
[0031] Figure 1 A schematic diagram of a data input and output system provided by an embodiment of the present application is shown, the system comprising: an MCU installed with Autosar OS, each CPU of the MCU is configured with a first FIFO memory and a second FIFO memory; Autosar OS is used to execute the steps of a data input method and a data output method.
[0032] See also Figure 2 The figure shows a schematic diagram of a software FIFO memory that is separated from the underlying hardware interface. When the application software wants to send data, Autosar OS first writes to the FIFO memory, and then continues to execute other parts of the software. Since the commonly used MCU supports multiple cores, in order to support multi-core security, a FIFO memory needs to be allocated separately for each core CPU to prevent conflicts, such as the wFIFO in the data output process and the rFIFO in the data input process shown in the figure.
[0033] The data output process is as follows: Autosar OS calls the general output interface, writes the output data of the upper application into the wFIFO, then reads the data in the wFIFO through interrupt or polling, and sends the data to the underlying hardware through the hardware driver interface.
[0034] The data input process is as follows: Autosar OS writes the waiting input data of the underlying hardware into rFIFO through the specified hardware driver interface by interruption or polling; when the upper-layer application wants to read the data, Autosar OS calls the preset universal input interface, reads the waiting input data from rFIFO, and inputs the waiting input data to the upper-layer application. The use of software FIFO can make the input and output interface independent of specific hardware implementation, and the specific hardware only needs to interact with the FIFO memory for data.
[0035] The above data input and output system also provides a protection mechanism and a deadlock prevention mechanism based on Autosar OS to prevent conflicts caused by multiple tasks accessing the hardware together and destroying the FIFO data structure. It can also use the resource mechanism of Autosar OS to prevent deadlock and avoid system crash. Figure 3 As shown in the figure, the specific mechanism of implementation is to establish a resource for each FIFO. When reading and writing, it is necessary to obtain the resource lock first to prevent multiple tasks from writing (reading) at the same time, and at the same time close the hardware input and output tasks or close the related interrupts to prevent the upper-level application and the underlying interface from reading and writing at the same time.
[0036] In addition, the above data input and output system also supports input and output priority mechanism, such as Figure 4 As shown, a priority is assigned to each FIFO. When the underlying driver accesses the FIFO, it accesses it according to the priority. The priority needs to be statically assigned. The priority is only related to the hardware core, that is, the priority is statically set manually. Since the FIFO and the CPU core are one-to-one corresponding, the priority setting is defined according to the importance of the CPU core. For example, a CPU with higher security requirements requires a higher priority, and a CPU that handles general computing tasks can be assigned a lower priority. The tasks running in the CPU of Autosar OS are statically defined during the design, so you only need to statically set the priority according to the overall arrangement of the system.
[0037] The data input and output system provided in the embodiment of the present application is a universal data input and output solution. It does not require static configuration like the DLT method, does not need to occupy the CPU running time all the time, and does not require a dedicated host computer. It is simple and fast to develop, the interface is compatible with the C language standard library, multi-threaded safe, highly efficient, low-cost, and supports data input and output of multiple hardware interfaces such as UART, Ethernet, SPI, I2C, CAN, CANFD, USB, etc.
[0038] The specific process of data output method and data input method is described in detail below: Figure 5 A flowchart of a data output method provided in an embodiment of the present application, the method is applied to Autosar OS; the method comprises the following steps:
[0039] Step S502: calling a preset universal output interface to store the data to be output of the upper layer application into the first target FIFO memory.
[0040] If Autosar OS runs on a CPU, and a CPU is configured with a first FIFO memory, then the first FIFO memory can be used as the first target FIFO memory. When the upper-layer application needs to output data, Autosar OS can directly call the preset general output interface to store the data to be output of the upper-layer application in the first target FIFO memory.
[0041] If Autosar OS runs on MCU, MCU includes multiple CPUs, each CPU is configured with a first FIFO memory; then the first target FIFO memory at this time needs to be determined according to the priorities of the multiple first FIFO memories, that is, the first FIFO memory with the highest priority is used as the first target FIFO memory. It should be noted that the priority of the first FIFO memory here is consistent with the priority of its corresponding CPU, that is, the higher the priority of the CPU, the higher the priority of the first FIFO memory configured by it.
[0042] Step S504: read the data to be output from the first target FIFO memory by interruption or polling, and output the data to be output to the underlying hardware through a designated hardware driver interface.
[0043] The data output method provided in the embodiment of the present application is applied to Autosar OS; by calling a preset universal output interface, the data to be outputted of the upper layer application is stored in the first target FIFO memory; then the data to be outputted is read from the first target FIFO memory by interruption or polling, and the data to be outputted is outputted to the underlying hardware by specifying a hardware driver interface. This method can output data for any hardware interface without modifying the application layer code, is convenient for transplantation, and has low cost.
[0044] In the case of multiple data output tasks at the same time, before the step of storing the data to be output of the upper-layer application in the first target FIFO memory, the following steps are also included: obtaining a resource lock and using the resource mechanism of the Autosar OS to prevent multiple data output tasks from being performed simultaneously; closing the hardware driver output task or closing related interrupts to prevent the upper-layer application and the underlying interface from reading and writing at the same time.
[0045] The above-mentioned closing of the hardware driver output task or closing of related interrupts can prevent multiple data output tasks from accessing the hardware together to cause conflicts and avoid destroying the data structure of the first FIFO memory; the above-mentioned acquisition of the resource lock is a protection mechanism and deadlock prevention mechanism based on Autosar OS, and the resource mechanism of Autosar OS can be used to prevent deadlock and avoid system crash.
[0046] Figure 6 A flowchart of a data input method provided in an embodiment of the present application, the data input method is applied to Autosar OS, and specifically includes the following steps:
[0047] Step S602: write the to-be-input data of the bottom hardware into the second target FIFO memory through the designated hardware driver interface by interruption or polling.
[0048] If Autosar OS runs on a CPU and a CPU is configured with a second FIFO memory, then the second FIFO memory can be used as the second target FIFO memory. When the underlying hardware transmits data to the upper-level application, Autosar OS can directly write the input data of the underlying hardware into the second target FIFO memory through an interrupt or polling method through the specified hardware driver interface.
[0049] If Autosar OS runs on MCU, MCU includes multiple CPUs, each CPU is configured with a second FIFO memory; then the second target FIFO memory at this time needs to be determined according to the priorities of the multiple second FIFO memories, that is, the second FIFO memory with the highest priority is used as the second target FIFO memory. It should be noted that the priority of the second FIFO memory is consistent with the priority of its corresponding CPU, that is, the higher the priority of the CPU, the higher the priority of the second FIFO memory configured.
[0050] Step S604: calling a preset universal input interface, reading the data to be input from the second target FIFO memory, and inputting the data to be input to the upper layer application.
[0051] It should be noted that the "first" and "second" in the above-mentioned first FIFO memory and second FIFO memory are only used to distinguish the data flow direction, that is, one is used in the data output process, and the other is used in the data input process. The first FIFO memory and the second FIFO memory are essentially first-in-first-out memories and have the same functions.
[0052] In the case where there are multiple data input tasks at the same time, before the step of reading the data to be input from the second target FIFO memory, the following steps are also included: obtaining a resource lock and using the resource mechanism of the Autosar OS to prevent multiple data input tasks from being performed simultaneously; closing the hardware driver input task or closing related interrupts to prevent the upper-layer application and the underlying interface from reading and writing at the same time.
[0053] Similarly, closing the hardware driver input task or closing the related interrupt can prevent multiple data input tasks from accessing the hardware together to cause conflicts and avoid destroying the data structure of the second FIFO memory; the acquisition of the resource lock is a protection mechanism and deadlock prevention mechanism based on Autosar OS, and the resource mechanism of Autosar OS can be used to prevent deadlock and avoid system crash.
[0054] The data input method provided in the embodiment of the present application is applied to Autosar OS; the data to be inputted of the underlying hardware is written into the second target FIFO memory through the specified hardware driver interface by interruption or polling; then the preset universal input interface is called to read the data to be inputted from the second target FIFO memory, and the data to be inputted is inputted to the upper layer application. This method can input data for any hardware interface without modifying the application layer code, is convenient for transplantation, and has low cost.
[0055] Based on the above data output method embodiment, the present application embodiment also provides a data output device, which is applied to Autosar OS; see Figure 7 As shown, the device includes: an output interface calling module 72, which is used to call a preset universal output interface and store the data to be output of the upper-layer application into a first target FIFO memory; a data output module 74, which is used to read the data to be output from the first target FIFO memory by interruption or polling, and output the data to be output to the underlying hardware through a specified hardware driver interface.
[0056] The above-mentioned data output device also includes a protection module, which is used to obtain a resource lock before storing the data to be output of the upper-layer application in the first target FIFO memory when there are multiple data output tasks at the same time, and use the resource mechanism of Autosar OS to prevent multiple data output tasks from being carried out simultaneously; close the hardware driver output task or close the related interrupt to prevent the upper-layer application and the bottom-layer interface from reading and writing at the same time.
[0057] The output interface calling module 72 is further used to determine the first target FIFO memory according to the priority corresponding to each first FIFO memory.
[0058] The data output device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned data output method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the device, reference may be made to the corresponding contents in the aforementioned data output method embodiment.
[0059] Based on the above data input method embodiment, the present application embodiment also provides a data input device, which is applied to Autosar OS; see Figure 8As shown, the device includes: a data writing module 82, which is used to write the data to be input of the underlying hardware into the second target FIFO memory through an interrupt or polling method through a specified hardware driver interface; an interface calling module 84, which is used to call a preset universal input interface, read the data to be input from the second target FIFO memory, and input the data to be input to the upper application.
[0060] The above-mentioned data input device also includes a protection module, which is used to obtain a resource lock before reading the data to be input from the second target FIFO memory when there are multiple data input tasks at the same time, and use the resource mechanism of AutosarOS to prevent multiple data input tasks from being carried out simultaneously; close the hardware driver input task or close the related interrupt to prevent the upper-level application and the underlying interface from reading and writing at the same time.
[0061] The interface calling module 84 is further used to determine the second target FIFO memory according to the priority corresponding to each second FIFO memory.
[0062] The data input device provided in the embodiment of the present application has the same implementation principle and technical effects as those of the aforementioned data input method embodiment. For the sake of brief description, for matters not mentioned in the embodiment of the device, reference may be made to the corresponding contents in the aforementioned data input method embodiment.
[0063] An embodiment of the present application also provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above method. The specific implementation can be found in the aforementioned method embodiment, which will not be repeated here.
[0064] The computer program products of the data input and output methods, devices and systems provided in the embodiments of the present application include a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0065] Unless otherwise specifically stated, the relative steps, numerical expressions and values of the components and steps set forth in these embodiments do not limit the scope of the present application.
[0066] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a non-volatile computer-readable storage medium that is executable by a processor. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present application. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0067] In the description of the present application, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present application and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as limiting the present application. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0068] Finally, it should be noted that the above-described embodiments are only specific implementation methods of the present application, which are used to illustrate the technical solutions of the present application, rather than to limit them. The protection scope of the present application is not limited thereto. Although the present application is described in detail with reference to the above-described embodiments, ordinary technicians in the field should understand that any technician familiar with the technical field can still modify the technical solutions recorded in the above-described embodiments within the technical scope disclosed in the present application, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the embodiments of the present application, and should be included in the protection scope of the present application. Therefore, the protection scope of the present application shall be subject to the protection scope of the claims.
Claims
1. A data output method, characterized in that: The method is applied to Autosar OS; the Autosar OS runs on an MCU, the MCU includes a plurality of CPUs, each of the CPUs is configured with a first FIFO memory; the method includes: Calling a preset universal output interface to store the to-be-output data of the upper layer application into the first target FIFO memory; Reading the data to be output from the first target FIFO memory by interruption or polling, and outputting the data to be output to the underlying hardware through a specified hardware driver interface; If there are multiple data output tasks at the same time, before the step of storing the to-be-output data of the upper-layer application in the first target FIFO memory, the method further includes: obtaining a resource lock, using the resource mechanism of the Autosar OS to prevent multiple data output tasks from being performed simultaneously; closing the hardware driver output task or closing the related interrupt to prevent the upper-layer application and the bottom-layer interface from reading and writing simultaneously; Before the step of storing the to-be-output data of the upper layer application in the first target FIFO memory, the method further comprises: determining the first target FIFO memory according to the priority corresponding to each of the first FIFO memories.
2. A data input method, characterized in that: The method is applied to Autosar OS; the Autosar OS runs on an MCU, the MCU includes a plurality of CPUs, each of the CPUs is configured with a second FIFO memory; the method includes: Writing the to-be-input data of the bottom hardware into the second target FIFO memory through the specified hardware driver interface by interruption or polling; calling the preset universal input interface to read the to-be-input data from the second target FIFO memory, and inputting the to-be-input data into the upper layer application; If there are multiple data input tasks at the same time, before the step of reading the data to be input from the second target FIFO memory, the method further includes: acquiring a resource lock, using the resource mechanism of the Autosar OS to prevent multiple data input tasks from being performed simultaneously; closing the hardware driver input task or closing the related interrupt to prevent the upper layer application and the bottom layer interface from reading and writing simultaneously; Before the step of reading the data to be input from the second target FIFO memory, the method further includes: determining a second target FIFO memory according to a priority corresponding to each of the second FIFO memories.
3. A data output device, characterized in that: The device is applied to Autosar OS; the Autosar OS runs on an MCU, the MCU includes a plurality of CPUs, each of the CPUs is configured with a first FIFO memory; the device includes: An output interface calling module, used for calling a preset universal output interface, and storing the to-be-output data of the upper layer application into a first target FIFO memory; A data output module, used for reading the data to be output from the first target FIFO memory by interruption or polling, and outputting the data to be output to the underlying hardware through a specified hardware driver interface; The first control module is used for obtaining a resource lock before storing the to-be-output data of the upper-layer application in the first target FIFO memory if there are multiple data output tasks at the same time, and using the resource mechanism of the Autosar OS to prevent multiple data output tasks from being performed simultaneously; closing the hardware driver output task or closing the related interrupt to prevent the upper-layer application and the bottom-layer interface from reading and writing simultaneously; The first judgment module is used to determine the first target FIFO memory according to the priority corresponding to each of the first FIFO memories before the step of storing the to-be-output data of the upper layer application in the first target FIFO memory.
4. A data input device, characterized in that: The device is applied to Autosar OS; the Autosar OS runs on an MCU, the MCU includes a plurality of CPUs, each of the CPUs is configured with a second FIFO memory; the device includes: A data writing module is used to write the to-be-input data of the underlying hardware into the second target FIFO memory through a designated hardware driver interface by means of interruption or polling; An interface calling module, used for calling a preset universal input interface, reading the data to be input from the second target FIFO memory, and inputting the data to be input to an upper layer application; The second control module is used for obtaining a resource lock before reading the data to be input from the second target FIFO memory if there are multiple data input tasks at the same time, and using the resource mechanism of the Autosar OS to prevent multiple data input tasks from being performed simultaneously; closing the hardware driver input task or closing the related interrupt to prevent the upper layer application and the bottom layer interface from reading and writing simultaneously; The second judgment module is used to determine the second target FIFO memory according to the priority corresponding to each second FIFO memory before the step of reading the data to be input from the second target FIFO memory.
5. A data input and output system, characterized in that: The system comprises: an MCU installed with an Autosar OS, each CPU of the MCU is configured with a first FIFO memory and a second FIFO memory; the Autosar OS is used to execute the method according to claim 1 or 2.
6. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the method of claim 1 or 2.
Citation Information
Patent Citations
A method and a system for realizing high-speed data transmission between a DSP and a ZYNQ
CN109902042A
METHOD, equipment AND COMPUTER PROGRAM PRODUCT FOR PROCESSING DATA
CN110413210A