Summary of the invention
In view of this; The embodiment of the invention provides a kind of reflective memory network data transmission method; Through being provided with the Data Position recording areas; Thereby can make node identification desire whether reading of data is new data, thereby avoid the data corruption in the data transmission procedure, thereby improve the efficiency of transmission of data.
The embodiment of the invention provides a kind of reflective memory network data transmission method, comprising:
The plate of reflective memory card is carried internal memory be divided into global variable district and node data district;
The data storage area that is used to store data in said node data district for each node division; In said global variable district is that corresponding Data Position recording areas is divided in each node data memory block; Said Data Position recording areas is used for the information data of record data in said data storage area, comprising position offset;
When plate carries internal memory and writes new data, said new data is write existing data back in the data storage area corresponding with said node at node, and the memory location of said new data is updated to position offset; After data were filled with in the data storage area, initial position covered legacy data with the storage new data from the data storage area;
When node read in the reflective memory card destination node data, preset data read the position recording areas in the local internal memory of node, and said data read fetch bit put district is used to write down the destination node data that read the position offset in the Data Position recording areas;
Read the current location side-play amount of Data Position recording areas record in the destination node; The position offset of the said destination node that current location side-play amount and said data read fetch bit put district are write down relatively; When twice offset value is different; Upgrade the position offset in said data read fetch bit put district with the current location side-play amount, and read the data of destination node.
Preferably, in embodiments of the present invention, said Data Position recording areas is greater than said data storage area.
Preferably, in embodiments of the present invention, said node reads and writes data in the internal memory of reflective memory card through driving function.
Preferably, in embodiments of the present invention, the size that the plate of said each node carries internal memory is the same.
Preferably, in embodiments of the present invention, said information data also comprises the original position of said data storage area.
Can find out through technique scheme, in embodiments of the present invention, be divided into global variable district and node data district through plate being carried internal memory; And be that corresponding Data Position recording areas is divided in each node data memory block in the global variable district, come the position offset of record data in said data storage area; Thereby make node when plate carries internal memory and writes data, can avoid covering the data of not read; And; When reading the data of destination node, can judge whether to be repeating data, thereby avoid the confusion of data in the data transmission procedure, and then improve the efficiency of transmission of data.
Embodiment
To combine the accompanying drawing in the embodiment of the invention below, the technical scheme in the embodiment of the invention is carried out clear, intactly description, obviously, described embodiment only is the present invention's part embodiment, rather than whole embodiment.Based on the embodiment among the present invention, those of ordinary skills are not making the every other embodiment that is obtained under the creative work prerequisite, all belong to the scope of the present invention's protection.
, plate can avoid covering the data of not read when carrying internal memory and write data in order to make node; And; When reading the data of destination node, can judge whether to be repeating data, thereby avoid the confusion of data in the data transmission procedure, and then improve the efficiency of transmission of data; The embodiment of the invention provides a kind of reflective memory network data transmission method, 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, the global variable district is used for storing each node data and carries the information data in the internal memory at plate, comprising position offset.The node data district is used to store the data that each node need be read and write.
S12, be used to store the data storage area of data for each node division in said node data district; In said global variable district is that corresponding Data Position recording areas is divided in each node data memory block; Said Data Position recording areas is used for the information data of record data in said data storage area, comprising position offset;
As shown in Figure 1, owing to carrying internal memory, plate needs each node in the map network, so the node data district need be each node division data storage area; Corresponding, also need divide corresponding Data Position recording areas for the data storage area of each node.
Concrete, when the node in the network is n, can number each node; Then, the node data zoning is divided into n data memory block, each node is corresponding one by one with each data storage area; Preferably, can each data storage area be divided into equal and opposite in direction.
As shown in Figure 2; Memory location for data in the data storage area that writes down each node; Corresponding Data Position recording areas is divided in the data storage area that also need be each node in the global variable district; That is to say, for the global variable district has comprised a plurality of Data Position recording areas, the respectively corresponding node of each Data Position recording areas and a data memory block.In practical application, the information data in the Data Position recording areas specifically can comprise original position field, position offset field and the extended field etc. of corresponding data memory block.The original position field is used for the position offset of the original position of record data memory block.
S13, at node when plate carries internal memory and writes new data, said new data is write in the data storage area corresponding with said node data back, and the memory location of said new data is updated to position offset; After data were filled with in the data storage area, initial position covered legacy data with the storage new data from the data storage area;
Concrete; When the corresponding data storage area of Data Position recording areas does not have data; The original position of this this corresponding data memory block of Data Position recording areas record, concrete can be the position offset of the original position of this corresponding data memory block in node data district original position, promptly; The position offset that can establish node data district original position is 0, and each data storage area is the position offset that benchmark is provided with self with the position offset of node data district original position.
When the data storage area has stored data and deposited new data in once more,, generate new position offset to upgrade this Data Position recording areas record with the length value that newly deposits data in and original position offset addition.Such as, when the Data Position recording areas current location side-play amount of certain node is recorded as 1000, depositing length with its corresponding data storage area data in and be 256 data, the position offset that then upgrades in this Data Position recording areas is 1256.
Because the limited length of data storage area so the situation that the data storage area storage is full of can occur, at this moment, can cover legacy data with the storage new data by initial position from the data storage area; At this moment, the position offset in the Data Position recording areas should deduct the length value of data storage area self for behind the length value and original position offset addition that newly deposit data in.
Through above-mentioned data writing mode; Make node can will newly write data in proper order according to the locus in the data storage area when data storage area in the internal memory carries out write operation and write in the clearance spaces as far as possible in that plate is carried; Thereby the data of having avoided newly not write by sense data cover, so also just avoided because data to lose the transfer of data that is caused chaotic.
S14, when node reads in the reflective memory card destination node data; Preset data reads the position recording areas in the local internal memory of node, and said data read fetch bit put district is used to write down the destination node data that read the position offset in the Data Position recording areas;
When reading in the reflective memory card destination node data at node; Can be clear and definite learn the data after whether the data that read are upgraded; Avoid repeating to read; In the embodiment of the invention, also be provided with data read fetch bit put district, with the position offset of the destination node data that read of record in the Data Position recording areas.Thereby can learn and read at present that in the data storage area position of data in the destination node.
S15, read the current location side-play amount of destination node Data Position recording areas record; The position offset of the destination node that current location side-play amount and data read fetch bit put district are write down relatively; When twice offset value is different; Upgrade the position offset in said data read fetch bit put district with the current location side-play amount, and read the data of destination node.
In data read fetch bit put district, write down the position offset of the Data Position that read, so, will learn whether the desire reading of data is the data after upgrading through this position offset and the current side-play amount of desiring reading of data are compared.Specifically, if the position offset of the destination node that current location side-play amount and data read fetch bit put district are write down is different, then declarative data can be carried out follow-up read operation for the data after upgrading.If the current location side-play amount is the same with the position offset of the destination node that data read fetch bit put district is write down, then the data of declarative data memory block have been read and have not upgraded, so will can not carry out the read operation to these data.
In practical application, the position offset of the destination node that current location side-play amount and data read fetch bit put district are write down is different, comprises two kinds of situation;
The position offset of the destination node that one of which, current location side-play amount are write down greater than data read fetch bit put district;
This feelings show; The memory location of the data of desiring to read does not also arrive the final position of this data storage area; So; The length of these data deducts the position offset of the destination node that is write down in data read fetch bit put district for the current location side-play amount, at this moment, can accomplish data read operation through the data between the position offset that reads the destination node that is write down in current location side-play amount and data read fetch bit put district.
Its two, the position offset of the destination node that the current location side-play amount is write down less than data read fetch bit put district.
Because the limited length of data storage area so the situation that the data storage area storage is full of can occur, at this moment, can cover legacy data with the storage new data by initial position from the data storage area; At this moment, the position offset in the Data Position recording areas should deduct the length value of data storage area self for behind the length value and original position offset addition that newly deposit data in; What the length value of data storage area self was concrete deducts the original position value for the final position value of data storage area.
When above-mentioned situation, the position offset of the destination node that the current location side-play amount of pre-reading data can be write down less than data read fetch bit put district; At this moment; Data are divided into two parts; Between the final position of position offset to this data storage area of the destination node that a part is write down in data read fetch bit put district, another part is between the current location side-play amount of original position to the pre-reading data of this data storage area.
Above-mentioned can learning arranged; In embodiments of the present invention, stored the position offset of reading of data, when reading of data; Through the position offset of reading of data and the side-play amount of desire reading of data compare; Thereby can judge that whether pre-reading data is the data after upgrading, so avoided data repeat read, improved the efficiency of transmission of data.
To the above-mentioned explanation of the disclosed embodiments, make this area professional and technical personnel can realize or use the present invention.Multiple modification to these embodiment will be conspicuous concerning those skilled in the art, and defined General Principle can realize under the situation that does not break away from the spirit or scope of the present invention in other embodiments among this paper.Therefore, the present invention will can not be restricted to these embodiment shown in this paper, but will meet and principle disclosed herein and features of novelty the wideest corresponding to scope.