예제 #1
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
/**********************************************************************************
 * nbm_hardware_watchdog_control_get
 *
 * 	Get hardware watchdog enable or disable
 *
 *	INPUT:
 *		NULL
 *	
 *	OUTPUT:
 *		enabled	- enable/disable hardware watchdog
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_control_get
(
	unsigned int *enabled
)
{
	unsigned char cpld_value = 0;
	int ret = 0;


	if(!enabled) {
		nbm_syslog_err("nbm hardware watchdog control get null pointer error!\n");
		return NPD_FAIL;
	}

	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_ENABLE, &cpld_value);
	if (ret)
	{
		return ret;
	}

	nbm_syslog_dbg("nbm hardware watchdog control get value %d\n", cpld_value);
	if(cpld_value == WATCHDOG_ENABLE) {
		*enabled = SYSTEM_HARDWARE_WATCHDOG_ENABLE;
	}
	else {
		*enabled = SYSTEM_HARDWARE_WATCHDOG_DISABLE;
	}

	return ret;
}
예제 #2
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
/**********************************************************************************
 * nbm_hardware_watchdog_timeout_get
 *
 * 	Get hardware watchdog timeout value
 *
 *	INPUT:
 *		NULL
 *	
 *	OUTPUT:
 *		timeout	- hardware watchdog timeout value
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_timeout_get
(
	unsigned int *timeout
)
{
	unsigned char cpld_value = 0;
	int ret = 0;
	
	if(!timeout) {
		nbm_syslog_err("nbm hardware watchdog timeout get null pointer error!\n");
		return NPD_FAIL;
	}

	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_TIMER, &cpld_value);
	if (ret)
	{
		*timeout = 0;		
		return ret;
	}

	nbm_syslog_dbg("nbm hardware watchdog timeout get value %#x\n", cpld_value);

	*timeout = cpld_value;
	return ret;
}
예제 #3
0
/**********************************************************************************
 * nbm_hardware_watchdog_timeout_get
 *
 * 	Get hardware watchdog timeout value
 *
 *	INPUT:
 *		NULL
 *	
 *	OUTPUT:
 *		timeout	- hardware watchdog timeout value
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_timeout_get
(
	unsigned int *timeout
)
{
	unsigned char cpld_value = 0;
	int ret = 0;
	
	/* confirm if current product support hardware watchdog or not */
	if(NBM_FALSE == npd_product_hardware_watchdog_function_check()) {
		return NBM_OK;
	}

	if(!timeout) {
		DBG("nbm hardware watchdog timeout get null pointer error!\n");
		return NPD_FAIL;
	}

	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_TIMER, &cpld_value);
	if (ret)
	{
		*timeout = 0;		
		return ret;
	}

	DBG("nbm hardware watchdog timeout get value %#x\n", cpld_value);

	*timeout = cpld_value;
	return ret;
}
예제 #4
0
/**********************************************************************************
 * nbm_hardware_watchdog_timeout_set
 *
 * 	Set hardware watchdog timeout value
 *
 *	INPUT:
 *		timeout	- hardware watchdog timeout value
 *	
 *	OUTPUT:
 *		NULL
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_timeout_set
(
	unsigned int timeout
)
{
	unsigned char regValue = 0;
	int ret = 0;
	unsigned char cpld_value;


	/* confirm if current product support hardware watchdog or not */
	if(NBM_FALSE == npd_product_hardware_watchdog_function_check()) {
		return NBM_OK;
	}

	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_TIMER, &cpld_value);
	if (ret)
	{
		return ret;
	}

	DBG("nbm hardware watchdog timeout change %d -> %d\n", regValue, timeout);

	ret = nbm_cpld_write_func_code(BM_IOC_CPLD_WDT_TIMER, timeout);	
	return ret;
}
예제 #5
0
/**********************************************************************************
 * nbm_hardware_watchdog_control_get
 *
 * 	Get hardware watchdog enable or disable
 *
 *	INPUT:
 *		NULL
 *	
 *	OUTPUT:
 *		enabled	- enable/disable hardware watchdog
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_control_get
(
	unsigned int *enabled
)
{
	unsigned char cpld_value = 0;
	int ret = 0;

	if(NBM_FALSE == npd_product_hardware_watchdog_function_check()) {
		return NBM_OK;
	}

	if(!enabled) {
		DBG("nbm hardware watchdog control get null pointer error!\n");
		return NPD_FAIL;
	}

	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_ENABLE, &cpld_value);
	if (ret)
	{
		return ret;
	}

	DBG("nbm hardware watchdog control get value %d\n", cpld_value);
	if(cpld_value == WATCHDOG_ENABLE) {
		*enabled = SYSTEM_HARDWARE_WATCHDOG_ENABLE;
	}
	else {
		*enabled = SYSTEM_HARDWARE_WATCHDOG_DISABLE;
	}

	return ret;
}
예제 #6
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
unsigned char nbm_get_backboard_version()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_BACKBOARD_VERSION, &reg_data);
    return reg_data;	
}
예제 #7
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
unsigned long nbm_get_module_hw_code()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_MODULE_HWCODE, &reg_data);
    return reg_data;
}
예제 #8
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
unsigned long nbm_get_product_hw_code()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_PRODUCT_HWCODE, &reg_data);
    return reg_data;
}
예제 #9
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
unsigned long nbm_get_family_type_get()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_PRODUCT_FAMILY, &reg_data);
    return reg_data;	
}
예제 #10
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
long nbm_slotno_get()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_SLOT_ID, &reg_data);
	if(ret != 0)
	{
		return 0;
	}
    return reg_data;	
}
예제 #11
0
long nbm_master_slotno_get()
{
	int ret = 0;
	unsigned char reg_data = 0;
	
	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_MASTER_SLOT_ID, &reg_data);
	if(ret != 0)
	{
		DBG("Get master slot id error.\n");
		return -1;
	}
    return reg_data;	
}
예제 #12
0
파일: nbm_cpld.c 프로젝트: ECYBTech/chanos
/**********************************************************************************
 * nbm_hardware_watchdog_timeout_set
 *
 * 	Set hardware watchdog timeout value
 *
 *	INPUT:
 *		timeout	- hardware watchdog timeout value
 *	
 *	OUTPUT:
 *		NULL
 *
 *	RETURN:
 *		0 - if no error occur.
 *		NPD_FAIL - if error occurred.
 *
 **********************************************************************************/
int nbm_hardware_watchdog_timeout_set
(
	unsigned int timeout
)
{
	unsigned char regValue = 0;
	int ret = 0;
	unsigned char cpld_value;


	ret = nbm_cpld_read_func_code(BM_IOC_CPLD_WDT_TIMER, &cpld_value);
	if (ret)
	{
		return ret;
	}

	nbm_syslog_dbg("nbm hardware watchdog timeout change %d -> %d\n", regValue, timeout);

	ret = nbm_cpld_write_func_code(BM_IOC_CPLD_WDT_TIMER, timeout);	
	return ret;
}