1. 程式人生 > >linux使用者層串列埠操作

linux使用者層串列埠操作

  /* After the UART speed has been changed, the IOCTL is
   * is called to set the line discipline to N_HW_BFG
   */
  ldisc = N_HW_BFG;
  /* 選擇線路規程 */
  if (ioctl(uart_fd, TIOCSETD, &ldisc) < 0) {  
   OCTTY_ERR(" Can't set line discipline");
   close_uart();
   return -1;
  }
  OCTTY_DBG(" Have installed N_HW_BFG Line displine");
 }
 else {
  OCTTY_DBG(" Un-Installed N_HW_BFG Line displine");
  /* UNINSTALL_N_TI_WL - When the Signal is received from KIM */
  /* closing UART fd */
  close_uart();
  uart_fd = -1;
 }
 return 0;
}