Lines Matching +full:tx +full:- +full:sync +full:- +full:mode
4 * SPDX-License-Identifier: Apache-2.0
13 * When IPv6 support enabled - the minimal size of network buffer
24 const struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1 }; in oa_tc6_reg_read() local
32 * When non-protected case - we need to decrase them in oa_tc6_reg_read()
34 if (!tc6->protected) { in oa_tc6_reg_read()
35 tx_buf.len -= sizeof(rvn); in oa_tc6_reg_read()
36 rx_buf.len -= sizeof(rvn); in oa_tc6_reg_read()
49 ret = spi_transceive_dt(tc6->spi, &tx, &rx); in oa_tc6_reg_read()
58 return -1; in oa_tc6_reg_read()
63 /* In protected mode read data is followed by its compliment value */ in oa_tc6_reg_read()
64 if (tc6->protected) { in oa_tc6_reg_read()
67 LOG_ERR("Protected mode transmission error!"); in oa_tc6_reg_read()
68 return -1; in oa_tc6_reg_read()
82 const struct spi_buf_set tx = { .buffers = &tx_buf, .count = 1 }; in oa_tc6_reg_write() local
90 * When non-protected case - we need to decrase them in oa_tc6_reg_write()
92 if (!tc6->protected) { in oa_tc6_reg_write()
93 tx_buf.len -= sizeof(rvn); in oa_tc6_reg_write()
94 rx_buf.len -= sizeof(rvn); in oa_tc6_reg_write()
108 if (tc6->protected) { in oa_tc6_reg_write()
112 ret = spi_transceive_dt(tc6->spi, &tx, &rx); in oa_tc6_reg_write()
121 return -1; in oa_tc6_reg_write()
128 return -1; in oa_tc6_reg_write()
132 * In protected mode check if read value is followed by its in oa_tc6_reg_write()
135 if (tc6->protected) { in oa_tc6_reg_write()
138 LOG_ERR("Protected mode transmission error!"); in oa_tc6_reg_write()
139 return -1; in oa_tc6_reg_write()
174 tc6->protected = prote; in oa_tc6_set_protected_ctrl()
181 uint8_t oa_tx[tc6->cps]; in oa_tc6_send_chunks()
187 return -ENODATA; in oa_tc6_send_chunks()
190 chunks = len / tc6->cps; in oa_tc6_send_chunks()
191 if (len % tc6->cps) { in oa_tc6_send_chunks()
196 if (chunks > tc6->txc) { in oa_tc6_send_chunks()
197 return -EIO; in oa_tc6_send_chunks()
212 hdr |= FIELD_PREP(OA_DATA_HDR_EBO, len - 1) | in oa_tc6_send_chunks()
218 ret = net_pkt_read(pkt, oa_tx, len > tc6->cps ? tc6->cps : len); in oa_tc6_send_chunks()
228 len -= tc6->cps; in oa_tc6_send_chunks()
238 if (!tc6->sync) { in oa_tc6_check_status()
239 LOG_ERR("SYNC: Configuration lost, reset IC!"); in oa_tc6_check_status()
240 return -EIO; in oa_tc6_check_status()
243 if (tc6->exst) { in oa_tc6_check_status()
269 return -EIO; in oa_tc6_update_status()
272 tc6->exst = FIELD_GET(OA_DATA_FTR_EXST, ftr); in oa_tc6_update_status()
273 tc6->sync = FIELD_GET(OA_DATA_FTR_SYNC, ftr); in oa_tc6_update_status()
274 tc6->rca = FIELD_GET(OA_DATA_FTR_RCA, ftr); in oa_tc6_update_status()
275 tc6->txc = FIELD_GET(OA_DATA_FTR_TXC, ftr); in oa_tc6_update_status()
285 struct spi_buf_set tx; in oa_tc6_chunk_spi_transfer() local
294 tx_buf[1].len = tc6->cps; in oa_tc6_chunk_spi_transfer()
296 tx.buffers = tx_buf; in oa_tc6_chunk_spi_transfer()
297 tx.count = ARRAY_SIZE(tx_buf); in oa_tc6_chunk_spi_transfer()
300 rx_buf[0].len = tc6->cps; in oa_tc6_chunk_spi_transfer()
308 ret = spi_transceive_dt(tc6->spi, &tx, &rx); in oa_tc6_chunk_spi_transfer()
339 * Special case - append already received data (extracted from previous in oa_tc6_read_chunks()
343 * (ZAREFE) - so received ethernet frames will always start on the in oa_tc6_read_chunks()
346 if (tc6->concat_buf) { in oa_tc6_read_chunks()
347 net_pkt_append_buffer(pkt, tc6->concat_buf); in oa_tc6_read_chunks()
348 tc6->concat_buf = NULL; in oa_tc6_read_chunks()
356 return -ENOMEM; in oa_tc6_read_chunks()
363 ret = oa_tc6_chunk_spi_transfer(tc6, buf_rx->data + buf_rx_used, NULL, hdr, &ftr); in oa_tc6_read_chunks()
369 ret = -EIO; in oa_tc6_read_chunks()
376 LOG_ERR("OA RX: Configuration not SYNC'ed!"); in oa_tc6_read_chunks()
403 * Check if received frame shall be dropped - i.e. MAC has in oa_tc6_read_chunks()
408 ret = -EIO; in oa_tc6_read_chunks()
413 * Concatenation of frames in a single chunk - one frame ends in oa_tc6_read_chunks()
417 tc6->concat_buf = net_buf_clone(buf_rx, OA_TC6_BUF_ALLOC_TIMEOUT); in oa_tc6_read_chunks()
418 if (!tc6->concat_buf) { in oa_tc6_read_chunks()
420 ret = -ENOMEM; in oa_tc6_read_chunks()
423 net_buf_pull(tc6->concat_buf, sbo); in oa_tc6_read_chunks()
428 buf_rx->len = buf_rx_used; in oa_tc6_read_chunks()
436 buf_rx_used += tc6->cps; in oa_tc6_read_chunks()
437 if ((buf_rx_size - buf_rx_used) < tc6->cps) { in oa_tc6_read_chunks()
439 buf_rx->len = buf_rx_used; in oa_tc6_read_chunks()
444 } while (tc6->rca > 0); in oa_tc6_read_chunks()