1 | /* |
---|
2 | * Declarations to fit FreeBSD to RTEMS. |
---|
3 | * |
---|
4 | ******************************************************************* |
---|
5 | * WARNING * |
---|
6 | * This file should *never* be included by any application program * |
---|
7 | ******************************************************************* |
---|
8 | * |
---|
9 | * $Id$ |
---|
10 | */ |
---|
11 | |
---|
12 | #ifndef _RTEMS_RTEMS_BSDNET_INTERNAL_H |
---|
13 | #define _RTEMS_RTEMS_BSDNET_INTERNAL_H |
---|
14 | |
---|
15 | #ifdef __cplusplus |
---|
16 | extern "C" { |
---|
17 | #endif |
---|
18 | |
---|
19 | #include <rtems.h> |
---|
20 | |
---|
21 | typedef unsigned int vm_offset_t; |
---|
22 | typedef long long vm_ooffset_t; |
---|
23 | typedef unsigned int vm_pindex_t; |
---|
24 | typedef unsigned int vm_size_t; |
---|
25 | |
---|
26 | #ifndef __ioctl_command_defined |
---|
27 | typedef u_int32_t ioctl_command_t; |
---|
28 | #define __ioctl_command_defined |
---|
29 | #endif |
---|
30 | |
---|
31 | |
---|
32 | #define _BSD_OFF_T_ int32_t |
---|
33 | #define _BSD_PID_T_ rtems_id |
---|
34 | #define _BSD_VA_LIST_ char * |
---|
35 | |
---|
36 | /* make sure we get the network versions of these */ |
---|
37 | #include <machine/types.h> |
---|
38 | #include <machine/param.h> |
---|
39 | #include <rtems/bsd/sys/cdefs.h> |
---|
40 | |
---|
41 | #include <sys/time.h> |
---|
42 | |
---|
43 | struct mdproc { |
---|
44 | int md_flags; |
---|
45 | int *md_regs; |
---|
46 | }; |
---|
47 | |
---|
48 | /* |
---|
49 | * Other RTEMS/BSD glue |
---|
50 | */ |
---|
51 | struct socket; |
---|
52 | extern int soconnsleep (struct socket *so); |
---|
53 | extern void soconnwakeup (struct socket *so); |
---|
54 | #define splnet() 0 |
---|
55 | #define splimp() 0 |
---|
56 | #define splx(_s) do { (_s) = 0; } while(0) |
---|
57 | |
---|
58 | /* to avoid warnings */ |
---|
59 | void *memcpy(void *dest, const void *src, size_t n); |
---|
60 | void *memset(void *s, int c, size_t n); |
---|
61 | |
---|
62 | #define ovbcopy(f,t,n) bcopy(f,t,n) |
---|
63 | #define copyout(f,t,n) (memcpy(t,f,n),0) |
---|
64 | #define copyin(f,t,n) (memcpy(t,f,n),0) |
---|
65 | |
---|
66 | #define random() rtems_bsdnet_random() |
---|
67 | #define panic rtems_panic |
---|
68 | #define suser(a,b) 0 |
---|
69 | |
---|
70 | void microtime (struct timeval *tv); |
---|
71 | #define hz rtems_bsdnet_ticks_per_second |
---|
72 | #define tick rtems_bsdnet_microseconds_per_tick |
---|
73 | |
---|
74 | #define log rtems_bsdnet_log |
---|
75 | |
---|
76 | /* |
---|
77 | * Since we can't have two sys/types.h files, we'll hack around |
---|
78 | * and copy the contents of the BSD sys/types.h to here.... |
---|
79 | */ |
---|
80 | |
---|
81 | typedef u_int64_t u_quad_t; /* quads */ |
---|
82 | typedef int64_t quad_t; |
---|
83 | typedef quad_t * qaddr_t; |
---|
84 | |
---|
85 | typedef void __sighandler_t(int); |
---|
86 | typedef __sighandler_t *sig_t; /* type of pointer to a signal function */ |
---|
87 | #define NSIG 32 |
---|
88 | struct sigaltstack { |
---|
89 | char *ss_sp; /* signal stack base */ |
---|
90 | int ss_size; /* signal stack length */ |
---|
91 | int ss_flags; /* SS_DISABLE and/or SS_ONSTACK */ |
---|
92 | }; |
---|
93 | |
---|
94 | #ifdef _KERNEL |
---|
95 | typedef int boolean_t; |
---|
96 | typedef struct vm_page *vm_page_t; |
---|
97 | #endif |
---|
98 | |
---|
99 | #ifndef _POSIX_SOURCE |
---|
100 | /* |
---|
101 | * minor() gives a cookie instead of an index since we don't want to |
---|
102 | * change the meanings of bits 0-15 or waste time and space shifting |
---|
103 | * bits 16-31 for devices that don't use them. |
---|
104 | */ |
---|
105 | #define major(x) ((int)(((u_int)(x) >> 8)&0xff)) /* major number */ |
---|
106 | #define minor(x) ((int)((x)&0xffff00ff)) /* minor number */ |
---|
107 | #define makedev(x,y) ((dev_t)(((x) << 8) | (y))) /* create dev_t */ |
---|
108 | #endif |
---|
109 | |
---|
110 | #include <rtems/endian.h> |
---|
111 | |
---|
112 | typedef quad_t rlim_t; /* resource limit */ |
---|
113 | typedef u_int32_t fixpt_t; /* fixed point number */ |
---|
114 | |
---|
115 | /* |
---|
116 | * Forward structure declarations for function prototypes. We include the |
---|
117 | * common structures that cross subsystem boundaries here; others are mostly |
---|
118 | * used in the same place that the structure is defined. |
---|
119 | */ |
---|
120 | struct proc; |
---|
121 | struct pgrp; |
---|
122 | struct ucred; |
---|
123 | struct rusage; |
---|
124 | struct file; |
---|
125 | struct buf; |
---|
126 | struct tty; |
---|
127 | struct uio; |
---|
128 | struct rtems_bsdnet_ifconfig; |
---|
129 | |
---|
130 | /* |
---|
131 | * Redo kernel memory allocation |
---|
132 | */ |
---|
133 | #define malloc(size,type,flags) rtems_bsdnet_malloc(size,type,flags) |
---|
134 | #define free(ptr,type) rtems_bsdnet_free(ptr,type) |
---|
135 | #define timeout(ftn,arg,ticks) rtems_bsdnet_timeout(ftn,arg,ticks) |
---|
136 | |
---|
137 | #define M_NOWAIT 0x0001 |
---|
138 | void *rtems_bsdnet_malloc (size_t size, int type, int flags); |
---|
139 | void rtems_bsdnet_free (void *addr, int type); |
---|
140 | |
---|
141 | void rtems_bsdnet_semaphore_obtain (void); |
---|
142 | void rtems_bsdnet_semaphore_release (void); |
---|
143 | void rtems_bsdnet_schednetisr (int n); |
---|
144 | int rtems_bsdnet_parse_driver_name (const struct rtems_bsdnet_ifconfig *config, char **namep); |
---|
145 | |
---|
146 | unsigned long rtems_bsdnet_seconds_since_boot (void); |
---|
147 | unsigned long rtems_bsdnet_random (void); |
---|
148 | |
---|
149 | rtems_id rtems_bsdnet_newproc ( |
---|
150 | char *name, |
---|
151 | int stacksize, |
---|
152 | void (*entry)(void *), |
---|
153 | void *arg |
---|
154 | ); |
---|
155 | |
---|
156 | rtems_status_code rtems_bsdnet_event_receive ( |
---|
157 | rtems_event_set event_in, |
---|
158 | rtems_option option_set, |
---|
159 | rtems_interval ticks, |
---|
160 | rtems_event_set *event_out |
---|
161 | ); |
---|
162 | |
---|
163 | /* |
---|
164 | * Network configuration |
---|
165 | */ |
---|
166 | extern int rtems_bsdnet_ticks_per_second; |
---|
167 | extern int rtems_bsdnet_microseconds_per_tick; |
---|
168 | extern struct in_addr rtems_bsdnet_log_host_address; |
---|
169 | extern char *rtems_bsdnet_domain_name; |
---|
170 | |
---|
171 | /* |
---|
172 | * Internal IOCTL command |
---|
173 | */ |
---|
174 | #define SIO_RTEMS_SHOW_STATS _IO('i', 250) |
---|
175 | |
---|
176 | /* |
---|
177 | * Some extra prototypes |
---|
178 | */ |
---|
179 | int sethostname (char *name, size_t namelen); |
---|
180 | void domaininit (void *); |
---|
181 | void ifinit (void *); |
---|
182 | void ipintr (void); |
---|
183 | void arpintr (void); |
---|
184 | void bootpc_init(int ); |
---|
185 | int socket (int, int, int); |
---|
186 | int ioctl (int, ioctl_command_t, ...); |
---|
187 | |
---|
188 | /* |
---|
189 | * Events used by networking routines. |
---|
190 | * Everything will break if the application |
---|
191 | * tries to use these events or if the `sleep' |
---|
192 | * events are equal to any of the NETISR * events. |
---|
193 | */ |
---|
194 | #define SBWAIT_EVENT RTEMS_EVENT_24 |
---|
195 | #define SOSLEEP_EVENT RTEMS_EVENT_25 |
---|
196 | #define NETISR_IP_EVENT (1L << NETISR_IP) |
---|
197 | #define NETISR_ARP_EVENT (1L << NETISR_ARP) |
---|
198 | #define NETISR_EVENTS (NETISR_IP_EVENT|NETISR_ARP_EVENT) |
---|
199 | #if (SBWAIT_EVENT & SOSLEEP_EVENT & NETISR_EVENTS) |
---|
200 | # error "Network event conflict" |
---|
201 | #endif |
---|
202 | |
---|
203 | #ifdef __cplusplus |
---|
204 | } |
---|
205 | #endif |
---|
206 | |
---|
207 | #endif /* _RTEMS_RTEMS_BSDNET_INTERNAL_H */ |
---|