This API provides a layer of abstraction from the underlying IP stack for common operations such as configuring the link and getting link status.
|
| enum | mmipal_status {
MMIPAL_SUCCESS
, MMIPAL_INVALID_ARGUMENT
, MMIPAL_NO_LINK
, MMIPAL_NO_MEM
,
MMIPAL_NOT_SUPPORTED
} |
| | Enumeration of status codes returned by MMIPAL functions. More...
|
| |
| enum | mmipal_link_state { MMIPAL_LINK_DOWN
, MMIPAL_LINK_UP
} |
| | Enumeration of link states. More...
|
| |
| enum | mmipal_addr_mode {
MMIPAL_DISABLED
, MMIPAL_STATIC
, MMIPAL_DHCP
, MMIPAL_AUTOIP
,
MMIPAL_DHCP_OFFLOAD
} |
| | Enumeration of IP address allocation modes. More...
|
| |
| enum | mmipal_ip6_addr_mode { MMIPAL_IP6_DISABLED
, MMIPAL_IP6_STATIC
, MMIPAL_IP6_AUTOCONFIG
, MMIPAL_IP6_DHCP6_STATELESS
} |
| | Enumeration of IPv6 address allocation modes. More...
|
| |
◆ MMIPAL_INIT_ARGS_DEFAULT
| #define MMIPAL_INIT_ARGS_DEFAULT |
Value:
MMIPAL_IP6_DISABLED, { 0 }, false, 0 }
@ MMIPAL_DHCP
IP address allocated via DHCP.
Default values for mmipal_init_args.
This should be used when initializing the mmipal_init_args structure.
Definition at line 173 of file mmipal.h.
◆ MMIPAL_IP6_CONFIG_DEFAULT
◆ MMIPAL_IP_CONFIG_DEFAULT
| #define MMIPAL_IP_CONFIG_DEFAULT { MMIPAL_DHCP, "", "", "", } |
◆ MMIPAL_IPADDR_STR_MAXLEN
| #define MMIPAL_IPADDR_STR_MAXLEN (48) |
Maximum length of an IP address string, including null-terminator.
Definition at line 27 of file mmipal.h.
◆ MMIPAL_MAX_IPV6_ADDRESSES
| #define MMIPAL_MAX_IPV6_ADDRESSES (3) |
Maximum number of IPv6 addresses supported.
Definition at line 32 of file mmipal.h.
◆ mmipal_ext_link_status_cb_fn_t
| typedef void(* mmipal_ext_link_status_cb_fn_t) (const struct mmipal_link_status *link_status, void *arg) |
Prototype for callback function invoked on link status changes.
This is similar to mmipal_link_status_cb_fn_t but with the addition of the arg parameter.
- Parameters
-
| link_status | The current link status. |
| arg | Opaque argument that was provided when the callback was registered. |
Definition at line 237 of file mmipal.h.
◆ mmipal_ip_addr_t
IP address string type.
Definition at line 75 of file mmipal.h.
◆ mmipal_link_status_cb_fn_t
Prototype for callback function invoked on link status changes.
- Parameters
-
| link_status | The current link status. |
Definition at line 213 of file mmipal.h.
◆ mmipal_addr_mode
Enumeration of IP address allocation modes.
| Enumerator |
|---|
| MMIPAL_DISABLED | Disabled.
|
| MMIPAL_STATIC | Static IP address.
|
| MMIPAL_DHCP | IP address allocated via DHCP.
LWIP_DHCP must be set to 1 if using LWIP.
|
| MMIPAL_AUTOIP | IP address allocated via AutoIP.
LWIP_DHCP must be set to 1 if using LWIP.
|
| MMIPAL_DHCP_OFFLOAD | DHCP offloaded to chip.
|
Definition at line 60 of file mmipal.h.
◆ mmipal_ip6_addr_mode
Enumeration of IPv6 address allocation modes.
| Enumerator |
|---|
| MMIPAL_IP6_DISABLED | Disabled.
|
| MMIPAL_IP6_STATIC | Static IPv6 addresses.
|
| MMIPAL_IP6_AUTOCONFIG | IPv6 address allocated via autoconfiguration.
LWIP_IPV6_AUTOCONFIG must be set to 1 if using LWIP.
|
| MMIPAL_IP6_DHCP6_STATELESS | IPv6 address allocated via stateless DHCPv6.
LWIP_IPV6_DHCP6_STATELESS must be set to 1 if using LWIP.
|
Definition at line 103 of file mmipal.h.
◆ mmipal_link_state
Enumeration of link states.
| Enumerator |
|---|
| MMIPAL_LINK_DOWN | Link is down.
|
| MMIPAL_LINK_UP | Link is up.
|
Definition at line 51 of file mmipal.h.
◆ mmipal_status
Enumeration of status codes returned by MMIPAL functions.
| Enumerator |
|---|
| MMIPAL_SUCCESS | Completed successfully.
|
| MMIPAL_INVALID_ARGUMENT | One or more arguments were invalid.
|
| MMIPAL_NO_LINK | The operation could not complete because the link is not up.
|
| MMIPAL_NO_MEM | Failed due to memory allocation failure.
|
| MMIPAL_NOT_SUPPORTED | This functionality is not supported (e.g., due to build configuration).
|
Definition at line 36 of file mmipal.h.
◆ mmipal_get_dns_server()
Get the DNS server at the given index.
- Parameters
-
| [in] | index | Index of the DNS server to set. |
| [out] | addr | IP address buffer to receive the IP address of the DNS server at the given index. Will be set to empty string if no server at the given index. |
- Returns
MMIPAL_SUCCESS on success.
◆ mmipal_get_ip6_config()
Get the IP configurations.
This can be used to get the local IP configurations.
- Parameters
-
| config | Pointer to the IP configurations. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_NOT_SUPPORTED if IPv6 is not supported..
◆ mmipal_get_ip_broadcast_addr()
Gets the current IPv4 broadcast address.
- Parameters
-
| [out] | broadcast_addr | Buffer to receive the broadcast address as a string. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_NOT_SUPPORTED if IPv4 is not supported.
◆ mmipal_get_ip_config()
Get the IP configurations.
This can be used to get the local IP configurations.
- Parameters
-
| config | Pointer to the IP configurations. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_NOT_SUPPORTED if IPv4 is not supported.
◆ mmipal_get_link_packet_counts()
| void mmipal_get_link_packet_counts |
( |
uint32_t * |
tx_packets, |
|
|
uint32_t * |
rx_packets |
|
) |
| |
Get the total number of transmitted and received packets on the MMWLAN interface.
- Note
- If using LWIP, this function requires LWIP_STATS to be defined in your application, otherwise packet counters will always return as 0.
- Parameters
-
| tx_packets | Pointer to location to store total tx packets |
| rx_packets | Pointer to location to store total rx packets |
◆ mmipal_get_link_state()
Get current IPv4 link state.
- Returns
- the current IPv4 link state (up or down).
◆ mmipal_get_local_addr()
Gets the local address for the MMWLAN interface that is appropriate for a given destination address.
The following table shows how the returned local_addr is selected:
dest_addr | local_addr returned |
| type is IPv4 | IPv4 address |
| type is IPv6 | An IPv6 source address selected from interface's IPv6 addresses or ERR_CONN |
(X = don't care)
If the given parameters would result in a local_addr type of IPv4 and IPv4 is not enabled, or IPv6 and IPv6 is not enabled, then MMIPAL_INVALID_ARGUMENT will be returned.
- Parameters
-
| [out] | local_addr | Output local address for the MMWLAN interface, as noted above. |
| [in] | dest_addr | Destination address. |
- Returns
MMIPAL_SUCESS if local_addr successfully set. otherwise an appropriate error code.
◆ mmipal_init()
Initialize the IP stack and enable the MMWLAN interface.
This will implicitly initialize and boot MMWLAN, and will block until this has completed.
- Note
- This function will boot the Morse Micro transceiver using mmwlan_boot() in order to read the MAC address. It is the responsibility of the caller to shut down the transceiver using mmwlan_shutdown() as required.
- Warning
- mmwlan_init() must be called before invoking this function.
- Parameters
-
| args | Initialization arguments. |
- Returns
MMIPAL_SUCCESS on success. otherwise a vendor specific error code.
◆ mmipal_set_dns_server()
Set the DNS server at the given index.
- Warning
- Depending on IP stack implementation, this setting may be overridden by DHCP.
- Parameters
-
| [in] | index | Index of the DNS server to set. |
| [out] | addr | Address of the DNS server to set. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_INVALID_ARGUMENT if an invalid index or IP address was given.
◆ mmipal_set_ext_link_status_callback()
Sets the extended link status callback function to be invoked on link status changes.
This is similar to mmipal_set_link_status_callback() with the exception that an opaque argument may also be specified.
This will be used when DHCP is enabled.
- Note
- This is for IPv4 only. To get IPv6 status use
mmipal_get_ip6_config.
- Parameters
-
| fn | Function pointer to the callback function. |
| arg | Opaque argument to be passed to the callback. |
◆ mmipal_set_ip6_config()
Set the IPv6 configurations.
This can be used to set the local IPv6 configurations.
- Parameters
-
| config | Pointer to the IPv6 configurations. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_NOT_SUPPORTED if IPv6 is not supported.
◆ mmipal_set_ip_config()
Set the IP configurations.
This can be used to set the local IP configurations.
- Parameters
-
| config | Pointer to the IP configurations. |
- Returns
MMIPAL_SUCCESS on success, MMIPAL_NOT_SUPPORTED if IPv4 is not supported.
◆ mmipal_set_link_status_callback()
Sets the callback function to be invoked on link status changes.
This will be used when DHCP is enabled.
- Note
- This is for IPv4 only. To get IPv6 status use
mmipal_get_ip6_config.
-
If an opaque argument is required then use mmipal_set_ext_link_status_callback() instead.
- Parameters
-
| fn | Function pointer to the callback function. |
◆ mmipal_set_tx_qos_tid()
| void mmipal_set_tx_qos_tid |
( |
uint8_t |
tid | ) |
|
Set the QoS Traffic ID to use when transmitting.
- Parameters
-