1 //------------------------------------------------------------------------------
2 // IMPORTANT:
3 // This file will NOT be built in CI test and should be used for any functions
4 // that require addition support to simulate in CI test. Any functions that will
5 // work out-of-the-box in CI test with use of the fake device tree should be put
6 // in `pdbg.cpp`.
7 //------------------------------------------------------------------------------
8 
9 #include <assert.h>
10 
11 extern "C"
12 {
13 #include <libpdbg_sbe.h>
14 }
15 
16 #include <util/pdbg.hpp>
17 #include <util/trace.hpp>
18 
19 using namespace analyzer;
20 
21 namespace util
22 {
23 
24 namespace pdbg
25 {
26 
27 //------------------------------------------------------------------------------
28 
29 bool queryLpcTimeout(pdbg_target* target)
30 {
31     // Must be a processor target.
32     assert(TYPE_PROC == getTrgtType(target));
33 
34     uint32_t result = 0;
35     if (0 != sbe_lpc_timeout(util::pdbg::getPibTrgt(target), &result))
36     {
37         trace::err("sbe_lpc_timeout() failed: target=%s", getPath(target));
38         result = 0; // just in case
39     }
40 
41     // 0 if no timeout, 1 if LPC timeout occurred.
42     return (0 != result);
43 }
44 
45 //------------------------------------------------------------------------------
46 
47 } // namespace pdbg
48 
49 } // namespace util
50