OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-2.0/] [packages/] [net/] [tcpip/] [v2_0/] [include/] [machine/] [param.h] - Blame information for rev 510

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 27 unneback
//==========================================================================
2
//
3
//      include/machine/param.h
4
//
5
//      Architecture/platform specific parameters
6
//
7
//==========================================================================
8
//####BSDCOPYRIGHTBEGIN####
9
//
10
// -------------------------------------------
11
//
12
// Portions of this software may have been derived from OpenBSD or other sources,
13
// and are covered by the appropriate copyright disclaimers included herein.
14
//
15
// -------------------------------------------
16
//
17
//####BSDCOPYRIGHTEND####
18
//==========================================================================
19
//#####DESCRIPTIONBEGIN####
20
//
21
// Author(s):    gthomas
22
// Contributors: gthomas
23
// Date:         2000-01-10
24
// Purpose:      
25
// Description:  
26
//              
27
//
28
//####DESCRIPTIONEND####
29
//
30
//==========================================================================
31
 
32
 
33
#ifndef _MACHINE_PARAM_H_
34
#define _MACHINE_PARAM_H_
35
 
36
#include <pkgconf/net.h>
37
 
38
/*
39
 * Constants related to network buffer management.
40
 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
41
 * on machines that exchange pages of input or output buffers with mbuf
42
 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
43
 * of the hardware page size.
44
 */
45
#define MSIZE           128             /* size of an mbuf */
46
#define MCLSHIFT        11              /* convert bytes to m_buf clusters */
47
#define MCLBYTES        (1 << MCLSHIFT) /* size of a m_buf cluster */
48
#define MCLOFSET        (MCLBYTES - 1)  /* offset within a m_buf cluster */
49
#define CLBYTES         4096            /* size of actual cluster */
50
 
51
/*
52
 * Round p (pointer or byte index) up to a correctly-aligned value
53
 * for all data types (int, long, ...).   The result is u_int and
54
 * must be cast to any desired pointer type.
55
 */
56
#define ALIGNBYTES      (sizeof(int) - 1)
57
#define ALIGN(p)        (((u_int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
58
 
59
// These symbols are used in the IPV6 stuff
60
// (be more defensive about external setup)
61
#ifdef __linux__
62
#undef __linux__
63
#endif
64
#ifdef __bsdi__
65
#undef __bsdi__
66
#endif
67
#ifdef __FreeBSD__
68
#undef __FreeBSD__
69
#endif
70
#ifdef __OpenBSD__
71
#undef __OpenBSD__
72
#endif
73
#ifdef __NetBSD__
74
#undef __NetBSD__
75
#endif
76
 
77
 
78
#define __linux__   0
79
#define __bsdi__    0
80
#define __FreeBSD__ 0
81
#define __OpenBSD__ 1
82
#define __NetBSD__  0
83
 
84
// These definitions here to avoid needing <sys/systm.h>
85
// This probably doesn't belong here, but we need these definitions
86
#include <lib/libkern/libkern.h>
87
#define SCARG(p,k)      ((p)->k.datum)  /* get arg from args pointer */
88
#include <stdarg.h>
89
 
90
// TEMP
91
 
92
#include <cyg/infra/diag.h>
93
#include <cyg/hal/hal_intr.h>
94
#include <cyg/kernel/kapi.h>
95
#include <cyg/io/file.h>
96
 
97
struct net_stats {
98
    int              count;
99
    cyg_uint32       min_time, max_time, total_time;
100
};
101
 
102
#ifdef CYGDBG_NET_TIMING_STATS
103
#define START_STATS()                                   \
104
    cyg_uint32 start_time, end_time, elapsed_time;      \
105
    HAL_CLOCK_READ(&start_time);
106
#define FINISH_STATS(stats)                                                             \
107
    HAL_CLOCK_READ(&end_time);                                                          \
108
    if (end_time < start_time) {                                                        \
109
        elapsed_time = (end_time+CYGNUM_KERNEL_COUNTERS_RTC_PERIOD) - start_time;       \
110
    } else {                                                                            \
111
        elapsed_time = end_time - start_time;                                           \
112
    }                                                                                   \
113
    if (stats.min_time == 0) {                                                          \
114
        stats.min_time = 0x7FFFFFFF;                                                    \
115
    }                                                                                   \
116
    if (elapsed_time < stats.min_time)                                                  \
117
        stats.min_time = elapsed_time;                                                  \
118
    if (elapsed_time > stats.max_time)                                                  \
119
        stats.max_time = elapsed_time;                                                  \
120
    stats.total_time += elapsed_time;                                                   \
121
    stats.count++;
122
#else
123
#define START_STATS() 
124
#define FINISH_STATS(X)
125
#endif
126
 
127
// timeout support
128
typedef void (timeout_fun)(void *);
129
extern cyg_uint32 timeout(timeout_fun *fun, void *arg, cyg_int32 delta);
130
extern void untimeout(timeout_fun *fun, void *arg);
131
extern int uiomove(caddr_t cp, int n, struct uio *uio);
132
extern int copyout(const void *s, void *d, size_t len);
133
extern int copyin(const void *s, void *d, size_t len);
134
extern void ovbcopy(const void *s, void *d, size_t len);
135
extern void get_mono_time(void);
136
extern int arc4random(void);
137
extern void get_random_bytes(void *buf, size_t len);
138
 
139
extern void *hashinit(int elements, int type, int flags, u_long *hashmask);
140
 
141
#endif // _MACHINE_PARAM_H_

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.