Processes Exit Status of Diagnostic Application (DA).
#include <diag/diag_exit.h> #define DA_SETRC_STATUS(VAL) da_exit_code.field.status = (VAL) #define DA_SETRC_USER(VAL) da_exit_code.field.user = (VAL) #define DA_SETRC_ERROR(VAL) da_exit_code.field.error = (VAL) #define DA_SETRC_TESTS(VAL) da_exit_code.field.tests = (VAL) #define DA_SETRC_MORE(VAL) da_exit_code.field.more = (VAL) #define DA_CHECKRC_STATUS() da_exit_code.status #define DA_CHECKRC_USER() da_exit_code.user #define DA_CHECKRC_ERROR() da_exit_code.error #define DA_CHECKRC_TESTS() da_exit_code.tests #define DA_CHECKRC_MORE() da_exit_code.more #define DA_EXIT() exit(*( (char*) &da_exit_code) ) ) enum diag_enum_status { DA_STATUS_GOOD, /* No hardware problems were found */ DA_STATUS_BAD, /* A hardware problem was found */ }; enum diag_enum_user { DA_USER_NOKEY, /* No special function keys were entered */ DA_USER_EXIT, /* The user entered the exit key */ DA_USER_QUIT, /* The user entered the cancel key */ }; enum diag_enum_error { DA_ERROR_NONE, /* No software errors were encountered */ DA_ERROR_OPEN, /* The Device Driver failed to open */ DA_ERROR_OTHER, /* Another software error was encountered */ }; enum diag_enum_tests { DA_TEST_NOTEST, /* No diagnostic tests were run */ DA_TEST_FULL, /* The full tests were run */ DA_TEST_SHR, /* The shared tests were run */ DA_TEST_SUB, /* The sub tests were run */ }; enum diag_enum_more { DA_MORE_NOCONT, /* The problem has been isolated. */ DA_MORE_CONT, /* The parent or sibling will be tested next */ }; typedef struct { unsigned status : 1; /* enum diag_enum_status */ unsigned user : 2; /* enum diag_enum_user */ unsigned error : 2; /* enum diag_enum_error */ unsigned tests : 2; /* enum diag_enum_tests */ unsigned more : 1; /* enum diag_enum_more */ } da_return_code_t; extern da_returncode_t da_exit_code;
The DA_EXIT macro is used to exit a DA. To set a value other than the default, the appropriate DA_SETRC_XXXXX macro must be called. To check the current value, use the appropriate DA_CHECKRC_XXXXXX macro.
Following is a easy chart to use to deciphered the bit positions:
Bit position |128 | 64 32 | 16 8 | 4 2 | 1 | | | | | | | | | | DA_MORE_NOCONT 0 | | | | | DA_MORE_CONT 1 | | | | |___________________ | | | | DA_TEST_NOTEST 0 | | | | DA_TEST_FULL 1 | | | | DA_TEST_SUB 2 | | | | DA_TEST_SHR 3 | | | |__________________________ | | | DA_ERROR_NONE 0 | | | DA_ERROR_OPEN 1 | | | DA_ERROR_OTHER 2 | | |__________________________________ | | DA_USER_NOKEY 0 | | DA_USER_EXIT 1 | | DA_USER_QUIT 2 | |___________________________________________ | DA_STATUS_GOOD 0 | DA_STATUS_BAD 1 |________________________________________________