scc.h 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. /* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */
  2. /* $Id: scc.h,v 1.29 1997/04/02 14:56:45 jreuter Exp jreuter $ */
  3. #ifndef _SCC_H
  4. #define _SCC_H
  5. #include <linux/sockios.h>
  6. /* selection of hardware types */
  7. #define PA0HZP 0x00 /* hardware type for PA0HZP SCC card and compatible */
  8. #define EAGLE 0x01 /* hardware type for EAGLE card */
  9. #define PC100 0x02 /* hardware type for PC100 card */
  10. #define PRIMUS 0x04 /* hardware type for PRIMUS-PC (DG9BL) card */
  11. #define DRSI 0x08 /* hardware type for DRSI PC*Packet card */
  12. #define BAYCOM 0x10 /* hardware type for BayCom (U)SCC */
  13. /* DEV ioctl() commands */
  14. enum SCC_ioctl_cmds {
  15. SIOCSCCRESERVED = SIOCDEVPRIVATE,
  16. SIOCSCCCFG,
  17. SIOCSCCINI,
  18. SIOCSCCCHANINI,
  19. SIOCSCCSMEM,
  20. SIOCSCCGKISS,
  21. SIOCSCCSKISS,
  22. SIOCSCCGSTAT,
  23. SIOCSCCCAL
  24. };
  25. /* Device parameter control (from WAMPES) */
  26. enum L1_params {
  27. PARAM_DATA,
  28. PARAM_TXDELAY,
  29. PARAM_PERSIST,
  30. PARAM_SLOTTIME,
  31. PARAM_TXTAIL,
  32. PARAM_FULLDUP,
  33. PARAM_SOFTDCD, /* was: PARAM_HW */
  34. PARAM_MUTE, /* ??? */
  35. PARAM_DTR,
  36. PARAM_RTS,
  37. PARAM_SPEED,
  38. PARAM_ENDDELAY, /* ??? */
  39. PARAM_GROUP,
  40. PARAM_IDLE,
  41. PARAM_MIN,
  42. PARAM_MAXKEY,
  43. PARAM_WAIT,
  44. PARAM_MAXDEFER,
  45. PARAM_TX,
  46. PARAM_HWEVENT = 31,
  47. PARAM_RETURN = 255 /* reset kiss mode */
  48. };
  49. /* fulldup parameter */
  50. enum FULLDUP_modes {
  51. KISS_DUPLEX_HALF, /* normal CSMA operation */
  52. KISS_DUPLEX_FULL, /* fullduplex, key down trx after transmission */
  53. KISS_DUPLEX_LINK, /* fullduplex, key down trx after 'idletime' sec */
  54. KISS_DUPLEX_OPTIMA /* fullduplex, let the protocol layer control the hw */
  55. };
  56. /* misc. parameters */
  57. #define TIMER_OFF 65535U /* to switch off timers */
  58. #define NO_SUCH_PARAM 65534U /* param not implemented */
  59. /* HWEVENT parameter */
  60. enum HWEVENT_opts {
  61. HWEV_DCD_ON,
  62. HWEV_DCD_OFF,
  63. HWEV_ALL_SENT
  64. };
  65. /* channel grouping */
  66. #define RXGROUP 0100 /* if set, only tx when all channels clear */
  67. #define TXGROUP 0200 /* if set, don't transmit simultaneously */
  68. /* Tx/Rx clock sources */
  69. enum CLOCK_sources {
  70. CLK_DPLL, /* normal halfduplex operation */
  71. CLK_EXTERNAL, /* external clocking (G3RUH/DF9IC modems) */
  72. CLK_DIVIDER, /* Rx = DPLL, Tx = divider (fullduplex with */
  73. /* modems without clock regeneration */
  74. CLK_BRG /* experimental fullduplex mode with DPLL/BRG for */
  75. /* MODEMs without clock recovery */
  76. };
  77. /* Tx state */
  78. enum TX_state {
  79. TXS_IDLE, /* Transmitter off, no data pending */
  80. TXS_BUSY, /* waiting for permission to send / tailtime */
  81. TXS_ACTIVE, /* Transmitter on, sending data */
  82. TXS_NEWFRAME, /* reset CRC and send (next) frame */
  83. TXS_IDLE2, /* Transmitter on, no data pending */
  84. TXS_WAIT, /* Waiting for Mintime to expire */
  85. TXS_TIMEOUT /* We had a transmission timeout */
  86. };
  87. typedef unsigned long io_port; /* type definition for an 'io port address' */
  88. /* SCC statistical information */
  89. struct scc_stat {
  90. long rxints; /* Receiver interrupts */
  91. long txints; /* Transmitter interrupts */
  92. long exints; /* External/status interrupts */
  93. long spints; /* Special receiver interrupts */
  94. long txframes; /* Packets sent */
  95. long rxframes; /* Number of Frames Actually Received */
  96. long rxerrs; /* CRC Errors */
  97. long txerrs; /* KISS errors */
  98. unsigned int nospace; /* "Out of buffers" */
  99. unsigned int rx_over; /* Receiver Overruns */
  100. unsigned int tx_under; /* Transmitter Underruns */
  101. unsigned int tx_state; /* Transmitter state */
  102. int tx_queued; /* tx frames enqueued */
  103. unsigned int maxqueue; /* allocated tx_buffers */
  104. unsigned int bufsize; /* used buffersize */
  105. };
  106. struct scc_modem {
  107. long speed; /* Line speed, bps */
  108. char clocksrc; /* 0 = DPLL, 1 = external, 2 = divider */
  109. char nrz; /* NRZ instead of NRZI */
  110. };
  111. struct scc_kiss_cmd {
  112. int command; /* one of the KISS-Commands defined above */
  113. unsigned param; /* KISS-Param */
  114. };
  115. struct scc_hw_config {
  116. io_port data_a; /* data port channel A */
  117. io_port ctrl_a; /* control port channel A */
  118. io_port data_b; /* data port channel B */
  119. io_port ctrl_b; /* control port channel B */
  120. io_port vector_latch; /* INTACK-Latch (#) */
  121. io_port special; /* special function port */
  122. int irq; /* irq */
  123. long clock; /* clock */
  124. char option; /* command for function port */
  125. char brand; /* hardware type */
  126. char escc; /* use ext. features of a 8580/85180/85280 */
  127. };
  128. /* (#) only one INTACK latch allowed. */
  129. struct scc_mem_config {
  130. unsigned int dummy;
  131. unsigned int bufsize;
  132. };
  133. struct scc_calibrate {
  134. unsigned int time;
  135. unsigned char pattern;
  136. };
  137. #endif /* _SCC_H */