Lines Matching refs:iface_ctx
556 static struct hl7800_iface_ctx iface_ctx; variable
596 if (!iface_ctx.stale_sockets[i].allocated) { in alloc_stale_socket()
597 sock = &iface_ctx.stale_sockets[i]; in alloc_stale_socket()
623 k_queue_append(&iface_ctx.stale_socket_queue, (void *)sock); in queue_stale_socket()
636 sock = (struct stale_socket *)k_queue_get(&iface_ctx.stale_socket_queue, K_NO_WAIT); in dequeue_stale_socket()
661 iface_ctx.vgpio_state = read_pin(0, &hl7800_cfg.gpio[MDM_VGPIO]); in is_cmd_ready()
663 iface_ctx.gpio6_state = read_pin(0, &hl7800_cfg.gpio[MDM_GPIO6]); in is_cmd_ready()
665 iface_ctx.cts_state = read_pin(1, &hl7800_cfg.gpio[MDM_UART_CTS]); in is_cmd_ready()
667 return iface_ctx.vgpio_state && iface_ctx.gpio6_state && !iface_ctx.cts_state; in is_cmd_ready()
680 if (is_cmd_rdy && (iface_ctx.sleep_state != HL7800_SLEEP_AWAKE) && in check_hl7800_awake()
681 !iface_ctx.allow_sleep && !iface_ctx.wait_for_KSUP) { in check_hl7800_awake()
684 k_sem_give(&iface_ctx.mdm_awake); in check_hl7800_awake()
685 } else if (!is_cmd_rdy && iface_ctx.sleep_state == HL7800_SLEEP_AWAKE && in check_hl7800_awake()
686 iface_ctx.allow_sleep) { in check_hl7800_awake()
689 if (iface_ctx.desired_sleep_level == HL7800_SLEEP_HIBERNATE || in check_hl7800_awake()
690 iface_ctx.desired_sleep_level == HL7800_SLEEP_LITE_HIBERNATE) { in check_hl7800_awake()
695 iface_ctx.wait_for_KSUP = true; in check_hl7800_awake()
696 iface_ctx.wait_for_KSUP_tries = 0; in check_hl7800_awake()
698 set_sleep_state(iface_ctx.desired_sleep_level); in check_hl7800_awake()
700 } else if (iface_ctx.desired_sleep_level == HL7800_SLEEP_SLEEP) { in check_hl7800_awake()
785 if (!iface_ctx.sockets[i].context) { in socket_get()
786 sock = &iface_ctx.sockets[i]; in socket_get()
804 if (iface_ctx.sockets[i].socket_id == socket_id) { in socket_from_id()
805 sock = &iface_ctx.sockets[i]; in socket_from_id()
815 iface_ctx.busy = busy; in set_busy()
859 iface_ctx.wake_up_callback = func; in mdm_hl7800_register_wake_test_point_callback()
864 iface_ctx.gpio6_callback = func; in mdm_hl7800_register_gpio6_callback()
869 iface_ctx.cts_callback = func; in mdm_hl7800_register_cts_callback()
897 if (iface_ctx.wake_up_callback != NULL) { in modem_assert_wake()
898 iface_ctx.wake_up_callback(state); in modem_assert_wake()
927 if (!iface_ctx.busy) { in allow_sleep_work_callback()
929 iface_ctx.allow_sleep = true; in allow_sleep_work_callback()
930 set_sleep_state(iface_ctx.desired_sleep_level); in allow_sleep_work_callback()
933 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.allow_sleep_work, in allow_sleep_work_callback()
942 if (!iface_ctx.restarting && !iface_ctx.busy) { in allow_sleep()
944 &hl7800_workq, &iface_ctx.allow_sleep_work, in allow_sleep()
947 k_work_cancel_delayable(&iface_ctx.allow_sleep_work); in allow_sleep()
951 k_work_cancel_delayable(&iface_ctx.allow_sleep_work); in allow_sleep()
952 iface_ctx.allow_sleep = false; in allow_sleep()
982 *rsrp = iface_ctx.mdm_rssi; in mdm_hl7800_get_signal_quality()
983 *sinr = iface_ctx.mdm_sinr; in mdm_hl7800_get_signal_quality()
997 iface_ctx.last_error = 0; in send_at_cmd()
1001 k_sem_reset(&iface_ctx.response_sem); in send_at_cmd()
1002 iface_ctx.last_socket_id = 0; in send_at_cmd()
1003 iface_ctx.socket_cmd = false; in send_at_cmd()
1006 iface_ctx.socket_cmd = true; in send_at_cmd()
1008 iface_ctx.last_socket_id = sock->socket_id; in send_at_cmd()
1011 strncpy(iface_ctx.no_id_resp_cmd, data, in send_at_cmd()
1012 sizeof(iface_ctx.no_id_resp_cmd) - 1); in send_at_cmd()
1013 iface_ctx.search_no_id_resp = true; in send_at_cmd()
1017 mdm_receiver_send(&iface_ctx.mdm_ctx, data, strlen(data)); in send_at_cmd()
1018 mdm_receiver_send(&iface_ctx.mdm_ctx, "\r", 1); in send_at_cmd()
1025 ret = k_sem_take(&iface_ctx.response_sem, timeout); in send_at_cmd()
1034 ret = iface_ctx.last_error; in send_at_cmd()
1046 iface_ctx.search_no_id_resp = false; in send_at_cmd()
1061 if (iface_ctx.desired_sleep_level == HL7800_SLEEP_SLEEP) { in wakeup_hl7800()
1067 ret = k_sem_take(&iface_ctx.mdm_awake, MDM_WAKEUP_TIME); in wakeup_hl7800()
1086 iface_ctx.last_socket_id = 0; in mdm_hl7800_send_at_cmd()
1103 iface_ctx.last_socket_id = 0; in mdm_hl7800_update_apn()
1113 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.mdm_reset_work, in mdm_hl7800_update_apn()
1131 if (value == iface_ctx.mdm_rat) { in mdm_hl7800_update_rat()
1142 iface_ctx.last_socket_id = 0; in mdm_hl7800_update_rat()
1145 if (iface_ctx.new_rat_cmd_support) { in mdm_hl7800_update_rat()
1151 if (iface_ctx.new_rat_cmd_support) { in mdm_hl7800_update_rat()
1169 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.mdm_reset_work, K_NO_WAIT); in mdm_hl7800_update_rat()
1179 iface_ctx.local_time_valid = false; in mdm_hl7800_get_local_time()
1183 iface_ctx.last_socket_id = 0; in mdm_hl7800_get_local_time()
1187 if (iface_ctx.local_time_valid) { in mdm_hl7800_get_local_time()
1188 memcpy(tm, &iface_ctx.local_time, sizeof(struct tm)); in mdm_hl7800_get_local_time()
1189 memcpy(offset, &iface_ctx.local_time_offset, sizeof(*offset)); in mdm_hl7800_get_local_time()
1203 iface_ctx.last_socket_id = 0; in mdm_hl7800_get_operator_index()
1212 return iface_ctx.operator_index; in mdm_hl7800_get_operator_index()
1222 iface_ctx.last_socket_id = 0; in mdm_hl7800_get_functionality()
1231 return iface_ctx.functionality; in mdm_hl7800_get_functionality()
1243 iface_ctx.last_socket_id = 0; in mdm_hl7800_set_functionality()
1260 iface_ctx.gps_query_location_rate_seconds = rate; in mdm_hl7800_set_gps_rate()
1286 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.gps_work, in mdm_hl7800_set_gps_rate()
1287 K_SECONDS(iface_ctx.gps_query_location_rate_seconds)); in mdm_hl7800_set_gps_rate()
1289 k_work_cancel_delayable(&iface_ctx.gps_work); in mdm_hl7800_set_gps_rate()
1387 event_handler(HL7800_EVENT_RSSI, &iface_ctx.mdm_rssi); in mdm_hl7800_generate_status_events()
1388 event_handler(HL7800_EVENT_SINR, &iface_ctx.mdm_sinr); in mdm_hl7800_generate_status_events()
1389 event_handler(HL7800_EVENT_APN_UPDATE, &iface_ctx.mdm_apn); in mdm_hl7800_generate_status_events()
1390 event_handler(HL7800_EVENT_RAT, &iface_ctx.mdm_rat); in mdm_hl7800_generate_status_events()
1391 event_handler(HL7800_EVENT_BANDS, iface_ctx.mdm_bands_string); in mdm_hl7800_generate_status_events()
1392 event_handler(HL7800_EVENT_ACTIVE_BANDS, iface_ctx.mdm_active_bands_string); in mdm_hl7800_generate_status_events()
1393 event_handler(HL7800_EVENT_REVISION, iface_ctx.mdm_revision); in mdm_hl7800_generate_status_events()
1463 mdm_receiver_send(&iface_ctx.mdm_ctx, frag->data, frag->len); in send_data()
1474 mdm_receiver_send(&iface_ctx.mdm_ctx, EOF_PATTERN, strlen(EOF_PATTERN)); in send_data()
1702 out_len = net_buf_linearize(iface_ctx.mdm_manufacturer, in on_cmd_atcmdinfo_manufacturer()
1703 sizeof(iface_ctx.mdm_manufacturer) - 1, *buf, 0, in on_cmd_atcmdinfo_manufacturer()
1705 iface_ctx.mdm_manufacturer[out_len] = 0; in on_cmd_atcmdinfo_manufacturer()
1706 LOG_INF("Manufacturer: %s", iface_ctx.mdm_manufacturer); in on_cmd_atcmdinfo_manufacturer()
1737 out_len = net_buf_linearize(iface_ctx.mdm_model, sizeof(iface_ctx.mdm_model) - 1, in on_cmd_atcmdinfo_model()
1739 iface_ctx.mdm_model[out_len] = 0; in on_cmd_atcmdinfo_model()
1740 LOG_INF("Model: %s", iface_ctx.mdm_model); in on_cmd_atcmdinfo_model()
1771 iface_ctx.mdm_revision, sizeof(iface_ctx.mdm_revision) - 1, *buf, 0, len); in on_cmd_atcmdinfo_revision()
1772 iface_ctx.mdm_revision[out_len] = 0; in on_cmd_atcmdinfo_revision()
1773 LOG_INF("Revision: %s", iface_ctx.mdm_revision); in on_cmd_atcmdinfo_revision()
1774 event_handler(HL7800_EVENT_REVISION, iface_ctx.mdm_revision); in on_cmd_atcmdinfo_revision()
1804 out_len = net_buf_linearize(iface_ctx.mdm_imei, sizeof(iface_ctx.mdm_imei) - 1, in on_cmd_atcmdinfo_imei()
1806 iface_ctx.mdm_imei[out_len] = 0; in on_cmd_atcmdinfo_imei()
1808 LOG_INF("IMEI: %s", iface_ctx.mdm_imei); in on_cmd_atcmdinfo_imei()
1840 strncpy(iface_ctx.mdm_iccid, value, sizeof(iface_ctx.mdm_iccid)); in on_cmd_atcmdinfo_iccid()
1841 len = MIN(iccid_len, sizeof(iface_ctx.mdm_iccid) - 1); in on_cmd_atcmdinfo_iccid()
1842 iface_ctx.mdm_iccid[len] = '\0'; in on_cmd_atcmdinfo_iccid()
1848 LOG_INF("ICCID: %s", iface_ctx.mdm_iccid); in on_cmd_atcmdinfo_iccid()
1875 out_len = net_buf_linearize(iface_ctx.mdm_imsi, MDM_HL7800_IMSI_MAX_STR_SIZE, in on_cmd_atcmdinfo_imsi()
1877 iface_ctx.mdm_imsi[out_len] = 0; in on_cmd_atcmdinfo_imsi()
1879 if (strstr(iface_ctx.mdm_imsi, "ERROR") != NULL) { in on_cmd_atcmdinfo_imsi()
1881 memset(iface_ctx.mdm_imsi, 0, sizeof(iface_ctx.mdm_imsi)); in on_cmd_atcmdinfo_imsi()
1884 LOG_INF("IMSI: %s", iface_ctx.mdm_imsi); in on_cmd_atcmdinfo_imsi()
1899 iface_ctx.dns_v6_string, in dns_work_cb()
1902 iface_ctx.dns_v4_string, in dns_work_cb()
1908 net_ipaddr_parse(iface_ctx.dns_v6_string, strlen(iface_ctx.dns_v6_string), in dns_work_cb()
1912 strncpy(iface_ctx.dns_v6_string, iface_ctx.dns_v4_string, in dns_work_cb()
1913 sizeof(iface_ctx.dns_v6_string) - 1); in dns_work_cb()
1914 valid_address = net_ipaddr_parse(iface_ctx.dns_v6_string, in dns_work_cb()
1915 strlen(iface_ctx.dns_v6_string), &temp_addr); in dns_work_cb()
1919 net_ipaddr_parse(iface_ctx.dns_v4_string, strlen(iface_ctx.dns_v4_string), in dns_work_cb()
1925 } else if (iface_ctx.iface && net_if_is_up(iface_ctx.iface) && !iface_ctx.dns_ready) { in dns_work_cb()
1946 iface_ctx.dns_ready = true; in dns_work_cb()
1949 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.dns_work, in dns_work_cb()
1958 return iface_ctx.mdm_iccid; in mdm_hl7800_get_iccid()
1963 return iface_ctx.mdm_sn; in mdm_hl7800_get_sn()
1968 return iface_ctx.mdm_imei; in mdm_hl7800_get_imei()
1973 return iface_ctx.mdm_revision; in mdm_hl7800_get_fw_version()
1978 return iface_ctx.mdm_imsi; in mdm_hl7800_get_imsi()
2114 ret = net_addr_pton(AF_INET, temp_addr_str, &iface_ctx.subnet); in on_cmd_atcmdinfo_ipaddr()
2125 ret = net_addr_pton(AF_INET, temp_addr_str, &iface_ctx.gateway); in on_cmd_atcmdinfo_ipaddr()
2138 ret = strncmp(temp_addr_str, iface_ctx.dns_v4_string, addr_len); in on_cmd_atcmdinfo_ipaddr()
2140 iface_ctx.dns_ready = false; in on_cmd_atcmdinfo_ipaddr()
2142 strncpy(iface_ctx.dns_v4_string, addr_start, addr_len); in on_cmd_atcmdinfo_ipaddr()
2143 iface_ctx.dns_v4_string[addr_len] = 0; in on_cmd_atcmdinfo_ipaddr()
2144 ret = net_addr_pton(AF_INET, iface_ctx.dns_v4_string, &iface_ctx.dns_v4); in on_cmd_atcmdinfo_ipaddr()
2145 LOG_DBG("IPv4 DNS addr: %s", iface_ctx.dns_v4_string); in on_cmd_atcmdinfo_ipaddr()
2149 ret = strncmp(temp_addr_str, iface_ctx.dns_v6_string, addr_len); in on_cmd_atcmdinfo_ipaddr()
2151 iface_ctx.dns_ready = false; in on_cmd_atcmdinfo_ipaddr()
2154 strncpy(iface_ctx.dns_v6_string, addr_start, addr_len); in on_cmd_atcmdinfo_ipaddr()
2156 ret = hl7800_net_addr6_pton(iface_ctx.dns_v6_string, &iface_ctx.dns_v6); in on_cmd_atcmdinfo_ipaddr()
2157 net_addr_ntop(AF_INET6, &iface_ctx.dns_v6, iface_ctx.dns_v6_string, in on_cmd_atcmdinfo_ipaddr()
2158 sizeof(iface_ctx.dns_v6_string)); in on_cmd_atcmdinfo_ipaddr()
2159 LOG_DBG("IPv6 DNS addr: %s", iface_ctx.dns_v6_string); in on_cmd_atcmdinfo_ipaddr()
2167 if (iface_ctx.iface) { in on_cmd_atcmdinfo_ipaddr()
2173 net_if_ipv4_addr_rm(iface_ctx.iface, &iface_ctx.ipv4Addr); in on_cmd_atcmdinfo_ipaddr()
2175 if (!net_if_ipv4_addr_add(iface_ctx.iface, &new_ipv4_addr, in on_cmd_atcmdinfo_ipaddr()
2180 net_if_ipv4_set_netmask_by_addr(iface_ctx.iface, in on_cmd_atcmdinfo_ipaddr()
2182 &iface_ctx.subnet); in on_cmd_atcmdinfo_ipaddr()
2183 net_if_ipv4_set_gw(iface_ctx.iface, &iface_ctx.gateway); in on_cmd_atcmdinfo_ipaddr()
2186 net_ipaddr_copy(&iface_ctx.ipv4Addr, &new_ipv4_addr); in on_cmd_atcmdinfo_ipaddr()
2189 net_if_ipv6_addr_rm(iface_ctx.iface, &iface_ctx.ipv6Addr); in on_cmd_atcmdinfo_ipaddr()
2190 if (!net_if_ipv6_addr_add(iface_ctx.iface, &new_ipv6_addr, in on_cmd_atcmdinfo_ipaddr()
2199 if (!iface_ctx.initialized) { in on_cmd_atcmdinfo_ipaddr()
2205 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.dns_work, in on_cmd_atcmdinfo_ipaddr()
2244 iface_ctx.operator_status = NO_OPERATOR; in on_cmd_atcmdinfo_operator_status()
2262 iface_ctx.operator_status = REGISTERED; in on_cmd_atcmdinfo_operator_status()
2310 strncpy(iface_ctx.mdm_sn, val_start, sn_len); in on_cmd_atcmdinfo_serial_number()
2311 iface_ctx.mdm_sn[sn_len] = 0; in on_cmd_atcmdinfo_serial_number()
2312 LOG_INF("Serial #: %s", iface_ctx.mdm_sn); in on_cmd_atcmdinfo_serial_number()
2325 iface_ctx.mdm_rat = strtol(value, NULL, 10); in on_cmd_radio_tech_status()
2326 LOG_INF("+KSRAT: %d", iface_ctx.mdm_rat); in on_cmd_radio_tech_status()
2327 event_handler(HL7800_EVENT_RAT, &iface_ctx.mdm_rat); in on_cmd_radio_tech_status()
2342 if (value[0] != (iface_ctx.mdm_rat == MDM_RAT_CAT_M1 ? '0' : '1')) { in on_cmd_radio_band_configuration()
2350 memcpy(iface_ctx.mdm_bands_string, &value[MDM_TOP_BAND_START_POSITION], in on_cmd_radio_band_configuration()
2355 iface_ctx.mdm_bands_top = strtoul(n_tmp, NULL, 16); in on_cmd_radio_band_configuration()
2360 iface_ctx.mdm_bands_middle = strtoul(n_tmp, NULL, 16); in on_cmd_radio_band_configuration()
2365 iface_ctx.mdm_bands_bottom = strtoul(n_tmp, NULL, 16); in on_cmd_radio_band_configuration()
2368 iface_ctx.mdm_bands_top, iface_ctx.mdm_bands_middle, in on_cmd_radio_band_configuration()
2369 iface_ctx.mdm_bands_bottom); in on_cmd_radio_band_configuration()
2371 event_handler(HL7800_EVENT_BANDS, iface_ctx.mdm_bands_string); in on_cmd_radio_band_configuration()
2390 memcpy(iface_ctx.mdm_active_bands_string, in on_cmd_radio_active_bands()
2392 event_handler(HL7800_EVENT_ACTIVE_BANDS, iface_ctx.mdm_active_bands_string); in on_cmd_radio_active_bands()
2416 iface_ctx.mdm_startup_state = state; in set_startup_state()
2424 event.code = iface_ctx.mdm_startup_state; in generate_startup_state_event()
2425 event.string = get_startup_state_string(iface_ctx.mdm_startup_state); in generate_startup_state_event()
2440 iface_ctx.desired_sleep_level = level; in mdm_hl7800_set_desired_sleep_level()
2462 if (iface_ctx.desired_sleep_level == HL7800_SLEEP_UNINITIALIZED) { in initialize_sleep_level()
2464 iface_ctx.desired_sleep_level = HL7800_SLEEP_HIBERNATE; in initialize_sleep_level()
2466 iface_ctx.desired_sleep_level = HL7800_SLEEP_LITE_HIBERNATE; in initialize_sleep_level()
2468 iface_ctx.desired_sleep_level = HL7800_SLEEP_SLEEP; in initialize_sleep_level()
2470 iface_ctx.desired_sleep_level = HL7800_SLEEP_AWAKE; in initialize_sleep_level()
2486 switch (iface_ctx.desired_sleep_level) { in set_sleep_level()
2527 iface_ctx.sleep_state = state; in set_sleep_state()
2528 if (iface_ctx.sleep_state != HL7800_SLEEP_AWAKE) { in set_sleep_state()
2529 k_sem_reset(&iface_ctx.mdm_awake); in set_sleep_state()
2538 event.code = iface_ctx.sleep_state; in generate_sleep_state_event()
2539 event.string = get_sleep_state_string(iface_ctx.sleep_state); in generate_sleep_state_event()
2567 get_fota_state_string(iface_ctx.fw_update_state), in set_fota_state()
2569 iface_ctx.fw_update_state = state; in set_fota_state()
2577 event.code = iface_ctx.fw_update_state; in generate_fota_state_event()
2578 event.string = get_fota_state_string(iface_ctx.fw_update_state); in generate_fota_state_event()
2584 uint32_t count = iface_ctx.fw_packet_count * XMODEM_DATA_SIZE; in generate_fota_count_event()
2605 if (iface_ctx.fw_updated) { in on_cmd_startup_report()
2606 iface_ctx.fw_updated = false; in on_cmd_startup_report()
2609 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.mdm_reset_work, in on_cmd_startup_report()
2615 iface_ctx.wait_for_KSUP = false; in on_cmd_startup_report()
2616 iface_ctx.mdm_startup_reporting_on = true; in on_cmd_startup_report()
2617 iface_ctx.reconfig_IP_connection = true; in on_cmd_startup_report()
2622 k_sem_give(&iface_ctx.mdm_awake); in on_cmd_startup_report()
2664 iface_ctx.mdm_echo_is_on = (echo_state != 0); in profile_handler()
2715 memset(iface_ctx.mdm_apn.username, 0, in on_cmd_atcmdinfo_pdp_authentication_cfg()
2716 sizeof(iface_ctx.mdm_apn.username)); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2717 memset(iface_ctx.mdm_apn.password, 0, in on_cmd_atcmdinfo_pdp_authentication_cfg()
2718 sizeof(iface_ctx.mdm_apn.password)); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2728 iface_ctx.mdm_apn.username[i++] = *p++; in on_cmd_atcmdinfo_pdp_authentication_cfg()
2735 iface_ctx.mdm_apn.username); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2744 iface_ctx.mdm_apn.password[i++] = *p++; in on_cmd_atcmdinfo_pdp_authentication_cfg()
2748 iface_ctx.mdm_apn.password); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2781 memset(iface_ctx.mdm_apn.value, 0, sizeof(iface_ctx.mdm_apn.value)); in on_cmd_atcmdinfo_pdp_context()
2782 memset(iface_ctx.mdm_pdp_addr_fam, 0, MDM_ADDR_FAM_MAX_LEN); in on_cmd_atcmdinfo_pdp_context()
2793 iface_ctx.mdm_pdp_addr_fam[i++] = *p++; in on_cmd_atcmdinfo_pdp_context()
2796 if (strcmp(iface_ctx.mdm_pdp_addr_fam, ADDRESS_FAMILY_IP) == 0) { in on_cmd_atcmdinfo_pdp_context()
2797 snprintk(iface_ctx.mdm_pdp_addr_fam, in on_cmd_atcmdinfo_pdp_context()
2798 sizeof(iface_ctx.mdm_pdp_addr_fam), "%s", in on_cmd_atcmdinfo_pdp_context()
2802 LOG_DBG("PDP address family: %s", iface_ctx.mdm_pdp_addr_fam); in on_cmd_atcmdinfo_pdp_context()
2820 iface_ctx.mdm_apn.value[i++] = *p++; in on_cmd_atcmdinfo_pdp_context()
2824 LOG_INF("APN: %s", iface_ctx.mdm_apn.value); in on_cmd_atcmdinfo_pdp_context()
2851 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.rssi_query_work, in hl7800_start_rssi_work()
2859 rc = k_work_cancel_delayable(&iface_ctx.rssi_query_work); in hl7800_stop_rssi_work()
2881 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.rssi_query_work, in hl7800_rssi_query_work()
2933 if (iface_ctx.gps_query_location_rate_seconds) { in gps_work_callback()
2934 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.gps_work, in gps_work_callback()
2935 K_SECONDS(iface_ctx.gps_query_location_rate_seconds)); in gps_work_callback()
3287 sock = &iface_ctx.sockets[i]; in notify_all_tcp_sockets_closed()
3306 if (iface_ctx.off) { in iface_status_work_cb()
3308 } else if (!iface_ctx.initialized && iface_ctx.restarting) { in iface_status_work_cb()
3312 &iface_ctx.iface_status_work, in iface_status_work_cb()
3315 } else if (iface_ctx.wait_for_KSUP && in iface_status_work_cb()
3316 iface_ctx.wait_for_KSUP_tries < WAIT_FOR_KSUP_RETRIES) { in iface_status_work_cb()
3318 iface_ctx.wait_for_KSUP_tries++; in iface_status_work_cb()
3321 &iface_ctx.iface_status_work, in iface_status_work_cb()
3324 } else if (iface_ctx.wait_for_KSUP && in iface_status_work_cb()
3325 iface_ctx.wait_for_KSUP_tries >= WAIT_FOR_KSUP_RETRIES) { in iface_status_work_cb()
3328 iface_ctx.wait_for_KSUP = false; in iface_status_work_cb()
3336 state = iface_ctx.network_state; in iface_status_work_cb()
3338 if (iface_ctx.network_dropped) { in iface_status_work_cb()
3339 iface_ctx.network_dropped = false; in iface_status_work_cb()
3341 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.iface_status_work, in iface_status_work_cb()
3355 if (iface_ctx.iface) { in iface_status_work_cb()
3357 net_if_carrier_on(iface_ctx.iface); in iface_status_work_cb()
3362 if (iface_ctx.iface && (iface_ctx.low_power_mode != HL7800_LPM_PSM)) { in iface_status_work_cb()
3364 iface_ctx.dns_ready = false; in iface_status_work_cb()
3365 net_if_carrier_off(iface_ctx.iface); in iface_status_work_cb()
3370 if ((iface_ctx.iface && !net_if_is_up(iface_ctx.iface)) || in iface_status_work_cb()
3371 (iface_ctx.low_power_mode == HL7800_LPM_PSM && state == HL7800_OUT_OF_COVERAGE)) { in iface_status_work_cb()
3374 } else if (iface_ctx.iface && net_if_is_up(iface_ctx.iface)) { in iface_status_work_cb()
3407 iface_ctx.network_state = state; in set_network_state()
3415 event.code = iface_ctx.network_state; in generate_network_state_event()
3416 event.string = get_network_state_string(iface_ctx.network_state); in generate_network_state_event()
3417 LOG_INF("Network State: %d %s", iface_ctx.network_state, event.string); in generate_network_state_event()
3442 &iface_ctx.iface_status_work, in on_cmd_network_report_query()
3468 iface_ctx.operator_index = (uint8_t)strtol(carrier, NULL, 10); in on_cmd_operator_index_query()
3470 LOG_INF("Operator Index: %u", iface_ctx.operator_index); in on_cmd_operator_index_query()
3494 iface_ctx.functionality = strtol(rsp, NULL, 10); in on_cmd_modem_functionality()
3496 LOG_INF("Modem Functionality: %u", iface_ctx.functionality); in on_cmd_modem_functionality()
3577 iface_ctx.local_time_valid = false; in on_cmd_rtc_query()
3593 iface_ctx.local_time_valid = convert_time_string_to_struct( in on_cmd_rtc_query()
3594 &iface_ctx.local_time, &iface_ctx.local_time_offset, rtc_string); in on_cmd_rtc_query()
3682 out_len = net_buf_linearize(iface_ctx.mdm_network_status, in on_cmd_network_report()
3683 sizeof(iface_ctx.mdm_network_status) - 1, *buf, in on_cmd_network_report()
3685 iface_ctx.mdm_network_status[out_len] = 0; in on_cmd_network_report()
3686 LOG_DBG("Network status: %s", iface_ctx.mdm_network_status); in on_cmd_network_report()
3687 pos = strchr(iface_ctx.mdm_network_status, ','); in on_cmd_network_report()
3689 l = pos - iface_ctx.mdm_network_status; in on_cmd_network_report()
3690 strncpy(val, iface_ctx.mdm_network_status, l); in on_cmd_network_report()
3694 set_network_state(strtol(iface_ctx.mdm_network_status, NULL, 0)); in on_cmd_network_report()
3701 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.iface_status_work, in on_cmd_network_report()
3736 iface_ctx.mdm_rssi = strtol(value, NULL, 10); in on_cmd_atcmdinfo_rssi()
3738 iface_ctx.mdm_sinr = strtol(delims[3] + 1, NULL, 10); in on_cmd_atcmdinfo_rssi()
3745 LOG_INF("RSSI (RSRP): %d SINR: %d", iface_ctx.mdm_rssi, in on_cmd_atcmdinfo_rssi()
3746 iface_ctx.mdm_sinr); in on_cmd_atcmdinfo_rssi()
3747 event_handler(HL7800_EVENT_RSSI, &iface_ctx.mdm_rssi); in on_cmd_atcmdinfo_rssi()
3748 event_handler(HL7800_EVENT_SINR, &iface_ctx.mdm_sinr); in on_cmd_atcmdinfo_rssi()
3759 sock = socket_from_id(iface_ctx.last_socket_id); in on_cmd_sockok()
3760 if (!sock || !iface_ctx.socket_cmd) { in on_cmd_sockok()
3761 iface_ctx.last_error = 0; in on_cmd_sockok()
3762 k_sem_give(&iface_ctx.response_sem); in on_cmd_sockok()
3779 iface_ctx.last_error = 0; in on_cmd_sock_ind()
3826 sock = socket_from_id(iface_ctx.last_socket_id); in on_cmd_sockerror()
3828 iface_ctx.last_error = -EIO; in on_cmd_sockerror()
3829 k_sem_give(&iface_ctx.response_sem); in on_cmd_sockerror()
3850 sock = socket_from_id(iface_ctx.last_socket_id); in on_cmd_sock_error_code()
3852 iface_ctx.last_error = -EIO; in on_cmd_sock_error_code()
3853 k_sem_give(&iface_ctx.response_sem); in on_cmd_sock_error_code()
3932 iface_ctx.network_dropped = true; in on_cmd_sock_notif()
3950 if (iface_ctx.network_dropped) { in on_cmd_sock_notif()
3951 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.iface_status_work, in on_cmd_sock_notif()
4000 iface_ctx.last_socket_id = strtol(value, NULL, 10); in on_cmd_sockcreate()
4002 LOG_DBG("+KTCPCFG: %d", iface_ctx.last_socket_id); in on_cmd_sockcreate()
4004 LOG_DBG("+KUDPCFG: %d", iface_ctx.last_socket_id); in on_cmd_sockcreate()
4008 sock = socket_from_id(iface_ctx.last_socket_id); in on_cmd_sockcreate()
4013 if (queue_stale_socket(type, iface_ctx.last_socket_id) == 0) { in on_cmd_sockcreate()
4018 &iface_ctx.delete_untracked_socket_work, in on_cmd_sockcreate()
4025 sock->socket_id = iface_ctx.last_socket_id; in on_cmd_sockcreate()
4075 sock = socket_from_id(iface_ctx.last_socket_id); in sock_read()
4077 LOG_ERR("Socket not found! (%d)", iface_ctx.last_socket_id); in sock_read()
4227 sock = socket_from_id(iface_ctx.last_socket_id); in on_cmd_connect()
4229 LOG_ERR("Sock (%d) not found", iface_ctx.last_socket_id); in on_cmd_connect()
4258 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV4UDPH_LEN)) { in start_socket_rx()
4260 net_if_get_mtu(iface_ctx.iface) - NET_IPV4UDPH_LEN; in start_socket_rx()
4264 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV6UDPH_LEN)) { in start_socket_rx()
4266 net_if_get_mtu(iface_ctx.iface) - NET_IPV6UDPH_LEN; in start_socket_rx()
4273 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV4TCPH_LEN)) { in start_socket_rx()
4275 net_if_get_mtu(iface_ctx.iface) - NET_IPV4TCPH_LEN; in start_socket_rx()
4279 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV6TCPH_LEN)) { in start_socket_rx()
4281 net_if_get_mtu(iface_ctx.iface) - NET_IPV6TCPH_LEN; in start_socket_rx()
4394 iface_ctx.device_services_ind = strtol(value, NULL, 10); in on_cmd_device_service_ind()
4396 LOG_INF("+WDSI: %d", iface_ctx.device_services_ind); in on_cmd_device_service_ind()
4399 if (iface_ctx.device_services_ind == WDSI_PKG_DOWNLOADED) { in on_cmd_device_service_ind()
4401 &iface_ctx.finish_fw_update_work); in on_cmd_device_service_ind()
4425 ret = mdm_receiver_recv(&iface_ctx.mdm_ctx, uart_buffer, in hl7800_read_rx()
4466 iface_ctx.fw_updated = true; in finish_fw_update_work_callback()
4490 LOG_DBG("Send FW update packet %d,%d", pkt->id, iface_ctx.fw_packet_count); in send_fw_update_packet()
4491 return mdm_receiver_send(&iface_ctx.mdm_ctx, (const uint8_t *)pkt, in send_fw_update_packet()
4500 iface_ctx.fw_packet.id_complement = 0xFF - iface_ctx.fw_packet.id; in prepare_and_send_fw_packet()
4502 ret = fs_seek(&iface_ctx.fw_update_file, iface_ctx.file_pos, FS_SEEK_SET); in prepare_and_send_fw_packet()
4505 LOG_ERR("Could not seek to offset %d of file", iface_ctx.file_pos); in prepare_and_send_fw_packet()
4509 read_res = fs_read(&iface_ctx.fw_update_file, iface_ctx.fw_packet.data, in prepare_and_send_fw_packet()
4517 fs_close(&iface_ctx.fw_update_file); in prepare_and_send_fw_packet()
4520 iface_ctx.fw_packet.data[i] = XMODEM_PAD_VALUE; in prepare_and_send_fw_packet()
4524 iface_ctx.fw_packet.crc = in prepare_and_send_fw_packet()
4525 calc_fw_update_crc(iface_ctx.fw_packet.data, XMODEM_DATA_SIZE); in prepare_and_send_fw_packet()
4527 send_fw_update_packet(&iface_ctx.fw_packet); in prepare_and_send_fw_packet()
4529 iface_ctx.file_pos += read_res; in prepare_and_send_fw_packet()
4530 iface_ctx.fw_packet_count++; in prepare_and_send_fw_packet()
4531 iface_ctx.fw_packet.id++; in prepare_and_send_fw_packet()
4544 if (iface_ctx.fw_update_state == HL7800_FOTA_START) { in process_fw_update_rx()
4547 iface_ctx.file_pos = 0; in process_fw_update_rx()
4548 iface_ctx.fw_packet_count = 1; in process_fw_update_rx()
4549 iface_ctx.fw_packet.id = 1; in process_fw_update_rx()
4550 iface_ctx.fw_packet.preamble = XM_SOH_1K; in process_fw_update_rx()
4553 } else if (iface_ctx.fw_update_state == HL7800_FOTA_WIP) { in process_fw_update_rx()
4556 send_fw_update_packet(&iface_ctx.fw_packet); in process_fw_update_rx()
4560 if (iface_ctx.fw_update_state == HL7800_FOTA_WIP) { in process_fw_update_rx()
4563 } else if (iface_ctx.fw_update_state == HL7800_FOTA_PAD) { in process_fw_update_rx()
4565 mdm_receiver_send(&iface_ctx.mdm_ctx, &eot, sizeof(eot)); in process_fw_update_rx()
4673 (void)k_sem_take(&iface_ctx.mdm_ctx.rx_sem, K_FOREVER); in hl7800_rx()
4691 if ((iface_ctx.fw_update_state == HL7800_FOTA_START) || in hl7800_rx()
4692 (iface_ctx.fw_update_state == HL7800_FOTA_WIP) || in hl7800_rx()
4693 (iface_ctx.fw_update_state == HL7800_FOTA_PAD)) { in hl7800_rx()
4718 if (iface_ctx.search_no_id_resp) { in hl7800_rx()
4719 cmp_res = strncmp(iface_ctx.no_id_resp_cmd, in hl7800_rx()
4732 if (!iface_ctx.search_no_id_resp) { in hl7800_rx()
4754 iface_ctx.search_no_id_resp = false; in hl7800_rx()
4803 rc = pm_device_state_get(iface_ctx.mdm_ctx.uart_dev, &state); in shutdown_uart()
4809 uart_irq_rx_disable(iface_ctx.mdm_ctx.uart_dev); in shutdown_uart()
4810 rc = pm_device_action_run(iface_ctx.mdm_ctx.uart_dev, PM_DEVICE_ACTION_SUSPEND); in shutdown_uart()
4813 uart_irq_rx_enable(iface_ctx.mdm_ctx.uart_dev); in shutdown_uart()
4825 rc = pm_device_state_get(iface_ctx.mdm_ctx.uart_dev, &state); in power_on_uart()
4831 rc = pm_device_action_run(iface_ctx.mdm_ctx.uart_dev, PM_DEVICE_ACTION_RESUME); in power_on_uart()
4834 uart_irq_rx_disable(iface_ctx.mdm_ctx.uart_dev); in power_on_uart()
4836 uart_irq_rx_enable(iface_ctx.mdm_ctx.uart_dev); in power_on_uart()
4850 iface_ctx.wait_for_KSUP = true; in prepare_io_for_reset()
4851 iface_ctx.wait_for_KSUP_tries = 0; in prepare_io_for_reset()
4859 if (!iface_ctx.vgpio_state) { in mdm_vgpio_work_cb()
4860 if (iface_ctx.desired_sleep_level == HL7800_SLEEP_HIBERNATE || in mdm_vgpio_work_cb()
4861 iface_ctx.desired_sleep_level == HL7800_SLEEP_LITE_HIBERNATE) { in mdm_vgpio_work_cb()
4862 if (iface_ctx.sleep_state != iface_ctx.desired_sleep_level) { in mdm_vgpio_work_cb()
4863 set_sleep_state(iface_ctx.desired_sleep_level); in mdm_vgpio_work_cb()
4866 if (iface_ctx.iface && iface_ctx.initialized && in mdm_vgpio_work_cb()
4867 iface_ctx.low_power_mode != HL7800_LPM_PSM) { in mdm_vgpio_work_cb()
4868 net_if_carrier_off(iface_ctx.iface); in mdm_vgpio_work_cb()
4880 iface_ctx.vgpio_state = read_pin(1, &hl7800_cfg.gpio[MDM_VGPIO]); in mdm_vgpio_callback_isr()
4881 HL7800_IO_DBG_LOG("VGPIO:%d", iface_ctx.vgpio_state); in mdm_vgpio_callback_isr()
4882 if (!iface_ctx.vgpio_state) { in mdm_vgpio_callback_isr()
4884 if (!iface_ctx.restarting && iface_ctx.initialized) { in mdm_vgpio_callback_isr()
4885 iface_ctx.reconfig_IP_connection = true; in mdm_vgpio_callback_isr()
4888 if (iface_ctx.off) { in mdm_vgpio_callback_isr()
4909 k_work_submit_to_queue(&hl7800_workq, &iface_ctx.mdm_vgpio_work); in mdm_vgpio_callback_isr()
4918 iface_ctx.dsr_state = read_pin(1, &hl7800_cfg.gpio[MDM_UART_DSR]); in mdm_uart_dsr_callback_isr()
4919 HL7800_IO_DBG_LOG("MDM_UART_DSR:%d", iface_ctx.dsr_state); in mdm_uart_dsr_callback_isr()
4929 sock = &iface_ctx.sockets[i]; in mark_sockets_for_reconfig()
4944 iface_ctx.gpio6_state = read_pin(1, &hl7800_cfg.gpio[MDM_GPIO6]); in mdm_gpio6_callback_isr()
4945 HL7800_IO_DBG_LOG("MDM_GPIO6:%d", iface_ctx.gpio6_state); in mdm_gpio6_callback_isr()
4947 if (!iface_ctx.gpio6_state) { in mdm_gpio6_callback_isr()
4950 iface_ctx.wait_for_KSUP = true; in mdm_gpio6_callback_isr()
4951 iface_ctx.wait_for_KSUP_tries = 0; in mdm_gpio6_callback_isr()
4952 iface_ctx.reconfig_IP_connection = true; in mdm_gpio6_callback_isr()
4955 if (iface_ctx.off) { in mdm_gpio6_callback_isr()
4957 } else if (iface_ctx.vgpio_state) { in mdm_gpio6_callback_isr()
4969 if ((iface_ctx.gpio6_callback != NULL) && in mdm_gpio6_callback_isr()
4970 ((iface_ctx.desired_sleep_level == HL7800_SLEEP_HIBERNATE) || in mdm_gpio6_callback_isr()
4971 (iface_ctx.desired_sleep_level == HL7800_SLEEP_LITE_HIBERNATE))) { in mdm_gpio6_callback_isr()
4972 iface_ctx.gpio6_callback(iface_ctx.gpio6_state); in mdm_gpio6_callback_isr()
4986 iface_ctx.cts_state = read_pin(0, &hl7800_cfg.gpio[MDM_UART_CTS]); in mdm_uart_cts_callback_isr()
4990 elapsed = now - iface_ctx.last_cts_time; in mdm_uart_cts_callback_isr()
4991 if (iface_ctx.last_cts_time <= 0) { in mdm_uart_cts_callback_isr()
4995 iface_ctx.last_cts_time = now; in mdm_uart_cts_callback_isr()
4998 iface_ctx.last_cts_time = now; in mdm_uart_cts_callback_isr()
5001 if (iface_ctx.cts_state != resample_state) { in mdm_uart_cts_callback_isr()
5003 iface_ctx.cts_state = resample_state; in mdm_uart_cts_callback_isr()
5006 iface_ctx.cts_state = resample_state; in mdm_uart_cts_callback_isr()
5007 if (iface_ctx.cts_state != iface_ctx.last_cts_state) { in mdm_uart_cts_callback_isr()
5008 iface_ctx.last_cts_state = iface_ctx.cts_state; in mdm_uart_cts_callback_isr()
5013 HL7800_IO_DBG_LOG("MDM_UART_CTS:%d(%llu)", iface_ctx.cts_state, elapsed); in mdm_uart_cts_callback_isr()
5016 if (iface_ctx.cts_state && iface_ctx.allow_sleep) { in mdm_uart_cts_callback_isr()
5023 if (iface_ctx.off) { in mdm_uart_cts_callback_isr()
5026 if (iface_ctx.vgpio_state && iface_ctx.gpio6_state) { in mdm_uart_cts_callback_isr()
5038 if ((iface_ctx.cts_callback != NULL) && in mdm_uart_cts_callback_isr()
5039 (iface_ctx.desired_sleep_level == HL7800_SLEEP_SLEEP)) { in mdm_uart_cts_callback_isr()
5040 iface_ctx.cts_callback(iface_ctx.cts_state); in mdm_uart_cts_callback_isr()
5056 iface_ctx.mdm_startup_reporting_on = false; in modem_reset()
5062 if (iface_ctx.fw_update_state == HL7800_FOTA_REBOOT_AND_RECONFIGURE) { in modem_reset()
5068 k_sem_reset(&iface_ctx.mdm_awake); in modem_reset()
5069 iface_ctx.off = true; in modem_reset()
5075 iface_ctx.off = false; in modem_run()
5086 ret = k_sem_take(&iface_ctx.mdm_awake, MDM_BOOT_TIME); in modem_boot_handler()
5088 LOG_WRN("Err waiting for boot: %d, DSR: %u", ret, iface_ctx.dsr_state); in modem_boot_handler()
5102 iface_ctx.mdm_echo_is_on = true; in modem_boot_handler()
5105 if (iface_ctx.mdm_echo_is_on) { in modem_boot_handler()
5118 __ASSERT(!iface_ctx.mdm_echo_is_on, "Echo should be off"); in modem_boot_handler()
5194 snprintk(cmd, sizeof(cmd), "AT+KBNDCFG=%d,%s", iface_ctx.mdm_rat, bands); in set_bands()
5209 k_work_reschedule_for_queue(&hl7800_workq, &iface_ctx.mdm_reset_work, K_NO_WAIT); in set_bands()
5238 if (strncmp(temp_bands, iface_ctx.mdm_bands_string, sizeof(temp_bands)) == 0) { in mdm_hl7800_set_bands()
5273 iface_ctx.restarting = true; in modem_reset_and_configure()
5274 iface_ctx.dns_ready = false; in modem_reset_and_configure()
5275 if (iface_ctx.iface) { in modem_reset_and_configure()
5276 net_if_carrier_off(iface_ctx.iface); in modem_reset_and_configure()
5286 if (!iface_ctx.mdm_startup_reporting_on) { in modem_reset_and_configure()
5304 ret = compare_versions(iface_ctx.mdm_revision, NEW_RAT_CMD_MIN_VERSION); in modem_reset_and_configure()
5306 iface_ctx.new_rat_cmd_support = false; in modem_reset_and_configure()
5308 iface_ctx.new_rat_cmd_support = true; in modem_reset_and_configure()
5320 if (!iface_ctx.configured) { in modem_reset_and_configure()
5322 if (iface_ctx.mdm_rat != MDM_RAT_CAT_M1) { in modem_reset_and_configure()
5323 if (iface_ctx.new_rat_cmd_support) { in modem_reset_and_configure()
5334 if (iface_ctx.mdm_rat != MDM_RAT_CAT_NB1) { in modem_reset_and_configure()
5335 if (iface_ctx.new_rat_cmd_support) { in modem_reset_and_configure()
5415 if (iface_ctx.mdm_bands_top != bands_top || in modem_reset_and_configure()
5416 iface_ctx.mdm_bands_middle != bands_middle || in modem_reset_and_configure()
5417 iface_ctx.mdm_bands_bottom != bands_bottom) { in modem_reset_and_configure()
5418 if (iface_ctx.mdm_bands_top != bands_top) { in modem_reset_and_configure()
5420 bands_top, iface_ctx.mdm_bands_top); in modem_reset_and_configure()
5422 if (iface_ctx.mdm_bands_middle != bands_middle) { in modem_reset_and_configure()
5424 bands_middle, iface_ctx.mdm_bands_middle); in modem_reset_and_configure()
5426 if (iface_ctx.mdm_bands_bottom != bands_bottom) { in modem_reset_and_configure()
5428 bands_bottom, iface_ctx.mdm_bands_bottom); in modem_reset_and_configure()
5449 iface_ctx.low_power_mode = HL7800_LPM_NONE; in modem_reset_and_configure()
5460 iface_ctx.low_power_mode = HL7800_LPM_PSM; in modem_reset_and_configure()
5466 iface_ctx.low_power_mode = HL7800_LPM_EDRX; in modem_reset_and_configure()
5471 if (iface_ctx.mdm_rat == MDM_RAT_CAT_NB1) { in modem_reset_and_configure()
5504 if (iface_ctx.mdm_startup_state != HL7800_STARTUP_STATE_SIM_NOT_PRESENT) { in modem_reset_and_configure()
5515 apn = iface_ctx.mdm_apn.value; in modem_reset_and_configure()
5516 if (strcmp(iface_ctx.mdm_pdp_addr_fam, MODEM_HL7800_ADDRESS_FAMILY)) { in modem_reset_and_configure()
5527 if (!iface_ctx.configured) { in modem_reset_and_configure()
5528 if (strncmp(iface_ctx.mdm_apn.value, CONFIG_MODEM_HL7800_APN_NAME, in modem_reset_and_configure()
5545 ret = setup_gprs_connection(iface_ctx.mdm_apn.value); in modem_reset_and_configure()
5571 iface_ctx.restarting = false; in modem_reset_and_configure()
5572 iface_ctx.configured = true; in modem_reset_and_configure()
5576 event_handler(HL7800_EVENT_APN_UPDATE, &iface_ctx.mdm_apn); in modem_reset_and_configure()
5579 if (!iface_ctx.initialized) { in modem_reset_and_configure()
5580 if (iface_ctx.iface != NULL) { in modem_reset_and_configure()
5581 hl7800_build_mac(&iface_ctx); in modem_reset_and_configure()
5582 net_if_set_link_addr(iface_ctx.iface, iface_ctx.mac_addr, in modem_reset_and_configure()
5583 sizeof(iface_ctx.mac_addr), in modem_reset_and_configure()
5585 iface_ctx.initialized = true; in modem_reset_and_configure()
5594 iface_ctx.configured = false; in modem_reset_and_configure()
5662 iface_ctx.dns_ready = false; in mdm_power_off_work_callback()
5663 iface_ctx.configured = false; in mdm_power_off_work_callback()
5664 iface_ctx.off = true; in mdm_power_off_work_callback()
5667 if (iface_ctx.iface) { in mdm_power_off_work_callback()
5668 net_if_carrier_off(iface_ctx.iface); in mdm_power_off_work_callback()
5680 k_work_cancel_delayable(&iface_ctx.iface_status_work); in hl7800_power_off()
5681 k_work_cancel_delayable(&iface_ctx.dns_work); in hl7800_power_off()
5682 k_work_cancel_delayable(&iface_ctx.mdm_reset_work); in hl7800_power_off()
5683 k_work_cancel_delayable(&iface_ctx.allow_sleep_work); in hl7800_power_off()
5684 k_work_cancel_delayable(&iface_ctx.delete_untracked_socket_work); in hl7800_power_off()
5685 (void)k_work_submit_to_queue(&hl7800_workq, &iface_ctx.mdm_pwr_off_work); in hl7800_power_off()
5857 if (iface_ctx.reconfig_IP_connection) { in reconfigure_IP_connection()
5858 iface_ctx.reconfig_IP_connection = false; in reconfigure_IP_connection()
5861 ret = setup_gprs_connection(iface_ctx.mdm_apn.value); in reconfigure_IP_connection()
5900 (*context)->iface = net_if_get_by_iface(iface_ctx.iface); in offload_get()
6275 ret = fs_open(&iface_ctx.fw_update_file, file_path, FS_O_READ); in mdm_hl7800_update_fw()
6289 k_work_cancel_delayable(&iface_ctx.iface_status_work); in mdm_hl7800_update_fw()
6290 k_work_cancel_delayable(&iface_ctx.dns_work); in mdm_hl7800_update_fw()
6291 k_work_cancel_delayable(&iface_ctx.mdm_reset_work); in mdm_hl7800_update_fw()
6292 k_work_cancel_delayable(&iface_ctx.allow_sleep_work); in mdm_hl7800_update_fw()
6293 k_work_cancel_delayable(&iface_ctx.delete_untracked_socket_work); in mdm_hl7800_update_fw()
6294 iface_ctx.dns_ready = false; in mdm_hl7800_update_fw()
6295 if (iface_ctx.iface) { in mdm_hl7800_update_fw()
6297 net_if_carrier_off(iface_ctx.iface); in mdm_hl7800_update_fw()
6326 iface_ctx.cts_state = iface_ctx.last_cts_state = 0; in hl7800_init()
6332 iface_ctx.iface = net_if_get_default(); in hl7800_init()
6333 if (iface_ctx.iface == NULL) { in hl7800_init()
6337 net_if_carrier_off(iface_ctx.iface); in hl7800_init()
6341 iface_ctx.sockets[i].socket_id = MDM_INVALID_SOCKET_ID; in hl7800_init()
6342 k_work_init(&iface_ctx.sockets[i].recv_cb_work, in hl7800_init()
6344 k_work_init(&iface_ctx.sockets[i].rx_data_work, in hl7800_init()
6346 k_work_init_delayable(&iface_ctx.sockets[i].notif_work, in hl7800_init()
6348 k_sem_init(&iface_ctx.sockets[i].sock_send_sem, 0, 1); in hl7800_init()
6350 iface_ctx.last_socket_id = 0; in hl7800_init()
6351 k_sem_init(&iface_ctx.response_sem, 0, 1); in hl7800_init()
6352 k_sem_init(&iface_ctx.mdm_awake, 0, 1); in hl7800_init()
6360 k_work_init_delayable(&iface_ctx.rssi_query_work, hl7800_rssi_query_work); in hl7800_init()
6361 k_work_init_delayable(&iface_ctx.iface_status_work, iface_status_work_cb); in hl7800_init()
6362 k_work_init_delayable(&iface_ctx.dns_work, dns_work_cb); in hl7800_init()
6363 k_work_init(&iface_ctx.mdm_vgpio_work, mdm_vgpio_work_cb); in hl7800_init()
6364 k_work_init_delayable(&iface_ctx.mdm_reset_work, mdm_reset_work_callback); in hl7800_init()
6365 k_work_init_delayable(&iface_ctx.allow_sleep_work, in hl7800_init()
6367 k_work_init_delayable(&iface_ctx.delete_untracked_socket_work, in hl7800_init()
6369 k_work_init(&iface_ctx.mdm_pwr_off_work, mdm_power_off_work_callback); in hl7800_init()
6372 k_work_init_delayable(&iface_ctx.gps_work, gps_work_callback); in hl7800_init()
6376 k_work_init(&iface_ctx.finish_fw_update_work, in hl7800_init()
6378 iface_ctx.fw_updated = false; in hl7800_init()
6458 gpio_init_callback(&iface_ctx.mdm_vgpio_cb, mdm_vgpio_callback_isr, in hl7800_init()
6461 &iface_ctx.mdm_vgpio_cb); in hl7800_init()
6473 gpio_init_callback(&iface_ctx.mdm_uart_dsr_cb, mdm_uart_dsr_callback_isr, in hl7800_init()
6476 &iface_ctx.mdm_uart_dsr_cb); in hl7800_init()
6488 gpio_init_callback(&iface_ctx.mdm_gpio6_cb, mdm_gpio6_callback_isr, in hl7800_init()
6491 &iface_ctx.mdm_gpio6_cb); in hl7800_init()
6503 gpio_init_callback(&iface_ctx.mdm_uart_cts_cb, mdm_uart_cts_callback_isr, in hl7800_init()
6506 &iface_ctx.mdm_uart_cts_cb); in hl7800_init()
6518 iface_ctx.mdm_ctx.data_manufacturer = iface_ctx.mdm_manufacturer; in hl7800_init()
6519 iface_ctx.mdm_ctx.data_model = iface_ctx.mdm_model; in hl7800_init()
6520 iface_ctx.mdm_ctx.data_revision = iface_ctx.mdm_revision; in hl7800_init()
6522 iface_ctx.mdm_ctx.data_imei = iface_ctx.mdm_imei; in hl7800_init()
6524 iface_ctx.mdm_ctx.data_rssi = &iface_ctx.mdm_rssi; in hl7800_init()
6526 ret = mdm_receiver_register(&iface_ctx.mdm_ctx, MDM_UART_DEV, in hl7800_init()
6533 k_queue_init(&iface_ctx.stale_socket_queue); in hl7800_init()
6561 hl7800_build_mac(&iface_ctx); in offload_iface_init()
6562 net_if_set_link_addr(iface, iface_ctx.mac_addr, sizeof(iface_ctx.mac_addr), in offload_iface_init()
6564 iface_ctx.initialized = true; in offload_iface_init()
6572 NET_DEVICE_DT_INST_OFFLOAD_DEFINE(0, hl7800_init, NULL, &iface_ctx,