RetroArch
netif.h
Go to the documentation of this file.
1 /*
2  * Copyright (c) 2001-2004 Swedish Institute of Computer Science.
3  * All rights reserved.
4  *
5  * Redistribution and use in source and binary forms, with or without modification,
6  * are permitted provided that the following conditions are met:
7  *
8  * 1. Redistributions of source code must retain the above copyright notice,
9  * this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation
12  * and/or other materials provided with the distribution.
13  * 3. The name of the author may not be used to endorse or promote products
14  * derived from this software without specific prior written permission.
15  *
16  * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17  * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18  * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
19  * SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
20  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT
21  * OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
22  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
23  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING
24  * IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
25  * OF SUCH DAMAGE.
26  *
27  * This file is part of the lwIP TCP/IP stack.
28  *
29  * Author: Adam Dunkels <[email protected]>
30  *
31  */
32 #ifndef __LWIP_NETIF_H__
33 #define __LWIP_NETIF_H__
34 
35 #include "lwip/opt.h"
36 
37 #include "lwip/err.h"
38 
39 #include "lwip/ip_addr.h"
40 
41 #include "lwip/inet.h"
42 #include "lwip/pbuf.h"
43 #if LWIP_DHCP
44 # include "lwip/dhcp.h"
45 #endif
46 
49 #define NETIF_MAX_HWADDR_LEN 6U
50 
57 #define NETIF_FLAG_UP 0x1U
58 
59 #define NETIF_FLAG_BROADCAST 0x2U
60 
61 #define NETIF_FLAG_POINTTOPOINT 0x4U
62 
63 #define NETIF_FLAG_DHCP 0x08U
64 
66 #define NETIF_FLAG_LINK_UP 0x10U
67 
72 struct netif {
74  struct netif *next;
75 
77  struct ip_addr ip_addr;
78  struct ip_addr netmask;
79  struct ip_addr gw;
80 
83  err_t (* input)(struct pbuf *p, struct netif *inp);
87  err_t (* output)(struct netif *netif, struct pbuf *p,
88  struct ip_addr *ipaddr);
92  err_t (* linkoutput)(struct netif *netif, struct pbuf *p);
95  void *state;
96 #if LWIP_DHCP
97 
98  struct dhcp *dhcp;
99 #endif
100 
111  char name[2];
114 };
115 
117 extern struct netif *netif_list;
119 extern struct netif *netif_default;
120 
121 /* netif_init() must be called first. */
122 void netif_init(void);
123 
124 struct netif *netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask,
125  struct ip_addr *gw,
126  void *state,
127  err_t (* init)(struct netif *netif),
128  err_t (* input)(struct pbuf *p, struct netif *netif));
129 
130 void
131 netif_set_addr(struct netif *netif,struct ip_addr *ipaddr, struct ip_addr *netmask,
132  struct ip_addr *gw);
133 void netif_remove(struct netif * netif);
134 
135 /* Returns a network interface given its name. The name is of the form
136  "et0", where the first two letters are the "name" field in the
137  netif structure, and the digit is in the num field in the same
138  structure. */
139 struct netif *netif_find(char *name);
140 
141 void netif_set_default(struct netif *netif);
142 
143 void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr);
144 void netif_set_netmask(struct netif *netif, struct ip_addr *netmast);
145 void netif_set_gw(struct netif *netif, struct ip_addr *gw);
146 void netif_set_up(struct netif *netif);
147 void netif_set_down(struct netif *netif);
148 u8_t netif_is_up(struct netif *netif);
149 
150 #endif /* __LWIP_NETIF_H__ */
void netif_set_up(struct netif *netif)
Definition: netif.c:257
GLuint const GLchar * name
Definition: glext.h:6671
s8_t err_t
Definition: err.h:39
void netif_set_addr(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw)
Definition: netif.c:103
struct netif * netif_add(struct netif *netif, struct ip_addr *ipaddr, struct ip_addr *netmask, struct ip_addr *gw, void *state, err_t(*init)(struct netif *netif), err_t(*input)(struct pbuf *p, struct netif *netif))
Definition: netif.c:64
struct netif * netif_default
Definition: netif.c:47
Definition: ip_addr.h:41
Definition: dhcp.h:16
u8_t flags
Definition: netif.h:107
u16_t mtu
Definition: netif.h:105
u8_t link_type
Definition: netif.h:109
void * state
Definition: netif.h:95
void netif_set_gw(struct netif *netif, struct ip_addr *gw)
Definition: netif.c:217
Definition: netif.h:72
GLenum GLenum GLenum input
Definition: glext.h:9938
struct netif * netif_find(char *name)
Definition: netif.c:139
void netif_init(void)
Definition: netif.c:284
void netif_set_default(struct netif *netif)
Definition: netif.c:241
err_t(* linkoutput)(struct netif *netif, struct pbuf *p)
Definition: netif.h:92
struct netif * netif_list
Definition: netif.c:46
void netif_remove(struct netif *netif)
Definition: netif.c:111
static uint64_t state[MAX_PADS]
Definition: xenon360_input.c:33
static struct uip_netif netif
Definition: tcpip.c:48
u8_t hwaddr_len
Definition: netif.h:101
#define NETIF_MAX_HWADDR_LEN
Definition: netif.h:49
void netif_set_down(struct netif *netif)
Definition: netif.c:278
GLfloat GLfloat p
Definition: glext.h:9809
u8 u8_t
Definition: cc.h:43
u8_t netif_is_up(struct netif *netif)
Definition: netif.c:265
u8_t num
Definition: netif.h:113
void netif_set_ipaddr(struct netif *netif, struct ip_addr *ipaddr)
Definition: netif.c:163
err_t(* output)(struct netif *netif, struct pbuf *p, struct ip_addr *ipaddr)
Definition: netif.h:87
struct netif * next
Definition: netif.h:74
u8_t hwaddr[NETIF_MAX_HWADDR_LEN]
Definition: netif.h:103
struct ip_addr gw
Definition: netif.h:79
struct ip_addr netmask
Definition: netif.h:78
void netif_set_netmask(struct netif *netif, struct ip_addr *netmast)
Definition: netif.c:229
u16 u16_t
Definition: cc.h:45
set set set set set set set macro pixldst1 abits if abits op else op endif endm macro pixldst2 abits if abits op else op endif endm macro pixldst4 abits if abits op else op endif endm macro pixldst0 abits op endm macro pixldst3 mem_operand op endm macro pixldst30 mem_operand op endm macro pixldst abits if abits elseif abits elseif abits elseif abits elseif abits pixldst0 abits else pixldst0 abits pixldst0 abits pixldst0 abits pixldst0 abits endif elseif abits else pixldst0 abits pixldst0 abits endif elseif abits else error unsupported bpp *numpix else pixst endif endm macro pixld1_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl mov asr adds SRC_WIDTH_FIXED bpl add asl else error unsupported endif endm macro pixld2_s mem_operand if mov asr add asl add asl mov asr sub UNIT_X add asl mov asr add asl add asl mov asr add UNIT_X add asl else pixld1_s mem_operand pixld1_s mem_operand endif endm macro pixld0_s mem_operand if asr adds SRC_WIDTH_FIXED bpl add asl elseif asr adds SRC_WIDTH_FIXED bpl add asl endif endm macro pixld_s_internal mem_operand if mem_operand pixld2_s mem_operand pixdeinterleave basereg elseif mem_operand elseif mem_operand elseif mem_operand elseif mem_operand pixld0_s mem_operand else pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else pixld0_s mem_operand pixld0_s mem_operand endif elseif mem_operand else error unsupported mem_operand if bpp mem_operand endif endm macro vuzp8 reg2 vuzp d d &reg2 endm macro vzip8 reg2 vzip d d &reg2 endm macro pixdeinterleave basereg basereg basereg basereg basereg endif endm macro pixinterleave basereg basereg basereg basereg basereg endif endm macro PF boost_increment endif if endif PF tst PF addne PF subne PF cmp ORIG_W if endif if endif if endif PF subge ORIG_W PF subges if endif if endif if endif endif endm macro cache_preload_simple endif if dst_r_bpp pld [DST_R, #(PREFETCH_DISTANCE_SIMPLE *dst_r_bpp/8)] endif if mask_bpp pld init[MASK, #(PREFETCH_DISTANCE_SIMPLE *mask_bpp/8)] endif endif endm macro fetch_mask_pixblock pixld mask_basereg pixblock_size MASK endm macro ensure_destination_ptr_alignment process_pixblock_tail_head if beq irp local skip1 beq endif SRC MASK if dst_r_bpp DST_R else add endif PF add sub src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head pixblock_size cache_preload_simple process_pixblock_tail pixinterleave dst_w_basereg irp beq endif process_pixblock_tail_head tst beq irp if pixblock_size chunk_size tst beq pixld_src SRC pixld MASK if DST_R else pixld DST_R endif if src_basereg pixdeinterleave mask_basereg pixdeinterleave dst_r_basereg process_pixblock_head if pixblock_size cache_preload_simple endif process_pixblock_tail pixinterleave dst_w_basereg irp if pixblock_size chunk_size tst beq if DST_W else pixst DST_W else mov ORIG_W endif add lsl if lsl endif if lsl endif lsl endif lsl endif lsl endif subs mov DST_W if regs_shortage str endif bge start_of_loop_label endm macro generate_composite_function
Definition: pixman-arm-neon-asm.h:600
Definition: pbuf.h:66