ircomm_tty.h 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139
  1. /*********************************************************************
  2. *
  3. * Filename: ircomm_tty.h
  4. * Version:
  5. * Description:
  6. * Status: Experimental.
  7. * Author: Dag Brattli <dagb@cs.uit.no>
  8. * Created at: Sun Jun 6 23:24:22 1999
  9. * Modified at: Fri Jan 28 13:16:57 2000
  10. * Modified by: Dag Brattli <dagb@cs.uit.no>
  11. *
  12. * Copyright (c) 1999-2000 Dag Brattli, All Rights Reserved.
  13. *
  14. * This program is free software; you can redistribute it and/or
  15. * modify it under the terms of the GNU General Public License as
  16. * published by the Free Software Foundation; either version 2 of
  17. * the License, or (at your option) any later version.
  18. *
  19. * This program is distributed in the hope that it will be useful,
  20. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  21. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  22. * GNU General Public License for more details.
  23. *
  24. * You should have received a copy of the GNU General Public License
  25. * along with this program; if not, write to the Free Software
  26. * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
  27. * MA 02111-1307 USA
  28. *
  29. ********************************************************************/
  30. #ifndef IRCOMM_TTY_H
  31. #define IRCOMM_TTY_H
  32. #include <linux/serial.h>
  33. #include <linux/termios.h>
  34. #include <linux/timer.h>
  35. #include <linux/tty.h> /* struct tty_struct */
  36. #include <net/irda/irias_object.h>
  37. #include <net/irda/ircomm_core.h>
  38. #include <net/irda/ircomm_param.h>
  39. #define IRCOMM_TTY_PORTS 32
  40. #define IRCOMM_TTY_MAGIC 0x3432
  41. #define IRCOMM_TTY_MAJOR 161
  42. #define IRCOMM_TTY_MINOR 0
  43. /* This is used as an initial value to max_header_size before the proper
  44. * value is filled in (5 for ttp, 4 for lmp). This allow us to detect
  45. * the state of the underlying connection. - Jean II */
  46. #define IRCOMM_TTY_HDR_UNINITIALISED 16
  47. /* Same for payload size. See qos.c for the smallest max data size */
  48. #define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED)
  49. /* Those are really defined in include/linux/serial.h - Jean II */
  50. #define ASYNC_B_INITIALIZED 31 /* Serial port was initialized */
  51. #define ASYNC_B_NORMAL_ACTIVE 29 /* Normal device is active */
  52. #define ASYNC_B_CLOSING 27 /* Serial port is closing */
  53. /*
  54. * IrCOMM TTY driver state
  55. */
  56. struct ircomm_tty_cb {
  57. irda_queue_t queue; /* Must be first */
  58. magic_t magic;
  59. int state; /* Connect state */
  60. struct tty_struct *tty;
  61. struct ircomm_cb *ircomm; /* IrCOMM layer instance */
  62. struct sk_buff *tx_skb; /* Transmit buffer */
  63. struct sk_buff *ctrl_skb; /* Control data buffer */
  64. /* Parameters */
  65. struct ircomm_params settings;
  66. __u8 service_type; /* The service that we support */
  67. int client; /* True if we are a client */
  68. LOCAL_FLOW flow; /* IrTTP flow status */
  69. int line;
  70. unsigned long flags;
  71. __u8 dlsap_sel;
  72. __u8 slsap_sel;
  73. __u32 saddr;
  74. __u32 daddr;
  75. __u32 max_data_size; /* Max data we can transmit in one packet */
  76. __u32 max_header_size; /* The amount of header space we must reserve */
  77. __u32 tx_data_size; /* Max data size of current tx_skb */
  78. struct iriap_cb *iriap; /* Instance used for querying remote IAS */
  79. struct ias_object* obj;
  80. void *skey;
  81. void *ckey;
  82. wait_queue_head_t open_wait;
  83. wait_queue_head_t close_wait;
  84. struct timer_list watchdog_timer;
  85. struct work_struct tqueue;
  86. unsigned short close_delay;
  87. unsigned short closing_wait; /* time to wait before closing */
  88. int open_count;
  89. int blocked_open; /* # of blocked opens */
  90. /* Protect concurent access to :
  91. * o self->open_count
  92. * o self->ctrl_skb
  93. * o self->tx_skb
  94. * Maybe other things may gain to be protected as well...
  95. * Jean II */
  96. spinlock_t spinlock;
  97. };
  98. void ircomm_tty_start(struct tty_struct *tty);
  99. void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
  100. extern int ircomm_tty_tiocmget(struct tty_struct *tty);
  101. extern int ircomm_tty_tiocmset(struct tty_struct *tty,
  102. unsigned int set, unsigned int clear);
  103. extern int ircomm_tty_ioctl(struct tty_struct *tty,
  104. unsigned int cmd, unsigned long arg);
  105. extern void ircomm_tty_set_termios(struct tty_struct *tty,
  106. struct ktermios *old_termios);
  107. #endif