/*1* aQuantia Corporation Network Driver2* Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved3*4* Redistribution and use in source and binary forms, with or without5* modification, are permitted provided that the following conditions6* are met:7*8* (1) Redistributions of source code must retain the above9* copyright notice, this list of conditions and the following10* disclaimer.11*12* (2) Redistributions in binary form must reproduce the above13* copyright notice, this list of conditions and the following14* disclaimer in the documentation and/or other materials provided15* with the distribution.16*17* (3)The name of the author may not be used to endorse or promote18* products derived from this software without specific prior19* written permission.20*21* THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS22* OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED23* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE24* ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY25* DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL26* DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE27* GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS28* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,29* WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING30* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS31* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.32*/3334#ifndef _AQ_COMMON_H_35#define _AQ_COMMON_H_3637#include <sys/types.h>383940#define ETIME ETIMEDOUT41#define EOK 04243#define BIT(nr) (1UL << (nr))4445#define usec_delay(x) DELAY(x)4647#ifndef msec_delay48#define msec_delay(x) DELAY(x*1000)49#define msec_delay_irq(x) DELAY(x*1000)50#endif5152#define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \53do { \54unsigned int i; \55for (i = _N_; (!(_B_)) && i; --i) { \56usec_delay(_US_); \57} \58if (!i) { \59err = -1; \60} \61} while (0)626364#define LOWORD(a) ((uint16_t)(a))65#define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))6667#define AQ_VER "0.0.5"6869#endif // _AQ_COMMON_H_707172