Lines Matching refs:rd_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()
81 pb->data.rd_idx = 0; in pbuf_tx_init()
85 *(pb->cfg->rd_idx_loc) = pb->data.rd_idx; in pbuf_tx_init()
107 pb->data.rd_idx = 0; in pbuf_rx_init()
125 uint32_t rd_idx = *(pb->cfg->rd_idx_loc); in pbuf_write() local
133 if (!IS_PTR_ALIGNED_BYTES(rd_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()
193 uint32_t rd_idx = pb->data.rd_idx; in pbuf_read() local
196 __ASSERT_NO_MSG(IS_PTR_ALIGNED_BYTES(rd_idx, _PBUF_IDX_SIZE)); in pbuf_read()
204 if (rd_idx == wr_idx) { in pbuf_read()
210 sys_cache_data_invd_range(&data_loc[rd_idx], PBUF_PACKET_LEN_SZ); in pbuf_read()
211 uint16_t plen = sys_get_be16(&data_loc[rd_idx]); in pbuf_read()
221 uint32_t occupied_space = idx_occupied(blen, wr_idx, rd_idx); in pbuf_read()
228 rd_idx = idx_wrap(blen, rd_idx + PBUF_PACKET_LEN_SZ); in pbuf_read()
236 uint32_t tail = MIN(blen - rd_idx, len); in pbuf_read()
238 sys_cache_data_invd_range(&data_loc[rd_idx], tail); in pbuf_read()
239 memcpy(buf, &data_loc[rd_idx], tail); in pbuf_read()
247 rd_idx = idx_wrap(blen, ROUND_UP(rd_idx + len, _PBUF_IDX_SIZE)); in pbuf_read()
249 pb->data.rd_idx = rd_idx; in pbuf_read()
250 *(pb->cfg->rd_idx_loc) = rd_idx; in pbuf_read()