Exemplo n.º 1
0
int snfc_i2c_open (void)
{
	mm_segment_t old_fs = get_fs();
	int i;

	SNFC_DEBUG_MSG_LOW("[snfc_i2c] snfc_i2c_open\n");

	for(i=0; i<I2C_STATUS_LOOP_MAX_CNT; i++)
	{
		if(__snfc_i2c_control_get_status() != I2C_STATUS_FOR_FELICA)
			break;
		usleep(100);
	}
	//                                                                    
	//             
	
	__snfc_i2c_control_set_status(I2C_STATUS_FOR_NFC);

	set_fs(KERNEL_DS);
	fd = sys_open("/dev/i2c-0", O_RDWR|O_NONBLOCK, 0);
	//                                                       
	if (fd < 0)
	{
		SNFC_DEBUG_MSG("[snfc_i2c] ERROR - snfc_i2c_open (/dev/snfc_i2c): %d \n", fd);
		__snfc_i2c_control_set_status(I2C_STATUS_READY);
		return fd;
	}

	set_fs(old_fs);

	return 0;
}
Exemplo n.º 2
0
/*
* Description :
* Input : None
* Output : true - available
*/
_e_snfc_i2c_status get_felica_i2c_status(void)
{
#if defined(CONFIG_LGE_FELICA_NFC)
  return __snfc_i2c_control_get_status();
#else
  return I2C_STATUS_NO_USE;
#endif
}