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