Lines Matching +full:line +full:- +full:idle +full:- +full:low

4  * SPDX-License-Identifier: Apache-2.0
216 #define SIZE_WITHOUT_NUL(v) (sizeof(v) - SIZE_OF_NUL)
220 .cmd = cmd_, .cmd_len = (uint16_t)sizeof(cmd_) - 1, \
249 #define RSSI_UNKNOWN -999
293 /* The ? can be a + or - */
300 #define TIME_STRING_TO_TM_STRUCT_YEAR_OFFSET (2000 - 1900)
372 static const char EOF_PATTERN[] = "--EOF--Pattern--";
594 sock->allocated = true; in alloc_stale_socket()
605 sock->allocated = false; in free_stale_socket()
616 sock->type = type; in queue_stale_socket()
617 sock->id = id; in queue_stale_socket()
621 ret = -ENOMEM; in queue_stale_socket()
642 int state = gpio_pin_get_raw(spec->port, spec->pin); in read_pin()
646 spec->port->name, spec->pin, state); in read_pin()
814 sock->context = NULL; in socket_put()
815 sock->socket_id = -1; in socket_put()
816 sock->created = false; in socket_put()
817 sock->reconfig = false; in socket_put()
818 sock->error = 0; in socket_put()
819 sock->rx_size = 0; in socket_put()
820 sock->state = SOCK_IDLE; in socket_put()
821 (void)memset(&sock->src, 0, sizeof(struct sockaddr)); in socket_put()
822 (void)memset(&sock->dst, 0, sizeof(struct sockaddr)); in socket_put()
830 if (addr->sa_family == AF_INET6) { in hl7800_sprint_ip_addr()
831 return net_addr_ntop(AF_INET6, &net_sin6(addr)->sin6_addr, buf, in hl7800_sprint_ip_addr()
836 if (addr->sa_family == AF_INET) { in hl7800_sprint_ip_addr()
837 return net_addr_ntop(AF_INET, &net_sin(addr)->sin_addr, buf, in hl7800_sprint_ip_addr()
842 LOG_ERR("Unknown IP address family:%d", addr->sa_family); in hl7800_sprint_ip_addr()
867 HL7800_IO_DBG_LOG("MDM_WAKE_PIN -> ASSERTED"); in modem_assert_wake()
870 HL7800_IO_DBG_LOG("MDM_WAKE_PIN -> NOT_ASSERTED"); in modem_assert_wake()
884 HL7800_IO_DBG_LOG("MDM_PWR_ON -> ASSERTED"); in modem_assert_pwr_on()
887 HL7800_IO_DBG_LOG("MDM_PWR_ON -> NOT_ASSERTED"); in modem_assert_pwr_on()
895 HL7800_IO_DBG_LOG("MDM_FAST_SHUTD -> ASSERTED"); in modem_assert_fast_shutd()
898 HL7800_IO_DBG_LOG("MDM_FAST_SHUTD -> NOT_ASSERTED"); in modem_assert_fast_shutd()
936 if (agent->event_callback != NULL) { in event_handler()
937 agent->event_callback(event, event_data); in event_handler()
971 sock->error = 0; in send_at_cmd()
972 k_sem_reset(&sock->sock_send_sem); in send_at_cmd()
973 iface_ctx.last_socket_id = sock->socket_id; in send_at_cmd()
977 sizeof(iface_ctx.no_id_resp_cmd) - 1); in send_at_cmd()
992 ret = k_sem_take(&sock->sock_send_sem, timeout); in send_at_cmd()
997 ret = sock->error; in send_at_cmd()
1001 } else if (ret == -EAGAIN) { in send_at_cmd()
1002 ret = -ETIMEDOUT; in send_at_cmd()
1005 retries--; in send_at_cmd()
1045 return -EINVAL; in mdm_hl7800_send_at_cmd()
1058 * non-volatile memory.
1062 int ret = -EINVAL; in mdm_hl7800_update_apn()
1072 /* After a reset the APN will be re-read from the modem in mdm_hl7800_update_apn()
1091 int ret = -EINVAL; in mdm_hl7800_update_rat()
1151 ret = -EIO; in mdm_hl7800_get_local_time()
1213 int ret = -1; in mdm_hl7800_set_gps_rate()
1219 /* Stopping first allows changing the rate between two non-zero values. in mdm_hl7800_set_gps_rate()
1259 int ret = -1; in mdm_hl7800_polte_register()
1277 int ret = -1; in mdm_hl7800_polte_enable()
1300 int ret = -1; in mdm_hl7800_polte_locate()
1374 return -EINVAL; in send_data()
1377 sock->error = 0; in send_data()
1378 sock->state = SOCK_TX; in send_data()
1380 frag = pkt->frags; in send_data()
1383 k_sem_reset(&sock->sock_send_sem); in send_data()
1384 if (sock->type == SOCK_STREAM) { in send_data()
1385 snprintk(buf, sizeof(buf), "AT+KTCPSND=%d,%zu", sock->socket_id, in send_data()
1388 if (!net_addr_ntop(sock->family, &net_sin(&sock->dst)->sin_addr, in send_data()
1391 return -EINVAL; in send_data()
1394 sock->socket_id, dst_addr, in send_data()
1395 net_sin(&sock->dst)->sin_port, send_len); in send_data()
1400 ret = k_sem_take(&sock->sock_send_sem, MDM_IP_SEND_RX_TIMEOUT); in send_data()
1406 if (sock->error != 0) { in send_data()
1407 ret = sock->error; in send_data()
1414 actual_send_len += frag->len; in send_data()
1415 mdm_receiver_send(&iface_ctx.mdm_ctx, frag->data, frag->len); in send_data()
1416 frag = frag->frags; in send_data()
1425 k_sem_reset(&sock->sock_send_sem); in send_data()
1427 ret = k_sem_take(&sock->sock_send_sem, MDM_IP_SEND_RX_TIMEOUT); in send_data()
1429 ret = sock->error; in send_data()
1430 } else if (ret == -EAGAIN) { in send_data()
1431 ret = -ETIMEDOUT; in send_data()
1434 if (sock->type == SOCK_STREAM) { in send_data()
1435 if (sock->error == 0) { in send_data()
1436 sock->state = SOCK_CONNECTED; in send_data()
1439 sock->state = SOCK_IDLE; in send_data()
1459 while (*buf && is_crlf(*(*buf)->data)) { in net_buf_skipcrlf()
1461 if (!(*buf)->len) { in net_buf_skipcrlf()
1471 while (buf && !is_crlf(*(buf->data + pos))) { in net_buf_findcrlf()
1472 if (pos + 1 >= buf->len) { in net_buf_findcrlf()
1473 len += buf->len; in net_buf_findcrlf()
1474 buf = buf->frags; in net_buf_findcrlf()
1481 if (buf && is_crlf(*(buf->data + pos))) { in net_buf_findcrlf()
1494 if (!(*buf)->len) { in net_buf_get_u8()
1506 to_remove = (*buf)->len; in net_buf_remove()
1512 len -= to_remove; in net_buf_remove()
1513 if (!(*buf)->len) { in net_buf_remove()
1539 &((struct sockaddr_in6 *)&sock->dst)->sin6_addr, in pkt_setup_ip_data()
1540 &((struct sockaddr_in6 *)&sock->src)->sin6_addr)) { in pkt_setup_ip_data()
1541 return -1; in pkt_setup_ip_data()
1543 src_port = ntohs(net_sin6(&sock->src)->sin6_port); in pkt_setup_ip_data()
1544 dst_port = ntohs(net_sin6(&sock->dst)->sin6_port); in pkt_setup_ip_data()
1552 pkt, &((struct sockaddr_in *)&sock->dst)->sin_addr, in pkt_setup_ip_data()
1553 &((struct sockaddr_in *)&sock->src)->sin_addr)) { in pkt_setup_ip_data()
1554 return -1; in pkt_setup_ip_data()
1556 src_port = ntohs(net_sin(&sock->src)->sin_port); in pkt_setup_ip_data()
1557 dst_port = ntohs(net_sin(&sock->dst)->sin_port); in pkt_setup_ip_data()
1564 if (sock->ip_proto == IPPROTO_UDP) { in pkt_setup_ip_data()
1566 return -1; in pkt_setup_ip_data()
1573 if (sock->ip_proto == IPPROTO_TCP) { in pkt_setup_ip_data()
1578 return -1; in pkt_setup_ip_data()
1584 tcp->src_port = dst_port; in pkt_setup_ip_data()
1585 tcp->dst_port = src_port; in pkt_setup_ip_data()
1588 return -1; in pkt_setup_ip_data()
1629 int len_no_null = MDM_MANUFACTURER_LENGTH - 1; in on_cmd_atcmdinfo_manufacturer()
1651 sizeof(iface_ctx.mdm_manufacturer) - 1, *buf, 0, in on_cmd_atcmdinfo_manufacturer()
1664 int len_no_null = MDM_MODEL_LENGTH - 1; in on_cmd_atcmdinfo_model()
1685 out_len = net_buf_linearize(iface_ctx.mdm_model, sizeof(iface_ctx.mdm_model) - 1, in on_cmd_atcmdinfo_model()
1719 iface_ctx.mdm_revision, sizeof(iface_ctx.mdm_revision) - 1, *buf, 0, len); in on_cmd_atcmdinfo_revision()
1752 out_len = net_buf_linearize(iface_ctx.mdm_imei, sizeof(iface_ctx.mdm_imei) - 1, in on_cmd_atcmdinfo_imei()
1789 len = MIN(iccid_len, sizeof(iface_ctx.mdm_iccid) - 1); in on_cmd_atcmdinfo_iccid()
1925 return -EINVAL; in hl7800_net_addr6_pton()
1931 return -EINVAL; in hl7800_net_addr6_pton()
1938 return -EINVAL; in hl7800_net_addr6_pton()
1941 UNALIGNED_PUT(htons(ipv6_section), &dst->s6_addr16[i]); in hl7800_net_addr6_pton()
1947 if (i < num_sections - 1) { in hl7800_net_addr6_pton()
1948 return -EINVAL; in hl7800_net_addr6_pton()
1995 addr_len = delims[3] - delims[2]; in on_cmd_atcmdinfo_ipaddr()
2021 addr_len = sm_start - addr_start; in on_cmd_atcmdinfo_ipaddr()
2039 addr_len = delims[3] - sm_start; in on_cmd_atcmdinfo_ipaddr()
2050 addr_len = delims[4] - addr_start; in on_cmd_atcmdinfo_ipaddr()
2062 addr_len = delims[5] - addr_start; in on_cmd_atcmdinfo_ipaddr()
2228 sn_len = len - (val_start - value); in on_cmd_atcmdinfo_serial_number()
2325 /* clang-format off */ in get_startup_state_string()
2337 /* clang-format on */ in get_startup_state_string()
2358 int r = -EPERM; in mdm_hl7800_set_desired_sleep_level()
2370 r = -EINVAL; in mdm_hl7800_set_desired_sleep_level()
2438 /* clang-format off */ in get_sleep_state_string()
2448 /* clang-format on */ in get_sleep_state_string()
2473 /* clang-format off */ in get_fota_state_string()
2475 PREFIXED_SWITCH_CASE_RETURN_STRING(HL7800_FOTA, IDLE); in get_fota_state_string()
2487 /* clang-format on */ in get_fota_state_string()
2492 LOG_INF("FOTA state: %s->%s", in set_fota_state()
2558 int echo_state = -1; in profile_handler()
2561 char line[MAX_PROFILE_LINE_LENGTH]; in profile_handler() local
2575 memset(line, 0, sizeof(line)); in profile_handler()
2576 output_length = net_buf_linearize(line, SIZE_WITHOUT_NUL(line), in profile_handler()
2578 LOG_DBG("length: %u: %s", line_length, line); in profile_handler()
2580 /* Echo on off is the first thing on the line: E0, E1 */ in profile_handler()
2582 echo_state = (line[1] == '1') ? 1 : 0; in profile_handler()
2593 /* Discard next line. This waits for the longest possible response even in profile_handler()
2626 char line[MDM_HL7800_APN_CMD_MAX_SIZE]; in on_cmd_atcmdinfo_pdp_authentication_cfg() local
2636 memset(line, 0, sizeof(line)); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2637 output_length = net_buf_linearize(line, SIZE_WITHOUT_NUL(line), in on_cmd_atcmdinfo_pdp_authentication_cfg()
2639 LOG_DBG("length: %u: %s", line_length, line); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2647 p = strchr(line, '"'); in on_cmd_atcmdinfo_pdp_authentication_cfg()
2688 char line[MDM_HL7800_APN_CMD_MAX_SIZE]; in on_cmd_atcmdinfo_pdp_context() local
2698 memset(line, 0, sizeof(line)); in on_cmd_atcmdinfo_pdp_context()
2699 output_length = net_buf_linearize(line, SIZE_WITHOUT_NUL(line), in on_cmd_atcmdinfo_pdp_context()
2701 LOG_DBG("length: %u: %s", line_length, line); in on_cmd_atcmdinfo_pdp_context()
2707 p = strchr(line, ','); in on_cmd_atcmdinfo_pdp_context()
2771 * when going from network down->up in hl7800_start_rssi_work()
2800 /* re-start RSSI query work */ in hl7800_rssi_query_work()
2817 int8_t event = -1; in on_cmd_gps_event()
2818 int8_t status = -1; in on_cmd_gps_event()
2867 * Altitude: "-1 m"
2880 * Since each response is on its own line, the command handler is used
2888 size_t gps_len = sizeof(gps_str) - 1; in gps_handler()
2972 size_t rsp_len = sizeof(rsp) - 1; in on_cmd_polte_registration()
3050 data.status = -1; in on_cmd_polte_registration()
3063 size_t rsp_len = sizeof(rsp) - 1; in on_cmd_polte_locate_cmd_rsp()
3072 data.status = -1; in on_cmd_polte_locate_cmd_rsp()
3103 size_t rsp_len = sizeof(rsp) - 1; in on_cmd_polte_location()
3134 data.status = -1; in on_cmd_polte_location()
3156 memcpy(data.latitude, start, MIN(end - start, sizeof(data.latitude) - 1)); in on_cmd_polte_location()
3164 memcpy(data.longitude, start, MIN(end - start, sizeof(data.longitude) - 1)); in on_cmd_polte_location()
3181 MIN(end - start, sizeof(data.confidence_in_meters) - 1)); in on_cmd_polte_location()
3208 if ((sock->context != NULL) && (sock->type == SOCK_STREAM)) { in notify_all_tcp_sockets_closed()
3209 LOG_DBG("Sock %d closed", sock->socket_id); in notify_all_tcp_sockets_closed()
3211 if (sock->recv_cb) { in notify_all_tcp_sockets_closed()
3212 sock->recv_cb(sock->context, sock->recv_pkt, in notify_all_tcp_sockets_closed()
3214 sock->recv_user_data); in notify_all_tcp_sockets_closed()
3257 /* Ensure we bring the network interface down and then re-check the current state */ in iface_status_work_cb()
3341 * [,[<cause_type>],[<reject_cause>] [,[<Active-Time>],[<Periodic-TAU>]]]]
3354 l = (value + out_len) - pos; in on_cmd_network_report_query()
3421 * %MEAS: EARFCN=5826, CellID=420, RSRP=-99, RSRQ=-15
3422 * %MEAS: EARFCN=6400, CellID=201, RSRP=-93, RSRQ=-21
3427 char response[sizeof("EARFCN=XXXXXXXXXXX, CellID=XXXXXXXXXXX, RSRP=-XXX, RSRQ=-XXX")]; in on_cmd_survey_status()
3492 size_t str_len = sizeof(TIME_STRING_FORMAT) - 1; in on_cmd_rtc_query()
3535 if ((time_string[i] == '+' || time_string[i] == '-') && in valid_time_string()
3572 tm->tm_year = TIME_STRING_TO_TM_STRUCT_YEAR_OFFSET + in convert_time_string_to_struct()
3574 tm->tm_mon = in convert_time_string_to_struct()
3575 get_next_time_string_digit(&fc, &ptr, TM_MONTH_RANGE_PLUS_1) - in convert_time_string_to_struct()
3577 tm->tm_mday = get_next_time_string_digit(&fc, &ptr, TM_DAY_RANGE); in convert_time_string_to_struct()
3578 tm->tm_hour = get_next_time_string_digit(&fc, &ptr, TM_HOUR_RANGE); in convert_time_string_to_struct()
3579 tm->tm_min = get_next_time_string_digit(&fc, &ptr, TM_MIN_RANGE); in convert_time_string_to_struct()
3580 tm->tm_sec = get_next_time_string_digit(&fc, &ptr, TM_SEC_RANGE); in convert_time_string_to_struct()
3581 tm->tm_isdst = 0; in convert_time_string_to_struct()
3585 if (time_string[TIME_STRING_PLUS_MINUS_INDEX] == '-') { in convert_time_string_to_struct()
3586 *offset *= -1; in convert_time_string_to_struct()
3592 * [,[<cause_type>],[<reject_cause>] [,[<Active-Time>],[<Periodic-TAU>]]]]
3602 sizeof(iface_ctx.mdm_network_status) - 1, *buf, in on_cmd_network_report()
3608 l = pos - iface_ctx.mdm_network_status; in on_cmd_network_report()
3657 if ((delims[1] - delims[0]) == 1) { in on_cmd_atcmdinfo_rssi()
3682 sock->error = 0; in on_cmd_sockok()
3683 k_sem_give(&sock->sock_send_sem); in on_cmd_sockok()
3713 sock->error = 0; in on_cmd_sock_ind()
3714 k_sem_give(&sock->sock_send_sem); in on_cmd_sock_ind()
3746 iface_ctx.last_error = -EIO; in on_cmd_sockerror()
3749 sock->error = -EIO; in on_cmd_sockerror()
3750 k_sem_give(&sock->sock_send_sem); in on_cmd_sockerror()
3770 iface_ctx.last_error = -EIO; in on_cmd_sock_error_code()
3773 sock->error = -EIO; in on_cmd_sock_error_code()
3774 k_sem_give(&sock->sock_send_sem); in on_cmd_sock_error_code()
3790 if (sock->recv_pkt != NULL) { in sock_notif_cb_work()
3794 k_work_reschedule_for_queue(&hl7800_workq, &sock->notif_work, in sock_notif_cb_work()
3797 if (sock->type == SOCK_STREAM) { in sock_notif_cb_work()
3798 LOG_DBG("Sock %d trigger NULL packet", sock->socket_id); in sock_notif_cb_work()
3799 k_work_submit_to_queue(&hl7800_workq, &sock->recv_cb_work); in sock_notif_cb_work()
3842 sock->error = 0; in on_cmd_sock_notif()
3847 sock->error = -ENOTCONN; in on_cmd_sock_notif()
3852 sock->error = -EIO; in on_cmd_sock_notif()
3863 k_work_reschedule_for_queue(&hl7800_workq, &sock->notif_work, MDM_SOCK_NOTIF_DELAY); in on_cmd_sock_notif()
3865 k_sem_give(&sock->sock_send_sem); in on_cmd_sock_notif()
3897 LOG_DBG("Delete untracked socket [%d]", sock->id); in delete_untracked_socket_work_cb()
3898 delete_socket(NULL, sock->type, sock->id); in delete_untracked_socket_work_cb()
3937 sock->socket_id = iface_ctx.last_socket_id; in on_cmd_sockcreate()
3938 sock->created = true; in on_cmd_sockcreate()
3939 sock->reconfig = false; in on_cmd_sockcreate()
3940 /* don't give back semaphore -- OK to follow */ in on_cmd_sockcreate()
3964 LOG_DBG("Sock %d RX CB (size: %zd)", sock->socket_id, in sockreadrecv_cb_work()
3965 (sock->recv_pkt != NULL) ? net_pkt_get_len(sock->recv_pkt) : 0); in sockreadrecv_cb_work()
3967 pkt = sock->recv_pkt; in sockreadrecv_cb_work()
3968 sock->recv_pkt = NULL; in sockreadrecv_cb_work()
3969 if (sock->recv_cb) { in sockreadrecv_cb_work()
3970 sock->recv_cb(sock->context, pkt, NULL, NULL, 0, in sockreadrecv_cb_work()
3971 sock->recv_user_data); in sockreadrecv_cb_work()
3993 if (sock->error != 0) { in sock_read()
3995 k_work_reschedule_for_queue(&hl7800_workq, &sock->notif_work, in sock_read()
3999 LOG_DBG("Socket %d RX %u bytes", sock->socket_id, sock->rx_size); in sock_read()
4009 wait_for_modem_data(buf, 0, sock->rx_size); in sock_read()
4015 sock->recv_pkt = net_pkt_rx_alloc_with_buffer( in sock_read()
4016 net_context_get_iface(sock->context), sock->rx_size, in sock_read()
4017 sock->family, sock->ip_proto, BUF_ALLOC_TIMEOUT); in sock_read()
4018 if (!sock->recv_pkt) { in sock_read()
4024 net_pkt_set_context(sock->recv_pkt, sock->context); in sock_read()
4027 hdr_len = pkt_setup_ip_data(sock->recv_pkt, sock); in sock_read()
4030 for (i = 0; i < sock->rx_size; i++) { in sock_read()
4034 if (net_pkt_write_u8(sock->recv_pkt, c)) { in sock_read()
4040 if (!*buf && i < sock->rx_size) { in sock_read()
4104 net_pkt_cursor_init(sock->recv_pkt); in sock_read()
4105 net_pkt_set_overwrite(sock->recv_pkt, true); in sock_read()
4108 net_pkt_skip(sock->recv_pkt, hdr_len); in sock_read()
4114 k_work_submit_to_queue(&hl7800_workq, &sock->recv_cb_work); in sock_read()
4115 LOG_DBG("Sock %d RX done", sock->socket_id); in sock_read()
4118 net_pkt_unref(sock->recv_pkt); in sock_read()
4119 sock->recv_pkt = NULL; in sock_read()
4121 if (sock->type == SOCK_STREAM) { in sock_read()
4122 if (sock->error == 0) { in sock_read()
4123 sock->state = SOCK_CONNECTED; in sock_read()
4126 sock->state = SOCK_IDLE; in sock_read()
4144 if (sock->state == SOCK_RX) { in on_cmd_connect()
4148 k_sem_give(&sock->sock_send_sem); in on_cmd_connect()
4159 if ((sock->socket_id <= 0) || (sock->rx_size <= 0)) { in start_socket_rx()
4161 sock->socket_id, sock->rx_size); in start_socket_rx()
4162 return -1; in start_socket_rx()
4165 LOG_DBG("Start socket RX ID:%d size:%d", sock->socket_id, rx_size); in start_socket_rx()
4166 sock->state = SOCK_RX; in start_socket_rx()
4167 if (sock->type == SOCK_DGRAM) { in start_socket_rx()
4169 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV4UDPH_LEN)) { in start_socket_rx()
4170 sock->rx_size = in start_socket_rx()
4171 net_if_get_mtu(iface_ctx.iface) - NET_IPV4UDPH_LEN; in start_socket_rx()
4175 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV6UDPH_LEN)) { in start_socket_rx()
4176 sock->rx_size = in start_socket_rx()
4177 net_if_get_mtu(iface_ctx.iface) - NET_IPV6UDPH_LEN; in start_socket_rx()
4181 sock->socket_id, rx_size); in start_socket_rx()
4184 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV4TCPH_LEN)) { in start_socket_rx()
4185 sock->rx_size = in start_socket_rx()
4186 net_if_get_mtu(iface_ctx.iface) - NET_IPV4TCPH_LEN; in start_socket_rx()
4190 if (rx_size > (net_if_get_mtu(iface_ctx.iface) - NET_IPV6TCPH_LEN)) { in start_socket_rx()
4191 sock->rx_size = in start_socket_rx()
4192 net_if_get_mtu(iface_ctx.iface) - NET_IPV6TCPH_LEN; in start_socket_rx()
4196 sock->socket_id, sock->rx_size); in start_socket_rx()
4220 rc = start_socket_rx(sock, sock->rx_size); in sock_rx_data_cb_work()
4250 out_len = net_buf_linearize(value, sizeof(value) - 1, *buf, 0, len); in on_cmd_sockdataind()
4273 sock->rx_size = left_bytes; in on_cmd_sockdataind()
4275 LOG_DBG("Defer socket RX -> ID: %d bytes: %u", socket_id, in on_cmd_sockdataind()
4277 k_work_submit_to_queue(&hl7800_workq, &sock->rx_data_work); in on_cmd_sockdataind()
4400 LOG_DBG("Send FW update packet %d,%d", pkt->id, iface_ctx.fw_packet_count); in send_fw_update_packet()
4410 iface_ctx.fw_packet.id_complement = 0xFF - iface_ctx.fw_packet.id; in prepare_and_send_fw_packet()
4622 i = -1; in hl7800_rx()
4667 /* We've handled the current line in hl7800_rx()
4689 /* clear out processed line (buffers) */ in hl7800_rx()
4823 if ((sock->context != NULL) && (sock->created)) { in mark_sockets_for_reconfig()
4824 /* mark socket as possibly needing re-configuration */ in mark_sockets_for_reconfig()
4825 sock->reconfig = true; in mark_sockets_for_reconfig()
4875 state1 = read_pin(-1, spec); in glitch_filter()
4877 state2 = read_pin(-1, spec); in glitch_filter()
4950 /* >20 milliseconds required for reset low */ in modem_reset()
4987 return -1; in modem_boot_handler()
5048 result = -1; in compare_versions()
5060 result = -1; in compare_versions()
5078 int cmd_max_len = sizeof(cmd_string) - 1; in setup_gprs_connection()
5121 return -EINVAL; in mdm_hl7800_set_bands()
5125 num_leading_zeros = MDM_BAND_BITMAP_STR_LENGTH_MAX - strlen(bands); in mdm_hl7800_set_bands()
5128 if (i == (num_leading_zeros - 1)) { in mdm_hl7800_set_bands()
5129 strncpy(temp_bands + (i + 1), bands, sizeof(temp_bands) - (i + 1)); in mdm_hl7800_set_bands()
5184 /* Turn on mobile start-up reporting for next reset. in modem_reset_and_configure()
5186 * Its value is saved in non-volatile memory on the HL7800. in modem_reset_and_configure()
5348 /* enable GPIO6 low power monitoring */ in modem_reset_and_configure()
5419 * Temporary Workaround - Ignore error in modem_reset_and_configure()
5493 /* Kernel will fault with non-zero return value. in modem_reset_and_configure()
5605 if (!agent->event_callback) { in mdm_hl7800_register_event_callback()
5608 sys_slist_append(&hl7800_event_callback_list, &agent->node); in mdm_hl7800_register_event_callback()
5622 ret = (int)sys_slist_find_and_remove(&hl7800_event_callback_list, &agent->node); in mdm_hl7800_unregister_event_callback()
5626 ret = -ENOENT; in mdm_hl7800_unregister_event_callback()
5640 snprintk(cmd_con, sizeof(cmd_con), "AT+KTCPCNX=%d", sock->socket_id); in connect_TCP_socket()
5644 ret = -EIO; in connect_TCP_socket()
5650 ret = k_sem_take(&sock->sock_send_sem, MDM_CMD_CONN_TIMEOUT); in connect_TCP_socket()
5652 ret = sock->error; in connect_TCP_socket()
5653 } else if (ret == -EAGAIN) { in connect_TCP_socket()
5654 ret = -ETIMEDOUT; in connect_TCP_socket()
5660 sock->state = SOCK_CONNECTED; in connect_TCP_socket()
5661 net_context_set_state(sock->context, NET_CONTEXT_CONNECTED); in connect_TCP_socket()
5671 int dst_port = -1; in configure_TCP_socket()
5679 if (sock->dst.sa_family == AF_INET6) { in configure_TCP_socket()
5681 dst_port = net_sin6(&sock->dst)->sin6_port; in configure_TCP_socket()
5682 } else if (sock->dst.sa_family == AF_INET) { in configure_TCP_socket()
5684 dst_port = net_sin(&sock->dst)->sin_port; in configure_TCP_socket()
5686 return -EINVAL; in configure_TCP_socket()
5689 sock->socket_id = MDM_CREATE_SOCKET_ID; in configure_TCP_socket()
5692 hl7800_sprint_ip_addr(&sock->dst), dst_port, af, restore_on_boot); in configure_TCP_socket()
5696 ret = -EIO; in configure_TCP_socket()
5715 sock->socket_id = MDM_CREATE_SOCKET_ID; in configure_UDP_socket()
5717 if (sock->family == AF_INET) { in configure_UDP_socket()
5719 } else if (sock->family == AF_INET6) { in configure_UDP_socket()
5722 return -EINVAL; in configure_UDP_socket()
5735 ret = k_sem_take(&sock->sock_send_sem, MDM_CMD_CONN_TIMEOUT); in configure_UDP_socket()
5737 ret = sock->error; in configure_UDP_socket()
5738 } else if (ret == -EAGAIN) { in configure_UDP_socket()
5739 ret = -ETIMEDOUT; in configure_UDP_socket()
5787 ret = -ENOMEM; in offload_get()
5791 (*context)->offload_context = sock; in offload_get()
5793 (*context)->iface = net_if_get_by_iface(iface_ctx.iface); in offload_get()
5794 sock->family = family; in offload_get()
5795 sock->type = type; in offload_get()
5796 sock->ip_proto = ip_proto; in offload_get()
5797 sock->context = *context; in offload_get()
5798 sock->reconfig = false; in offload_get()
5799 sock->created = false; in offload_get()
5800 sock->socket_id = MDM_CREATE_SOCKET_ID; in offload_get()
5833 return -EINVAL; in offload_bind()
5836 sock = (struct hl7800_socket *)context->offload_context; in offload_bind()
5839 return -EINVAL; in offload_bind()
5843 sock->src.sa_family = addr->sa_family; in offload_bind()
5845 if (addr->sa_family == AF_INET6) { in offload_bind()
5846 net_ipaddr_copy(&net_sin6(&sock->src)->sin6_addr, in offload_bind()
5847 &net_sin6(addr)->sin6_addr); in offload_bind()
5848 net_sin6(&sock->src)->sin6_port = net_sin6(addr)->sin6_port; in offload_bind()
5852 if (addr->sa_family == AF_INET) { in offload_bind()
5853 net_ipaddr_copy(&net_sin(&sock->src)->sin_addr, in offload_bind()
5854 &net_sin(addr)->sin_addr); in offload_bind()
5855 net_sin(&sock->src)->sin_port = net_sin(addr)->sin_port; in offload_bind()
5859 return -EPFNOSUPPORT; in offload_bind()
5868 return -ENOTSUP; in offload_listen()
5877 int dst_port = -1; in offload_connect()
5881 return -EINVAL; in offload_connect()
5884 sock = (struct hl7800_socket *)context->offload_context; in offload_connect()
5887 return -EINVAL; in offload_connect()
5890 if (sock->socket_id < 1) { in offload_connect()
5892 sock->socket_id, context); in offload_connect()
5893 return -EINVAL; in offload_connect()
5896 sock->dst.sa_family = addr->sa_family; in offload_connect()
5899 if (addr->sa_family == AF_INET6) { in offload_connect()
5900 net_ipaddr_copy(&net_sin6(&sock->dst)->sin6_addr, in offload_connect()
5901 &net_sin6(addr)->sin6_addr); in offload_connect()
5902 dst_port = ntohs(net_sin6(addr)->sin6_port); in offload_connect()
5903 net_sin6(&sock->dst)->sin6_port = dst_port; in offload_connect()
5907 if (addr->sa_family == AF_INET) { in offload_connect()
5908 net_ipaddr_copy(&net_sin(&sock->dst)->sin_addr, in offload_connect()
5909 &net_sin(addr)->sin_addr); in offload_connect()
5910 dst_port = ntohs(net_sin(addr)->sin_port); in offload_connect()
5911 net_sin(&sock->dst)->sin_port = dst_port; in offload_connect()
5915 return -EINVAL; in offload_connect()
5920 return -EINVAL; in offload_connect()
5925 if (sock->type == SOCK_STREAM) { in offload_connect()
5931 if (!sock->created) { in offload_connect()
5960 return -ENOTSUP; in offload_accept()
5972 return -EINVAL; in offload_sendto()
5975 sock = (struct hl7800_socket *)context->offload_context; in offload_sendto()
5978 return -EINVAL; in offload_sendto()
5982 if (dst_addr->sa_family == AF_INET6) { in offload_sendto()
5983 net_ipaddr_copy(&net_sin6(&sock->dst)->sin6_addr, in offload_sendto()
5984 &net_sin6(dst_addr)->sin6_addr); in offload_sendto()
5985 dst_port = ntohs(net_sin6(dst_addr)->sin6_port); in offload_sendto()
5986 net_sin6(&sock->dst)->sin6_port = dst_port; in offload_sendto()
5990 if (dst_addr->sa_family == AF_INET) { in offload_sendto()
5991 net_ipaddr_copy(&net_sin(&sock->dst)->sin_addr, in offload_sendto()
5992 &net_sin(dst_addr)->sin_addr); in offload_sendto()
5993 dst_port = ntohs(net_sin(dst_addr)->sin_port); in offload_sendto()
5994 net_sin(&sock->dst)->sin_port = dst_port; in offload_sendto()
5998 return -EINVAL; in offload_sendto()
6041 return -EPFNOSUPPORT; in offload_send()
6044 return offload_sendto(pkt, &context->remote, addr_len, cb, timeout, in offload_send()
6054 return -EINVAL; in offload_recv()
6057 sock = (struct hl7800_socket *)context->offload_context; in offload_recv()
6060 return -EINVAL; in offload_recv()
6063 sock->recv_cb = cb; in offload_recv()
6064 sock->recv_user_data = user_data; in offload_recv()
6075 return -EINVAL; in offload_put()
6078 sock = (struct hl7800_socket *)context->offload_context; in offload_put()
6085 k_work_cancel_delayable(&sock->notif_work); in offload_put()
6090 if (sock->type == SOCK_STREAM) { in offload_put()
6092 sock->socket_id); in offload_put()
6095 sock->socket_id); in offload_put()
6100 if ((sock->type == SOCK_DGRAM) || (sock->error != -ENOTCONN)) { in offload_put()
6104 if (sock->type == SOCK_STREAM) { in offload_put()
6106 delete_socket(sock, sock->type, sock->socket_id); in offload_put()
6112 if (sock->type == SOCK_STREAM) { in offload_put()
6141 ictx->mac_addr[0] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 6]; in hl7800_build_mac()
6142 ictx->mac_addr[1] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 5]; in hl7800_build_mac()
6143 ictx->mac_addr[2] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 4]; in hl7800_build_mac()
6144 ictx->mac_addr[3] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 3]; in hl7800_build_mac()
6145 ictx->mac_addr[4] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 2]; in hl7800_build_mac()
6146 ictx->mac_addr[5] = ictx->mdm_imei[MDM_HL7800_IMEI_STRLEN - 1]; in hl7800_build_mac()
6221 return -EIO; in hl7800_init()
6228 iface_ctx.sockets[i].socket_id = -1; in hl7800_init()
6272 hl7800_cfg.gpio[i].port->name); in hl7800_init()
6273 return -ENODEV; in hl7800_init()
6445 struct hl7800_iface_ctx *ctx = dev->data; in offload_iface_init()
6447 iface->if_dev->offload = &offload_funcs; in offload_iface_init()
6448 ctx->iface = iface; in offload_iface_init()