source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h @ cd9564e

4.104.114.84.95
Last change on this file since cd9564e was cd9564e, checked in by Ralf Corsepius <ralf.corsepius@…>, on 05/10/07 at 07:29:14

Include <rtems/bsd/sys/cdefs.h> instead of <sys/cdefs.h>.

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