Rev 3 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed
Rev | Author | Line No. | Line |
---|---|---|---|
2 | pj | 1 | /* |
2 | * Project: S.Ha.R.K. |
||
3 | * |
||
4 | * Coordinators: |
||
5 | * Giorgio Buttazzo <giorgio@sssup.it> |
||
6 | * Paolo Gai <pj@gandalf.sssup.it> |
||
7 | * |
||
8 | * Authors : |
||
9 | * Paolo Gai <pj@gandalf.sssup.it> |
||
10 | * Massimiliano Giorgi <massy@gandalf.sssup.it> |
||
11 | * Luca Abeni <luca@gandalf.sssup.it> |
||
12 | * (see the web pages for full authors list) |
||
13 | * |
||
14 | * ReTiS Lab (Scuola Superiore S.Anna - Pisa - Italy) |
||
15 | * |
||
16 | * http://www.sssup.it |
||
17 | * http://retis.sssup.it |
||
18 | * http://shark.sssup.it |
||
19 | */ |
||
20 | |||
21 | /** |
||
22 | ------------ |
||
17 | pj | 23 | CVS : $Id: net.c,v 1.2 2002-10-28 08:01:36 pj Exp $ |
2 | pj | 24 | |
25 | File: $File$ |
||
17 | pj | 26 | Revision: $Revision: 1.2 $ |
27 | Last update: $Date: 2002-10-28 08:01:36 $ |
||
2 | pj | 28 | ------------ |
29 | **/ |
||
30 | |||
31 | /* |
||
32 | * Copyright (C) 2000 Luca Abeni |
||
33 | * |
||
34 | * This program is free software; you can redistribute it and/or modify |
||
35 | * it under the terms of the GNU General Public License as published by |
||
36 | * the Free Software Foundation; either version 2 of the License, or |
||
37 | * (at your option) any later version. |
||
38 | * |
||
39 | * This program is distributed in the hope that it will be useful, |
||
40 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
||
41 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
||
42 | * GNU General Public License for more details. |
||
43 | * |
||
44 | * You should have received a copy of the GNU General Public License |
||
45 | * along with this program; if not, write to the Free Software |
||
46 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA |
||
47 | * |
||
48 | */ |
||
49 | |||
50 | /* Author: Luca Abeni */ |
||
51 | /* Date: 4/12/1997 */ |
||
52 | |||
53 | /* File: net.C */ |
||
54 | /* Revision: 1.00 */ |
||
55 | |||
56 | /* |
||
57 | This module provides an interface function eth_init that initialize |
||
58 | all the network library layers (LowLev, Ethrnet, IP,...) according |
||
59 | to the values passed in a net_model structure |
||
60 | */ |
||
61 | |||
62 | #include <kernel/kern.h> |
||
63 | #include <drivers/net.h> |
||
64 | #include "eth_priv.h" |
||
65 | |||
17 | pj | 66 | //#define DEBUG_NET |
67 | |||
2 | pj | 68 | /* OKKIO!!!!! net_base must change if you change NET_MAX_PROTOCOLS!!!! */ |
69 | struct net_model net_base = {0, 0, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
||
70 | NULL, NULL, NULL, NULL, NULL, NULL, NULL, |
||
71 | NULL, NULL, NULL, NULL, NULL, NULL}}; |
||
72 | |||
73 | void net_setprotocol(struct net_model *m, void (*initfun)(void *parm), void *initparms) |
||
74 | { |
||
75 | int i; |
||
76 | |||
77 | i = m->numprotocol++; |
||
78 | m->protocol[i].initfun=initfun; |
||
79 | m->protocol[i].initparms=initparms; |
||
80 | } |
||
81 | |||
82 | int net_init(struct net_model *m) |
||
83 | { |
||
84 | int i; |
||
85 | int app; |
||
86 | |||
87 | /* First, initialize the base layers: eth & lowlev */ |
||
88 | if (app = eth_init(m->lowlevparm,NULL) != 1) { |
||
89 | return app; |
||
90 | } |
||
91 | /* Then, the high level layers */ |
||
92 | for(i = 0; i < m->numprotocol; i++) { |
||
17 | pj | 93 | #ifdef DEBUG_NET |
94 | printk(KERN_DEBUG "Protocol %d init \n", i); |
||
95 | #endif |
||
96 | m->protocol[i].initfun(m->protocol[i].initparms); |
||
2 | pj | 97 | } |
98 | |||
99 | return 1; |
||
100 | } |