1*493d26c5SEd Maste /* 2*493d26c5SEd Maste * aQuantia Corporation Network Driver 3*493d26c5SEd Maste * Copyright (C) 2014-2017 aQuantia Corporation. All rights reserved 4*493d26c5SEd Maste * 5*493d26c5SEd Maste * Redistribution and use in source and binary forms, with or without 6*493d26c5SEd Maste * modification, are permitted provided that the following conditions 7*493d26c5SEd Maste * are met: 8*493d26c5SEd Maste * 9*493d26c5SEd Maste * (1) Redistributions of source code must retain the above 10*493d26c5SEd Maste * copyright notice, this list of conditions and the following 11*493d26c5SEd Maste * disclaimer. 12*493d26c5SEd Maste * 13*493d26c5SEd Maste * (2) Redistributions in binary form must reproduce the above 14*493d26c5SEd Maste * copyright notice, this list of conditions and the following 15*493d26c5SEd Maste * disclaimer in the documentation and/or other materials provided 16*493d26c5SEd Maste * with the distribution. 17*493d26c5SEd Maste * 18*493d26c5SEd Maste * (3)The name of the author may not be used to endorse or promote 19*493d26c5SEd Maste * products derived from this software without specific prior 20*493d26c5SEd Maste * written permission. 21*493d26c5SEd Maste * 22*493d26c5SEd Maste * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS 23*493d26c5SEd Maste * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 24*493d26c5SEd Maste * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 25*493d26c5SEd Maste * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 26*493d26c5SEd Maste * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 27*493d26c5SEd Maste * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 28*493d26c5SEd Maste * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 29*493d26c5SEd Maste * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 30*493d26c5SEd Maste * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING 31*493d26c5SEd Maste * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 32*493d26c5SEd Maste * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 33*493d26c5SEd Maste */ 34*493d26c5SEd Maste 35*493d26c5SEd Maste #ifndef _AQ_COMMON_H_ 36*493d26c5SEd Maste #define _AQ_COMMON_H_ 37*493d26c5SEd Maste 38*493d26c5SEd Maste #include <stdint.h> 39*493d26c5SEd Maste 40*493d26c5SEd Maste #define ETH_MAC_LEN 6 41*493d26c5SEd Maste 42*493d26c5SEd Maste /* Types definition */ 43*493d26c5SEd Maste #define TRUE 1 44*493d26c5SEd Maste #define FALSE 0 45*493d26c5SEd Maste 46*493d26c5SEd Maste #define s8 __int8_t 47*493d26c5SEd Maste #define u8 __uint8_t 48*493d26c5SEd Maste #define u16 __uint16_t 49*493d26c5SEd Maste #define s16 __int16_t 50*493d26c5SEd Maste #define u32 __uint32_t 51*493d26c5SEd Maste #define u64 __uint64_t 52*493d26c5SEd Maste #define s64 __int64_t 53*493d26c5SEd Maste #define s32 int 54*493d26c5SEd Maste typedef __uint32_t DWORD; 55*493d26c5SEd Maste 56*493d26c5SEd Maste #define ETIME ETIMEDOUT 57*493d26c5SEd Maste #define EOK 0 58*493d26c5SEd Maste 59*493d26c5SEd Maste #define BIT(nr) (1UL << (nr)) 60*493d26c5SEd Maste 61*493d26c5SEd Maste #define usec_delay(x) DELAY(x) 62*493d26c5SEd Maste 63*493d26c5SEd Maste #ifndef msec_delay 64*493d26c5SEd Maste #define msec_delay(x) DELAY(x*1000) 65*493d26c5SEd Maste #define msec_delay_irq(x) DELAY(x*1000) 66*493d26c5SEd Maste #endif 67*493d26c5SEd Maste 68*493d26c5SEd Maste #define AQ_HW_WAIT_FOR(_B_, _US_, _N_) \ 69*493d26c5SEd Maste do { \ 70*493d26c5SEd Maste unsigned int i; \ 71*493d26c5SEd Maste for (i = _N_; (!(_B_)) && i; --i) { \ 72*493d26c5SEd Maste usec_delay(_US_); \ 73*493d26c5SEd Maste } \ 74*493d26c5SEd Maste if (!i) { \ 75*493d26c5SEd Maste err = -1; \ 76*493d26c5SEd Maste } \ 77*493d26c5SEd Maste } while (0) 78*493d26c5SEd Maste 79*493d26c5SEd Maste 80*493d26c5SEd Maste #define LODWORD(a) ((DWORD)(a)) 81*493d26c5SEd Maste #define LOWORD(a) ((u16)(a)) 82*493d26c5SEd Maste #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0])) 83*493d26c5SEd Maste 84*493d26c5SEd Maste #define AQ_VER "0.0.5" 85*493d26c5SEd Maste 86*493d26c5SEd Maste #endif //_AQ_COMMON_H_ 87*493d26c5SEd Maste 88