1 /*
2  * Copyright (c) 2017 Oticon A/S
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 #ifndef ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_CORE_H_
7 #define ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_CORE_H_
8 
9 #include "kernel.h"
10 
11 #ifdef __cplusplus
12 extern "C" {
13 #endif
14 
15 
16 typedef struct {
17 	k_thread_entry_t entry_point;
18 	void *arg1;
19 	void *arg2;
20 	void *arg3;
21 
22 	int thread_idx;
23 
24 #if defined(CONFIG_ARCH_HAS_THREAD_ABORT)
25 	/* The kernel may indicate that a thread has been aborted several */
26 	/* times */
27 	int aborted;
28 #endif
29 
30 	/*
31 	 * Note: If more elements are added to this structure, remember to
32 	 * update ARCH_POSIX_RECOMMENDED_STACK_SIZE in the configuration.
33 	 *
34 	 * Currently there are 4 pointers + 2 ints, on a 32-bit native posix
35 	 * implementation this will result in 24 bytes ( 4*4 + 2*4).
36 	 * For a 64-bit implementation the recommended stack size will be
37 	 * 40 bytes ( 4*8 + 2*4 ).
38 	 */
39 } posix_thread_status_t;
40 
41 
42 void posix_new_thread(posix_thread_status_t *ptr);
43 void posix_swap(int next_allowed_thread_nbr, int this_thread_nbr);
44 void posix_main_thread_start(int next_allowed_thread_nbr);
45 void posix_init_multithreading(void);
46 void posix_core_clean_up(void);
47 
48 void posix_new_thread_pre_start(void); /* defined in thread.c */
49 void posix_irq_check_idle_exit(void);
50 
51 #ifdef __cplusplus
52 }
53 #endif
54 
55 #endif /* ZEPHYR_ARCH_POSIX_INCLUDE_POSIX_CORE_H_ */
56