| 324 | */ |
| 325 | #ifdef RT_USING_HEAP |
| 326 | rt_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 |
nothing calls this directly
no test coverage detected