long nbm_local_reset() { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); ret = nbm_cpld_operate(BM_IOC_CPLD_SELF_SYS_RESET, &cpld_data); return NPD_SUCCESS; }
int nbm_master_set_debug(unsigned long value) { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.value = value; ret = nbm_cpld_operate(BM_IOC_CPLD_MASTER_SWITCH, &cpld_data); }
long nbm_board_online(unsigned long slot_index) { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.param = slot_index; ret = nbm_cpld_operate(BM_IOC_CPLD_BOARD_ONLINE, &cpld_data); return (cpld_data.value == BOARD_INSERT); }
int nbm_master_set(unsigned long value) { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.value= value; // master bit cpld_data.write_flag = 1; ret = nbm_cpld_operate(BM_IOC_CPLD_MASTER_STATE, &cpld_data); return ret; }
int nbm_cpld_write_func_code(unsigned long cmd, unsigned char value) { cpld_op_args cpld_args ; memset(&cpld_args, 0, sizeof(cpld_args)); cpld_args.write_flag = 1; cpld_args.value = value; nbm_cpld_operate(cmd, &cpld_args); return 0; }
int nbm_cpld_read_func_code(unsigned long cmd, unsigned char* value) { cpld_op_args cpld_args ; memset(&cpld_args, 0, sizeof(cpld_args)); nbm_cpld_operate(cmd, &cpld_args); *value = cpld_args.value; return 0; }
int nbm_master_get() { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.value= 1; // master bit ret = nbm_cpld_operate(BM_IOC_CPLD_MASTER_STATE, &cpld_data); if (ret != 0) { return ret; } return cpld_data.value; }
long nbm_board_reset(unsigned long slot_index) { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.param = slot_index; cpld_data.write_flag = 1; ret = nbm_cpld_operate(BM_IOC_CPLD_BOARD_RESET, &cpld_data); if(ret != 0) { return NPD_FAIL; } return NPD_SUCCESS; }
long nbm_board_online(unsigned long slot_index) { int ret = 0; cpld_op_args cpld_data = {0}; memset(&cpld_data, 0, sizeof(cpld_op_args)); cpld_data.param = slot_index; ret = nbm_cpld_operate(BM_IOC_CPLD_BOARD_ONLINE, &cpld_data); if(ret != 0) { DBG("board online state error.\n"); return NPD_FAIL; } //DBG("board slot index %d online state is %d.\n", cpld_data.value); return (cpld_data.value == BOARD_INSERT); }
long nbm_get_power_present(int index, int * online_state) { int ret; cpld_op_args cpld_args ; if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile())) { return -1; } memset(&cpld_args, 0, sizeof(cpld_args)); cpld_args.param = index; ret = nbm_cpld_operate(BM_IOC_CPLD_POWER_PRESENT, &cpld_args); if (ret != 0) { nbm_syslog_err("nbm get power supply %d info error!\n", index+1); return -1; } *online_state = cpld_args.value; return 0; }