Merge pull request #97 from DC-fgervais/xretries
[open-ath9k-htc-firmware.git] / target_firmware / wlan / ah_osdep.h
index 54b2a9b7a6a0f905d4cdf95aa19078479f3495a4..14576a23a80c51920db3ba3c52691f90ff0b9bfc 100755 (executable)
@@ -1,40 +1,41 @@
-/*-
+/*
  * Copyright (c) 2002-2004 Sam Leffler, Errno Consulting, Atheros
- * Communications, Inc.  All rights reserved.
+ *             Communications, Inc.  All rights reserved.
+ * Copyright (c) 2013 Qualcomm Atheros, Inc.
+ *
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted (subject to the limitations in the
+ * disclaimer below) provided that the following conditions are met:
  *
- * Redistribution and use in source and binary forms are permitted
- * provided that the following conditions are met:
- * 1. The materials contained herein are unmodified and are used
- *    unmodified.
- * 2. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following NO
- *    ''WARRANTY'' disclaimer below (''Disclaimer''), without
- *    modification.
- * 3. Redistributions in binary form must reproduce at minimum a
- *    disclaimer similar to the Disclaimer below and any redistribution
- *    must be conditioned upon including a substantially similar
- *    Disclaimer requirement for further binary redistribution.
- * 4. Neither the names of the above-listed copyright holders nor the
- *    names of any contributors may be used to endorse or promote
- *    product derived from this software without specific prior written
- *    permission.
+ *  * Redistributions of source code must retain the above copyright
+ *    notice, this list of conditions and the following disclaimer.
  *
- * NO WARRANTY
- * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
- * ''AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
- * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT,
- * MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
- * IN NO EVENT SHALL THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE
- * FOR SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
- * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
- * USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
- * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
- * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
- * SUCH DAMAGES.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *    notice, this list of conditions and the following disclaimer in the
+ *    documentation and/or other materials provided with the
+ *    distribution.
  *
- * $Id: //depot/sw/branches/fusion_usb/target_firmware/wlan/target/hal/main/linux/ah_osdep.h#1 $
+ *  * Neither the name of Qualcomm Atheros nor the names of its
+ *    contributors may be used to endorse or promote products derived
+ *    from this software without specific prior written permission.
+ *
+ * NO EXPRESS OR IMPLIED LICENSES TO ANY PARTY'S PATENT RIGHTS ARE
+ * GRANTED BY THIS LICENSE.  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT
+ * HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
+ * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
+
 #ifndef _ATH_AH_OSDEP_H_
 #define _ATH_AH_OSDEP_H_
 /*
@@ -128,10 +129,8 @@ extern  void __ahdecl ath_hal_delay(a_int32_t);
 extern  void* __ahdecl ath_hal_ioremap(a_uint32_t addr, a_uint32_t len);
 #define OS_REMAP(_addr, _len)       ath_hal_ioremap(_addr, _len)
 
-#define OS_MEMZERO(_a, _n)  ath_hal_memzero((_a), (_n))
-extern void __ahdecl ath_hal_memzero(void *, size_t);
 #define OS_MEMCPY(_d, _s, _n)   ath_hal_memcpy(_d,_s,_n)
-extern void * __ahdecl ath_hal_memcpy(void *, void *, size_t);
+extern void * __ahdecl ath_hal_memcpy(void *, const void *, size_t);
 
 #ifndef abs
 #define abs(_a)     __builtin_abs(_a)
@@ -141,51 +140,14 @@ struct ath_hal;
 extern  a_uint32_t __ahdecl ath_hal_getuptime(struct ath_hal *);
 #define OS_GETUPTIME(_ah)   ath_hal_getuptime(_ah)
 
-/*
- * Byte order/swapping support.
- */
-#define AH_LITTLE_ENDIAN    1234
-#define AH_BIG_ENDIAN       4321
-
-#if AH_BYTE_ORDER == AH_BIG_ENDIAN
-/*
- * This could be optimized but since we only use it for
- * a few registers there's little reason to do so.
- */
-#ifndef __bswap32
-static inline a_uint32_t
-__bswap32(a_uint32_t _x)
-{
-    return ((a_uint32_t)(
-          (((const a_uint8_t *)(&_x))[0]    ) |
-          (((const a_uint8_t *)(&_x))[1]<< 8) |
-          (((const a_uint8_t *)(&_x))[2]<<16) |
-          (((const a_uint8_t *)(&_x))[3]<<24))
-    );
-}
-#endif
-#ifndef __bswap16
-#define __bswap16(_x) ( (a_uint16_t)( (((const a_uint8_t *)(&_x))[0] ) |\
-                         ( ( (const a_uint8_t *)( &_x ) )[1]<< 8) ) )
-#endif
-#else
 #ifndef __bswap32
 #define __bswap32(_x)  (_x)
 #endif
 #ifndef __bswap16
 #define __bswap16(_x)  (_x)
 #endif
-#endif
-
-#define OS_REG_WRITE(_ah, _reg, _val)   ath_hal_reg_write_target(_ah, _reg, _val)
-#define OS_REG_READ(_ah, _reg)      ath_hal_reg_read_target(_ah, _reg)
-
-extern  void __ahdecl ath_hal_reg_write_target(struct ath_hal *ah,
-        a_uint32_t reg, a_uint32_t val);
-extern  a_uint32_t __ahdecl ath_hal_reg_read_target(struct ath_hal *ah, a_uint32_t reg);
 
 #define AH_USE_EEPROM     0x00000001
-extern  struct ath_hal *_ath_hal_attach_tgt( a_uint32_t,HAL_SOFTC,adf_os_device_t,HAL_BUS_HANDLE,
+extern  struct ath_hal *_ath_hal_attach_tgt( a_uint32_t, HAL_SOFTC, adf_os_device_t,
        a_uint32_t flags, void* status);
-extern  void ath_hal_detach(struct ath_hal *);
 #endif /* _ATH_AH_OSDEP_H_ */