cycx_x25.h
上传用户:jlfgdled
上传日期:2013-04-10
资源大小:33168k
文件大小:4k
源码类别:

Linux/Unix编程

开发平台:

Unix_Linux

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