cycx_x25.h 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. #ifndef _CYCX_X25_H
  2. #define _CYCX_X25_H
  3. /*
  4. * cycx_x25.h Cyclom X.25 firmware API definitions.
  5. *
  6. * Author: Arnaldo Carvalho de Melo <acme@conectiva.com.br>
  7. *
  8. * Copyright: (c) 1998-2003 Arnaldo Carvalho de Melo
  9. *
  10. * Based on sdla_x25.h by Gene Kozin <74604.152@compuserve.com>
  11. *
  12. * This program is free software; you can redistribute it and/or
  13. * modify it under the terms of the GNU General Public License
  14. * as published by the Free Software Foundation; either version
  15. * 2 of the License, or (at your option) any later version.
  16. * ============================================================================
  17. * 2000/04/02 acme dprintk and cycx_debug
  18. * 1999/01/03 acme judicious use of data types
  19. * 1999/01/02 acme #define X25_ACK_N3 0x4411
  20. * 1998/12/28 acme cleanup: lot'o'things removed
  21. * commands listed,
  22. * TX25Cmd & TX25Config structs
  23. * typedef'ed
  24. */
  25. #ifndef PACKED
  26. #define PACKED __attribute__((packed))
  27. #endif
  28. /* X.25 shared memory layout. */
  29. #define X25_MBOX_OFFS 0x300 /* general mailbox block */
  30. #define X25_RXMBOX_OFFS 0x340 /* receive mailbox */
  31. /* Debug */
  32. #define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a)
  33. extern unsigned int cycx_debug;
  34. /* Data Structures */
  35. /* X.25 Command Block. */
  36. struct cycx_x25_cmd {
  37. u16 command;
  38. u16 link; /* values: 0 or 1 */
  39. u16 len; /* values: 0 thru 0x205 (517) */
  40. u32 buf;
  41. } PACKED;
  42. /* Defines for the 'command' field. */
  43. #define X25_CONNECT_REQUEST 0x4401
  44. #define X25_CONNECT_RESPONSE 0x4402
  45. #define X25_DISCONNECT_REQUEST 0x4403
  46. #define X25_DISCONNECT_RESPONSE 0x4404
  47. #define X25_DATA_REQUEST 0x4405
  48. #define X25_ACK_TO_VC 0x4406
  49. #define X25_INTERRUPT_RESPONSE 0x4407
  50. #define X25_CONFIG 0x4408
  51. #define X25_CONNECT_INDICATION 0x4409
  52. #define X25_CONNECT_CONFIRM 0x440A
  53. #define X25_DISCONNECT_INDICATION 0x440B
  54. #define X25_DISCONNECT_CONFIRM 0x440C
  55. #define X25_DATA_INDICATION 0x440E
  56. #define X25_INTERRUPT_INDICATION 0x440F
  57. #define X25_ACK_FROM_VC 0x4410
  58. #define X25_ACK_N3 0x4411
  59. #define X25_CONNECT_COLLISION 0x4413
  60. #define X25_N3WIN 0x4414
  61. #define X25_LINE_ON 0x4415
  62. #define X25_LINE_OFF 0x4416
  63. #define X25_RESET_REQUEST 0x4417
  64. #define X25_LOG 0x4500
  65. #define X25_STATISTIC 0x4600
  66. #define X25_TRACE 0x4700
  67. #define X25_N2TRACEXC 0x4702
  68. #define X25_N3TRACEXC 0x4703
  69. /**
  70. * struct cycx_x25_config - cyclom2x x25 firmware configuration
  71. * @link - link number
  72. * @speed - line speed
  73. * @clock - internal/external
  74. * @n2 - # of level 2 retransm.(values: 1 thru FF)
  75. * @n2win - level 2 window (values: 1 thru 7)
  76. * @n3win - level 3 window (values: 1 thru 7)
  77. * @nvc - # of logical channels (values: 1 thru 64)
  78. * @pktlen - level 3 packet lenght - log base 2 of size
  79. * @locaddr - my address
  80. * @remaddr - remote address
  81. * @t1 - time, in seconds
  82. * @t2 - time, in seconds
  83. * @t21 - time, in seconds
  84. * @npvc - # of permanent virt. circuits (1 thru nvc)
  85. * @t23 - time, in seconds
  86. * @flags - see dosx25.doc, in portuguese, for details
  87. */
  88. struct cycx_x25_config {
  89. u8 link;
  90. u8 speed;
  91. u8 clock;
  92. u8 n2;
  93. u8 n2win;
  94. u8 n3win;
  95. u8 nvc;
  96. u8 pktlen;
  97. u8 locaddr;
  98. u8 remaddr;
  99. u16 t1;
  100. u16 t2;
  101. u8 t21;
  102. u8 npvc;
  103. u8 t23;
  104. u8 flags;
  105. } PACKED;
  106. struct cycx_x25_stats {
  107. u16 rx_crc_errors;
  108. u16 rx_over_errors;
  109. u16 n2_tx_frames;
  110. u16 n2_rx_frames;
  111. u16 tx_timeouts;
  112. u16 rx_timeouts;
  113. u16 n3_tx_packets;
  114. u16 n3_rx_packets;
  115. u16 tx_aborts;
  116. u16 rx_aborts;
  117. } PACKED;
  118. #endif /* _CYCX_X25_H */