a_osapi.h 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /*
  2. * Copyright (c) 2013-2014 The Linux Foundation. All rights reserved.
  3. *
  4. * Previously licensed under the ISC license by Qualcomm Atheros, Inc.
  5. *
  6. *
  7. * Permission to use, copy, modify, and/or distribute this software for
  8. * any purpose with or without fee is hereby granted, provided that the
  9. * above copyright notice and this permission notice appear in all
  10. * copies.
  11. *
  12. * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
  13. * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
  14. * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
  15. * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
  16. * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
  17. * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  18. * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  19. * PERFORMANCE OF THIS SOFTWARE.
  20. */
  21. /*
  22. * This file was originally distributed by Qualcomm Atheros, Inc.
  23. * under proprietary terms before Copyright ownership was assigned
  24. * to the Linux Foundation.
  25. */
  26. /* ============================================================================== */
  27. /* This file contains the definitions of the basic atheros data types. */
  28. /* It is used to map the data types in atheros files to a platform specific */
  29. /* type. */
  30. /* */
  31. /* Author(s): ="Atheros" */
  32. /* ============================================================================== */
  33. #ifndef _A_OSAPI_H_
  34. #define _A_OSAPI_H_
  35. #if defined(__linux__) && !defined(LINUX_EMULATION)
  36. #include "osapi_linux.h"
  37. #endif
  38. /*=== the following primitives have the same definition for all platforms ===*/
  39. #define A_COMPILE_TIME_ASSERT(assertion_name, predicate) \
  40. typedef char assertion_name[(predicate) ? 1 : -1]
  41. /*
  42. * If N is a power of 2, then N and N-1 are orthogonal
  43. * (N-1 has all the least-significant bits set which are zero in N)
  44. * so N ^ (N-1) = (N << 1) - 1
  45. */
  46. #define A_COMPILE_TIME_ASSERT_IS_PWR2(assertion_name, value) \
  47. A_COMPILE_TIME_ASSERT (assertion_name, \
  48. (((value) ^ ((value)-1)) == ((value) << 1) - 1))
  49. #ifndef __ubicom32__
  50. #define HIF_MALLOC_DIAGMEM(osdev, size, pa, context, retry) \
  51. os_malloc_CONSISTENT(osdev, size, pa, context, retry)
  52. #define HIF_FREE_DIAGMEM(osdev, size, vaddr, pa, context) \
  53. OS_FREE_CONSISTENT(osdev, size, vaddr, pa, context)
  54. #define HIF_DIAGMEM_SYNC(osdev, pa, size, dir, context)
  55. #else
  56. #define HIF_MALLOC_DIAGMEM(osdev, size, pa, context, retry) \
  57. os_malloc_NONCONSISTENT(osdev, size, pa, context, retry)
  58. #define HIF_FREE_DIAGMEM(osdev, size, vaddr, pa, context) \
  59. OS_FREE_NONCONSISTENT(osdev, size, vaddr, pa, context)
  60. #define HIF_DIAGMEM_SYNC(osdev, pa, size, dir, context) \
  61. OS_SYNC_SINGLE(osdev, pa, size, dir, context)
  62. #endif /* ubicom32 */
  63. #endif /* _OSAPI_H_ */