The read-only control systems of USB and method
Technical field
The invention belongs to digital independent fields, more particularly to a kind of read-only control systems of USB and method.
Background technology
Due to the particularity of electronic evidence, when collecting electronic evidence, for ensure the primitiveness of electronic evidence, authenticity,
Legitimacy should use professional apparatus for obtaining evidence by electronic evidence file copy backup, it is desirable that evidence obtaining in the collection of electronic evidence
Device need to have the functions such as read-only design and automatic calibration, this requirement to electronic evidence-collecting equipment also greatly promotes.And it is current
Many equipment are to control the read-only function of USB interface, after control software is destroyed, USB interface by installing control software
Read-only function will fail.Being possible to when the data of evidence taking equipment in reading in this way can be because evidence obtaining be treated in the maloperation of personnel
The data of equipment change and cause to wait for that evidence taking equipment data are untrue.
Invention content
In view of the above shortcomings of the prior art, it the present invention provides a kind of read-only control systems of USB and method, enhances
The credibility of USB interface, safety are effectively guaranteed the authenticity for waiting for evidence taking equipment data.
In order to solve the above-mentioned technical problem, present invention employs the following technical solutions:
A kind of read-only control systems of USB, including:Master controller (CPU), USB Device interfaces, USB Host interfaces,
Row buffer (buffer for upstream-device side, BUD), the sides Device down buffer storage device on the sides Device
Row buffer (buffer for upstream- on (buffer for downstream-device side, BDD), the sides Host
Host side, BUH), the sides Host down buffer storage device (buffer for downstream-host side, BDH);The USB
Device interfaces connect upstream host USB Host interfaces, the USB Device interfaces also respectively on the sides Device
Row buffer is connected with the sides the Device down buffer storage device, on the sides Device under row buffer and the sides Device
Row buffer is also connected with the master controller, and the master controller is also connected with row buffer and the sides Host on the sides Host
Down buffer storage device, row buffer and the sides the Host down buffer storage device are also connected with the USB Host interfaces on the sides Host,
The USB Host interfaces are also connected with the USB Device interfaces of upstream device, the master controller and USB Device interfaces,
Row buffer on USB Host interfaces, the sides Device, the sides Device down buffer storage device, on the sides Host under row buffer, the sides Host
Row buffer also sets up control connection.
Wherein, the USB interface is SUB3.0 interfaces.
When operation, master controller controls the traffic direction of each module, the read-only controls of USB according to the state of each module
System is additionally operable to:
A. serial data stream is sent out by the USB Host interfaces of upstream host, by the physical layer in USB Device interfaces
It is converted into parallel data stream and is sent into the link layer;
B. the link layer in the USB Device interfaces is for determining the parallel data stream boundary flowed into, to judge whether
For the control packet of the link layer process;If so, the link layer handles control packet;If it is not, entering step c;
C. the packet other than non-controlling packet in the parallel data stream is sent in the down buffer storage device of the sides Device;
D. the packet other than the non-controlling packet is sent in master controller by the sides the Device down buffer storage device, the master
Controller analyzes the type of the packet other than the non-controlling packet, reads the class in the packet header of the packet other than the non-controlling packet
Type-word section simultaneously judges whether the packet other than the non-controlling packet is the data packet for transmitting data;If it is not, entering step e;If so, into
Enter step f;
E. the control packet stream of the master controller enters in the down buffer storage device of the sides Host, then will by the USB Host interfaces
The control packet is sent to upstream device by the USB Device interfaces of upstream device;
F. the master controller further reads the information in the packet header of the packet other than the non-controlling packet, according to reading
Data length information in the packet header takes out complete data packet from the down buffer storage device of the sides Device;
G. the master controller is generated according to the information in the packet header of the data packet of taking-up confirms transaction packet and is put into
On the sides Device in row buffer;
H. the confirmation transaction packet on the sides Device in row buffer is sent to by the USB Device interfaces
Host is swum, and is matched with the comparison of the data packet number of upstream host.
As an optimization, the USB Device interfaces, USB Host interfaces include link layer and physical layer, the physics
Layer include signal electric interfaces, it can be achieved that signal timing it is synchronous, string and parallel-serial conversion, data buffer storage, data circuit volume
The function of code and decoding, the scrambling of data and descrambling;The demarcation of packet, the foundation of link connection and pipe can be achieved in the link layer
Reason, the function of error detection.
As an optimization, row buffer on the sides Device, the sides Device down buffer storage device, row buffer on the sides Host,
The sides Host down buffer storage device is using SRAM memory.
When operation, the sides the Device down buffer storage device, the sides Host down buffer storage device are used to store the data of upstream host
Stream information, row buffer is used to store the traffic flow information of upstream device, the sides Device uplink caching on the sides Host
The confirmation transaction packet that device is used to store the traffic flow information of upstream device and master controller generates.
The read-only control methods of USB of the present invention, this method are as follows:
A. serial data stream is sent out by the USB Host interfaces of upstream host, by the physical layer in USB Device interfaces
It is converted into parallel data stream and is sent into the link layer;
B. the link layer in the USB Device interfaces is for determining the parallel data stream boundary flowed into, to judge whether
For the control packet of link layer processing;If so, the link layer handles control packet;If it is not, entering step
c;
C. the packet other than non-controlling packet in the parallel data stream is sent in the down buffer storage device of the sides Device;
D. the packet other than the non-controlling packet is sent in master controller by the sides the Device down buffer storage device, the master
Controller analyzes the type of the packet other than the non-controlling packet, reads the class in the packet header of the packet other than the non-controlling packet
Type-word section simultaneously judges whether the packet other than the non-controlling packet is the data packet (Data Packet, DP) for transmitting data;If it is not,
Enter step e;If so, entering step f;
E. the control packet stream of the master controller enters in the down buffer storage device of the sides Host, then will by the USB Host interfaces
The control packet is sent to upstream device by the USB Device interfaces of upstream device;
F. the master controller further reads the information in the packet header of the packet other than the non-controlling packet, according to reading
Data length information in the packet header takes out complete data packet from the down buffer storage device of the sides Device;
G. the master controller is generated according to the information in the packet header of the data packet of taking-up confirms transaction packet
(Acknowledgement Transaction Packet, ACK TP) is simultaneously put on the sides Device in row buffer;
H. the confirmation transaction packet on the sides Device in row buffer is sent to by the USB Device interfaces
Host is swum, and is matched with the comparison of the data packet number of upstream host.
As an optimization, upstream host and upstream device establish ppp protocol, upstream host by USB Device interfaces and
USB Host interfaces send control signal to upstream device.
As an optimization, upstream device sends upstream by USB Host interfaces, wherein in USB Host interfaces
Converting serial data streams at parallel data stream and are sent into link layer by physical layer, this link layer will not belong to the control of this layer processing
Packet other than packet is put on the sides Host in row buffer, and the packet in row buffer on the sides Host is moved to Device by master controller
On side in row buffer, upstream host is sent to by USB Device interfaces.
The beneficial effects of the invention are as follows:
In evidence obtaining, after the interface of evidence taking equipment is inserted into apparatus for obtaining evidence, the USB interface of apparatus for obtaining evidence only reads number
According to function, will not thus worry to lead to wait for that the data in evidence taking equipment are modified because of maloperation.
Description of the drawings
Fig. 1 is a kind of system framework figure of the read-only control systems of USB of the present invention;
Fig. 2 is a kind of downlink data process chart of the read-only control systems of USB of the present invention.
Specific implementation mode
The present invention is described in further detail below in conjunction with the accompanying drawings.
Fig. 1 is the system framework figure of the present invention.As shown in Figure 1, a kind of read-only control systems of USB, including:Master controller
(CPU), USB Device interfaces, USB Host interfaces, row buffer (buffer for upstream- on the sides Device
Device side, BUD), the sides Device down buffer storage device (buffer for downstream-device side, BDD),
Row buffer (buffer for upstream-host side, BUH), the sides Host down buffer storage device (buffer on the sides Host
For downstream-host side, BDH).Master controller is used to judge the type of data flow and controls the side of data flow
Row buffer, the sides Host down buffer storage device are adopted on, row buffer on the sides Device, the sides Device down buffer storage device, the sides Host
It is SRAM memory, the sides Device down buffer storage device, the sides Host down buffer storage device are used to store the data flow of upstream host
Information, row buffer is used to store the traffic flow information of upstream device on the sides Host, and row buffer is for storing on the sides Device
The confirmation transaction packet that the traffic flow information and master controller of upstream device generate.
USB Device interfaces connect upstream host USB Host interfaces, USB Device interfaces also respectively with Device
Row buffer is connected with the sides Device down buffer storage device on side, row buffer and the sides Device down buffer storage device on the sides Device
It is also connected with master controller, master controller is also connected with row buffer and the sides Host down buffer storage device on the sides Host, and the sides Host uplink is slow
Storage and the sides Host down buffer storage device are also connected with USB Host interfaces, and USB Host interfaces are also connected with the USB of upstream device
Device interfaces,
Wherein, the read-only control systems of USB are additionally operable to:
A. serial data stream is sent out by the USB Host interfaces of upstream host, by the physical layer in USB Device interfaces
It is converted into parallel data stream and is sent into link layer;
Link layer in b.USB Device interfaces is for determining the parallel data stream boundary flowed into, to determine whether chain
The control packet of road floor processing;If so, link layer handles control packet;If it is not, entering step c;
C. the packet other than non-controlling packet in parallel data stream is sent in the down buffer storage device of the sides Device;
Packet other than non-controlling packet is sent in master controller by the sides d.Device down buffer storage device, and master controller is to non-control
The type of packet other than system packet is analyzed, and is read the type field in the packet header of the packet other than non-controlling packet and is judged non-controlling packet
Whether packet in addition is the data packet for transmitting data;If it is not, entering step e;If so, entering step f;
E. the control packet stream of master controller enters in the down buffer storage device of the sides Host, then by USB Host interfaces that control packet is logical
The USB Device interfaces for crossing upstream device are sent to upstream device;
F. master controller further reads the information in the packet header of the packet other than non-controlling packet, according to number in the packet header of reading
According to length information, complete data packet is taken out from the down buffer storage device of the sides Device;
G. master controller is generated according to the information in the packet header of the data packet of taking-up confirms transaction packet and is put into the sides Device
In upper row buffer;
Confirmation transaction packet on the sides h.Device in row buffer is sent to upstream host by USB Device interfaces, and
It is matched with the comparison of the data packet number of upstream host.
Wherein, USB interface is USB3.0 interfaces.
USB Device interfaces, USB Host interfaces include link layer and physical layer, and physical layer includes the electricity of signal
Gas interface, it can be achieved that signal timing is synchronous, string and parallel-serial conversion, data buffer storage, the line coding of data and decoding, data
The function of scrambling and descrambling;The function of the demarcation of packet, the foundation and management, error detection of link connection can be achieved in link layer.
Fig. 2 is for the downlink data process chart of the present invention.As shown in Fig. 2, a kind of read-only control methods of USB, including
Following steps:
A. serial data stream is sent out by the USB Host interfaces of upstream host, by the physical layer in USB Device interfaces
It is converted into parallel data stream and is sent into the link layer;
Link layer in b.USB Device interfaces is for determining the parallel data stream boundary flowed into, to determine whether chain
The control packet of road floor processing;If so, link layer handles control packet;If it is not, entering step c;
C. the control packet of the link layer process in non-USB Device interfaces is sent in the down buffer storage device of the sides Device;
Packet other than non-controlling packet is sent in master controller by the sides d.Device down buffer storage device, and master controller is to non-control
The type of packet other than system packet is analyzed, and reads the Packet type field in the packet header of the packet other than non-controlling packet, and judge non-
Whether the packet other than control packet is the data packet (Data Packet, DP) for transmitting data;If it is not, entering step e;If so, into
Step f;
E. the control packet stream of master controller enters in the down buffer storage device of the sides Host, then by USB Host interfaces that control packet is logical
The USB Device interfaces for crossing upstream device are sent to upstream device;
F. master controller further reads the information in the packet header of the packet other than non-controlling packet, according to number in the packet header of reading
According to length information, complete data packet is taken out from the down buffer storage device of the sides Device;
G. master controller is generated according to the information in the packet header of the data packet of taking-up confirms transaction packet
(Acknowledgement Transaction Packet, ACK TP) is simultaneously put on the sides Device in row buffer;
Confirmation transaction packet on the sides h.Device in row buffer is sent to upstream host by USB Device interfaces, and
It is matched with the comparison of the data packet number of upstream host.
Upstream host establishes ppp protocol with upstream device, and upstream host passes through USB Device interfaces and USBHost interfaces
Control stream signal is sent to upstream device.
Upstream device sends upstream by USB Host interfaces, wherein the physical layer in USB Host interfaces will
Converting serial data streams are at parallel data stream and are sent into link layer, this link layer will not belong to other than the control packet of this layer processing
Packet is put on the sides Host in row buffer, and the packet in row buffer on the sides Host is moved to the sides Device uplink and delayed by master controller
In storage, upstream host is sent to by USB Device interfaces.
The operation principle of the present invention:Upstream host is apparatus for obtaining evidence, and upstream device is to wait for evidence taking equipment.When upstream device connects
When entering upstream host, upstream host sends out the control stream signal for reading upstream device, and upstream device sends uplink by USB interface
Data flow, the processing after USB Host interfaces by physical layer and link layer, will not belong to the Bao Doufang of link layer process
Enter into row buffer on the sides Host, the packet in row buffer on the sides Host is moved to the sides Device uplink and cached by master controller
In device, host is sent to by USB Device interfaces.
When upstream host sends out serial data stream, handled by the physical layer in USB Device interfaces, link layer,
And the data flow that will not belong to link layer is sent to the sides Device down buffer storage device, master controller is to the sides Device down buffer storage device
The type of the data flow summarized is analyzed, and judges whether it is the data packet for transmitting data, if it is not, then putting it into Host
In the down buffer storage device of side, upstream device is issued by USB Host interfaces;If so, showing that upstream host has initiated downstream equipment
The operation of data is written, master controller can further read other fields in packet header, will be whole according to the length of data in packet header
A data packet is taken out from the sides Device down buffer storage device, while being generated according to the relevant information in the packet header of data packet and confirming affairs
Packet, is put on the sides Device in row buffer, upstream host is sent to by USB Device interfaces.The confirmation transaction packet number of generation
Amount is flux matched with the number-of-packet of host.
The specific implementation of the read-only control system of USB of the present invention and its method, may relate to utility software, but used
Software is the most common software of those skilled in the art, also, not patent application claims scope of the claimed.
Finally it should be noted that:Those skilled in the art various changes and modifications can be made to the invention without departing from
The spirit and scope of the present invention.In this way, if these modifications and changes of the present invention belongs to the claims in the present invention and its waits system
Within the scope of counting, then the present invention is also intended to include these modification and variations.