xref: /freebsd/tools/tools/ath/common/ah_osdep.h (revision 726af9c015a095db6635ed2bc0e5fc10ccbc83be)
11094c01fSSam Leffler /*-
21094c01fSSam Leffler  * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
31094c01fSSam Leffler  * All rights reserved.
41094c01fSSam Leffler  *
51094c01fSSam Leffler  * Redistribution and use in source and binary forms, with or without
61094c01fSSam Leffler  * modification, are permitted provided that the following conditions
71094c01fSSam Leffler  * are met:
81094c01fSSam Leffler  * 1. Redistributions of source code must retain the above copyright
91094c01fSSam Leffler  *    notice, this list of conditions and the following disclaimer,
101094c01fSSam Leffler  *    without modification.
111094c01fSSam Leffler  * 2. Redistributions in binary form must reproduce at minimum a disclaimer
121094c01fSSam Leffler  *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
131094c01fSSam Leffler  *    redistribution must be conditioned upon including a substantially
141094c01fSSam Leffler  *    similar Disclaimer requirement for further binary redistribution.
151094c01fSSam Leffler  *
161094c01fSSam Leffler  * NO WARRANTY
171094c01fSSam Leffler  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
181094c01fSSam Leffler  * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
191094c01fSSam Leffler  * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
201094c01fSSam Leffler  * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
211094c01fSSam Leffler  * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
221094c01fSSam Leffler  * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
231094c01fSSam Leffler  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
241094c01fSSam Leffler  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
251094c01fSSam Leffler  * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
261094c01fSSam Leffler  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
271094c01fSSam Leffler  * THE POSSIBILITY OF SUCH DAMAGES.
281094c01fSSam Leffler  *
291094c01fSSam Leffler  * $FreeBSD$
301094c01fSSam Leffler  */
311094c01fSSam Leffler #ifndef _ATH_AH_OSDEP_H_
321094c01fSSam Leffler #define _ATH_AH_OSDEP_H_
331094c01fSSam Leffler /*
341094c01fSSam Leffler  * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
351094c01fSSam Leffler  */
361094c01fSSam Leffler #include <sys/param.h>
371094c01fSSam Leffler 
381094c01fSSam Leffler /*
391094c01fSSam Leffler  * Bus i/o type definitions.
401094c01fSSam Leffler  */
411094c01fSSam Leffler typedef void *HAL_SOFTC;
421094c01fSSam Leffler typedef int HAL_BUS_TAG;
431094c01fSSam Leffler typedef void *HAL_BUS_HANDLE;
44*726af9c0SAdrian Chadd typedef uint32_t HAL_DMA_ADDR;
451094c01fSSam Leffler 
461094c01fSSam Leffler #define	OS_DELAY(_n)	DELAY(_n)
471094c01fSSam Leffler #define	OS_INLINE	__inline
481094c01fSSam Leffler #define	OS_MEMZERO(_a, _size)		bzero((_a), (_size))
491094c01fSSam Leffler #define	OS_MEMCPY(_dst, _src, _size)	bcopy((_src), (_dst), (_size))
501094c01fSSam Leffler #define	OS_MACEQU(_a, _b) \
511094c01fSSam Leffler 	(bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
521094c01fSSam Leffler 
531094c01fSSam Leffler struct ath_hal;
541094c01fSSam Leffler extern 	u_int32_t OS_GETUPTIME(struct ath_hal *);
551094c01fSSam Leffler extern	void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t);
561094c01fSSam Leffler extern	u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t);
571094c01fSSam Leffler extern	void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
581094c01fSSam Leffler #define	OS_GETUPTIME(_ah)	0
591094c01fSSam Leffler #define	OS_REG_WRITE(_ah, _reg, _val)
601094c01fSSam Leffler #define	OS_REG_READ(_ah, _reg)	0
611094c01fSSam Leffler #define	OS_MARK(_ah, _id, _v)
621094c01fSSam Leffler #define __packed __attribute__((__packed__))
631094c01fSSam Leffler 
641094c01fSSam Leffler /*
651094c01fSSam Leffler  * Linux/BSD gcc compatibility shims.
661094c01fSSam Leffler  */
671094c01fSSam Leffler #ifndef __printflike
681094c01fSSam Leffler #define	__printflike(_a,_b) \
691094c01fSSam Leffler 	__attribute__ ((__format__ (__printf__, _a, _b)))
701094c01fSSam Leffler #endif
711094c01fSSam Leffler #include <stdarg.h>
721094c01fSSam Leffler #ifndef __va_list
731094c01fSSam Leffler #define	__va_list	va_list
741094c01fSSam Leffler #endif
751094c01fSSam Leffler #define	OS_INLINE	__inline
761094c01fSSam Leffler #endif /* _ATH_AH_OSDEP_H_ */
77