@@ -5211,206 +5211,6 @@ void k_mbox_data_get(struct k_mbox_msg *rx_msg, void *buffer);
52115211 */
52125212__syscall void k_pipe_init (struct k_pipe * pipe , uint8_t * buffer , size_t buffer_size );
52135213
5214- #ifdef CONFIG_PIPES
5215- /** Pipe Structure */
5216- struct k_pipe {
5217- unsigned char * buffer ; /**< Pipe buffer: may be NULL */
5218- size_t size ; /**< Buffer size */
5219- size_t bytes_used ; /**< Number of bytes used in buffer */
5220- size_t read_index ; /**< Where in buffer to read from */
5221- size_t write_index ; /**< Where in buffer to write */
5222- struct k_spinlock lock ; /**< Synchronization lock */
5223-
5224- struct {
5225- _wait_q_t readers ; /**< Reader wait queue */
5226- _wait_q_t writers ; /**< Writer wait queue */
5227- } wait_q ; /** Wait queue */
5228-
5229- Z_DECL_POLL_EVENT
5230-
5231- uint8_t flags ; /**< Flags */
5232-
5233- SYS_PORT_TRACING_TRACKING_FIELD (k_pipe )
5234-
5235- #ifdef CONFIG_OBJ_CORE_PIPE
5236- struct k_obj_core obj_core ;
5237- #endif
5238- };
5239-
5240- /**
5241- * @cond INTERNAL_HIDDEN
5242- */
5243- #define K_PIPE_FLAG_ALLOC BIT(0) /** Buffer was allocated */
5244-
5245- #define Z_PIPE_INITIALIZER (obj , pipe_buffer , pipe_buffer_size ) \
5246- { \
5247- .buffer = pipe_buffer, \
5248- .size = pipe_buffer_size, \
5249- .bytes_used = 0, \
5250- .read_index = 0, \
5251- .write_index = 0, \
5252- .lock = {}, \
5253- .wait_q = { \
5254- .readers = Z_WAIT_Q_INIT(&obj.wait_q.readers), \
5255- .writers = Z_WAIT_Q_INIT(&obj.wait_q.writers) \
5256- }, \
5257- Z_POLL_EVENT_OBJ_INIT(obj) \
5258- .flags = 0, \
5259- }
5260-
5261- /**
5262- * INTERNAL_HIDDEN @endcond
5263- */
5264-
5265- /**
5266- * @brief Statically define and initialize a pipe.
5267- *
5268- * The pipe can be accessed outside the module where it is defined using:
5269- *
5270- * @code extern struct k_pipe <name>; @endcode
5271- *
5272- * @param name Name of the pipe.
5273- * @param pipe_buffer_size Size of the pipe's ring buffer (in bytes),
5274- * or zero if no ring buffer is used.
5275- * @param pipe_align Alignment of the pipe's ring buffer (power of 2).
5276- *
5277- */
5278- #define K_PIPE_DEFINE (name , pipe_buffer_size , pipe_align ) \
5279- static unsigned char __noinit __aligned(pipe_align) \
5280- _k_pipe_buf_##name[pipe_buffer_size]; \
5281- STRUCT_SECTION_ITERABLE(k_pipe, name) = \
5282- Z_PIPE_INITIALIZER(name, _k_pipe_buf_##name, pipe_buffer_size)
5283-
5284- /**
5285- * @deprecated Dynamic allocation of pipe buffers will be removed in the new k_pipe API.
5286- * @brief Release a pipe's allocated buffer
5287- *
5288- * If a pipe object was given a dynamically allocated buffer via
5289- * k_pipe_alloc_init(), this will free it. This function does nothing
5290- * if the buffer wasn't dynamically allocated.
5291- *
5292- * @param pipe Address of the pipe.
5293- * @retval 0 on success
5294- * @retval -EAGAIN nothing to cleanup
5295- */
5296- __deprecated int k_pipe_cleanup (struct k_pipe * pipe );
5297-
5298- /**
5299- * @deprecated Dynamic allocation of pipe buffers will be removed in the new k_pipe API.
5300- * @brief Initialize a pipe and allocate a buffer for it
5301- *
5302- * Storage for the buffer region will be allocated from the calling thread's
5303- * resource pool. This memory will be released if k_pipe_cleanup() is called,
5304- * or userspace is enabled and the pipe object loses all references to it.
5305- *
5306- * This function should only be called on uninitialized pipe objects.
5307- *
5308- * @param pipe Address of the pipe.
5309- * @param size Size of the pipe's ring buffer (in bytes), or zero if no ring
5310- * buffer is used.
5311- * @retval 0 on success
5312- * @retval -ENOMEM if memory couldn't be allocated
5313- */
5314- __deprecated __syscall int k_pipe_alloc_init (struct k_pipe * pipe , size_t size );
5315-
5316- /**
5317- * @deprecated k_pipe_put() is replaced by k_pipe_write(...) in the new k_pipe API.
5318- * @brief Write data to a pipe.
5319- *
5320- * This routine writes up to @a bytes_to_write bytes of data to @a pipe.
5321- *
5322- * @param pipe Address of the pipe.
5323- * @param data Address of data to write.
5324- * @param bytes_to_write Size of data (in bytes).
5325- * @param bytes_written Address of area to hold the number of bytes written.
5326- * @param min_xfer Minimum number of bytes to write.
5327- * @param timeout Waiting period to wait for the data to be written,
5328- * or one of the special values K_NO_WAIT and K_FOREVER.
5329- *
5330- * @retval 0 At least @a min_xfer bytes of data were written.
5331- * @retval -EIO Returned without waiting; zero data bytes were written.
5332- * @retval -EAGAIN Waiting period timed out; between zero and @a min_xfer
5333- * minus one data bytes were written.
5334- */
5335- __deprecated __syscall int k_pipe_put (struct k_pipe * pipe , const void * data ,
5336- size_t bytes_to_write , size_t * bytes_written ,
5337- size_t min_xfer , k_timeout_t timeout );
5338-
5339- /**
5340- * @deprecated k_pipe_get() is replaced by k_pipe_read(...) in the new k_pipe API.
5341- * @brief Read data from a pipe.
5342- *
5343- * This routine reads up to @a bytes_to_read bytes of data from @a pipe.
5344- *
5345- * @param pipe Address of the pipe.
5346- * @param data Address to place the data read from pipe.
5347- * @param bytes_to_read Maximum number of data bytes to read.
5348- * @param bytes_read Address of area to hold the number of bytes read.
5349- * @param min_xfer Minimum number of data bytes to read.
5350- * @param timeout Waiting period to wait for the data to be read,
5351- * or one of the special values K_NO_WAIT and K_FOREVER.
5352- *
5353- * @retval 0 At least @a min_xfer bytes of data were read.
5354- * @retval -EINVAL invalid parameters supplied
5355- * @retval -EIO Returned without waiting; zero data bytes were read.
5356- * @retval -EAGAIN Waiting period timed out; between zero and @a min_xfer
5357- * minus one data bytes were read.
5358- */
5359- __deprecated __syscall int k_pipe_get (struct k_pipe * pipe , void * data ,
5360- size_t bytes_to_read , size_t * bytes_read ,
5361- size_t min_xfer , k_timeout_t timeout );
5362-
5363- /**
5364- * @deprecated k_pipe_read_avail() will be removed in the new k_pipe API.
5365- * @brief Query the number of bytes that may be read from @a pipe.
5366- *
5367- * @param pipe Address of the pipe.
5368- *
5369- * @retval a number n such that 0 <= n <= @ref k_pipe.size; the
5370- * result is zero for unbuffered pipes.
5371- */
5372- __deprecated __syscall size_t k_pipe_read_avail (struct k_pipe * pipe );
5373-
5374- /**
5375- * @deprecated k_pipe_write_avail() will be removed in the new k_pipe API.
5376- * @brief Query the number of bytes that may be written to @a pipe
5377- *
5378- * @param pipe Address of the pipe.
5379- *
5380- * @retval a number n such that 0 <= n <= @ref k_pipe.size; the
5381- * result is zero for unbuffered pipes.
5382- */
5383- __deprecated __syscall size_t k_pipe_write_avail (struct k_pipe * pipe );
5384-
5385- /**
5386- * @deprecated k_pipe_flush() will be removed in the new k_pipe API.
5387- * @brief Flush the pipe of write data
5388- *
5389- * This routine flushes the pipe. Flushing the pipe is equivalent to reading
5390- * both all the data in the pipe's buffer and all the data waiting to go into
5391- * that pipe into a large temporary buffer and discarding the buffer. Any
5392- * writers that were previously pended become unpended.
5393- *
5394- * @param pipe Address of the pipe.
5395- */
5396- __deprecated __syscall void k_pipe_flush (struct k_pipe * pipe );
5397-
5398- /**
5399- * @deprecated k_pipe_buffer_flush will be removed in the new k_pipe API.
5400- * @brief Flush the pipe's internal buffer
5401- *
5402- * This routine flushes the pipe's internal buffer. This is equivalent to
5403- * reading up to N bytes from the pipe (where N is the size of the pipe's
5404- * buffer) into a temporary buffer and then discarding that buffer. If there
5405- * were writers previously pending, then some may unpend as they try to fill
5406- * up the pipe's emptied buffer.
5407- *
5408- * @param pipe Address of the pipe.
5409- */
5410- __deprecated __syscall void k_pipe_buffer_flush (struct k_pipe * pipe );
5411-
5412- #else /* CONFIG_PIPES */
5413-
54145214enum pipe_flags {
54155215 PIPE_FLAG_OPEN = BIT (0 ),
54165216 PIPE_FLAG_RESET = BIT (1 ),
@@ -5524,7 +5324,6 @@ __syscall void k_pipe_reset(struct k_pipe *pipe);
55245324 * @param pipe Address of the pipe.
55255325 */
55265326__syscall void k_pipe_close (struct k_pipe * pipe );
5527- #endif /* CONFIG_PIPES */
55285327/** @} */
55295328
55305329/**
0 commit comments