Summary of the invention
The object of the present invention is to provide a kind of SPI data transmission method and devices, can guarantee the complete of data transmission
Under the premise of whole property, improve data transfer efficiency.
In order to solve the above-mentioned technical problem, the embodiment of the invention provides a kind of SPI data transmission methods, comprising:
Data distribution to be sent is sent into buffer area to N number of data, wherein N is the integer greater than 1;
The data to be sent that each data are sent to buffer area, are sent to corresponding data receiver buffer area, so that
Receiving end garbled data from least one data receiver buffer area, to obtain a consistent complete with the data to be sent
Entire data;Wherein, the data send buffer area and the data receiver buffer area is cyclic buffer.
It is described by data distribution to be sent to N number of data send buffer area before, further includes:
Check code is generated to each frame data of data to be sent, and adds frame number to each frame data, wherein described
Frame number indicates that M is the integer greater than 0 with M;
In the data to be sent that each data are sent to buffer area, it is sent to corresponding data receiver buffer area
Later, further includes:
So that receiving end to each data receiver buffer area the check codes of received each frame data verify, and will
The data frame of verification failure abandons.
It is described so that receiving end garbled data from least one data receiver buffer area, comprising: so that receiving end is from
The data frame cached is taken out in one data receiver buffer area, then according to taking out from n-th data receiver buffer area
The mode garbled data of the data frame lacked in N-1 data receiver buffer area.
Described so that receiving end garbled data from least one data receiver buffer area, further includes: so that receiving end
When last data receives buffer area and takes out data and jump latter data reception buffer area, by previous data receiver buffer area
All data dumps;When so that receiving end is sequentially sieved from first data receiver buffer area to n-th data receiver buffer area
After selecting data, when cannot still obtain a partial data consistent with the data to be sent, then above-mentioned steps are repeated, directly
To acquisition portion and the consistent partial data of data to be sent.
The data send buffer area and each frame data of the data receiver buffer area are arranged according to frame number ascending order
Column.
To solve identical technical problem, the embodiment of the present invention separately provides a kind of SPI data transmission method, comprising: connects
The N number of data for receiving and dispatching sending end send the data to be sent that buffer area is sent, and are cached in corresponding with each data transmission buffer area
Data receiver buffer area;
The garbled data from least one data receiver buffer area, to obtain a consistent with the data to be sent
Partial data;Wherein, the data send buffer area and the data receiver buffer area is cyclic buffer.
To each data receiver buffer area the check codes of received each frame data verify, and will verification failure
Data frame abandons.
The garbled data from least one data receiver buffer area, comprising: from first data receiver buffer area
The data frame cached is taken out, is then taken out in the N-1 data receiver buffer area according to from n-th data receiver buffer area
The mode garbled data of the data frame of missing.
In the garbled data from least one data receiver buffer area, further includes: receive buffer area in last data
When taking out data and jumping latter data reception buffer area, by all data dumps of previous data receiver buffer area;When according to
Sequence from first data receiver buffer area to n-th data receiver buffer area after garbled data, cannot still obtain it is a with it is described
When the consistent partial data of data to be sent, then above-mentioned steps are repeated, until obtaining a with the data one to be sent
The partial data of cause.
As an improvement of the above scheme, another embodiment of the present invention correspondence provides a kind of SPI data transmission device, wraps
It includes:
File distributing unit, for data distribution to be sent to be sent buffer area to N number of data, wherein N is whole greater than 1
Number;
Data transmission unit is sent to corresponding number for each data to be sent to the data to be sent of buffer area
According to buffer area is received so that receiving end garbled data from least one data receiver buffer area, thus obtain it is a with it is described
The consistent partial data of data to be sent;Wherein, the data send buffer area and the data receiver buffer area is circulation
Buffer area.
Pretreatment unit generates check code for each frame data to data to be sent, and adds to each frame data
Frame number, wherein the frame number is indicated with M, M is the integer greater than 0;
The data transmission unit is also used to make receiving end to the received each frame data of each data receiver buffer area institute
Check code verified, and will verification failure data frame abandon.
As an improvement of the above scheme, another embodiment of the present invention correspondence provides a kind of SPI data transmission device, wraps
It includes:
Data receipt unit, N number of data for receiving transmitting terminal send the data to be sent that buffer area is sent, and cache
In data receiver buffer area corresponding with each data transmission buffer area;
Data screening unit, for the garbled data from least one data receiver buffer area, to obtain a and institute
State the consistent partial data of data to be sent;Wherein, the data send buffer area and the data receiver buffer area is to follow
Ring buffer area.
Data check unit, for each data receiver buffer area the check codes of received each frame data carry out school
It tests, and the data frame of verification failure is abandoned.
Compared with the prior art, the beneficial effect of the embodiment of the present invention is, SPI data provided in an embodiment of the present invention pass
Transmission method and device send buffer area and data receiver buffer area by using N number of data to realize double buffers, and make to connect
Receiving end garbled data from least one data receiver buffer area is a consistent complete with the data to be sent up to obtaining
Data, to guarantee the integrality of data transmission;When there is data packetloss situation, it can be used from preliminary data and receive buffer area
Middle screening institute packet loss data, to solve asking using acknowledgement mechanism caused by inefficiency of the prior art under packet drop
Topic, and then improve the efficiency of data transmission.
Another embodiment of the present invention provides a kind of terminal device, including processor, memory and it is stored in described deposit
In reservoir and it is configured as the computer program executed by the processor, the processor executes real when the computer program
Existing SPI data transmission method as described in any one of the above embodiments.
Another embodiment of the present invention provides a kind of servers, comprising:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes SPI data transmission method as described in any one of the above embodiments.
Another embodiment of the present invention provides a kind of computer readable storage medium, the computer readable storage medium packet
Include the computer program of storage, wherein where controlling the computer readable storage medium in computer program operation
Equipment executes SPI data transmission method as described in any one of the above embodiments.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete
Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on
Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other
Embodiment shall fall within the protection scope of the present invention.
Referring to Fig. 1,3 and 4, which comprises
S001: data distribution to be sent is sent into buffer area to N number of data, wherein N is the integer greater than 1;
Each data: being sent the data to be sent of buffer area, is sent to corresponding data receiver buffer area by S002,
So that receiving end garbled data from least one data receiver buffer area, to obtain a consistent with the data to be sent
Partial data;Wherein, the data send buffer area and the data receiver buffer area is cyclic buffer, wherein recycling
Buffering carries out the transmission, reception, verification etc. of data in the way of data first in first out.
In the present embodiment, before step S001, check code is generated to each frame data of data to be sent, so as to connect
Receiving end according to the identifying code carry out verification received data it is whether correct;And frame number, wherein institute are added to each frame data
State frame number is indicated with M, and M is the integer greater than 0.
In the present embodiment, the step S002 further include: in the number to be sent that each data are sent to buffer area
According to being sent to after corresponding data receiver buffer area, so that receiving end is received to each data receiver buffer area institute
The check code of each frame data is verified according to frame number ascending order, and the data frame of verification failure is abandoned.
In the present embodiment, the step S002 further include: so that receiving end takes from first data receiver buffer area
The data frame cached out, it is then scarce in the N-1 data receiver buffer area according to being taken out from n-th data receiver buffer area
The mode garbled data of the data frame of mistake can screen when there is packet drop to realize in next data receiver buffer area
Institute's packet loss data, thus the data transmission realizing the integrality of data transmission, and without carrying out acknowledgement mechanism, and then improving
Efficiency.
In the present embodiment, the step S002 further include: so that receiving end, which receives buffer area in last data, takes out number
According to and when jumping latter data and receiving buffer area, by all data dumps of previous data receiver buffer area, to realize circulation
Caching, to guarantee data transfer integrity;When so that receiving end sequentially from first data receiver buffer area to n-th data
After receiving buffer area garbled data, when cannot still obtain a partial data consistent with the data to be sent, then repeat to hold
Row above-mentioned steps, until a and consistent partial data of data to be sent is obtained, to ensure that the complete of data transmission
Whole property, and double buffers are utilized, further improve the efficiency of data transmission.
In the present embodiment, the data send each frame data of buffer area and the data receiver buffer area according to
The arrangement of frame number ascending order, to realize that data transmission procedure orderly carries out, thus improve the efficiency of transmission.
A kind of SPI data transmission method provided in an embodiment of the present invention has the following beneficial effects: by by number to be sent
Buffer area is sent according to N number of data are distributed to, in a manner of realizing that N paths carry out the transmission of SPI data, and the data are sent
Buffer function is played in buffer area, thus the efficiency of improve data transfer;Meanwhile by making receiving end from least one data receiver
Garbled data in buffer area, to obtain a and consistent partial data of data to be sent, to ensure that data are transmitted
Integrality further improve the effect of data transmission and by the way that N number of data receiver buffer area is arranged to realize buffer function
Rate.
Referring to fig. 2,3 and 5, which comprises
S011: the N number of data for receiving transmitting terminal send the data to be sent that buffer area is sent, and are cached in and each data
Send the corresponding data receiver buffer area in buffer area;
S012: the garbled data from least one data receiver buffer area, to obtain a and data to be sent
Consistent partial data;Wherein, the data send buffer area and the data receiver buffer area is cyclic buffer.
In the present embodiment, buffer area and data receiver buffer area are sent by data and realizes double buffers, to realize
Buffer function, to improve the efficiency of data transmission procedure;And pass through at least one sieve from N number of data receiver buffer area
Data are selected, to obtain a and consistent partial data of the outgoing data, to guarantee the integrality of data transmission, and then can
Under the premise of guaranteeing data transfer integrity, the efficiency of improve data transfer.
In the present embodiment, to each data receiver buffer area the check codes of received each frame data verify,
And abandon the data frame of verification failure, to ensure that received data is consistent with the data to be sent.
In the present embodiment, the step S012 further include: take out from first data receiver buffer area and to have cached
Then data frame takes out the data frame lacked in the N-1 data receiver buffer area according to from n-th data receiver buffer area
Mode garbled data;When there is packet drop to realize, institute's packet loss data can be screened in next data receiver buffer area,
To realize the integrality of data transmission, and without carrying out acknowledgement mechanism, and then the efficiency of the data transmission improved.
In the present embodiment, the step S012 further include: after last data receives buffer area taking-up data and jumps
When one data receiver buffer area, by all data dumps of previous data receiver buffer area;It is connect when sequentially from first data
After receiving buffer area to n-th data receiver buffer area garbled data, cannot still it obtain a consistent with the data to be sent
When partial data, then above-mentioned steps are repeated, until a and consistent partial data of data to be sent is obtained, thus
It ensure that the integrality of data transmission, and utilize double buffers, further improve the efficiency of data transmission.
A kind of SPI data transmission method provided in an embodiment of the present invention has the following beneficial effects: by receiving transmitting terminal
N number of data send buffer area send outgoing data, by realize by mulitpath carry out the transmission of SPI data in a manner of, when
When packet loss occurs in main road path in mulitpath, general's choosing to packet loss data can be carried out from backup path, thus guaranteeing number
Under the premise of transmission completely, the efficiency of improve data transfer;And the data send buffer area and play buffer function, into one
The efficiency of step ground improve data transfer.
Referring to Fig. 6, a kind of flow diagram for SPI data transmission device that one embodiment of the invention provides, comprising:
Pretreatment unit 61 generates check code for each frame data to data to be sent, and adds to each frame data
Add frame number, wherein the frame number is indicated with M, M is the integer greater than 0.
File distributing unit 62, for data distribution to be sent to be sent buffer area to N number of data, wherein N is greater than 1
Integer.
Data transmission unit 63 is sent to corresponding for each data to be sent to the data to be sent of buffer area
Data receiver buffer area, so that receiving end garbled data from least one data receiver buffer area, to obtain a and institute
State the consistent partial data of data to be sent;Wherein, the data send buffer area and the data receiver buffer area is to follow
Ring buffer area.
Wherein, the data transmission unit 63 is also used to keep receiving end received every to each data receiver buffer area institute
The check code of one frame data is verified, and the data frame of verification failure is abandoned.
A kind of SPI data transmission device provided in an embodiment of the present invention has the following beneficial effects: through the processing unit 61
Check code is generated to each frame of outgoing data and adds frame number, so that receiving end is according to frame number sequence to received number
According to sequentially being verified, received data is consistent with outgoing data to verify, to guarantee the accuracy of data and complete
Whole property;Say that data distribution sends buffer area to N number of data by file distributing unit simultaneously, to realize that the data of multipath pass
It is defeated, and by data transmission unit from the data receiver buffer area garbled data at least one path, when there is packet loss
Packet loss data can be screened from the data receiver buffer area in other path, retransmit packet loss data without feeding back to sender,
To improve the efficiency of data transmission, and the data transmission unit verifies received data, until obtaining
A and consistent partial data of data to be sent, and then ensure that the integrality of data transmission.
Referring to Fig. 7, another embodiment of the present invention provides a kind of SPI data transmission device, comprising:
Data receipt unit 71, N number of data for receiving transmitting terminal send the data to be sent that buffer area is sent, and delay
It is stored in data receiver buffer area corresponding with each data transmission buffer area;
Data screening unit 72, for the garbled data from least one data receiver buffer area, thus obtain it is a with
The consistent partial data of data to be sent;Wherein, the data send buffer area and the data receiver buffer area is
Cyclic buffer.
Data check unit 73, for each data receiver buffer area received each frame data check code carry out
Verification, and the data frame of verification failure is abandoned.
A kind of SPI data transmission device provided in an embodiment of the present invention, has the following beneficial effects: through data receiver list
N number of data that member receives transmitting terminal send the data that buffer area is sent, to realize the data transfer mode of multichannel, and by slow
There are the data to send in buffer area and the data receiver buffer area, to realize buffer function, to improve data biography
Defeated efficiency;Simultaneously by data screening unit carry out to the data receiver buffer area at least one channel in multichannel into
Row data screening with obtain it is a send the consistent partial data of data with the band, can be from it when occurring under packet drop
Packet loss data are screened in his data receiver buffer area, reduce acknowledgement mechanism, and then can guarantee data transfer integrity
Under the premise of, the efficiency of improve data transfer.
The embodiment of the invention also provides a kind of terminal device, including processor, memory and it is stored in the storage
In device and it is configured as the computer program executed by the processor, the processor is realized when executing the computer program
SPI data transmission method as described in any one of the above embodiments.Such as step S001 shown in FIG. 1.Alternatively, the processor executes institute
The function of each module/unit in above-mentioned each Installation practice, such as data transmission unit are realized when stating computer program.
Illustratively, the computer program can be divided into one or more module/units, one or more
A module/unit is stored in the memory, and is executed by the processor, to complete the present invention.It is one or more
A module/unit can be the series of computation machine program instruction section that can complete specific function, and the instruction segment is for describing institute
State implementation procedure of the computer program in SPI data transmission terminal equipment.
The SPI data transmission terminal equipment can be desktop PC, notebook, palm PC and Intelligent flat etc.
Calculate equipment.The SPI data transmission terminal equipment may include, but be not limited only to, processor, memory.Those skilled in the art
Member is appreciated that above-mentioned component is only the example of SPI data transmission terminal equipment, does not constitute to SPI data transmission terminal
The restriction of equipment may include perhaps combining certain components or different components, example than above-mentioned more or fewer components
Such as described SPI data transmission terminal equipment can also include input-output equipment, network access equipment, bus.
The embodiment of the invention also provides a kind of servers, comprising:
One or more processors;
Storage device, for storing one or more programs;
When one or more of programs are executed by one or more of processors, so that one or more of processing
Device realizes SPI data transmission method as described in any one of the above embodiments.
Alleged processor can be central processing unit (Central Processing Unit, CPU), can also be it
His general processor, digital signal processor (Digital Signal Processor, DSP), specific integrated circuit
(Application Specific Integrated Circuit, ASIC), ready-made programmable gate array (Field-
Programmable Gate Array, FPGA) either other programmable logic device, discrete gate or transistor logic,
Discrete hardware components etc..General processor can be microprocessor or the processor is also possible to any conventional processor
Deng the processor is the control centre of the SPI data transmission terminal equipment, entire using various interfaces and connection
The various pieces of SPI data transmission set.
The storage device can be used for storing the computer program and/or module, and the processor is by operation or holds
Row stores computer program and/or module in the memory, and calls the data being stored in memory, realizes institute
The various functions of predicate voice endpoint detection device.The storage device can mainly include storing program area and storage data area,
In, storing program area can application program needed for storage program area, at least one function (such as sound-playing function, image
Playing function etc.) etc.;Storage data area, which can be stored, uses created data (such as audio data, phone directory according to mobile phone
Deng) etc..In addition, memory may include high-speed random access memory, it can also include nonvolatile memory, such as firmly
Disk, memory, plug-in type hard disk, intelligent memory card (Smart Media Card, SMC), secure digital (Secure Digital,
SD) block, flash card (Flash Card), at least one disk memory, flush memory device or other volatile solid-states
Part.
Wherein, if the SPI data transmission terminal equipment it is integrated module/unit it is real in the form of SFU software functional unit
Now and when sold or used as an independent product, it can store in a computer readable storage medium.Based in this way
Understanding, the present invention realize above-described embodiment method in all or part of the process, can also be instructed by computer program
Relevant hardware is completed, and the computer program can be stored in a computer readable storage medium, the computer program
When being executed by processor, it can be achieved that the step of above-mentioned each embodiment of the method.Wherein, the computer program includes computer
Program code, the computer program code can be source code form, object identification code form, executable file or certain centres
Form etc..The computer-readable medium may include: can carry the computer program code any entity or device,
Recording medium, USB flash disk, mobile hard disk, magnetic disk, CD, computer storage, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), electric carrier signal, telecommunication signal and software
Distribution medium etc..It should be noted that the content that the computer-readable medium includes can be according to making laws in jurisdiction
Requirement with patent practice carries out increase and decrease appropriate, such as in certain jurisdictions, according to legislation and patent practice, computer
Readable medium does not include electric carrier signal and telecommunication signal.
It should be noted that the apparatus embodiments described above are merely exemplary, wherein described be used as separation unit
The unit of explanation may or may not be physically separated, and component shown as a unit can be or can also be with
It is not physical unit, it can it is in one place, or may be distributed over multiple network units.It can be according to actual
It needs that some or all of the modules therein is selected to achieve the purpose of the solution of this embodiment.In addition, device provided by the invention
In embodiment attached drawing, the connection relationship between module indicate between them have communication connection, specifically can be implemented as one or
A plurality of communication bus or signal wire.Those of ordinary skill in the art are without creative efforts, it can understand
And implement.
The above is a preferred embodiment of the present invention, it is noted that for those skilled in the art
For, various improvements and modifications may be made without departing from the principle of the present invention, these improvements and modifications are also considered as
Protection scope of the present invention.