UbixOS
2.0
init.c
Go to the documentation of this file.
1
/*****************************************************************************************
2
Copyright (c) 2004 The UbixOS Project
3
All rights reserved.
4
5
Redistribution and use in source and binary forms, with or without modification, are
6
permitted provided that the following conditions are met:
7
8
Redistributions of source code must retain the above copyright notice, this list of
9
conditions, the following disclaimer and the list of authors. Redistributions in binary
10
form must reproduce the above copyright notice, this list of conditions, the following
11
disclaimer and the list of authors in the documentation and/or other materials provided
12
with the distribution. Neither the name of the UbixOS Project nor the names of its
13
contributors may be used to endorse or promote products derived from this software
14
without specific prior written permission.
15
16
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
17
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
19
THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21
OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
22
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR
23
TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
24
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25
26
$Id: init.c 54 2016-01-11 01:29:55Z reddawg $
27
28
*****************************************************************************************/
29
30
#include <
sys/types.h
>
31
#include <
ubixos/sched.h
>
32
#include <
ubixos/endtask.h
>
33
#include <
ubixos/sem.h
>
34
35
#include <
net/sys.h
>
36
#include <
net/mem.h
>
37
#include <
net/memp.h
>
38
#include <
net/tcpip.h
>
39
#include <
net/ip_addr.h
>
40
41
#include <
netif/ethernet.h
>
42
#include <
netif/ethernetif.h
>
43
44
#include <
ubixos/exec.h
>
45
#include <
lib/kmalloc.h
>
46
#include <
lib/kprintf.h
>
47
48
void
lnc_thread
();
49
void
shell_thread
(
void
*);
50
51
struct
netif
lnc_netif
;
52
53
int
net_init
() {
54
ip_addr_t
ipaddr, netmask, gw;
55
56
tcpip_init
(
NULL
,
NULL
);
57
58
IP4_ADDR(&gw, 10, 50, 0, 1);
59
IP4_ADDR(&ipaddr, 10, 50, 0, 7);
60
IP4_ADDR(&netmask, 255, 255, 0, 0);
61
62
netif_add
(&
lnc_netif
, &ipaddr, &netmask, &gw,
NULL
,
ethernetif_init
,
tcpip_input
);
63
netif_set_link_up
(&
lnc_netif
);
64
netif_set_up
(&
lnc_netif
);
65
66
netif_set_default
(&
lnc_netif
);
67
sys_thread_new
(
"lncThread"
, (
void
*)
lnc_thread
, 0x0, 0x1000, 0x0);
68
sys_thread_new
(
"shellThread"
, (
void
*)
shell_thread
, 0x0, 0x1000, 0x0);
69
70
return
(0x0);
71
}
net_init
int net_init()
Definition:
init.c:52
sys.h
ethernetif_init
err_t ethernetif_init(struct netif *netif)
Definition:
ethernetif.c:302
netif_set_up
void netif_set_up(struct netif *netif)
Definition:
netif.c:624
tcpip.h
sem.h
tcpip_init
void tcpip_init(tcpip_init_done_fn tcpip_init_done, void *arg)
Definition:
tcpip.c:446
endtask.h
sys_thread_new
sys_thread_t sys_thread_new(const char *name, lwip_thread_fn thread, void *arg, int stacksize, int prio)
Definition:
sys_arch.c:378
exec.h
sched.h
types.h
kprintf.h
ip_addr_t
ip6_addr_t ip_addr_t
Definition:
ip_addr.h:290
netif
Definition:
netif.h:233
shell_thread
void shell_thread(void *)
Definition:
shell.c:95
ethernet.h
netif_set_default
void netif_set_default(struct netif *netif)
Definition:
netif.c:604
lnc_netif
struct netif lnc_netif
Definition:
init.c:50
tcpip_input
err_t tcpip_input(struct pbuf *p, struct netif *inp)
Definition:
tcpip.c:204
netif_add
struct netif * netif_add(struct netif *netif, void *state, netif_init_fn init, netif_input_fn input)
Definition:
netif.c:241
ethernetif.h
netif_set_link_up
void netif_set_link_up(struct netif *netif)
Definition:
netif.c:735
memp.h
mem.h
kmalloc.h
ip_addr.h
lnc_thread
void lnc_thread()
Definition:
lnc.c:278
NULL
#define NULL
Definition:
fat_string.h:17
net
net
init.c
Generated by
1.8.16