Lines Matching refs:frame
129 static void modem_cmux_log_frame(const struct modem_cmux_frame *frame, in modem_cmux_log_frame() argument
132 LOG_DBG("%s ch:%u cr:%u pf:%u type:%s dlen:%u", action, frame->dlci_address, in modem_cmux_log_frame()
133 frame->cr, frame->pf, modem_cmux_frame_type_to_str(frame->type), frame->data_len); in modem_cmux_log_frame()
134 LOG_HEXDUMP_DBG(frame->data, hexdump_len, "data:"); in modem_cmux_log_frame()
137 static void modem_cmux_log_transmit_frame(const struct modem_cmux_frame *frame) in modem_cmux_log_transmit_frame() argument
139 modem_cmux_log_frame(frame, "tx", frame->data_len); in modem_cmux_log_transmit_frame()
142 static void modem_cmux_log_received_frame(const struct modem_cmux_frame *frame) in modem_cmux_log_received_frame() argument
144 modem_cmux_log_frame(frame, "rcvd", frame->data_len); in modem_cmux_log_received_frame()
267 const struct modem_cmux_frame *frame) in modem_cmux_transmit_frame() argument
276 data_len = MIN(space, frame->data_len); in modem_cmux_transmit_frame()
282 buf[1] = 0x01 | (frame->cr << 1) | (frame->dlci_address << 2); in modem_cmux_transmit_frame()
285 buf[2] = frame->type | (frame->pf << 4); in modem_cmux_transmit_frame()
301 if (frame->type == MODEM_CMUX_FRAME_TYPE_UIH) { in modem_cmux_transmit_frame()
304 fcs = 0xFF - crc8_rohc(fcs, frame->data, data_len); in modem_cmux_transmit_frame()
311 ring_buf_put(&cmux->transmit_rb, frame->data, data_len); in modem_cmux_transmit_frame()
322 const struct modem_cmux_frame *frame) in modem_cmux_transmit_cmd_frame() argument
335 modem_cmux_log_transmit_frame(frame); in modem_cmux_transmit_cmd_frame()
336 if (modem_cmux_wrap_command(&command, frame->data, frame->data_len) == 0) { in modem_cmux_transmit_cmd_frame()
340 modem_cmux_transmit_frame(cmux, frame); in modem_cmux_transmit_cmd_frame()
346 const struct modem_cmux_frame *frame) in modem_cmux_transmit_data_frame() argument
372 modem_cmux_log_transmit_frame(frame); in modem_cmux_transmit_data_frame()
373 ret = modem_cmux_transmit_frame(cmux, frame); in modem_cmux_transmit_data_frame()
381 struct modem_cmux_frame frame; in modem_cmux_acknowledge_received_frame() local
384 if (sizeof(data) < cmux->frame.data_len) { in modem_cmux_acknowledge_received_frame()
389 memcpy(&frame, &cmux->frame, sizeof(cmux->frame)); in modem_cmux_acknowledge_received_frame()
390 memcpy(data, cmux->frame.data, cmux->frame.data_len); in modem_cmux_acknowledge_received_frame()
391 modem_cmux_wrap_command(&command, data, cmux->frame.data_len); in modem_cmux_acknowledge_received_frame()
393 frame.data = data; in modem_cmux_acknowledge_received_frame()
394 frame.data_len = cmux->frame.data_len; in modem_cmux_acknowledge_received_frame()
396 if (modem_cmux_transmit_cmd_frame(cmux, &frame) == false) { in modem_cmux_acknowledge_received_frame()
477 if (modem_cmux_wrap_command(&command, cmux->frame.data, cmux->frame.data_len) < 0) { in modem_cmux_on_control_frame_uih()
513 struct modem_cmux_frame frame = { in modem_cmux_connect_response_transmit() local
514 .dlci_address = cmux->frame.dlci_address, in modem_cmux_connect_response_transmit()
515 .cr = cmux->frame.cr, in modem_cmux_connect_response_transmit()
516 .pf = cmux->frame.pf, in modem_cmux_connect_response_transmit()
523 modem_cmux_transmit_cmd_frame(cmux, &frame); in modem_cmux_connect_response_transmit()
547 modem_cmux_log_received_frame(&cmux->frame); in modem_cmux_on_control_frame()
549 switch (cmux->frame.type) { in modem_cmux_on_control_frame()
576 if (dlci->dlci_address == cmux->frame.dlci_address) { in modem_cmux_find_dlci()
619 written = ring_buf_put(&dlci->receive_rb, cmux->frame.data, cmux->frame.data_len); in modem_cmux_on_dlci_frame_uih()
621 if (written != cmux->frame.data_len) { in modem_cmux_on_dlci_frame_uih()
623 dlci->dlci_address, cmux->frame.data_len - written, cmux->frame.data_len); in modem_cmux_on_dlci_frame_uih()
665 modem_cmux_log_received_frame(&cmux->frame); in modem_cmux_on_dlci_frame()
670 cmux->frame.dlci_address); in modem_cmux_on_dlci_frame()
674 switch (cmux->frame.type) { in modem_cmux_on_dlci_frame()
703 if (cmux->frame.dlci_address == 0) { in modem_cmux_on_frame()
720 struct modem_cmux_frame *frame = &cmux->frame; in modem_cmux_drop_frame() local
722 frame->data = cmux->receive_buf; in modem_cmux_drop_frame()
723 modem_cmux_log_frame(frame, "dropped", MIN(frame->data_len, cmux->receive_buf_size)); in modem_cmux_drop_frame()
761 cmux->frame.cr = (byte & 0x02) ? true : false; in modem_cmux_process_received_byte()
764 cmux->frame.dlci_address = (byte >> 2) & 0x3F; in modem_cmux_process_received_byte()
776 cmux->frame.pf = (byte & MODEM_CMUX_PF) ? true : false; in modem_cmux_process_received_byte()
779 cmux->frame.type = byte & (~MODEM_CMUX_PF); in modem_cmux_process_received_byte()
791 cmux->frame.data_len = (byte >> 1); in modem_cmux_process_received_byte()
801 if (cmux->frame.data_len == 0) { in modem_cmux_process_received_byte()
817 cmux->frame.data_len |= ((uint16_t)byte) << 7; in modem_cmux_process_received_byte()
819 if (cmux->frame.data_len > cmux->receive_buf_size) { in modem_cmux_process_received_byte()
821 cmux->frame.data_len, cmux->receive_buf_size); in modem_cmux_process_received_byte()
839 if (cmux->frame.data_len == cmux->receive_buf_len) { in modem_cmux_process_received_byte()
857 if (cmux->frame.type == MODEM_CMUX_FRAME_TYPE_UIH) { in modem_cmux_process_received_byte()
860 fcs = 0xFF - crc8_rohc(fcs, cmux->frame.data, cmux->frame.data_len); in modem_cmux_process_received_byte()
888 cmux->frame.data = cmux->receive_buf; in modem_cmux_process_received_byte()
998 static const struct modem_cmux_frame frame = { in modem_cmux_connect_handler() local
1007 modem_cmux_transmit_cmd_frame(cmux, &frame); in modem_cmux_connect_handler()
1027 struct modem_cmux_frame frame = { in modem_cmux_disconnect_handler() local
1037 modem_cmux_transmit_cmd_frame(cmux, &frame); in modem_cmux_disconnect_handler()
1106 struct modem_cmux_frame frame = { in modem_cmux_dlci_pipe_api_transmit() local
1115 ret = modem_cmux_transmit_data_frame(cmux, &frame); in modem_cmux_dlci_pipe_api_transmit()
1181 struct modem_cmux_frame frame = { in modem_cmux_dlci_open_handler() local
1190 modem_cmux_transmit_cmd_frame(dlci->cmux, &frame); in modem_cmux_dlci_open_handler()
1210 struct modem_cmux_frame frame = { in modem_cmux_dlci_close_handler() local
1219 modem_cmux_transmit_cmd_frame(cmux, &frame); in modem_cmux_dlci_close_handler()