Skip to content

Commit

Permalink
V2: dma_flock: Update Framelock addresses
Browse files Browse the repository at this point in the history
Moved the Framelock from FLAGS to CONTROL register.
Target HDL: V4, 9084038788f036d357ce052a9ea391caff3d1d1e
Had to add a set_control to the DMA API since enable/disable_dma do not
preserve the other bits states.

Signed-off-by: Jorge Marques <[email protected]>
  • Loading branch information
gastmaier committed Jul 22, 2024
1 parent 6271fe7 commit 0bfc053
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 18 deletions.
10 changes: 5 additions & 5 deletions common/sv/adi_regmap_dmac_pkg.sv
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,14 @@ package adi_regmap_dmac_pkg;
`define UPDATE_DMAC_IRQ_SOURCE_TRANSFER_QUEUED(x,y) UpdateField(DMAC_IRQ_SOURCE,"TRANSFER_QUEUED",x,y)

const reg_t DMAC_CONTROL = '{ 'h0400, "CONTROL" , '{
"FRAMELOCK": '{ 3, 3, RW, 'h0 },
"HWDESC": '{ 2, 2, RW, 'h0 },
"PAUSE": '{ 1, 1, RW, 'h0 },
"ENABLE": '{ 0, 0, RW, 'h0 }}};
`define SET_DMAC_CONTROL_FRAMELOCK(x) SetField(DMAC_CONTROL,"FRAMELOCK",x)
`define GET_DMAC_CONTROL_FRAMELOCK(x) GetField(DMAC_CONTROL,"FRAMELOCK",x)
`define DEFAULT_DMAC_CONTROL_FRAMELOCK GetResetValue(DMAC_CONTROL,"FRAMELOCK")
`define UPDATE_DMAC_CONTROL_FRAMELOCK(x,y) UpdateField(DMAC_CONTROL,"FRAMELOCK",x,y)
`define SET_DMAC_CONTROL_HWDESC(x) SetField(DMAC_CONTROL,"HWDESC",x)
`define GET_DMAC_CONTROL_HWDESC(x) GetField(DMAC_CONTROL,"HWDESC",x)
`define DEFAULT_DMAC_CONTROL_HWDESC GetResetValue(DMAC_CONTROL,"HWDESC")
Expand Down Expand Up @@ -211,14 +216,9 @@ package adi_regmap_dmac_pkg;
`define UPDATE_DMAC_TRANSFER_SUBMIT_TRANSFER_SUBMIT(x,y) UpdateField(DMAC_TRANSFER_SUBMIT,"TRANSFER_SUBMIT",x,y)

const reg_t DMAC_FLAGS = '{ 'h040c, "FLAGS" , '{
"FRAMELOCK": '{ 3, 3, RW, 0 },
"PARTIAL_REPORTING_EN": '{ 2, 2, RW, 0 },
"TLAST": '{ 1, 1, RW, 0 },
"CYCLIC": '{ 0, 0, RW, 0 }}};
`define SET_DMAC_FLAGS_FRAMELOCK(x) SetField(DMAC_FLAGS,"FRAMELOCK",x)
`define GET_DMAC_FLAGS_FRAMELOCK(x) GetField(DMAC_FLAGS,"FRAMELOCK",x)
`define DEFAULT_DMAC_FLAGS_FRAMELOCK GetResetValue(DMAC_FLAGS,"FRAMELOCK")
`define UPDATE_DMAC_FLAGS_FRAMELOCK(x,y) UpdateField(DMAC_FLAGS,"FRAMELOCK",x,y)
`define SET_DMAC_FLAGS_PARTIAL_REPORTING_EN(x) SetField(DMAC_FLAGS,"PARTIAL_REPORTING_EN",x)
`define GET_DMAC_FLAGS_PARTIAL_REPORTING_EN(x) GetField(DMAC_FLAGS,"PARTIAL_REPORTING_EN",x)
`define DEFAULT_DMAC_FLAGS_PARTIAL_REPORTING_EN GetResetValue(DMAC_FLAGS,"PARTIAL_REPORTING_EN")
Expand Down
16 changes: 13 additions & 3 deletions common/sv/dmac_api.sv
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ package dmac_api_pkg;
this.axi_write(GetAddrs(DMAC_Y_LENGTH), 32'h0);
end
this.axi_read(GetAddrs(DMAC_FLAGS), val);
p.FRAMELOCK = `GET_DMAC_FLAGS_FRAMELOCK(val);
p.FRAMELOCK = `GET_DMAC_CONTROL_FRAMELOCK(val);
endtask : discover_params

// -----------------
Expand Down Expand Up @@ -134,15 +134,25 @@ package dmac_api_pkg;
`SET_DMAC_CONTROL_PAUSE(0));
endtask : disable_dma

// -----------------
//
// -----------------
task set_control(input bit[3:0] control);
this.axi_write(GetAddrs(DMAC_CONTROL),
`SET_DMAC_CONTROL_ENABLE(control[0]) |
`SET_DMAC_CONTROL_PAUSE(control[1]) |
`SET_DMAC_CONTROL_HWDESC(control[2]) |
`SET_DMAC_CONTROL_FRAMELOCK(control[3]));
endtask : set_control

// -----------------
//
// -----------------
task set_flags(input bit[3:0] flags);
this.axi_write(GetAddrs(DMAC_FLAGS),
`SET_DMAC_FLAGS_CYCLIC(flags[0]) |
`SET_DMAC_FLAGS_TLAST(flags[1]) |
`SET_DMAC_FLAGS_PARTIAL_REPORTING_EN(flags[2]) |
`SET_DMAC_FLAGS_FRAMELOCK(flags[3]));
`SET_DMAC_FLAGS_PARTIAL_REPORTING_EN(flags[2]));
endtask : set_flags

// -----------------
Expand Down
4 changes: 2 additions & 2 deletions dma_flock/cfgs/cfg3_fsync_autorun.tcl
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ set m_dma_cfg [list \
DMA_2D_TLAST_MODE {1} \
\
AUTORUN $AUTORUN \
AUTORUN_FLAGS {0xB} \
AUTORUN_FLAGS {0x13} \
AUTORUN_SRC_ADDR {0x00000000} \
AUTORUN_DEST_ADDR {0x00001000} \
AUTORUN_X_LENGTH {0x3FF} \
Expand All @@ -50,7 +50,7 @@ set s_dma_cfg [list \
DMA_2D_TLAST_MODE {1} \
\
AUTORUN $AUTORUN \
AUTORUN_FLAGS {0xB} \
AUTORUN_FLAGS {0x13} \
AUTORUN_SRC_ADDR {0x00001000} \
AUTORUN_DEST_ADDR {0x00000000} \
AUTORUN_X_LENGTH {0x3FF} \
Expand Down
8 changes: 4 additions & 4 deletions dma_flock/tests/test_program.sv
Original file line number Diff line number Diff line change
Expand Up @@ -175,11 +175,11 @@ program test_program;
env.ref_src_axis_seq.start();
`endif

m_dmac_api.enable_dma();
m_dmac_api.set_flags('b1111);
m_dmac_api.set_control('b1001);
m_dmac_api.set_flags('b111);

s_dmac_api.enable_dma();
s_dmac_api.set_flags('b1111);
s_dmac_api.set_control('b1001);
s_dmac_api.set_flags('b111);

`ifdef HAS_XIL_VDMA
// Config S2MM
Expand Down
9 changes: 5 additions & 4 deletions dma_flock/tests/test_program_frame_delay.sv
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,7 @@ program test_program_frame_delay;
// Get parameters
autorun_flock_framenum = `TH.`DUT_RX_DMA.inst.AUTORUN_FRAMELOCK_CONFIG & 'hFF;
autorun_flock_distance = (((`TH.`DUT_RX_DMA.inst.AUTORUN_FRAMELOCK_CONFIG) >> 16) & 'hFF) + 1;

singleTest(
.frame_num(10),
.flock_framenum(autorun_flock_framenum),
Expand Down Expand Up @@ -217,11 +218,11 @@ program test_program_frame_delay;
`endif

if (has_autorun == 0) begin
m_dmac_api.enable_dma();
m_dmac_api.set_flags('b1111);
m_dmac_api.set_control('b1001);
m_dmac_api.set_flags('b111);

s_dmac_api.enable_dma();
s_dmac_api.set_flags('b1111);
s_dmac_api.set_control('b1001);
s_dmac_api.set_flags('b111);
end

`ifdef HAS_XIL_VDMA
Expand Down

0 comments on commit 0bfc053

Please sign in to comment.