1 /* 2 * Copyright (c) 2023 Google LLC 3 * SPDX-License-Identifier: Apache-2.0 4 */ 5 6 #include <zephyr/init.h> 7 #include <zephyr/rtio/rtio.h> 8 #include <zephyr/sys/mpsc_lockfree.h> 9 #include <zephyr/sys/util.h> 10 #include <zephyr/app_memory/app_memdomain.h> 11 #include <zephyr/sys/iterable_sections.h> 12 13 #ifdef CONFIG_USERSPACE 14 K_APPMEM_PARTITION_DEFINE(rtio_partition); 15 #endif 16 rtio_init(void)17int rtio_init(void) 18 { 19 STRUCT_SECTION_FOREACH(rtio_sqe_pool, sqe_pool) { 20 for (int i = 0; i < sqe_pool->pool_size; i++) { 21 mpsc_push(&sqe_pool->free_q, &sqe_pool->pool[i].q); 22 } 23 } 24 25 STRUCT_SECTION_FOREACH(rtio_cqe_pool, cqe_pool) { 26 for (int i = 0; i < cqe_pool->pool_size; i++) { 27 mpsc_push(&cqe_pool->free_q, &cqe_pool->pool[i].q); 28 } 29 } 30 31 return 0; 32 } 33 34 SYS_INIT(rtio_init, POST_KERNEL, 0); 35