2014-03-16 03:47:02 +05:30
/**
* Copyright ( c ) 2014 Redpine Signals 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 __RSI_COMMON_H__
# define __RSI_COMMON_H__
# include <linux/kthread.h>
# define EVENT_WAIT_FOREVER 0
2017-05-16 15:31:17 +05:30
# define FIRMWARE_RSI9113 "rs9113_wlan_qspi.rps"
2014-03-16 03:47:02 +05:30
# define QUEUE_NOT_FULL 1
# define QUEUE_FULL 0
static inline int rsi_init_event ( struct rsi_event * pevent )
{
atomic_set ( & pevent - > event_condition , 1 ) ;
init_waitqueue_head ( & pevent - > event_queue ) ;
return 0 ;
}
static inline int rsi_wait_event ( struct rsi_event * event , u32 timeout )
{
int status = 0 ;
if ( ! timeout )
status = wait_event_interruptible ( event - > event_queue ,
( atomic_read ( & event - > event_condition ) = = 0 ) ) ;
else
status = wait_event_interruptible_timeout ( event - > event_queue ,
( atomic_read ( & event - > event_condition ) = = 0 ) ,
timeout ) ;
return status ;
}
static inline void rsi_set_event ( struct rsi_event * event )
{
atomic_set ( & event - > event_condition , 0 ) ;
wake_up_interruptible ( & event - > event_queue ) ;
}
static inline void rsi_reset_event ( struct rsi_event * event )
{
atomic_set ( & event - > event_condition , 1 ) ;
}
static inline int rsi_create_kthread ( struct rsi_common * common ,
struct rsi_thread * thread ,
void * func_ptr ,
u8 * name )
{
init_completion ( & thread - > completion ) ;
2018-02-27 19:56:16 +05:30
atomic_set ( & thread - > thread_done , 0 ) ;
2014-05-22 11:48:41 -07:00
thread - > task = kthread_run ( func_ptr , common , " %s " , name ) ;
2014-03-16 03:47:02 +05:30
if ( IS_ERR ( thread - > task ) )
return ( int ) PTR_ERR ( thread - > task ) ;
return 0 ;
}
static inline int rsi_kill_thread ( struct rsi_thread * handle )
{
atomic_inc ( & handle - > thread_done ) ;
rsi_set_event ( & handle - > event ) ;
return kthread_stop ( handle - > task ) ;
}
void rsi_mac80211_detach ( struct rsi_hw * hw ) ;
2017-08-30 15:08:23 +05:30
u16 rsi_get_connected_channel ( struct ieee80211_vif * vif ) ;
2018-02-27 19:56:17 +05:30
struct rsi_hw * rsi_91x_init ( u16 oper_mode ) ;
2014-03-16 03:47:02 +05:30
void rsi_91x_deinit ( struct rsi_hw * adapter ) ;
2018-02-27 19:56:11 +05:30
int rsi_read_pkt ( struct rsi_common * common , u8 * rx_pkt , s32 rcv_pkt_len ) ;
2017-11-01 17:42:45 +05:30
# ifdef CONFIG_PM
2017-10-27 16:55:55 +05:30
int rsi_config_wowlan ( struct rsi_hw * adapter , struct cfg80211_wowlan * wowlan ) ;
2017-11-01 17:42:45 +05:30
# endif
2017-08-16 18:43:14 +05:30
struct rsi_sta * rsi_find_sta ( struct rsi_common * common , u8 * mac_addr ) ;
2017-08-30 15:08:23 +05:30
struct ieee80211_vif * rsi_get_vif ( struct rsi_hw * adapter , u8 * mac ) ;
2017-10-24 02:29:09 -07:00
void rsi_roc_timeout ( struct timer_list * t ) ;
2014-03-16 03:47:02 +05:30
# endif