|
@@ -9,26 +9,26 @@
|
|
|
// License: LGPL
|
|
|
//-----------------------------------------------------------------
|
|
|
//
|
|
|
-// This source file may be used and distributed without
|
|
|
-// restriction provided that this copyright statement is not
|
|
|
-// removed from the file and that any derivative work contains
|
|
|
-// the original copyright notice and the associated disclaimer.
|
|
|
+// This source file may be used and distributed without
|
|
|
+// restriction provided that this copyright statement is not
|
|
|
+// removed from the file and that any derivative work contains
|
|
|
+// the original copyright notice and the associated disclaimer.
|
|
|
//
|
|
|
-// This source file is free software; you can redistribute it
|
|
|
-// and/or modify it under the terms of the GNU Lesser General
|
|
|
-// Public License as published by the Free Software Foundation;
|
|
|
-// either version 2.1 of the License, or (at your option) any
|
|
|
+// This source file is free software; you can redistribute it
|
|
|
+// and/or modify it under the terms of the GNU Lesser General
|
|
|
+// Public License as published by the Free Software Foundation;
|
|
|
+// either version 2.1 of the License, or (at your option) any
|
|
|
// later version.
|
|
|
//
|
|
|
-// This source is distributed in the hope that it will be
|
|
|
-// useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
-// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
-// PURPOSE. See the GNU Lesser General Public License for more
|
|
|
+// This source is distributed in the hope that it will be
|
|
|
+// useful, but WITHOUT ANY WARRANTY; without even the implied
|
|
|
+// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
|
|
|
+// PURPOSE. See the GNU Lesser General Public License for more
|
|
|
// details.
|
|
|
//
|
|
|
-// You should have received a copy of the GNU Lesser General
|
|
|
-// Public License along with this source; if not, write to the
|
|
|
-// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
+// You should have received a copy of the GNU Lesser General
|
|
|
+// Public License along with this source; if not, write to the
|
|
|
+// Free Software Foundation, Inc., 59 Temple Place, Suite 330,
|
|
|
// Boston, MA 02111-1307 USA
|
|
|
//-----------------------------------------------------------------
|
|
|
|
|
@@ -63,6 +63,7 @@ module usb_cdc_core
|
|
|
,output inport_accept_o
|
|
|
,output outport_valid_o
|
|
|
,output [ 7:0] outport_data_o
|
|
|
+ ,output outport_break_o
|
|
|
);
|
|
|
|
|
|
|
|
@@ -273,7 +274,7 @@ wire usb_hs_w;
|
|
|
//-----------------------------------------------------------------
|
|
|
// Transceiver Control (high speed)
|
|
|
//-----------------------------------------------------------------
|
|
|
-generate
|
|
|
+generate
|
|
|
if (USB_SPEED_HS == "True")
|
|
|
begin
|
|
|
|
|
@@ -655,7 +656,7 @@ begin
|
|
|
setup_frame_q <= 1'b0;
|
|
|
end
|
|
|
// Detect STATUS stage (ACK for SETUP GET requests)
|
|
|
-// TODO: Not quite correct ....
|
|
|
+// TODO: Not quite correct ....
|
|
|
else if (ep0_rx_valid_w && !rx_strb_w && rx_last_w)
|
|
|
begin
|
|
|
setup_valid_q <= 1'b0;
|
|
@@ -690,6 +691,9 @@ reg [15:0] ctrl_get_len_r;
|
|
|
|
|
|
reg [7:0] desc_addr_r;
|
|
|
|
|
|
+reg rx_break_q;
|
|
|
+reg rx_break_r;
|
|
|
+
|
|
|
reg addressed_q;
|
|
|
reg addressed_r;
|
|
|
reg [6:0] device_addr_r;
|
|
@@ -711,6 +715,7 @@ begin
|
|
|
addressed_r = addressed_q;
|
|
|
configured_r = configured_q;
|
|
|
set_with_data_r = set_with_data_q;
|
|
|
+ rx_break_r = 1'b0;
|
|
|
|
|
|
if (setup_valid_q)
|
|
|
begin
|
|
@@ -835,6 +840,9 @@ begin
|
|
|
end
|
|
|
`USB_CLASS_REQUEST:
|
|
|
begin
|
|
|
+ ctrl_ack_r = setup_set_w && setup_no_data_w;
|
|
|
+ set_with_data_r = setup_set_w && !setup_no_data_w;
|
|
|
+
|
|
|
case (bRequest_w)
|
|
|
`CDC_GET_LINE_CODING:
|
|
|
begin
|
|
@@ -842,11 +850,14 @@ begin
|
|
|
desc_addr_r = `ROM_CDC_LINE_CODING_ADDR;
|
|
|
ctrl_get_len_r = `ROM_CDC_LINE_CODING_SIZE;
|
|
|
end
|
|
|
+ `CDC_SEND_BREAK:
|
|
|
+ begin
|
|
|
+ rx_break_r = (wValue_w != 16'd0);
|
|
|
+ end
|
|
|
default:
|
|
|
- begin
|
|
|
- ctrl_ack_r = setup_set_w && setup_no_data_w;
|
|
|
- set_with_data_r = setup_set_w && !setup_no_data_w;
|
|
|
- end
|
|
|
+ begin
|
|
|
+ // Do nothing
|
|
|
+ end
|
|
|
endcase
|
|
|
end
|
|
|
default:
|
|
@@ -866,6 +877,7 @@ begin
|
|
|
addressed_q <= 1'b0;
|
|
|
configured_q <= 1'b0;
|
|
|
set_with_data_q <= 1'b0;
|
|
|
+ rx_break_q <= 1'b0;
|
|
|
end
|
|
|
else if (usb_reset_w)
|
|
|
begin
|
|
@@ -873,6 +885,7 @@ begin
|
|
|
addressed_q <= 1'b0;
|
|
|
configured_q <= 1'b0;
|
|
|
set_with_data_q <= 1'b0;
|
|
|
+ rx_break_q <= 1'b0;
|
|
|
end
|
|
|
else
|
|
|
begin
|
|
@@ -880,6 +893,7 @@ begin
|
|
|
addressed_q <= addressed_r;
|
|
|
configured_q <= configured_r;
|
|
|
set_with_data_q <= set_with_data_r;
|
|
|
+ rx_break_q <= rx_break_r;
|
|
|
end
|
|
|
|
|
|
//-----------------------------------------------------------------
|
|
@@ -1076,12 +1090,13 @@ assign ep3_rx_space_w = 1'b0;
|
|
|
reg inport_valid_q;
|
|
|
reg [7:0] inport_data_q;
|
|
|
reg [10:0] inport_cnt_q;
|
|
|
+reg outport_break_q;
|
|
|
|
|
|
always @ (posedge clk_i or posedge rst_i)
|
|
|
if (rst_i)
|
|
|
begin
|
|
|
- inport_valid_q <= 1'b0;
|
|
|
- inport_data_q <= 8'b0;
|
|
|
+ inport_valid_q <= 1'b0;
|
|
|
+ inport_data_q <= 8'b0;
|
|
|
end
|
|
|
else if (inport_accept_o)
|
|
|
begin
|
|
@@ -1111,6 +1126,16 @@ assign outport_valid_o = ep1_rx_valid_w && rx_strb_w;
|
|
|
assign outport_data_o = rx_data_w;
|
|
|
assign ep1_rx_space_w = outport_accept_i;
|
|
|
|
|
|
-
|
|
|
+always @(posedge clk_i or posedge rst_i)
|
|
|
+ if (rst_i)
|
|
|
+ outport_break_q <= 1'b0;
|
|
|
+ else
|
|
|
+ outport_break_q <= rx_break_q |
|
|
|
+ (outport_break_q &
|
|
|
+ ~setup_set_w &
|
|
|
+ ~outport_valid_o &
|
|
|
+ ~(inport_valid_q & ep2_tx_data_accept_w));
|
|
|
+
|
|
|
+assign outport_break_o = outport_break_q;
|
|
|
|
|
|
endmodule
|