Chameleon

Chameleon Svn Source Tree

Root/branches/xZenu/src/include/arm/param.h

Source at commit 1270 created 12 years 8 months ago.
By meklort, Add arm headers. update makefiles
1/*
2 * Copyright (c) 2000-2007 Apple Inc. All rights reserved.
3 */
4/*-
5 * Copyright (c) 1990, 1993
6 *The Regents of the University of California. All rights reserved.
7 * (c) UNIX System Laboratories, Inc.
8 * All or some portions of this file are derived from material licensed
9 * to the University of California by American Telephone and Telegraph
10 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
11 * the permission of UNIX System Laboratories, Inc.
12 *
13 * Redistribution and use in source and binary forms, with or without
14 * modification, are permitted provided that the following conditions
15 * are met:
16 * 1. Redistributions of source code must retain the above copyright
17 * notice, this list of conditions and the following disclaimer.
18 * 2. Redistributions in binary form must reproduce the above copyright
19 * notice, this list of conditions and the following disclaimer in the
20 * documentation and/or other materials provided with the distribution.
21 * 3. All advertising materials mentioning features or use of this software
22 * must display the following acknowledgement:
23 *This product includes software developed by the University of
24 *California, Berkeley and its contributors.
25 * 4. Neither the name of the University nor the names of its contributors
26 * may be used to endorse or promote products derived from this software
27 * without specific prior written permission.
28 *
29 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
30 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
31 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
32 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
33 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
34 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
35 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
36 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
37 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
38 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
39 * SUCH DAMAGE.
40 *
41 *@(#)param.h8.1 (Berkeley) 4/4/95
42 */
43
44/*
45 * Machine dependent constants for ARM
46 */
47
48#ifndef _ARM_PARAM_H_
49#define _ARM_PARAM_H_
50
51/*
52 * Round p (pointer or byte index) up to a correctly-aligned value for all
53 * data types (int, long, ...). The result is unsigned int and must be
54 * cast to any desired pointer type.
55 */
56#defineALIGNBYTES3
57#defineALIGN(p)(((unsigned int)(p) + ALIGNBYTES) &~ ALIGNBYTES)
58
59#defineNBPG4096/* bytes/page */
60#definePGOFSET(NBPG-1)/* byte offset into page */
61#definePGSHIFT12/* LOG2(NBPG) */
62
63#defineDEV_BSIZE512
64#defineDEV_BSHIFT9/* log2(DEV_BSIZE) */
65#define BLKDEV_IOSIZE2048
66#defineMAXPHYS(64 * 1024)/* max raw I/O transfer size */
67
68#defineCLSIZE1
69#defineCLSIZELOG20
70
71/*
72 * Constants related to network buffer management.
73 * MCLBYTES must be no larger than CLBYTES (the software page size), and,
74 * on machines that exchange pages of input or output buffers with mbuf
75 * clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple
76 * of the hardware page size.
77 */
78#defineMSIZE256/* size of an mbuf */
79#defineMCLBYTES2048/* large enough for ether MTU */
80#defineMCLSHIFT11
81#defineMCLOFSET(MCLBYTES - 1)
82#ifndef NMBCLUSTERS
83#defineNMBCLUSTERSCONFIG_NMBCLUSTERS/* cl map size */
84#endif
85
86/*
87 * Some macros for units conversion
88 */
89/* Core clicks (NeXT_page_size bytes) to segments and vice versa */
90#definectos(x)(x)
91#definestoc(x)(x)
92
93/* Core clicks (4096 bytes) to disk blocks */
94#definectod(x)((x)<<(PGSHIFT-DEV_BSHIFT))
95#definedtoc(x)((x)>>(PGSHIFT-DEV_BSHIFT))
96#definedtob(x)((x)<<DEV_BSHIFT)
97
98/* clicks to bytes */
99#definectob(x)((x)<<PGSHIFT)
100
101/* bytes to clicks */
102#definebtoc(x)(((unsigned)(x)+(NBPG-1))>>PGSHIFT)
103
104#ifdef __APPLE__
105#define btodb(bytes, devBlockSize) \
106 ((unsigned)(bytes) / devBlockSize)
107#define dbtob(db, devBlockSize) \
108 ((unsigned)(db) * devBlockSize)
109#else
110#definebtodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \
111((unsigned)(bytes) >> DEV_BSHIFT)
112#definedbtob(db)/* calculates (db * DEV_BSIZE) */ \
113((unsigned)(db) << DEV_BSHIFT)
114#endif
115
116/*
117 * Map a ``block device block'' to a file system block.
118 * This should be device dependent, and will be if we
119 * add an entry to cdevsw/bdevsw for that purpose.
120 * For now though just use DEV_BSIZE.
121 */
122#definebdbtofsb(bn)((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))
123
124/*
125 * Macros to decode (and encode) processor status word.
126 */
127#define STATUS_WORD(rpl, ipl)(((ipl) << 8) | (rpl))
128#defineUSERMODE(x)(((x) & 3) == 3)
129#defineBASEPRI(x)(((x) & (255 << 8)) == 0)
130
131
132#ifdefined(KERNEL) || defined(STANDALONE)
133#defineDELAY(n) delay(n)
134
135#else/* defined(KERNEL) || defined(STANDALONE) */
136#defineDELAY(n){ register int N = (n); while (--N > 0); }
137#endif/* defined(KERNEL) || defined(STANDALONE) */
138
139#endif /* _ARM_PARAM_H_ */
140

Archive Download this file

Revision: 1270