Lines Matching +full:tracking +full:- +full:index

4  * SPDX-License-Identifier: Apache-2.0
92 struct ubx_m8_data *data = dev->data; in ubx_m8_resume()
95 ret = modem_pipe_open(data->uart_pipe, K_SECONDS(10)); in ubx_m8_resume()
100 ret = modem_chat_attach(&data->chat, data->uart_pipe); in ubx_m8_resume()
102 (void)modem_pipe_close(data->uart_pipe, K_SECONDS(10)); in ubx_m8_resume()
111 struct ubx_m8_data *data = dev->data; in ubx_m8_turn_off()
113 return modem_pipe_close(data->uart_pipe, K_SECONDS(10)); in ubx_m8_turn_off()
118 struct ubx_m8_data *data = dev->data; in ubx_m8_init_nmea0183_match()
123 .satellites = data->satellites, in ubx_m8_init_nmea0183_match()
124 .satellites_size = ARRAY_SIZE(data->satellites), in ubx_m8_init_nmea0183_match()
128 return gnss_nmea0183_match_init(&data->match_data, &match_config); in ubx_m8_init_nmea0183_match()
133 const struct ubx_m8_config *cfg = dev->config; in ubx_m8_init_pipe()
134 struct ubx_m8_data *data = dev->data; in ubx_m8_init_pipe()
137 .uart = cfg->uart, in ubx_m8_init_pipe()
138 .receive_buf = data->uart_backend_receive_buf, in ubx_m8_init_pipe()
139 .receive_buf_size = sizeof(data->uart_backend_receive_buf), in ubx_m8_init_pipe()
140 .transmit_buf = data->uart_backend_transmit_buf, in ubx_m8_init_pipe()
141 .transmit_buf_size = ARRAY_SIZE(data->uart_backend_transmit_buf), in ubx_m8_init_pipe()
144 data->uart_pipe = modem_backend_uart_init(&data->uart_backend, &uart_backend_config); in ubx_m8_init_pipe()
151 struct ubx_m8_data *data = dev->data; in ubx_m8_init_chat()
155 .receive_buf = data->chat_receive_buf, in ubx_m8_init_chat()
156 .receive_buf_size = sizeof(data->chat_receive_buf), in ubx_m8_init_chat()
161 .argv = data->chat_argv, in ubx_m8_init_chat()
162 .argv_size = ARRAY_SIZE(data->chat_argv), in ubx_m8_init_chat()
167 return modem_chat_init(&data->chat, &chat_config); in ubx_m8_init_chat()
172 struct ubx_m8_data *data = dev->data; in ubx_m8_init_ubx()
176 .receive_buf = data->ubx_receive_buf, in ubx_m8_init_ubx()
177 .receive_buf_size = sizeof(data->ubx_receive_buf), in ubx_m8_init_ubx()
178 .work_buf = data->ubx_work_buf, in ubx_m8_init_ubx()
179 .work_buf_size = sizeof(data->ubx_work_buf), in ubx_m8_init_ubx()
182 return modem_ubx_init(&data->ubx, &ubx_config); in ubx_m8_init_ubx()
194 struct ubx_m8_data *data = dev->data; in ubx_m8_modem_module_change()
198 modem_chat_release(&data->chat); in ubx_m8_modem_module_change()
199 ret = modem_ubx_attach(&data->ubx, data->uart_pipe); in ubx_m8_modem_module_change()
201 modem_ubx_release(&data->ubx); in ubx_m8_modem_module_change()
202 ret = modem_chat_attach(&data->chat, data->uart_pipe); in ubx_m8_modem_module_change()
206 (void)modem_pipe_close(data->uart_pipe, K_SECONDS(10)); in ubx_m8_modem_module_change()
215 struct ubx_m8_data *data = dev->data; in ubx_m8_modem_ubx_run_script()
223 ret = modem_ubx_run_script(&data->ubx, modem_ubx_script_tx); in ubx_m8_modem_ubx_run_script()
233 struct ubx_m8_data *data = dev->data; in ubx_m8_modem_ubx_script_fill()
235 data->script.request = (struct ubx_frame *)data->request_buf; in ubx_m8_modem_ubx_script_fill()
236 data->script.response = (struct ubx_frame *)data->response_buf; in ubx_m8_modem_ubx_script_fill()
237 data->script.match = (struct ubx_frame *)data->match_buf; in ubx_m8_modem_ubx_script_fill()
238 data->script.retry_count = UBX_M8_SCRIPT_RETRY_DEFAULT; in ubx_m8_modem_ubx_script_fill()
239 data->script.timeout = K_MSEC(MODEM_UBX_SCRIPT_TIMEOUT_MS); in ubx_m8_modem_ubx_script_fill()
246 struct ubx_m8_data *data = dev->data; in ubx_m8_modem_ubx_script_init()
254 ret = ubx_create_and_validate_frame(data->match_buf, sizeof(data->match_buf), UBX_CLASS_ACK, in ubx_m8_modem_ubx_script_init()
260 ret = ubx_create_and_validate_frame(data->request_buf, sizeof(data->request_buf), msg_cls, in ubx_m8_modem_ubx_script_init()
270 struct ubx_m8_data *data = dev->data; in ubx_m8_ubx_cfg_rate()
273 key = k_spin_lock(&data->lock); in ubx_m8_ubx_cfg_rate()
283 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_ubx_cfg_rate()
286 k_spin_unlock(&data->lock, key); in ubx_m8_ubx_cfg_rate()
296 struct ubx_m8_data *data = dev->data; in ubx_m8_ubx_cfg_prt_set()
299 key = k_spin_lock(&data->lock); in ubx_m8_ubx_cfg_prt_set()
310 data->script.retry_count = retry; in ubx_m8_ubx_cfg_prt_set()
312 * because the device will change its baudrate and respond with UBX-ACK with new baudrate, in ubx_m8_ubx_cfg_prt_set()
316 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_ubx_cfg_prt_set()
319 k_spin_unlock(&data->lock, key); in ubx_m8_ubx_cfg_prt_set()
328 struct ubx_m8_data *data = dev->data; in ubx_m8_ubx_cfg_rst()
331 key = k_spin_lock(&data->lock); in ubx_m8_ubx_cfg_rst()
344 data->script.match = NULL; in ubx_m8_ubx_cfg_rst()
345 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_ubx_cfg_rst()
355 k_spin_unlock(&data->lock, key); in ubx_m8_ubx_cfg_rst()
364 struct ubx_m8_data *data = dev->data; in ubx_m8_set_uart_baudrate()
365 const struct ubx_m8_config *config = dev->config; in ubx_m8_set_uart_baudrate()
368 key = k_spin_lock(&data->lock); in ubx_m8_set_uart_baudrate()
375 ret = uart_config_get(config->uart, &uart_cfg); in ubx_m8_set_uart_baudrate()
381 ret = uart_configure(config->uart, &uart_cfg); in ubx_m8_set_uart_baudrate()
386 k_spin_unlock(&data->lock, key); in ubx_m8_set_uart_baudrate()
409 const struct ubx_m8_config *config = dev->config; in ubx_m8_configure_gnss_device_baudrate_prerequisite()
410 uint32_t target_baudrate = config->uart_baudrate; in ubx_m8_configure_gnss_device_baudrate_prerequisite()
447 const struct ubx_m8_config *config = dev->config; in ubx_m8_configure_gnss_device_baudrate()
448 uint32_t target_baudrate = config->uart_baudrate; in ubx_m8_configure_gnss_device_baudrate()
467 struct ubx_m8_data *data = dev->data; in ubx_m8_configure_messages()
470 key = k_spin_lock(&data->lock); in ubx_m8_configure_messages()
486 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_configure_messages()
506 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_configure_messages()
513 k_spin_unlock(&data->lock, key); in ubx_m8_configure_messages()
531 return -EINVAL; in ubx_m8_navigation_mode_to_ubx_dynamic_model()
560 return -EINVAL; in ubx_m8_ubx_dynamic_model_to_navigation_mode()
568 struct ubx_m8_data *data = dev->data; in ubx_m8_set_navigation_mode()
571 key = k_spin_lock(&data->lock); in ubx_m8_set_navigation_mode()
588 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_set_navigation_mode()
596 k_spin_unlock(&data->lock, key); in ubx_m8_set_navigation_mode()
605 struct ubx_m8_data *data = dev->data; in ubx_m8_get_navigation_mode()
608 key = k_spin_lock(&data->lock); in ubx_m8_get_navigation_mode()
616 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_get_navigation_mode()
621 struct ubx_frame *response = data->script.response; in ubx_m8_get_navigation_mode()
623 dynamic_model = ((struct ubx_cfg_nav5_payload *)response->payload_and_checksum)->dyn_model; in ubx_m8_get_navigation_mode()
632 k_spin_unlock(&data->lock, key); in ubx_m8_get_navigation_mode()
661 return -EINVAL; in ubx_m8_ubx_gnss_id_to_gnss_system()
666 struct ubx_cfg_gnss_payload *payload, uint8_t index, in ubx_m8_config_block_fill() argument
673 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_GPS; in ubx_m8_config_block_fill()
677 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_GLONASS; in ubx_m8_config_block_fill()
681 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_GALILEO; in ubx_m8_config_block_fill()
685 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_BEIDOU; in ubx_m8_config_block_fill()
689 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_QZSS; in ubx_m8_config_block_fill()
693 payload->config_blocks[index].gnss_id = UBX_GNSS_ID_SBAS; in ubx_m8_config_block_fill()
697 return -EINVAL; in ubx_m8_config_block_fill()
700 payload->config_blocks[index].flags = enable | signal_config; in ubx_m8_config_block_fill()
709 struct ubx_m8_data *data = dev->data; in ubx_m8_set_enabled_systems()
711 key = k_spin_lock(&data->lock); in ubx_m8_set_enabled_systems()
715 /* Get number of tracking channels for each supported gnss system by sending CFG-GNSS. */ in ubx_m8_set_enabled_systems()
722 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_set_enabled_systems()
727 struct ubx_frame *response = data->script.response; in ubx_m8_set_enabled_systems()
730 /* Calculate sum of reserved and maximum tracking channels for each supported gnss system, in ubx_m8_set_enabled_systems()
731 * and assert that the sum is not greater than the number of tracking channels in use. in ubx_m8_set_enabled_systems()
733 payload = (struct ubx_cfg_gnss_payload *) response->payload_and_checksum; in ubx_m8_set_enabled_systems()
734 for (int i = 0; i < payload->num_config_blocks; ++i) { in ubx_m8_set_enabled_systems()
735 ret = ubx_m8_ubx_gnss_id_to_gnss_system(dev, payload->config_blocks[i].gnss_id); in ubx_m8_set_enabled_systems()
741 res_trk_ch_sum += payload->config_blocks[i].num_res_trk_ch; in ubx_m8_set_enabled_systems()
742 max_trk_ch_sum += payload->config_blocks[i].max_num_trk_ch; in ubx_m8_set_enabled_systems()
745 if (res_trk_ch_sum > payload->num_trk_ch_use || in ubx_m8_set_enabled_systems()
746 max_trk_ch_sum > payload->num_trk_ch_use) { in ubx_m8_set_enabled_systems()
747 ret = -EINVAL; in ubx_m8_set_enabled_systems()
752 /* Prepare payload (payload) for sending CFG-GNSS for enabling the gnss systems. */ in ubx_m8_set_enabled_systems()
756 ret = -ENOMEM; in ubx_m8_set_enabled_systems()
760 payload->num_config_blocks = UBX_M8_GNSS_SUPP_SYS_CNT; in ubx_m8_set_enabled_systems()
796 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_set_enabled_systems()
807 k_spin_unlock(&data->lock, key); in ubx_m8_set_enabled_systems()
816 struct ubx_m8_data *data = dev->data; in ubx_m8_get_enabled_systems()
818 key = k_spin_lock(&data->lock); in ubx_m8_get_enabled_systems()
826 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_get_enabled_systems()
831 struct ubx_frame *response = data->script.response; in ubx_m8_get_enabled_systems()
833 (struct ubx_cfg_gnss_payload *) response->payload_and_checksum; in ubx_m8_get_enabled_systems()
836 for (int i = 0; i < payload->num_config_blocks; ++i) { in ubx_m8_get_enabled_systems()
837 if (payload->config_blocks[i].flags & UBX_CFG_GNSS_FLAG_ENABLE) { in ubx_m8_get_enabled_systems()
838 enum ubx_gnss_id gnss_id = payload->config_blocks[i].gnss_id; in ubx_m8_get_enabled_systems()
850 k_spin_unlock(&data->lock, key); in ubx_m8_get_enabled_systems()
859 struct ubx_m8_data *data = dev->data; in ubx_m8_set_fix_rate()
863 return -1; in ubx_m8_set_fix_rate()
866 key = k_spin_lock(&data->lock); in ubx_m8_set_fix_rate()
877 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_set_fix_rate()
880 k_spin_unlock(&data->lock, key); in ubx_m8_set_fix_rate()
889 struct ubx_m8_data *data = dev->data; in ubx_m8_get_fix_rate()
892 key = k_spin_lock(&data->lock); in ubx_m8_get_fix_rate()
900 ret = ubx_m8_modem_ubx_run_script(dev, &(data->script)); in ubx_m8_get_fix_rate()
905 struct ubx_frame *response = data->script.response; in ubx_m8_get_fix_rate()
907 payload = (struct ubx_cfg_rate_payload *) response->payload_and_checksum; in ubx_m8_get_fix_rate()
908 *fix_interval_ms = payload->meas_rate_ms; in ubx_m8_get_fix_rate()
911 k_spin_unlock(&data->lock, key); in ubx_m8_get_fix_rate()