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