1185743Ssam/*-
2185743Ssam * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3185743Ssam * All rights reserved.
4185743Ssam *
5185743Ssam * Redistribution and use in source and binary forms, with or without
6185743Ssam * modification, are permitted provided that the following conditions
7185743Ssam * are met:
8185743Ssam * 1. Redistributions of source code must retain the above copyright
9185743Ssam *    notice, this list of conditions and the following disclaimer,
10185743Ssam *    without modification.
11185743Ssam * 2. Redistributions in binary form must reproduce at minimum a disclaimer
12185743Ssam *    similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any
13185743Ssam *    redistribution must be conditioned upon including a substantially
14185743Ssam *    similar Disclaimer requirement for further binary redistribution.
15185743Ssam *
16185743Ssam * NO WARRANTY
17185743Ssam * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18185743Ssam * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19185743Ssam * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY
20185743Ssam * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL
21185743Ssam * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY,
22185743Ssam * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
23185743Ssam * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
24185743Ssam * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
25185743Ssam * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
26185743Ssam * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
27185743Ssam * THE POSSIBILITY OF SUCH DAMAGES.
28185743Ssam *
29185743Ssam * $FreeBSD$
30185743Ssam */
31185743Ssam#ifndef _ATH_AH_OSDEP_H_
32185743Ssam#define _ATH_AH_OSDEP_H_
33185743Ssam/*
34185743Ssam * Atheros Hardware Access Layer (HAL) OS Dependent Definitions.
35185743Ssam */
36185743Ssam#include <sys/param.h>
37185743Ssam
38287297Srodrigc#include <strings.h>
39287297Srodrigc
40185743Ssam/*
41185743Ssam * Bus i/o type definitions.
42185743Ssam */
43185743Ssamtypedef void *HAL_SOFTC;
44185743Ssamtypedef int HAL_BUS_TAG;
45185743Ssamtypedef void *HAL_BUS_HANDLE;
46239162Sadriantypedef uint32_t HAL_DMA_ADDR;
47185743Ssam
48185743Ssam#define	OS_DELAY(_n)	DELAY(_n)
49185743Ssam#define	OS_INLINE	__inline
50185743Ssam#define	OS_MEMZERO(_a, _size)		bzero((_a), (_size))
51185743Ssam#define	OS_MEMCPY(_dst, _src, _size)	bcopy((_src), (_dst), (_size))
52185743Ssam#define	OS_MACEQU(_a, _b) \
53185743Ssam	(bcmp((_a), (_b), IEEE80211_ADDR_LEN) == 0)
54185743Ssam
55185743Ssamstruct ath_hal;
56185743Ssamextern 	u_int32_t OS_GETUPTIME(struct ath_hal *);
57185743Ssamextern	void OS_REG_WRITE(struct ath_hal *, u_int32_t, u_int32_t);
58185743Ssamextern	u_int32_t OS_REG_READ(struct ath_hal *, u_int32_t);
59185743Ssamextern	void OS_MARK(struct ath_hal *, u_int id, u_int32_t value);
60185743Ssam#define	OS_GETUPTIME(_ah)	0
61185743Ssam#define	OS_REG_WRITE(_ah, _reg, _val)
62185743Ssam#define	OS_REG_READ(_ah, _reg)	0
63185743Ssam#define	OS_MARK(_ah, _id, _v)
64185743Ssam#define __packed __attribute__((__packed__))
65185743Ssam
66185743Ssam/*
67185743Ssam * Linux/BSD gcc compatibility shims.
68185743Ssam */
69185743Ssam#ifndef __printflike
70185743Ssam#define	__printflike(_a,_b) \
71185743Ssam	__attribute__ ((__format__ (__printf__, _a, _b)))
72185743Ssam#endif
73185743Ssam#include <stdarg.h>
74185743Ssam#ifndef __va_list
75185743Ssam#define	__va_list	va_list
76185743Ssam#endif
77185743Ssam#define	OS_INLINE	__inline
78185743Ssam#endif /* _ATH_AH_OSDEP_H_ */
79