1 /*- 2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting 3 * 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 * 1. Redistributions of source code must retain the above copyright 9 * notice, this list of conditions and the following disclaimer, 10 * without modification. 11 * 2. Redistributions in binary form must reproduce at minimum a disclaimer 12 * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any 13 * redistribution must be conditioned upon including a substantially 14 * similar Disclaimer requirement for further binary redistribution. 15 * 16 * NO WARRANTY 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 18 * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 19 * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY 20 * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL 21 * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, 22 * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 23 * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 24 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 25 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 26 * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF 27 * THE POSSIBILITY OF SUCH DAMAGES. 28 * 29 * $FreeBSD$ 30 */ 31 #ifndef _ATH_AH_OSDEP_H_ 32 #define _ATH_AH_OSDEP_H_ 33 /* 34 * Atheros Hardware Access Layer (HAL) OS Dependent Definitions. 35 */ 36 #include <sys/param.h> 37 38 #include <strings.h> 39 40 /* 41 * Bus i/o type definitions. 42 */ 43 typedef void *HAL_SOFTC; 44 typedef int HAL_BUS_TAG; 45 typedef void *HAL_BUS_HANDLE; 46 typedef uint32_t HAL_DMA_ADDR; 47 48 #define OS_DELAY(_n) DELAY(_n) 49 #define OS_INLINE __inline 50 #define OS_MEMZERO(_a, _size) bzero((_a), (_size)) 51 #define OS_MEMCPY(_dst, _src, _size) bcopy((_src), (_dst), (_size)) 52 #define OS_MACEQU(_a, _b) \ 53 (bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0) 54 55 struct ath_hal; 56 extern u_int32_t OS_GETUPTIME(struct ath_hal *); 57 extern void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t); 58 extern u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t); 59 extern void OS_MARK(struct ath_hal *, u_int id, u_int32_t value); 60 #define OS_GETUPTIME(_ah) 0 61 #define OS_REG_WRITE(_ah, _reg, _val) 62 #define OS_REG_READ(_ah, _reg) 0 63 #define OS_MARK(_ah, _id, _v) 64 #define __packed __attribute__((__packed__)) 65 66 /* 67 * Linux/BSD gcc compatibility shims. 68 */ 69 #ifndef __printflike 70 #define __printflike(_a,_b) \ 71 __attribute__ ((__format__ (__printf__, _a, _b))) 72 #endif 73 #include <stdarg.h> 74 #ifndef __va_list 75 #define __va_list va_list 76 #endif 77 #define OS_INLINE __inline 78 #endif /* _ATH_AH_OSDEP_H_ */ 79