/* * Copyright (c) Hisilicon Technologies Co., Ltd. 2020-2020. All rights reserved. * Description: sample for testing active standby functions */ #include #include #include "td_type.h" #include "uapi_pmoc.h" #ifdef CONFIG_SUPPORT_CA_RELEASE #define log_info_standby(format, arg ...) #else #define log_info_standby(format, arg ...) printf(format, ## arg) #endif #define pmoc_notice(format...) printf("> "); printf(format); static td_void show_usage_info(td_void) { pmoc_notice("usage: sample_active_standby [-e enter] [-q quit] ].\n"); pmoc_notice("command as follows:\n"); pmoc_notice("sample_active_standby -e -- enter active standby.\n"); pmoc_notice("sample_active_standby -q -- quit active standby.\n"); return; } td_s32 main(td_s32 argc, td_char *argv[]) { td_s32 ret; td_s32 result; ret = uapi_pmoc_init(); if (ret != TD_SUCCESS) { log_info_standby("uapi_pmoc_init err, 0x%08x !\n", ret); return ret; } result = getopt(argc, argv, ":eq"); switch (result) { case 'e': { ret = uapi_pmoc_enter_active_standby(UAPI_PMOC_ACTIVE_STANDBY_MODLE1); if (ret != TD_SUCCESS) { log_info_standby("uapi_pmoc_enter_active_standby err, 0x%08x !\n", ret); } uapi_pmoc_deinit(); return ret; } case 'q': { ret = uapi_pmoc_quit_active_standby(); if (ret != TD_SUCCESS) { log_info_standby("uapi_pmoc_quit_active_standby err, 0x%08x !\n", ret); } uapi_pmoc_deinit(); return ret; } default: { break; } } uapi_pmoc_deinit(); show_usage_info(); return ret; }