CN116112456A - BAP protocol-based data caching method, device, equipment and medium - Google Patents

BAP protocol-based data caching method, device, equipment and medium Download PDF

Info

Publication number
CN116112456A
CN116112456A CN202310115568.7A CN202310115568A CN116112456A CN 116112456 A CN116112456 A CN 116112456A CN 202310115568 A CN202310115568 A CN 202310115568A CN 116112456 A CN116112456 A CN 116112456A
Authority
CN
China
Prior art keywords
data
transmitted
chip
length
frame
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202310115568.7A
Other languages
Chinese (zh)
Other versions
CN116112456B (en
Inventor
李浦
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Mgjia Beijing Technology Co ltd
Original Assignee
Mgjia Beijing Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Mgjia Beijing Technology Co ltd filed Critical Mgjia Beijing Technology Co ltd
Priority to CN202310115568.7A priority Critical patent/CN116112456B/en
Publication of CN116112456A publication Critical patent/CN116112456A/en
Application granted granted Critical
Publication of CN116112456B publication Critical patent/CN116112456B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9005Buffering arrangements using dynamic buffer space allocation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L49/00Packet switching elements
    • H04L49/90Buffering arrangements
    • H04L49/9026Single buffer per packet

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Communication Control (AREA)
  • Data Exchanges In Wide-Area Networks (AREA)

Abstract

The invention discloses a data caching method, a device, equipment and a medium based on a BAP protocol, wherein the method comprises the following steps: receiving data to be transmitted; reading data information of data to be transmitted; judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information; when the transmission mode is multi-frame transmission, reading the total length of data, the data ID and the transmission channel number from the data information; screening a target buffer area from the idle buffer area based on the total length of the data, and storing the data to be transmitted in the target buffer area; by adopting the data caching method provided by the scheme, the situation that the space is too small to be enough can not occur. And, because the current receivable data length of the target buffer area is the closest to the total data length in all the idle buffer areas, excessive waste of the buffer areas can not occur, thereby ensuring the rationality of the allocation of the buffer areas.

Description

BAP protocol-based data caching method, device, equipment and medium
Technical Field
The present invention relates to the field of communications technologies, and in particular, to a method, an apparatus, a device, and a medium for caching data based on a BAP protocol.
Background
In the data transmission process, different data protocols may be executed at the transmitting and receiving ends of the data, in this case, the received data needs to be parsed first, and after all the data is stored in the buffer area, the data is applied.
However, in the related art, when data is stored in the buffer area, the buffer area is randomly allocated to the data, and the allocation manner may lead to unreasonable space allocation, so that part of the buffer area is insufficient due to too small space, or part of the buffer area is wasted due to too large space.
Therefore, how to reasonably allocate the buffer area becomes a problem to be solved.
Disclosure of Invention
Therefore, the technical problem to be solved by the invention is to overcome the defect of unreasonable allocation of the buffer area in the prior art, thereby providing a data buffer method, device, equipment and medium based on BAP protocol.
In a first aspect, the present invention provides a BAP protocol-based data caching method, including:
receiving data to be transmitted; reading data information of data to be transmitted; judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information; when the transmission mode is multi-frame transmission, reading the total length of data, the data ID and the transmission channel number from the data information; and screening a target cache region from the idle cache regions based on the total length of the data client case numbers, and storing data to be transmitted in the target cache region, wherein the current containable data length of the target cache region is larger than or equal to the total length of the data, and when the current containable data length of the target cache region is larger than the total length of the data, the difference value between the current containable data length of the target cache region and the total length of the data is the minimum value in the difference value between the containable data length of each idle cache region and the total length of the data in the idle cache region, and the target cache region is used for storing all data to be transmitted, which carry the data ID and the transmission channel number.
After the data to be transmitted is obtained, the invention judges whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not according to the read data information of the data to be transmitted. When the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission, the data cannot be directly transmitted, the total length of the data is required to be read from the data information of the data to be transmitted, then the target buffer area which can currently accommodate the data with the closest total data length is screened out from the existing idle buffer area according to the total length of the data, and then the data to be transmitted is stored in the screened target buffer area. The target buffer zone found by the method is the buffer zone which is most suitable for the total length of the current data under the current condition, so that the situation that the space is too small to be enough cannot occur by adopting the data buffer method provided by the scheme. And, because the current receivable data length of the target buffer area is the closest to the total data length in all the idle buffer areas, excessive waste of the buffer areas can not occur, thereby ensuring the rationality of the allocation of the buffer areas.
With reference to the first aspect, in a first embodiment of the first aspect, after receiving data to be transmitted, the method further includes:
and judging the data type of the data to be transmitted based on the data source of the data to be transmitted so as to read the data information corresponding to the data type from the data to be transmitted based on the data type, wherein the data type comprises bus data and chip data.
Client case number
With reference to the first aspect, in a second embodiment of the first aspect, when determining that the data to be transmitted is chip data, determining, based on the data information, whether a transmission mode of a data packet to which the data to be transmitted belongs is multi-frame transmission includes:
reading the total length of data corresponding to the chip data from the data information corresponding to the chip data; comparing the total length of the data corresponding to the chip data with the preset data length, and determining that the transmission mode of the data packet to which the chip data belongs is multi-frame transmission when the total length of the data is larger than the preset data length.
With reference to the first aspect, in a third embodiment of the first aspect, when determining that the data to be transmitted is chip data, after determining that the transmission mode is multi-frame transmission, the method further includes:
and allocating a transmission channel number for the chip data.
With reference to the first aspect, in a fourth embodiment of the first aspect, when determining that the data to be transmitted is chip data, after reading the total length of data, the data ID, and the transmission channel number from the data information of the data to be transmitted, the method further includes:
splitting the chip data into at least two frames of chip sub-data based on the total data length corresponding to the chip data and the preset data length, and determining the splitting sequence of the chip sub-data; configuring a flag value and a serial number for each frame of chip sub-data based on the splitting sequence of each frame of chip sub-data, wherein the flag value is used for indicating the frame attribute of the chip sub-data, the frame attribute comprises a starting frame and a process frame, and the serial number is used for indicating the sequence among the chip sub-data; taking the data ID corresponding to the chip data as the data ID of each frame of chip sub-data, and taking the transmission channel number corresponding to the chip data as the transmission channel number of each frame of chip sub-data.
With reference to the first aspect, in a fifth embodiment of the first aspect, when determining that the data to be transmitted is bus data, the data information further includes a first flag value, and determining, based on the data information, whether a transmission mode of a data packet to which the data to be transmitted belongs is multi-frame transmission includes:
client case number
Reading a first flag value on a first flag bit of bus data; it is determined whether the bus data is a multi-frame transmission based on the first flag value.
With reference to the first aspect, in a sixth embodiment of the first aspect, when determining that the data to be transmitted is bus data, the data information further includes a second flag value, and after determining that the transmission mode is multi-frame transmission, the method further includes:
reading a second flag value on a second flag bit of the bus data; determining whether the bus data is start frame data based on the second flag value; when it is determined that the bus data is the start frame data, the total length of the data, the data ID, and the transmission channel number are read from the data information.
In a second aspect, the present invention provides a BAP protocol-based data caching apparatus, including:
the receiving module is used for receiving data to be transmitted; the first reading module is used for reading data information of data to be transmitted; the first judging module is used for judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information; the second reading module is used for reading the total length of data, the data ID and the transmission channel number from the data information when the transmission mode is multi-frame transmission; the screening module is used for screening out a target cache area from the idle cache areas based on the total length of data, and storing the data to be transmitted in the target cache area, wherein the current receivable data length of the target cache area is larger than or equal to the total length of the data, and when the current receivable data length of the target cache area is larger than the total length of the data, the difference value between the current receivable data length of the target cache area and the total length of the data is the minimum value in the difference value between the receivable data length of each idle cache area and the total length of the data in the idle cache area, and the target cache area is used for storing all the data to be transmitted, which carry the data ID and the transmission channel number.
In a third aspect, the present invention provides a computer device comprising: the system comprises a memory and a processor, wherein the memory and the processor are in communication connection, the memory is used for storing a computer program, and the computer client case number program is executed by the processor to enable the processor to execute the BAP protocol-based data caching method according to any one of the invention.
In a fourth aspect, the present invention provides a computer readable storage medium for storing computer instructions which, when executed by a processor, implement a BAP protocol based data caching method as in any one of the summary.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings that are needed in the description of the embodiments or the prior art will be briefly described, and it is obvious that the drawings in the description below are some embodiments of the present invention, and other drawings can be obtained according to the drawings without inventive effort for a person skilled in the art.
Fig. 1 is a flowchart of a BAP protocol-based data caching method according to an embodiment of the present invention;
fig. 2 is a flowchart of a BAP protocol-based data caching method corresponding to when data to be transmitted is chip data according to an embodiment of the present invention;
fig. 3 is a flowchart of a data caching method based on BAP protocol corresponding to the case where data to be transmitted is bus data according to an embodiment of the present invention;
fig. 4 is a connection diagram of a BAP protocol-based data caching apparatus according to an embodiment of the present invention;
fig. 5 is a connection diagram of a computer device according to an embodiment of the present invention.
Detailed Description
The technical scheme of the invention will be clearly and completely described below with reference to the accompanying drawings, and the number of the clients is obvious
The described embodiments are some, but not all, embodiments of the invention. All other embodiments, which can be made by those skilled in the art based on the embodiments of the invention without making any inventive effort, are intended to be within the scope of the invention.
The invention discloses a data caching method based on BAP protocol, as shown in figure 1, the method comprises the following steps:
step S11: and receiving data to be transmitted.
Illustratively, the method is applicable to a system for resolving mass automotive platforms CAN (Controller Area Network, control area network) -BAP (Bandwidth Allocation Protocol ), the data to be transmitted being received by the MCU (Microcontroller Unit, micro control unit). After receiving the data to be transmitted, the MCU can judge the data type of the data to be transmitted based on the data source of the data to be transmitted so as to read the data information corresponding to the data type from the data to be transmitted based on the data type. When the data to be transmitted is derived from a bus, the corresponding data type is bus data; when the data to be transmitted is sourced from the chip, the corresponding data type is the chip data.
Step S12: and reading data information of the data to be transmitted.
Specifically, the data information is information carried in the data to be transmitted, and the data information read here is part of all the data information carried in the data to be transmitted. And the read data information corresponds to the data type of the data to be transmitted.
For example, when the data to be transmitted is bus data, the data information to be read is a first flag value on a first flag bit of the bus data; when the data to be transmitted is chip data, the data information to be read is the total length of the chip data.
Client case number
Step S13: and judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information.
Specifically, the transmission mode includes single-frame transmission and multi-frame transmission, wherein the single-frame transmission refers to that one data packet is transmitted in a single-frame data form, and the multi-frame transmission refers to that one data packet is divided into a plurality of frames of data for transmission. Therefore, after receiving the data to be transmitted, it is necessary to determine whether the data to be transmitted is a data packet or is only one frame of data in the data packet.
When the data to be transmitted is the bus data, judging whether the transmission mode of the data packet to which the bus data belongs is multi-frame transmission or not based on a first flag value on the first flag bit; when the data to be transmitted is chip data, judging whether the transmission mode of the data packet to which the chip data belongs is multi-frame transmission or not based on the total length of the data.
Step S14: when the transmission mode is determined to be multi-frame transmission, the total length of data, the data ID and the transmission channel number are read from the data information.
For example, when the data to be transmitted is bus data and the transmission mode of the data packet to which the bus data belongs is determined to be multi-frame transmission, the total length of the data, the data ID and the transmission channel number are read from the data information of the bus data. The total data length is the data length corresponding to the data packet to which the bus data belongs, and the total data length can be stored in each frame of bus data contained in the data packet.
For example, when the data to be transmitted is chip data and the transmission mode of the data packet to which the chip data belongs is determined to be multi-frame transmission, the total length of the data, the data ID and the transmission channel number are directly read from the data information corresponding to the chip data.
Step S15: screening target buffer area from idle buffer area based on total length of data, and setting number of clients
The data to be transmitted is stored in the target buffer area.
Specifically, the current allowable data length of the target buffer area is greater than or equal to the total data length, and when the current allowable data length of the target buffer area is greater than the total data length, the difference between the current allowable data length of the target buffer area and the total data length is the minimum value of the difference between the allowable data length of each free buffer area and the total data length. The target buffer area is used for storing all data to be transmitted, which carries a data ID and a transmission channel number, and because the data ID and the transmission channel carried by each frame of data are the same in the multi-frame data contained in one data packet, it can be understood that the target buffer area corresponds to the data packet to which the data to be transmitted belongs one by one, that is, one target buffer area is only used for storing all frame data contained in one data packet.
After the data to be transmitted is obtained, the invention judges whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not according to the read data information of the data to be transmitted. When the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission, the data cannot be directly transmitted, the total length of the data is required to be read from the data information of the data to be transmitted, then the target buffer area which can currently accommodate the data with the closest total data length is screened out from the existing idle buffer area according to the total length of the data, and then the data to be transmitted is stored in the screened target buffer area. The target buffer zone found by the method is the buffer zone which is most suitable for the total length of the current data under the current condition, so that the situation that the space is too small to be enough cannot occur by adopting the data buffer method provided by the scheme. And, because the current receivable data length of the target buffer area is the closest to the total data length in all the idle buffer areas, excessive waste of the buffer areas can not occur, thereby ensuring the rationality of the allocation of the buffer areas.
In an alternative embodiment, when the data to be transmitted is determined to be chip data, the case number is customized based on the data information
Judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not, comprising the following steps:
step S21: and reading the total length of the data corresponding to the chip data from the data information corresponding to the chip data.
Specifically, the data information corresponding to the chip data includes a chip data ID, a total length of the chip data, and a data segment, where the chip data ID is an ID allocated to the system when the chip data is generated, the total length of the chip data is determined by a chip data occupying byte, and the data segment is specific data content carried by the chip data.
For example, when the data to be transmitted is determined to be chip data according to the data source of the data to be transmitted, the chip data may be directly used as one data packet. The total length of data (i.e., data information) is read from the data information corresponding to the chip data, and in this embodiment, the total length of data corresponding to the chip data is 13 bytes.
Step S22: comparing the total length of the data corresponding to the chip data with the preset data length, and determining that the transmission mode of the data packet to which the chip data belongs is multi-frame transmission when the total length of the data is larger than the preset data length.
The preset data length is illustratively the data length of one frame of data set during transmission, and in this embodiment, the preset data length is 6 bytes. Comparing the total length of the data corresponding to the chip data with the preset data length, wherein the total length of the data 13 bytes of the chip data is greater than the preset data length 6 bytes, and indicating that the chip data needs to be divided into multi-frame data for transmission.
In another alternative embodiment, the total length of the data corresponding to the chip data is 5 bytes, the preset data length is 6 bytes, and at this time, the total length of the data of the chip data is smaller than the preset data client number length, which indicates that the chip data can be directly transmitted in a single frame form without framing, and then the chip data is directly sent to the bus.
In an alternative embodiment, when determining that the data to be transmitted is chip data, after determining that the transmission mode is multi-frame transmission, the method further includes:
and allocating a transmission channel number for the chip data.
When the transmission data is determined to be chip data and the transmission mode of the chip data is multi-frame transmission, a transmission channel number is allocated to the chip data, the transmission channel number is a number corresponding to a data transmission channel, and when the transmission channel number is allocated, each frame of data included in the chip data is transmitted from a channel corresponding to the transmission channel number when the data transmission is started subsequently.
In an alternative embodiment, when determining that the data to be transmitted is chip data, after reading the total length of the data, the data ID and the transmission channel number from the data information of the data to be transmitted, the method further includes the steps of:
s31: based on the total data length and the preset data length corresponding to the chip data, splitting the chip data into at least two frames of chip sub-data, and determining the splitting sequence of the chip sub-data.
In this embodiment, the total length of data corresponding to the chip data is 15 bytes, and the preset data length is 6 bytes, so that the chip data needs to be split into 3 frames of chip sub-data according to the rounding principle. And determining the splitting sequence of the chip sub-data while splitting.
S32: and configuring a mark value and a serial number for each frame of chip sub-data based on the splitting sequence of each frame of chip sub-data.
Client case number
Specifically, the flag value is used to indicate the frame attribute of the chip sub-data, the frame attribute includes a start frame and a process frame, and the serial number is used to indicate the sequence between the chip sub-data.
For example, taking the embodiment corresponding to S31 as an example, after splitting the chip data into 3 frames of chip sub-data, the frame attribute corresponding to the first frame in the 3 frames is the start frame, and the frame attributes corresponding to the second frame and the third frame are the process frames. Therefore, a flag value corresponding to the start frame needs to be configured in the first frame chip sub-data, for example, 10, wherein 1 on the first bit represents multi-frame transmission, and 0 on the second bit represents the start frame; a flag value corresponding to a process frame, such as 11, is configured in the second frame chip sub-data and the third frame chip sub-data, with 1 on the first bit representing a multi-frame transmission and 1 on the second bit representing a start frame.
Meanwhile, a serial number is configured for each frame of chip sub-data according to the splitting sequence of the 3 frames of chip sub-data, for example, a serial number x1 is configured for the first frame of chip sub-data, a serial number x2 is configured for the second frame of chip sub-data, and a serial number x3 is configured for the third frame of chip sub-data. In the scheme, the form of the serial number is not particularly limited, and the serial number can be configured according to an actual application scene.
S33: taking the data ID corresponding to the chip data as the data ID of each frame of chip sub-data, and taking the transmission channel number corresponding to the chip data as the transmission channel number of each frame of chip sub-data.
Illustratively, after the information configuration is finished, the data information carried in the sub-data of each frame of chip includes: the data ID, the transmission channel number, the flag value, the serial number and the sub-data segment, wherein the sub-data segment comprises the total data length of the chip data. After S33, the target buffer area is selected from the idle buffer areas according to the total length of the chip data, and each frame of chip sub-data split from the chip data is stored in the target buffer area.
Illustratively, in another alternative embodiment, when the data to be transmitted is chip data, and will be encoded by the client case number
After each frame of chip sub-data split by the chip data is stored in the target buffer area, the method further comprises the following steps:
and polling the target cache area in a timing way, and when the time corresponding to the target cache area reaches the target sending time, sending the chip sub-data corresponding to the target sending time to the bus according to the serial number of the chip sub-data. And when the corresponding time of the polling to the target buffer area does not reach the target sending time, waiting for reaching the target sending time and then sending the data. The target sending time is a corresponding time after a preset time period by taking the sending time of the sub-data of the chip of the previous frame as the starting time.
After chip sub-data corresponding to the target sending moment is sent to a bus, judging whether a target cache area is empty or not, and releasing the target cache area when the target cache area is empty; and when the target buffer area is not empty, continuing to wait for the next target sending moment to finish sending the chip sub-data. The method for judging whether the target buffer area is empty may be to compare the actual receivable data length of the target buffer area with the target receivable data length at the current moment, and when the actual receivable data length is consistent with the target receivable data length, the target buffer area is considered to be empty, otherwise, the target buffer area is not empty. The manner of determining whether the specific target buffer is empty is not specifically limited herein.
When the data to be transmitted is chip data, please refer to fig. 2 for a complete flow from receiving the chip data to completing the chip data transmission and releasing the buffer.
In an alternative embodiment, when determining that the data to be transmitted is bus data, the data information further includes a first flag value, and determining, based on the data information, whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission includes:
reading a first flag value on a first flag bit of bus data; it is determined whether the bus data is a multi-frame transmission based on the first flag value.
Client case number
The data information corresponding to the bus data includes a bus data ID, a first flag value, a second flag value, and a data segment, where the bus data ID is an ID that is allocated by the system when generating the bus data, the first flag value and the second flag value are flag values that are allocated by the system before receiving the bus data, where the first flag value is used to indicate a transmission mode of a data packet to which the bus data belongs, the second flag value is used to indicate a frame attribute of the bus data, and the data segment is a specific data content carried by the bus data, and includes information such as a transmission channel number, a device ID, a function ID, a serial number, and a total length of data.
When data to be transmitted is received, and the data to be transmitted is determined to be bus data based on a data source, a first flag value on a first flag bit of the bus data is read, and when the first flag value is 1, the transmission mode of a data packet to which the bus data belongs is multi-frame transmission. When the first flag value is 0, it indicates that the transmission mode of the data packet to which the bus data belongs is single frame transmission, and at this time, the bus data can be directly analyzed by using BAP (Bandwidth Allocation Protocol ), and the analyzed bus data is sent to SOC (System on Chip).
In an alternative embodiment, when determining that the data to be transmitted is bus data, the data information further includes a second flag value, and after determining that the transmission mode is multi-frame transmission, the method further includes the following steps:
s41: and reading a second flag value on a second flag bit of the bus data.
For example, when it is determined that the transmission mode of the data packet to which the bus data belongs is multi-frame transmission, a second flag value on a second flag bit of the bus data is read.
S42: it is determined whether the bus data is start frame data based on the second flag value.
Illustratively, when the second flag value is 0, it indicates that the current bus data is the start frame data of the client table number in the belonging packet; when the second flag value is 1, it indicates that the current bus data is the process frame data in the belonging data packet.
S43: when it is determined that the bus data is the start frame data, the total length of the data, the data ID, and the transmission channel number are read from the data information.
When the bus data is determined to be the initial frame data, the data ID is read from the data information, the data segment in the data information is parsed by using the BAP protocol, and the total length of the data and the transmission channel number are obtained after the parsing. In this embodiment, the total length of data is stored only in the start frame data, so when the data to be transmitted is determined to be the start frame data, the total length of data can be read from the data information of the frame bus data.
After S43, a target buffer area may be selected from the idle buffer areas according to the total length of the data, and the bus data is stored in the target buffer area, where the target buffer area is used to store each frame of bus data included in a data packet to which the bus data belongs, and includes a start frame data and a plurality of process frame data, where a plurality of bus data included in a same data packet have a same data ID and a same transmission channel number.
Illustratively, when the bus data is determined to be process frame data, the data ID is read from the data information and the data segment in the data information is parsed using the BAP protocol to obtain the transmission channel number. Then, based on the data ID and the transmission channel number, a corresponding target buffer area is searched from the occupied buffer areas, after the target buffer area is searched, the bus data is directly stored in the target buffer area, and all the stored data are combined according to the serial numbers in the bus data.
After the bus data is stored in the target buffer area, the actual data client case number length corresponding to all data stored in the current target buffer area is calculated according to the data length of each frame of bus data stored in the target buffer area. And comparing the actual data length with the total length of the data carried in the initial frame data.
When the actual data length is smaller than the total data length, other bus data exist in the data packet corresponding to the target buffer area, so that the transmission data needs to be continuously received; when the actual data length is equal to the total length of the data, it means that all bus data in the data packet corresponding to the target buffer area are received, at this time, all the bus data in the target buffer area can be packed, and the packed bus data is stored in the packing area, and at the same time, the target buffer area is released.
In another alternative embodiment, after storing the packed bus data in the packing area, the method further includes:
the packing area is polled at fixed time, and the total length of the stored data of the packing area is obtained. And when the total length of the data in the packaging area reaches a preset storage threshold, all the data in the packaging area are sent to the chip. The preset storage threshold may be a specific proportion of the total length of the data that the packing area can accommodate.
When the data to be transmitted is bus data, please refer to fig. 3 for a complete flow from receiving the chip data to completing the bus data transmission and then releasing the buffer.
The invention discloses a data caching device based on BAP protocol, as shown in figure 4, comprising the following modules:
a receiving module 41, configured to receive data to be transmitted.
The first reading module 42 is configured to read data information of the data to be transmitted.
The first determining module 43 is configured to determine, based on the data information, whether a transmission mode of a data packet to which the data to be transmitted belongs is multi-frame transmission.
A second reading module 44 for, when the transmission mode is determined to be multi-frame transmission, obtaining the client number from the data information
The total length of the data, the data ID, and the transmission channel number are read.
The screening module 45 is configured to screen a target buffer area from the idle buffer areas based on a total length of data, and store data to be transmitted in the target buffer areas, where a current receivable data length of the target buffer area is greater than or equal to the total length of data, and when the current receivable data length of the target buffer area is greater than the total length of data, a difference between the current receivable data length of the target buffer area and the total length of data is a minimum value of differences between the receivable data length and the total length of data of each idle buffer area in the idle buffer areas, and the target buffer area is configured to store all data to be transmitted, which carries a data ID and a transmission channel number.
In an alternative embodiment, after the receiving module 41, further comprises:
the second judging module is used for judging the data type of the data to be transmitted based on the data source of the data to be transmitted so as to read the data information corresponding to the data type from the data to be transmitted based on the data type, wherein the data type comprises bus data and chip data.
In an alternative embodiment, when determining that the data to be transmitted is chip data, the first determining module 43 includes:
the reading sub-module is used for reading the total length of the data corresponding to the chip data from the data information corresponding to the chip data; and the comparison sub-module is used for comparing the total length of data corresponding to the chip data with the preset data length, and determining that the transmission mode of the data packet to which the chip data belongs is multi-frame transmission when the total length of the data is larger than the preset data length.
In an alternative embodiment, when it is determined that the data to be transmitted is chip data, after the second reading module 44, it further includes:
client case number
And the distribution module is used for distributing the transmission channel number for the chip data.
In an alternative embodiment, when it is determined that the data to be transmitted is chip data, after the second reading module 44, it further includes:
the splitting module is used for splitting the chip data into at least two frames of chip sub-data based on the total length of the data corresponding to the chip data and the preset data length, and determining the splitting sequence of the chip sub-data; the configuration module is used for configuring a mark value and a serial number for each frame of chip sub-data based on the splitting sequence of each frame of chip sub-data, wherein the mark value is used for indicating the frame attribute of the chip sub-data, the frame attribute comprises a starting frame and a process frame, and the serial number is used for indicating the sequence among the chip sub-data; the determining module is used for taking the data ID corresponding to the chip data as the data ID of the chip sub-data of each frame and taking the transmission channel number corresponding to the chip data as the transmission channel number of the chip sub-data of each frame.
In an alternative embodiment, when determining that the data to be transmitted is bus data, the data information further includes a first flag value, and the first determining module 43 includes:
the reading submodule is used for reading a first mark value on a first mark bit of the bus data; a determining sub-module for determining whether the bus data is a multi-frame transmission based on the first flag value.
In an alternative embodiment, when it is determined that the data to be transmitted is bus data, the data information further includes a second flag value, and after the second reading module 44, further includes:
the first reading module is used for reading a second mark value on a second mark bit of the bus data; a determining module, configured to determine whether the bus data is start frame data based on the second flag value; and a second reading module for reading the total length of data, the data ID and the transmission channel number from the data information when the bus data is determined to be the start frame data.
Client case number
The present embodiment provides a computer device, as shown in fig. 5, which may include at least one processor 51, at least one communication interface 52, at least one communication bus 53 and at least one memory 54, where the communication interface 52 may include a Display, a Keyboard (Keyboard), and the optional communication interface 52 may further include a standard wired interface, a wireless interface. The memory 54 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 54 may alternatively be at least one memory device located remotely from the aforementioned processor 51. Wherein the processor 51 may store an application program in the memory 54 in conjunction with the apparatus described in fig. 5, and the processor 51 invokes the program code stored in the memory 54 for performing the BAP protocol based data caching method of any of the method embodiments described above.
The communication bus 53 may be a peripheral component interconnect standard (peripheral component interconnect, PCI) bus, an extended industry standard architecture (extended industry standard architecture, EISA) bus, or the like. The communication bus 53 may be classified into an address bus, a data bus, a control bus, and the like. For ease of illustration, only one thick line is shown in fig. 5, but not only one bus or one type of bus.
Wherein the memory 54 may include volatile memory (english) such as random-access memory (RAM); the memory may also include a nonvolatile memory (english: non-volatile memory), such as a flash memory (english: flash memory), a hard disk (english: hard disk drive, abbreviated as HDD) or a solid state disk (english: solid-state drive, abbreviated as SSD); memory 54 may also include a combination of the types of memory described above.
Client case number
The processor 51 may be a central processor (English: central processing unit, abbreviated: CPU), a network processor (English: network processor, abbreviated: NP) or a combination of CPU and NP.
The processor 51 may further include a hardware chip, among others. The hardware chip may be an application-specific integrated circuit (ASIC), a Programmable Logic Device (PLD), or a combination thereof (English: programmable logic device). The PLD may be a complex programmable logic device (English: complex programmable logic device, abbreviated: CPLD), a field programmable gate array (English: field-programmable gate array, abbreviated: FPGA), a general-purpose array logic (English: generic array logic, abbreviated: GAL), or any combination thereof. Optionally, the memory 54 is also used for storing program instructions. Processor 51 may invoke program instructions to implement the BAP protocol based data caching method in any of the embodiments of the present invention.
The present embodiment provides a computer-readable storage medium storing computer-executable instructions that can perform the BAP protocol-based data caching method in any of the above method embodiments. The storage medium may be a magnetic Disk, an optical Disk, a Read-Only Memory (ROM), a random access Memory (Random Access Memory, RAM), a Flash Memory (Flash Memory), a Hard Disk (HDD), or a Solid State Drive (SSD); the storage medium may also comprise a combination of memories of the kind described above.
It is apparent that the above examples are given by way of illustration only and are not limiting of the embodiments. It will be apparent to those skilled in the art from this disclosure that the case number may be given
To make other variations or modifications in various forms. It is not necessary here nor is it exhaustive of all embodiments. While still being apparent from variations or modifications that may be made by those skilled in the art are within the scope of the invention.

Claims (10)

1. A BAP protocol-based data caching method, comprising:
receiving data to be transmitted;
reading data information of the data to be transmitted;
judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information;
when the transmission mode is multi-frame transmission, reading the total length of data, the data ID and the transmission channel number from the data information;
and screening a target cache region from the idle cache regions based on the total data length, and storing the data to be transmitted in the target cache region, wherein the current receivable data length of the target cache region is larger than or equal to the total data length, and when the current receivable data length of the target cache region is larger than the total data length, the difference value between the current receivable data length of the target cache region and the total data length is the minimum value of the difference value between the receivable data length of each idle cache region and the total data length in the idle cache region, and the target cache region is used for storing all the data to be transmitted carrying the data ID and the transmission channel number.
2. The BAP protocol based data caching method of claim 1, further comprising, after the receiving the data to be transmitted:
and judging the data type of the data to be transmitted based on the data source of the data to be transmitted so as to read the data information corresponding to the data type from the data to be transmitted based on the data type, wherein the data type comprises bus data and chip data.
3. The BAP protocol-based data buffering method of claim 2, wherein when determining that the data to be transmitted is chip data, determining, based on the data information, whether a transmission mode of a data packet to which the data to be transmitted belongs is multi-frame transmission includes:
reading the total length of data corresponding to the chip data from the data information corresponding to the chip data;
comparing the total length of the data corresponding to the chip data with a preset data length, and determining that the transmission mode of the data packet to which the chip data belongs is multi-frame transmission when the total length of the data is larger than the preset data length.
4. The BAP protocol-based data buffering method of claim 3, wherein when the data to be transmitted is determined to be chip data, after determining that the transmission mode is multi-frame transmission, further comprising:
and allocating a transmission channel number for the chip data.
5. The BAP protocol-based data buffering method of claim 4, wherein when the data to be transmitted is determined to be chip data, after the reading of the total length of data, the data ID, and the transmission channel number from the data information of the data to be transmitted, further comprising:
splitting the chip data into at least two frames of chip sub-data based on the total length of the data corresponding to the chip data and the preset data length, and determining the splitting sequence of the chip sub-data;
configuring a mark value and a sequence number for each frame of the chip sub-data based on the splitting sequence of the chip sub-data, wherein the mark value is used for indicating the frame attribute of the chip sub-data, the frame attribute comprises a starting frame and a process frame, and the sequence number is used for indicating the sequence between the chip sub-data;
and taking the data ID corresponding to the chip data as the data ID of the chip sub-data of each frame, and taking the transmission channel number corresponding to the chip data as the transmission channel number of the chip sub-data of each frame.
6. The BAP protocol-based data buffering method of claim 2, wherein when the data to be transmitted is determined to be bus data, the data information further includes a first flag value, and the determining, based on the data information, whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission includes:
reading a first flag value on a first flag bit of the bus data;
determining whether the bus data is a multi-frame transmission based on the first flag value.
7. The BAP protocol-based data buffering method of claim 6, wherein when the data to be transmitted is determined to be bus data, the data information further includes a second flag value, and further comprising, after the determining that the transmission mode is multi-frame transmission:
reading a second flag value on a second flag bit of the bus data;
determining whether the bus data is start frame data based on the second flag value;
when the bus data is determined to be the start frame data, the total length of data, the data ID and the transmission channel number are read from the data information.
8. A BAP protocol-based data caching apparatus, comprising:
the receiving module is used for receiving data to be transmitted;
the first reading module is used for reading the data information of the data to be transmitted;
the first judging module is used for judging whether the transmission mode of the data packet to which the data to be transmitted belongs is multi-frame transmission or not based on the data information;
the second reading module is used for reading the total length of data, the data ID and the transmission channel number from the data information when the transmission mode is determined to be multi-frame transmission;
and the screening module is used for screening a target cache area from the idle cache areas based on the total length of the data, storing the data to be transmitted in the target cache area, wherein the current receivable data length of the target cache area is larger than or equal to the total length of the data, and when the current receivable data length of the target cache area is larger than the total length of the data, the difference value between the current receivable data length of the target cache area and the total length of the data is the minimum value in the difference value between the receivable data length of each idle cache area and the total length of the data in the idle cache area, and the target cache area is used for storing all the data to be transmitted, which carry the data ID and the transmission channel number.
9. A computer device, comprising: memory and processor, said memory and said processor being communicatively connected to each other, said memory being configured to store a computer program, said computer program, when executed by said processor, causing said processor to perform a BAP protocol based data caching method according to any one of claims 1 to 7.
10. A computer readable storage medium for storing computer instructions which, when executed by a processor, implement a BAP protocol based data caching method as claimed in any one of claims 1 to 7.
CN202310115568.7A 2023-02-01 2023-02-01 BAP protocol-based data caching method, device, equipment and medium Active CN116112456B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202310115568.7A CN116112456B (en) 2023-02-01 2023-02-01 BAP protocol-based data caching method, device, equipment and medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202310115568.7A CN116112456B (en) 2023-02-01 2023-02-01 BAP protocol-based data caching method, device, equipment and medium

Publications (2)

Publication Number Publication Date
CN116112456A true CN116112456A (en) 2023-05-12
CN116112456B CN116112456B (en) 2024-02-13

Family

ID=86255855

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202310115568.7A Active CN116112456B (en) 2023-02-01 2023-02-01 BAP protocol-based data caching method, device, equipment and medium

Country Status (1)

Country Link
CN (1) CN116112456B (en)

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010043575A1 (en) * 2000-04-14 2001-11-22 Frank Kelly System and method for providing a two-way satellite system
CN107948094A (en) * 2017-10-20 2018-04-20 西安电子科技大学 A kind of high speed data frame Lothrus apterus is joined the team the device and method of processing
CN110149803A (en) * 2018-08-27 2019-08-20 深圳市锐明技术股份有限公司 Date storage method, system and terminal device
CN114896189A (en) * 2022-05-07 2022-08-12 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Cache method, device, equipment and storage medium of high-speed bus data
CN115087029A (en) * 2021-03-12 2022-09-20 维沃移动通信有限公司 Data unit processing method, device, node and storage medium
CN115334175A (en) * 2022-09-13 2022-11-11 浙江正泰物联技术有限公司 Multi-protocol self-adaptive analysis method, internet of things metering device, equipment and medium
CN115412498A (en) * 2021-05-11 2022-11-29 华为技术有限公司 Communication method and device
CN115529662A (en) * 2021-06-24 2022-12-27 华为技术有限公司 Communication method and device
CN116250256A (en) * 2020-07-30 2023-06-09 华为技术有限公司 Method for multicast communication, first network device and second network device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20010043575A1 (en) * 2000-04-14 2001-11-22 Frank Kelly System and method for providing a two-way satellite system
CN107948094A (en) * 2017-10-20 2018-04-20 西安电子科技大学 A kind of high speed data frame Lothrus apterus is joined the team the device and method of processing
CN110149803A (en) * 2018-08-27 2019-08-20 深圳市锐明技术股份有限公司 Date storage method, system and terminal device
CN116250256A (en) * 2020-07-30 2023-06-09 华为技术有限公司 Method for multicast communication, first network device and second network device
CN115087029A (en) * 2021-03-12 2022-09-20 维沃移动通信有限公司 Data unit processing method, device, node and storage medium
CN115412498A (en) * 2021-05-11 2022-11-29 华为技术有限公司 Communication method and device
CN115529662A (en) * 2021-06-24 2022-12-27 华为技术有限公司 Communication method and device
CN114896189A (en) * 2022-05-07 2022-08-12 武汉船舶通信研究所(中国船舶重工集团公司第七二二研究所) Cache method, device, equipment and storage medium of high-speed bus data
CN115334175A (en) * 2022-09-13 2022-11-11 浙江正泰物联技术有限公司 Multi-protocol self-adaptive analysis method, internet of things metering device, equipment and medium

Also Published As

Publication number Publication date
CN116112456B (en) 2024-02-13

Similar Documents

Publication Publication Date Title
CN111147564B (en) Data file transmission method, system and communication terminal
CN106951388B (en) PCIe-based DMA data transmission method and system
CN108737296B (en) Data transmission method, device and network equipment
CN105450785B (en) File transmission method and device
US10314096B2 (en) Data transmission method, data transmission apparatus, processor, and mobile terminal
US20200382597A1 (en) Vehicle diagnostic communication apparatus, system including the same and method thereof
US11734077B2 (en) Evaluation device, evaluation method and evaluation program
CN111490947A (en) Data packet transmitting method, data packet receiving method, system, device and medium
CN113254375A (en) Data transmission method and device, electronic equipment and storage medium
US20240275740A1 (en) RDMA Data Transmission System, RDMA Data Transmission Method, and Network Device
US11509428B2 (en) Data transmission method and apparatus having data reuse mechanism
CN106445353A (en) Display method and device of super-large pictures and electronic equipment
CN116112456B (en) BAP protocol-based data caching method, device, equipment and medium
US20160085683A1 (en) Data receiving device and data receiving method
CN116225999B (en) DMA data transmission method and system
CN111651282B (en) Message processing method, message processing device and electronic equipment
CN113079219A (en) Large file fragment uploading method and system
CN106790466B (en) Method, server and terminal equipment for pushing
CN113170500B (en) Information transmission method and device
CN115633044A (en) Message processing method and device, electronic equipment and storage medium
CN113454935B (en) Line coding method and device
CN109327284B (en) Data transmission method and device and electronic equipment
CN113691630B (en) DNS request processing method, device, system, electronic equipment and storage medium
CN110266814A (en) Transmission method and transmitting device
CN114124850B (en) Network communication method and device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant