source: rtems/cpukit/libnetworking/rtems/rtems_bsdnet_internal.h @ 1edaa5f

4.115
Last change on this file since 1edaa5f was 1edaa5f, checked in by Sebastian Huber <sebastian.huber@…>, on 12/14/12 at 11:01:47

libnetworking: Make functions public

Make functions rtems_bsdnet_semaphore_obtain_recursive() and
rtems_bsdnet_semaphore_release_recursive() public.

  • Property mode set to 100644
File size: 5.6 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
10#ifndef _RTEMS_RTEMS_BSDNET_INTERNAL_H
11#define _RTEMS_RTEMS_BSDNET_INTERNAL_H
12
13#include <rtems.h>
14#include <rtems/fs.h>
15
16#ifdef __cplusplus
17extern "C" {
18#endif
19
20typedef unsigned int            vm_offset_t;
21typedef long long               vm_ooffset_t;
22typedef unsigned int            vm_pindex_t;
23typedef unsigned int            vm_size_t;
24
25#define _BSD_OFF_T_     int32_t
26#define _BSD_PID_T_     rtems_id
27#define _BSD_VA_LIST_   char *
28
29/* make sure we get the network versions of these */
30#include <machine/types.h>
31#include <machine/param.h>
32#include <sys/cdefs.h>
33
34#include <sys/time.h>
35#include <sys/ioctl.h>
36
37struct mdproc {
38        int     md_flags;
39        int     *md_regs;
40};
41
42/*
43 * Other RTEMS/BSD glue
44 */
45struct socket;
46extern int soconnsleep (struct socket *so);
47extern void soconnwakeup (struct socket *so);
48#define splnet()        0
49#define splimp()        0
50#define splx(_s)        do { (_s) = 0; (void) (_s); } while(0)
51
52/* to avoid warnings */
53void *memcpy(void *dest, const void *src, size_t n);
54void *memset(void *s, int c, size_t n);
55
56#define ovbcopy(f,t,n) bcopy(f,t,n)
57#define copyout(f,t,n) (memcpy(t,f,n),0)
58#define copyin(f,t,n) (memcpy(t,f,n),0)
59
60#define random()        rtems_bsdnet_random()
61#define panic   rtems_panic
62#define suser(a,b)      0
63
64static inline void microtime(struct timeval *tv)
65{
66  rtems_clock_get_uptime_timeval(tv);
67}
68
69#define hz rtems_bsdnet_ticks_per_second
70#define tick rtems_bsdnet_microseconds_per_tick
71
72#define log     rtems_bsdnet_log
73
74/*
75 * Since we can't have two sys/types.h files, we'll hack around
76 * and copy the contents of the BSD sys/types.h to here....
77 */
78
79typedef u_int64_t       u_quad_t;       /* quads */
80typedef int64_t         quad_t;
81typedef quad_t *        qaddr_t;
82
83typedef void __sighandler_t(int);
84typedef __sighandler_t  *sig_t; /* type of pointer to a signal function */
85#define NSIG    32
86struct  sigaltstack {
87        char    *ss_sp;                 /* signal stack base */
88        int     ss_size;                /* signal stack length */
89        int     ss_flags;               /* SS_DISABLE and/or SS_ONSTACK */
90};
91
92#ifdef _KERNEL
93typedef int             boolean_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  buf;
122struct  tty;
123struct  uio;
124struct  rtems_bsdnet_ifconfig;
125
126/*
127 * Redo kernel memory allocation
128 */
129#define malloc(size,type,flags) rtems_bsdnet_malloc(size,type,flags)
130#define free(ptr,type) rtems_bsdnet_free(ptr,type)
131#define timeout(ftn,arg,ticks) rtems_bsdnet_timeout(ftn,arg,ticks)
132
133#define M_NOWAIT        0x0001
134void *rtems_bsdnet_malloc (size_t size, int type, int flags);
135void rtems_bsdnet_free (void *addr, int type);
136
137void rtems_bsdnet_semaphore_obtain (void);
138void rtems_bsdnet_semaphore_release (void);
139void rtems_bsdnet_semaphore_obtain_recursive (uint32_t nest_count);
140uint32_t rtems_bsdnet_semaphore_release_recursive (void);
141void rtems_bsdnet_schednetisr (int n);
142int rtems_bsdnet_parse_driver_name (const struct rtems_bsdnet_ifconfig *config, char **namep);
143
144static inline unsigned long rtems_bsdnet_seconds_since_boot(void)
145{
146  return (unsigned long) rtems_clock_get_uptime_seconds() + 1UL;
147}
148
149unsigned long rtems_bsdnet_random (void);
150
151rtems_id rtems_bsdnet_newproc (
152  char  *name,
153  int   stacksize,
154  void  (*entry)(void *),
155  void  *arg
156);
157
158rtems_status_code rtems_bsdnet_event_receive (
159  rtems_event_set  event_in,
160  rtems_option     option_set,
161  rtems_interval   ticks,
162  rtems_event_set *event_out
163);
164
165static inline rtems_status_code rtems_bsdnet_event_send (
166  rtems_id        task_id,
167  rtems_event_set event_in
168)
169{
170  return rtems_event_system_send (task_id, event_in);
171}
172
173/*
174 * Network configuration
175 */
176extern int rtems_bsdnet_ticks_per_second;
177extern int rtems_bsdnet_microseconds_per_tick;
178extern struct in_addr rtems_bsdnet_log_host_address;
179extern char *rtems_bsdnet_domain_name;
180
181/*
182 * Internal IOCTL command
183 */
184#define SIO_RTEMS_SHOW_STATS    _IO('i', 250)
185
186/*
187 * Some extra prototypes
188 */
189int sethostname (char *name, size_t namelen);
190void domaininit (void *);
191void ifinit (void *);
192void ipintr (void);
193void arpintr (void);
194int socket (int, int, int);
195int ioctl (int, ioctl_command_t, ...);
196
197/*
198 * Events used by networking routines.
199 * Everything will break if the application
200 * tries to use these events or if the `sleep'
201 * events are equal to any of the NETISR * events.
202 */
203#define SBWAIT_EVENT   RTEMS_EVENT_SYSTEM_NETWORK_SBWAIT
204#define SOSLEEP_EVENT  RTEMS_EVENT_SYSTEM_NETWORK_SOSLEEP
205#define NETISR_IP_EVENT        (1L << NETISR_IP)
206#define NETISR_ARP_EVENT       (1L << NETISR_ARP)
207#define NETISR_EVENTS  (NETISR_IP_EVENT|NETISR_ARP_EVENT)
208#if (SBWAIT_EVENT & SOSLEEP_EVENT & NETISR_EVENTS)
209# error "Network event conflict"
210#endif
211
212struct socket *rtems_bsdnet_fdToSocket(int fd);
213
214#ifdef __cplusplus
215}
216#endif
217
218#endif /* _RTEMS_RTEMS_BSDNET_INTERNAL_H */
Note: See TracBrowser for help on using the repository browser.