Line 1... |
Line 1... |
--
|
--
|
-- UART interrupt control
|
-- UART interrupt control
|
--
|
--
|
-- Author: Sebastian Witt
|
-- Author: Sebastian Witt
|
-- Date: 27.01.2008
|
-- Date: 27.01.2008
|
-- Version: 1.0
|
-- Version: 1.1
|
|
--
|
|
-- History: 1.0 - Initial version
|
|
-- 1.1 - Automatic flow control
|
|
--
|
--
|
--
|
-- This code is free software; you can redistribute it and/or
|
-- This code is free software; you can redistribute it and/or
|
-- modify it under the terms of the GNU Lesser General Public
|
-- modify it under the terms of the GNU Lesser General Public
|
-- License as published by the Free Software Foundation; either
|
-- License as published by the Free Software Foundation; either
|
-- version 2.1 of the License, or (at your option) any later version.
|
-- version 2.1 of the License, or (at your option) any later version.
|
Line 21... |
Line 25... |
-- Boston, MA 02111-1307 USA
|
-- Boston, MA 02111-1307 USA
|
--
|
--
|
|
|
LIBRARY IEEE;
|
LIBRARY IEEE;
|
USE IEEE.std_logic_1164.all;
|
USE IEEE.std_logic_1164.all;
|
USE IEEE.std_logic_unsigned.all;
|
|
USE IEEE.numeric_std.all;
|
USE IEEE.numeric_std.all;
|
|
|
-- Serial UART interrupt control
|
-- Serial UART interrupt control
|
entity uart_interrupt is
|
entity uart_interrupt is
|
port (
|
port (
|
Line 34... |
Line 37... |
IER : in std_logic_vector(3 downto 0); -- IER 3:0
|
IER : in std_logic_vector(3 downto 0); -- IER 3:0
|
LSR : in std_logic_vector(4 downto 0); -- LSR 4:0
|
LSR : in std_logic_vector(4 downto 0); -- LSR 4:0
|
THI : in std_logic; -- Transmitter holding register empty interrupt
|
THI : in std_logic; -- Transmitter holding register empty interrupt
|
RDA : in std_logic; -- Receiver data available
|
RDA : in std_logic; -- Receiver data available
|
CTI : in std_logic; -- Character timeout indication
|
CTI : in std_logic; -- Character timeout indication
|
|
AFE : in std_logic; -- Automatic flow control enable
|
MSR : in std_logic_vector(3 downto 0); -- MSR 3:0
|
MSR : in std_logic_vector(3 downto 0); -- MSR 3:0
|
IIR : out std_logic_vector(3 downto 0); -- IIR 3:0
|
IIR : out std_logic_vector(3 downto 0); -- IIR 3:0
|
INT : out std_logic -- Interrupt
|
INT : out std_logic -- Interrupt
|
);
|
);
|
end uart_interrupt;
|
end uart_interrupt;
|
Line 62... |
Line 66... |
iCTIInterrupt <= IER(0) and CTI;
|
iCTIInterrupt <= IER(0) and CTI;
|
|
|
-- Priority 3: Transmitter holding register empty
|
-- Priority 3: Transmitter holding register empty
|
iTHRInterrupt <= IER(1) and THI;
|
iTHRInterrupt <= IER(1) and THI;
|
|
|
-- Priority 4: Modem status interrupt: dCTS, dDSR, TERI, dDCD
|
-- Priority 4: Modem status interrupt: dCTS (when AFC is disabled), dDSR, TERI, dDCD
|
iMSRInterrupt <= IER(3) and (MSR(0) or MSR(1) or MSR(2) or MSR(3));
|
iMSRInterrupt <= IER(3) and ((MSR(0) and not AFE) or MSR(1) or MSR(2) or MSR(3));
|
|
|
-- IIR
|
-- IIR
|
IC_IIR: process (CLK, RST)
|
IC_IIR: process (CLK, RST)
|
begin
|
begin
|
if (RST = '1') then
|
if (RST = '1') then
|