Lines Matching +full:pre +full:- +full:delay

4  * SPDX-License-Identifier: Apache-2.0
7 /** SMP - Simple Management Client Protocol. */
59 smpt = smp_client->smpt; in smp_client_handle_reqs()
61 while ((nb = k_fifo_get(&smp_client->tx_fifo, K_NO_WAIT)) != NULL) { in smp_client_handle_reqs()
62 smpt->functions.output(nb); in smp_client_handle_reqs()
69 /* Pre config SMP header structure */ in smp_header_init()
71 header->nh_version = version; in smp_header_init()
72 header->nh_op = op; in smp_header_init()
73 header->nh_len = sys_cpu_to_be16(payload_len); in smp_header_init()
74 header->nh_group = sys_cpu_to_be16(group); in smp_header_init()
75 header->nh_id = id; in smp_header_init()
76 header->nh_seq = seq; in smp_header_init()
97 time_stamp_ref = entry->timestamp; in smp_client_transport_work_fn()
102 time_stamp_cmp = entry->timestamp - time_stamp_ref; in smp_client_transport_work_fn()
109 } else if (entry->retry_cnt) { in smp_client_transport_work_fn()
110 /* Increment reference for re-transmission */ in smp_client_transport_work_fn()
111 entry->nb = net_buf_ref(entry->nb); in smp_client_transport_work_fn()
112 entry->retry_cnt--; in smp_client_transport_work_fn()
113 entry->timestamp = time_stamp_ref + CONFIG_SMP_CMD_RETRY_TIME; in smp_client_transport_work_fn()
114 k_fifo_put(&entry->smp_client->tx_fifo, entry->nb); in smp_client_transport_work_fn()
115 k_work_submit_to_queue(smp_get_wq(), &entry->smp_client->work); in smp_client_transport_work_fn()
119 cb = entry->cb; in smp_client_transport_work_fn()
120 user_data = entry->user_data; in smp_client_transport_work_fn()
128 /* Re-schedule new timeout to next */ in smp_client_transport_work_fn()
167 sys_slist_append(&smp_client_data.cmd_list, &cmd_req->node); in smp_cmd_add_to_list()
172 smp_client_buf_free(cmd_req->nb); in smp_client_cmd_req_free()
173 cmd_req->nb = NULL; in smp_client_cmd_req_free()
174 sys_slist_find_and_remove(&smp_client_data.cmd_list, &cmd_req->node); in smp_client_cmd_req_free()
176 sys_slist_append(&smp_client_data.cmd_free_list, &cmd_req->node); in smp_client_cmd_req_free()
179 /* cancel delay */ in smp_client_cmd_req_free()
195 smp_read_hdr(cmd_req->nb, &smp_header); in smp_client_response_discover()
202 if (smp_header.nh_seq != res_hdr->nh_seq) { in smp_client_response_discover()
204 } else if (res_hdr->nh_op != response) { in smp_client_response_discover()
215 smp_client->smpt = smp_client_transport_get(smp_type); in smp_client_object_init()
216 if (!smp_client->smpt) { in smp_client_object_init()
221 k_work_init(&smp_client->work, smp_client_handle_reqs); in smp_client_object_init()
222 k_fifo_init(&smp_client->tx_fifo); in smp_client_object_init()
235 LOG_DBG("Response Header len %d, flags %d OP: %d group %d id %d seq %d", res_hdr->nh_len, in smp_client_single_response()
236 res_hdr->nh_flags, res_hdr->nh_op, res_hdr->nh_group, res_hdr->nh_id, in smp_client_single_response()
237 res_hdr->nh_seq); in smp_client_single_response()
240 cb = cmd_req->cb; in smp_client_single_response()
241 user_data = cmd_req->user_data; in smp_client_single_response()
263 smp_header_init(&smp_header, group, command_id, op, 0, smp_client->smp_seq++, in smp_client_buf_allocation()
265 memcpy(nb->data, &smp_header, sizeof(smp_header)); in smp_client_buf_allocation()
266 nb->len = sizeof(smp_header); in smp_client_buf_allocation()
278 memcpy(dst_hdr, nb->data, sizeof(*dst_hdr)); in smp_read_hdr()
279 dst_hdr->nh_len = sys_be16_to_cpu(dst_hdr->nh_len); in smp_read_hdr()
280 dst_hdr->nh_group = sys_be16_to_cpu(dst_hdr->nh_group); in smp_read_hdr()
299 if (nb->len < sizeof(smp_header)) { in smp_client_send_cmd()
303 smp_header.nh_len = sys_cpu_to_be16(nb->len - sizeof(smp_header)); in smp_client_send_cmd()
305 memcpy(nb->data, &smp_header, sizeof(smp_header)); in smp_client_send_cmd()
315 cmd_req->nb = nb; in smp_client_send_cmd()
316 cmd_req->cb = cb; in smp_client_send_cmd()
317 cmd_req->smp_client = smp_client; in smp_client_send_cmd()
318 cmd_req->user_data = user_data; in smp_client_send_cmd()
319 cmd_req->retry_cnt = timeout_in_sec * (1000 / CONFIG_SMP_CMD_RETRY_TIME); in smp_client_send_cmd()
320 cmd_req->timestamp = k_uptime_get() + CONFIG_SMP_CMD_RETRY_TIME; in smp_client_send_cmd()
321 /* Increment reference for re-transmission and read smp header */ in smp_client_send_cmd()
324 k_fifo_put(&smp_client->tx_fifo, nb); in smp_client_send_cmd()
325 k_work_submit_to_queue(smp_get_wq(), &smp_client->work); in smp_client_send_cmd()