Пример #1
0
/*
 * Description: MFC calls this function using open method of FileInputStream class
 * Input: None
 * Output: Success : 0 Fail : Others
 */
static int felica_rfs_open (struct inode *inode, struct file *fp)
{
  int rc = 0;

  if(1 == isopen)
  {
    FELICA_DEBUG_MSG_HIGH("[FELICA_RFS] felica_rfs_open - already open \n");


    return -1;
  }
  else
  {
    FELICA_DEBUG_MSG_LOW("[FELICA_RFS] felica_rfs_open - start \n");

    isopen = 1;
  }

#ifdef FELICA_LED_SUPPORT
  rc = felica_gpio_open(felica_get_rfs_gpio_num(), GPIO_DIRECTION_IN, GPIO_HIGH_VALUE);
#else
  rc = felica_gpio_open(felica_get_rfs_gpio_num(), GPIO_DIRECTION_IN, GPIO_LOW_VALUE);
#endif

  FELICA_DEBUG_MSG_LOW("[FELICA_RFS] felica_rfs_open - end \n");

#ifdef FELICA_FN_DEVICE_TEST
  FELICA_DEBUG_MSG_LOW("[FELICA_RFS] felica_rfs_open - result(%d) \n",result_open_rfs);
  return result_open_rfs;
#else
  return rc;
#endif

}
Пример #2
0
/*
* Description : MFC calls this function using close method(void open()) of FileOutputStream class
*               When this fuction is excuted, set PON to Low.
* Input : None
* Output : Success : 0 Fail : Other
*/
static int felica_rws_open (struct inode *inode, struct file *fp)
{
  int rc = 0;

  if(1 == isopen)
  {
    #ifdef FEATURE_DEBUG_LOW
    FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_open - already open \n");
    #endif

    return -1;
  }
  else
  {
    #ifdef FEATURE_DEBUG_LOW
    FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_open - start \n");
    #endif

	  isopen = 1;
	}

  rc = felica_gpio_open(GPIO_FELICA_INT, GPIO_DIRECTION_IN, GPIO_HIGH_VALUE);

  #ifdef FEATURE_DEBUG_LOW
  FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_open - end \n");
  #endif

#ifdef FELICA_FN_DEVICE_TEST
	FELICA_DEBUG_MSG("[FELICA_RWS] felica_rws_open - result(%d) \n",result_open_rws);
	return result_open_rws;
#else
	  return rc;
#endif
}
Пример #3
0
/*
* Description : open uart
* Input : None
* Output : success : 0 fail : others
*/
int felica_uart_open(void)
{
//  struct termios newtio;
  int rc;
  mm_segment_t old_fs = get_fs();

  #ifdef FEATURE_DEBUG_LOW
  FELICA_DEBUG_MSG("[FELICA_UART] open_hs_uart - start \n");
  #endif

  if(0 <= fd)
  {
    FELICA_DEBUG_MSG("[FELICA_UART] felica_uart is already opened fd : %d\n",fd);
    return 0;
  }

  set_fs(KERNEL_DS);

    fd = sys_open("/dev/ttyO3", O_RDWR | O_NOCTTY | O_NONBLOCK, 0);
    
  FELICA_DEBUG_MSG("[FELICA_UART] open UART - fd : %d \n",fd);
    
    
    if (fd < 0)
    {
    FELICA_DEBUG_MSG("[FELICA_UART] ERROR - can not sys_open \n");
      set_fs(old_fs);
      return fd;
    }

    {
      /*  Set speed */
      struct termios newtio;

      // yjchoi; 120412 temporary block due to build error
      serial_omap_disable_console_port();
      
      // yjchoi; 120412 temporary block due to build error
      rc = felica_gpio_open(GPIO_FELICA_UART_SW, GPIO_DIRECTION_OUT, GPIO_LOW_VALUE);

      felica_gpio_write(GPIO_FELICA_UART_SW, 0);
      sys_ioctl(fd, TCGETS, (unsigned long)&newtio);
      memcpy(&console_settings, &newtio, sizeof(struct termios));

      memset(&newtio, 0, sizeof(newtio));
      newtio.c_cflag = B460800 | CS8 | CLOCAL | CREAD;
      newtio.c_cc[VMIN] = 1;
      newtio.c_cc[VTIME] = 5;
      sys_ioctl(fd, TCFLSH, TCIOFLUSH);
      sys_ioctl(fd, TCSETSF, (unsigned long)&newtio);
    }
    set_fs(old_fs);

  #ifdef FEATURE_DEBUG_LOW
  FELICA_DEBUG_MSG("[FELICA_UART] open_hs_uart - end \n");
  #endif

  return 0;
}
Пример #4
0
static void felica_rfs_open_after_boot_work(struct work_struct *data)
{
	int rc = 0;
    #ifdef FEATURE_DEBUG_LOW
	FELICA_DEBUG_MSG("[FELICA_RFS] felica_rfs_open_after_boot_work - start");
    #endif
	rc = felica_gpio_open(felica_get_rfs_gpio_num(), GPIO_DIRECTION_IN, GPIO_HIGH_VALUE);
    #ifdef FEATURE_DEBUG_LOW
	FELICA_DEBUG_MSG("[FELICA_RFS] felica_rfs_open_after_boot_work - end");
    #endif
}