Exemple #1
0
long nbm_get_boot_version_name(char * vername)
{
	int op_ret;
	boot_env_t	env_args ;
	char *name = "version";		
	char version[128] ;
	char *tmp = version;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	memset(&env_args, 0, sizeof(boot_env_t));

	sprintf(env_args.name,name);
	env_args.operation = GET_BOOT_ENV;
	
	op_ret = ioctl(g_bm_fd,BM_IOC_ENV_EXCH,&env_args);
    if(op_ret == -1)
    {
       DBG("nbm led control error!\n");
       return -1;
    }
	
	sprintf(version,env_args.value); 
	tmp = strstr(version, "version");
	tmp += strlen("version") + 1;
	strcpy(vername, tmp);
		
	return 0;
}
Exemple #2
0
int nbm_sfp_light_set(int index, int light_state)
{
	int op_ret = 0;
	sfp_op_args sfp_data;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	memset(&sfp_data, 0, sizeof(sfp_op_args));
	sfp_data.index = index;
	sfp_data.rwflag = 1;	//write op
	sfp_data.value = light_state; 

	nbm_syslog_dbg("sfp_data is index %d, rwflag is %d, value is %d.\n", 
			sfp_data.index, sfp_data.rwflag, sfp_data.value);
	
	op_ret = ioctl (g_bm_fd, BM_IOC_SFP_LIGHT, &sfp_data);

	nbm_syslog_dbg("ioctl op_ret  is %d.\n", op_ret);

	if(op_ret < 0)
	{
		nbm_syslog_err("nbm write cpld register  error!\n");
	       	return -1;
	}
	
	return 0;	
}
Exemple #3
0
int nbm_led_sfp_speed(int sfp_index, int sfp_speed)
{
	int op_ret;
	led_op_args  led_op_data;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}

	led_op_data.rwflag = 1; 
	led_op_data.op_type = LED_SFP_SPEED;
	led_op_data.index = sfp_index;
	if (sfp_speed == SFP_SPD_XGE)
	{
		led_op_data.inserted = LED_STATUS_INSERT;
		led_op_data.state = LED_STATUS_NORMAL;
	}
	else
	{
		led_op_data.inserted = LED_STATUS_REMOVE;
	}
	
	op_ret = ioctl (g_bm_fd, BM_IOC_LED_CONTROL, &led_op_data);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm led control error!\n");
       return -1;
    }

	return op_ret;
	
}
Exemple #4
0
int nbm_sfp_write(int index, unsigned int reg_addr, char * buf, int len)
{
	int op_ret = 0;
	sfp_op_args sfp_data;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	memset(&sfp_data, 0, sizeof(sfp_op_args));
	sfp_data.index = index;
	sfp_data.reg_addr = reg_addr;
	sfp_data.rwflag = 1;	//write op
	sfp_data.buf = (uint64_t)buf; 
	sfp_data.buf_len = len;
	
	op_ret = ioctl (g_bm_fd, BM_IOC_SFP_OPERATE, &sfp_data);
	if(op_ret == -1)
	{
		DBG("nbm read cpld register  error!\n");
	       	return -1;
	}
	
	return 0;		
}
Exemple #5
0
int nbm_get_temp_info(temp_info_args * temp_data)
{
	int op_ret = 0;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	if (temp_data == NULL)
	{
		nbm_syslog_err("temp_data argument error!\n");
		return -1;
	}

	op_ret = ioctl (g_bm_fd, BM_IOC_TEMP_INFO, temp_data);
	if(op_ret == -1)
	{
		nbm_syslog_err("nbm read temp info error!\n");
	    return -1;
	}

	return 0;

}
Exemple #6
0
long nbm_get_boot_version_name(char * vername)
{
	int op_ret;
	boot_env_t	env_args ;
	char *name = "version";	

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	memset(&env_args, 0, sizeof(boot_env_t));

	sprintf(env_args.name,name);
	env_args.operation = GET_BOOT_ENV;
	
	op_ret = ioctl(g_bm_fd,BM_IOC_ENV_EXCH,&env_args);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm led control error!\n");
       return -1;
    }

	sprintf(vername,env_args.value);
		
	return 0;
}
Exemple #7
0
int nbm_sfp_read(int index, unsigned int dev_addr, unsigned int reg_addr, char *buf, int len)
{
	int op_ret = 0;
	sfp_op_args sfp_data;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	memset(&sfp_data, 0, sizeof(sfp_op_args));
	sfp_data.index = index;
	sfp_data.reg_addr = dev_addr;
	sfp_data.rwflag = 0; /* read opt */
	sfp_data.value = reg_addr;
	sfp_data.buf = (uint64_t)(int)(buf); 
	sfp_data.buf_len = len;

	printf("buf value is %x. \n", (int)sfp_data.buf); /* */
	
	op_ret = ioctl (g_bm_fd, BM_IOC_SFP_OPERATE, &sfp_data);
	if(op_ret == -1)
	{
		nbm_syslog_err("nbm read cpld register  error!\n");
	       	return -1;
	}
	
	return 0;	
}
Exemple #8
0
int nbm_poe_led(poe_port_t *poe_port)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd,BM_IOC_POE_LED_LIGTH, poe_port);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl poe_led error!\n");
       return -1;
    }
		
	return 0;
}
Exemple #9
0
long nbm_cpld_register_write(cpld_reg_args *cpld_reg_param)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_CPLD_REG_WRITE, cpld_reg_param);
    if(op_ret == -1)
    {
       DBG("nbm ioctl cpld write error!\n");
       return -1;
    }
	
	return 0;
}
Exemple #10
0
long nbm_xaui_loop(cpld_mux_args *cpld_mux_param)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_MUX_LOOP, cpld_mux_param);
    if(op_ret == -1)
    {
       DBG("nbm ioctl xaui loop error!\n");
       return -1;
    }
	
	return 0;
}
Exemple #11
0
long nbm_music_i2c_write(music_i2c_dev_args *music_i2c_dev_data)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_MUSIC_I2C_WRITE, music_i2c_dev_data);
    if(op_ret == -1)
    {
       DBG("nbm ioctl music_i2c_write error!\n");
       return -1;
    }
	
	return 0;
}	
Exemple #12
0
long nbm_rtl8139_operate(rtl8139_op_args *rtl8139_op_data)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_RTL8139_OPERATE, rtl8139_op_data);
    if(op_ret == -1)
    {
       DBG("nbm ioctl rtl8139 operate error!\n");
       return -1;
    }
	
	return 0;
}	
Exemple #13
0
long nbm_mv_switch_counter(sw_counter_args *sw_counter_data)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd,BM_IOC_SWITCH_COUNTER, sw_counter_data);
    if(op_ret == -1)
    {
       DBG("nbm ioctl mv_switch_counter error!\n");
       return -1;
    }
		
	return 0;
}
Exemple #14
0
long nbm_bcm5396_switch_op(bcm5396_sw_op_args *sw_op_data)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd,BM_IOC_SWITCH_BCM5396_OP, sw_op_data);
    if(op_ret == -1)
    {
       DBG("nbm ioctl BCM5396_switch_op error!\n");
       return -1;
    }
		
	return 0;
}
Exemple #15
0
long nbm_op_boot_env(boot_env_t *env_args)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd,BM_IOC_ENV_EXCH, env_args);
    if(op_ret == -1)
    {
       DBG("nbm ioctl env error!\n");
       return -1;
    }
		
	return 0;
}
Exemple #16
0
int nbm_set_temp_threshold(temp_op_args * temp_op)
{
	int op_ret = 0;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
		
	op_ret = ioctl (g_bm_fd, BM_IOC_TEMP_THRESHOLD, temp_op);
	if(op_ret == -1)
	{
		nbm_syslog_err("nbm read cpld register  error!\n");
	    return -1;
	}
		
	return 0;		
}
Exemple #17
0
long nbm_led_control(led_op_args * led_op)	
{
	int op_ret;
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	led_op->rwflag = 1; 

	op_ret = ioctl (g_bm_fd, BM_IOC_LED_CONTROL, led_op);
    if(op_ret == -1)
    {
       DBG("nbm led control error!\n");
       return -1;
    }

	return op_ret;
}
Exemple #18
0
long nbm_get_power_info(int index, power_info_args * power_info)
{
	int op_ret;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	power_info->index = index;
	op_ret = ioctl (g_bm_fd, BM_IOC_POWER_INFO, power_info);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm get power info error!\n");
       return -1;
    }
	
	return op_ret;
}
Exemple #19
0
long nbm_qt2225_operate(smi_op_args *smi_op_param)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_SMI_OPERATE, smi_op_param);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl qt2225 operate error!\n");
       return -1;
    }
	
	return 0;
}	
Exemple #20
0
long nbm_subcard_info_operate(music_subcard_info_t *subcard_info)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_MUSIC_SUBCARD_INFO, subcard_info);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl subcard_info error!\n");
       return -1;
    }
	
	return 0;
}	
Exemple #21
0
/* Added by wangquan for cgm9648 20120426 */
long nbm_xaui_switch(cpld_mux_args *cpld_mux_param)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_XAUI_SWITCH, cpld_mux_param);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl xaui switch error!\n");
       return -1;
    }
	
	return 0;
}
Exemple #22
0
long nbm_wireless_led_operate(wled_port_args *wled_port_data)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_WIRELESS_LED_LIGTH, wled_port_data);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl wireless led operate error!\n");
       return -1;
    }
	
	return 0;
}		
Exemple #23
0
/* Added by wangquan for topsec 20120423 */
long nbm_port_isolation_control(port_isolation_op_args *port_isolation_args)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd,BM_IOC_PORT_ISOLATION_CONTROL, port_isolation_args);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl port isolation!\n");
       return -1;
    }
		
	return 0;
}
Exemple #24
0
long nbm_interrupt_operate(int_op_t * int_op)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}

	op_ret = ioctl(g_bm_fd,BM_IOC_INT_OPERATE,int_op);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm led control error!\n");
       return -1;
    }
	
	return 0;
}
Exemple #25
0
int nbm_kernel_debug(int debug_level)
{
	int op_ret  = 0;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl (g_bm_fd, BM_IOC_KERNEL_DEBUG, &debug_level);
    if(op_ret == -1)
    {
       DBG("nbm set kernel debug success!\n");
       return -1;
    }

	return op_ret;
	
}
Exemple #26
0
long nbm_board_num_get()
{
	int op_ret = 0;
	int board_num;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl (g_bm_fd, BM_IOC_CPLD_BOARD_NUM, &board_num);
	if(op_ret == -1)
	{
		DBG("nbm read cpld register  error!\n");
	    return -1;
	}
	
	return board_num;
}
Exemple #27
0
int nbm_sfp_num_get()
{
	int op_ret = 0;
	int sfp_num;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl (g_bm_fd, BM_IOC_SFP_NUM, &sfp_num);
	if(op_ret == -1)
	{
		DBG("nbm read cpld register  error!\n");
	       	return -1;
	}
	
	return sfp_num;
}
Exemple #28
0
int nbm_poe_board_info(poe_board_t *poe_board)
{
	int op_ret;

	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	
	op_ret = ioctl(g_bm_fd, BM_IOC_POE_BOARD_INFO, poe_board);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm ioctl poe_board error!\n");
       return -1;
    }

	printf("nbm_poe_board_info : present %d, type %d\n", poe_board->present, poe_board->type);
		
	return 0;
}
Exemple #29
0
long nbm_get_led_info(led_op_args * led_op)	
{
	int op_ret;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
	led_op->rwflag = 0; 
	
	op_ret = ioctl (g_bm_fd, BM_IOC_LED_CONTROL, led_op);
    if(op_ret == -1)
    {
       nbm_syslog_err("nbm led control error!\n");
       return -1;
    }

	return op_ret;
	
}
Exemple #30
0
int nbm_get_temp_state(int * temp_state)
{
	int op_ret = 0;
	int state = 0;
	
	if ((g_bm_fd <= 0) && (-1 == nbm_open_bmfile()))
	{
		return -1;
	}
		
	op_ret = ioctl (g_bm_fd, BM_IOC_TEMP_STATE, &state);
	if(op_ret == -1)
	{
		nbm_syslog_err("nbm read cpld register  error!\n");
	    return -1;
	}
	
	*temp_state = state;
	
	return 0;		
}