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

Subversion Repositories openrisc_me

[/] [openrisc/] [trunk/] [rtos/] [rtems/] [c/] [src/] [libnetworking/] [machine/] [param.h] - Blame information for rev 173

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 30 unneback
/*
2
 *  $Id: param.h,v 1.2 2001-09-27 12:01:53 chris Exp $
3
 */
4
 
5
#ifndef _MACHINE_PARAM_H_
6
#define _MACHINE_PARAM_H_
7
 
8
/*
9
 * These aren't really machine-dependent for RTEMS.....
10
 */
11
 
12
/*
13
#define MACHINE         "i386"
14
#define MID_MACHINE     MID_I386
15
*/
16
 
17
/*
18
 * Round p (pointer or byte index) up to a correctly-aligned value
19
 * for all data types (int, long, ...).   The result is unsigned int
20
 * and must be cast to any desired pointer type.
21
 */
22
#define ALIGNBYTES      (sizeof(int) - 1)
23
#define ALIGN(p)        (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES)
24
 
25
#define PAGE_SHIFT      12              /* LOG2(PAGE_SIZE) */
26
#define PAGE_SIZE       (1<<PAGE_SHIFT) /* bytes/page */
27
#define PAGE_MASK       (PAGE_SIZE-1)
28
#define NPTEPG          (PAGE_SIZE/(sizeof (pt_entry_t)))
29
 
30
#define NPDEPG          (PAGE_SIZE/(sizeof (pd_entry_t)))
31
#define PDRSHIFT        22              /* LOG2(NBPDR) */
32
#define NBPDR           (1<<PDRSHIFT)   /* bytes/page dir */
33
 
34
#define DEV_BSHIFT      9               /* log2(DEV_BSIZE) */
35
#define DEV_BSIZE       (1<<DEV_BSHIFT)
36
 
37
#define BLKDEV_IOSIZE   2048
38
#define MAXPHYS         (64 * 1024)     /* max raw I/O transfer size */
39
 
40
#define UPAGES  2               /* pages of u-area */
41
 
42
/*
43
 * Constants related to network buffer management.
44
 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
45
 * on machines that exchange pages of input or output buffers with mbuf
46
 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
47
 * of the hardware page size.
48
 */
49
#ifndef MSIZE
50
#define MSIZE           128             /* size of an mbuf */
51
#endif  /* MSIZE */
52
 
53
#ifndef MCLSHIFT
54
#define MCLSHIFT        11              /* convert bytes to m_buf clusters */
55
#endif  /* MCLSHIFT */
56
#define MCLBYTES        (1 << MCLSHIFT) /* size of an m_buf cluster */
57
#define MCLOFSET        (MCLBYTES - 1)  /* offset within an m_buf cluster */
58
 
59
/*
60
 * Some macros for units conversion
61
 */
62
 
63
/* clicks to bytes */
64
#define ctob(x) ((x)<<PAGE_SHIFT)
65
 
66
/* bytes to clicks */
67
#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
68
 
69
/*
70
 * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
71
 * want to shift an unsigned type to avoid sign extension and we don't
72
 * want to widen `bytes' unnecessarily.  Assume that the result fits in
73
 * a daddr_t.
74
 */
75
#define btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
76
        (sizeof (bytes) > sizeof(long) \
77
         ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
78
         : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
79
 
80
#define dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
81
        ((off_t)(db) << DEV_BSHIFT)
82
 
83
/*
84
 * Mach derived conversion macros
85
 */
86
#define trunc_page(x)           ((unsigned)(x) & ~PAGE_MASK)
87
#define round_page(x)           ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
88
 
89
#define atop(x)                 ((unsigned)(x) >> PAGE_SHIFT)
90
#define ptoa(x)                 ((unsigned)(x) << PAGE_SHIFT)
91
 
92
#endif /* !_MACHINE_PARAM_H_ */

powered by: WebSVN 2.1.0

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