当前位置: 首页>>代码示例>>C++>>正文


C++ DIAG_ERROR函数代码示例

本文整理汇总了C++中DIAG_ERROR函数的典型用法代码示例。如果您正苦于以下问题:C++ DIAG_ERROR函数的具体用法?C++ DIAG_ERROR怎么用?C++ DIAG_ERROR使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了DIAG_ERROR函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: s35390a_init

static  int s35390a_init(void)
{
	unsigned char reg1 = 0;
	unsigned int ret = 0;
	
	
	/*Check Frist Start Up*/
	ret = s35390a_check_started(&reg1);
	if( ret != SP_OK ) {
		DIAG_ERROR("[%s]External RTC init fail!\n", __FUNCTION__);
		return ret;
	}

	/*Set 12/24 format*/
	ret = s35390a_set_12or24_format(1);
	if( ret != SP_OK ) {
		DIAG_ERROR("[%s]Set External RTC 12/24 format fail!\n", __FUNCTION__);
		return ret;
	}

	/*Reset External RTC EXT_RTC_ADJ_REG*/
	ret = s35390a_set_adjust(0x82 ); /* +1 ppm */

	ret = s35390a_clear_alarm_int();
	
	DIAG_INFO("External RTC initialize OK!\n");
	return SP_OK;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:28,代码来源:external_rtc.c

示例2: gp_gpio_request

/**
 * @brief   Gpio pin request function.
 * @param   pin_index[in]: gpio channel + function id + gid + pin number
 * @param   name[in]: caller's name
 * @return  gpio handle/ERROR_ID
 * @see
 */
int gp_gpio_request(unsigned int pin_index, char *name)
{
	int ret;
	unsigned int ch = GPIO_CHANNEL(pin_index);
	unsigned int pin_number = GPIO_PIN_NUMBER(pin_index);
	gpio_handle_t *handle;

	if (gpio == NULL) 
	{
		DIAG_ERROR("gpio not initialized!");
		return -ENODEV;
	}
	if(ch >= NUM_GPIO_CHANNEL)
	{
		DIAG_ERROR("ch not exit!");
		return -EINVAL;
	}

	if (down_interruptible(&gpio->sem) != 0) 
	{
		return -ERESTARTSYS;
	}

	/* check pin requested */
	if ((ch < NUM_GPIO_CHANNEL) && (pin_number < 32) && (pin_table[ch][pin_number] != NULL)) 
	{
		name = pin_table[ch][pin_number]->name;
		DIAG_ERROR("pin already requested by %s!\n", (name != NULL) ? name : "unknown module");
		ret = -EBUSY;
		goto out;
	}

	ret = gpHalGpioSetPadGrp(pin_index);
	if (ret != 0) 
	{
		ret = -EINVAL;
		goto out;
	}

	handle = (gpio_handle_t *)kzalloc(sizeof(gpio_handle_t), GFP_KERNEL);
	if (handle == NULL) 
	{
		ret = -ENOMEM;
		goto out;
	}

	handle->pin_index = pin_index;
	handle->name = name;
	ret = (int)handle;

	/* set pin requested */
	if ((ch < NUM_GPIO_CHANNEL) && (pin_number < 32)) 
	{
		pin_table[ch][pin_number] = handle;
	}

out:
	up(&gpio->sem);
	return ret;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:67,代码来源:gp_gpio.c

示例3: audioInit

static UINT32
audioInit(
	void
)
{
#ifdef SYSCONFIG_SPU
	if (insmod("gp_audio") != SP_OK) {
		DIAG_ERROR("insmod gp_audio error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_mixer") != SP_OK) {
		DIAG_ERROR("insmod gp_mixer error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_spu_module") != SP_OK) {
		DIAG_ERROR("insmod gp_spu_module error!\n");
		return SP_FAIL;
	}
#else 
#ifdef	SYSCONFIG_AUDIO
	if (insmod("gp_audio") != SP_OK) {
		DIAG_ERROR("insmod gp_audio error!\n");
		return SP_FAIL;
	}
	if (insmod("gp_mixer") != SP_OK) {
		DIAG_ERROR("insmod gp_mixer error!\n");
		return SP_FAIL;
	}
#endif
#endif
	return SP_OK;
}
开发者ID:go2ev-devteam,项目名称:GPCV,代码行数:32,代码来源:sysinit.c

示例4: ppuInit

static UINT32
ppuInit(
	void
)
{
	
#ifdef SYSCONFIG_PPU
#if (SYSCONFIG_PPU == 1)
	if (insmod("gp_ppu_module") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_module error!\n");
		return SP_FAIL;
	}
#elif (SYSCONFIG_PPU == 2)
	if (insmod("gp_ppu_simple") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_simple error!\n");
		return SP_FAIL;
	}
#elif (SYSCONFIG_PPU == 3)
	if (insmod("gp_ppu_dma_module") != SP_OK) {
		DIAG_ERROR("insmod gp_ppu_dma_module error!\n");
		return SP_FAIL;
	}
#endif
#endif
	return SP_OK;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:26,代码来源:sysinit.c

示例5: scalarInit

static UINT32
scalarInit(
	void
)
{
	if (insmod("gp_scale_module") != SP_OK) {
		DIAG_ERROR("insmod gp_scale_module error!\n");
		return SP_FAIL;
	}
	
	if( gp_ver.major == MACH_GPL32900 )
	{
		if (insmod("gp_scale2_module") != SP_OK) {
			DIAG_ERROR("insmod gp_scale_module error!\n");
			return SP_FAIL;
		}
	}

	if( gp_ver.major == MACH_GPL32900B )
	{	
		if (insmod("gp_scale2_module") != SP_OK) {
			DIAG_ERROR("insmod gp_scale_module error!\n");
			return SP_FAIL;
		}
	}

	return SP_OK;
}
开发者ID:go2ev-devteam,项目名称:GPCV,代码行数:28,代码来源:sysinit.c

示例6: s35390a_set_reg

/**
*@brief Write S35390A register
*/
static int s35390a_set_reg(unsigned char addr, unsigned char *dataGroup, unsigned char cnt)
{
	unsigned char slaveAddress = DEVICE_ADDR;
   	int ret = SP_OK;
	unsigned char i = 0;
	int i2c_handle = 0;
	
	addr = (addr<<1)&0x0e;
	slaveAddress = (slaveAddress|addr);
	i2c_handle = gp_i2c_bus_request(slaveAddress, 0x0f);
	if(!i2c_handle){
		DIAG_ERROR("[%s] Fail to request I2c bus!\n", __FUNCTION__);
		return SP_FAIL;
	}

	//msb2Lsb(dataGroup, cnt);
        for(i = 0; i < cnt; i++){
		dataGroup[i] = bitrev8(dataGroup[i]);
	}

	ret = gp_i2c_bus_write(i2c_handle, dataGroup, cnt);

	if(ret < 0){
		DIAG_ERROR("Fail to write external RTC register!\n");
		ret = SP_FAIL;
	}else{
		ret = SP_OK;
	}

	if(i2c_handle)
		gp_i2c_bus_release(i2c_handle);

	return ret;	
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:37,代码来源:external_rtc.c

示例7: gp_ext_rtc_probe

static int __init gp_ext_rtc_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	int ret = 0;

	gp_ext_rtc_info = kzalloc(sizeof(gp_ext_rtc_t), GFP_KERNEL);
	if (!gp_ext_rtc_info)
		return -ENOMEM;

	if(s35390a_init()){
		DIAG_ERROR("S35390A Initialize Fail!!!\n");
		goto err_init;
	}
#if ENABLE_INT1_OUTPUT_FREQUENCY
	s35390a_int1_output_freq(16);
#endif

	spin_lock_init(&gp_ext_rtc_info->lock);

	gp_ext_rtc_info->rtc = rtc_device_register("gp-ext-rtc", &pdev->dev, &gp_ext_rtc_ops, THIS_MODULE);
	ret = PTR_ERR(gp_ext_rtc_info->rtc);
	if (IS_ERR(gp_ext_rtc_info->rtc)) {
		DIAG_ERROR("Failed to register RTC device -> %d\n", ret);
		goto err_init;
	}
	
	device_init_wakeup(dev, 1);
	
	return 0;

err_init:
	kfree(gp_ext_rtc_info);	
	gp_ext_rtc_info = NULL;
	return ret;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:35,代码来源:external_rtc.c

示例8: scale_init

/**
 * @brief   Scale driver init function
 */
static int __init scale_init(void)
{
	int ret = -ENXIO;

	scale = (scale_info_t *)kzalloc(sizeof(scale_info_t),  GFP_KERNEL);
	if (scale == NULL) {
		ret = -ENOMEM;
		DIAG_ERROR("scale kmalloc fail\n");
		goto fail_kmalloc;
	}

	ret = request_irq(IRQ_SCALE_ENGINE,
					  scale_irq_handler,
					  IRQF_SHARED,
					  "SCALE_IRQ",
					  scale);
	if (ret < 0) {
		DIAG_ERROR("scale request irq fail\n");
		goto fail_request_irq;
	}

	/* initialize */
	init_MUTEX(&scale->sem);
	init_waitqueue_head(&scale->done_wait);

	scale->dev.name  = "scalar";
	scale->dev.minor = MISC_DYNAMIC_MINOR;
	scale->dev.fops  = &scale_fops;

	/* register device */
	ret = misc_register(&scale->dev);
	if (ret != 0) {
		DIAG_ERROR("scalar device register fail\n");
		goto fail_device_register;
	}

	platform_device_register(&gp_scalar_device);
	platform_driver_register(&gp_scalar_driver);

	return 0;

	/* error rollback */
fail_device_register:
	free_irq(IRQ_SCALE_ENGINE, scale);
fail_request_irq:
	kfree(scale);
	scale = NULL;
fail_kmalloc:
	return ret;
}
开发者ID:danelledeano,项目名称:VTech-InnoTab,代码行数:53,代码来源:gp_scale.c

示例9: asensorInit

static UINT32
asensorInit(
	void
)
{
#ifdef SYSCONFIG_A_SENSOR
	DIAG_ERROR("load asensor ko\n");
	if (insmod("/lib/modules/common/%s.ko",SYSCONFIG_A_SENSOR_DEVICE) != SP_OK) {
		DIAG_ERROR("insmod gp_gsensor error!\n");
		return SP_FAIL;
	}
#endif
	return SP_OK;
}
开发者ID:go2ev-devteam,项目名称:GPCV,代码行数:14,代码来源:sysinit.c

示例10: gp_adc_probe

static int gp_adc_probe(struct platform_device *pdev)
{
	struct device *dev = &pdev->dev;
	struct gp_adc_device_s *adc;
	int ret;

	adc = kzalloc(sizeof(struct gp_adc_device_s), GFP_KERNEL);
	if (adc == NULL) {
		DIAG_ERROR("failed to allocate adc device\n");
		return -ENOMEM;
	}
	g_adc_dev = adc;

	sema_init(&adc->lock,1);
	sema_init(&g_adc_prepare,1);
	sema_init(&adc->aux_sem, 0);
	adc->pdev = pdev;
	adc->aux_ch = -1; /* not starting aux */
	ret = request_irq( IRQ_SAACC, gp_adc_irq, 0, dev_name(dev), adc);
	if (ret < 0) {
		DIAG_ERROR( "failed to attach adc irq\n");
		goto err_alloc;
	}

	/* register misc device */
	adc->dev.name  = "adc";
	adc->dev.minor = MISC_DYNAMIC_MINOR;
	adc->dev.fops  = &gp_adc_fops;
	adc->open_cnt = 0;
	ret = misc_register(&adc->dev);
	if (ret != 0) {
		DIAG_ERROR("gp_adc device register fail\n");
		goto err_irq;
	}

	platform_set_drvdata(pdev, adc);

	if(gAdcRegBackup == NULL)
		gAdcRegBackup = (int *)kmalloc(sizeof(regADC_t), GFP_KERNEL);
	return 0;

err_irq:
	free_irq(IRQ_SAACC, adc);

err_alloc:
	kfree(adc);
	return ret;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:48,代码来源:gp_adc.c

示例11: sysMknod

static UINT32
sysMknod(
	char *name,
	mode_t mode
)
{
	FILE *file;
	char line[128];
	UINT32 minor;
	char *pEnd;

	file = fopen ("/proc/misc", "r");
	if (file == NULL) {
		DIAG_ERROR("[%s:%d], Open Fail!\n", __FUNCTION__, __LINE__);
		return SP_FAIL;
	}

	while (fgets(line, sizeof(line), file) != NULL) {
		minor = (UINT32)strtol(line, &pEnd, 10);
		pEnd += 1;
		if (strncmp(pEnd, name, strlen(name)) == 0) {
			memset(&line, 0, sizeof(line));
			snprintf(line, sizeof(line), "/dev/%s", name);
			mknod(line, S_IFCHR|0777, makedev(MISC_MAJOR, minor));
			break;
		}
	}

	fclose ( file );

	return SP_OK;
}
开发者ID:go2ev-devteam,项目名称:GPCV,代码行数:32,代码来源:sysinit.c

示例12: hunter_get_state

enum HunterState hunter_get_state(struct CmpAppr *appr)
{
	if (appr->type == CMP_APPR_STATIC_SPRITE &&
		appr->body.static_sprite.bitmap == sc_hunter_stand_right) {
		return HUNTER_STATE_STAND_RIGHT;

	} else if (
		appr->type == CMP_APPR_STATIC_SPRITE &&
		appr->body.static_sprite.bitmap == sc_hunter_stand_left) {
		return HUNTER_STATE_STAND_LEFT;

	} else if (
		appr->type == CMP_APPR_ANIMATED_SPRITE &&
		appr->body.animated_sprite.common == sc_hunter_walk_right_common) {
		return HUNTER_STATE_WALK_RIGHT;

	} else if (
		appr->type == CMP_APPR_ANIMATED_SPRITE &&
		appr->body.animated_sprite.common == sc_hunter_walk_left_common) {
		return HUNTER_STATE_WALK_LEFT;

	} else {
		DIAG_ERROR("Failed recognizing hunter state based on the appearance component.");
		exit(1);
	}
}
开发者ID:k-stachowiak,项目名称:gfwk,代码行数:26,代码来源:sc_hunter.c

示例13: i2c_bus_write

/**
 * @brief   I2C bus device write function
 */
static ssize_t i2c_bus_write(struct file *flip, const char __user *buf, size_t count, loff_t *oppos)
{
	int ret = 0;
	unsigned char *sendBuf = NULL;

	sendBuf = (unsigned char *)kmalloc(count, GFP_KERNEL);
	if (!sendBuf) {
		ret = -ENOMEM;
		goto __err_kmalloc;
	}

	if (copy_from_user(sendBuf, buf, count)) {
		ret = -EFAULT;
		goto __err_copy;
	}

	ret = gp_i2c_bus_write((int)flip->private_data, sendBuf, count);
	if (ret < 0) {
		DIAG_ERROR("ERROR: i2c bus write fail\n");
		//return -ENXIO; /*MUST free sendBuf*/
		ret = -ENXIO;
	}

__err_copy:
	kfree(sendBuf);
	sendBuf = NULL;
__err_kmalloc:
	return ret;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:32,代码来源:gp_i2c_bus.c

示例14: i2c_bus_read

/**
 * @brief   I2C bus device read function
 */
static ssize_t i2c_bus_read(struct file *flip, char __user *buf, size_t count, loff_t *oppos)
{
	int ret = 0;
	unsigned char *recvBuf = NULL;

	recvBuf = (unsigned char *)kmalloc(count, GFP_KERNEL);
	if (!(recvBuf)) {
		ret = -ENOMEM;
		goto __err_kmalloc;
	}

	ret = gp_i2c_bus_read((int)flip->private_data, recvBuf, count);
	if (ret <= 0) {
		DIAG_ERROR("ERROR: i2c read fail\n");
		/*return -ENXIO;*/
		ret = -ENXIO;
		goto __err_copy;
	}

	if (copy_to_user(buf, recvBuf, ret)) {
		ret = -EFAULT;
		/*goto __err_copy;*/
	}

__err_copy:
	kfree(recvBuf);
	recvBuf = NULL;
__err_kmalloc:
	return ret;
}
开发者ID:WayWingsDev,项目名称:Gplus_2159_0801,代码行数:33,代码来源:gp_i2c_bus.c

示例15: uartModeInit

static UINT32 uartModeInit(void)
{/*

#define SYSCONFIG_UART_FUNC

#define SYSCONFIG_UART_FUNC_DEVICE "CloudDog"

*/
 #ifdef SYSCONFIG_UART_FUNC
	DIAG_ERROR("load asensor ko\n");
	if (insmod("/lib/modules/common/%s.ko",SYSCONFIG_UART_FUNC_DEVICE) != SP_OK) {
		DIAG_ERROR("insmod gp_gsensor error!\n");
		return SP_FAIL;
	}
#endif
	return SP_OK;
}
开发者ID:go2ev-devteam,项目名称:GPCV,代码行数:17,代码来源:sysinit.c


注:本文中的DIAG_ERROR函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。