OpenCores
URL https://opencores.org/ocsvn/or1k/or1k/trunk

Subversion Repositories or1k

[/] [or1k/] [trunk/] [uclinux/] [uClinux-2.0.x/] [include/] [linux/] [if_frad.h] - Blame information for rev 1765

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 199 simons
/*
2
 * DLCI/FRAD    Definitions for Frame Relay Access Devices.  DLCI devices are
3
 *              created for each DLCI associated with a FRAD.  The FRAD driver
4
 *              is not truly a network device, but the lower level device
5
 *              handler.  This allows other FRAD manufacturers to use the DLCI
6
 *              code, including its RFC1490 encapsulation alongside the current
7
 *              implementation for the Sangoma cards.
8
 *
9
 * Version:     @(#)if_ifrad.h  0.15    31 Mar 96
10
 *
11
 * Author:      Mike McLagan <mike.mclagan@linux.org>
12
 *
13
 * Changes:
14
 *              0.15    Mike McLagan    changed structure defs (packed)
15
 *                                      re-arranged flags
16
 *                                      added DLCI_RET vars
17
 *
18
 *              This program is free software; you can redistribute it and/or
19
 *              modify it under the terms of the GNU General Public License
20
 *              as published by the Free Software Foundation; either version
21
 *              2 of the License, or (at your option) any later version.
22
 */
23
 
24
#ifndef _FRAD_H_
25
#define _FRAD_H_
26
 
27
#include <linux/config.h>
28
#include <linux/if.h>
29
 
30
/* Structures and constants associated with the DLCI device driver */
31
 
32
struct dlci_add
33
{
34
   char  devname[IFNAMSIZ];
35
   short dlci;
36
};
37
 
38
#define DLCI_GET_CONF   (SIOCDEVPRIVATE + 2)
39
#define DLCI_SET_CONF   (SIOCDEVPRIVATE + 3)
40
 
41
/*
42
 * These are related to the Sangoma SDLA and should remain in order.
43
 * Code within the SDLA module is based on the specifics of this
44
 * structure.  Change at your own peril.
45
 */
46
struct dlci_conf {
47
   short flags;
48
   short CIR_fwd;
49
   short Bc_fwd;
50
   short Be_fwd;
51
   short CIR_bwd;
52
   short Bc_bwd;
53
   short Be_bwd;
54
 
55
/* these are part of the status read */
56
   short Tc_fwd;
57
   short Tc_bwd;
58
   short Tf_max;
59
   short Tb_max;
60
 
61
/* add any new fields here above is a mirror of sdla_dlci_conf */
62
};
63
 
64
#define DLCI_GET_SLAVE  (SIOCDEVPRIVATE + 4)
65
 
66
/* configuration flags for DLCI */
67
#define DLCI_IGNORE_CIR_OUT     0x0001
68
#define DLCI_ACCOUNT_CIR_IN     0x0002
69
#define DLCI_BUFFER_IF          0x0008
70
 
71
#define DLCI_VALID_FLAGS        0x000B
72
 
73
/* FRAD driver uses these to indicate what it did with packet */
74
#define DLCI_RET_OK             0x00
75
#define DLCI_RET_ERR            0x01
76
#define DLCI_RET_DROP           0x02
77
 
78
/* defines for the actual Frame Relay hardware */
79
#define FRAD_GET_CONF   (SIOCDEVPRIVATE)
80
#define FRAD_SET_CONF   (SIOCDEVPRIVATE + 1)
81
 
82
#define FRAD_LAST_IOCTL FRAD_SET_CONF
83
 
84
/*
85
 * Based on the setup for the Sangoma SDLA.  If changes are
86
 * necessary to this structure, a routine will need to be
87
 * added to that module to copy fields.
88
 */
89
struct frad_conf
90
{
91
   short station;
92
   short flags;
93
   short kbaud;
94
   short clocking;
95
   short mtu;
96
   short T391;
97
   short T392;
98
   short N391;
99
   short N392;
100
   short N393;
101
   short CIR_fwd;
102
   short Bc_fwd;
103
   short Be_fwd;
104
   short CIR_bwd;
105
   short Bc_bwd;
106
   short Be_bwd;
107
 
108
/* Add new fields here, above is a mirror of the sdla_conf */
109
 
110
};
111
 
112
#define FRAD_STATION_CPE        0x0000
113
#define FRAD_STATION_NODE       0x0001
114
 
115
#define FRAD_TX_IGNORE_CIR      0x0001
116
#define FRAD_RX_ACCOUNT_CIR     0x0002
117
#define FRAD_DROP_ABORTED       0x0004
118
#define FRAD_BUFFERIF           0x0008
119
#define FRAD_STATS              0x0010
120
#define FRAD_MCI                0x0100
121
#define FRAD_AUTODLCI           0x8000
122
#define FRAD_VALID_FLAGS        0x811F
123
 
124
#define FRAD_CLOCK_INT          0x0001
125
#define FRAD_CLOCK_EXT          0x0000
126
 
127
#ifdef __KERNEL__
128
 
129
/* these are the fields of an RFC 1490 header */
130
struct frhdr
131
{
132
   unsigned char  control       __attribute__((packed));
133
 
134
   /* for IP packets, this can be the NLPID */
135
   unsigned char  pad           __attribute__((packed));
136
 
137
   unsigned char  NLPID         __attribute__((packed));
138
   unsigned char  OUI[3]        __attribute__((packed));
139
   unsigned short PID           __attribute__((packed));
140
 
141
#define IP_NLPID pad 
142
};
143
 
144
/* see RFC 1490 for the definition of the following */
145
#define FRAD_I_UI               0x03
146
 
147
#define FRAD_P_PADDING          0x00
148
#define FRAD_P_Q933             0x08
149
#define FRAD_P_SNAP             0x80
150
#define FRAD_P_CLNP             0x81
151
#define FRAD_P_IP               0xCC
152
 
153
struct dlci_local
154
{
155
   struct enet_statistics stats;
156
   struct device          *slave;
157
   struct dlci_conf       config;
158
   int                    configured;
159
 
160
   /* callback function */
161
   void              (*receive)(struct sk_buff *skb, struct device *);
162
};
163
 
164
struct frad_local
165
{
166
   struct enet_statistics stats;
167
 
168
   /* devices which this FRAD is slaved to */
169
   struct device     *master[CONFIG_DLCI_MAX];
170
   short             dlci[CONFIG_DLCI_MAX];
171
 
172
   struct frad_conf  config;
173
   int               configured;        /* has this device been configured */
174
   int               initialized;       /* mem_start, port, irq set ? */
175
 
176
   /* callback functions */
177
   int               (*activate)(struct device *, struct device *);
178
   int               (*deactivate)(struct device *, struct device *);
179
   int               (*assoc)(struct device *, struct device *);
180
   int               (*deassoc)(struct device *, struct device *);
181
   int               (*dlci_conf)(struct device *, struct device *, int get);
182
 
183
   /* fields that are used by the Sangoma SDLA cards */
184
   struct timer_list timer;
185
   int               type;              /* adapter type */
186
   int               state;             /* state of the S502/8 control latch */
187
   int               buffer;            /* current buffer for S508 firmware */
188
};
189
 
190
int register_frad(const char *name);
191
int unregister_frad(const char *name);
192
 
193
#endif __KERNEL__
194
 
195
#endif

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.