Commit f9c88b31 authored by Miguel Jimenez Lopez's avatar Miguel Jimenez Lopez

irq-demo: Add a basic error reporting mechanism in the main() function

parent 63201f33
......@@ -53,7 +53,7 @@ int main(int argc, char *argv[])
log_device gen_log;
log_device stats_log;
user_args user_arguments;
log_device logs[2];
log_device logs[2], err_log;
unsigned int n_logs = 2;
stats_engine sengine;
int ret = 0;
......@@ -68,14 +68,17 @@ int main(int argc, char *argv[])
/* Loggers are stored in array:
* -[0]: General logger for stdout
* -[1]: File logger for stats
* -err_log: General logger to report main errors
*/
logs[0] = gen_log;
logs[1] = stats_log;
err_log = gen_log;
/* Parse user arguments (FMC DIO dev entry path and optionally irq period) */
user_arguments = create_user_arguments();
if(parse_user_arguments(argc, argv, user_arguments)) {
/* In case of failure, show the help message and exit */
/* In case of failure, exit */
send_to_log_device(err_log, "Error parsing user arguments\n");
ret = 1;
goto out_log;
}
......@@ -87,6 +90,7 @@ int main(int argc, char *argv[])
sengine = create_stats_engine();
if(check_stats_engine(sengine)) {
/* In case of failure, exit */
send_to_log_device(err_log, "Error initializing stats engine\n");
ret = 1;
goto out_user_args;
}
......@@ -101,6 +105,7 @@ int main(int argc, char *argv[])
dev = create_fmc_dio_device(user_arguments->fmc_dev_path);
if(open_fmc_dio_device(dev)) {
/* In case of failure, exit */
send_to_log_device(err_log, "Error opening FMC DIO device\n");
ret = 1;
goto out_stats_engine;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment