1# Copyright (c) 2024 Tenstorrent
2#
3# SPDX-License-Identifier: Apache-2.0
4
5config POSIX_API
6	bool "POSIX APIs"
7	depends on !NATIVE_APPLICATION
8	select NATIVE_LIBC_INCOMPATIBLE
9	select POSIX_BASE_DEFINITIONS # clock_gettime(), pthread_create(), sem_get(), etc
10	select POSIX_AEP_REALTIME_MINIMAL # CLOCK_MONOTONIC, pthread_attr_setstack(), etc
11	select POSIX_NETWORKING if NETWORKING # inet_ntoa(), socket(), etc
12	imply EVENTFD # eventfd(), eventfd_read(), eventfd_write()
13	imply POSIX_FD_MGMT # open(), close(), read(), write()
14	imply POSIX_MESSAGE_PASSING # mq_open(), etc
15	imply POSIX_MULTI_PROCESS # sleep(), getpid(), etc
16	help
17	  This option enables the required POSIX System Interfaces (base definitions), all of PSE51,
18	  and some features found in PSE52.
19
20	  Note: in the future, this option may be deprecated in favour of subprofiling options.
21
22choice POSIX_AEP_CHOICE
23	prompt "POSIX Subprofile"
24	default POSIX_AEP_CHOICE_NONE
25	help
26	  This choice is intended to help users select the correct POSIX profile for their
27	  application. Choices are based on IEEE 1003.13-2003 (now inactive / reserved) and
28	  extrapolated to the more recent Subprofiling Option Groups in IEEE 1003.3-2017.
29
30	  For more information, please refer to
31	  https://standards.ieee.org/ieee/1003.13/3322/
32	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
33
34config POSIX_AEP_CHOICE_NONE
35	bool "No pre-defined POSIX subprofile"
36	help
37	  No pre-defined POSIX profile is selected.
38
39config POSIX_AEP_CHOICE_BASE
40	bool "Base definitions (system interfaces)"
41	depends on !NATIVE_APPLICATION
42	select NATIVE_LIBC_INCOMPATIBLE
43	select POSIX_BASE_DEFINITIONS
44	help
45	  Only enable the base definitions required for all POSIX systems.
46
47	  For more information, please see
48	  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_03_01
49
50config POSIX_AEP_CHOICE_PSE51
51	bool "Minimal Realtime System Profile (PSE51)"
52	depends on !NATIVE_APPLICATION
53	select NATIVE_LIBC_INCOMPATIBLE
54	select POSIX_BASE_DEFINITIONS
55	select POSIX_AEP_REALTIME_MINIMAL
56	help
57	  PSE51 includes the POSIX Base Definitions (System Interfaces) as well as several Options and
58	  Option Groups to facilitate device I/O, signals, mandatory configuration utilities, and
59	  threading.
60
61	  For more information, please see
62	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
63
64config POSIX_AEP_CHOICE_PSE52
65	bool "Realtime Controller System Profile (PSE52)"
66	depends on !NATIVE_APPLICATION
67	select NATIVE_LIBC_INCOMPATIBLE
68	select POSIX_BASE_DEFINITIONS
69	select POSIX_AEP_REALTIME_MINIMAL
70	select POSIX_AEP_REALTIME_CONTROLLER
71	help
72	  PSE52 includes the POSIX Base Definitions (System Interfaces) as well as all features of
73	  PSE51. Additionally, it includes interfaces for file descriptor management, filesystem
74	  support, support for message queues, and tracing.
75
76	  For more information, please see
77	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
78
79config POSIX_AEP_CHOICE_PSE53
80	bool "Dedicated Realtime System Profile (PSE53)"
81	depends on !NATIVE_APPLICATION
82	select NATIVE_LIBC_INCOMPATIBLE
83	select POSIX_BASE_DEFINITIONS
84	select POSIX_AEP_REALTIME_MINIMAL
85	select POSIX_AEP_REALTIME_CONTROLLER
86	select POSIX_AEP_REALTIME_DEDICATED
87	help
88	  PSE53 includes the POSIX Base Definitions (System Interfaces) as well as all features of
89	  PSE52. Additionally, it includes interfaces for POSIX multi-processing, networking, pipes,
90	  and prioritized I/O.
91
92	  For more information, please see
93	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
94
95# TODO: PSE54: Multi-purpose Realtime System Profile
96
97endchoice # POSIX_AEP_CHOICE
98
99# Base Definitions (System Interfaces)
100config POSIX_BASE_DEFINITIONS
101	bool
102	select POSIX_ASYNCHRONOUS_IO
103	select POSIX_BARRIERS
104	select POSIX_CLOCK_SELECTION
105	# select POSIX_MAPPED_FILES
106	# select POSIX_MEMORY_PROTECTION
107	select POSIX_READER_WRITER_LOCKS
108	select POSIX_REALTIME_SIGNALS
109	select POSIX_SEMAPHORES
110	select POSIX_SPIN_LOCKS
111	select POSIX_THREAD_SAFE_FUNCTIONS
112	select POSIX_THREADS
113	select POSIX_TIMEOUTS
114	select POSIX_TIMERS
115	help
116	  This option is not user configurable. It may be configured indirectly by selecting
117	  CONFIG_POSIX_AEP_CHOICE_BASE=y.
118
119	  For more information, please see
120	  https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/V1_chap02.html#tag_02_01_03_01
121
122config POSIX_AEP_REALTIME_MINIMAL
123	bool
124	# Option Groups
125	select POSIX_DEVICE_IO
126	select POSIX_SIGNALS
127	select POSIX_SINGLE_PROCESS
128	select XSI_THREADS_EXT
129	# Options
130	select POSIX_FSYNC
131	# select POSIX_MEMLOCK
132	# select POSIX_MEMLOCK_RANGE
133	select POSIX_MONOTONIC_CLOCK
134	# select POSIX_SHARED_MEMORY_OBJECTS
135	select POSIX_SYNCHRONIZED_IO
136	select POSIX_THREAD_ATTR_STACKADDR
137	select POSIX_THREAD_ATTR_STACKSIZE
138	select POSIX_THREAD_CPUTIME
139	select POSIX_THREAD_PRIO_INHERIT
140	select POSIX_THREAD_PRIO_PROTECT
141	select POSIX_THREAD_PRIORITY_SCHEDULING
142	# select POSIX_THREAD_SPORADIC_SERVER
143	help
144	  This option is not user configurable. It may be configured indirectly by selecting
145	  CONFIG_POSIX_AEP_CHOICE_PSE51=y.
146
147	  For more information, please see
148	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
149
150config POSIX_AEP_REALTIME_CONTROLLER
151	bool
152	# Option Groups
153	select POSIX_FD_MGMT
154	select POSIX_FILE_SYSTEM
155	# Options
156	select POSIX_MESSAGE_PASSING
157	# select POSIX_TRACE
158	# select POSIX_TRACE_EVENT_FILTER
159	# select POSIX_TRACE_LOG
160	help
161	  This option is not user configurable. It may be configured indirectly by selecting
162	  CONFIG_POSIX_AEP_CHOICE_PSE52=y.
163
164	  For more information, please see
165	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
166
167config POSIX_AEP_REALTIME_DEDICATED
168	bool
169	# Option Groups
170	select POSIX_MULTI_PROCESS
171	select POSIX_NETWORKING
172	# select POSIX_PIPE
173	# select POSIX_SIGNAL_JUMP
174	# Options
175	select POSIX_CPUTIME
176	# select POSIX_PRIORITIZED_IO
177	select POSIX_PRIORITY_SCHEDULING
178	select POSIX_RAW_SOCKETS
179	# select POSIX_SPAWN
180	# select POSIX_SPORADIC_SERVER
181	help
182	  This option is not user configurable. It may be configured indirectly by selecting
183	  CONFIG_POSIX_AEP_CHOICE_PSE53=y.
184
185	  For more information, please see
186	  https://pubs.opengroup.org/onlinepubs/9699919799/xrat/V4_subprofiles.html
187