Data processing method and transport layer module in AutoSar architecture
By determining and utilizing suitable target sub-storage areas to store data to be cached in the transport layer module of the AutoSar architecture, the problems of Buffer overflow and data coverage are solved, and the reliability and stability of data transmission are achieved.
Patent Information
- Application Number
- CN202411925745.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-25
- Publication Date
- 2025-04-08
AI Technical Summary
In the transport layer module in the AutoSar architecture, when using Buffer to cache data, it is easy to overflow or overwrite the incoming data due to incorrect length, resulting in data transmission failure or program crash.
By determining the target storage block based on the source address and destination address of the data to be cached, it is detected whether there is a target sub-storage area in the target storage block that does not exist and available storage space is sufficient to store the data to be cached, and the data is stored in the sub-storage area.
It effectively avoids buffer data being overwritten and buffer overflow, ensuring the integrity and stability of data transmission.
Smart Images

Figure CN119781688A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of communication technology, and in particular to a data processing method, a device, a transport layer module in an AutoSar architecture, and a computer-readable storage medium. Background Art
[0002] The transport layer module in the AutoSar architecture is used to transmit data whose length exceeds the single-frame transmission length. Before transmission, the data needs to be cached using a buffer.
[0003] Currently, when using Buffer to cache data, the Buffer is directly operated according to the data length, which may easily lead to the risk of data in the Buffer being overwritten or Buffer overflow due to incorrect input data length, ultimately causing data transmission failure or even program crash. Summary of the invention
[0004] The present application provides a data processing method, a device, a transport layer module in an AutoSar architecture, and a computer-readable storage medium, which can solve the technical problem in the prior art that when using a Buffer to cache data, data in the Buffer is easily overwritten or the Buffer overflows.
[0005] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to a transport layer module in an AutoSar architecture, and the data processing method includes:
[0006] Determine a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas;
[0007] Detecting whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area where no data exists and the available storage space is sufficient to store the data to be cached;
[0008] If the target sub-storage area exists in the target storage block, the data to be cached is stored in the target sub-storage area.
[0009] In combination with the first aspect, in one implementation, determining the target storage block according to the source address and the destination address of the data to be cached includes:
[0010] Determine a target transmission channel according to the source address and destination address of the data to be cached;
[0011] A target storage block corresponding to the target transmission channel is determined based on the corresponding relationship between the transmission channel and the storage block.
[0012] In combination with the first aspect, in one implementation, the detecting whether a target sub-storage area exists in the target storage block includes:
[0013] Obtaining status flags of all sub-storage areas included in the target storage block, wherein when there is no data in the sub-storage area, the corresponding status flag is a first value, and when there is data in the sub-storage area, the corresponding status flag is a second value;
[0014] If there is an optional sub-storage area whose status flag is the first value, detecting whether there is a target optional sub-storage area with available storage space sufficient to store the data to be cached;
[0015] If there is a target optional sub-storage area with available storage space sufficient to store the data to be cached, any target optional sub-storage area is used as the target sub-storage area;
[0016] If there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, determining that there is no target sub-storage area in the target storage block;
[0017] If the status flags of all sub-storage areas are the second value, it is determined that no target sub-storage area exists in the target storage block.
[0018] In combination with the first aspect, in one implementation, after determining that there is no target sub-storage area in the target storage block if there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, the method further includes:
[0019] Selecting a sub-storage area from the optional sub-storage areas, increasing the available storage space of the selected sub-storage area so that the available storage space of the selected sub-storage area is sufficient to store the data to be cached, and using the selected sub-storage area as a target optional sub-storage area;
[0020] Alternatively, a sub-storage area having available storage space sufficient to store the data to be cached is added to the target storage block, and the newly added sub-storage area is used as the target optional sub-storage area.
[0021] In combination with the first aspect, in one implementation, after determining that the target sub-storage area does not exist in the target storage block if the status flag bits of all sub-storage areas are the second value, the method further includes:
[0022] A sub-storage area having available storage space sufficient to store the data to be cached is added to the target storage block, and the newly added sub-storage area is used as a target optional sub-storage area.
[0023] In combination with the first aspect, in an embodiment, after taking the selected sub-storage area as the target optional sub-storage area, or after taking the newly added sub-storage area as the target optional sub-storage area, the method further includes:
[0024] The data to be cached is stored in the target sub-storage area.
[0025] In combination with the first aspect, in an implementation manner, after storing the data to be cached in the target sub-storage area, the method further includes:
[0026] Updating the status flag of the target sub-storage area to a second value;
[0027] Read the data in the target sub-storage area and send it;
[0028] After the sending is completed, the status flag bit of the target sub-storage area is updated to the first value.
[0029] In a second aspect, an embodiment of the present application provides a transport layer module in an AutoSar architecture, wherein the transport layer module includes:
[0030] A determination module, configured to determine a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas;
[0031] a detection module, configured to detect whether a target sub-storage area exists in the target storage block, wherein the target sub-storage area is a sub-storage area in which no data exists and the available storage space is sufficient to store the data to be cached;
[0032] The storage module is configured to store the data to be cached in the target sub-storage area if the target sub-storage area exists in the target storage block.
[0033] In a third aspect, an embodiment of the present application provides a data processing device, comprising a processor, a memory, and a data processing program stored in the memory and executable by the processor, wherein when the data processing program is executed by the processor, the steps of the data processing method described in the first aspect are implemented.
[0034] In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, on which a data processing program is stored, wherein when the data processing program is executed by a processor, the steps of the data processing method described in the first aspect are implemented.
[0035] The beneficial effects brought by the technical solution provided in the embodiments of the present application include:
[0036] In an embodiment of the present application, a target storage block is determined according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas; it is detected whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area in which no data exists and the available storage space is sufficient to store the data to be cached; if the target sub-storage area exists in the target storage block, the data to be cached is stored in the target sub-storage area. Through the embodiment of the present application, based on the selection of the target sub-storage area, it is possible to avoid the data in the buffer being overwritten and the buffer overflowing. BRIEF DESCRIPTION OF THE DRAWINGS
[0037] Figure 1 This is a flow chart of the first embodiment of the data processing method of the present application;
[0038] Figure 2 For this application Figure 1 Detailed flow chart of step S20;
[0039] Figure 3 This is a flow chart of the second embodiment of the data processing method of the present application;
[0040] Figure 4 This is a functional module diagram of an embodiment of a transport layer module in the AutoSar architecture of the present application;
[0041] Figure 5 This is a schematic diagram of the hardware structure of the data processing device involved in the embodiment of the present application. DETAILED DESCRIPTION
[0042] In order to enable those skilled in the art to better understand the solution of the present application, the technical solution in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application. Obviously, the described embodiments are only 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 this field without creative work are within the scope of protection of this application.
[0043] First, some technical terms in the present application are explained to facilitate those skilled in the art to understand the present application.
[0044] AutoSar is the abbreviation of Automotive Open System Architecture. It encapsulates the underlying software of the automotive electronic control unit (ECU) in a standard way, so that by sharing a set of underlying software, in most cases, only some parameters need to be modified to match different hardware and different application layer software. By decoupling software and hardware, application software can be developed without relying on hardware.
[0045] In order to make the objectives, technical solutions and advantages of the present application clearer, the implementation methods of the present application will be further described in detail below with reference to the accompanying drawings.
[0046] In a first aspect, an embodiment of the present application provides a data processing method, which is applied to a transport layer module in an AutoSar architecture.
[0047] In one embodiment, referring to Figure 1 , Figure 1 This is a flow chart of the first embodiment of the data processing method of this application. Figure 1 As shown, the data processing method includes:
[0048] Step S10, determining a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas;
[0049] In this embodiment, the transport layer module in the AutoSar architecture includes a Can TP module, a Lin TP module, and a FlexRayTP module, where TP represents a transport layer protocol. The buffer is pre-divided into a plurality of sub-storage areas, and then a plurality of storage blocks are determined based on the plurality of sub-storage areas, wherein a storage block includes one or more sub-storage areas. For example, the buffer is divided into 100 sub-storage areas, namely sub-storage areas 1 to sub-storage areas 100, wherein storage block 1 includes sub-storage areas 1 to sub-storage areas 2, storage block 2 includes sub-storage areas 3 to sub-storage areas 6, storage block 3 includes sub-storage areas 7, and so on. Among them, the size of each sub-storage area and the number of sub-storage areas contained in each storage block are set according to actual conditions.
[0050] In the AutoSar architecture, the transport layer module is used to transmit data between two ECUs. For example, if the data to be cached is sent from ECU1 to ECU2, the source address is the IP address of ECU1, and the destination address is the IP address of ECU2. Based on this, the storage blocks used to transmit data between two ECUs can be pre-set. For example, the IP address of ECU1 and the IP address of ECU2 correspond to storage block 1; the IP address of ECU1 and the IP address of ECU3 correspond to storage block 2, and so on. On this basis, the target storage block can be determined according to the source address and destination address of the data to be cached. For example, if the source address and destination address of the data to be cached are the IP address of ECU3 and the IP address of ECU1 respectively, the target storage block can be determined to be storage block 2.
[0051] Step S20, detecting whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area in which no data exists and the available storage space is sufficient to store the data to be cached;
[0052] In this embodiment, combined with the description of step S10, the target storage block takes storage block 2 as an example, and storage block 2 includes sub-storage areas 3 to 6, then a sub-storage area in which no data exists and whose available storage space is sufficient to store the data to be cached is searched from sub-storage areas 3 to 6. It is easy to understand that the available storage space is sufficient to store the data to be cached, that is, the size of the available storage space is greater than the size of the data to be cached. Among them, each sub-storage area included in storage block 2 can be detected in sequence from high to low or from low to high based on the address of the sub-storage area.
[0053] Step S30: If the target sub-storage area exists in the target storage block, the data to be cached is stored in the target sub-storage area.
[0054] In this embodiment, if the target sub-storage area exists in the target storage block, for example, the target sub-storage area is sub-storage area 6, the data to be cached is stored in the target sub-storage area. It is easy to understand that since there is no data in sub-storage area 6, the original data in the buffer will not be overwritten by mistake; and the available storage space of sub-storage area 6 is sufficient to store the data to be cached, so the buffer will not overflow.
[0055] In an embodiment of the present application, a target storage block is determined according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas; it is detected whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area in which no data exists and the available storage space is sufficient to store the data to be cached; if the target sub-storage area exists in the target storage block, the data to be cached is stored in the target sub-storage area. Through the embodiment of the present application, based on the selection of the target sub-storage area, it is possible to avoid the data in the buffer being overwritten and the buffer overflowing.
[0056] Furthermore, in one embodiment, step S10 includes:
[0057] A target transmission channel is determined according to a source address and a destination address of the data to be cached; and a target storage block corresponding to the target transmission channel is determined based on a corresponding relationship between the transmission channel and the storage block.
[0058] In this embodiment, a specific transmission channel is used to transmit data between two ECUs using a specific transport layer protocol. For example, transmission channel 1 is used to transmit data between ECU1 and ECU2 via the CAN protocol; transmission channel 2 is used to transmit data between ECU1 and ECU2 via the Lin protocol; and transmission channel 3 is used to transmit data between ECU2 and ECU3 via the CAN protocol.
[0059] When the data to be cached needs to be transmitted through the Can TP module, and the source address and the destination address are the IP addresses of ECU1 and ECU2 or the IP addresses of ECU2 and ECU1 respectively, it is determined that transmission channel 1 needs to be used for transmission, and the target transmission channel is determined to be transmission channel 1. Further, the correspondence between each transmission channel and the storage block is preset, for example, transmission channel 1 corresponds to storage block 1, transmission channel 2 corresponds to storage block 2, and so on. Based on this, the target storage block corresponding to the target transmission channel can be determined.
[0060] Further, in one embodiment, referring to Figure 2 , Figure 2 For this application Figure 1 Detailed flow chart of step S20 in FIG. Figure 2 As shown, step S20 includes:
[0061] Step S201, obtaining status flags of all sub-storage areas included in the target storage block, wherein when there is no data in the sub-storage area, the corresponding status flag is a first value, and when there is data in the sub-storage area, the corresponding status flag is a second value;
[0062] In this embodiment, whether the sub-storage area stores data is represented by a status flag. When the buffer is initialized, the data in the buffer is cleared, and the status flags of all sub-storage areas are set to the first value. Subsequently, when the buffer is used, if data is written to the sub-storage area, its status flag is updated to the second value; if data in the sub-storage area is read, its status flag is updated to the first value.
[0063] Step S202, if there is an optional sub-storage area whose status flag is the first value, then detecting whether there is a target optional sub-storage area with available storage space sufficient to store the data to be cached;
[0064] Step S203, if there is a target optional sub-storage area with available storage space sufficient to store the data to be cached, any target optional sub-storage area is used as the target sub-storage area;
[0065] In this embodiment, it is assumed that the optional sub-storage areas with the status flag bit being the first value include sub-storage area 3, sub-storage area 5, and sub-storage area 7. It is then respectively detected whether the available storage space of sub-storage area 3, sub-storage area 5, and sub-storage area 7 is sufficient to store the data to be cached. If the target optional sub-storage area includes sub-storage area 5 and sub-storage area 7, any one of sub-storage area 5 and sub-storage area 7 is used as the target sub-storage area.
[0066] It is easy to understand that if there is only one target optional sub-storage area, the target optional sub-storage area is directly used as the target sub-storage area.
[0067] Step S204, if there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, determining that there is no target sub-storage area in the target storage block;
[0068] In this embodiment, if it is detected that the available storage space of sub-storage area 3, sub-storage area 5 and sub-storage area 7 is insufficient to store the data to be cached, it is determined that there is no target sub-storage area in the target storage block.
[0069] Step S205: If the status flags of all sub-storage areas are the second value, it is determined that the target sub-storage area does not exist in the target storage block.
[0070] In this embodiment, if the status flags of all sub-storage areas are the second value, it means that data exists in all sub-storage areas included in the target storage block. In order to avoid data overwriting, it is determined that there is no target sub-storage area in the target storage block.
[0071] Further, in one embodiment, referring to Figure 3 , Figure 3 This is a flow chart of the second embodiment of the data processing method of this application. Figure 3 As shown, after step S204, the following steps are also included:
[0072] Step S206, selecting a sub-storage area from the optional sub-storage areas, increasing the available storage space of the selected sub-storage area so that the available storage space of the selected sub-storage area is sufficient to store the data to be cached, and using the selected sub-storage area as the target optional sub-storage area;
[0073] In this embodiment, if the available storage space of sub-storage area 3, sub-storage area 5 and sub-storage area 7 is insufficient to store the data to be cached, then any one of sub-storage area 3, sub-storage area 5 and sub-storage area 7 can be selected, or a sub-storage area whose available storage space is closest to the size of the data to be cached can be selected. For example, sub-storage area 7 is selected, where the available storage space size of sub-storage area 7 is 5M and the size of the data to be cached is 6M. The available storage space of sub-storage area 7 can be increased to 7M, so that the sub-storage area 7 with the increased available storage space is sufficient to store the data to be cached, and sub-storage area 7 is used as the target optional sub-storage area.
[0074] Or, in step S207, a sub-storage area having available storage space sufficient to store the data to be cached is added to the target storage block, and the newly added sub-storage area is used as a target optional sub-storage area.
[0075] In this embodiment, a sub-storage area with available storage space sufficient to store the data to be cached may be added to the target storage block, and the newly added sub-storage area may be used as the target optional sub-storage area.
[0076] Further, in one embodiment, continue to refer to Figure 3 , after step S205, further comprising:
[0077] Step S207: adding a sub-storage area with available storage space sufficient to store the data to be cached to the target storage block, and using the newly added sub-storage area as a target optional sub-storage area.
[0078] In this embodiment, since all sub-storage areas included in the target storage block have data, only one sub-storage area with available storage space sufficient to store the data to be cached can be added to the target storage block, and the added sub-storage area is used as the target optional sub-storage area.
[0079] Further, in one embodiment, continue to refer to Figure 3 , after step S206 and after step S207, execute step S30.
[0080] In this embodiment, through the processing of step S206 or step S207, if the target sub-storage area exists, the data to be cached is stored in the target sub-storage area.
[0081] Furthermore, in one embodiment, after step S30, the method further includes:
[0082] The state flag of the target sub-storage area is updated to the second value; the data in the target sub-storage area is read and sent; after the sending is completed, the state flag of the target sub-storage area is updated to the first value.
[0083] In this embodiment, after the data to be cached is stored in the target sub-storage area, the state flag of the target sub-storage area can be updated to the second value. Since the memory address of each sub-storage area is known, data (the data is the above-mentioned data to be cached) can be read from the target sub-storage area based on the memory address of the target sub-storage area and sent. After the reading and sending are completed, if the data in the target sub-storage area is empty, the state flag of the target sub-storage area is updated to the first value.
[0084] In a second aspect, an embodiment of the present application also provides a transport layer module in an AutoSar architecture.
[0085] In one embodiment, referring to Figure 4 , Figure 4 This is a functional module diagram of an embodiment of the transport layer module in the AutoSar architecture of this application. Figure 4 As shown, the transport layer modules in the AutoSar architecture include:
[0086] A determination module 10, configured to determine a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas;
[0087] A detection module 20 is used to detect whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area where no data exists and the available storage space is sufficient to store the data to be cached;
[0088] The storage module 30 is configured to store the data to be cached in the target sub-storage area if the target sub-storage area exists in the target storage block.
[0089] Furthermore, in one embodiment, the determination module 10 is used to:
[0090] Determine a target transmission channel according to the source address and destination address of the data to be cached;
[0091] A target storage block corresponding to the target transmission channel is determined based on the corresponding relationship between the transmission channel and the storage block.
[0092] Furthermore, in one embodiment, the detection module 20 is used to:
[0093] Obtaining status flags of all sub-storage areas included in the target storage block, wherein when there is no data in the sub-storage area, the corresponding status flag is a first value, and when there is data in the sub-storage area, the corresponding status flag is a second value;
[0094] If there is an optional sub-storage area whose status flag is the first value, detecting whether there is a target optional sub-storage area with available storage space sufficient to store the data to be cached;
[0095] If there is a target optional sub-storage area with available storage space sufficient to store the data to be cached, any target optional sub-storage area is used as the target sub-storage area;
[0096] If there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, determining that there is no target sub-storage area in the target storage block;
[0097] If the status flags of all sub-storage areas are the second value, it is determined that no target sub-storage area exists in the target storage block.
[0098] Furthermore, in one embodiment, the transport layer module in the AutoSar architecture further includes:
[0099] The first expansion module is used to select a sub-storage area from the optional sub-storage areas, increase the available storage space of the selected sub-storage area, so that the available storage space of the selected sub-storage area is sufficient to store the data to be cached, and use the selected sub-storage area as a target optional sub-storage area.
[0100] Furthermore, in one embodiment, the transport layer module in the AutoSar architecture further includes:
[0101] The second expansion module is used to add a sub-storage area with available storage space sufficient to store the data to be cached to the target storage block, and use the newly added sub-storage area as a target optional sub-storage area.
[0102] Furthermore, in one embodiment, the transport layer module in the AutoSar architecture further includes:
[0103] A sending processing module, used for updating the status flag bit of the target sub-storage area to a second value;
[0104] Read the data in the target sub-storage area and send it;
[0105] After the sending is completed, the status flag bit of the target sub-storage area is updated to the first value.
[0106] Among them, the functional implementation of each module in the transport layer module in the above-mentioned AutoSar architecture corresponds to the steps in the above-mentioned data processing method embodiment, and its functions and implementation processes will not be repeated here one by one.
[0107] In a third aspect, an embodiment of the present application provides a data processing device.
[0108] Reference Figure 5 , Figure 5 Schematic diagram of the hardware structure of the data processing device involved in the embodiment of the present application. In the embodiment of the present application, the data processing device may include a processor, a memory, a communication interface and a communication bus.
[0109] The communication bus may be of any type and is used to interconnect the processor, the memory, and the communication interface.
[0110] Communication interfaces include input / output (I / O) interfaces, physical interfaces, and logical interfaces, which are used to interconnect devices within a data processing device, as well as interfaces used to interconnect a data processing device with other devices (such as other computing devices or user devices). Physical interfaces can be Ethernet interfaces, optical fiber interfaces, ATM interfaces, etc.; user devices can be display screens (Display), keyboards (Keyboard), etc.
[0111] The memory can be various types of storage media, such as random access memory (RAM), read-only memory (ROM), non-volatile RAM (NVRAM), flash memory, optical storage, hard disk, programmable ROM (PROM), erasable PROM (EPROM), electrically erasable PROM (EEPROM), etc.
[0112] The processor may be a general-purpose processor, and the general-purpose processor may call the data processing program stored in the memory and execute the data processing method provided in the embodiment of the present application. For example, the general-purpose processor may be a central processing unit (CPU). The method executed when the data processing program is called may refer to the various embodiments of the data processing method of the present application, and will not be repeated here.
[0113] Those skilled in the art will understand that Figure 5 The hardware structure shown in the figure does not constitute a limitation on the present application, and may include more or less components than shown in the figure, or combine certain components, or arrange the components differently.
[0114] In a fourth aspect, an embodiment of the present application also provides a computer-readable storage medium.
[0115] The computer-readable storage medium of the present application stores a data processing program, wherein when the data processing program is executed by a processor, the steps of the data processing method described above are implemented.
[0116] Among them, the method implemented when the data processing program is executed can refer to the various embodiments of the data processing method of the present application, and will not be repeated here.
[0117] It should be noted that the serial numbers of the above-mentioned embodiments of the present application are only for description and do not represent the advantages or disadvantages of the embodiments.
[0118] The terms "including" and "having" and any variations thereof in the specification and claims of this application and the above-mentioned drawings are intended to cover non-exclusive inclusions. For example, a process, method, system, product or device that includes a series of steps or units is not limited to the listed steps or units, but optionally includes steps or units that are not listed, or optionally includes other steps or units inherent to these processes, methods, products or devices. The terms "first", "second" and "third" are used to distinguish different objects, etc., and do not represent a sequence, nor do they limit "first", "second" and "third" to different types.
[0119] In the description of the embodiments of the present application, "exemplary", "for example" or "for example" are used to indicate examples, illustrations or descriptions. Any embodiment or design described as "exemplary", "for example" or "for example" in the embodiments of the present application should not be interpreted as being more preferred or more advantageous than other embodiments or designs. Specifically, the use of words such as "exemplary", "for example" or "for example" is intended to present related concepts in a specific way.
[0120] In the description of the embodiments of the present application, unless otherwise specified, “ / ” means or, for example, A / B can mean A or B; the “and / or” in the text is merely a description of the association relationship of associated objects, indicating that three relationships may exist, for example, A and / or B can mean: A exists alone, A and B exist at the same time, and B exists alone. In addition, in the description of the embodiments of the present application, “multiple” refers to two or more than two.
[0121] In some processes described in the embodiments of the present application, multiple operations or steps that appear in a specific order are included, but it should be understood that these operations or steps may not be executed in the order in which they appear in the embodiments of the present application or in parallel, and the sequence number of the operation is only used to distinguish the different operations, and the sequence number itself does not represent any execution order. In addition, these processes may include more or fewer operations, and these operations or steps may be executed in sequence or in parallel, and these operations or steps may be combined.
[0122] Through the description of the above implementation methods, those skilled in the art can clearly understand that the above-mentioned embodiment methods can be implemented by means of software plus a necessary general hardware platform, and of course by hardware, but in many cases the former is a better implementation method. Based on such an understanding, the technical solution of the present application is essentially or the part that contributes to the prior art can be embodied in the form of a software product, which is stored in a storage medium (such as ROM / RAM, disk, CD) as described above, and includes a number of instructions for a terminal device to execute the methods described in each embodiment of the present application.
[0123] The above are only preferred embodiments of the present application, and are not intended to limit the patent scope of the present application. Any equivalent structure or equivalent process transformation made using the contents of the present application specification and drawings, or directly or indirectly applied in other related technical fields, are also included in the patent protection scope of the present application.
Claims
1. A data processing method, characterized in that: The data processing method is applied to the transport layer module in the AutoSar architecture, and the data processing method includes: Determine a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas; Detecting whether there is a target sub-storage area in the target storage block, wherein the target sub-storage area is a sub-storage area where no data exists and the available storage space is sufficient to store the data to be cached; If the target sub-storage area exists in the target storage block, the data to be cached is stored in the target sub-storage area.
2. The data processing method according to claim 1, characterized in that: Determining the target storage block according to the source address and the destination address of the data to be cached includes: Determine a target transmission channel according to the source address and destination address of the data to be cached; A target storage block corresponding to the target transmission channel is determined based on the corresponding relationship between the transmission channel and the storage block.
3. The data processing method according to claim 1, characterized in that: The detecting whether there is a target sub-storage area in the target storage block comprises: Obtaining status flags of all sub-storage areas included in the target storage block, wherein when there is no data in the sub-storage area, the corresponding status flag is a first value, and when there is data in the sub-storage area, the corresponding status flag is a second value; If there is an optional sub-storage area whose status flag is the first value, detecting whether there is a target optional sub-storage area with available storage space sufficient to store the data to be cached; If there is a target optional sub-storage area with available storage space sufficient to store the data to be cached, any target optional sub-storage area is used as the target sub-storage area; If there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, determining that there is no target sub-storage area in the target storage block; If the status flags of all sub-storage areas are the second value, it is determined that no target sub-storage area exists in the target storage block.
4. The data processing method according to claim 3, characterized in that: After determining that there is no target sub-storage area in the target storage block if there is no target optional sub-storage area with available storage space sufficient to store the data to be cached, the method further includes: Selecting a sub-storage area from the optional sub-storage areas, increasing the available storage space of the selected sub-storage area so that the available storage space of the selected sub-storage area is sufficient to store the data to be cached, and using the selected sub-storage area as a target optional sub-storage area; Alternatively, a sub-storage area having available storage space sufficient to store the data to be cached is added to the target storage block, and the newly added sub-storage area is used as the target optional sub-storage area.
5. The data processing method according to claim 3, characterized in that: After determining that the target sub-storage area does not exist in the target storage block if the status flag bits of all sub-storage areas are the second value, the method further includes: A sub-storage area having available storage space sufficient to store the data to be cached is added to the target storage block, and the newly added sub-storage area is used as a target optional sub-storage area.
6. The data processing method according to claim 4, characterized in that: After the selected sub-storage area is used as the target optional sub-storage area, or after the newly added sub-storage area is used as the target optional sub-storage area, the method further includes: The data to be cached is stored in the target sub-storage area.
7. The data processing method according to claim 6, characterized in that: After storing the data to be cached in the target sub-storage area, the method further includes: Updating the status flag of the target sub-storage area to a second value; Read the data in the target sub-storage area and send it; After the sending is completed, the status flag bit of the target sub-storage area is updated to the first value.
8. A transport layer module in the AutoSar architecture, characterized in that: The transport layer module includes: A determination module, configured to determine a target storage block according to a source address and a destination address of the data to be cached, wherein the buffer includes a plurality of storage blocks, and a storage block includes one or more sub-storage areas; a detection module, configured to detect whether a target sub-storage area exists in the target storage block, wherein the target sub-storage area is a sub-storage area in which no data exists and the available storage space is sufficient to store the data to be cached; The storage module is configured to store the data to be cached in the target sub-storage area if the target sub-storage area exists in the target storage block.
9. A data processing device, characterized in that: The data processing device includes a processor, a memory, and a data processing program stored in the memory and executable by the processor, wherein when the data processing program is executed by the processor, the steps of the data processing method according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a data processing program, wherein when the data processing program is executed by a processor, the steps of the data processing method according to any one of claims 1 to 7 are implemented.