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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-old/] [newlib-1.17.0/] [newlib/] [libc/] [sys/] [rtems/] [machine/] [param.h] - Blame information for rev 855

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

Line No. Rev Author Line
1 148 jeremybenn
/*
2
 *  $Id: param.h 148 2010-06-30 19:21:22Z jeremybennett $
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
#if defined(__AVR__) || defined(__h8300__)
38
#define BLKDEV_IOSIZE   1024
39
#define MAXPHYS         (1 * 1024)      /* max raw I/O transfer size */
40
#else
41
#define BLKDEV_IOSIZE   2048
42
#define MAXPHYS         (64 * 1024)     /* max raw I/O transfer size */
43
#endif
44
 
45
#define UPAGES  2               /* pages of u-area */
46
 
47
/*
48
 * Constants related to network buffer management.
49
 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
50
 * on machines that exchange pages of input or output buffers with mbuf
51
 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
52
 * of the hardware page size.
53
 */
54
#ifndef MSIZE
55
#define MSIZE           128             /* size of an mbuf */
56
#endif  /* MSIZE */
57
 
58
#ifndef MCLSHIFT
59
#define MCLSHIFT        11              /* convert bytes to m_buf clusters */
60
#endif  /* MCLSHIFT */
61
#define MCLBYTES        (1 << MCLSHIFT) /* size of an m_buf cluster */
62
#define MCLOFSET        (MCLBYTES - 1)  /* offset within an m_buf cluster */
63
 
64
/*
65
 * Some macros for units conversion
66
 */
67
 
68
/* clicks to bytes */
69
#define ctob(x) ((x)<<PAGE_SHIFT)
70
 
71
/* bytes to clicks */
72
#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT)
73
 
74
/*
75
 * btodb() is messy and perhaps slow because `bytes' may be an off_t.  We
76
 * want to shift an unsigned type to avoid sign extension and we don't
77
 * want to widen `bytes' unnecessarily.  Assume that the result fits in
78
 * a daddr_t.
79
 */
80
#define btodb(bytes)                    /* calculates (bytes / DEV_BSIZE) */ \
81
        (sizeof (bytes) > sizeof(long) \
82
         ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \
83
         : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT))
84
 
85
#define dbtob(db)                       /* calculates (db * DEV_BSIZE) */ \
86
        ((off_t)(db) << DEV_BSHIFT)
87
 
88
/*
89
 * Mach derived conversion macros
90
 */
91
#define trunc_page(x)           ((unsigned)(x) & ~PAGE_MASK)
92
#define round_page(x)           ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK)
93
 
94
#define atop(x)                 ((unsigned)(x) >> PAGE_SHIFT)
95
#define ptoa(x)                 ((unsigned)(x) << PAGE_SHIFT)
96
 
97
#endif /* !_MACHINE_PARAM_H_ */

powered by: WebSVN 2.1.0

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