Lines Matching refs:mdata

163 static struct modem_data mdata;  variable
265 rc = find_apn(mdata.mdm_apn, in modem_detect_apn()
266 sizeof(mdata.mdm_apn), in modem_detect_apn()
270 rc = find_apn(mdata.mdm_apn, in modem_detect_apn()
271 sizeof(mdata.mdm_apn), in modem_detect_apn()
278 LOG_INF("Assign APN: \"%s\"", mdata.mdm_apn); in modem_detect_apn()
341 mdata.sock_written = 0; in send_socket_data()
367 k_sem_take(&mdata.cmd_handler_data.sem_tx_lock, K_FOREVER); in send_socket_data()
370 k_sem_reset(&mdata.sem_prompt); in send_socket_data()
379 ret = modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_socket_data()
388 ret = k_sem_take(&mdata.sem_prompt, K_SECONDS(1)); in send_socket_data()
409 k_sem_reset(&mdata.sem_response); in send_socket_data()
426 ret = k_sem_take(&mdata.sem_response, timeout); in send_socket_data()
429 ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data); in send_socket_data()
436 (void)modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_socket_data()
438 k_sem_give(&mdata.cmd_handler_data.sem_tx_lock); in send_socket_data()
444 return mdata.sock_written; in send_socket_data()
473 k_sem_take(&mdata.cmd_handler_data.sem_tx_lock, K_FOREVER); in send_cert()
482 ret = modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_cert()
493 k_sem_reset(&mdata.sem_response); in send_cert()
494 ret = k_sem_take(&mdata.sem_response, K_MSEC(1000)); in send_cert()
497 ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data); in send_cert()
504 (void)modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_cert()
506 k_sem_give(&mdata.cmd_handler_data.sem_tx_lock); in send_cert()
520 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
527 k_sem_give(&mdata.sem_prompt); in MODEM_CMD_DEFINE()
539 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
548 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
561 out_len = net_buf_linearize(mdata.mdm_manufacturer, in MODEM_CMD_DEFINE()
562 sizeof(mdata.mdm_manufacturer) - 1, in MODEM_CMD_DEFINE()
564 mdata.mdm_manufacturer[out_len] = '\0'; in MODEM_CMD_DEFINE()
565 LOG_INF("Manufacturer: %s", mdata.mdm_manufacturer); in MODEM_CMD_DEFINE()
574 out_len = net_buf_linearize(mdata.mdm_model, in MODEM_CMD_DEFINE()
575 sizeof(mdata.mdm_model) - 1, in MODEM_CMD_DEFINE()
577 mdata.mdm_model[out_len] = '\0'; in MODEM_CMD_DEFINE()
578 LOG_INF("Model: %s", mdata.mdm_model); in MODEM_CMD_DEFINE()
582 if (strstr(mdata.mdm_model, "R4")) { in MODEM_CMD_DEFINE()
583 mdata.mdm_variant = MDM_VARIANT_UBLOX_R4; in MODEM_CMD_DEFINE()
585 if (strstr(mdata.mdm_model, "U2")) { in MODEM_CMD_DEFINE()
586 mdata.mdm_variant = MDM_VARIANT_UBLOX_U2; in MODEM_CMD_DEFINE()
589 LOG_INF("Variant: %d", mdata.mdm_variant); in MODEM_CMD_DEFINE()
600 out_len = net_buf_linearize(mdata.mdm_revision, in MODEM_CMD_DEFINE()
601 sizeof(mdata.mdm_revision) - 1, in MODEM_CMD_DEFINE()
603 mdata.mdm_revision[out_len] = '\0'; in MODEM_CMD_DEFINE()
604 LOG_INF("Revision: %s", mdata.mdm_revision); in MODEM_CMD_DEFINE()
613 out_len = net_buf_linearize(mdata.mdm_imei, sizeof(mdata.mdm_imei) - 1, in MODEM_CMD_DEFINE()
615 mdata.mdm_imei[out_len] = '\0'; in MODEM_CMD_DEFINE()
616 LOG_INF("IMEI: %s", mdata.mdm_imei); in MODEM_CMD_DEFINE()
625 out_len = net_buf_linearize(mdata.mdm_imsi, sizeof(mdata.mdm_imsi) - 1, in MODEM_CMD_DEFINE()
627 mdata.mdm_imsi[out_len] = '\0'; in MODEM_CMD_DEFINE()
628 LOG_INF("IMSI: %s", mdata.mdm_imsi); in MODEM_CMD_DEFINE()
632 modem_detect_apn(mdata.mdm_imsi); in MODEM_CMD_DEFINE()
649 mdata.mdm_rssi = -140 + (rsrp - 1); in MODEM_CMD_DEFINE()
650 LOG_INF("RSRP: %d", mdata.mdm_rssi); in MODEM_CMD_DEFINE()
652 mdata.mdm_rssi = -110 + (rxlev - 1); in MODEM_CMD_DEFINE()
653 LOG_INF("RSSI: %d", mdata.mdm_rssi); in MODEM_CMD_DEFINE()
655 mdata.mdm_rssi = -1000; in MODEM_CMD_DEFINE()
672 mdata.mdm_rssi = -46; in MODEM_CMD_DEFINE()
675 mdata.mdm_rssi = -110 + ((rssi * 2) + 1); in MODEM_CMD_DEFINE()
677 mdata.mdm_rssi = -1000; in MODEM_CMD_DEFINE()
680 LOG_INF("RSSI: %d", mdata.mdm_rssi); in MODEM_CMD_DEFINE()
744 sock = modem_socket_from_newid(&mdata.socket_config); in MODEM_CMD_DEFINE()
749 if (modem_socket_id_assign(&mdata.socket_config, sock, id) < 0) { in MODEM_CMD_DEFINE()
750 modem_socket_put(&mdata.socket_config, sock->sock_fd); in MODEM_CMD_DEFINE()
761 mdata.sock_written = ATOI(argv[1], 0, "length"); in MODEM_CMD_DEFINE()
762 LOG_DBG("bytes written: %d", mdata.sock_written); in MODEM_CMD_DEFINE()
817 sock = modem_socket_from_id(&mdata.socket_config, socket_id); in on_cmd_sockread_common()
843 (void)modem_socket_packet_size_update(&mdata.socket_config, sock, in on_cmd_sockread_common()
894 sock = modem_socket_from_id(&mdata.socket_config, in MODEM_CMD_DEFINE()
911 sock = modem_socket_from_id(&mdata.socket_config, socket_id); in MODEM_CMD_DEFINE()
916 ret = modem_socket_packet_size_update(&mdata.socket_config, sock, in MODEM_CMD_DEFINE()
924 modem_socket_data_ready(&mdata.socket_config, sock); in MODEM_CMD_DEFINE()
933 mdata.ev_creg = ATOI(argv[0], 0, "stat"); in MODEM_CMD_DEFINE()
934 LOG_DBG("CREG:%d", mdata.ev_creg); in MODEM_CMD_DEFINE()
1045 if (mdata.mdm_variant == MDM_VARIANT_UBLOX_U2) { in modem_rssi_query_work()
1053 &mdata.sem_response, in modem_rssi_query_work()
1065 &mdata.sem_response, in modem_rssi_query_work()
1076 &modem_workq, &mdata.rssi_query_work, in modem_rssi_query_work()
1096 &cmd, 1U, send_cmd, &mdata.sem_response, in modem_rssi_query_work()
1108 &mdata.sem_response, in modem_rssi_query_work()
1119 &modem_workq, &mdata.rssi_query_work, in modem_rssi_query_work()
1195 mdata.mdm_apn[0] = '\0'; in modem_reset()
1196 strncat(mdata.mdm_apn, in modem_reset()
1198 sizeof(mdata.mdm_apn)-1); in modem_reset()
1203 k_work_cancel_delayable(&mdata.rssi_query_work); in modem_reset()
1217 NULL, 0, "AT", &mdata.sem_response, in modem_reset()
1231 &mdata.sem_response, in modem_reset()
1241 snprintk(cmd, sizeof(cmd), "AT+CGDCONT=1,\"IP\",\"%s\"", mdata.mdm_apn); in modem_reset()
1247 &mdata.sem_response, in modem_reset()
1253 &mdata.sem_response, in modem_reset()
1264 &mdata.sem_response, in modem_reset()
1270 &mdata.sem_response, in modem_reset()
1288 while (counter++ < 40 && mdata.ev_creg != 1 && mdata.ev_creg != 5) { in modem_reset()
1294 NULL, 0, "AT+CFUN=0", &mdata.sem_response, in modem_reset()
1301 NULL, 0, "AT+CFUN=1", &mdata.sem_response, in modem_reset()
1315 (mdata.mdm_rssi >= 0 || in modem_reset()
1316 mdata.mdm_rssi <= -1000)) { in modem_reset()
1321 if (mdata.mdm_rssi >= 0 || mdata.mdm_rssi <= -1000) { in modem_reset()
1334 if (mdata.mdm_variant == MDM_VARIANT_UBLOX_U2) { in modem_reset()
1340 snprintk(cmd, sizeof(cmd), "AT+UPSD=0,1,\"%s\"", mdata.mdm_apn); in modem_reset()
1344 &mdata.sem_response, in modem_reset()
1351 &mdata.sem_response, in modem_reset()
1359 &mdata.sem_response, in modem_reset()
1373 &modem_workq, &mdata.rssi_query_work, in modem_reset()
1414 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1425 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1432 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1439 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1446 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1453 &mdata.sem_response, MDM_CMD_TIMEOUT); in create_socket()
1464 modem_socket_put(&mdata.socket_config, sock->sock_fd); in create_socket()
1480 ret = modem_socket_get(&mdata.socket_config, family, type, proto); in offload_socket()
1497 if (modem_socket_id_is_assigned(&mdata.socket_config, sock) == false) { in offload_close()
1506 &mdata.sem_response, MDM_CMD_TIMEOUT); in offload_close()
1512 modem_socket_put(&mdata.socket_config, sock->sock_fd); in offload_close()
1525 if (modem_socket_is_allocated(&mdata.socket_config, sock) == true) { in offload_bind()
1549 if (modem_socket_is_allocated(&mdata.socket_config, sock) == false) { in offload_connect()
1557 if (modem_socket_id_is_assigned(&mdata.socket_config, sock) == false) { in offload_connect()
1590 &mdata.sem_response, MDM_CMD_CONN_TIMEOUT); in offload_connect()
1625 next_packet_size = modem_socket_next_packet_size(&mdata.socket_config, in offload_recvfrom()
1638 modem_socket_wait_data(&mdata.socket_config, sock); in offload_recvfrom()
1640 &mdata.socket_config, sock); in offload_recvfrom()
1663 cmd, ARRAY_SIZE(cmd), sendbuf, &mdata.sem_response, in offload_recvfrom()
1724 return modem_socket_poll_prepare(&mdata.socket_config, obj, pfd, pev, pev_end); in offload_ioctl()
2020 &cmd, 1U, sendbuf, &mdata.sem_response, in offload_getaddrinfo()
2085 hash_value = hash32(mdata.mdm_imei, strlen(mdata.mdm_imei)); in modem_get_mac()
2136 k_sem_init(&mdata.sem_response, 0, 1); in modem_init()
2137 k_sem_init(&mdata.sem_prompt, 0, 1); in modem_init()
2147 ret = modem_socket_init(&mdata.socket_config, &mdata.sockets[0], ARRAY_SIZE(mdata.sockets), in modem_init()
2155 .match_buf = &mdata.cmd_match_buf[0], in modem_init()
2156 .match_buf_len = sizeof(mdata.cmd_match_buf), in modem_init()
2167 ret = modem_cmd_handler_init(&mctx.cmd_handler, &mdata.cmd_handler_data, in modem_init()
2175 .rx_rb_buf = &mdata.iface_rb_buf[0], in modem_init()
2176 .rx_rb_buf_len = sizeof(mdata.iface_rb_buf), in modem_init()
2181 ret = modem_iface_uart_init(&mctx.iface, &mdata.iface_data, &uart_config); in modem_init()
2187 mctx.data_manufacturer = mdata.mdm_manufacturer; in modem_init()
2188 mctx.data_model = mdata.mdm_model; in modem_init()
2189 mctx.data_revision = mdata.mdm_revision; in modem_init()
2190 mctx.data_imei = mdata.mdm_imei; in modem_init()
2191 mctx.data_rssi = &mdata.mdm_rssi; in modem_init()
2216 mctx.driver_data = &mdata; in modem_init()
2232 k_work_init_delayable(&mdata.rssi_query_work, modem_rssi_query_work); in modem_init()
2242 &mdata, NULL,