From: Luke Kenneth Casson Leighton Date: Mon, 23 Jul 2018 14:09:22 +0000 (+0100) Subject: convert uart16550 to get/put X-Git-Url: https://git.libre-soc.org/?p=shakti-peripherals.git;a=commitdiff_plain;h=7313966f13ebd830ac816b721c0d63fb0c9588b9 convert uart16550 to get/put --- diff --git a/src/peripherals/uart/Uart16550.bsv b/src/peripherals/uart/Uart16550.bsv index ae97d23..ecdc1ac 100644 --- a/src/peripherals/uart/Uart16550.bsv +++ b/src/peripherals/uart/Uart16550.bsv @@ -175,10 +175,14 @@ typedef enum { (* always_ready, always_enabled *) interface RS232_PHY_Ifc; - (* always_ready, always_enabled *) method Action modem_input(bit srx, bit cts, bit dsr, bit ri, bit dcd); - method bit modem_output_stx; - method bit modem_output_rts; - method bit modem_output_dtr; + interface Get#(Bit#(1)) srx_in; + interface Get#(Bit#(1)) cts_in; + interface Get#(Bit#(1)) dsr_in; + interface Get#(Bit#(1)) ri_in; + interface Get#(Bit#(1)) dcd_in; + interface Put#(Bit#(1)) stx_out; + interface Put#(Bit#(1)) rts_out; + interface Put#(Bit#(1)) dtr_out; endinterface @@ -653,16 +657,57 @@ module mkUart16550#(Clock core_clock, Reset core_reset)(Uart16550_AXI4_Lite_Ifc) endrule */ interface RS232_PHY_Ifc coe_rs232; - method Action modem_input(bit srx, bit cts, bit dsr, bit ri, bit dcd); - pin_srx_sync <= srx; // RX Input - pin_cts_sync <= cts; // CTS Input - pin_dsr_sync <= dsr; // Data Set Ready indicating that MODEM is ready to establish the communication - pin_ri_sync <= ri; // Ring Indicator indicate that a telephone ringing signal has been recieved by the MODEM - pin_dcd_sync <= dcd; // Data carrier detect - endmethod - method bit modem_output_stx = pin_stx; // Tx output - method bit modem_output_rts = pin_rts; // RTS output - method bit modem_output_dtr = pin_dtr; // Data Terminal Ready output + + interface srx_in = interface Put + method Action put(Bit#(1) in); + pin_srx_sync <= in; // RX Input + endmethod + endinterface; + + interface cts_in = interface Put + method Action put(Bit#(1) in); + pin_cts_sync <= in; // CTS Input + endmethod + endinterface; + + interface dsr_in = interface Put + method Action put(Bit#(1) in); + pin_dsr_sync <= in; // Data Set Ready indicating that MODEM is ready + // to establish the communication + endmethod + endinterface; + + interface ri_in = interface Put + method Action put(Bit#(1) in); + pin_ri_sync <= in; // Ring Indicator indicate that a telephone ringing + //signal has been recieved by the MODEM + endmethod + endinterface; + + interface dcd_in = interface Put + method Action put(Bit#(1) in); + pin_dcd_sync <= in; // Data carrier detect + endmethod + endinterface; + + interface stx_out = interface Get + method ActionValue#(Bit#(1)) get; + return pin_stx; // Tx output + endmethod + endinterface; + + interface rts_out = interface Get + method ActionValue#(Bit#(1)) get; + return pin_rts; // RTS output + endmethod + endinterface; + + interface dtr_out = interface Get + method ActionValue#(Bit#(1)) get; + return pin_dtr; // Data Terminal Ready output + endmethod + endinterface; + endinterface interface slave_axi_uart = s_xactor.axi_side;