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 26#ifndef PACKED 27#define PACKED __attribute__((packed)) 28#endif 29 30/* X.25 shared memory layout. */ 31#define X25_MBOX_OFFS 0x300 /* general mailbox block */ 32#define X25_RXMBOX_OFFS 0x340 /* receive mailbox */ 33 34/* Debug */ 35#define dprintk(level, format, a...) if (cycx_debug >= level) printk(format, ##a) 36 37extern unsigned int cycx_debug; 38 39/* Data Structures */ 40/* X.25 Command Block. */ 41typedef struct X25Cmd 42{ 43 u16 command PACKED; 44 u16 link PACKED; /* values: 0 or 1 */ 45 u16 len PACKED; /* values: 0 thru 0x205 (517) */ 46 u32 buf PACKED; 47} TX25Cmd; 48 49/* Defines for the 'command' field. */ 50#define X25_CONNECT_REQUEST 0x4401 51#define X25_CONNECT_RESPONSE 0x4402 52#define X25_DISCONNECT_REQUEST 0x4403 53#define X25_DISCONNECT_RESPONSE 0x4404 54#define X25_DATA_REQUEST 0x4405 55#define X25_ACK_TO_VC 0x4406 56#define X25_INTERRUPT_RESPONSE 0x4407 57#define X25_CONFIG 0x4408 58#define X25_CONNECT_INDICATION 0x4409 59#define X25_CONNECT_CONFIRM 0x440A 60#define X25_DISCONNECT_INDICATION 0x440B 61#define X25_DISCONNECT_CONFIRM 0x440C 62#define X25_DATA_INDICATION 0x440E 63#define X25_INTERRUPT_INDICATION 0x440F 64#define X25_ACK_FROM_VC 0x4410 65#define X25_ACK_N3 0x4411 66#define X25_CONNECT_COLLISION 0x4413 67#define X25_N3WIN 0x4414 68#define X25_LINE_ON 0x4415 69#define X25_LINE_OFF 0x4416 70#define X25_RESET_REQUEST 0x4417 71#define X25_LOG 0x4500 72#define X25_STATISTIC 0x4600 73#define X25_TRACE 0x4700 74#define X25_N2TRACEXC 0x4702 75#define X25_N3TRACEXC 0x4703 76 77typedef struct X25Config { 78 u8 link PACKED; /* link number */ 79 u8 speed PACKED; /* line speed */ 80 u8 clock PACKED; /* internal/external */ 81 u8 n2 PACKED; /* # of level 2 retransm.(values: 1 thru FF) */ 82 u8 n2win PACKED; /* level 2 window (values: 1 thru 7) */ 83 u8 n3win PACKED; /* level 3 window (values: 1 thru 7) */ 84 u8 nvc PACKED; /* # of logical channels (values: 1 thru 64) */ 85 u8 pktlen PACKED; /* level 3 packet lenght - log base 2 of size */ 86 u8 locaddr PACKED; /* my address */ 87 u8 remaddr PACKED; /* remote address */ 88 u16 t1 PACKED; /* time, in seconds */ 89 u16 t2 PACKED; /* time, in seconds */ 90 u8 t21 PACKED; /* time, in seconds */ 91 u8 npvc PACKED; /* # of permanent virt. circuits (1 thru nvc) */ 92 u8 t23 PACKED; /* time, in seconds */ 93 u8 flags PACKED; /* see dosx25.doc, in portuguese, for details */ 94} TX25Config; 95 96typedef struct X25Stats { 97 u16 rx_crc_errors PACKED; 98 u16 rx_over_errors PACKED; 99 u16 n2_tx_frames PACKED; 100 u16 n2_rx_frames PACKED; 101 u16 tx_timeouts PACKED; 102 u16 rx_timeouts PACKED; 103 u16 n3_tx_packets PACKED; 104 u16 n3_rx_packets PACKED; 105 u16 tx_aborts PACKED; 106 u16 rx_aborts PACKED; 107} TX25Stats; 108#endif /* _CYCX_X25_H */ 109