Lines Matching refs:mdata
16 static struct modem_data mdata; variable
70 hash_value = hash32(mdata.mdm_imei, strlen(mdata.mdm_imei)); in modem_get_mac()
161 sock = modem_socket_from_fd(&mdata.socket_config, socket_fd); in on_cmd_sockread_common()
187 (void)modem_socket_packet_size_update(&mdata.socket_config, sock, in on_cmd_sockread_common()
207 &mdata.sem_response, MDM_CMD_TIMEOUT); in socket_close()
212 modem_socket_put(&mdata.socket_config, sock->sock_fd); in socket_close()
219 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
227 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
235 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
246 mdata.mdm_rssi = -51; in MODEM_CMD_DEFINE()
248 mdata.mdm_rssi = -114 + ((rssi * 2) + 1); in MODEM_CMD_DEFINE()
250 mdata.mdm_rssi = -1000; in MODEM_CMD_DEFINE()
253 LOG_INF("RSSI: %d", mdata.mdm_rssi); in MODEM_CMD_DEFINE()
264 k_sem_give(&mdata.sem_sock_conn); in MODEM_CMD_DEFINE()
272 size_t out_len = net_buf_linearize(mdata.mdm_manufacturer, in MODEM_CMD_DEFINE()
273 sizeof(mdata.mdm_manufacturer) - 1, in MODEM_CMD_DEFINE()
275 mdata.mdm_manufacturer[out_len] = '\0'; in MODEM_CMD_DEFINE()
276 LOG_INF("Manufacturer: %s", mdata.mdm_manufacturer); in MODEM_CMD_DEFINE()
283 size_t out_len = net_buf_linearize(mdata.mdm_model, in MODEM_CMD_DEFINE()
284 sizeof(mdata.mdm_model) - 1, in MODEM_CMD_DEFINE()
286 mdata.mdm_model[out_len] = '\0'; in MODEM_CMD_DEFINE()
289 LOG_INF("Model: %s", mdata.mdm_model); in MODEM_CMD_DEFINE()
296 size_t out_len = net_buf_linearize(mdata.mdm_revision, in MODEM_CMD_DEFINE()
297 sizeof(mdata.mdm_revision) - 1, in MODEM_CMD_DEFINE()
299 mdata.mdm_revision[out_len] = '\0'; in MODEM_CMD_DEFINE()
302 LOG_INF("Revision: %s", mdata.mdm_revision); in MODEM_CMD_DEFINE()
309 size_t out_len = net_buf_linearize(mdata.mdm_imei, in MODEM_CMD_DEFINE()
310 sizeof(mdata.mdm_imei) - 1, in MODEM_CMD_DEFINE()
312 mdata.mdm_imei[out_len] = '\0'; in MODEM_CMD_DEFINE()
315 LOG_INF("IMEI: %s", mdata.mdm_imei); in MODEM_CMD_DEFINE()
323 size_t out_len = net_buf_linearize(mdata.mdm_imsi, in MODEM_CMD_DEFINE()
324 sizeof(mdata.mdm_imsi) - 1, in MODEM_CMD_DEFINE()
326 mdata.mdm_imsi[out_len] = '\0'; in MODEM_CMD_DEFINE()
329 LOG_INF("IMSI: %s", mdata.mdm_imsi); in MODEM_CMD_DEFINE()
339 out_len = net_buf_linearize(mdata.mdm_iccid, sizeof(mdata.mdm_iccid) - 1, in MODEM_CMD_DEFINE()
341 mdata.mdm_iccid[out_len] = '\0'; in MODEM_CMD_DEFINE()
344 if (mdata.mdm_iccid[0] == '+') { in MODEM_CMD_DEFINE()
345 p = strchr(mdata.mdm_iccid, ' '); in MODEM_CMD_DEFINE()
348 memmove(mdata.mdm_iccid, p + 1, len + 1); in MODEM_CMD_DEFINE()
352 LOG_INF("ICCID: %s", mdata.mdm_iccid); in MODEM_CMD_DEFINE()
360 k_sem_give(&mdata.sem_tx_ready); in MODEM_CMD_DIRECT_DEFINE()
368 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
376 mdata.sock_written = 0; in MODEM_CMD_DEFINE()
378 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
386 return on_cmd_sockread_common(mdata.sock_fd, data, len); in MODEM_CMD_DEFINE()
398 sock = modem_socket_from_fd(&mdata.socket_config, sock_fd); in MODEM_CMD_DEFINE()
405 modem_socket_data_ready(&mdata.socket_config, sock); in MODEM_CMD_DEFINE()
417 sock = modem_socket_from_fd(&mdata.socket_config, sock_fd); in MODEM_CMD_DEFINE()
433 k_sem_give(&mdata.sem_response); in MODEM_CMD_DEFINE()
456 mdata.sock_written = buf_len; in send_socket_data()
460 (void)k_sem_take(&mdata.cmd_handler_data.sem_tx_lock, K_FOREVER); in send_socket_data()
461 k_sem_reset(&mdata.sem_tx_ready); in send_socket_data()
471 ret = modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_socket_data()
479 ret = k_sem_take(&mdata.sem_tx_ready, K_MSEC(5000)); in send_socket_data()
491 k_sem_reset(&mdata.sem_response); in send_socket_data()
492 ret = k_sem_take(&mdata.sem_response, timeout); in send_socket_data()
498 ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data); in send_socket_data()
505 (void)modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in send_socket_data()
507 k_sem_give(&mdata.cmd_handler_data.sem_tx_lock); in send_socket_data()
514 return mdata.sock_written; in send_socket_data()
607 mdata.sock_fd = sock->sock_fd; in offload_recvfrom()
611 data_cmd, ARRAY_SIZE(data_cmd), sendbuf, &mdata.sem_response, in offload_recvfrom()
666 return modem_socket_poll_prepare(&mdata.socket_config, obj, pfd, pev, pev_end); in offload_ioctl()
701 if (modem_socket_is_allocated(&mdata.socket_config, sock) == false) { in offload_connect()
728 k_sem_reset(&mdata.sem_sock_conn); in offload_connect()
746 &mdata.sem_response, K_SECONDS(1)); in offload_connect()
756 ret = modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in offload_connect()
763 ret = k_sem_take(&mdata.sem_sock_conn, MDM_CMD_CONN_TIMEOUT); in offload_connect()
771 ret = modem_cmd_handler_get_error(&mdata.cmd_handler_data); in offload_connect()
784 (void) modem_cmd_handler_update_cmds(&mdata.cmd_handler_data, in offload_connect()
799 if (modem_socket_is_allocated(&mdata.socket_config, sock) == false) { in offload_close()
875 &cmd, 1U, send_cmd, &mdata.sem_response, in modem_rssi_query_work()
884 &mdata.rssi_query_work, in modem_rssi_query_work()
895 int ret = k_sem_take(&mdata.sem_pin_busy, K_SECONDS(3)); in pin_init()
926 k_sem_give(&mdata.sem_pin_busy); in pin_init()
982 NULL, 0U, "AT+QIACT=1", &mdata.sem_response, in modem_pdp_context_activate()
988 NULL, 0U, "AT+QIDEACT=1", &mdata.sem_response, in modem_pdp_context_activate()
997 NULL, 0U, "AT+QIACT=1", &mdata.sem_response, in modem_pdp_context_activate()
1028 k_work_cancel_delayable(&mdata.rssi_query_work); in modem_setup()
1032 ret = k_sem_take(&mdata.sem_response, MDM_MAX_BOOT_TIME); in modem_setup()
1041 &mdata.sem_response, MDM_REGISTRATION_TIMEOUT); in modem_setup()
1054 (mdata.mdm_rssi >= 0 || mdata.mdm_rssi <= -1000)) { in modem_setup()
1060 if (mdata.mdm_rssi >= 0 || mdata.mdm_rssi <= -1000) { in modem_setup()
1077 k_work_reschedule_for_queue(&modem_workq, &mdata.rssi_query_work, in modem_setup()
1153 ret = modem_socket_get(&mdata.socket_config, family, type, proto); in offload_socket()
1168 k_sem_init(&mdata.sem_pin_busy, 1, 1); in modem_init()
1170 k_sem_init(&mdata.sem_response, 0, 1); in modem_init()
1171 k_sem_init(&mdata.sem_tx_ready, 0, 1); in modem_init()
1172 k_sem_init(&mdata.sem_sock_conn, 0, 1); in modem_init()
1178 ret = modem_socket_init(&mdata.socket_config, &mdata.sockets[0], ARRAY_SIZE(mdata.sockets), in modem_init()
1186 .match_buf = &mdata.cmd_match_buf[0], in modem_init()
1187 .match_buf_len = sizeof(mdata.cmd_match_buf), in modem_init()
1198 ret = modem_cmd_handler_init(&mctx.cmd_handler, &mdata.cmd_handler_data, in modem_init()
1206 .rx_rb_buf = &mdata.iface_rb_buf[0], in modem_init()
1207 .rx_rb_buf_len = sizeof(mdata.iface_rb_buf), in modem_init()
1212 ret = modem_iface_uart_init(&mctx.iface, &mdata.iface_data, &uart_config); in modem_init()
1218 mctx.data_manufacturer = mdata.mdm_manufacturer; in modem_init()
1219 mctx.data_model = mdata.mdm_model; in modem_init()
1220 mctx.data_revision = mdata.mdm_revision; in modem_init()
1221 mctx.data_imei = mdata.mdm_imei; in modem_init()
1223 mctx.data_imsi = mdata.mdm_imsi; in modem_init()
1224 mctx.data_iccid = mdata.mdm_iccid; in modem_init()
1226 mctx.data_rssi = &mdata.mdm_rssi; in modem_init()
1260 mctx.driver_data = &mdata; in modem_init()
1275 k_work_init_delayable(&mdata.rssi_query_work, modem_rssi_query_work); in modem_init()
1284 &mdata, NULL,