Data processing method and device
Technical field
The present invention relates to data card technical field, particularly relate to a kind of data processing method and device.
Background technology
USB(Universal Serial Bus, USB (universal serial bus)) standard that become computer realm connects
Vocal imitation skill, owing to it has the feature such as plug and play, easy to use, low cost, rapidly be industry
Strong backing, has become the bus standard of main flow the most.USB is widely used in tradition PC(Personal
Computer, PC) peripheral hardware, such as mouse, keyboard, display etc., movable storage device is as moved
Dynamic hard disk, flash disk etc., and emerging consumer electronics, as MP3 player, digital camera,
Mobile phone etc..Meanwhile, its range of application is also constantly expanding, data communication system based on USB
Also increasing, wherein, the most representational for USB data card.
The uplink service of USB data card needs to follow NDIS(Network Driver Interface
Standard, NetWare Driver Interface Specification) serial mode that requires.At present, data based on USB
When card carries out data transmission, the transfer process of packet is: PC(Personal Computer, Ge Ren electricity
Brain) operating system usb data that packet is sent in PC by the interface called according to NDIS
Card driver;USB data card driver is sent to usb data by usb bus packet
Card;After USB data card acknowledges receipt of this packet, USB data card driver reinforms PC
This packet of operating system is sent completely;PC operating system receives USB data card driver and sends
Usb bus sent the message of this packet;PC operating system can decide whether to send out according to demand
Send next packet.
Above-mentioned existing USB data transmission mode, when carrying out the transmission of packet, PC operating system
Must etc. previous packet send to USB data card, and receive USB data card driver send
Completion message after, just again can send next packet to USB data card driver.By
Fast less than the transmission of usb bus in PC operating system and the rate of interaction of USB data card driver
Rate so that the efficiency of transmission of usb bus can not be fully used, causes USB data transmission speed
Low.
Summary of the invention
The invention provides a kind of data processing method and device, to solve existing USB data transmission
Mode is when carrying out the transmission of packet, and the efficiency of transmission of usb bus can not be fully used, USB
The problem that message transmission rate is low.
In order to solve the problems referred to above, the invention discloses a kind of data processing method, including: receive user
The packet that equipment sends;Data in described packet are set rule according to first and copies to task control
In clamp dog, and it is completion status by the data setting in described task control block;Call USB (universal serial bus)
Interface sends the data in described task control block to described USB (universal serial bus) data card, continues to connect simultaneously
Receive other packets that described subscriber equipment sends, and by the data in other packets described according to described
First sets rule copies in other task control blocks respectively, is organized into by other task control blocks described
Task control block chained list to be sent;Data in the described task control block being set as completion status send
After completing, set rule to each task control in described task control block chained list to be sent according to second
Data in block package;Call the described data after described USB transmission group bag extremely
Described USB (universal serial bus) data card.
In order to solve the problems referred to above, the invention also discloses a kind of data processing equipment, including: receive mould
Block, for receiving the packet that subscriber equipment sends;Replication module, for by the number in described packet
Copy in task control block according to setting rule according to first, and the data in described task control block are set
It is set to completion status;Molded tissue block, is used for calling USB to described USB (universal serial bus)
Data card sends the data in described task control block, continues to the transmission of described subscriber equipment its simultaneously
His packet, and the data in other packets described are set rule according to described first copy to respectively
In other task control blocks, other task control blocks described are organized into task control block chained list to be sent;
Group bag module, after the data in the described task control block being set as completion status are sent completely,
Rule is set in each task control block in described task control block chained list to be sent according to second
Data package;Sending module, the institute after calling described USB transmission group bag
State data to described USB (universal serial bus) data card.
Compared with prior art, the invention have the advantages that
Data processing scheme in the present invention, the subscriber equipment at USB data card driver place is to USB
When data card sends packet, after receiving a packet to be sent, packet is replicated and takes office
Business controls in block, and the packet being replicated is set as completion status.When the packet being replicated is set
After being set to completion status, this is set as that the packet of completion status is sent to USB number by USB interface
According to card;Meanwhile, also continue to receive the packet that subscriber equipment sends, it is to avoid in prior art,
Need to send to USB data card the packet received, just can continue to next packet,
Thus cause data processing speed slow, the problem that message transmission rate is low.Additionally, also by receive its
Data in his packet copy to form task control block chained list to be sent in task control block, are setting
After being sent completely for the data in the described task control block of completion status, by task control block chain to be sent
The data in each task control block in table package, and are sent to USB by USB interface in the lump
In data card, solving in existing technology, USB data card driver can only send a number every time
According to bag to USB data card, the efficiency of transmission of usb bus can not be fully used, data transmission speed
The problem that rate is low.By the data processing scheme in the present invention, carry out packet caching, organize bag after send out
Deliver to USB data card, take full advantage of the efficiency of transmission of usb bus, improve the transmission speed of data
Rate.
Accompanying drawing explanation
Fig. 1 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention;
Fig. 2 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention two;
Fig. 3 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention three;
Fig. 4 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention four;
Fig. 5 is the flow chart of steps of a kind of data processing method of according to embodiments of the present invention five;
Fig. 6 is the concrete steps flow process using the data processing method in embodiment five to package data
Figure;
Fig. 7 is that the packet after the group bag obtaining the data processing method used in embodiment five solves
The particular flow sheet of bag;
Fig. 8 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention six;
Fig. 9 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention seven;
Figure 10 is the structured flowchart of a kind of data processing equipment of according to embodiments of the present invention eight.
Detailed description of the invention
Understandable, below in conjunction with the accompanying drawings for enabling the above-mentioned purpose of the present invention, feature and advantage to become apparent from
The present invention is further detailed explanation with detailed description of the invention.
Embodiment one
With reference to Fig. 1, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention one.
The data processing method of the present invention is illustrated by the present embodiment from usb data sending side, this reality
The step of the data process executing example is as follows:
Step S102: receive the packet that subscriber equipment sends.
Data processing method in the present embodiment processes dress by the data being integrated with USB data card driver
Putting realization, this data processing equipment is arranged on terminal unit such as PC, and PC operating system passes through USB
Data card driver sends the packet needing to send to USB data card, and USB data card drives journey
Sequence is called USB interface and is sent packet to USB data card, and PC passes through USB data card driver
Need during calling interface to follow NDIS.
Step S104: the data in packet are set rule according to first and copies in task control block,
And be completion status by the data setting in task control block.
When receiving packet, by USB data card driver, the data in packet can be copied to
In task control block.
First sets rule can be appropriately arranged with according to practical situation by those skilled in the art, e.g., permissible
Directly control that block chained list extracts an idle task from idle task and control block by the data in packet
Copy to this idle task control in block;One can also be taken out from task control block chained list to be sent
Data in packet are copied in task control block to be sent by task control block to be sent.
After the data in packet are copied in task control block, the data in task control block are set
It is set to completion status.When the data in task block are completion status, USB data card driver should
Feedback of status follows NDIS agreement, according to demand calling interface to PC operating system, PC operating system
Continue through USB data card driver and send the packet needing to send to USB data card.Need
Illustrating, USB data card driver is not the most ceaselessly the data in task control block to be set
Be set to completion status, when the data in task block reach a certain amount of, will not continue by data setting be
Completion status, but state undetermined, now, PC operating system will not drive to USB data card again
Program sends packet.
Step S106: call USB interface and send the data in task control block to USB data card, with
Time continue to other packets that subscriber equipment sends, and by the data in other packets according to first
Set rule to copy to respectively, in other task control blocks, other task control blocks are organized into be sent
Business controls block chained list.
Data in these chained lists are when the USB interface free time, it will sent to USB data card by group bag.
That is, data send and data receiver is carried out simultaneously, thus it is effectively improved data and processes and send out
Send efficiency.
Step S108: after the data in the task control block being set as completion status are sent completely, press
Set rule according to second the data in each task control block in task control block chained list to be sent are entered
Row group bag.
After data in the task control block being set as completion status are sent completely, i.e. USB interface is empty
Idle, it will the data being cached in task control block chained list to be sent are packaged, group is wrapped
Data sent in USB data card by USB interface in the lump.
Wherein, second sets rule can be appropriately arranged with according to the actual requirements by those skilled in the art, as
Directly the data in the task control block setting quantity are packaged, or, by one or more tasks
Control to package etc. again after the data in block copy in the task control block in the most available free space.
Step S110: call the data after USB interface transmission group bag to USB data card.
The data processing method provided by the present embodiment, the user at USB data card driver place sets
Standby when USB data card sends packet, after receiving a packet to be sent, by data
Packet replication is in task control block, and the packet being replicated is set as completion status.When be replicated
After packet is set to completion status, this is set as that the packet of completion status is sent out by USB interface
Deliver to USB data card;Meanwhile, also continue to receive other packets that subscriber equipment sends, keep away
Exempt from prior art, needed to be sent extremely by the packet received by USB data card driver
After USB data card, the problem that just can continue to next packet, thus cause data processing speed
Slowly, the problem that message transmission rate is low.Additionally, also use USB data card driver to receive
Other packets in data copy to task control block forms task control block chained list to be sent,
After the data being set as in the task control block of completion status are sent completely, by task control block chain to be sent
The data in each task control block in table package, and are sent to USB by USB interface in the lump
In data card, solving in existing technology, USB data card driver can only send a number every time
According to bag to USB data card, the efficiency of transmission of usb bus can not be fully used, data transmission speed
The problem that rate is low.By the data processing method in the present embodiment, after carrying out packet caching, organizing bag
Send to USB data card, take full advantage of the efficiency of transmission of usb bus, improve the transmission of data
Speed.
Embodiment two
With reference to Fig. 2, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention two.
The data processing method of the present invention is still illustrated by the present embodiment from usb data sending side, this
Embodiment carries out the process of data with the data processing equipment that USB data card driver is integrated,
Specifically comprising the following steps that of data processing method
The integrated data processing equipment of step S202:USB data card driver receives subscriber equipment and sends out
The packet sent.
Data processing equipment integrated for USB data card driver is installed on terminal by the present embodiment set
On standby such as PC, PC operating system is sent by USB data card driver to be needed to usb data
The packet that card sends, USB data card driver is sent out to USB data card by calling USB interface
The packet sent.Wherein, PC operating system needs when calling USB interface to follow NDIS agreement.
The integrated data processing equipment of step S204:USB data card driver is by the number in packet
Copy in task control block according to setting rule according to first, and by the data setting in task control block be
Completion status.
Preferably, the data in packet are pressed by the data processing equipment that USB data card driver is integrated
Set the regular concrete steps copied in task control block according to first to include: USB data card driver
Integrated data processing equipment judges whether there is task control to be sent in USB data card driver
Clamp dog;If existing, then the data in the packet sent by subscriber equipment copy to one still free free time
Between task control block to be sent in, wherein, this free space is more than or equal to packet to be copied
Size;If not existing, then control block chained list extracts an idle task control block from idle task,
Data in packet are copied in the idle task control block extracted.
The integrated data processing equipment of step S206:USB data card driver is calling USB interface
While the data that USB data card sends in task control block, continue to what subscriber equipment sent
Other packets, and the data in other packets are copied to other respectively according to the first setting rule
Business controls, in block, other task control blocks to be organized into task control block chained list to be sent.
The data processing equipment use USB data card driver general that USB data card driver is integrated
The packet received copies in task control block, before replicating data, select to replicate data
In which task control block.If in task block chained list to be sent, there is task control to be sent
The most available free space in clamp dog, and this task control block to be sent, and free space more than or etc.
Size in packet to be copied, then, by selecting this task control block to be sent, replicate and connect
Data in other packets received, data and the original data in task control block to be sent that will replicate
Package.If in task block chained list to be sent, there is not task control block to be sent, or,
Do not have free space to be more than or equal to the task control block of size of packet to be copied, then appoint from the free time
Business controls to extract in block chained list an idle task control block, copies to the data in packet extract
Idle task control block in.
When the packet in task control block chained list to be sent reaches some, USB data card drives
The data in task control block that the integrated data processing equipment of program will not may be copied to again continue to set
For completion status, but set it to other states, state the most undetermined.The most now, USB
The integrated data processing equipment of data card driver will be this feedback of status to subscriber equipment, Yong Hushe
The standby calling interface that will not be further continued for sends packet.
The integrated data processing equipment of step S208:USB data card driver is being set as shape
After data in the task control block of state are sent completely, from task control block chained list to be sent, extract one
Task control block to be sent.
The integrated data processing equipment of step S210:USB data card driver judges task to be sent
Control whether block chained list exists other task control blocks to be sent.If not existing, then perform step
S212;If existing, then perform step S214.
Step S212: when judging not exist in task control block chained list to be sent other tasks to be sent
When controlling block, the integrated data processing equipment of USB data card driver directly invokes USB interface and sends out
Send the data in the task control block of extraction to USB data card, terminate this flow process.
Step S214: when judging to there is other task controls to be sent in task control block chained list to be sent
During clamp dog, then the data processing equipment that USB data card driver is integrated is from task control block to be sent
Chained list extracts other task control blocks to be sent again, in the task control block all to be sent extracted
Data package.
Specifically, the data processing equipment that USB data card driver is integrated is from task control block to be sent
Chained list extracts other task control blocks to be sent again, in the task control block all to be sent extracted
The step that packages of data include:
The integrated data processing equipment of step S2142:USB data card driver is from task control to be sent
Clamp dog chained list extracts other task control block to be sent again.
The data processing equipment judgement successively extraction that step S2144:USB data card driver is integrated
Whether the data volume size sum of two task control blocks to be sent is less than or equal to setting value;If so,
Then perform step S2146;If it is not, then perform step S2148.
Wherein, setting value can be appropriately arranged with according to practical situation by those skilled in the art, more preferably,
Setting value can be arranged to 32KB, naturally it is also possible to is other value.
Step S2146: if the data volume size sum of two task control blocks to be sent is less than or equal to
Setting value, then to be sent the appointing that the data processing equipment that USB data card driver is integrated will extract
The data that business controls in a task control block in block copy to carry out in another task control block group
Bag, and the task control block being replicated data is linked into idle task control block chained list, return step
S210。
Wherein, replicate and the task control block that is replicated can be any in two task control blocks
Individual.
After the data in a task control block are copied in another task control block, will be replicated
The task control block of data is linked into idle task and controls block chained list, returns step S210 and continues to judge
Whether task control block chained list to be sent exists other task control blocks to be sent.
When the data in each task control block in task control block chained list to be sent are packaged,
Can package to sent each packet in task control block successively.During group bag, Mei Dangyi
When data in individual task control block to be sent are copied in another task control block to be sent, i.e. enter
During row every time group bag, all can revise total bag number of data in the packet after group bag, and each data
The bag long message of bag.Packet after group bag includes: total bag number of packet of group bag, each data
The bag length of bag and real data.
Step S2148: if the data volume size sum of two task control blocks to be sent be more than described in set
Definite value, then the data processing equipment that USB data card driver is integrated drives journey by USB data card
The task control block to be sent of rear extraction is put back in task control block chained list to be sent by sequence, performs step
S216。
The integrated data processing equipment of step S216:USB data card driver calls USB interface and sends out
Send the data after group bag to USB data card.
The data processing method provided by the present embodiment, at the data that USB data card driver is integrated
Reason device, when USB data card sends packet, is receiving the packet that subscriber equipment sends
After, packet is copied in task control block, and the packet being replicated is set as completion status.
After the packet being replicated is set to completion status, this is set as that the packet of completion status passes through
USB interface sends to USB data card;Meanwhile, also continue to receive subscriber equipment send other
Packet, it is to avoid in prior art, need the number that will be received by USB data card driver
Send to USB data card according to bag, just can continue to next packet, thus cause at data
Reason speed is slow, the problem that message transmission rate is low.Additionally, use USB data card driver to connect
Data in other packets received copy to form task control block chain to be sent in task control block
Table, after the data in the described task control block being set as completion status are sent completely, by packet
Data cache, after the USB interface free time, by each in task control block chained list to be sent
Data in task control block package, and are sent to USB data card by USB interface in the lump,
Solve in existing technology, a packet can only be sent by USB data card driver every time
To USB data card, the efficiency of transmission of usb bus can not be fully used, and message transmission rate is low
Problem.By the data processing method in the present embodiment, by USB data card driver by number
Send after carrying out caching according to bag, organize bag to USB data card, take full advantage of the transmission effect of usb bus
Rate, improves the transfer rate of data.
Embodiment three
With reference to Fig. 3, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention three.
The present embodiment receives side from usb data and illustrates the data processing method the present invention, this
What the data of embodiment processed specifically comprises the following steps that
Step S302:USB data card is received USB data card driver and is sent by USB interface
Group bag after packet.Wherein, group bag after packet by USB data card driver by with
Under type packages: USB data card driver receives the packet that subscriber equipment sends;By data
Data in bag set rule according to first and copy in task control block, and by the number in task control block
According to being set as completion status;The number in task control block is sent to USB data card calling USB interface
While according to, continue to other packets needing to send to USB data card, and by other data
Data in bag set rule according to first and copy in other task control blocks respectively, by other task controls
Clamp dog is organized into task control block chained list to be sent;Number in the task control block being set as completion status
After being sent completely, set rule to each task control in task control block chained list to be sent according to second
Data in clamp dog package.
It should be noted that USB data card driver is setting rule to the number received according to first
Copy to the process in task control block according to the data in bag refer in embodiment one or embodiment two
Reproduction process.Further, rule is being set to sent each in task control block chained list according to second
The process that data in task control block package, it is possible to the group in reference example one or embodiment two
Packet procedures.
Packet after reception group is wrapped by step S304:USB data card unpacks.
By the data processing method provided in the present embodiment, receive in USB data card and set through terminal
After packet after the USB data card driver group bag of standby side, USB data card is by the number after group bag
It is reduced to raw data packets according to bag, and then the data in each packet are processed, it is to avoid be existing
USB data transmission in, on the one hand, need drive to USB data card after having received a packet
Dynamic program side returns and confirms that response could receive next packet again, and data transmission bauds and efficiency are equal
Low problem;On the other hand, the reception of this individual data bag also results in USB data card and to have processed
If needs process next packet after the data of a packet, then also wait for next data
Bag sends and could process it to USB data card again, causes the problem that treatment effeciency is low, joint
Save and waited that packet sends the time to USB data card, improve the transfer rate of data.
Embodiment four
With reference to Fig. 4, it is shown that the flow chart of steps of a kind of data processing method of the embodiment of the present invention four.
The present embodiment still receives side from usb data and illustrates the data processing method the present invention,
Specifically comprising the following steps that of the data processing method of the present embodiment
Step S402:USB data card is received USB data card driver and is sent by USB interface
Group bag after packet.
Wherein, the packet after group bag is packaged in the following manner by USB data card driver:
USB data card driver receives the packet that subscriber equipment sends;By the data in packet according to
One sets rule copies in task control block, and by the data setting in task control block for completing shape
State;While calling USB interface data in USB data card transmission task control block, continue
Receive other packets that subscriber equipment sends, and the data in other packets are set rule according to first
Copy to the most respectively, in other task control blocks, other task control blocks are organized into task control to be sent
Block chained list;After data in the task control block being set as completion status are sent completely, set according to second
Data in each task control block in task control block chained list to be sent are then packaged by set pattern.
In the present embodiment, the packet after setting group bag includes: total bag number of the packet of group bag, each
The bag length of individual packet and real data.
Total bag number of the packet after step S404:USB data card acquisition group bag and each packet
Bag is long.
Total bag number of the packet after step S406:USB data card foundation group bag and each packet
Bag is long to be unpacked the packet after group bag.
Including: unwrap the beginning from first data, each packet in the packet after the bag of judgement group successively
Whether bag is long meets established standards;If being unsatisfactory for established standards, after the most directly stopping remaining group of bag
Packet unpacks;If meeting established standards, then the packet meeting established standards is unpacked also
Return whether the bag length of each packet in the packet after judging described group of bag successively meets established standards
Step.
In a kind of preferred packet judging after group bag, whether the bag length of each packet meets and sets mark
Standard is: the bag obtaining a packet is long, contrasts, this Bao Changyu setting value such as by setting value
It is set to 1500 bytes, then judge that bag is long whether less than or equal to 1500 bytes of setting value, if little
In or equal to 1500 bytes of setting value, then can determine that the long conformance with standard of bag of this packet, then can enter
Row unpacking process;If being not more than 1500 bytes of this setting value, then stop de-packaging operation, no longer to this
In packet after group bag, remaining packet unpacks.It should be noted that 1500 bytes are only
Exemplary illustration, can be the most suitable value according to requirements set.
USB data card after the bag length judging first packet meets established standards, then can replicate this number
According to the data in bag, and data are processed;When after the data processed in first packet, connect
And judge whether the bag length of second packet meets established standards, if the bag length of second packet is also
Meet established standards, then also can replicate the data in second packet, process, circulate successively
Operation, until the data in all of packet have all processed, or runs into long being unsatisfactory for of bag and sets mark
Accurate packet stops unpacking.
When the bag length of a certain packet is unsatisfactory for established standards, then illustrate that the group packet procedures of this packet can
Can there is a problem, i.e. packet after group bag there is a problem, then will stop the data after this group bag
Bag unpacks.Such as: the packet after a certain group of bag comprises 10 packets, then USB number
Successively the packet after group bag is unpacked according to card.It is assumed that the bag length of front 5 packets is all satisfied
Established standards, then front 5 packets are just unpacked by USB data card, replicate front 5 numbers
According to the data in bag, and these data are processed;During to the 6th packet, it is judged that the 6th packet
Bag length be unsatisfactory for established standards, then stopping is unpacked by USB data card, i.e. will not continue to process after
The remaining packet in limit.
By the data processing method provided in the present embodiment, receive in USB data card and set through terminal
After packet after the USB data card driver group bag of standby side, after USB data card acquisition group bag
Total bag number of packet and the bag of each packet are long, according to the bag length of total bag number and each packet to group
Packet after bag unpacks, and enables USB data card to reduce initial data, and to initial data
It is further processed.Further, during unpacking, USB data card can judge the bag of packet
Whether length meets established standards, and the bag length once packet is unsatisfactory for established standards, then can stop immediately
Unpack, it is possible to save and unpack the time, it is ensured that the accuracy of data.
Embodiment five
With reference to Fig. 5, it is shown that the flow chart of a kind of data processing method of the embodiment of the present invention five.
In the present embodiment, set USB data card driver and be arranged in PC, from PC and USB
The data processing method of the present invention is illustrated by the angle of the data interaction between data card.
The data processing method steps of the present embodiment is as follows:
Step S502:PC operating system follows NDIS agreement, according to NDIS agreement calling interface
MPSendPacket transmission upstream data bag is to the USB data card driver of PC, wherein, up
Packet is i.e. sent to the packet of USB data card.
Wherein, MPSendPacket interface is the transmission interface being registered to NDIS, when needs send IP
MpSendPacket can be called during (Internet Protocol, the agreement of interconnection between network) packet
Interface.
The state of packet is set as by step S504:USB data card driver
NDIS_STATUS_PENDING, state the most undetermined.
Step S506:USB data card driver judges task control block chained list to be sent
Whether QueueSendTCB exists task control block TCB to be sent.If existing, then perform step
S508, if not existing, then performs step S510.
Task control block chained list QueueSendTCB to be sent is to preserve TCB(Tast Control to be sent
Block, task control block) chained list of pointer.
It is multiple that step S508:USB data card driver takes out a TCB from QueueSendTCB
Data in packet processed, perform step S512.
Step S510:USB data card driver controls block chained list SendFreeList from idle task
One idle TCB of middle taking-up, the data in duplicate packet, perform step S512.
If QueueSendTCB has TCB to be sent, the data in IP packet are copied to this
In TCB;Otherwise, from SendFreeList, an idle TCB is taken out to preserve in IP packet
Data.
The state of bag is set as by step S512:USB data card driver
NDIS_STATUS_COMPLETE。
NDIS_STATUS_COMPLETE i.e. completion status, after packet has been replicated, this number
Being set to NDIS_STATUS_COMPLETE state according to the state of bag, PC operating system is in data
After the state of bag is set to NDIS_STATUS_COMPLETE state, may proceed to send next
Individual IP packet.
Step S514:USB data card driver judges that USB interface is the most idle.If it is idle, then
Perform step S516;If the most idle, then perform step S518.
Step S516:USB data card driver calls USB interface and is set as completion status
The transmission of the packet in TCB, performs step S520.
The task control block TCB replicating data is put into by step S518:USB data card driver
In QueueSendTCB, to be sent, terminate this transmission flow.
When the USB free time, USB data card driver calls USB and sends function and realize USB and connect
Mouthful, send the data in TCB;The most just TCB is got back into QueueSendTCB.
Step S520:USB data card driver determines that packet is sent completely.
After packet is sent completely, now USB is idle, and USB data card driver can call into USB
Be sent completely function.Here package action, after group bag completes, again sends.
Whether step S522:USB data card driver judges to have in QueueSendTCB to be sent
TCB.If there is TCB to be sent, then perform step S524.If there is not TCB to be sent
Then terminate this transmission flow.
Step S524:USB data card driver inquiry QueueSendTCB, and the behaviour that packages
Make, return step S516.
After execution of step S524, again return to step S516, i.e. in QueueSendTCB
Data package operation, send the data after group bag to USB data card.
Wherein, the idiographic flow of the above-mentioned operation that packages the data in QueueSendTCB is with reference to attached
Fig. 6.
Specifically, the step operated that packages the data in QueueSendTCB is as follows:
Step S602:USB data card driver determines that USB has been sent completely current packet.
Whether step S604:USB data card driver judges to have in QueueSendTCB to be sent
TCB.If existing, perform step S606;If not existing, then terminate this group packet procedures.
Step S606:USB data card driver takes a TCB out from QueueSendTCB.
For ease of difference, the named pTCB of TCB that this is extracted.
Step S608:USB data card driver judges in QueueSendTCB the most pending
The TCB sent.If existing, perform step S610;If not existing, then call USB and send function, send out
Send the data in pTCB.
Step S610:USB data card driver extracts a TCB from QueueSendTCB again
Out.
For ease of difference, the named PTempTCB of TCB that this is extracted.
The bag length of the packet in step S612:USB two TCB of data card driver inspection and be
No less than 32KB.If the bag length of the packet in two TCB and be less than or equal to 32KB, then hold
Row step S614;If more than 32KB, directly perform step S616.
If that is, PTCB and PTempTCB data meet group bag condition, by PTempTCB's
In data copy to PTCB data.PTempTCB data message is removed, and gets back into QueueTCB
In.
It should be understood that 32KB is merely illustrative, other appropriate value is equally applicable.
Data in PTempTCB are copied to PTCB by step S614:USB data card driver
In.
After data in PTempTCB are copied in PTCB, the data in PTempTCB are deleted
Remove.Packet in PTCB is packaged with the packet in PTempTCB.
Certainly, in actual applications, it is also possible to the data in PTCB are copied in PTempTCB.
PTempTCB is put back in QueueSendTCB by step S616:USB data card driver.
In step S618:USB data card driver amendment PTCB, record wraps the long and letter of bag number
Breath, calls USB and sends function, send the data in PTCB.
It should be noted that the above-mentioned the most simply group bag that packaged by PTCB with PTempTCB shows
Example, in the flow process of whole group of bag, if QueueSendTCB exists multiple TCB to be sent,
So will circulate the step of above-mentioned group of bag, the data in TCB to be sent to each package.
The form of the packet after a kind of group of bag is as shown in table 1:
Table 1
Wherein, Byte0(byte 0) and Byte1(byte 1) show that this usb data comprises IP
The total number of bag.Bag according to total bag number He each IP bag is long, can circulate the data obtaining IP bag.
Data after group bag are sent to USB data card by USB data card driver, usb data
Blocking and unpack the data after group bag, this unpacking process is as shown in Figure 7.
With reference to Fig. 7, it is shown that the idiographic flow that the data after the group bag in the present embodiment are unpacked.
Unpack specifically comprises the following steps that
Step S702:USB data card receives the data after group bag.
The number of packet and each data in data after step S704:USB data card acquisition group bag
The bag of bag is long.
As it has been described above, Byte0 and Byte1 shows that this organizes the total number containing IP bag of the packet after wrapping.
Bag according to total bag number He each IP bag is long, and circulation obtains the data of IP bag.
Step S706:USB data card judges that (the most whether rationally the bag length of packet the most one by one
Meet established standards).If the bag length of packet is reasonable, then perform step S708;If it is unreasonable, the most directly
Connect stopping to unpack.
Step S708:USB data card replicates the data of n-th IP packet.
Wherein, N is the natural number of total number of the IP bag less than or equal to Byte0 instruction.From the 1st
Individual data unwrap the beginning, and last packet to this group bag stops.
Step S710:USB data card processes the data in n-th IP packet, returns step S706.
The data processing method provided by the present embodiment, USB data card driver is according to specific bar
Part, the packet that will comply with the transmission of NDIS agreement carries out storing up bag, disposable toward USB after reaching condition
Data card sends, and can improve the efficiency of data transmission, it will be apparent that improve upstream rate.Use this enforcement
After the group of example wraps capable scheme, find that speed can improve 100% by test.
Embodiment six
With reference to Fig. 8, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention six.
Data processing equipment in the present embodiment is positioned at usb data sending side, this data processing equipment bag
Include: receiver module 802, the packet sent to USB data card for receiving subscriber equipment to need;Multiple
Molding block 804, copies in task control block for the data in packet are set rule according to first,
And be completion status by the data setting in task control block;Molded tissue block 806, is used for calling USB and connects
Mouth sends the data in task control block to USB data card, continues to what subscriber equipment sent simultaneously
Other packets, and the data in other packets are copied to other respectively according to the first setting rule
Business controls, in block, other task control blocks to be organized into task control block chained list to be sent;Group bag module
808, after the data in the task control block being set as completion status are sent completely, according to second
Set rule the data in each task control block in task control block chained list to be sent are packaged;
Sending module 810, the data after calling USB interface transmission group bag are to USB data card.
The data processing equipment of the present embodiment is used for realizing corresponding USB in aforesaid plurality of embodiment of the method
The data processing method of data sending side, and there is the data process side of corresponding usb data sending side
The beneficial effect of method.The data processing equipment provided by the present embodiment, carries out packet caching, group
Send after bag to USB data card, take full advantage of the efficiency of transmission of usb bus, improve data
Transfer rate.
Embodiment seven
With reference to Fig. 9, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention seven.
The present embodiment has carried out further optimization to the device in embodiment six, and the data after optimization process dress
Put and include: receiver module 902, for receiving the packet that subscriber equipment sends;Replication module 904,
Copy in task control block for the data in packet are set rule according to first, and by task control
Data setting in clamp dog is completion status;Molded tissue block 906, for sending task to USB data card
Control the data in block, continue to other packets that subscriber equipment sends simultaneously, and by other data
Data in bag set rule according to first and copy in other task control blocks respectively, by other task controls
Clamp dog is organized into task control block chained list to be sent;Group bag module 908, for being set as completion status
Task control block in data be sent completely after, according to second set rule to task control block to be sent
The data in each task control block in chained list package;Sending module 910, is used for calling USB
Data after interface transmission group bag are to USB data card.
Preferably, group bag module 908 includes: extract submodule 9082, for being set as completion status
Task control block in data be sent completely after, from task control block chained list to be sent extract one treat
The task control block sent;First judges submodule 9084, is used for judging task control block chained list to be sent
In whether there is other task control blocks to be sent;Implementation sub-module 9086, for judging son first
The judged result of module 9084 be not in the presence of, call sending module by USB data card driver
910;In the presence of judging that the judged result of submodule 9084 is first, from task control block chain to be sent
Table extracts other task control blocks to be sent again, in the task control block all to be sent extracted
Data package.
Preferably, implementation sub-module 9086 is treated extracting other again from task control block chained list to be sent
The task control block sent, when the data in the task control block all to be sent extracted are packaged:
Other task control block to be sent is extracted again from task control block chained list to be sent;Judge successively
Whether the data volume size sum of two task control blocks to be sent extracted is less than or equal to setting value,
Wherein, setting value is less than or equal to the size of described task control block;If during less than or equal to setting value,
The data in a task control block in the task control block to be sent that will extract copy to another
Task control block packages, and the task control block being replicated data is linked into idle task control
Clamp dog chained list, returns first and judges submodule 9084;If during more than setting value, to be sent by rear extraction
Task control block put back in task control block chained list to be sent.
Preferably, the packet after group bag includes: total bag number of packet of group bag, each packet
Bag length and real data.
Preferably, replication module 904 includes: judge submodule 9042, is used for judging USB data card
Whether driver exists task control block to be sent;
First replicon module 9044, is used in the presence of judging that submodule 9042 judged result is, then
Data in the packet send subscriber equipment copy to be sent the appointing in a space the most available free
Business controls in block, and wherein, free space is more than or equal to the size of packet to be copied;
Second replicon module 9046, be used for judging submodule 9042 judged result as in the presence of not, from
Idle task controls to extract in block chained list an idle task control block, the data in packet is replicated
In the idle task control block extracted.
The data processing equipment of the present embodiment is used for realizing aforementioned enforcement one, embodiment two and embodiment three
In multiple embodiments of the method in the data processing method of corresponding usb data sending side, and have
The beneficial effect that corresponding method is implemented, does not repeats them here.
Embodiment eight
With reference to Figure 10, it is shown that the structured flowchart of a kind of data processing equipment of the embodiment of the present invention eight.
The data processing equipment of the present embodiment is positioned at usb data and receives side, and this data processing equipment includes:
Receiver module 1002, after receiving the group bag that USB data card driver is sent by USB interface
Packet;Unpacking module 1004, the packet after wrapping reception group unpacks;Wherein,
Packet after group bag is packaged in the following manner by USB data card driver: usb data
Card driver receives the packet needing to send to USB data card;By the data in packet according to
First sets rule copies in task control block, and by the data setting in task control block for completing shape
State;While calling USB interface data in USB data card transmission task control block, continue
Receive need to USB data card send other packets, and by the data in other packets according to
First sets rule copies to, in other task control blocks, be organized into pending by other task control blocks respectively
Send task control block chained list;Data in the described task control block being set as completion status are sent completely
After, set rule to the number in each task control block in task control block chained list to be sent according to second
According to packaging.
The data processing equipment provided by the present embodiment, is received in USB data card and passes through the application
In data processing method group bag after packet after, to group bag after packet unpack, make USB
Data card can reduce initial data, and be further processed initial data, it is to avoid existing
In data processing method, if needs process next data after having processed the data of a packet
Bag, then also wait for next packet transmission and could again it be processed to USB data card,
Save and wait that packet sends the time to USB data card, also improve the transmission speed of data equally
Rate.
Preferably, the packet after group bag includes: total bag number of packet of group bag, each packet
Bag length and real data;Unpack total bag number of the module 1004 packet after obtaining group bag with each
The bag of individual packet is long;According to the bag of total bag number and each packet is long, packet after group bag is solved
Bag.
Preferably, module 1004 is unpacked after the bag length according to total bag number and each packet is to group bag
When packet unpacks: unwrap the beginning from first data, in the packet after the bag of judgement group successively each
Whether the bag length of packet meets established standards;If being unsatisfactory for established standards, directly stop remaining group
Packet after bag unpacks;If meeting established standards, then the packet meeting established standards is carried out
Unpack and return the bag length of each packet in the packet performed after judging group bag successively whether to meet and set
Calibration standard.
The data processing equipment of the present embodiment is used for realizing aforementioned enforcement three, embodiment four and embodiment five
In multiple embodiments of the method in corresponding usb data receive the data processing method of side, and have
The beneficial effect that corresponding method is implemented, does not repeats them here.
Each embodiment in this specification all uses the mode gone forward one by one to describe, and each embodiment stresses
Be all the difference with other embodiments, between each embodiment, identical similar part sees mutually
?.For device embodiment, due to itself and embodiment of the method basic simlarity, so the ratio described
Relatively simple, relevant part sees the part of embodiment of the method and illustrates.
Above data processing method provided by the present invention and device are described in detail, herein should
Being set forth principle and the embodiment of the present invention by specific case, the explanation of above example is only
It is the method and core concept thereof being adapted to assist in and understanding the present invention;General technology simultaneously for this area
Personnel, according to the thought of the present invention, the most all will change,
In sum, this specification content should not be construed as limitation of the present invention.