M7350/external/compat-wireless/drivers/net/wireless/ath/ath6kl/btc.h

80 lines
1.9 KiB
C
Raw Permalink Normal View History

2024-09-09 08:57:42 +00:00
/*
* Copyright (c) 2004-2011 Atheros Communications Inc.
*
* Permission to use, copy, modify, and/or distribute this software for any
* purpose with or without fee is hereby granted, provided that the above
* copyright notice and this permission notice appear in all copies.
*
* THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
* WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
* MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
* ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
* WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
* ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
* OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
#ifndef BTC_H
#define BTC_H
#include <net/iw_handler.h>
#define EVENT_ID_LEN 2
void cfg80211_send_genevent_to_app(struct net_device *dev,
u16 event_id,
u8 *datap, int len)
{
char *buf;
u16 size;
union iwreq_data wrqu;
size = len + EVENT_ID_LEN;
if (size > IW_GENERIC_IE_MAX)
return;
buf = kmalloc(size, GFP_ATOMIC);
if (buf == NULL)
return;
memset(buf, 0, size);
memcpy(buf, &event_id, EVENT_ID_LEN);
memcpy(buf + EVENT_ID_LEN, datap, len);
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = size;
wireless_send_event(dev, IWEVGENIE, &wrqu, buf);
kfree(buf);
}
void cfg80211_send_event_to_app(struct net_device *dev,
u16 event_id,
u8 *datap, int len)
{
char *buf;
u16 size;
union iwreq_data wrqu;
if (!dev)
return;
size = len + EVENT_ID_LEN;
if (size > IW_CUSTOM_MAX)
return;
buf = kmalloc(size, GFP_ATOMIC);
if (buf == NULL)
return;
memset(buf, 0, size);
memcpy(buf, &event_id, EVENT_ID_LEN);
memcpy(buf + EVENT_ID_LEN, datap, len);
memset(&wrqu, 0, sizeof(wrqu));
wrqu.data.length = size;
wireless_send_event(dev, IWEVCUSTOM, &wrqu, buf);
kfree(buf);
}
#endif