wireless/bcm43xxx: add customized MAC address support

Signed-off-by: chao.an <anchao@xiaomi.com>
This commit is contained in:
chao.an 2022-06-19 02:10:33 +08:00 committed by Xiang Xiao
parent e498e5308a
commit fbddae8813
4 changed files with 49 additions and 0 deletions

View File

@ -126,6 +126,15 @@ void bcmf_board_setup_oob_irq(int minor, int (*func)(void *), void *arg)
}
}
/****************************************************************************
* Name: bcmf_board_etheraddr
****************************************************************************/
bool bcmf_board_etheraddr(struct ether_addr *ethaddr)
{
return false;
}
/****************************************************************************
* Name: emw3162_wlan_initialize
****************************************************************************/

View File

@ -108,6 +108,15 @@ void bcmf_board_setup_oob_irq(int minor, int (*func)(void *), void *arg)
}
}
/****************************************************************************
* Name: bcmf_board_etheraddr
****************************************************************************/
bool bcmf_board_etheraddr(struct ether_addr *ethaddr)
{
return false;
}
/****************************************************************************
* Name: photon_wlan_initialize
****************************************************************************/

View File

@ -41,6 +41,7 @@
#include <nuttx/net/arp.h>
#include <nuttx/net/netdev.h>
#include <nuttx/wireless/wireless.h>
#include <nuttx/wireless/ieee80211/bcmf_board.h>
#ifdef CONFIG_NET_PKT
# include <nuttx/net/pkt.h>
@ -1033,6 +1034,17 @@ int bcmf_netdev_register(FAR struct bcmf_dev_s *priv)
return -EIO;
}
/* Set customized MAC address */
if (bcmf_board_etheraddr(&priv->bc_dev.d_mac.ether))
{
out_len = ETHER_ADDR_LEN;
bcmf_cdc_iovar_request(priv, CHIP_STA_INTERFACE, true,
IOVAR_STR_CUR_ETHERADDR,
priv->bc_dev.d_mac.ether.ether_addr_octet,
&out_len);
}
/* Query MAC address */
out_len = ETHER_ADDR_LEN;

View File

@ -27,6 +27,7 @@
#include <stdbool.h>
#include <nuttx/irq.h>
#include <net/ethernet.h>
#ifdef __cplusplus
#define EXTERN extern "C"
@ -108,6 +109,24 @@ void bcmf_board_reset(int minor, bool reset);
void bcmf_board_setup_oob_irq(int minor, int (*func)(void *), void *arg);
/****************************************************************************
* Name: bcmf_board_etheraddr
*
* Description:
* Board specific function called from Broadcom FullMAC driver
* that must be implemented to get the customized MAC address
*
* Returned Value:
* Return true if customized MAC address is set,
* otherwise use firmware default MAC address
*
* Input Parameters:
* ethaddr - Pointer to MAC address
*
****************************************************************************/
bool bcmf_board_etheraddr(FAR struct ether_addr *ethaddr);
#undef EXTERN
#ifdef __cplusplus
}