#include <arm/param.h>

arm/param.h Kernel.framework

Machine dependent constants for ARM
includes: arm/_param.h
35 macros

macroALIGNBYTES

Round p (pointer or byte index) up to a correctly-aligned value for all data types (int, long, ...). The result is unsigned int and must be cast to any desired pointer type.
#define ALIGNBYTES __DARWIN_ALIGNBYTES

macroALIGN

#define ALIGN(p) __DARWIN_ALIGN(p)

macroNBPG

#define NBPG 4096
bytes/page

macroPGOFSET

#define PGOFSET (NBPG-1)
byte offset into page

macroPGSHIFT

#define PGSHIFT 12
LOG2(NBPG)

macroDEV_BSIZE

#define DEV_BSIZE 512

macroDEV_BSHIFT

#define DEV_BSHIFT 9
log2(DEV_BSIZE)

macroBLKDEV_IOSIZE

#define BLKDEV_IOSIZE 2048

macroMAXPHYS

#define MAXPHYS (64 * 1024)
max raw I/O transfer size

macroCLSIZE

#define CLSIZE 1

macroCLSIZELOG2

#define CLSIZELOG2 0

macroMSIZESHIFT

Constants related to network buffer management. MCLBYTES must be no larger than CLBYTES (the software page size), and, on machines that exchange pages of input or output buffers with mbuf clusters (MAPPED_MBUFS), MCLBYTES must also be an integral multiple of the hardware page size.
#define MSIZESHIFT 8
256

macroMSIZE

#define MSIZE (1 << MSIZESHIFT)
size of an mbuf

macroMCLSHIFT

#define MCLSHIFT 11
2048

macroMCLBYTES

#define MCLBYTES (1 << MCLSHIFT)
size of an mbuf cluster

macroMBIGCLSHIFT

#define MBIGCLSHIFT 12
4096

macroMBIGCLBYTES

#define MBIGCLBYTES (1 << MBIGCLSHIFT)
size of a big cluster

macroM16KCLSHIFT

#define M16KCLSHIFT 14
16384

macroM16KCLBYTES

#define M16KCLBYTES (1 << M16KCLSHIFT)
size of a jumbo cluster

macroMCLOFSET

#define MCLOFSET (MCLBYTES - 1)

macroNMBCLUSTERS

#define NMBCLUSTERS CONFIG_NMBCLUSTERS
cl map size

macroctos

Some macros for units conversion Core clicks (NeXT_page_size bytes) to segments and vice versa
#define ctos(x) (x)

macrostoc

#define stoc(x) (x)

macroctod

Core clicks (4096 bytes) to disk blocks
#define ctod(x) ((x)<<(PGSHIFT-DEV_BSHIFT))

macrodtoc

#define dtoc(x) ((x)>>(PGSHIFT-DEV_BSHIFT))

macrodtob

#define dtob(x) ((x)<<DEV_BSHIFT)

macroctob

clicks to bytes
#define ctob(x) ((x)<<PGSHIFT)

macrobtoc

bytes to clicks
#define btoc(x) (((unsigned)(x)+(NBPG-1))>>PGSHIFT)

macrobtodb

#define btodb(bytes, devBlockSize) ((unsigned)(bytes) / devBlockSize)

macrodbtob

#define dbtob(db, devBlockSize) ((unsigned)(db) * devBlockSize)

macrobdbtofsb

Map a ``block device block'' to a file system block. This should be device dependent, and will be if we add an entry to cdevsw/bdevsw for that purpose. For now though just use DEV_BSIZE.
#define bdbtofsb(bn) ((bn) / (BLKDEV_IOSIZE/DEV_BSIZE))

macroSTATUS_WORD

Macros to decode (and encode) processor status word.
#define STATUS_WORD(rpl, ipl) (((ipl) << 8) | (rpl))

macroUSERMODE

#define USERMODE(x) (((x) & 3) == 3)

macroBASEPRI

#define BASEPRI(x) (((x) & (255 << 8)) == 0)

macroDELAY

#define DELAY(n) delay(n)