mirror of
https://github.com/mist-devel/mist-board.git
synced 2026-02-02 06:21:12 +00:00
Printer redirection via USB
This commit is contained in:
@@ -287,10 +287,10 @@ wire ste_dma_snd_xsirq, ste_dma_snd_xsirq_delayed;
|
||||
// mfp io7 is mono_detect which in ste is xor'd with the dma sound irq
|
||||
wire mfp_io7 = system_ctrl[8] ^ (ste?ste_dma_snd_xsirq:1'b0);
|
||||
|
||||
// input 0 is busy from printer port which has a pullup
|
||||
// input 0 is busy from printer which is pulled up when the printer cannot accept further data
|
||||
// inputs 1,2 and 6 are inputs from serial which have pullups before an inverter
|
||||
wire [7:0] mfp_gpio_in = {mfp_io7, 1'b0, !dma_irq, !acia_irq, !blitter_irq, 3'b001 };
|
||||
wire [1:0] mfp_timer_in = {st_de, ste?ste_dma_snd_xsirq_delayed:1'b1};
|
||||
wire [7:0] mfp_gpio_in = {mfp_io7, 1'b0, !dma_irq, !acia_irq, !blitter_irq, 2'b00, parallal_fifo_full};
|
||||
wire [1:0] mfp_timer_in = {st_de, ste?ste_dma_snd_xsirq_delayed:parallal_fifo_full};
|
||||
|
||||
mfp mfp (
|
||||
// cpu register interface
|
||||
@@ -457,11 +457,53 @@ sigma_delta_dac sigma_delta_dac_r (
|
||||
);
|
||||
|
||||
//// ym2149 sound chip ////
|
||||
|
||||
// ------ fifo to store printer data coming from psg ---------
|
||||
localparam FIFO_ADDR_BITS = 4;
|
||||
localparam FIFO_DEPTH = (1 << FIFO_ADDR_BITS);
|
||||
reg [7:0] fifoOut [FIFO_DEPTH-1:0];
|
||||
reg [FIFO_ADDR_BITS-1:0] writePout, readPout;
|
||||
|
||||
wire parallal_fifo_full = (readPout === (writePout + 4'd1));
|
||||
assign parallel_data_out_available = (readPout != writePout);
|
||||
assign parallel_data_out = fifoOut[readPout];
|
||||
|
||||
// parallel strobe signal
|
||||
reg parallel_strobeD, parallel_strobeD2;
|
||||
// strobe signal by io controller when reading from parallel fifo
|
||||
reg parallel_strobe_outD, parallel_strobe_outD2;
|
||||
|
||||
always @(posedge clk_8) begin
|
||||
// printer strobe generated by core/ST using the PSG
|
||||
parallel_strobeD <= port_a_out[5];
|
||||
parallel_strobeD2 <= parallel_strobeD;
|
||||
|
||||
// fifo read strobe generated by io controller
|
||||
parallel_strobe_outD <= parallel_strobe_out;
|
||||
parallel_strobe_outD2 <= parallel_strobe_outD;
|
||||
|
||||
if(reset) begin
|
||||
readPout <= 4'd0;
|
||||
writePout <= 4'd0;
|
||||
end else begin
|
||||
// rising edge on fifo read strobe from io controller
|
||||
if(parallel_strobe_outD && !parallel_strobe_outD2)
|
||||
readPout <= readPout + 4'd1;
|
||||
|
||||
// rising edge on strobe signal coming from psg
|
||||
if(parallel_strobeD && !parallel_strobeD2) begin
|
||||
fifoOut[writePout] <= port_b_out;
|
||||
writePout <= writePout + 4'd1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
reg [1:0] sclk;
|
||||
always @ (posedge clk_8)
|
||||
sclk <= sclk + 2'd1;
|
||||
|
||||
wire [7:0] port_a_out;
|
||||
wire [7:0] port_a_out /* synthesis keep */;
|
||||
wire [7:0] port_b_out /* synthesis keep */;
|
||||
assign floppy_side = port_a_out[0];
|
||||
assign floppy_sel = port_a_out[2:1];
|
||||
|
||||
@@ -492,7 +534,7 @@ YM2149 ym2149 (
|
||||
|
||||
// port b
|
||||
.I_IOB ( 8'd0 ),
|
||||
.O_IOB ( ),
|
||||
.O_IOB ( port_b_out ),
|
||||
.O_IOB_OE_L ( ),
|
||||
|
||||
//
|
||||
@@ -1041,6 +1083,11 @@ wire serial_data_from_mfp_available;
|
||||
wire [7:0] serial_data_to_mfp;
|
||||
wire serial_strobe_to_mfp;
|
||||
|
||||
// connection to transfer parallel data from psg to io controller
|
||||
wire [7:0] parallel_data_out;
|
||||
wire parallel_strobe_out;
|
||||
wire parallel_data_out_available;
|
||||
|
||||
//// user io has an extra spi channel outside minimig core ////
|
||||
user_io user_io(
|
||||
.SPI_CLK(SPI_SCK),
|
||||
@@ -1063,6 +1110,11 @@ user_io user_io(
|
||||
.serial_strobe_in(serial_strobe_to_mfp),
|
||||
.serial_data_in(serial_data_to_mfp),
|
||||
|
||||
// parallel interface
|
||||
.parallel_strobe_out(parallel_strobe_out),
|
||||
.parallel_data_out(parallel_data_out),
|
||||
.parallel_data_out_available(parallel_data_out_available),
|
||||
|
||||
.CORE_TYPE(8'ha3) // mist core id
|
||||
);
|
||||
|
||||
|
||||
@@ -23,6 +23,11 @@ module user_io(
|
||||
output reg serial_strobe_in,
|
||||
output reg [7:0] serial_data_in,
|
||||
|
||||
// parallel data from psg/ym to io controller
|
||||
output reg parallel_strobe_out,
|
||||
input parallel_data_out_available,
|
||||
input [7:0] parallel_data_out,
|
||||
|
||||
output [1:0] BUTTONS,
|
||||
output [1:0] SWITCHES
|
||||
);
|
||||
@@ -55,6 +60,14 @@ module user_io(
|
||||
else
|
||||
SPI_MISO <= serial_data_out[15-cnt];
|
||||
end
|
||||
|
||||
// parallel psg/ym->io controller
|
||||
if(cmd == 6) begin
|
||||
if(!toggle)
|
||||
SPI_MISO <= parallel_data_out_available;
|
||||
else
|
||||
SPI_MISO <= parallel_data_out[15-cnt];
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -65,6 +78,7 @@ module user_io(
|
||||
ikbd_strobe_in <= 1'b0;
|
||||
ikbd_strobe_out <= 1'b0;
|
||||
serial_strobe_out <= 1'b0;
|
||||
parallel_strobe_out <= 1'b0;
|
||||
end else begin
|
||||
sbuf[6:1] <= sbuf[5:0];
|
||||
sbuf[0] <= SPI_MOSI;
|
||||
@@ -88,6 +102,7 @@ module user_io(
|
||||
ikbd_strobe_out <= 1'b0;
|
||||
serial_strobe_in <= 1'b0;
|
||||
serial_strobe_out <= 1'b0;
|
||||
parallel_strobe_out <= 1'b0;
|
||||
end
|
||||
|
||||
// payload byte
|
||||
@@ -116,6 +131,10 @@ module user_io(
|
||||
// give strobe after second serial byte (toggle ==1)
|
||||
if((cmd == 5) && toggle)
|
||||
serial_strobe_out <= 1'b1;
|
||||
|
||||
// give strobe after second parallel byte (toggle ==1)
|
||||
if((cmd == 6) && toggle)
|
||||
parallel_strobe_out <= 1'b1;
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user