1f9f848faSopenharmony_ci/*-
2f9f848faSopenharmony_ci * Copyright (c) 1982, 1986, 1989, 1993
3f9f848faSopenharmony_ci *    The Regents of the University of California.  All rights reserved.
4f9f848faSopenharmony_ci * (c) UNIX System Laboratories, Inc.
5f9f848faSopenharmony_ci *
6f9f848faSopenharmony_ci * All or some portions of this file are derived from material licensed
7f9f848faSopenharmony_ci * to the University of California by American Telephone and Telegraph
8f9f848faSopenharmony_ci * Co. or Unix System Laboratories, Inc. and are reproduced herein with
9f9f848faSopenharmony_ci * the permission of UNIX System Laboratories, Inc.
10f9f848faSopenharmony_ci *
11f9f848faSopenharmony_ci * Redistribution and use in source and binary forms, with or without
12f9f848faSopenharmony_ci * modification, are permitted provided that the following conditions
13f9f848faSopenharmony_ci * are met:
14f9f848faSopenharmony_ci * 1. Redistributions of source code must retain the above copyright
15f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer.
16f9f848faSopenharmony_ci * 2. Redistributions in binary form must reproduce the above copyright
17f9f848faSopenharmony_ci *    notice, this list of conditions and the following disclaimer in the
18f9f848faSopenharmony_ci *    documentation and/or other materials provided with the distribution.
19f9f848faSopenharmony_ci * 4. Neither the name of the University nor the names of its contributors
20f9f848faSopenharmony_ci *    may be used to endorse or promote products derived from this software
21f9f848faSopenharmony_ci *    without specific prior written permission.
22f9f848faSopenharmony_ci *
23f9f848faSopenharmony_ci * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
24f9f848faSopenharmony_ci * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
25f9f848faSopenharmony_ci * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
26f9f848faSopenharmony_ci * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
27f9f848faSopenharmony_ci * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
28f9f848faSopenharmony_ci * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
29f9f848faSopenharmony_ci * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
30f9f848faSopenharmony_ci * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
31f9f848faSopenharmony_ci * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
32f9f848faSopenharmony_ci * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
33f9f848faSopenharmony_ci * SUCH DAMAGE.
34f9f848faSopenharmony_ci *
35f9f848faSopenharmony_ci *    @(#)errno.h    8.5 (Berkeley) 1/21/94
36f9f848faSopenharmony_ci * $FreeBSD$
37f9f848faSopenharmony_ci */
38f9f848faSopenharmony_ci
39f9f848faSopenharmony_ci#ifndef _MACRO_REF_H
40f9f848faSopenharmony_ci#define	_MACRO_REF_H
41f9f848faSopenharmony_ci
42f9f848faSopenharmony_ci#define	FREAD		0x0001
43f9f848faSopenharmony_ci#define	FWRITE		0x0002
44f9f848faSopenharmony_ci
45f9f848faSopenharmony_ci/* pseudo-errors returned inside kernel to modify return to process */
46f9f848faSopenharmony_ci#define	EJUSTRETURN	(-2)		/* don't modify regs, just return */
47f9f848faSopenharmony_ci#define	ENOIOCTL	(-3)		/* ioctl not handled by this layer */
48f9f848faSopenharmony_ci#define	EDIRIOCTL	(-4)		/* do direct ioctl in GEOM */
49f9f848faSopenharmony_ci
50f9f848faSopenharmony_ci/* Ref usb_transfer.c */
51f9f848faSopenharmony_ci#define	WITNESS_WARN(flags, lock, fmt, ...)	(void)0
52f9f848faSopenharmony_ci
53f9f848faSopenharmony_ci#ifndef MIN
54f9f848faSopenharmony_ci#define MIN(a,b) (a < b ? a : b)
55f9f848faSopenharmony_ci#endif
56f9f848faSopenharmony_ci
57f9f848faSopenharmony_ci#ifndef MAX
58f9f848faSopenharmony_ci#define MAX(a,b) (a > b ? a : b)
59f9f848faSopenharmony_ci#endif
60f9f848faSopenharmony_ci
61f9f848faSopenharmony_ci#define	put_unaligned_be16(p, v)	do {*((UINT8*)(p)) = (v >> 8); *((UINT8*)(p + 1)) = (v);}while(0);
62f9f848faSopenharmony_ci#define	put_unaligned_be32(p, v)	do{put_unaligned_be16(p, (v >> 16)) ; put_unaligned_be16((p + 2), v);}while(0);
63f9f848faSopenharmony_ci
64f9f848faSopenharmony_ci#define	get_unaligned_be16(p)   (((UINT8*)p)[0] << 8 | ((UINT8*)p)[1])
65f9f848faSopenharmony_ci#define	get_unaligned_be32(p)   (((UINT8*)p)[0] << 24 | ((UINT8*)p)[1] << 16 |((UINT8*)p)[2] << 8 |((UINT8*)p)[3])
66f9f848faSopenharmony_ci
67f9f848faSopenharmony_ci#endif
68