2017-03-26 17:42:53 +02:00
|
|
|
/****************************************************************************
|
2021-03-08 22:39:04 +01:00
|
|
|
* drivers/wireless/ieee80211/bcm43xxx/bcmf_driver.h
|
2017-03-26 17:42:53 +02:00
|
|
|
*
|
2021-05-27 11:12:43 +02:00
|
|
|
* Licensed to the Apache Software Foundation (ASF) under one or more
|
|
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
|
|
* this work for additional information regarding copyright ownership. The
|
|
|
|
* ASF licenses this file to you under the Apache License, Version 2.0 (the
|
|
|
|
* "License"); you may not use this file except in compliance with the
|
|
|
|
* License. You may obtain a copy of the License at
|
2017-03-26 17:42:53 +02:00
|
|
|
*
|
2021-05-27 11:12:43 +02:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2017-03-26 17:42:53 +02:00
|
|
|
*
|
2021-05-27 11:12:43 +02:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
|
|
|
|
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
|
|
|
|
* License for the specific language governing permissions and limitations
|
|
|
|
* under the License.
|
2017-03-26 17:42:53 +02:00
|
|
|
*
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#ifndef __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_DRIVER_H
|
|
|
|
#define __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_DRIVER_H
|
2017-03-26 17:42:53 +02:00
|
|
|
|
2020-08-09 14:51:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Included Files
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-04-13 20:31:39 +02:00
|
|
|
#include <stdbool.h>
|
2017-04-23 22:17:43 +02:00
|
|
|
#include <stdint.h>
|
2017-03-26 17:42:53 +02:00
|
|
|
|
2017-04-24 20:04:47 +02:00
|
|
|
#include <nuttx/net/netdev.h>
|
2020-02-01 08:17:32 +01:00
|
|
|
#include <nuttx/semaphore.h>
|
2017-04-30 20:29:48 +02:00
|
|
|
#include <net/if.h>
|
2017-04-24 20:04:47 +02:00
|
|
|
#include <nuttx/wdog.h>
|
|
|
|
#include <nuttx/wqueue.h>
|
2017-04-16 13:13:11 +02:00
|
|
|
|
2017-05-03 23:19:28 +02:00
|
|
|
#include "bcmf_ioctl.h"
|
|
|
|
|
2017-04-28 19:28:29 +02:00
|
|
|
struct bcmf_dev_s;
|
|
|
|
struct bcmf_frame_s;
|
|
|
|
|
|
|
|
#include "bcmf_bdc.h"
|
|
|
|
|
|
|
|
struct bcmf_bus_dev_s;
|
|
|
|
|
2020-08-09 14:51:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Pre-processor Definitions
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-04-24 20:04:47 +02:00
|
|
|
/* Chip interfaces */
|
|
|
|
|
|
|
|
#define CHIP_STA_INTERFACE 0
|
|
|
|
#define CHIP_AP_INTERFACE 1
|
|
|
|
#define CHIP_P2P_INTERFACE 2
|
2017-04-16 13:13:11 +02:00
|
|
|
|
2020-08-09 14:51:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Types
|
|
|
|
****************************************************************************/
|
|
|
|
|
2017-03-26 17:42:53 +02:00
|
|
|
/* This structure contains the unique state of the Broadcom FullMAC driver */
|
|
|
|
|
|
|
|
struct bcmf_dev_s
|
|
|
|
{
|
2017-04-24 20:04:47 +02:00
|
|
|
FAR struct bcmf_bus_dev_s *bus; /* Bus interface structure */
|
|
|
|
|
|
|
|
bool bc_bifup; /* true:ifup false:ifdown */
|
2021-10-02 05:26:43 +02:00
|
|
|
struct work_s bc_rxwork; /* For deferring rx work to the work queue */
|
2017-04-24 20:04:47 +02:00
|
|
|
struct work_s bc_pollwork; /* For deferring poll work to the work queue */
|
|
|
|
|
|
|
|
/* This holds the information visible to the NuttX network */
|
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
struct net_driver_s bc_dev; /* Network interface structure */
|
|
|
|
FAR struct bcmf_frame_s *cur_tx_frame; /* Frame used to interface network layer */
|
2017-04-24 20:04:47 +02:00
|
|
|
|
2017-04-28 19:28:29 +02:00
|
|
|
/* Event registration array */
|
|
|
|
|
|
|
|
event_handler_t event_handlers[BCMF_EVENT_COUNT];
|
2017-03-26 17:42:53 +02:00
|
|
|
|
2017-04-23 22:17:43 +02:00
|
|
|
sem_t control_mutex; /* Cannot handle multiple control requests */
|
|
|
|
sem_t control_timeout; /* Semaphore to wait for control frame rsp */
|
|
|
|
uint16_t control_reqid; /* Current control request id */
|
|
|
|
uint16_t control_rxdata_len; /* Received control frame out buffer length */
|
2022-10-21 05:04:06 +02:00
|
|
|
FAR uint8_t *control_rxdata; /* Received control frame out buffer */
|
2017-04-23 22:17:43 +02:00
|
|
|
uint32_t control_status; /* Last received frame status */
|
2023-12-18 04:33:08 +01:00
|
|
|
#ifdef CONFIG_NETDEV_IOCTL
|
|
|
|
mutex_t ioctl_mutex; /* Avoid handle multiple ioctl requests */
|
|
|
|
#endif
|
2017-04-28 19:28:29 +02:00
|
|
|
|
|
|
|
/* AP Scan state machine.
|
2020-08-09 14:51:47 +02:00
|
|
|
* During scan, control_mutex is locked to prevent control requests
|
|
|
|
*/
|
2017-04-28 19:28:29 +02:00
|
|
|
|
|
|
|
int scan_status; /* Current scan status */
|
2020-08-04 12:31:31 +02:00
|
|
|
struct wdog_s scan_timeout; /* Scan timeout timer */
|
2022-06-17 19:26:13 +02:00
|
|
|
FAR wl_bss_info_t *scan_result; /* Temp buffer that holds results */
|
|
|
|
unsigned int scan_result_entries; /* Current entries of temp buffer */
|
2017-04-30 20:29:48 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
FAR sem_t *auth_signal; /* Authentication notification signal */
|
|
|
|
uint32_t auth_status; /* Authentication status */
|
|
|
|
wsec_pmk_t auth_pmk; /* Authentication pmk */
|
|
|
|
bool auth_pending; /* Authentication pending */
|
2022-06-20 08:56:37 +02:00
|
|
|
|
|
|
|
#ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
|
2022-07-02 06:51:35 +02:00
|
|
|
struct work_s lp_work_ifdown; /* Ifdown work to work queue */
|
|
|
|
struct work_s lp_work_dtim; /* Low power work to work queue */
|
|
|
|
int lp_dtim; /* Listen interval Delivery Traffic Indication Message */
|
|
|
|
sclock_t lp_ticks; /* Ticks of last tx time */
|
2022-06-20 08:56:37 +02:00
|
|
|
#endif
|
2022-06-21 16:26:59 +02:00
|
|
|
#ifdef CONFIG_IEEE80211_BROADCOM_PTA_PRIORITY
|
|
|
|
int pta_priority; /* Current priority of Packet Traffic Arbitration */
|
|
|
|
#endif
|
2017-04-23 22:17:43 +02:00
|
|
|
};
|
2017-04-13 20:31:39 +02:00
|
|
|
|
2017-04-23 22:17:43 +02:00
|
|
|
/* Default bus interface structure */
|
2017-04-13 20:31:39 +02:00
|
|
|
|
2017-04-30 20:29:48 +02:00
|
|
|
struct bcmf_bus_dev_s
|
|
|
|
{
|
2017-04-23 22:17:43 +02:00
|
|
|
void (*stop)(FAR struct bcmf_dev_s *priv);
|
2022-10-21 05:04:06 +02:00
|
|
|
int (*txframe)(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct bcmf_frame_s *frame,
|
2017-04-30 20:29:48 +02:00
|
|
|
bool control);
|
2017-05-04 02:20:57 +02:00
|
|
|
struct bcmf_frame_s *(*rxframe)(FAR struct bcmf_dev_s *priv);
|
2017-04-16 11:28:08 +02:00
|
|
|
|
2017-04-30 20:29:48 +02:00
|
|
|
/* Frame buffer allocation primitives
|
2017-04-23 22:17:43 +02:00
|
|
|
* len - requested payload length
|
|
|
|
* control - true if control frame else false
|
|
|
|
* block - true to block until free frame is available
|
|
|
|
*/
|
2020-08-09 14:51:47 +02:00
|
|
|
|
2017-05-04 02:20:57 +02:00
|
|
|
struct bcmf_frame_s *(*allocate_frame)(FAR struct bcmf_dev_s *priv,
|
2017-04-30 20:29:48 +02:00
|
|
|
unsigned int len, bool block,
|
|
|
|
bool control);
|
|
|
|
|
2020-08-09 14:51:47 +02:00
|
|
|
void (*free_frame)(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct bcmf_frame_s *frame);
|
2017-04-23 22:17:43 +02:00
|
|
|
};
|
2017-04-16 11:28:08 +02:00
|
|
|
|
2017-04-23 22:17:43 +02:00
|
|
|
/* bcmf frame definition */
|
2017-04-22 15:57:51 +02:00
|
|
|
|
2017-04-30 20:29:48 +02:00
|
|
|
struct bcmf_frame_s
|
|
|
|
{
|
2022-10-21 05:04:06 +02:00
|
|
|
FAR uint8_t *base; /* Frame base buffer used by low level layer (SDIO) */
|
|
|
|
FAR uint8_t *data; /* Payload data (Control, data and event messages) */
|
|
|
|
uint16_t len; /* Frame buffer size */
|
2017-03-26 17:42:53 +02:00
|
|
|
};
|
|
|
|
|
2020-08-09 14:51:47 +02:00
|
|
|
/****************************************************************************
|
|
|
|
* Public Function Prototypes
|
|
|
|
****************************************************************************/
|
|
|
|
|
2022-08-14 21:04:18 +02:00
|
|
|
FAR struct bcmf_dev_s *bcmf_allocate_device(void);
|
|
|
|
void bcmf_free_device(FAR struct bcmf_dev_s *priv);
|
|
|
|
|
|
|
|
int bcmf_driver_initialize(FAR struct bcmf_dev_s *priv);
|
|
|
|
|
2017-05-02 16:48:13 +02:00
|
|
|
/* IOCTLs network interface implementation */
|
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_mac_address(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct ifreq *req);
|
2017-04-30 20:29:48 +02:00
|
|
|
|
2017-04-24 20:04:47 +02:00
|
|
|
int bcmf_wl_enable(FAR struct bcmf_dev_s *priv, bool enable);
|
2017-04-22 20:55:22 +02:00
|
|
|
|
2022-06-20 08:56:37 +02:00
|
|
|
int bcmf_wl_active(FAR struct bcmf_dev_s *priv, bool active);
|
|
|
|
|
2022-07-02 06:51:35 +02:00
|
|
|
#ifdef CONFIG_IEEE80211_BROADCOM_LOWPOWER
|
|
|
|
int bcmf_wl_set_dtim(FAR struct bcmf_dev_s *priv, uint32_t interval_ms);
|
|
|
|
#endif
|
2022-06-20 08:56:37 +02:00
|
|
|
|
2022-06-21 16:03:42 +02:00
|
|
|
int bcmf_wl_set_country_code(FAR struct bcmf_dev_s *priv,
|
|
|
|
int interface, FAR void *code);
|
|
|
|
|
2017-05-02 16:48:13 +02:00
|
|
|
/* IOCTLs AP scan interface implementation */
|
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_start_scan(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2017-04-28 19:28:29 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_get_scan_results(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct iwreq *iwr);
|
2017-04-28 19:28:29 +02:00
|
|
|
|
2017-05-02 16:48:13 +02:00
|
|
|
/* IOCTLs authentication interface implementation */
|
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_auth_param(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct iwreq *iwr);
|
2017-05-02 16:48:13 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_encode_ext(FAR struct bcmf_dev_s *priv,
|
|
|
|
FAR struct iwreq *iwr);
|
2017-05-02 16:48:13 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_mode(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
|
|
|
int bcmf_wl_get_mode(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2017-05-02 16:48:13 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_ssid(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
|
|
|
int bcmf_wl_get_ssid(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_bssid(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
|
|
|
int bcmf_wl_get_bssid(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-06-21 16:26:59 +02:00
|
|
|
int bcmf_wl_get_frequency(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_get_rate(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_get_txpower(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_get_rssi(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-17 08:47:26 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_get_iwrange(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2017-04-30 20:29:48 +02:00
|
|
|
|
2022-10-21 05:04:06 +02:00
|
|
|
int bcmf_wl_set_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
|
|
|
int bcmf_wl_get_country(FAR struct bcmf_dev_s *priv, FAR struct iwreq *iwr);
|
2022-06-21 16:03:42 +02:00
|
|
|
|
2022-06-21 16:26:59 +02:00
|
|
|
int bcmf_wl_get_channel(FAR struct bcmf_dev_s *priv, int interface);
|
|
|
|
|
|
|
|
#ifdef CONFIG_IEEE80211_BROADCOM_PTA_PRIORITY
|
|
|
|
int bcmf_wl_get_pta(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
|
|
|
int bcmf_wl_set_pta(FAR struct bcmf_dev_s *priv, struct iwreq *iwr);
|
|
|
|
|
|
|
|
int bcmf_wl_set_pta_priority(FAR struct bcmf_dev_s *priv, uint32_t prio);
|
|
|
|
#else
|
|
|
|
# define bcmf_wl_get_pta(...)
|
|
|
|
# define bcmf_wl_set_pta(...)
|
|
|
|
# define bcmf_wl_set_pta_priority(...)
|
|
|
|
#endif
|
|
|
|
|
2022-01-15 03:44:35 +01:00
|
|
|
#endif /* __DRIVERS_WIRELESS_IEEE80211_BCM43XXX_BCMF_DRIVER_H */
|