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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [rtos/] [ecos-3.0/] [packages/] [net/] [tcpip/] [current/] [include/] [machine/] [param.h] - Blame information for rev 786

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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