CN109254936A - The method and apparatus for being inserted into data transmission queue structure's body - Google Patents

The method and apparatus for being inserted into data transmission queue structure's body Download PDF

Info

Publication number
CN109254936A
CN109254936A CN201710565480.XA CN201710565480A CN109254936A CN 109254936 A CN109254936 A CN 109254936A CN 201710565480 A CN201710565480 A CN 201710565480A CN 109254936 A CN109254936 A CN 109254936A
Authority
CN
China
Prior art keywords
structural body
request
round
redundancy
queue
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.)
Granted
Application number
CN201710565480.XA
Other languages
Chinese (zh)
Other versions
CN109254936B (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.)
Loongson Technology Corp Ltd
Original Assignee
Loongson Technology Corp 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 Loongson Technology Corp Ltd filed Critical Loongson Technology Corp Ltd
Priority to CN201710565480.XA priority Critical patent/CN109254936B/en
Publication of CN109254936A publication Critical patent/CN109254936A/en
Application granted granted Critical
Publication of CN109254936B publication Critical patent/CN109254936B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/40Bus structure
    • G06F13/4063Device-to-bus coupling
    • G06F13/4068Electrical coupling
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F13/00Interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F13/38Information transfer, e.g. on bus
    • G06F13/42Bus transfer protocol, e.g. handshake; Synchronisation
    • G06F13/4282Bus transfer protocol, e.g. handshake; Synchronisation on a serial bus, e.g. I2C bus, SPI bus
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2213/00Indexing scheme relating to interconnection of, or transfer of information or other signals between, memories, input/output devices or central processing units
    • G06F2213/0042Universal serial bus [USB]

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • General Engineering & Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Physics & Mathematics (AREA)
  • Computer Hardware Design (AREA)
  • Information Transfer Systems (AREA)
  • Computer And Data Communications (AREA)

Abstract

The present invention provides a kind of method and apparatus of insertion data transmission queue structure's body, this method comprises: receiving the first request, described first is requested for executing input operation or output operation to general-purpose serial bus USB equipment;According to first request, the corresponding first QH structural body of first request is inserted into data transmission queue QH structural body round-robin queue, at least one redundancy QH structural body is spaced between the first QH structural body and the 2nd QH structural body of QH structural body round-robin queue, corresponding second request of the 2nd QH structural body, the operation that second request executes the USB device are different from first request;According to QH structural body round-robin queue, operation is executed to the USB device.The method and apparatus of insertion data transmission queue structure's body provided by the invention, can be improved the efficiency that data are transmitted between computer and USB device.

Description

The method and apparatus for being inserted into data transmission queue structure's body
Technical field
The present invention relates to computer technology more particularly to a kind of method and apparatus of insertion data transmission queue structure's body.
Background technique
Currently, will be inserted on computer in universal serial bus (Universal Serial Bus, USB) equipment After USB interface, the request that computer can be inputted according to user operates USB device executive control operation, input or output is grasped Make.Wherein, for sending control command to USB device, input operates the data for receiving USB device transmission for control operation, Output operation is for sending data to USB device.
In the prior art, above-mentioned computer can be passed when receiving the request to USB device execution input operation in data It is inserted into an input QH structural body in defeated queue (Queue Head, QH) structural body round-robin queue, and USB device is transferred to meter The data of calculation machine are packaged into a data packet (Queue Element Transfer Descriptor, QTD) chained list and hang over input On QH structural body.Correspondingly, above-mentioned computer can be passed when receiving the request to USB device execution output operation in data It is inserted into an output QH structural body in defeated queue (Queue Head, QH) structural body round-robin queue, and computer is sent to USB The data of equipment are packaged into a data packet (Queue Element Transfer Descriptor, QTD) chained list and hang over output On QH structural body.In this way, the QH structural body in computer circulate operation QH structural body round-robin queue, with complete with USB device it Between data transmission.
When a certain QH structural body in computer circulate operation QH structural body round-robin queue, it is possible that needing will operation The case where data that the USB received when upper QH structural body is sent are exported again to USB device.At this point, if computer operation The data received when upper QH structural body do not reach calculator memory also on the transmission channel of memory, then computer is grasped When making current QH structural body, it will be unable to read the data in memory, computer caused read error occur.In such case Under, computer can restart the chip for reading data, cause the efficiency of the transmission data between computer and USB device compared with It is low.
Summary of the invention
The present invention provides a kind of method and apparatus of insertion data transmission queue structure's body, for improving computer and USB The efficiency of data is transmitted between equipment.
First aspect present invention provides a kind of method of insertion data transmission queue structure's body, comprising:
The first request is received, first request is for executing input operation or output to general-purpose serial bus USB equipment Operation;
According to first request, it is inserted into first request in data transmission queue QH structural body round-robin queue and corresponds to The first QH structural body, be spaced between the first QH structural body and the 2nd QH structural body of QH structural body round-robin queue to A few redundancy QH structural body, corresponding second request of the 2nd QH structural body, second request execute the USB device Operation it is different from first request;
According to QH structural body round-robin queue, operation is executed to the USB device.
As described above, it is described according to first request, institute is inserted into data transmission queue QH structural body round-robin queue Before stating the corresponding first QH structural body of the first request, the method also includes:
When receiving the input operation or output operation for the USB device for the first time, creation it is described at least one Redundancy QH structural body, to form QH structural body round-robin queue by least one redundancy QH structural body.
As described above, the variable of the redundancy QH structural body is default value.
As described above, it is described according to QH structural body round-robin queue, operation is executed to the USB device, comprising:
The 3rd QH structural body is read from QH structural body round-robin queue, the 3rd QH structural body is the QH structure Any one QH structural body in body circulation queue;
According to the value of the variable of the 3rd QH structural body, determine whether the 3rd QH structural body is the redundancy QH Structural body;
When the 3rd QH structural body is the redundancy QH structural body, position is read from QH structural body round-robin queue A QH structural body after the 3rd QH structural body;
When the 3rd QH structural body is nonredundancy QH structural body, the 3rd QH structural body pair is executed to USB device The operation answered.
As described above, being spaced two redundancy QH structural bodies between the first QH structural body and the 2nd QH structural body.
Second aspect of the present invention provides a kind of device of insertion data transmission queue structure's body, comprising:
Receiving module, for receiving the first request, first request is defeated for executing to general-purpose serial bus USB equipment Enter operation or output operation;
Processing module, for being inserted into institute in data transmission queue QH structural body round-robin queue according to first request State the corresponding first QH structural body of the first request, the 2nd QH knot of the first QH structural body and QH structural body round-robin queue At least one redundancy QH structural body, corresponding second request of the 2nd QH structural body, second request pair are spaced between structure body The operation that the USB device executes is different from first request;
Execution module, for executing operation to the USB device according to QH structural body round-robin queue.
As described above, the processing module, is also used to request according to described first, in data transmission queue QH structural body It is inserted into round-robin queue before the corresponding first QH structural body of first request, is set receiving for the first time for the USB When standby input operation or output operate, at least one redundancy QH structural body is created, to pass through at least one described redundancy QH structural body forms QH structural body round-robin queue.
As described above, the variable of the redundancy QH structural body is default value.
As described above, the execution module, is specifically used for reading the 3rd QH structure from QH structural body round-robin queue Body, and the value of the variable according to the 3rd QH structural body determine whether the 3rd QH structural body is the redundancy QH knot Structure body;When the 3rd QH structural body is the redundancy QH structural body, reads and be located at from QH structural body round-robin queue A QH structural body after the 3rd QH structural body;When the 3rd QH structural body is nonredundancy QH structural body, to USB Equipment executes the corresponding operation of the 3rd QH structural body;
Wherein, the 3rd QH structural body is any one QH structural body in QH structural body round-robin queue.
As described above, being spaced two redundancy QH structural bodies between the first QH structural body and the 2nd QH structural body.
The method and apparatus of insertion data transmission queue structure's body provided by the invention, by the way that redundancy QH structural body is arranged, With the isolation input QH structural body in QH structural body round-robin queue and output QH structural body, computer operation input QH can be extended Duration between structural body and operation output QH structural body.The method provided through the invention, can be to avoid computer will be defeated Enter QH structural body connection data be sent to calculator memory after, computer directly operate output QH structural body when, and needs from When reading the data for being sent to calculator memory in calculator memory, if data do not reach calculator memory also, it will lead to Computer read error, the problem of causing chip of the computer for reading data to be restarted, it is thus possible to improve computer with The efficiency of data is transmitted between USB device.
Detailed description of the invention
In order to more clearly explain the embodiment of the invention or the technical proposal in the existing technology, to embodiment or will show below There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this Some embodiments of invention for those of ordinary skill in the art without creative efforts, can be with It obtains other drawings based on these drawings.
Fig. 1 is the flow diagram for the embodiment of the method one that insertion data provided by the invention transmit queue structure's body;
Fig. 2 is the flow diagram for the embodiment of the method two that insertion data provided by the invention transmit queue structure's body;
Fig. 3 is the schematic diagram of existing QH structural body round-robin queue;
Fig. 4 is the schematic diagram of QH structural body provided by the invention round-robin queue;
Fig. 5 is the structural schematic diagram for the Installation practice one that insertion data provided by the invention transmit queue structure's body.
Specific embodiment
Following will be combined with the drawings in the embodiments of the present invention, and technical solution in the embodiment of the present invention carries out clear, complete Site preparation description, it is clear that described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.It is based on Embodiment in the present invention, it is obtained by those of ordinary skill in the art without making creative efforts every other Embodiment shall fall within the protection scope of the present invention.
The method and apparatus of insertion data transmission queue structure's body provided by the invention, set for improving computer with USB The efficiency of data is transmitted between standby.Wherein, USB device mentioned here can be any USB interface and meter by computer What calculation machine connected stores equipment, such as: USB flash disk.
Technical solution of the present invention is described in detail with specifically embodiment below.These specific implementations below Example can be combined with each other, and the same or similar concept or process may be repeated no more in some embodiments.
Fig. 1 is the flow diagram for the embodiment of the method one that insertion data provided by the invention transmit queue structure's body.This The executing subject of embodiment can be insert number according to the device of transmission queue structure's body, can also be to be integrated with insertion data transmission The computer (referred to as: computer) of the device of queue structure's body.Following application documents are by taking executing subject computer as an example, to this hair Method provided by bright is illustrated.What is involved is computers for the present embodiment according to the first request, in data transmission queue The detailed process of the corresponding first QH structural body of the first request of insertion in (Queue Head, QH) structural body round-robin queue.Such as Fig. 1 Shown, this method may include:
S101, the first request is received, wherein the first request is for operating USB device execution input operation or output.
Specifically, computer can receive after connecting USB device with computer by the USB interface of computer The first request inputted to user.Wherein, this first request can serve to indicate that computer to USB device execute input operation or Output operation.It is mentioned here input operation can for receive USB device send data operation, output operation can for The operation of USB device transmission data.
Wherein, user may refer to the prior art to the mode that computer inputs above-mentioned request, repeat no more to this.
S102, it is requested according to first, the corresponding first QH structural body of the first request is inserted into QH structural body round-robin queue, Wherein, at least one redundancy QH structure is spaced between the first QH structural body and the 2nd QH structural body of QH structural body round-robin queue Body, corresponding second request of the 2nd QH structural body, the operation that the second request executes USB device are different from the first request.
In the prior art, when user is used to execute the request of input operation to computer input, computer will create defeated Enter QH structural body.Wherein, input QH structural body can connect input chained list, and the input chained list is by the case where the input operates, USB Equipment is sent at least one data packet (Queue Element Transfer Descriptor, QTD) group of computer At.At this point, user is for the first time if above-mentioned request is after connecting USB device with computer by the USB interface of computer The request inputted to computer, then the pointer of input QH structural body can be directed toward input QH structural body by above-mentioned computer, with So that input QH structural body oneself forms QH structural body round-robin queue.If what above-mentioned request and non-user inputted for the first time asks It asks and existing QH structural body round-robin queue in above-mentioned computer, then input QH structural body is being inserted into QH by above-mentioned computer It, can be by QH structure of the pointer of the input QH structural body direction after the input QH structural body when structural body round-robin queue Body.Meanwhile the pointer of the QH structural body before input QH structural body can be directed toward input QH structural body by computer, with shape At QH structural body round-robin queue.Wherein, the QH structural body before and after input QH structural body can be input QH knot Structure body, or output QH structural body.
Correspondingly, when user is used to execute the request of output operation to computer input, computer will create output QH Structural body.Wherein, output QH structural body can connect output chained list, and the output chained list is by the case where the output operates, computer It is sent at least one data packet (Queue Element Transfer Descriptor, QTD) composition of USB device.This When, if above-mentioned request is after connecting USB device with computer by the USB interface of computer, user is for the first time to meter The request of calculation machine input, then the pointer of output QH structural body can be directed toward output QH structural body by above-mentioned computer, so that Output QH structural body oneself forms QH structural body round-robin queue.If the request of output for the first time of above-mentioned request and non-user and Existing QH structural body round-robin queue in above-mentioned computer, then output QH structural body is being inserted into QH structural body by above-mentioned computer It, can be by QH structural body of the pointer of the output QH structural body direction after the output QH structural body when round-robin queue.Meanwhile The pointer of QH structural body before output QH structural body can be directed toward output QH structural body by computer, to form QH structure Body circulation queue.Wherein, the QH structural body before and after output QH structural body can be input QH structural body, can also Think output QH structural body.
In this way, computer can be according to the sequence of QH structural body each in QH structural body round-robin queue, sequentially to execute user Request.That is, the QTD on the input chained list for inputting the connection of QH structural body is written to computer when operation input QH structural body In memory, to realize input operation.When operation output QH structural body, output QH structural body connection is read from calculator memory The QTD on chained list is exported, and the processor for being sent to USB device carries out storage processing, to realize output operation.When computer is grasped When finishing a certain QH structural body in QH structural body round-robin queue, computer can be by the QH structural body from QH structure body circulation team It is deleted in column.
As can be seen from the above description, in the prior art, QH structural body included by QH structural body round-robin queue is up to two Kind, it is respectively as follows: input QH structural body and output QH structural body.That is, QH structural body included by QH structural body round-robin queue connects It is connected to input chained list or output chained list.QH structural body included by QH structural body round-robin queue is computer QH knot to be operated Structure body.And in the present embodiment, QH structural body round-robin queue is provided with redundancy QH structural body.Redundancy QH structural body can isolate defeated Enter QH structural body and output QH structural body, to extend between computer operation input QH structural body and operation output QH structural body Duration.That is, computer passes through operation redundancy QH structural body, computer has been elongated from input operation is executed to execution output operation Between time.
Therefore, in the present embodiment, above-mentioned computer is requested, in QH after receiving the first request according to first When corresponding first QH structural body is requested in insertion first in structural body round-robin queue, need to tie the first QH structural body and the 2nd QH At least one redundancy QH structural body is spaced between structure body.If include multiple 2nd QH structural bodies in QH structural body round-robin queue, First QH structural body needs and each 2nd QH structural body interval at least one redundancy QH structural body.
Wherein, corresponding second request of above-mentioned 2nd QH structural body is different from the first request.For example, when the first request is used for When executing input operation to USB device, the first QH structural body is input QH structural body, at this point, the second request is for USB device Output operation is executed, i.e. the 2nd QH structural body is output QH structural body.When the first request is for executing output operation to USB device When, the first QH structural body is output QH structural body, at this point, the second request is for executing input operation, i.e. the 2nd QH to USB device Structural body is input QH structural body.
It should be noted that above-mentioned redundancy QH structural body can be empty QH structural body.That is, the variable of redundancy QH structural body It is default value or is not assigned.Above-mentioned redundancy QH structural body can also be connected to preset input chained list or preset output for chain The structural body etc. of chained list, to this without limiting.In addition, the present embodiment does not also limit above-mentioned first QH structural body and the 2nd QH is tied The quantity for the redundancy QH structural body being spaced between structure body, such as: two are spaced between the first QH structural body and the 2nd QH structural body Redundancy QH structural body etc..
When specific implementation, above-mentioned at least one redundancy QH structure being located between the first QH structural body and the 2nd QH structural body Body can be the QH structural body being preset in QH structural body round-robin queue, can also be directed to for computer receiving for the first time When the input of USB device operates or output operates, QH structural body of creation etc..When above-mentioned at least one redundancy QH structural body is meter Calculation machine is created when receiving operation (such as: input operation or output operation) for USB device for the first time, then above-mentioned meter Calculation machine can form QH structural body round-robin queue by least one redundancy QH structural body, and computer is received for the first time The QH structural body created for the operation of USB device be inserted into the QH structural body round-robin queue.Wherein, computer creates QH Structural body and the mode for forming QH structural body round-robin queue may refer to the prior art, repeat no more to this.
S103, according to QH structural body round-robin queue, operation is executed to USB device.
Specifically, above-mentioned computer can sequentially operate the QH structural body in QH structural body round-robin queue, to USB device Execute input or output operation.
It is output QH structural body with the first QH structural body, the 2nd QH structural body is to input for QH structural body, wherein first QH structural body is located at after the 2nd QH structural body in QH structural body round-robin queue.Under the scene, above-mentioned computer is being operated The 2nd QH structural body (the QTD write-in on input chained list for being connected the second QH structural body in QH structural body round-robin queue Calculator memory) after, computer can sequentially operate the redundancy QH structural body between the 2nd QH structural body and the first QH structural body.Meter Calculation machine can just operate the first QH structural body after having operated redundancy QH structural body, (the first QH be read i.e. from calculator memory The QTD on output chained list that structural body is connected, and it is sent to USB device).
At this point, if it is same data that it is corresponding with the QTD on output chained list, which to input the QTD on chained list, by taking QTD1 as an example, That is, QTD1 is sent to USB device at once again after the QTD1 for receiving USB device transmission by computer.Then computer is being grasped After making the 2nd QH structural body, the side of the redundancy QH structural body between the 2nd QH structural body and the first QH structural body is operated by sequence Formula can reach calculator memory for the QTD1 on input chained list and get more times, so that computer is in operation first When QH structural body, the QTD1 inputted on chained list has arrived at calculator memory.In this way, when the first QH structural body of computer operation, May insure computer can from the QTD1 read in calculator memory on the output chained list that the first QH structural body connected, So that the QTD1 can be sent to USB device by computer.In this way, can to avoid computer because have not been able to from The data for being sent to USB device are read in calculator memory, lead to computer read error, cause computer for reading The problem of chip of data is restarted.The regular hour can be occupied by being restarted due to the chip that computer reads data, influence to transmit number According to efficiency.Therefore, by the above-mentioned means, the efficiency for transmitting data between computer and USB device can be improved.
The method of insertion data transmission queue structure's body provided by the invention, by the way that redundancy QH structural body is arranged, in QH Isolation input QH structural body and output QH structural body in structural body round-robin queue, can extend computer operation input QH structural body Duration between operation output QH structural body.The method provided through the invention can will input QH knot to avoid computer After the data of structure body connection are sent to calculator memory, when computer directly operates output QH structural body, and need from computer When reading the data for being sent to calculator memory in memory, if data do not reach calculator memory also, computer will lead to Read error causes computer for reading the problem of chip of data is restarted, it is thus possible to improve computer and USB device Between transmit data efficiency.
Fig. 2 is the flow diagram for the embodiment of the method two that insertion data provided by the invention transmit queue structure's body.Such as Shown in Fig. 2, as described in above-described embodiment, above-mentioned redundancy QH structural body can be empty QH structural body.That is, redundancy QH structural body Variable is default value or is not assigned.Above-mentioned redundancy QH structural body can also be connected to preset input chained list or preset for chain Export the structural body etc. of chained list.By taking the QH structural body that above-mentioned redundancy QH structural body is empty as an example, then above-mentioned S103 may include:
S201, the 3rd QH structural body is read from QH structural body round-robin queue, wherein the 3rd QH structural body is QH structural body Any one QH structural body in round-robin queue.
S202, the value according to the variable of the 3rd QH structural body, determine whether the 3rd QH structural body is redundancy QH structural body. If so, S203 is executed, if it is not, then executing S204.
Specifically, as aforementioned described, when above-mentioned redundancy QH structural body is empty QH structural body, above-mentioned redundancy QH structural body Variable be default value or be not assigned.Therefore, QH structural body of the computer in sequence operation QH structural body round-robin queue When, after above-mentioned computer reads the 3rd QH structural body from QH structural body round-robin queue, computer can be according to the 3rd QH The value of the variable of structural body judges whether the 3rd QH structural body is redundancy QH structural body.
When the value of the variable of the 3rd QH structural body is default value or is not assigned, illustrate that the 3rd QH structural body is empty QH structural body.Since empty QH structural body will not be connected with any input chained list and output chained list, so computer can not have to Any operation is executed to empty QH structural body.Therefore, computer can be read from QH structural body round-robin queue is located at the 3rd QH A QH structural body after structural body.Ignore the 3rd QH structural body, operates next QH structural body.
When the value of the variable of the 3rd QH structural body is not default value or is assigned, illustrate that the 3rd QH structural body is not empty QH structural body.That is, the 3rd QH structural body is connected with input chained list and output chained list.That is, the 3rd QH structural body is defeated Enter QH structural body or output QH structural body.Therefore, computer can execute the corresponding operation of the 3rd QH structural body to USB device.
S203, it is located at a QH structural body after the 3rd QH structural body from reading in QH structural body round-robin queue.
Specifically, computer is tied from the QH read after being located at the 3rd QH structural body in QH structural body round-robin queue After structure body, the QH structural body can be judged, this is repeated no more by the way of step S202.
S204, the corresponding operation of the 3rd QH structural body is executed to USB device.
Specifically, when the 3rd QH structural body is input QH structural body, what computer can connect the 3rd QH structural body Data packet on input chained list is sent in calculator memory.When above-mentioned 3rd QH structural body is output QH structural body, calculate Machine can be from the data packet read on the output chained list that the 3rd QH structural body connects in calculator memory, and these data packets are sent out Give USB device.
The method of insertion data transmission queue structure's body provided by the invention, is empty QH structural body in redundancy QH structural body When, computer, can taking according to the variable of QH structural body when sequence operates the QH structural body in QH structural body round-robin queue Value, to judge whether QH structural body is redundancy QH structural body, and then when QH structural body is not redundancy QH structural body, sets USB It is standby to execute the corresponding operation of QH structural body.Method through this embodiment, it can be ensured that computer can correctly operate QH QH structural body in structural body round-robin queue improves the efficiency that data are transmitted between computer and USB device.
Below to be equipped with the microprocessor with no inner interlocked pipelining-stage of linux operating system Computer (following application texts of (Microprocessor Without interlocked Piped Stages, MIPS) framework Part abbreviation computer) for, the method for insertion data transmission queue structure's body provided by the invention is introduced.
Currently, being provided with central processing unit (Central Processing Unit, CPU) on the mainboard of above-mentioned computer With multiple usb host controllers.CPU can by with the matched usb host controller of the controller of USB device, with USB device Carry out data transmission.Such as: the controller used in the above-mentioned USB device is enhanced host controller interface (Enhanced Host Controller Interface, EHCI) controller when, CPU can by with the matched usb host of EHCI controller Controller carries out data transmission with USB device.
Correspondingly, in linux operating system, the driving of USB device is driven by usb host controller driving and USB device Dynamic composition.Wherein, usb host controller drives, for driving usb host controller.USB device driving, for driving USB to set It is standby, such as: USB flash disk, USB camera etc..It should be noted that USB device driving can be understood as usb host controller driving Upper layer call, usb host controller driving be USB device driving bottom encapsulation.Therefore, USB device driving operation be It is driven by usb host controller and is controlled with specific hardware device, interacts to realize.
After connecting USB device with computer by the USB interface of computer, CPU is available to be sent to USB device USB device information.Such as the factory of agreement used in the mark of USB device, the model of USB device, USB device, USB device Trade mark knows, one or more in the version number of USB device etc..Therefore, CPU can be according to above-mentioned USB device information, to USB Equipment is initialized, to match the driving of usb host controller and usb host controller for USB.
According to existing usb protocol standard, computer can be divided into 3 to the operation of USB device by usb host controller driving Generic operation: input operation, output operation and control operation.Wherein, input operates corresponding input endpoint, the corresponding output of output operation Endpoint, the corresponding control endpoint of control operation.After CPU is to USB device initialization, it can carry out data transmission with USB device. During transmitting data, usb host controller driving can establish input QH structural body for input endpoint, for output end Point establishes output QH structural body.And any QH structural body will not be then established for control endpoint.
When usb host controller driving needs to read the data of USB device, usb host controller driving can pass through The data information for needing USB device to transmit is sent to the controller of USB device by output port.The controller of USB device is connecing After receiving data information, the data for needing to be transferred to computer can be packaged by multiple QTD according to these data informations.It should Multiple QTD connect into an input chained list, and the input chained list is connected on input QH structural body.Correspondingly, computer is sent out The data for giving USB device can also be packaged into multiple QTD.Multiple QTD connects into an output chained list, and by the output chained list It is connected on output QH structural body.
Fig. 3 is the schematic diagram of existing QH structural body round-robin queue.As shown in figure 3, in the prior art, when usb host control When device driving processed establishes input QH structural body and output QH structural body, the pointer of input QH structural body can be directed toward output The pointer of QH structural body, output QH structural body is directed toward input QH structural body, so that input QH structural body and output QH knot Structure body forms QH structural body round-robin queue.In this way, usb host controller can be with defeated in circulate operation QH structural body round-robin queue Enter QH structural body and output QH structural body, completes to transmit with the data of USB device.That is, existing QH structure body circulation It only include input QH structural body and output QH structural body in queue.
It is currently, there are computer and decompresses a bigger compressed package (such as 3GB or more size) to calculating from USB device Scene in machine hard disk.Under the scene, there are following situations: USB device is incited somebody to action by input QH structural body in decompression procedure After file after a certain decompression is sent to computer, and after the decompression for needing to send by output QH structural body acquisition computer File in a certain decompression parameter so that USB device can decompress next file according to the decompression parameter.That is, Usb host controller is operating input QH structural body, and the file after USB device is decompressed is sent to calculator memory and deposits Chu Hou, usb host controller operate again output QH structural body, with from calculator memory read this document in decompression parameter, And the decompression parameter is sent to USB device.When needing certain due to the file after USB device decompression to calculator memory Between, if usb host controller operation export QH structural body, from calculator memory read this document in decompression parameter when, If this document does not reach calculator memory also, it will lead to usb host controller and occur reading the mistake of failure.In such case Under, usb host controller can be restarted automatically, to repair the mistake for reading failure.Due to usb host controller restart need it is several The time of second, cause the efficiency of the transmission data between computer and USB device lower.
Fig. 4 is the schematic diagram of QH structural body provided by the invention round-robin queue.As shown in figure 4, insertion provided by the invention The method of data transmission queue structural body, by being inserted at least one redundancy between input QH structural body and output QH structural body QH structural body, can in QH structural body round-robin queue will input QH structural body and output QH structural body keep apart.In this way, Usb host controller will not operate at once after operation input QH structural body and export QH structural body, but first operation input QH Redundancy QH structural body between structural body and output QH structural body gets the time to reach memory for data, it is ensured that defeated executing Out when QH structural body, data be arrived in calculator memory, to avoid occurring above-mentioned described because reading unsuccessfully leads to usb host The problem of controller is restarted.
When specific implementation, the driving of usb host controller in operating system can be modified, so that usb host controller Driving when can carry out first time operation (input operate or output operate) to USB device with computer, create above-mentioned redundancy QH Structural body, to form QH structural body round-robin queue by above-mentioned redundancy QH structural body.Such as: redundancy QH structural body can be established On control endpoint.Wherein, above-mentioned redundancy QH structural body can be empty QH structural body, that is, not carry on redundancy QH structural body QTD。
Data transmission during, usb host controller operate QH structural body round-robin queue in QH structural body when, Can first judge whether the QH structural body is redundancy QH structural body first according to the value of the variable of QH structural body.Determining QH knot When structure body is redundancy QH structural body, then without data transmission and processing, continue to operate next QH structural body.That is, encountering redundancy Empty QH, then do not transmit, and encounters non-empty QH, is then transmitted.
It illustratively, can be by being modified as follows usb host controller driving, in the usb protocol of existing standard It is upper to realize above-mentioned function, specifically:
1, QH structural body is modified, increases the variable and macrodefinition of mark sky QH structural body in QH structural body, so that USB Host controller driver can create redundancy QH structural body.
2, when computer is operated (input operates or output operates) to USB device for the first time, on control endpoint Establish multiple redundancy QH structural bodies.Such as: 4 redundancy QH structural bodies.
3, will to be spaced at least one superfluous between input QH structural body and output QH structural body in QH structural body round-robin queue Remaining QH structural body.
4, in data transmission procedure, first judge whether QH structural body is redundancy QH structural body before operation QH structural body.
The method of insertion data transmission queue structure's body provided by the invention, by the way that redundancy QH structural body is arranged, in QH Isolation input QH structural body and output QH structural body in structural body round-robin queue, can extend computer operation input QH structural body Duration between operation output QH structural body.The method provided through the invention can will input QH knot to avoid computer After the data of structure body connection are sent to calculator memory, when computer directly operates output QH structural body, and need from computer When reading the data for being sent to calculator memory in memory, if data do not reach calculator memory also, computer will lead to Read error causes computer for reading the problem of chip of data is restarted, it is thus possible to improve computer and USB device Between transmit data efficiency.
Those of ordinary skill in the art will appreciate that: realize that all or part of the steps of above method embodiment can pass through The relevant hardware of program instruction is completed, and program above-mentioned can be stored in a computer readable storage medium, the program When being executed, step including the steps of the foregoing method embodiments is executed;And storage medium above-mentioned includes: ROM, RAM, magnetic disk or light The various media that can store program code such as disk.
Fig. 5 is the structural schematic diagram for the Installation practice one that insertion data provided by the invention transmit queue structure's body.Such as Shown in Fig. 5, the device of insertion data transmission queue structure's body may include: receiving module 11, processing module 12 and execution mould Block 13.Wherein,
Receiving module 11, for receiving the first request, first request is for executing general-purpose serial bus USB equipment Input operation or output operation;
Processing module 12, for being inserted into data transmission queue QH structural body round-robin queue according to first request Described first requests corresponding first QH structural body, the 2nd QH of the first QH structural body and QH structural body round-robin queue At least one redundancy QH structural body, corresponding second request of the 2nd QH structural body, second request are spaced between structural body The operation executed to the USB device is different from first request.
Execution module 13, for executing operation to the USB device according to QH structural body round-robin queue.
Optionally, the variable of above-mentioned redundancy QH structural body is default value.Illustratively, the first QH structural body and institute Two redundancy QH structural bodies can be spaced by stating between the 2nd QH structural body.
Optionally, above-mentioned execution module 13 is specifically used for reading the 3rd QH structure from QH structural body round-robin queue Body, and the value of the variable according to the 3rd QH structural body determine whether the 3rd QH structural body is the redundancy QH knot Structure body;When the 3rd QH structural body is the redundancy QH structural body, reads and be located at from QH structural body round-robin queue A QH structural body after the 3rd QH structural body;When the 3rd QH structural body is nonredundancy QH structural body, to USB Equipment executes the corresponding operation of the 3rd QH structural body;
Wherein, the 3rd QH structural body is any one QH structural body in QH structural body round-robin queue.
Optionally, above-mentioned processing module 12 is also used to request according to described first, in data transmission queue QH structural body It is inserted into round-robin queue before the corresponding first QH structural body of first request, is set receiving for the first time for the USB When standby input operation or output operate, at least one redundancy QH structural body is created, to pass through at least one described redundancy QH structural body forms QH structural body round-robin queue.
The device of insertion data transmission queue structure's body provided by the invention, can execute above method embodiment, in fact Existing principle is similar with technical effect, and details are not described herein.
Finally, it should be noted that the above embodiments are only used to illustrate the technical solution of the present invention., rather than its limitations;To the greatest extent Pipe present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that: its according to So be possible to modify the technical solutions described in the foregoing embodiments, or to some or all of the technical features into Row equivalent replacement;And these are modified or replaceed, various embodiments of the present invention technology that it does not separate the essence of the corresponding technical solution The range of scheme.

Claims (10)

1. a kind of method of insertion data transmission queue structure's body, which is characterized in that the described method includes:
The first request is received, first request is for operating the execution input operation of general-purpose serial bus USB equipment or output;
According to first request, first request corresponding the is inserted into data transmission queue QH structural body round-robin queue One QH structural body, is spaced at least one between the first QH structural body and the 2nd QH structural body of QH structural body round-robin queue A redundancy QH structural body, corresponding second request of the 2nd QH structural body, the behaviour that second request executes the USB device Make different from first request;
According to QH structural body round-robin queue, operation is executed to the USB device.
2. the method according to claim 1, wherein described request according to described first, in data transmission queue It is inserted into QH structural body round-robin queue before the corresponding first QH structural body of first request, the method also includes:
When receiving the input operation or output operation for the USB device for the first time, at least one described redundancy is created QH structural body, to form QH structural body round-robin queue by least one redundancy QH structural body.
3. the method according to claim 1, wherein the variable of the redundancy QH structural body is default value.
4. according to the method described in claim 3, it is characterized in that, described according to QH structural body round-robin queue, to described USB device executes operation, comprising:
The 3rd QH structural body is read from QH structural body round-robin queue, the 3rd QH structural body is that the QH structural body follows Any one QH structural body in ring queue;
According to the value of the variable of the 3rd QH structural body, determine whether the 3rd QH structural body is the redundancy QH structure Body;
When the 3rd QH structural body is the redundancy QH structural body, is read from QH structural body round-robin queue and be located at institute State a QH structural body after the 3rd QH structural body;
When the 3rd QH structural body is nonredundancy QH structural body, the 3rd QH structural body pair is executed to the USB device The operation answered.
5. method according to claim 1-4, which is characterized in that the first QH structural body and the 2nd QH Two redundancy QH structural bodies are spaced between structural body.
6. a kind of device of insertion data transmission queue structure's body characterized by comprising
Receiving module, for receiving the first request, first request is for executing input behaviour to general-purpose serial bus USB equipment Make or output operates;
Processing module, for being inserted into described the in data transmission queue QH structural body round-robin queue according to first request The corresponding first QH structural body of one request, the 2nd QH structural body of the first QH structural body and QH structural body round-robin queue Between be spaced at least one redundancy QH structural body, corresponding second request of the 2nd QH structural body, second request is to described The operation that USB device executes is different from first request;
Execution module, for executing operation to the USB device according to QH structural body round-robin queue.
7. device according to claim 6, which is characterized in that the processing module is also used to ask according to described first It asks, is inserted into data transmission queue QH structural body round-robin queue before the corresponding first QH structural body of first request, When receiving the input operation or output operation for the USB device for the first time, at least one redundancy QH structure is created Body, to form QH structural body round-robin queue by least one redundancy QH structural body.
8. device according to claim 6, which is characterized in that the variable of the redundancy QH structural body is default value.
9. device according to claim 8, which is characterized in that the execution module is specifically used for from the QH structural body The 3rd QH structural body, and the value of the variable according to the 3rd QH structural body are read in round-robin queue, determine the 3rd QH Whether structural body is the redundancy QH structural body;When the 3rd QH structural body is the redundancy QH structural body, from the QH A QH structural body being located at after the 3rd QH structural body is read in structural body round-robin queue;In the 3rd QH structural body When for nonredundancy QH structural body, the corresponding operation of the 3rd QH structural body is executed to the USB device;
Wherein, the 3rd QH structural body is any one QH structural body in QH structural body round-robin queue.
10. according to the described in any item devices of claim 6-9, which is characterized in that the first QH structural body and described second Two redundancy QH structural bodies are spaced between QH structural body.
CN201710565480.XA 2017-07-12 2017-07-12 Method and device for inserting data transmission queue structure Active CN109254936B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710565480.XA CN109254936B (en) 2017-07-12 2017-07-12 Method and device for inserting data transmission queue structure

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710565480.XA CN109254936B (en) 2017-07-12 2017-07-12 Method and device for inserting data transmission queue structure

Publications (2)

Publication Number Publication Date
CN109254936A true CN109254936A (en) 2019-01-22
CN109254936B CN109254936B (en) 2020-06-02

Family

ID=65050769

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710565480.XA Active CN109254936B (en) 2017-07-12 2017-07-12 Method and device for inserting data transmission queue structure

Country Status (1)

Country Link
CN (1) CN109254936B (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356517A (en) * 2021-12-24 2022-04-15 苏州浪潮智能科技有限公司 Serial bus resource management method, system, electronic device and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1755656A (en) * 2004-09-27 2006-04-05 江苏新科电子集团有限公司 Data transmission and control system employing USB and relative method thereof
CN101005376A (en) * 2007-01-09 2007-07-25 华为技术有限公司 Device and method for realizing service plate main control plate communication
US20070258362A1 (en) * 2006-04-28 2007-11-08 Samsung Electronics Co., Ltd. Data flow control apparatus and method of mobile terminal for reverse communication from high speed communication device to wireless network
CN101227688A (en) * 2007-11-21 2008-07-23 中兴通讯股份有限公司 Method for transmitting data through USB interface on mobile phone
CN101414915A (en) * 2007-10-19 2009-04-22 英业达股份有限公司 System and method for processing remote copied send request
CN101820422A (en) * 2010-03-30 2010-09-01 南京恩瑞特实业有限公司 Safe computer message buffer implementation method
CN101923494A (en) * 2009-06-17 2010-12-22 安凯(广州)微电子技术有限公司 Memory controller verification system, method and scoreboard
CN102325275A (en) * 2011-10-17 2012-01-18 深圳市融创天下科技股份有限公司 Packet discarding method, device and server for playing of streaming media
US8225034B1 (en) * 2004-06-30 2012-07-17 Oracle America, Inc. Hybrid instruction buffer

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8225034B1 (en) * 2004-06-30 2012-07-17 Oracle America, Inc. Hybrid instruction buffer
CN1755656A (en) * 2004-09-27 2006-04-05 江苏新科电子集团有限公司 Data transmission and control system employing USB and relative method thereof
US20070258362A1 (en) * 2006-04-28 2007-11-08 Samsung Electronics Co., Ltd. Data flow control apparatus and method of mobile terminal for reverse communication from high speed communication device to wireless network
CN101005376A (en) * 2007-01-09 2007-07-25 华为技术有限公司 Device and method for realizing service plate main control plate communication
CN101414915A (en) * 2007-10-19 2009-04-22 英业达股份有限公司 System and method for processing remote copied send request
CN101227688A (en) * 2007-11-21 2008-07-23 中兴通讯股份有限公司 Method for transmitting data through USB interface on mobile phone
CN101923494A (en) * 2009-06-17 2010-12-22 安凯(广州)微电子技术有限公司 Memory controller verification system, method and scoreboard
CN101820422A (en) * 2010-03-30 2010-09-01 南京恩瑞特实业有限公司 Safe computer message buffer implementation method
CN102325275A (en) * 2011-10-17 2012-01-18 深圳市融创天下科技股份有限公司 Packet discarding method, device and server for playing of streaming media

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114356517A (en) * 2021-12-24 2022-04-15 苏州浪潮智能科技有限公司 Serial bus resource management method, system, electronic device and storage medium
CN114356517B (en) * 2021-12-24 2023-08-04 苏州浪潮智能科技有限公司 Method, system, electronic equipment and storage medium for managing serial bus resources

Also Published As

Publication number Publication date
CN109254936B (en) 2020-06-02

Similar Documents

Publication Publication Date Title
US10969983B2 (en) Method for implementing NVME over fabrics, terminal, server, and system
US9934160B1 (en) Bit-mapped DMA and IOC transfer with dependency table comprising plurality of index fields in the cache for DMA transfer
US9986028B2 (en) Techniques to replicate data between storage servers
CN109766302B (en) Method and device for managing equipment
US20130198311A1 (en) Techniques for Use of Vendor Defined Messages to Execute a Command to Access a Storage Device
CN109656593A (en) The method for realizing FPGA program remote upgrading based on ZYNQ chip
US9195394B2 (en) Transport mode data transfer between a channel subsystem and input/output devices
US20110004718A1 (en) System, method, and computer program product for ordering a plurality of write commands associated with a storage device
CN109284117A (en) Firmware upgrade method and system and flash memory microcontroller based on flash memory microcontroller
JP6998991B2 (en) Information processing methods and equipment
US9779047B2 (en) Universal intelligent platform management interface (IPMI) host to baseboard management controller (BMC) communication for non-x86 and legacy free systems
CN116635820A (en) Method and apparatus for controlling a compute-store processor
US20150095518A1 (en) I/o device sharing system and i/o device sharing method
US9804992B2 (en) Computer system and method for accessing virtual machine
CN109254936A (en) The method and apparatus for being inserted into data transmission queue structure's body
CN109800202B (en) PCIE (peripheral component interface express) -based data transmission system, method and device
CN102708079A (en) Data transmission controlling method and system applied to microcontroller
US20130103886A1 (en) Dual-firmware for next generation emulation
CN111371799B (en) Method, device and equipment for controlling data receiving and transmitting of MCTP (Multi-channel media Port) controller
US8904062B2 (en) Network control model driver
CN107066360B (en) Information transmission method and server
US9606951B2 (en) External electronic device and interface controller and external electronic device control method
TWI345711B (en)
US10025736B1 (en) Exchange message protocol message transmission between two devices
US10042792B1 (en) Method for transferring and receiving frames across PCI express bus for SSD device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
CP01 Change in the name or title of a patent holder

Address after: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Patentee after: Loongson Zhongke Technology Co.,Ltd.

Address before: 100095 Building 2, Longxin Industrial Park, Zhongguancun environmental protection technology demonstration park, Haidian District, Beijing

Patentee before: LOONGSON TECHNOLOGY Corp.,Ltd.

CP01 Change in the name or title of a patent holder