ircomm_tty.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121
  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, see <http://www.gnu.org/licenses/>.
  26. *
  27. ********************************************************************/
  28. #ifndef IRCOMM_TTY_H
  29. #define IRCOMM_TTY_H
  30. #include <linux/serial.h>
  31. #include <linux/termios.h>
  32. #include <linux/timer.h>
  33. #include <linux/tty.h> /* struct tty_struct */
  34. #include <net/irda/irias_object.h>
  35. #include <net/irda/ircomm_core.h>
  36. #include <net/irda/ircomm_param.h>
  37. #define IRCOMM_TTY_PORTS 32
  38. #define IRCOMM_TTY_MAGIC 0x3432
  39. #define IRCOMM_TTY_MAJOR 161
  40. #define IRCOMM_TTY_MINOR 0
  41. /* This is used as an initial value to max_header_size before the proper
  42. * value is filled in (5 for ttp, 4 for lmp). This allow us to detect
  43. * the state of the underlying connection. - Jean II */
  44. #define IRCOMM_TTY_HDR_UNINITIALISED 16
  45. /* Same for payload size. See qos.c for the smallest max data size */
  46. #define IRCOMM_TTY_DATA_UNINITIALISED (64 - IRCOMM_TTY_HDR_UNINITIALISED)
  47. /*
  48. * IrCOMM TTY driver state
  49. */
  50. struct ircomm_tty_cb {
  51. irda_queue_t queue; /* Must be first */
  52. struct tty_port port;
  53. magic_t magic;
  54. int state; /* Connect state */
  55. struct ircomm_cb *ircomm; /* IrCOMM layer instance */
  56. struct sk_buff *tx_skb; /* Transmit buffer */
  57. struct sk_buff *ctrl_skb; /* Control data buffer */
  58. /* Parameters */
  59. struct ircomm_params settings;
  60. __u8 service_type; /* The service that we support */
  61. int client; /* True if we are a client */
  62. LOCAL_FLOW flow; /* IrTTP flow status */
  63. int line;
  64. __u8 dlsap_sel;
  65. __u8 slsap_sel;
  66. __u32 saddr;
  67. __u32 daddr;
  68. __u32 max_data_size; /* Max data we can transmit in one packet */
  69. __u32 max_header_size; /* The amount of header space we must reserve */
  70. __u32 tx_data_size; /* Max data size of current tx_skb */
  71. struct iriap_cb *iriap; /* Instance used for querying remote IAS */
  72. struct ias_object* obj;
  73. void *skey;
  74. void *ckey;
  75. struct timer_list watchdog_timer;
  76. struct work_struct tqueue;
  77. /* Protect concurent access to :
  78. * o self->ctrl_skb
  79. * o self->tx_skb
  80. * Maybe other things may gain to be protected as well...
  81. * Jean II */
  82. spinlock_t spinlock;
  83. };
  84. void ircomm_tty_start(struct tty_struct *tty);
  85. void ircomm_tty_check_modem_status(struct ircomm_tty_cb *self);
  86. int ircomm_tty_tiocmget(struct tty_struct *tty);
  87. int ircomm_tty_tiocmset(struct tty_struct *tty, unsigned int set,
  88. unsigned int clear);
  89. int ircomm_tty_ioctl(struct tty_struct *tty, unsigned int cmd,
  90. unsigned long arg);
  91. void ircomm_tty_set_termios(struct tty_struct *tty,
  92. struct ktermios *old_termios);
  93. #endif