drivers: modem: hl7800: add IPv6 support
Add support for dual mode IPv4/IPv6 stack. Signed-off-by: Ryan Erickson <ryan.erickson@lairdconnect.com>
This commit is contained in:
parent
03e62be290
commit
7b5714669c
|
@ -313,7 +313,7 @@ static const struct mdm_control_pinconfig pinconfig[] = {
|
|||
#define PROFILE_LINE_2 \
|
||||
"S00:255 S01:255 S03:255 S04:255 S05:255 S07:255 S08:255 S10:255\r\n"
|
||||
|
||||
#define SETUP_GPRS_CONNECTION_CMD "AT+KCNXCFG=1,\"GPRS\",\"\""
|
||||
#define SETUP_GPRS_CONNECTION_CMD "AT+KCNXCFG=1,\"GPRS\",\"\",,,\"IPV4V6\""
|
||||
|
||||
#define MAX_PROFILE_LINE_LENGTH \
|
||||
MAX(sizeof(PROFILE_LINE_1), sizeof(PROFILE_LINE_2))
|
||||
|
@ -2959,8 +2959,12 @@ static int start_socket_rx(struct hl7800_socket *sock, uint16_t rx_size)
|
|||
sock->rx_size =
|
||||
net_if_get_mtu(ictx.iface) - NET_IPV4UDPH_LEN;
|
||||
}
|
||||
#else
|
||||
#warning IPV6 not supported in HL7800 driver
|
||||
#endif
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
if (rx_size > (net_if_get_mtu(ictx.iface) - NET_IPV6UDPH_LEN)) {
|
||||
sock->rx_size =
|
||||
net_if_get_mtu(ictx.iface) - NET_IPV6UDPH_LEN;
|
||||
}
|
||||
#endif
|
||||
snprintk(sendbuf, sizeof(sendbuf), "AT+KUDPRCV=%d,%u",
|
||||
sock->socket_id, rx_size);
|
||||
|
@ -2970,8 +2974,12 @@ static int start_socket_rx(struct hl7800_socket *sock, uint16_t rx_size)
|
|||
sock->rx_size =
|
||||
net_if_get_mtu(ictx.iface) - NET_IPV4TCPH_LEN;
|
||||
}
|
||||
#else
|
||||
#warning IPV6 not supported in HL7800 driver
|
||||
#endif
|
||||
#if defined(CONFIG_NET_IPV6)
|
||||
if (rx_size > (net_if_get_mtu(ictx.iface) - NET_IPV6TCPH_LEN)) {
|
||||
sock->rx_size =
|
||||
net_if_get_mtu(ictx.iface) - NET_IPV6TCPH_LEN;
|
||||
}
|
||||
#endif
|
||||
snprintk(sendbuf, sizeof(sendbuf), "AT+KTCPRCV=%d,%u",
|
||||
sock->socket_id, sock->rx_size);
|
||||
|
@ -3530,8 +3538,7 @@ static void mdm_vgpio_work_cb(struct k_work *item)
|
|||
hl7800_unlock();
|
||||
}
|
||||
|
||||
void mdm_vgpio_callback_isr(const struct device *port,
|
||||
struct gpio_callback *cb,
|
||||
void mdm_vgpio_callback_isr(const struct device *port, struct gpio_callback *cb,
|
||||
uint32_t pins)
|
||||
{
|
||||
ictx.vgpio_state = (uint32_t)gpio_pin_get(ictx.gpio_port_dev[MDM_VGPIO],
|
||||
|
@ -3560,8 +3567,7 @@ void mdm_vgpio_callback_isr(const struct device *port,
|
|||
}
|
||||
|
||||
void mdm_uart_dsr_callback_isr(const struct device *port,
|
||||
struct gpio_callback *cb,
|
||||
uint32_t pins)
|
||||
struct gpio_callback *cb, uint32_t pins)
|
||||
{
|
||||
ictx.dsr_state = (uint32_t)gpio_pin_get(
|
||||
ictx.gpio_port_dev[MDM_UART_DSR], pinconfig[MDM_UART_DSR].pin);
|
||||
|
@ -3585,8 +3591,7 @@ static void mark_sockets_for_reconfig(void)
|
|||
}
|
||||
#endif
|
||||
|
||||
void mdm_gpio6_callback_isr(const struct device *port,
|
||||
struct gpio_callback *cb,
|
||||
void mdm_gpio6_callback_isr(const struct device *port, struct gpio_callback *cb,
|
||||
uint32_t pins)
|
||||
{
|
||||
#ifdef CONFIG_MODEM_HL7800_LOW_POWER_MODE
|
||||
|
@ -3611,8 +3616,7 @@ void mdm_gpio6_callback_isr(const struct device *port,
|
|||
#endif
|
||||
}
|
||||
|
||||
void mdm_uart_cts_callback(const struct device *port,
|
||||
struct gpio_callback *cb,
|
||||
void mdm_uart_cts_callback(const struct device *port, struct gpio_callback *cb,
|
||||
uint32_t pins)
|
||||
{
|
||||
ictx.cts_state = (uint32_t)gpio_pin_get(
|
||||
|
@ -4000,7 +4004,7 @@ static int write_apn(char *access_point_name)
|
|||
|
||||
/* PDP Context */
|
||||
memset(cmd_string, 0, MDM_HL7800_APN_CMD_MAX_SIZE);
|
||||
strncat(cmd_string, "AT+CGDCONT=1,\"IP\",\"",
|
||||
strncat(cmd_string, "AT+CGDCONT=1,\"IPV4V6\",\"",
|
||||
MDM_HL7800_APN_CMD_MAX_STRLEN);
|
||||
strncat(cmd_string, access_point_name, MDM_HL7800_APN_CMD_MAX_STRLEN);
|
||||
strncat(cmd_string, "\"", MDM_HL7800_APN_CMD_MAX_STRLEN);
|
||||
|
|
Loading…
Reference in a new issue