diff options
author | Jeff Johnston <jjohnstn@redhat.com> | 2002-11-07 19:27:36 +0000 |
---|---|---|
committer | Jeff Johnston <jjohnstn@redhat.com> | 2002-11-07 19:27:36 +0000 |
commit | dd7ee147db24eaaa37f333fa93ce31efe949d9bf (patch) | |
tree | e9399790bc9dfd4304546acff76ea834b9e8c88d /newlib/libc/sys/rtems/machine/param.h | |
parent | 783747919d1180bbca4b29a3b3bea27633adae11 (diff) | |
download | cygnal-dd7ee147db24eaaa37f333fa93ce31efe949d9bf.tar.gz cygnal-dd7ee147db24eaaa37f333fa93ce31efe949d9bf.tar.bz2 cygnal-dd7ee147db24eaaa37f333fa93ce31efe949d9bf.zip |
2002-11-07 Joel Sherrill <joel@OARcorp.com>
* libc/sys/rtems/machine: New directory.
* libc/sys/rtems/machine/limits.h, libc/sys/rtems/machine/param.h,
libc/sys/rtems/sys/param.h, libc/sys/rtems/sys/syslimits.h,
libc/sys/rtems/sys/utime.h: New files added to make *-rtems newlib
targets more BSD like when installed without requiring files to
be overwritten at install point when RTEMS itself is installed.
* Makefile.am: Pick up system dependent machine .h files such as
might be found on a BSD-ish system.
* Makefile.in: Regenerate.
* libc/include/machine/types.h: When on an RTEMS target, define a
few BSD flavor types.
Diffstat (limited to 'newlib/libc/sys/rtems/machine/param.h')
-rw-r--r-- | newlib/libc/sys/rtems/machine/param.h | 92 |
1 files changed, 92 insertions, 0 deletions
diff --git a/newlib/libc/sys/rtems/machine/param.h b/newlib/libc/sys/rtems/machine/param.h new file mode 100644 index 000000000..4168f1f6c --- /dev/null +++ b/newlib/libc/sys/rtems/machine/param.h @@ -0,0 +1,92 @@ +/* + * $Id$ + */ + +#ifndef _MACHINE_PARAM_H_ +#define _MACHINE_PARAM_H_ + +/* + * These aren't really machine-dependent for RTEMS..... + */ + +/* +#define MACHINE "i386" +#define MID_MACHINE MID_I386 +*/ + +/* + * 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 (sizeof(int) - 1) +#define ALIGN(p) (((unsigned)(p) + ALIGNBYTES) & ~ALIGNBYTES) + +#define PAGE_SHIFT 12 /* LOG2(PAGE_SIZE) */ +#define PAGE_SIZE (1<<PAGE_SHIFT) /* bytes/page */ +#define PAGE_MASK (PAGE_SIZE-1) +#define NPTEPG (PAGE_SIZE/(sizeof (pt_entry_t))) + +#define NPDEPG (PAGE_SIZE/(sizeof (pd_entry_t))) +#define PDRSHIFT 22 /* LOG2(NBPDR) */ +#define NBPDR (1<<PDRSHIFT) /* bytes/page dir */ + +#define DEV_BSHIFT 9 /* log2(DEV_BSIZE) */ +#define DEV_BSIZE (1<<DEV_BSHIFT) + +#define BLKDEV_IOSIZE 2048 +#define MAXPHYS (64 * 1024) /* max raw I/O transfer size */ + +#define UPAGES 2 /* pages of u-area */ + +/* + * 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. + */ +#ifndef MSIZE +#define MSIZE 128 /* size of an mbuf */ +#endif /* MSIZE */ + +#ifndef MCLSHIFT +#define MCLSHIFT 11 /* convert bytes to m_buf clusters */ +#endif /* MCLSHIFT */ +#define MCLBYTES (1 << MCLSHIFT) /* size of an m_buf cluster */ +#define MCLOFSET (MCLBYTES - 1) /* offset within an m_buf cluster */ + +/* + * Some macros for units conversion + */ + +/* clicks to bytes */ +#define ctob(x) ((x)<<PAGE_SHIFT) + +/* bytes to clicks */ +#define btoc(x) (((unsigned)(x)+PAGE_MASK)>>PAGE_SHIFT) + +/* + * btodb() is messy and perhaps slow because `bytes' may be an off_t. We + * want to shift an unsigned type to avoid sign extension and we don't + * want to widen `bytes' unnecessarily. Assume that the result fits in + * a daddr_t. + */ +#define btodb(bytes) /* calculates (bytes / DEV_BSIZE) */ \ + (sizeof (bytes) > sizeof(long) \ + ? (daddr_t)((unsigned long long)(bytes) >> DEV_BSHIFT) \ + : (daddr_t)((unsigned long)(bytes) >> DEV_BSHIFT)) + +#define dbtob(db) /* calculates (db * DEV_BSIZE) */ \ + ((off_t)(db) << DEV_BSHIFT) + +/* + * Mach derived conversion macros + */ +#define trunc_page(x) ((unsigned)(x) & ~PAGE_MASK) +#define round_page(x) ((((unsigned)(x)) + PAGE_MASK) & ~PAGE_MASK) + +#define atop(x) ((unsigned)(x) >> PAGE_SHIFT) +#define ptoa(x) ((unsigned)(x) << PAGE_SHIFT) + +#endif /* !_MACHINE_PARAM_H_ */ |