Lines Matching +full:buffer +full:- +full:size

4  * SPDX-License-Identifier: Apache-2.0
18 * @brief Packed buffer API
19 * @defgroup pbuf Packed Buffer API
24 /** @brief Size of packet length field. */
30 /* Minimal length of the data field in the buffer to store the smalest packet
33 * (+_PBUF_IDX_SIZE) to distinguish buffer full and buffer empty.
45 /** @brief Control block of packet buffer.
58 uint32_t dcache_alignment; /* CPU data cache line size in bytes.
59 * Used for validation - TODO: To be
67 * @brief Data block of the packed buffer.
85 * @brief Scure packed buffer.
87 * The packet buffer implements lightweight unidirectional packet
88 * buffer with read/write semantics on top of a memory region shared
92 * This structure supports single writer and reader. Data stored in the buffer
98 * buffer.
101 * to the buffer
108 * It is recommended to use this macro to initialize packed buffer
112 * @param size Size of the memory.
115 #define PBUF_CFG_INIT(mem_addr, size, dcache_align) \ argument
122 .len = (uint32_t)((uint32_t)(size) - MAX(dcache_align, _PBUF_IDX_SIZE) - \
142 * @param size Size of the memory.
143 * @param dcache_align Data cache line size.
145 #define PBUF_DEFINE(name, mem_addr, size, dcache_align) \ argument
147 "Cache line size must be non negative."); \
148 BUILD_ASSERT((size) > 0 && IS_PTR_ALIGNED_BYTES(size, _PBUF_IDX_SIZE), \
149 "Incorrect size."); \
152 BUILD_ASSERT(size >= (MAX(dcache_align, _PBUF_IDX_SIZE) + _PBUF_IDX_SIZE + \
153 _PBUF_MIN_DATA_LEN), "Insufficient size."); \
155 PBUF_CFG_INIT(mem_addr, size, dcache_align); \
161 * @brief Initialize the Tx packet buffer.
163 * This function initializes the Tx packet buffer based on provided configuration.
168 * @param pb Pointer to the packed buffer containing
172 * @retval -EINVAL when the input parameter is incorrect.
177 * @brief Initialize the Rx packet buffer.
179 * This function initializes the Rx packet buffer.
184 * @param pb Pointer to the packed buffer containing
188 * @retval -EINVAL when the input parameter is incorrect.
193 * @brief Write specified amount of data to the packet buffer.
195 * This function call writes specified amount of data to the packet buffer if
196 * the buffer will fit the data.
198 * @param pb A buffer to which to write.
199 * @param buf Pointer to the data to be written to the buffer.
200 * @param len Number of bytes to be written to the buffer. Must be positive.
202 * -EINVAL, if any of input parameter is incorrect.
203 * -ENOMEM, if len is bigger than the buffer can fit.
209 * @brief Read specified amount of data from the packet buffer.
214 * @param pb A buffer from which data will be read.
217 * @param len Number of bytes to be read from the buffer.
220 * -EINVAL, if any of input parameter is incorrect.
221 * -ENOMEM, if message can not fit in provided buf.
222 * -EAGAIN, if not whole message is ready yet.