crisv10.h 3.9 KB

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