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

Subversion Repositories openrisc

[/] [openrisc/] [tags/] [gnu-src/] [newlib-1.18.0/] [newlib-1.18.0-or32-1.0rc2/] [newlib/] [libc/] [sys/] [rtems/] [machine/] [param.h] - Blame information for rev 520

Details | Compare with Previous | View Log

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

powered by: WebSVN 2.1.0

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