2 * Copyright (c) 2007-2008 Atheros Communications Inc.
4 * Permission to use, copy, modify, and/or distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
17 /* Module Name : wrap_mis.c */
20 /* This module contains wrapper functions for misc functions */
23 /* Platform dependent. */
25 /************************************************************************/
30 #include <linux/netlink.h>
31 #include <net/iw_handler.h>
33 /* extern struct zsWdsStruct wds[ZM_WDS_PORT_NUMBER]; */
34 extern struct zsVapStruct vap
[ZM_VAP_PORT_NUMBER
];
35 extern u16_t
zfLnxGetVapId(zdev_t
*dev
);
37 /* Simply return 0xffff if VAP function is not supported */
38 u16_t
zfwGetVapId(zdev_t
*dev
)
40 return zfLnxGetVapId(dev
);
43 void zfwSleep(zdev_t
*dev
, u32_t ms
)
45 if (in_interrupt() == 0)
49 int iter
= 100000 * ms
;
51 for (ii
= 0; ii
< iter
; ii
++) {
56 #ifdef ZM_HALPLUS_LOCK
57 asmlinkage
struct zsWlanDev
*zfwGetWlanDev(zdev_t
*dev
)
59 struct usbdrv_private
*macp
= dev
->ml_priv
;
63 asmlinkage
void zfwEnterCriticalSection(zdev_t
*dev
)
65 struct usbdrv_private
*macp
= dev
->ml_priv
;
66 spin_lock_irqsave(&macp
->cs_lock
, macp
->hal_irqFlag
);
69 asmlinkage
void zfwLeaveCriticalSection(zdev_t
*dev
)
71 struct usbdrv_private
*macp
= dev
->ml_priv
;
72 spin_unlock_irqrestore(&macp
->cs_lock
, macp
->hal_irqFlag
);
75 asmlinkage u8_t
zfwBufReadByte(zdev_t
*dev
, zbuf_t
*buf
, u16_t offset
)
77 return *(u8_t
*)((u8_t
*)buf
->data
+offset
);
80 asmlinkage u16_t
zfwBufReadHalfWord(zdev_t
*dev
, zbuf_t
*buf
, u16_t offset
)
82 return zmw_cpu_to_le16(*(u16_t
*)((u8_t
*)buf
->data
+offset
));
85 asmlinkage
void zfwBufWriteByte(zdev_t
*dev
, zbuf_t
*buf
, u16_t offset
,
88 *(u8_t
*)((u8_t
*)buf
->data
+offset
) = value
;
91 asmlinkage
void zfwBufWriteHalfWord(zdev_t
*dev
, zbuf_t
*buf
, u16_t offset
,
94 *(u16_t
*)((u8_t
*)buf
->data
+offset
) = zmw_cpu_to_le16(value
);
97 asmlinkage u8_t
*zfwGetBuffer(zdev_t
*dev
, zbuf_t
*buf
)
99 return (u8_t
*)(buf
->data
);
103 /* Leave an empty line below to remove warning message on some compiler */