File tree Expand file tree Collapse file tree
Documentation/reference/user Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -110,6 +110,16 @@ Board information
110110 which to receive the board unique ID.
111111
112112 :dependencies: Board logic must provide the :c:func: `board_uniqueid ` interface.
113+
114+ .. c :macro :: BOARDIOC_MACADDR
115+
116+ Get the network driver MAC address.
117+
118+ :Argument: A pointer to an instance of :c:struct: `boardioc_macaddr_s `.
119+
120+ :configuration: CONFIG_BOARDCTL_MACADDR
121+
122+ :dependencies: Board logic must provide the :c:func: `board_macaddr ` interface.
113123
114124Filesystems
115125-----------
Original file line number Diff line number Diff line change @@ -5322,6 +5322,14 @@ config BOARDCTL_START_CPU
53225322 Architecture specific logic must provide the board_start_cpu()
53235323 interface.
53245324
5325+ config BOARDCTL_MACADDR
5326+ bool "Get network MAC address"
5327+ default n
5328+ ---help---
5329+ Enables support for the BOARDIOC_MACADDR boardctl() command.
5330+ Architecture specific logic must provide the board_macaddr()
5331+ interface.
5332+
53255333config BOARDCTL_IOCTL
53265334 bool "Board-specific boardctl() commands"
53275335 default n
Original file line number Diff line number Diff line change @@ -906,6 +906,25 @@ int boardctl(unsigned int cmd, uintptr_t arg)
906906 break ;
907907#endif
908908
909+ #ifdef CONFIG_BOARDCTL_MACADDR
910+ /* CMD: BOARDIOC_MACADDR
911+ * DESCRIPTION: Get the network driver mac address.
912+ * ARG: A pointer to an instance of struct
913+ * boardioc_macaddr_s.
914+ * CONFIGURATION: CONFIG_BOARDCTL_MACADDR
915+ * DEPENDENCIES: Board logic must provide board_macaddr()
916+ */
917+
918+ case BOARDIOC_MACADDR :
919+ {
920+ FAR struct boardioc_macaddr_s * req =
921+ (FAR struct boardioc_macaddr_s * )arg ;
922+
923+ ret = board_macaddr (req -> ifname , req -> macaddr );
924+ }
925+ break ;
926+ #endif
927+
909928 default :
910929 {
911930#ifdef CONFIG_BOARDCTL_IOCTL
Original file line number Diff line number Diff line change @@ -635,6 +635,26 @@ void board_autoled_off(int led);
635635# define board_autoled_off (led )
636636#endif
637637
638+ /****************************************************************************
639+ * Name: board_macaddr
640+ *
641+ * Description:
642+ * Get the network driver mac address.
643+ *
644+ * Input Parameters:
645+ * ifname - The interface name.
646+ * macaddr - The mac address.
647+ *
648+ * Returned Value:
649+ * Zero (OK) is returned on success; a negated errno value is returned on
650+ * any failure.
651+ *
652+ ****************************************************************************/
653+
654+ #ifdef CONFIG_BOARDCTL_MACADDR
655+ int board_macaddr (FAR const char * ifname , FAR uint8_t * macaddr );
656+ #endif
657+
638658/****************************************************************************
639659 * Name: board_userled_initialize
640660 *
Original file line number Diff line number Diff line change 4848# include <nuttx/spinlock.h>
4949#endif
5050
51+ #ifdef CONFIG_BOARDCTL_MACADDR
52+ # include <net/if.h>
53+ # include <nuttx/net/netdev.h>
54+ #endif
55+
5156#ifdef CONFIG_BOARDCTL
5257
5358/****************************************************************************
216221#define BOARDIOC_RESET_CAUSE _BOARDIOC(0x0015)
217222#define BOARDIOC_IRQ_AFFINITY _BOARDIOC(0x0016)
218223#define BOARDIOC_START_CPU _BOARDIOC(0x0017)
224+ #define BOARDIOC_MACADDR _BOARDIOC(0x0018)
219225
220226/* If CONFIG_BOARDCTL_IOCTL=y, then board-specific commands will be support.
221227 * In this case, all commands not recognized by boardctl() will be forwarded
224230 * User defined board commands may begin with this value:
225231 */
226232
227- #define BOARDIOC_USER _BOARDIOC(0x0018 )
233+ #define BOARDIOC_USER _BOARDIOC(0x0019 )
228234
229235/****************************************************************************
230236 * Public Type Definitions
@@ -478,6 +484,14 @@ struct boardioc_reset_cause_s
478484};
479485#endif
480486
487+ #ifdef CONFIG_BOARDCTL_MACADDR
488+ struct boardioc_macaddr_s
489+ {
490+ char ifname [IFNAMSIZ ];
491+ uint8_t macaddr [RADIO_MAX_ADDRLEN ];
492+ };
493+ #endif
494+
481495/****************************************************************************
482496 * Public Data
483497 ****************************************************************************/
You can’t perform that action at this time.
0 commit comments