Lines Matching refs:cfg
31 static int validate_cfg(const struct pbuf_cfg *cfg) in validate_cfg() argument
34 if (!cfg || !cfg->rd_idx_loc || !cfg->wr_idx_loc || !cfg->data_loc) { in validate_cfg()
39 if (!IS_PTR_ALIGNED_BYTES(cfg->rd_idx_loc, MAX(cfg->dcache_alignment, _PBUF_IDX_SIZE)) || in validate_cfg()
40 !IS_PTR_ALIGNED_BYTES(cfg->wr_idx_loc, MAX(cfg->dcache_alignment, _PBUF_IDX_SIZE)) || in validate_cfg()
41 !IS_PTR_ALIGNED_BYTES(cfg->data_loc, _PBUF_IDX_SIZE)) { in validate_cfg()
46 if (cfg->len < _PBUF_MIN_DATA_LEN || !IS_PTR_ALIGNED_BYTES(cfg->len, _PBUF_IDX_SIZE)) { in validate_cfg()
51 if (!(cfg->rd_idx_loc < cfg->wr_idx_loc) || in validate_cfg()
52 !((uint8_t *)cfg->wr_idx_loc < cfg->data_loc) || in validate_cfg()
53 !(((uint8_t *)cfg->rd_idx_loc + MAX(_PBUF_IDX_SIZE, cfg->dcache_alignment)) == in validate_cfg()
54 (uint8_t *)cfg->wr_idx_loc)) { in validate_cfg()
64 native_emb_addr_remap((void **)&pb->cfg->rd_idx_loc); in pbuf_native_addr_remap()
65 native_emb_addr_remap((void **)&pb->cfg->wr_idx_loc); in pbuf_native_addr_remap()
66 native_emb_addr_remap((void **)&pb->cfg->data_loc); in pbuf_native_addr_remap()
72 if (validate_cfg(pb->cfg) != 0) { in pbuf_tx_init()
84 *(pb->cfg->wr_idx_loc) = pb->data.wr_idx; in pbuf_tx_init()
85 *(pb->cfg->rd_idx_loc) = pb->data.rd_idx; in pbuf_tx_init()
90 sys_cache_data_flush_range((void *)(pb->cfg->wr_idx_loc), sizeof(*(pb->cfg->wr_idx_loc))); in pbuf_tx_init()
91 sys_cache_data_flush_range((void *)(pb->cfg->rd_idx_loc), sizeof(*(pb->cfg->rd_idx_loc))); in pbuf_tx_init()
98 if (validate_cfg(pb->cfg) != 0) { in pbuf_rx_init()
120 sys_cache_data_invd_range((void *)(pb->cfg->rd_idx_loc), sizeof(*(pb->cfg->rd_idx_loc))); in pbuf_write()
123 uint8_t *const data_loc = pb->cfg->data_loc; in pbuf_write()
124 const uint32_t blen = pb->cfg->len; in pbuf_write()
125 uint32_t rd_idx = *(pb->cfg->rd_idx_loc); in pbuf_write()
172 *(pb->cfg->wr_idx_loc) = wr_idx; in pbuf_write()
174 sys_cache_data_flush_range((void *)pb->cfg->wr_idx_loc, sizeof(*(pb->cfg->wr_idx_loc))); in pbuf_write()
187 sys_cache_data_invd_range((void *)(pb->cfg->wr_idx_loc), sizeof(*(pb->cfg->wr_idx_loc))); in pbuf_read()
190 uint8_t *const data_loc = pb->cfg->data_loc; in pbuf_read()
191 const uint32_t blen = pb->cfg->len; in pbuf_read()
192 uint32_t wr_idx = *(pb->cfg->wr_idx_loc); in pbuf_read()
243 memcpy(&buf[tail], &pb->cfg->data_loc[0], len - tail); in pbuf_read()
250 *(pb->cfg->rd_idx_loc) = rd_idx; in pbuf_read()
252 sys_cache_data_flush_range((void *)pb->cfg->rd_idx_loc, sizeof(*(pb->cfg->rd_idx_loc))); in pbuf_read()