2 * Copyright (c) 2002-2008 Sam Leffler, Errno Consulting
3 * Copyright (c) 2002-2008 Atheros Communications, Inc.
5 * Permission to use, copy, modify, and/or distribute this software for any
6 * purpose with or without fee is hereby granted, provided that the above
7 * copyright notice and this permission notice appear in all copies.
9 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
10 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
11 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
12 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
13 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
14 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
15 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
19 #ifndef _ATH_AR5312_H_
20 #define _ATH_AR5312_H_
23 #include "ar5212/ar5212.h"
25 #define AR5312_UNIT(_ah) \
26 (((const struct ar531x_config *)((_ah)->ah_st))->unit)
27 #define AR5312_BOARDCONFIG(_ah) \
28 (((const struct ar531x_config *)((_ah)->ah_st))->board)
29 #define AR5312_RADIOCONFIG(_ah) \
30 (((const struct ar531x_config *)((_ah)->ah_st))->radio)
32 #define IS_5312_2_X(ah) \
33 (((AH_PRIVATE(ah)->ah_macVersion) == AR_SREV_VERSION_VENICE) && \
34 (((AH_PRIVATE(ah)->ah_macRev) == 2) || ((AH_PRIVATE(ah)->ah_macRev) == 7)))
37 ((AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV6) || \
38 (AH_PRIVATE(ah)->ah_devid == AR5212_AR2315_REV7) || \
39 (AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV1) || \
40 (AH_PRIVATE(ah)->ah_devid == AR5212_AR2317_REV2))
43 extern struct ath_hal
* ar5312Attach(uint16_t devid
, HAL_SOFTC sc
,
44 HAL_BUS_TAG st
, HAL_BUS_HANDLE sh
, HAL_STATUS
*status
);
45 extern HAL_BOOL
ar5312IsInterruptPending(struct ath_hal
*ah
);
48 extern HAL_BOOL
ar5312GpioCfgOutput(struct ath_hal
*, uint32_t gpio
);
49 extern HAL_BOOL
ar5312GpioCfgInput(struct ath_hal
*, uint32_t gpio
);
50 extern HAL_BOOL
ar5312GpioSet(struct ath_hal
*, uint32_t gpio
, uint32_t val
);
51 extern uint32_t ar5312GpioGet(struct ath_hal
*ah
, uint32_t gpio
);
52 extern void ar5312GpioSetIntr(struct ath_hal
*ah
, u_int
, uint32_t ilevel
);
55 extern HAL_BOOL
ar5315GpioCfgOutput(struct ath_hal
*, uint32_t gpio
);
56 extern HAL_BOOL
ar5315GpioCfgInput(struct ath_hal
*, uint32_t gpio
);
57 extern HAL_BOOL
ar5315GpioSet(struct ath_hal
*, uint32_t gpio
, uint32_t val
);
58 extern uint32_t ar5315GpioGet(struct ath_hal
*ah
, uint32_t gpio
);
59 extern void ar5315GpioSetIntr(struct ath_hal
*ah
, u_int
, uint32_t ilevel
);
61 extern void ar5312SetLedState(struct ath_hal
*ah
, HAL_LED_STATE state
);
62 extern HAL_BOOL
ar5312DetectCardPresent(struct ath_hal
*ah
);
63 extern void ar5312SetupClock(struct ath_hal
*ah
, HAL_OPMODE opmode
);
64 extern void ar5312RestoreClock(struct ath_hal
*ah
, HAL_OPMODE opmode
);
65 extern void ar5312DumpState(struct ath_hal
*ah
);
66 extern HAL_BOOL
ar5312Reset(struct ath_hal
*ah
, HAL_OPMODE opmode
,
67 HAL_CHANNEL
*chan
, HAL_BOOL bChannelChange
, HAL_STATUS
*status
);
68 extern HAL_BOOL
ar5312ChipReset(struct ath_hal
*ah
, HAL_CHANNEL
*chan
);
69 extern HAL_BOOL
ar5312SetPowerMode(struct ath_hal
*ah
, HAL_POWER_MODE mode
,
71 extern HAL_BOOL
ar5312PhyDisable(struct ath_hal
*ah
);
72 extern HAL_BOOL
ar5312Disable(struct ath_hal
*ah
);
73 extern HAL_BOOL
ar5312MacReset(struct ath_hal
*ah
, unsigned int RCMask
);
74 extern uint32_t ar5312GetPowerMode(struct ath_hal
*ah
);
75 extern HAL_BOOL
ar5312GetPowerStatus(struct ath_hal
*ah
);
78 extern HAL_BOOL
ar5312EepromRead(struct ath_hal
*, u_int off
, uint16_t *data
);
80 #endif /* _ATH_AR3212_H_ */