Commit 294c36b7 authored by Ille, Ondrej, Ing.'s avatar Ille, Ondrej, Ing.

src: Add transfer to Operation control - Off when unit is bus off!

parent 71413606
......@@ -582,6 +582,12 @@ begin
-- Memory registers Interface
drv_bus => drv_bus, -- IN
-- Prescaler Interface
rx_trigger => pc_rx_trigger, -- IN
-- Fault confinement Interface
is_bus_off => is_bus_off_i, -- IN
-- Protocol Control Interface
arbitration_lost => arbitration_lost_i, -- IN
......
......@@ -85,6 +85,18 @@ entity operation_control is
-- Driving bus
drv_bus :in std_logic_vector(1023 downto 0);
------------------------------------------------------------------------
-- Prescaler Interface
------------------------------------------------------------------------
-- RX Trigger
rx_trigger :in std_logic;
------------------------------------------------------------------------
-- Fault confinement Interface
------------------------------------------------------------------------
-- Unit is Bus-off
is_bus_off :in std_logic;
------------------------------------------------------------------------
-- Protocol Control Interface
------------------------------------------------------------------------
......@@ -120,8 +132,19 @@ architecture rtl of operation_control is
signal curr_state : t_operation_control_state;
signal next_state : t_operation_control_state;
-- Unit is off the bus
signal go_to_off : std_logic;
begin
-- Unit should go to off when it turned Error Passive or when it is disabled.
-- Gated by RX Trigger (delayed till next sample point) to avoid transiting
-- back to off directly after end of integration/reintegration.
go_to_off <= '1' when (is_bus_off = '1' or drv_ena = CTU_CAN_DISABLED) and
(rx_trigger = '1')
else
'0';
-- Driving bus aliases
drv_ena <= drv_bus(DRV_ENA_INDEX);
......@@ -129,38 +152,44 @@ begin
-- Next state
---------------------------------------------------------------------------
next_state_proc : process(curr_state, set_idle, set_transmitter,
set_receiver, arbitration_lost, drv_ena)
set_receiver, arbitration_lost, go_to_off)
begin
next_state <= curr_state;
if (drv_ena = CTU_CAN_DISABLED) then
next_state <= s_oc_off;
else
case curr_state is
when s_oc_off =>
if (set_idle = '1') then
next_state <= s_oc_idle;
end if;
when s_oc_idle =>
if (set_transmitter = '1') then
next_state <= s_oc_transmitter;
elsif (set_receiver = '1') then
next_state <= s_oc_receiver;
end if;
when s_oc_transmitter =>
if (set_idle = '1') then
next_state <= s_oc_idle;
elsif (set_receiver = '1' or arbitration_lost = '1') then
next_state <= s_oc_receiver;
end if;
when s_oc_receiver =>
if (set_idle = '1') then
next_state <= s_oc_idle;
elsif (set_transmitter = '1') then
next_state <= s_oc_transmitter;
end if;
end case;
end if;
case curr_state is
when s_oc_off =>
if (set_idle = '1') then
next_state <= s_oc_idle;
end if;
when s_oc_idle =>
if (go_to_off = '1') then
next_state <= s_oc_off;
elsif (set_transmitter = '1') then
next_state <= s_oc_transmitter;
elsif (set_receiver = '1') then
next_state <= s_oc_receiver;
end if;
when s_oc_transmitter =>
if (go_to_off = '1') then
next_state <= s_oc_off;
elsif (set_idle = '1') then
next_state <= s_oc_idle;
elsif (set_receiver = '1' or arbitration_lost = '1') then
next_state <= s_oc_receiver;
end if;
when s_oc_receiver =>
if (go_to_off = '1') then
next_state <= s_oc_off;
elsif (set_idle = '1') then
next_state <= s_oc_idle;
elsif (set_transmitter = '1') then
next_state <= s_oc_transmitter;
end if;
end case;
end process;
---------------------------------------------------------------------------
......
......@@ -1046,6 +1046,18 @@ package can_components is
------------------------------------------------------------------------
-- Driving bus
drv_bus :in std_logic_vector(1023 downto 0);
------------------------------------------------------------------------
-- Prescaler Interface
------------------------------------------------------------------------
-- RX Trigger
rx_trigger :in std_logic;
------------------------------------------------------------------------
-- Fault confinement Interface
------------------------------------------------------------------------
-- Unit is Bus-off
is_bus_off :in std_logic;
------------------------------------------------------------------------
-- Protocol Control Interface
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment