Skip to content

Added DMA configurable timeout register #1246

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 9 commits into from
Mar 31, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion axi/dma/rtl/AxiDmaPkg.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -194,6 +194,7 @@ package AxiDmaPkg is
maxSize : slv(31 downto 0);
contEn : sl;
buffId : slv(31 downto 0);
timout : slv(31 downto 0);
end record;

constant AXI_WRITE_DMA_DESC_ACK_INIT_C : AxiWriteDmaDescAckType := (
Expand All @@ -204,7 +205,8 @@ package AxiDmaPkg is
dropEn => '0',
maxSize => (others=>'0'),
contEn => '0',
buffId => (others=>'0')
buffId => (others=>'0'),
timout => x"0000FFFF"
);

type AxiWriteDmaDescAckArray is array (natural range<>) of AxiWriteDmaDescAckType;
Expand Down
7 changes: 6 additions & 1 deletion axi/dma/rtl/v2/AxiStreamDmaV2Desc.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,7 @@ architecture rtl of AxiStreamDmaV2Desc is
buffWrCache : slv(3 downto 0);
enableCnt : slv(7 downto 0);
idBuffThold : Slv32Array(7 downto 0);
wrTimout : slv(31 downto 0);

-- FIFOs
fifoDin : slv(31 downto 0);
Expand Down Expand Up @@ -222,6 +223,7 @@ architecture rtl of AxiStreamDmaV2Desc is
buffWrCache => (others => '0'),
enableCnt => (others => '0'),
idBuffThold => (others => (others => '0')),
wrTimout => x"0000FFFF",
-- FIFOs
fifoDin => (others => '0'),
wrFifoWr => (others => '0'),
Expand Down Expand Up @@ -433,7 +435,7 @@ begin
axiSlaveRegister(regCon, x"000", 0, v.enable);
axiSlaveRegisterR(regCon, x"000", 8, r.enableCnt); -- Count the number of times enable transitions from 0->1
axiSlaveRegisterR(regCon, x"000", 16, '1'); -- Legacy DESC_128_EN_C constant (always 0x1 now)
axiSlaveRegisterR(regCon, x"000", 24, toSlv(4, 8)); -- Version Number for aes-stream-driver to case on
axiSlaveRegisterR(regCon, x"000", 24, toSlv(5, 8)); -- Version Number for aes-stream-driver to case on
axiSlaveRegister(regCon, x"004", 0, v.intEnable);
axiSlaveRegister(regCon, x"008", 0, v.contEn);
axiSlaveRegister(regCon, x"00C", 0, v.dropEn);
Expand Down Expand Up @@ -486,6 +488,8 @@ begin

axiSlaveRegister(regCon, x"084", 0, v.intHoldoff);

axiSlaveRegister(regCon, x"088", 0, v.wrTimout);

for i in 0 to 7 loop
axiSlaveRegister(regCon, toSlv(144 + i*4, 12), 0, v.idBuffThold(i)); -- 0x090 - 0xAC
axiSlaveRegisterR(regCon, toSlv(176 + i*4, 12), 0, r.idBuffCount(i)); -- 0x0B0 - 0xCC
Expand Down Expand Up @@ -583,6 +587,7 @@ begin
v.dmaWrDescAck(i).dropEn := r.dropEn;
v.dmaWrDescAck(i).contEn := r.contEn;
v.dmaWrDescAck(i).maxSize := r.maxSize;
v.dmaWrDescAck(i).timeout := r.wrTimout;

v.dmaWrDescAck(i).buffId(27 downto 0) := wrFifoDout(27 downto 0);

Expand Down
5 changes: 3 additions & 2 deletions axi/dma/rtl/v2/AxiStreamDmaV2Write.vhd
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ architecture rtl of AxiStreamDmaV2Write is
result : slv(1 downto 0);
reqCount : slv(31 downto 0);
ackCount : slv(31 downto 0);
stCount : slv(15 downto 0);
stCount : slv(31 downto 0);
awlen : slv(AXI_CONFIG_G.LEN_BITS_C-1 downto 0);
axiLen : AxiLenType;
wMaster : AxiWriteMasterType;
Expand Down Expand Up @@ -271,6 +271,7 @@ begin
v.dmaWrTrack.metaAddr := dmaWrDescAck.metaAddr;
v.dmaWrTrack.address := dmaWrDescAck.address;
v.dmaWrTrack.maxSize := dmaWrDescAck.maxSize;
v.dmaWrTrack.timout := dmaWrDescAck.timout;

-- Descriptor return calls for dumping frame?
if dmaWrDescAck.dropEn = '1' then
Expand Down Expand Up @@ -473,7 +474,7 @@ begin
v.dmaWrDescRet.valid := '1';
v.state := IDLE_S;
-- Check for ACK timeout
elsif (r.stCount = x"FFFF") then
elsif (r.stCount = r.dmaWrTrack.timout) then
-- Set the flags
v.dmaWrDescRet.result(1 downto 0) := "11";
v.dmaWrDescRet.valid := '1';
Expand Down