File tree Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Expand file tree Collapse file tree 3 files changed +18
-17
lines changed Original file line number Diff line number Diff line change 11
11
12
12
#pragma once
13
13
14
+ #include < tuple>
15
+
14
16
#include " RegAccessor.hpp"
15
17
#include " UioIf.hpp"
16
18
#include " udmaio/rdl/AxiDma.hpp"
17
-
18
19
namespace udmaio {
19
20
20
21
using AxiDmaBlock = axi_dma::block<RegAccessorArray>;
@@ -31,7 +32,7 @@ class UioAxiDmaIf : public UioIf, AxiDmaBlock {
31
32
using UioIf::arm_interrupt;
32
33
33
34
// / Wait for interrupt and acknowledge it
34
- uint32_t clear_interrupt ();
35
+ std::tuple< uint32_t , axi_dma:: s2mm_dmasr_t > clear_interrupt ();
35
36
36
37
// / @brief Check status register and log any errors
37
38
// / @return true if any error occurred
Original file line number Diff line number Diff line change @@ -59,18 +59,21 @@ void DataHandlerAbstract::_handle_input(const boost::system::error_code& ec) {
59
59
return ;
60
60
}
61
61
62
- // Check for error flags and log them
63
- _dma.check_for_errors ();
64
-
65
- uint32_t irq_count = _dma.clear_interrupt ();
62
+ auto [irq_count, dma_stat] = _dma.clear_interrupt ();
66
63
BOOST_LOG_SEV (_lg, bls::trace) << " irq count = " << irq_count;
64
+ if (dma_stat.err_irq && _dma.check_for_errors ()) {
65
+ _desc.print_descs ();
66
+ throw std::runtime_error (" DMA engine error raised" );
67
+ }
67
68
68
- auto full_bufs = _receive_packets ? _desc.get_next_packet () : _desc.get_full_buffers ();
69
- if (full_bufs.empty ()) {
70
- BOOST_LOG_SEV (_lg, bls::trace) << " spurious event, got no data" ;
71
- } else {
72
- auto bytes = _desc.read_buffers (full_bufs);
73
- process_data (std::move (bytes));
69
+ if (dma_stat.ioc_irq ) {
70
+ auto full_bufs = _receive_packets ? _desc.get_next_packet () : _desc.get_full_buffers ();
71
+ if (full_bufs.empty ()) {
72
+ BOOST_LOG_SEV (_lg, bls::trace) << " spurious event, got no data" ;
73
+ } else {
74
+ auto bytes = _desc.read_buffers (full_bufs);
75
+ process_data (std::move (bytes));
76
+ }
74
77
}
75
78
76
79
_start_read ();
Original file line number Diff line number Diff line change @@ -51,7 +51,7 @@ void UioAxiDmaIf::start(uintptr_t start_desc) {
51
51
<< " DMA ctrl = 0x" << std::hex << reg_to_raw (s2mm_dmacr.rd ()) << std::dec;
52
52
}
53
53
54
- uint32_t UioAxiDmaIf::clear_interrupt () {
54
+ std::tuple< uint32_t , axi_dma:: s2mm_dmasr_t > UioAxiDmaIf::clear_interrupt () {
55
55
uint32_t irq_count = wait_for_interrupt ();
56
56
57
57
auto stat = s2mm_dmasr.rd ();
@@ -60,13 +60,10 @@ uint32_t UioAxiDmaIf::clear_interrupt() {
60
60
}
61
61
if (stat.err_irq ) {
62
62
BOOST_LOG_SEV (_lg, bls::warning) << " ERR IRQ" ;
63
- if (check_for_errors ()) {
64
- throw std::runtime_error (" DMA engine error raised" );
65
- }
66
63
}
67
64
s2mm_dmasr.wr ({.ioc_irq = stat.ioc_irq , .err_irq = stat.err_irq });
68
65
69
- return irq_count;
66
+ return std::make_tuple ( irq_count, stat) ;
70
67
}
71
68
72
69
bool UioAxiDmaIf::check_for_errors () {
You can’t perform that action at this time.
0 commit comments