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