1*5113495bSYour Name /*
2*5113495bSYour Name * Copyright (c) 2013-2018 The Linux Foundation. All rights reserved.
3*5113495bSYour Name *
4*5113495bSYour Name * Permission to use, copy, modify, and/or distribute this software for
5*5113495bSYour Name * any purpose with or without fee is hereby granted, provided that the
6*5113495bSYour Name * above copyright notice and this permission notice appear in all
7*5113495bSYour Name * copies.
8*5113495bSYour Name *
9*5113495bSYour Name * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL
10*5113495bSYour Name * WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED
11*5113495bSYour Name * WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE
12*5113495bSYour Name * AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
13*5113495bSYour Name * DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
14*5113495bSYour Name * PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
15*5113495bSYour Name * TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
16*5113495bSYour Name * PERFORMANCE OF THIS SOFTWARE.
17*5113495bSYour Name */
18*5113495bSYour Name
19*5113495bSYour Name /**
20*5113495bSYour Name * DOC: osdep
21*5113495bSYour Name * This file provides OS abstraction for osdependent APIs.
22*5113495bSYour Name */
23*5113495bSYour Name
24*5113495bSYour Name #ifndef _OSDEP_H
25*5113495bSYour Name #define _OSDEP_H
26*5113495bSYour Name
27*5113495bSYour Name #include <qdf_types.h>
28*5113495bSYour Name #include <qdf_mem.h>
29*5113495bSYour Name #include <qdf_lock.h>
30*5113495bSYour Name #include <qdf_time.h>
31*5113495bSYour Name #include <qdf_timer.h>
32*5113495bSYour Name #include <qdf_defer.h>
33*5113495bSYour Name #include <qdf_nbuf.h>
34*5113495bSYour Name #include <i_osdep.h>
35*5113495bSYour Name
36*5113495bSYour Name /*
37*5113495bSYour Name * ATH_DEBUG -
38*5113495bSYour Name * Control whether debug features (printouts, assertions) are compiled
39*5113495bSYour Name * into the driver.
40*5113495bSYour Name */
41*5113495bSYour Name #ifndef ATH_DEBUG
42*5113495bSYour Name #define ATH_DEBUG 1 /* default: include debug code */
43*5113495bSYour Name #endif
44*5113495bSYour Name
45*5113495bSYour Name #if ATH_DEBUG
46*5113495bSYour Name #ifndef ASSERT
47*5113495bSYour Name #define ASSERT(expr) qdf_assert(expr)
48*5113495bSYour Name #endif
49*5113495bSYour Name #else
50*5113495bSYour Name #define ASSERT(expr)
51*5113495bSYour Name #endif /* ATH_DEBUG */
52*5113495bSYour Name
53*5113495bSYour Name /*
54*5113495bSYour Name * Need to define byte order based on the CPU configuration.
55*5113495bSYour Name */
56*5113495bSYour Name #ifndef _LITTLE_ENDIAN
57*5113495bSYour Name #define _LITTLE_ENDIAN 1234
58*5113495bSYour Name #endif
59*5113495bSYour Name #ifndef _BIG_ENDIAN
60*5113495bSYour Name #define _BIG_ENDIAN 4321
61*5113495bSYour Name #endif
62*5113495bSYour Name #ifdef __BIG_ENDIAN
63*5113495bSYour Name #define _BYTE_ORDER _BIG_ENDIAN
64*5113495bSYour Name #else
65*5113495bSYour Name #define _BYTE_ORDER _LITTLE_ENDIAN
66*5113495bSYour Name #endif
67*5113495bSYour Name
68*5113495bSYour Name /*
69*5113495bSYour Name * Deduce if tasklets are available. If not then
70*5113495bSYour Name * fall back to using the immediate work queue.
71*5113495bSYour Name */
72*5113495bSYour Name #define qdf_sysctl_decl(f, ctl, write, filp, buffer, lenp, ppos) \
73*5113495bSYour Name f(struct ctl_table *ctl, int32_t write, void *buffer, \
74*5113495bSYour Name size_t *lenp, loff_t *ppos)
75*5113495bSYour Name
76*5113495bSYour Name #define QDF_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos) \
77*5113495bSYour Name __QDF_SYSCTL_PROC_DOINTVEC(ctl, write, filp, buffer, lenp, ppos)
78*5113495bSYour Name
79*5113495bSYour Name #define EOK (0)
80*5113495bSYour Name
81*5113495bSYour Name #ifndef ARPHRD_IEEE80211
82*5113495bSYour Name #define ARPHRD_IEEE80211 801 /* IEEE 802.11. */
83*5113495bSYour Name #endif
84*5113495bSYour Name
85*5113495bSYour Name /*
86*5113495bSYour Name * Normal Delay functions. Time specified in microseconds.
87*5113495bSYour Name */
88*5113495bSYour Name #define OS_DELAY(_us) qdf_udelay(_us)
89*5113495bSYour Name
90*5113495bSYour Name /*
91*5113495bSYour Name * memory data manipulation functions.
92*5113495bSYour Name */
93*5113495bSYour Name #define OS_MEMCPY(_dst, _src, _len) qdf_mem_copy(_dst, _src, _len)
94*5113495bSYour Name #define OS_MEMMOVE(_dst, _src, _len) qdf_mem_move(_dst, _src, _len)
95*5113495bSYour Name #define OS_MEMZERO(_buf, _len) qdf_mem_zero(_buf, _len)
96*5113495bSYour Name #define OS_MEMSET(_buf, _ch, _len) qdf_mem_set(_buf, _len, _ch)
97*5113495bSYour Name #define OS_MEMCMP(_mem1, _mem2, _len) qdf_mem_cmp(_mem1, _mem2, _len)
98*5113495bSYour Name
99*5113495bSYour Name
100*5113495bSYour Name /*
101*5113495bSYour Name * System time interface
102*5113495bSYour Name */
103*5113495bSYour Name typedef qdf_time_t systime_t;
104*5113495bSYour Name
105*5113495bSYour Name /**
106*5113495bSYour Name * os_get_timestamp() - gives the timestamp in ticks
107*5113495bSYour Name * Return: unsigned long
108*5113495bSYour Name */
os_get_timestamp(void)109*5113495bSYour Name static inline qdf_time_t os_get_timestamp(void)
110*5113495bSYour Name {
111*5113495bSYour Name /* Fix double conversion from jiffies to ms */
112*5113495bSYour Name return qdf_system_ticks();
113*5113495bSYour Name }
114*5113495bSYour Name
115*5113495bSYour Name struct _NIC_DEV;
116*5113495bSYour Name
117*5113495bSYour Name #define OS_FREE(_p) qdf_mem_free(_p)
118*5113495bSYour Name
119*5113495bSYour Name #define OS_DMA_MEM_CONTEXT(context) \
120*5113495bSYour Name dma_addr_t context
121*5113495bSYour Name
122*5113495bSYour Name #define OS_GET_DMA_MEM_CONTEXT(var, field) \
123*5113495bSYour Name &(var->field)
124*5113495bSYour Name
125*5113495bSYour Name /*
126*5113495bSYour Name * Timer Interfaces. Use these macros to declare timer
127*5113495bSYour Name * and retrieve timer argument. This is mainly for resolving
128*5113495bSYour Name * different argument types for timer function in different OS.
129*5113495bSYour Name */
130*5113495bSYour Name #define os_timer_func(_fn) \
131*5113495bSYour Name void _fn(void *timer_arg)
132*5113495bSYour Name
133*5113495bSYour Name #define OS_GET_TIMER_ARG(_arg, _type) \
134*5113495bSYour Name ((_arg) = (_type)(timer_arg))
135*5113495bSYour Name
136*5113495bSYour Name #define OS_SET_TIMER(_timer, _ms) qdf_timer_mod(_timer, _ms)
137*5113495bSYour Name
138*5113495bSYour Name /*
139*5113495bSYour Name * These are required for network manager support
140*5113495bSYour Name */
141*5113495bSYour Name #ifndef SET_NETDEV_DEV
142*5113495bSYour Name #define SET_NETDEV_DEV(ndev, pdev)
143*5113495bSYour Name #endif
144*5113495bSYour Name
145*5113495bSYour Name #endif /* end of _OSDEP_H */
146