Lines Matching refs:wr_idx
19 static uint32_t idx_occupied(uint32_t len, uint32_t wr_idx, uint32_t rd_idx) in idx_occupied() argument
22 return (rd_idx > wr_idx) ? (len - (rd_idx - wr_idx)) : (wr_idx - rd_idx); in idx_occupied()
80 pb->data.wr_idx = 0; in pbuf_tx_init()
84 *(pb->cfg->wr_idx_loc) = pb->data.wr_idx; in pbuf_tx_init()
106 pb->data.wr_idx = 0; in pbuf_rx_init()
126 uint32_t wr_idx = pb->data.wr_idx; in pbuf_write() local
129 __ASSERT_NO_MSG(IS_PTR_ALIGNED_BYTES(wr_idx, _PBUF_IDX_SIZE)); in pbuf_write()
137 uint32_t free_space = blen - idx_occupied(blen, wr_idx, rd_idx) - _PBUF_IDX_SIZE; in pbuf_write()
150 *((uint32_t *)(&data_loc[wr_idx])) = 0; in pbuf_write()
151 sys_put_be16(len, &data_loc[wr_idx]); in pbuf_write()
153 sys_cache_data_flush_range(&data_loc[wr_idx], PBUF_PACKET_LEN_SZ); in pbuf_write()
155 wr_idx = idx_wrap(blen, wr_idx + PBUF_PACKET_LEN_SZ); in pbuf_write()
158 uint32_t tail = MIN(len, blen - wr_idx); in pbuf_write()
160 memcpy(&data_loc[wr_idx], data, tail); in pbuf_write()
161 sys_cache_data_flush_range(&data_loc[wr_idx], tail); in pbuf_write()
169 wr_idx = idx_wrap(blen, ROUND_UP(wr_idx + len, _PBUF_IDX_SIZE)); in pbuf_write()
171 pb->data.wr_idx = wr_idx; in pbuf_write()
172 *(pb->cfg->wr_idx_loc) = wr_idx; in pbuf_write()
192 uint32_t wr_idx = *(pb->cfg->wr_idx_loc); in pbuf_read() local
200 if (!IS_PTR_ALIGNED_BYTES(wr_idx, _PBUF_IDX_SIZE)) { in pbuf_read()
204 if (rd_idx == wr_idx) { in pbuf_read()
221 uint32_t occupied_space = idx_occupied(blen, wr_idx, rd_idx); in pbuf_read()