MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_audio_pipe_create

Function rt_audio_pipe_create

components/drivers/audio/dev_audio_pipe.c:326–346  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

324 */
325#ifdef RT_USING_HEAP
326rt_err_t rt_audio_pipe_create(const char *name, rt_int32_t flag, rt_size_t size)
327{
328 rt_uint8_t *rb_memptr = RT_NULL;
329 struct rt_audio_pipe *pipe = RT_NULL;
330
331 /* get aligned size */
332 size = RT_ALIGN(size, RT_ALIGN_SIZE);
333 pipe = (struct rt_audio_pipe *)rt_calloc(1, sizeof(struct rt_audio_pipe));
334 if (pipe == RT_NULL)
335 return -RT_ENOMEM;
336
337 /* create ring buffer of pipe */
338 rb_memptr = (rt_uint8_t *)rt_malloc(size);
339 if (rb_memptr == RT_NULL)
340 {
341 rt_free(pipe);
342 return -RT_ENOMEM;
343 }
344
345 return rt_audio_pipe_init(pipe, name, flag, rb_memptr, size);
346}
347
348/**
349 * @brief Detachaudio pipe and free its ringbuffer

Callers

nothing calls this directly

Calls 4

rt_callocFunction · 0.85
rt_mallocFunction · 0.85
rt_freeFunction · 0.85
rt_audio_pipe_initFunction · 0.85

Tested by

no test coverage detected