1 #include <libpdbg.h> 2 3 #include <analyzer/analyzer_main.hpp> 4 #include <attn/attn_config.hpp> 5 #include <attn/attn_main.hpp> 6 #include <cli.hpp> 7 8 /** 9 * @brief Attention handler application main() 10 * 11 * This is the main interface to the hardware diagnostics application. This 12 * application can be loaded as a daemon for monitoring the attention 13 * gpio or it can be loaded as an application to analyze hardware and 14 * diagnose hardware error conditions. 15 * 16 * Usage: 17 * --analyze: Analyze the hardware 18 * --daemon: Start the attention handler daemon 19 * 20 * @return 0 = success 21 */ 22 int main(int argc, char* argv[]) 23 { 24 int rc = 0; // assume success 25 26 if (argc == 1) 27 { 28 printf("openpower-hw-diags <options>\n"); 29 printf("options:\n"); 30 printf(" --analyze: Analyze the hardware\n"); 31 printf(" --daemon: Start the attn handler daemon\n"); 32 } 33 else 34 { 35 // Either analyze (application mode) or daemon mode 36 if (true == getCliOption(argv, argv + argc, "--analyze")) 37 { 38 analyzer::analyzeHardware(); 39 } 40 // daemon mode 41 else 42 { 43 if (true == getCliOption(argv, argv + argc, "--daemon")) 44 { 45 attn::Config attnConfig; // default config 46 47 pdbg_targets_init(nullptr); // initialize pdbg targets 48 49 attn::attnDaemon(&attnConfig); // start daemon 50 } 51 } 52 } 53 54 return rc; 55 } 56