CN103514126B - The method of reseptance of a kind of data, system and device - Google Patents

The method of reseptance of a kind of data, system and device Download PDF

Info

Publication number
CN103514126B
CN103514126B CN201210214211.6A CN201210214211A CN103514126B CN 103514126 B CN103514126 B CN 103514126B CN 201210214211 A CN201210214211 A CN 201210214211A CN 103514126 B CN103514126 B CN 103514126B
Authority
CN
China
Prior art keywords
data
memory space
frame head
frame
dma controller
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.)
Expired - Fee Related
Application number
CN201210214211.6A
Other languages
Chinese (zh)
Other versions
CN103514126A (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.)
Comba Network Systems Co Ltd
Original Assignee
Comba Telecom Systems Guangzhou 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 Comba Telecom Systems Guangzhou Co Ltd filed Critical Comba Telecom Systems Guangzhou Co Ltd
Priority to CN201210214211.6A priority Critical patent/CN103514126B/en
Publication of CN103514126A publication Critical patent/CN103514126A/en
Application granted granted Critical
Publication of CN103514126B publication Critical patent/CN103514126B/en
Expired - Fee Related legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Abstract

The invention discloses the method for reseptance of a kind of data, system and device, including: the data frame head of the Frame of reception is stored in the first memory space by dma controller, data frame head carries the information of the data length for characterizing Frame, read, after determining reception and having stored data frame head, the data frame head that the first memory space preserves, and the information of data length is sent to application program, and, after determining reception and having stored data frame head, the data volume of the Frame of reception is stored in the second memory space;This application program information according to the data length obtained from dma controller, it is determined that dma controller by after reception having stored data volume, reads data frame head that the first memory space preserves and the data volume that the second memory space preserves.Adopt the technical program, it is possible to avoid the problem that Frame that application program reads from memory space is inconsistent with actual Frame, improve application program and read the success rate of data.

Description

The method of reseptance of a kind of data, system and device
Technical field
The present invention relates to computer and information technology field, particularly relate to the method for reseptance of a kind of data, system and device.
Background technology
At present, embedded system is when communicating with high speed data transfer equipment, a complete Frame is received typically via the mode repeatedly received, namely receive the part data of this Frame every time, the length of these part data can determine according to the data-handling capacity of the locally configured hardware of system, and, system often receives a secondary data will produce an interrupt requests, this interrupt requests can trigger central processing unit (CentralProcessingUnit, CPU) and call interrupt service routine and carry out the operation of data receiver.In practical application, the data volume that CPU receives every time is limited, therefore, when the data volume that system receives is bigger, CPU finishes receiving the number of times of all data also can be increased accordingly, and correspondingly, the number of processes that CPU calls interrupt service routine according to interrupt requests also can increase, these processing procedures improve the occupancy of cpu resource, it is possible to cause the reduction of cpu data disposal ability.
At present, for the problems referred to above, embedded system is generally adopted the data receiver mode of direct memory access (DirectMemoryAccess, DMA).Before adopting dma mode to receive data, the data receiver of DMA is mainly configured and initializes by CPU, for instance, CPU can according to the memory space that the data length of Frame set in advance is the dma controller distribution Frame for storing reception.In the data receiver mode of DMA, main completed the reception of data by dma controller and operate, this dma controller can adapt to be configured with the embedded system of the hardware of different pieces of information disposal ability, generally, dma controller can once receive a complete Frame, but the data length requiring this Frame meets the data length of the Frame of setting, namely need not by repeatedly having received a Frame, thus decreasing the CPU process resource to interrupt requests.
Based in the data receiver mode of DMA, for dma controller distribution for store dma controller receive data memory space be typically of size of fixing, namely adopting the data receiver mode of DMA, it is desirable to the data length of the Frame every time received is fixing.It is based upon the memory space of the fixed size of dma controller distribution, dma controller can carry out the operational circumstances of data storage according to this memory space and judge whether to have received a Frame, such as, the data length of Frame set in advance is 512bit, it is 1000bit based on the memory space that this data length is the dma controller distribution Frame for storing this data length, so, receive in the process of data at dma controller, the Frame received can be preserved to memory space corresponding for the front 512bit of this memory space, after dma controller has determined the reception of Frame, interrupt requests can be produced, and this interrupt requests is sent to application program, by application program according to set Frame data length from this memory space read corresponding length data.Wherein, dma controller has determined the reception of Frame, mainly preserves to memory space corresponding for the front 512bit of memory space at the Frame that will receive, it is judged that whether receive data again in the setting time, if not receiving, it is determined that complete the reception of Frame.
Obviously, adopt the data receiver mode of DMA, dma controller is mainly based upon the memory space of pre-assigned fixed size and receives the Frame meeting setting data length, in actual applications, difference due to practical business type, it is difficult to ensure that the data length of Frame is fixed value, in the case, may result in data receiver failure, such as, when the real data length of currently received Frame is more than the data length of Frame set, would be likely to occur the pre-assigned memory space real data length less than currently received Frame, so, dma controller then can not receive complete Frame, and then application program also cannot get complete data;When the real data length of currently received Frame is less than the data length of Frame set, owing to application program is the data that the data length according to the Frame set reads corresponding data length from memory space, therefore, would be likely to occur the problem that application program also can read other incoherent data messages when reading this Frame, thus causing that the Frame that application program reads is inconsistent with actual Frame, reducing application program and reading the success rate of data.
In sum, the data receiver mode of existing DMA, there is the problem that Frame that application program reads from memory space is inconsistent with actual Frame, thus causing that application program reads the success rate of data.
Summary of the invention
In view of this, the embodiment of the present invention provides the method for reseptance of a kind of data and device, adopts this technical scheme, it is possible to avoid the problem that Frame that application program reads from memory space is inconsistent with the Frame of actual transmissions.
The embodiment of the present invention is achieved through the following technical solutions:
An aspect according to embodiments of the present invention, it is provided that the method for reseptance of a kind of data, including:
The data frame head of the Frame of reception is stored in the first memory space by dma controller, described data frame head carries the information of the data length for characterizing described Frame, after determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame, and, after determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space;
The information of the described data length that described application program sends according to described dma controller, after determining that described dma controller receives and stored described data volume, read the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation.
Another aspect according to embodiments of the present invention, additionally provides the method for reseptance of a kind of data, including:
The data frame head of the Frame of reception is stored in the first memory space by dma controller, and described data frame head carries the information of the data length for characterizing described Frame;
After determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame;And
After determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space.
Another aspect according to embodiments of the present invention, additionally provides the method for reseptance of a kind of data, including:
Application program receives the information of the data length of the Frame for characterizing reception that dma controller sends;
Information according to described data length, after determining the data volume that described dma controller received and stored described Frame, read described dma controller and be received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space.
Another aspect according to embodiments of the present invention, additionally provides the reception system of a kind of data, and this system includes dma controller and application program, wherein:
Described dma controller, for the data frame head of the Frame of reception is stored in the first memory space, described data frame head carries the information of the data length for characterizing described Frame, after determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame, and, after determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space;
Described application program, the information of the described data length for sending according to described dma controller, after determining that described dma controller receives and stored described data volume, read the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation.
Another aspect according to embodiments of the present invention, additionally provides the reception device of a kind of data, including:
Data frame head memory element, for the data frame head of the Frame of reception is stored in the first memory space, described data frame head carries the information of the data length for characterizing described Frame;
Data frame head storage monitoring unit, is used for determining whether described data frame head memory element receives and stored described data frame head;
Data frame head reads unit, for, after described data frame head storage monitoring unit determines that described data frame head memory element receives and stored described data frame head, reading the described data frame head that described first memory space preserves;
The information transmitting unit of data length, the information of the described data length that the data frame head read for described data frame head reads unit carries sends to the application program being used for processing described Frame;
Data volume memory element, for, after described data frame head storage monitoring unit determines that described data frame head memory element receives and stored described data frame head, being stored in the second memory space by the data volume of the described Frame received.
Another aspect according to embodiments of the present invention, additionally provides the reception device of a kind of data, including:
The information receiving unit of data length, for receiving the information of the data length of the Frame for characterizing reception that dma controller sends;
Data volume storage completes to determine unit, the information of the data length for receiving according to the information receiving unit of described data length, it is determined that whether described dma controller completes to receive and store the operation of the data volume of described Frame;
Frame reads unit, for after described data volume storage completes to determine that unit determines the data volume that described dma controller received and stored described Frame, read described dma controller and be received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space.
By at least one technical scheme above-mentioned that the embodiment of the present invention provides, the data frame head of the Frame of reception is stored in the first memory space by dma controller, this data frame head carries the information of the data length of the Frame for characterizing reception, after determining reception and having stored data frame head, read the data frame head that the first memory space preserves, and the information of the data length carried by data frame head sends to the application program being used for processing Frame.The information of the data length that application program sends according to dma controller, determine that the data volume of the Frame of reception is stored in after the operation of the second memory space completes by dma controller, namely read data frame head that the first memory space preserves and the data volume that the second memory space preserves.nullThe technical program is compared with prior art,The information of data length can be carried by the data frame head of Frame,Thus after dma controller completes the reception of data frame head,The information of the data length that can be carried by the data frame head of reception sends the application program to the Frame being used for processing reception,Thus according to the information of data length, this application program can determine whether dma controller completes the reception of Frame,And after determining the data volume that dma controller received and stored Frame,Read the data frame head in the first memory space preservation and the data volume in the second memory space preservation,Thus dma controller can support the reception of the Frame of different data lengths,Avoid the problem that Frame that application program reads from memory space is inconsistent with the Frame of actual transmissions,Improve application program and read the success rate of data.
Other features and advantages of the present invention will be set forth in the following description, and, partly become apparent from description, or understand by implementing the present invention.The purpose of the present invention and other advantages can be realized by structure specifically noted in the description write, claims and accompanying drawing and be obtained.
Accompanying drawing explanation
Accompanying drawing is for providing a further understanding of the present invention, and constitutes a part for description, is used for explaining the present invention, is not intended that limitation of the present invention together with the embodiment of the present invention.In the accompanying drawings:
The schematic flow sheet of the reception of a kind of data that Fig. 1 provides for the embodiment of the present invention one;
The determination dma controller that Fig. 2 provides for the embodiment of the present invention one receives and stores the schematic flow sheet that the operation of data volume completes;
The schematic flow sheet of the preferred implementation of the data volume that the data frame head of reading the first memory space preservation that Fig. 3 provides for the embodiment of the present invention one and the second memory space preserve;
The schematic flow sheet of the another preferred implementation of the data volume that the data frame head of reading the first memory space preservation that Fig. 4 provides for the embodiment of the present invention one and the second memory space preserve;
The structural representation receiving device of a kind of data that Fig. 5 provides for the embodiment of the present invention three;
The structural representation receiving device of another data that Fig. 6 provides for the embodiment of the present invention three.
Detailed description of the invention
In order to provide the implementation improving the success rate that application program reads data, embodiments provide the method for reseptance of a kind of data, system and device, below in conjunction with Figure of description, the preferred embodiments of the present invention are illustrated, it is to be understood that, preferred embodiment described herein is merely to illustrate and explains the present invention, is not intended to limit the present invention.And when not conflicting, the embodiment in the application and the feature in embodiment can be mutually combined.
In technical scheme provided by the invention, before carrying out the associative operation of reception of data, first dma controller can be initialized, such as, it is the dma controller distribution the first memory space for the data frame head of the Frame that stores reception by CPU according to the data length of the data frame head of Frame, the memory area that this first memory space provides can mate with the data length of data frame head, can also more than the data length of data frame head, in practical application, it is possible to distribute accordingly as the case may be;In addition, CPU can also according to the span of the data length of the data volume of Frame, for dma controller distribution for storing the second memory space of the data volume of the Frame of reception, in the technical program, the data length of the data volume of Frame is unfixed, this data length can be arranged flexibly according to the situation of the data of actual transmissions, therefore, CPU can be the second memory space that dma controller distribution stores this data volume according to the span of the data length of data volume in practical application.
Embodiment one
This embodiment one provides the method for reseptance of a kind of data, the method can be applied in embedded systems, by applying the technical program in embedded systems, it can be avoided that the problem that the Frame that reads from memory space of application program is inconsistent with the Frame of actual transmissions such that it is able to reach to improve the purpose of the success rate that application program reads data.
Fig. 1 illustrates the schematic flow sheet of the reception of a kind of data that the embodiment of the present invention one provides, as it is shown in figure 1, the reception process of these data, mainly comprises the steps that
The data frame head of the Frame of reception is stored in the first memory space by step 101, dma controller, and wherein, data frame head carries the information of the data length for characterizing Frame.
In this step 101, the data length that information for characterizing the data length of Frame is corresponding, the data length of the data volume that the data length of the data frame head included by Frame and Frame include forms, wherein, the data length of data frame head is set in advance, the data length of data volume can be arranged accordingly according to the concrete condition of the data of transmission, and namely the data length of this data volume is not fixed.
Step 102, dma controller, after determining the data frame head receiving and having stored reception, read the data frame head that the first memory space preserves, and the data volume of the Frame of reception are stored in the second memory space.
In this step 102, dma controller is after determining the data frame head receiving and having stored reception, can pass through to produce the mode of interrupt requests, interrupt service routine to the first memory space read the data frame head of storage to obtain the information of the data length that this data frame head carries.In addition, the technical program does not limit the order of the operation for performing " reading the data frame head that the first memory space preserves " and " data volume of the Frame of reception is stored in the second memory space ", namely aforesaid operations can according to actual applied environment, carry out simultaneously, or it is sequentially carried out as required, repeats no more herein.The data volume of the described Frame in this programme be in Frame divisor according to frame head outside data.
The information of the data length that the data frame head of reading is carried by step 103, dma controller sends to the application program being used for processing Frame.
In this step 103, in practical application, can based on the description in step 102, after interrupt service routine reads the data frame head stored in the first memory space, the information of the data length carried by the data frame head of reading sends to application program, being carried out follow-up operation by application program, so far, end interrupt service routine processes the operation carried out with end interrupt.In practical application, the information of the data length carried in data frame head at the data frame head of the first memory space and is sent to application program by step 102 and step 103 except the mode reading and saving of employing interrupt processing, other modes can also be adopted to operate accordingly according to the concrete condition of applied environment or requirement, herein, no longer repeat one by one.In this programme, can according to the dma controller producing interrupt requests, the technical scheme of the information of the data length that corresponding reading and saving is carried in the data frame head of the first memory space, transmission data frame head can also be realized according to the actual requirements, for ease of describing, below this programme, follow-up description will be carried out for DMA control.
The information of the data length that step 104, application program send according to dma controller, it is determined that after dma controller receives and stored data volume, reads the data frame head of the first memory space preservation and the data volume of the second memory space preservation.
In this step 104, application program is in the information of the data length sent according to dma controller, judge when whether dma controller completes the operation receiving and storing data volume, can in conjunction with dma controller receiving data frames time message transmission rate carry out, such as, the result that the number of the bit included by the data length of data volume is multiplied with message transmission rate is defined as dma controller and the data volume of the Frame of reception is stored in the operation duration of the second memory space, in practical application, also can connected applications environment, the basis of the duration determined increases the duration of extra setting, to fully ensure that Frame is received and stored, this extra duration can be generally the 5%-10% of the duration determined, in practical application, this ratio can be arranged as the case may be flexibly.After this duration, it may be determined that the operation that the data volume of the Frame of reception is stored in the second memory space is completed by dma controller.In addition, needs according to applied environment, after determining that dma controller receives and stored data volume, the data frame head of the first memory space preservation and the data volume of the second memory space preservation can be read, can also directly read second memory space preserve data volume, namely directly obtain Frame divisor according to frame head outside data.
So far, the flow process of the reception of data terminates.
nullIn the flow process that Fig. 1 is corresponding,The information of data length can be carried by the data frame head of Frame,Thus after dma controller completes the reception of data frame head,The information of the data length that can be carried by the data frame head of reception sends the application program to the Frame being used for processing reception,Thus according to the information of data length, this application program can determine whether dma controller completes the reception of Frame,And after determining the data volume that dma controller received and stored Frame,Read the data frame head in the first memory space preservation and the data volume in the second memory space preservation,Thus dma controller can support the reception of the Frame of different data lengths,Avoid the problem that Frame that application program reads from memory space is inconsistent with the Frame of actual transmissions,Improve application program and read the success rate of data.
In the step 102 that the flow process that Fig. 1 is corresponding includes, namely at dma controller after determining the data frame head receiving and having stored reception, read in the data frame head that the first memory space preserves, for dma controller, the technical program determines that the operation receiving and having stored the data frame head received provides several preferred embodiments, specific as follows:
When the memory area size that the first memory space of the data frame head for store frames of data is corresponding is mated with the data length of the data frame head of Frame, dma controller can determine whether to receive and stored by monitoring the occupied situation of memory area corresponding to the first memory space the data frame head of reception, such as, when dma controller monitors after memory area corresponding to the first memory space all taken by data (the data frame head of the Frame namely received), it is determined that receive and stored data frame head;
When memory area corresponding to the first memory space of the data frame head for store frames of data is more than the data length of the data frame head of Frame, dma controller can when monitoring memory area corresponding to the first memory space data length by data (the data frame head of the Frame namely received) size taken and the data frame head pre-saved and mating, it is determined that receives and stored described data frame head.
nullIn the step 104 that the flow process that Fig. 1 is corresponding includes,The information of the data length namely sent according to dma controller at application program,After determining that dma controller receives and stored data volume,Read in the data frame head of the first memory space preservation and the data volume of the second memory space preservation,The information of the data length that application program sends according to dma controller,Determine that dma controller receives and store the operation of data volume when completing,Application program can according to the data length of data length corresponding to the information of data length and the data frame head of Frame,Determine the data length of the data volume of Frame,And then,Determine that dma controller stores the duration of the data volume of the Frame of reception in the second memory space,Specifically,What Fig. 2 illustrated that the present embodiment one provides a kind of determines that dma controller receives and store the schematic flow sheet that the operation of data volume completes,Such as figure,This determines that dma controller receives and store the process that the operation of data volume completes,Mainly comprise the steps that
The difference of data length corresponding to the information of the data length that DMA interrupt handling routine is sent by step 201, application program and the data length of data frame head, it is determined that for the data length of data volume.
Step 202, the application program data length according to data volume, it is determined that the data volume of the data length determined received is stored in the duration that the second memory space needs by dma controller.
In this step 202, application program can message transmission rate when clear and definite dma controller receiving data frames, data length according to data volume, determine that the data volume of the data length determined received is stored in the duration that the second memory space needs by dma controller, specifically, it is possible to reference to the associated description in above-mentioned steps 104.
Step 203, application program are after the duration determined, it is determined that dma controller receives and stores the operation of data volume and completes.
In this step 203, receive dma controller based on application program and send the information of data length, and after the information receiving data length, perform the duration of step 201 and step 202, it is negligible that relative dma controller receives and store the duration of the Frame of reception, therefore, application program can start timing from the time of the information receiving the data length that dma controller sends, and enter resting state, after the duration determined, application program is waken up and determines that the operation that the data volume of the Frame of reception is stored in the second memory space is completed by dma controller;Or, directly from determining that the dma controller data volume by the data length determined received is stored in time of the duration that the second memory space needs and starts timing, and enter resting state, after the duration determined, application program is waken up and determines that the operation that the data volume of the Frame of reception is stored in the second memory space is completed by dma controller.
So far, it is determined that dma controller receives and store the flow process that the operation of data volume completes to be terminated.
The feature of position when being assigned with based on the first memory space of the above-mentioned data frame head being respectively used to store frames of data and data volume and the second memory space, " reading data frame head that the first memory space preserves and the data volume that the second memory space preserves " in the step 104 that the technical program includes for Fig. 1 correspondence flow process, provide several preferred implementation, specific as follows:
Preferred implementation one
In this preferred implementation one, the memory area that memory area that first memory space is corresponding is corresponding with the second memory space is adjacent, and second after memory area corresponding to memory space be positioned at the memory area that the first memory space is corresponding, to should the feature of position of the first memory space and the second memory space, Fig. 3 illustrates that the application program that the embodiment of the present invention one provides reads the data frame head of the first memory space preservation and the schematic flow sheet of the data volume of the second memory space preservation, as shown in Figure 3, the data frame head of this reading and saving and the process of data volume, mainly comprise the steps that
Step 301, application program determine the initial address of the address of the first memory space.
In this step 301, after being positioned at, based on the memory area of the first storage sky correspondence and the memory area that memory area is adjacent and the second memory space is corresponding of the secondth memory space, the memory area that the first memory space is corresponding, namely the first memory space of CPU distribution and the memory area of the second memory space are continuous print, after dma controller preserves data in continuous print memory area, if desired the data of reading and saving, generally determine the initial address of the address of this continuous print memory area, namely determine the initial address of the address of the first memory space.If having only to read the data volume of the Frame of storage in the second memory space, then can using after amount of physical memory corresponding for the first memory space and the address of the memory space adjacent with this amount of physical memory initial address as the second memory space.
The information of the data length that step 302, application program send according to dma controller, from the initial address of the address of the first memory space, reads the data of data length determined as the data frame head of Frame and data volume.
In this step 302, application program is from the initial address of the address of the first memory space, reading data length consistent data corresponding with the information of the data length that dma controller sends, these data read are the Frame being made up of data frame head and data volume.If having only to read the data volume of the Frame of storage in the second memory space, the initial address of the second memory space then directly determined from step 301 starts to read the data that data length is consistent with the data length of the data volume of Frame, as the data volume of Frame.
So far, the flow process reading the data frame head of the first memory space preservation and the data volume of the second memory space preservation terminates.
Preferred implementation two
In this preferred implementation two, the memory area that memory area that first memory space is corresponding is corresponding with the second memory space is non-adjacent, to should the feature of position of the first memory space and the second memory space, Fig. 4 illustrates that the application program that the embodiment of the present invention one provides reads the data frame head of the first memory space preservation and the schematic flow sheet of the data volume of the second memory space preservation, as shown in Figure 4, the data frame head of this reading and saving and the process of data volume, mainly comprise the steps that
Step 401, application program determine the address of the first memory space and the address of the second memory space.
Step 402, the application program data length according to the data frame head of Frame, the memory area corresponding from the address of the first memory space reads the data that data length is consistent with the data length of data frame head, as the data frame head of Frame.
In this step 402, when the memory area that application program is corresponding from the address of the first memory space reads data, can according to the address of the first memory space, the initial memory address of the memory area corresponding from the address of the first memory space starts to read the data that data length is consistent with the data length of data frame head.
Step 403, the application program data length according to the data volume of Frame, the memory area corresponding from the address of the second memory space reads the data that data length is consistent with the data length of data volume, as the data volume of Frame.
In this step 403, when the memory area that application program is corresponding from the address of the second memory space reads data, can according to the address of the second memory space, the initial memory address of the memory area corresponding from this address starts to read the data that data length is consistent with the data length of data volume.If having only to read the data volume of the Frame of storage in the second memory space, then can determine the address of the second memory space in step 401, then perform this step 403.If desired complete Frame is read, the execution sequence of this step 403 and step 402, can carry out flexibly according to practical situation, it is not construed as limiting herein, for instance, it is possible to perform step 402 and step 403 simultaneously, or, step 402 is performed after performing step 403, or, perform step 403 after performing step 402.
So far, the flow process reading the data frame head of the first memory space preservation and the data volume of the second memory space preservation terminates.
Embodiment two
This embodiment two provides the reception system of a kind of data, this system can be applied in embedded systems, by applying the technical program in embedded systems, it can be avoided that the problem that the Frame that reads from memory space of application program is inconsistent with the Frame of actual transmissions such that it is able to reach to improve the purpose of the success rate that application program reads data.
The reception system of the data that the present embodiment two provides, including dma controller and application program, wherein:
Dma controller, for the data frame head of the Frame of reception is stored in the first memory space, data frame head carries the information of the data length for characterizing Frame, after determining reception and having stored data frame head, read the data frame head that the first memory space preserves, and the information of the data length carried by data frame head sends to the application program being used for processing Frame, and, after determining reception and having stored data frame head, the data volume of the Frame of reception is stored in the second memory space;
Application program, the information of the data length for sending according to dma controller, it is determined that after dma controller receives and stored data volume, reads the data frame head of the first memory space preservation and the data volume of the second memory space preservation.
Further, dma controller and application program that the present embodiment two provides also have following functions, specific as follows:
Dma controller is when being determined the operation receiving and having stored data frame head, if the size of memory area corresponding for the first memory space of store frames of data head is mated with the data length of data frame head, after then all can being taken by data frame head monitoring memory area corresponding to the first memory space, it is determined that receive and stored data frame head;If the size of the memory area that the first memory space is corresponding is more than the data length of data frame head, then when the data length monitoring memory area corresponding to the first memory space size taken by data frame head and the data frame head pre-saved mates, it is determined that receive and stored according to frame head.
The information of the data length that application program sends according to dma controller, when being determined the operation that dma controller received and stored data volume, can by the difference of data length corresponding for the information of data length Yu the data length of data frame head, it is defined as the data length of data volume, then the data length according to data volume, determine that the data volume of reception is stored in the duration that the second memory space needs by dma controller, and after the duration determined, it is determined that dma controller receives and has stored data volume.
Application program read first memory space preserve data frame head and the second memory space preserve data volume time, corresponding read operation can be carried out according to the feature of the first memory space and the position of the second memory space, such as, if the memory area that the memory area that the first memory space is corresponding is corresponding with the second memory space is adjacent, and second after memory area corresponding to memory space be positioned at the memory area that the first memory space is corresponding, then application program can after determining the initial address of address of the first memory space, information according to the data length that dma controller sends, from the initial address of the address of the first memory space, using the data with the data length that dma controller sends that read as the data frame head of Frame and data volume;If the memory area that the memory area that the first memory space is corresponding is corresponding with the second memory space is non-adjacent, then application program can behind the address of the address and the second memory space of determining the first memory space, the data length of the data frame head according to Frame, data by the data length of memory area read data frame head corresponding for the address from the first memory space, data frame head as Frame, and the data length of the data volume according to Frame, memory area corresponding for address from the second memory space is read the data of the data length of data volume, data volume as Frame.
Embodiment three
This embodiment three provides the reception device of a kind of data, this device can be applied in embedded systems, further, this device can be applied in dma controller, by applying the technical program in embedded systems, it can be avoided that the problem that the Frame that reads from memory space of application program is inconsistent with the Frame of actual transmissions such that it is able to reach to improve the purpose of the success rate that application program reads data.
Fig. 5 illustrates the structural representation receiving device of a kind of data that the embodiment of the present invention two provides, as it is shown in figure 5, this device includes:
Data frame head memory element 501, data frame head storage monitoring unit 502, data frame head read unit 503, the information transmitting unit 504 of data length and data volume memory element 505, wherein:
Data frame head memory element 501, for the data frame head of the Frame of reception is stored in the first memory space, data frame head carries the information of the data length for characterizing Frame;
Data frame head storage monitoring unit 502, is used for determining whether data frame head memory element 501 receives and stored data frame head;
Data frame head reads unit 503, for, after data frame head storage monitoring unit 502 determines that data frame head memory element 501 receives and stored data frame head, reading the data frame head that the first memory space preserves;
The information transmitting unit 504 of data length, the information of the data length that the data frame head read for data frame head reads unit 503 carries sends to the application program being used for processing Frame;
Data volume memory element 505, for, after data frame head storage monitoring unit 502 determines that data frame head memory element 501 receives and stored data frame head, being stored in the second memory space by the data volume of the Frame of reception.
In the preferred implementation that the embodiment of the present invention three provides, the data frame head storage monitoring unit 502 that Fig. 5 shown device includes, specifically for monitoring after memory area corresponding to the first memory space all taken by data frame head, determine that data frame head memory element receives and stored data frame head, wherein, the memory area size that the first memory space is corresponding is mated with the data length of data frame head;Or when the data length monitoring memory area corresponding to the first memory space size taken by data frame head and the data frame head pre-saved mates, it is determined that data frame head memory element receives and has stored data frame head.
Fig. 6 illustrates the reception device of another data that the present embodiment three provides, and this device can be applied in embedded systems, and further, this device can be applied in the equipment for processing the data after receiving and preserving, and as shown in Figure 6, this device includes:
The information receiving unit 601 of data length, data volume storage complete to determine that unit 602 and Frame read unit 603, wherein:
The information receiving unit 601 of data length, for receiving the information of the data length of the Frame for characterizing reception that direct memory access dma controller sends;
Data volume storage completes to determine unit 602, the information of the data length for receiving according to the information receiving unit 601 of data length, it is determined that whether dma controller completes to receive the operation of the also data volume of store frames of data;
Frame reads unit 603, for after data volume storage completes to determine that unit 602 determines the data volume that dma controller received and stored Frame, reading DMA controller is received and saved in the data frame head of the Frame of the first memory space and dma controller is received and saved in the data volume of the second memory space.
In the preferred implementation that the embodiment of the present invention three provides, the data volume storage that Fig. 6 shown device includes completes to determine unit 602, the data length corresponding specifically for the information by data length and the difference of the data length of data frame head, it is determined that for the data length of data volume;Data length according to data volume, it is determined that the data volume of the data length of reception is stored in the duration that the second memory space needs by dma controller;And after duration, it is determined that dma controller receives and has stored data volume.
In the preferred implementation that the embodiment of the present invention three provides, the Frame that Fig. 6 shown device includes reads unit 603, if after being positioned at, specifically for the memory area that memory area is adjacent and the second memory space is corresponding that the memory area that the first memory space is corresponding is corresponding with the second memory space, the memory area that the first memory space is corresponding, it is determined that the initial address of the address of the first memory space;And according to the information of data length that dma controller sends, from the initial address of the address of the first memory space, read the data of data length as the data frame head of Frame and data volume.
In the preferred implementation that the embodiment of the present invention three provides, the Frame that Fig. 6 shown device includes reads unit 603, if the memory area corresponding with the second memory space specifically for the memory area that the first memory space is corresponding is non-adjacent, it is determined that the address of the first memory space and the address of the second memory space;The data length of the data frame head according to Frame, the data of the data length of the memory area read data frame head corresponding from the address of the first memory space, as the data frame head of Frame;And the data length of the data volume according to Frame, the memory area corresponding from the address of the second memory space reads the data of the data length of data volume, as the data volume of Frame.
Should be appreciated that the unit that apparatus above includes is only the logical partitioning that the function realized according to this device carries out, in practical application, it is possible to carry out superposition or the fractionation of said units.And the method for reseptance flow process one_to_one corresponding of a kind of data that the function that the device that this embodiment provides realizes provides with above-described embodiment, for the handling process specifically that this device realizes, said method embodiment is described in detail, is not described in detail herein.
Further, the device that receives of the data in the present embodiment three also has the functional module being capable of embodiment one and embodiment two scheme, repeats no more herein.
Although having been described for the preferred embodiment of the application, but those skilled in the art are once know basic creative concept, then these embodiments can be made other change and amendment.So, claims are intended to be construed to include preferred embodiment and fall into all changes and the amendment of the application scope.
Obviously, the present invention can be carried out various change and modification without deviating from the spirit and scope of the present invention by those skilled in the art.So, if these amendments of the present invention and modification belong within the scope of the claims in the present invention and equivalent technologies thereof, then the present invention is also intended to comprise these change and modification.

Claims (15)

1. the method for reseptance of data, it is characterised in that including:
The data frame head of the Frame of reception is stored in the first memory space by direct memory access dma controller, described data frame head carries the information of the data length for characterizing described Frame, after determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame, and, after determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space;
The information of the described data length that described application program sends according to described dma controller, after determining that described dma controller receives and stored described data volume, read the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation, concrete, described application program is by the difference of data length corresponding for the information of described data length Yu the data length of described data frame head, it is determined that for the data length of described data volume;Data length according to described data volume, it is determined that the data volume of the described data length received is stored in the duration that the second memory space needs by described dma controller;And after described duration, it is determined that described dma controller receives and has stored described data volume.
2. the method for claim 1, it is characterised in that dma controller is determined reception and stored described data frame head, including:
Dma controller is monitoring after memory area corresponding to described first memory space all taken by described data frame head, determine reception and stored described data frame head, wherein, the memory area size that described first memory space is corresponding is mated with the data length of described data frame head;Or
Dma controller is when the data length monitoring memory area corresponding to described first the memory space size taken by described data frame head and the described data frame head pre-saved mates, it is determined that receive and stored described data frame head.
3. the method for claim 1, it is characterized in that, after the memory area that the memory area that memory area that described first memory space is corresponding is corresponding with described second memory space is adjacent and described second memory space is corresponding is positioned at the memory area that described first memory space is corresponding;
Application program reads the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation, including:
Application program determines the initial address of the address of described first memory space;And
Information according to the data length that described dma controller sends, from the initial address of the address of described first memory space, reads the data of described data length as the data frame head of described Frame and data volume.
4. the method for claim 1, it is characterised in that the memory area that memory area that described first memory space is corresponding is corresponding with described second memory space is non-adjacent;
Application program reads the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation, including:
Application program determines the address of described first memory space and the address of described second memory space;
The data length of the data frame head according to described Frame, the memory area corresponding from the address of described first memory space reads the data of the data length of described data frame head, as the data frame head of described Frame;And
The data length of the data volume according to described Frame, the memory area corresponding from the address of described second memory space reads the data of the data length of described data volume, as the data volume of described Frame.
5. the method for reseptance of data, it is characterised in that including:
The data frame head of the Frame of reception is stored in the first memory space by direct memory access dma controller, and described data frame head carries the information of the data length for characterizing described Frame;
Determine reception and stored described data frame head, concrete, dma controller is monitoring after memory area corresponding to described first memory space all taken by described data frame head, determine reception and stored described data frame head, wherein, the memory area size that described first memory space is corresponding is mated with the data length of described data frame head;Or, dma controller is when the data length monitoring memory area corresponding to described first the memory space size taken by described data frame head and the described data frame head pre-saved mates, it is determined that receive and stored described data frame head;
After determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame;And
After determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space.
6. the method for reseptance of data, it is characterised in that including:
Application program receives the information of the data length of the Frame for characterizing reception that direct memory access dma controller sends;
Information according to described data length, determine that described dma controller receives and stored the data volume of described Frame, concrete, described application program is by the difference of data length corresponding for the information of described data length Yu the data length of described data frame head, it is determined that for the data length of described data volume;
Data length according to described data volume, it is determined that the data volume of the described data length received is stored in the duration that the second memory space needs by described dma controller;And after described duration, it is determined that described dma controller receives and has stored described data volume;
After determining the data volume that described dma controller received and stored described Frame, read described dma controller and be received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space.
7. method as claimed in claim 6, it is characterized in that, after the memory area that the memory area that memory area that described first memory space is corresponding is corresponding with described second memory space is adjacent and described second memory space is corresponding is positioned at the memory area that described first memory space is corresponding;
Application program reads described dma controller and is received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space, including:
Application program determines the initial address of the address of described first memory space;And
Information according to the data length that described dma controller sends, from the initial address of the address of described first memory space, reads the data of described data length as the data frame head of described Frame and data volume.
8. method as claimed in claim 6, it is characterised in that the memory area that memory area that described first memory space is corresponding is corresponding with described second memory space is non-adjacent;
Application program reads described dma controller and is received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space, including:
Application program determines the address of described first memory space and the address of described second memory space;
The data length of the data frame head according to described Frame, the memory area corresponding from the address of described first memory space reads the data of the data length of described data frame head, as the data frame head of described Frame;And
The data length of the data volume according to described Frame, the memory area corresponding from the address of described second memory space reads the data of the data length of described data volume, as the data volume of described Frame.
9. the reception system of data, it is characterised in that including:
Direct memory access dma controller and application program, wherein:
Described dma controller, for the data frame head of the Frame of reception is stored in the first memory space, described data frame head carries the information of the data length for characterizing described Frame, after determining reception and having stored described data frame head, read the described data frame head that described first memory space preserves, and the information of the described data length carried by described data frame head sends to the application program being used for processing described Frame, and, after determining reception and having stored described data frame head, the data volume of the described Frame received is stored in the second memory space;
Described application program, the information of the described data length for sending according to described dma controller, after determining that described dma controller receives and stored described data volume, read the described data frame head of described first memory space preservation and the described data volume of described second memory space preservation.
10. the reception device of data, it is characterised in that including:
Data frame head memory element, for the data frame head of the Frame of reception is stored in the first memory space, described data frame head carries the information of the data length for characterizing described Frame;
Data frame head storage monitoring unit, is used for determining whether described data frame head memory element receives and stored described data frame head;
Data frame head reads unit, for, after described data frame head storage monitoring unit determines that described data frame head memory element receives and stored described data frame head, reading the described data frame head that described first memory space preserves;
The information transmitting unit of data length, the information of the described data length that the data frame head read for described data frame head reads unit carries sends to the application program being used for processing described Frame;
Data volume memory element, for, after described data frame head storage monitoring unit determines that described data frame head memory element receives and stored described data frame head, being stored in the second memory space by the data volume of the described Frame received.
11. device as claimed in claim 10, it is characterized in that, described data frame head storage monitoring unit, specifically for monitoring after memory area corresponding to described first memory space all taken by described data frame head, determine that described data frame head memory element receives and stored described data frame head, wherein, the memory area size that described first memory space is corresponding is mated with the data length of described data frame head;Or when the data length monitoring memory area corresponding to described first the memory space size taken by described data frame head and the described data frame head pre-saved mates, it is determined that described data frame head memory element receives and has stored described data frame head.
12. a direct memory access dma controller, it is characterised in that include the reception device of data described in claim 10 or claim 11.
13. the reception device of data, it is characterised in that including:
The information receiving unit of data length, for receiving the information of the data length of the Frame for characterizing reception that direct memory access dma controller sends;
Data volume storage completes to determine unit, the information of the data length for receiving according to the information receiving unit of described data length, it is determined that whether described dma controller completes to receive and store the operation of the data volume of described Frame;The data length corresponding specifically for the information by described data length and the difference of the data length of described data frame head, it is determined that for the data length of described data volume;Data length according to described data volume, it is determined that the data volume of the described data length received is stored in the duration that the second memory space needs by described dma controller;And after described duration, it is determined that described dma controller receives and has stored described data volume;
Frame reads unit, for after described data volume storage completes to determine that unit determines the data volume that described dma controller received and stored described Frame, read described dma controller and be received and saved in the data frame head of described Frame of the first memory space and described dma controller is received and saved in the described data volume of described second memory space.
14. device as claimed in claim 13, it is characterized in that, described Frame reads unit, if after adjacent specifically for memory area that the memory area that described first memory space is corresponding is corresponding with described second memory space and that described second memory space is corresponding memory area is positioned at the memory area that described first memory space is corresponding, it is determined that the initial address of the address of described first memory space;And the information of the data length sent according to described dma controller, from the initial address of the address of described first memory space, read the data of described data length as the data frame head of described Frame and data volume.
15. device as claimed in claim 13, it is characterized in that, described Frame reads unit, if the memory area corresponding with described second memory space specifically for the memory area that described first memory space is corresponding is non-adjacent, it is determined that the address of described first memory space and the address of described second memory space;The data length of the data frame head according to described Frame, the memory area corresponding from the address of described first memory space reads the data of the data length of described data frame head, as the data frame head of described Frame;And the data length of the data volume according to described Frame, the memory area corresponding from the address of described second memory space reads the data of the data length of described data volume, as the data volume of described Frame.
CN201210214211.6A 2012-06-26 2012-06-26 The method of reseptance of a kind of data, system and device Expired - Fee Related CN103514126B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201210214211.6A CN103514126B (en) 2012-06-26 2012-06-26 The method of reseptance of a kind of data, system and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201210214211.6A CN103514126B (en) 2012-06-26 2012-06-26 The method of reseptance of a kind of data, system and device

Publications (2)

Publication Number Publication Date
CN103514126A CN103514126A (en) 2014-01-15
CN103514126B true CN103514126B (en) 2016-07-20

Family

ID=49896874

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201210214211.6A Expired - Fee Related CN103514126B (en) 2012-06-26 2012-06-26 The method of reseptance of a kind of data, system and device

Country Status (1)

Country Link
CN (1) CN103514126B (en)

Families Citing this family (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109347957A (en) * 2018-10-22 2019-02-15 北京广利核系统工程有限公司 Communication data memory management method, device and looped network board based on FPGA
CN111405040B (en) * 2020-03-16 2021-05-07 北京星际荣耀空间科技股份有限公司 Real-time data processing method, device and equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101158930A (en) * 2007-11-19 2008-04-09 中兴通讯股份有限公司 Method and device for external controlling DMA controller
CN101263464A (en) * 2005-09-16 2008-09-10 英特尔公司 Parallel processing of frame based data transfers
CN101556564A (en) * 2008-04-11 2009-10-14 联芯科技有限公司 Data receiving/sending method and device
CN101636721A (en) * 2006-11-28 2010-01-27 Lm爱立信电话有限公司 Be used to handle the DMAC of unknown lengths transmission

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101263464A (en) * 2005-09-16 2008-09-10 英特尔公司 Parallel processing of frame based data transfers
CN101636721A (en) * 2006-11-28 2010-01-27 Lm爱立信电话有限公司 Be used to handle the DMAC of unknown lengths transmission
CN101158930A (en) * 2007-11-19 2008-04-09 中兴通讯股份有限公司 Method and device for external controlling DMA controller
CN101556564A (en) * 2008-04-11 2009-10-14 联芯科技有限公司 Data receiving/sending method and device

Also Published As

Publication number Publication date
CN103514126A (en) 2014-01-15

Similar Documents

Publication Publication Date Title
CN103401909A (en) Data interaction method and system based on BS (browser/server), client end and server
CN104967635A (en) Data transmission method and apparatus thereof
CN104185036A (en) Video file source returning method and device
CN106095622A (en) Data back up method and device
CN104092815A (en) Method and device for inter-application information interaction based on Android system
US20170033980A1 (en) Agent manager for distributed transaction monitoring system
CN111371704B (en) Data caching method and device, terminal equipment and storage medium
CN103514126B (en) The method of reseptance of a kind of data, system and device
CN103412771A (en) Software upgrading processing method, device and system
CN106383667A (en) Method and apparatus for LUN migration in business operation
CN105808345A (en) Data processing method, acceleration engine, control panel and system
CN103795856A (en) Information processing method and electronic device
CN109981798A (en) A kind of method for writing data, system and electronic equipment and storage medium
CN105471930A (en) Method, system and equipment for reading distributed data
CN102055811A (en) Method and system for writing equipment ID
CN114996134A (en) Containerized deployment method, electronic equipment and storage medium
CN109800202B (en) PCIE (peripheral component interface express) -based data transmission system, method and device
CN111274176B (en) Information processing method, electronic equipment, system and storage medium
CN111371799B (en) Method, device and equipment for controlling data receiving and transmitting of MCTP (Multi-channel media Port) controller
CN114024878A (en) Data transmission method, device, medium and equipment
CN103399949B (en) A kind of database storage block state control method and device
CN101241478B (en) Data transfer method
CN104580328A (en) Virtual machine migration method, device and system
CN109753461B (en) DMA device and data transmission method
CN111124907A (en) Mobile phone game testing method and device and server

Legal Events

Date Code Title Description
C06 Publication
PB01 Publication
C10 Entry into substantive examination
SE01 Entry into force of request for substantive examination
C14 Grant of patent or utility model
GR01 Patent grant
TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20180222

Address after: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou, Guangzhou economic and Technological Development Zone, Guangdong Province, No. 10

Co-patentee after: Comba Telecom Systems (Guangzhou) Co., Ltd.

Patentee after: Comba Telecom System (China) Co., Ltd.

Co-patentee after: Jingxin Communication Technology (Guangzhou) Co., Ltd.

Co-patentee after: TIANJIN COMBA TELECOM SYSTEMS CO., LTD.

Address before: 510663 Guangzhou Science City, Guangdong Shenzhou Road, No. 10

Patentee before: Comba Telecom Systems (Guangzhou) Co., Ltd.

TR01 Transfer of patent right
TR01 Transfer of patent right

Effective date of registration: 20200108

Address after: 510663 No. 10, Shenzhou Road, Science City, Guangzhou, economic and Technological Development Zone, Huangpu District, Guangzhou, Guangdong Province

Patentee after: Jingxin Communication System (China) Co., Ltd.

Address before: 510663 Shenzhou Road, Guangzhou Science City, Guangzhou, Guangzhou economic and Technological Development Zone, Guangdong Province, No. 10

Co-patentee before: Jingxin Communication System (Guangzhou) Co., Ltd.

Patentee before: Jingxin Communication System (China) Co., Ltd.

Co-patentee before: Jingxin Communication Technology (Guangzhou) Co., Ltd.

Co-patentee before: TIANJIN COMBA TELECOM SYSTEMS CO., LTD.

CF01 Termination of patent right due to non-payment of annual fee
CF01 Termination of patent right due to non-payment of annual fee

Granted publication date: 20160720

Termination date: 20210626