crisv10.h 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137
  1. /*
  2. * serial.h: Arch-dep definitions for the Etrax100 serial driver.
  3. *
  4. * Copyright (C) 1998, 1999, 2000 Axis Communications AB
  5. */
  6. #ifndef _ETRAX_SERIAL_H
  7. #define _ETRAX_SERIAL_H
  8. #include <linux/config.h>
  9. #include <linux/circ_buf.h>
  10. #include <asm/termios.h>
  11. /* Software state per channel */
  12. #ifdef __KERNEL__
  13. /*
  14. * This is our internal structure for each serial port's state.
  15. *
  16. * Many fields are paralleled by the structure used by the serial_struct
  17. * structure.
  18. *
  19. * For definitions of the flags field, see tty.h
  20. */
  21. #define SERIAL_RECV_DESCRIPTORS 8
  22. struct etrax_recv_buffer {
  23. struct etrax_recv_buffer *next;
  24. unsigned short length;
  25. unsigned char error;
  26. unsigned char pad;
  27. unsigned char buffer[0];
  28. };
  29. struct e100_serial {
  30. int baud;
  31. volatile u8 *port; /* R_SERIALx_CTRL */
  32. u32 irq; /* bitnr in R_IRQ_MASK2 for dmaX_descr */
  33. /* Output registers */
  34. volatile u8 *oclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
  35. volatile u32 *ofirstadr; /* adr to R_DMA_CHx_FIRST */
  36. volatile u8 *ocmdadr; /* adr to R_DMA_CHx_CMD */
  37. const volatile u8 *ostatusadr; /* adr to R_DMA_CHx_STATUS */
  38. /* Input registers */
  39. volatile u8 *iclrintradr; /* adr to R_DMA_CHx_CLR_INTR */
  40. volatile u32 *ifirstadr; /* adr to R_DMA_CHx_FIRST */
  41. volatile u8 *icmdadr; /* adr to R_DMA_CHx_CMD */
  42. volatile u32 *idescradr; /* adr to R_DMA_CHx_DESCR */
  43. int flags; /* defined in tty.h */
  44. u8 rx_ctrl; /* shadow for R_SERIALx_REC_CTRL */
  45. u8 tx_ctrl; /* shadow for R_SERIALx_TR_CTRL */
  46. u8 iseteop; /* bit number for R_SET_EOP for the input dma */
  47. int enabled; /* Set to 1 if the port is enabled in HW config */
  48. u8 dma_out_enabled:1; /* Set to 1 if DMA should be used */
  49. u8 dma_in_enabled:1; /* Set to 1 if DMA should be used */
  50. /* end of fields defined in rs_table[] in .c-file */
  51. u8 uses_dma_in; /* Set to 1 if DMA is used */
  52. u8 uses_dma_out; /* Set to 1 if DMA is used */
  53. u8 forced_eop; /* a fifo eop has been forced */
  54. int baud_base; /* For special baudrates */
  55. int custom_divisor; /* For special baudrates */
  56. struct etrax_dma_descr tr_descr;
  57. struct etrax_dma_descr rec_descr[SERIAL_RECV_DESCRIPTORS];
  58. int cur_rec_descr;
  59. volatile int tr_running; /* 1 if output is running */
  60. struct tty_struct *tty;
  61. int read_status_mask;
  62. int ignore_status_mask;
  63. int x_char; /* xon/xoff character */
  64. int close_delay;
  65. unsigned short closing_wait;
  66. unsigned short closing_wait2;
  67. unsigned long event;
  68. unsigned long last_active;
  69. int line;
  70. int type; /* PORT_ETRAX */
  71. int count; /* # of fd on device */
  72. int blocked_open; /* # of blocked opens */
  73. struct circ_buf xmit;
  74. struct etrax_recv_buffer *first_recv_buffer;
  75. struct etrax_recv_buffer *last_recv_buffer;
  76. unsigned int recv_cnt;
  77. unsigned int max_recv_cnt;
  78. struct work_struct work;
  79. struct async_icount icount; /* error-statistics etc.*/
  80. struct termios normal_termios;
  81. struct termios callout_termios;
  82. #ifdef DECLARE_WAITQUEUE
  83. wait_queue_head_t open_wait;
  84. wait_queue_head_t close_wait;
  85. #else
  86. struct wait_queue *open_wait;
  87. struct wait_queue *close_wait;
  88. #endif
  89. unsigned long char_time_usec; /* The time for 1 char, in usecs */
  90. unsigned long flush_time_usec; /* How often we should flush */
  91. unsigned long last_tx_active_usec; /* Last tx usec in the jiffies */
  92. unsigned long last_tx_active; /* Last tx time in jiffies */
  93. unsigned long last_rx_active_usec; /* Last rx usec in the jiffies */
  94. unsigned long last_rx_active; /* Last rx time in jiffies */
  95. int break_detected_cnt;
  96. int errorcode;
  97. #ifdef CONFIG_ETRAX_RS485
  98. struct rs485_control rs485; /* RS-485 support */
  99. #endif
  100. };
  101. /* this PORT is not in the standard serial.h. it's not actually used for
  102. * anything since we only have one type of async serial-port anyway in this
  103. * system.
  104. */
  105. #define PORT_ETRAX 1
  106. /*
  107. * Events are used to schedule things to happen at timer-interrupt
  108. * time, instead of at rs interrupt time.
  109. */
  110. #define RS_EVENT_WRITE_WAKEUP 0
  111. #endif /* __KERNEL__ */
  112. #endif /* !_ETRAX_SERIAL_H */