Summary of the invention
In view of this, embodiments provide a kind of data transmission method of reflective memory network, by being provided with Data Position recording areas, thus node can be made identification whether to be new data for reading data, thus the data corruption avoided in data transmission procedure, thus improve the efficiency of transmission of data.
Embodiments provide a kind of data transmission method of reflective memory network, comprising:
The plate of reflective memory card is carried internal memory and be divided into global variable district and node data district;
Be that each node division is for storing the data storage area of data in described node data district; Be that each node data memory block divides corresponding Data Position recording areas in described global variable district; Described Data Position recording areas is used for the information data of record data in described data storage area, comprising position offset;
Node to plate carry internal memory write new data time, after existing data in data storage area corresponding with described node for the write of described new data, and the memory location of described new data is updated to position offset; After data are filled with in data storage area, cover legacy data to store new data from data storage area initial position;
When node reads destination node data in reflective memory card, recording areas, preset data load position in the local internal memory of node, recording areas, described digital independent position is for recording the position offset of destination node data in Data Position recording areas read;
Read the current location side-play amount of Data Position recording areas record in destination node, the position offset of described destination node current location side-play amount recorded with recording areas, described digital independent position compares, when twice position offset value is different, upgrade the position offset of recording areas, described digital independent position by current location side-play amount, and read the data of destination node.
Preferably, in embodiments of the present invention, described Data Position recording areas is greater than described data storage area.
Preferably, in embodiments of the present invention, described node is read and write data in the internal memory of reflective memory card by driving function.
Preferably, in embodiments of the present invention, to carry the size of internal memory the same for the plate of described each node.
Preferably, in embodiments of the present invention, described information data also comprises the original position of described data storage area.
Can being found out by technique scheme, in embodiments of the present invention, being divided into global variable district and node data district by plate being carried internal memory; And be that each node data memory block divides corresponding Data Position recording areas in global variable district, carry out the position offset of record data in described data storage area; Thus make node can avoid covering the data be not read out when plate carries internal memory write data, and, can repeating data be determined whether when reading the data of destination node, thus avoid the confusion of data in data transmission procedure, and then improve the efficiency of transmission of data.
Embodiment
Below in conjunction with the accompanying drawing in the embodiment of the present invention, be clearly and completely described the technical scheme in the embodiment of the present invention, obviously, described embodiment is only the present invention's part embodiment, instead of whole embodiments.Based on the embodiment in the present invention, those of ordinary skill in the art, not making the every other embodiment obtained under creative work prerequisite, belong to the scope of protection of the invention.
Can avoid covering the data be not read out when plate carries internal memory write data to make node, and, repeating data can be determined whether when reading the data of destination node, thus avoid the confusion of data in data transmission procedure, and then improve the efficiency of transmission of data, embodiments provide a kind of data transmission method of reflective memory network, comprising:
S11, the plate of reflective memory card is carried internal memory be divided into global variable district and node data district;
In embodiments of the present invention, information data in internal memory to be carried, comprising position offset for storing data in each node in global variable district at plate.Node data district needs the data of read-write for storing each node.
S12, be that each node division is for storing the data storage area of data in described node data district; Be that each node data memory block divides corresponding Data Position recording areas in described global variable district; Described Data Position recording areas is used for the information data of record data in described data storage area, comprising position offset;
As shown in Figure 1, because plate carries each node that internal memory needs in map network, so node data district needs for each node division data storage area; Corresponding, also need the data storage area for each node to divide corresponding Data Position recording areas.
Concrete, when the node in network is n, can be numbered each node, then, node data zoning is divided into n data storage area, each node and each data storage area one_to_one corresponding, preferably, each data storage area can be divided into equal and opposite in direction.
As shown in Figure 2, in order to record each node data storage area in the memory location of data, also need the Data Position recording areas of the data storage area division correspondence in global variable district being each node, that is, for global variable district includes multiple Data Position recording areas, each Data Position recording areas is a corresponding node and a data storage area respectively.In actual applications, the information data in Data Position recording areas specifically can comprise original position field, the position offset field and extended field etc. of corresponding data memory block.Original position field is used for the position offset of the original position of record data memory block.
S13, node to plate carry internal memory write new data time, after data in data storage area corresponding with described node for the write of described new data, and the memory location of described new data is updated to position offset; After data are filled with in data storage area, cover legacy data to store new data from data storage area initial position;
Concrete, when the data storage area that Data Position recording areas is corresponding does not have data, the original position of this corresponding data memory block is recorded in this Data Position recording areas, the position offset of original position in node data district original position of concrete can be this corresponding data memory block, namely, the position offset of node data district original position can be set as 0, each data storage area with the position offset of node data district original position for benchmark arranges self position offset.
When data storage area has stored data also again stored in new data, the new length value stored in data is added with original position offset, has generated new position offset to upgrade this Data Position recording areas record.Such as, when the Data Position recording areas current location side-play amount of certain node is recorded as 1000, be the data of 256 stored in the length with its corresponding data storage area data, then the position offset upgraded in this Data Position recording areas is 1256.
Due to the limited length of data storage area, so there will be the situation that data storage area data storage is full of, now, legacy data can be covered to store new data from data storage area initial position; Now, the position offset in Data Position recording areas should be, after the new length value stored in data is added with original position offset, deduct the length value of data storage area self.
By above-mentioned data writing mode, make node newly can will write data according to the locus order in data storage area as far as possible in write clearance spaces carrying plate when the data storage area in internal memory carries out write operation, thus avoid and be not read out data by the data cover newly write, and then also just avoid because the transfer of data that causes of the loss of data is chaotic.
S14, when node reads destination node data in reflective memory card, recording areas, preset data load position in the local internal memory of node, recording areas, described digital independent position is for recording the position offset of destination node data in Data Position recording areas read;
In order to when node reads destination node data in reflective memory card, data after whether data learning reading that can be clear and definite upgrade, avoid repeating to read, in the embodiment of the present invention, also be provided with recording areas, digital independent position, to record the position offset of destination node data in Data Position recording areas read.Thus the position of having read data in data storage area in destination node at present can be learnt.
The current location side-play amount of S15, reading destination node Data Position recording areas record, the position offset of destination node current location side-play amount recorded with recording areas, digital independent position compares, when twice position offset value is different, upgrade the position offset of recording areas, described digital independent position by current location side-play amount, and read the data of destination node.
In recording areas, digital independent position, have recorded the position offset of the Data Position read, so by comparing by this position offset with for reading the current offset of data, will learn for read data be whether upgrade after data.Specifically, if the position offset of destination node that current location side-play amount and recording areas, digital independent position are recorded is different, then illustrates that data are the data after upgrading, can follow-up read operation be carried out.If current location side-play amount is the same with the position offset of the destination node that recording areas, digital independent position is recorded, then illustrate that the data of data storage area have been read and have not upgraded, so can not perform the read operation to these data.
In actual applications, the position offset of the destination node that current location side-play amount and recording areas, digital independent position are recorded is different, comprises two kinds of situations;
One, current location side-play amount is greater than the position offset of the destination node that recording areas, digital independent position is recorded;
This feelings show, memory location for the data read also does not arrive the final position of this data storage area, so, the length of these data deducts the position offset of the destination node that recording areas, digital independent position is recorded for current location side-play amount, now, data read operation can be completed by the data between the position offset that reads the destination node that current location side-play amount and recording areas, digital independent position are recorded.
Its two, current location side-play amount is less than the position offset of the destination node that recording areas, digital independent position is recorded.
Due to the limited length of data storage area, so there will be the situation that data storage area data storage is full of, now, legacy data can be covered to store new data from data storage area initial position; Now, the position offset in Data Position recording areas should be, after the new length value stored in data is added with original position offset, deduct the length value of data storage area self; The final position value for data storage area that the length value of data storage area self is concrete deducts original position value.
When above-mentioned situation, the current location side-play amount of pre-reading data can be less than the position offset of the destination node that recording areas, digital independent position is recorded; Now, data are divided into two parts, the position offset of the destination node that a part records in recording areas, digital independent position to this data storage area final position between, the original position of another part in this data storage area to pre-reading data current location side-play amount between.
There is above-mentioned can learning, in embodiments of the present invention, store the position offset reading data, when reading data, by will reading the position offset of data and compare for the side-play amount of reading data, thus can judge that whether pre-reading data is the data after upgrading, and then avoid data repeat read, improve the efficiency of transmission of data.
To the above-mentioned explanation of the disclosed embodiments, professional and technical personnel in the field are realized or uses the present invention.To be apparent for those skilled in the art to the multiple amendment of these embodiments, General Principle as defined herein can without departing from the spirit or scope of the present invention, realize in other embodiments.Therefore, the present invention can not be restricted to these embodiments shown in this article, but will meet the widest scope consistent with principle disclosed herein and features of novelty.