1 #pragma once 2 3 #include <libpdbg.h> 4 5 #include <attn/attn_config.hpp> 6 7 #include <bitset> 8 9 namespace attn 10 { 11 12 /** @brief attention handler configuration flags */ 13 inline constexpr uint32_t enableBreakpoints = 1; 14 15 /** 16 * @brief These objects contain information about an active attention. 17 * 18 * An Attention object is created for each active attention. These objects 19 * carry with them various configuration and status information as well 20 * the attention handler function to call for handling the attention. Each 21 * Attention object also carries a priority value. This priority is used 22 * to determine which attention event(s) to handle when there are more than 23 * one active event. 24 */ 25 class Attention 26 { 27 public: 28 /** @brief types of attentions to be handled (by priority low to high) */ 29 enum AttentionType 30 { 31 Special = 0, 32 Checkstop = 1, 33 Vital = 2 34 }; 35 36 /** @brief Default constructor. */ 37 Attention() = delete; 38 39 /** @brief Main constructors */ 40 Attention(AttentionType i_type, int (*i_handler)(Attention*), 41 pdbg_target* i_target, Config* i_config); 42 43 /** @brief Destructor */ 44 ~Attention() = default; 45 46 /** @brief Get attention priority */ 47 int getPriority() const; 48 49 /* @brief Get config object */ 50 Config* getConfig() const; 51 52 /* @brief Call attention handler function */ 53 int handle(); 54 55 /* @brief Get attention handler target */ 56 pdbg_target* getTarget() const; 57 58 /** @brief Copy constructor. */ 59 Attention(const Attention&) = default; 60 61 /** @brief Assignment operator. */ 62 Attention& operator=(const Attention&) = default; 63 64 /** @brief less than operator */ 65 bool operator<(const Attention& right) const; 66 67 private: 68 AttentionType iv_type; // attention type 69 int (*iv_handler)(Attention*); // handler function 70 pdbg_target* iv_target; // handler function target 71 Config* iv_config; // configuration flags 72 }; 73 74 } // namespace attn 75