1 | /* |
2 | Copyright (c) 2012, Broadcom Europe Ltd |
3 | All rights reserved. |
4 | |
5 | Redistribution and use in source and binary forms, with or without |
6 | modification, are permitted provided that the following conditions are met: |
7 | * Redistributions of source code must retain the above copyright |
8 | notice, this list of conditions and the following disclaimer. |
9 | * Redistributions in binary form must reproduce the above copyright |
10 | notice, this list of conditions and the following disclaimer in the |
11 | documentation and/or other materials provided with the distribution. |
12 | * Neither the name of the copyright holder nor the |
13 | names of its contributors may be used to endorse or promote products |
14 | derived from this software without specific prior written permission. |
15 | |
16 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
17 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
18 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
19 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY |
20 | DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
21 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
22 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
23 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
24 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
25 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
26 | */ |
27 | |
28 | /*============================================================================= |
29 | VideoCore OS Abstraction Layer - thread attributes |
30 | =============================================================================*/ |
31 | |
32 | #ifndef VCOS_THREAD_ATTR_H |
33 | #define VCOS_THREAD_ATTR_H |
34 | |
35 | #ifdef __cplusplus |
36 | extern "C" { |
37 | #endif |
38 | |
39 | /** |
40 | * \file |
41 | * |
42 | * Attributes for thread creation. |
43 | * |
44 | */ |
45 | |
46 | /** Initialize thread attribute struct. This call does not allocate memory, |
47 | * and so cannot fail. |
48 | * |
49 | */ |
50 | VCOSPRE_ void VCOSPOST_ vcos_thread_attr_init(VCOS_THREAD_ATTR_T *attrs); |
51 | |
52 | /** Set the stack address and size. If not set, a stack will be allocated automatically. |
53 | * |
54 | * This can only be set on some platforms. It will always be possible to set the stack |
55 | * address on VideoCore, but on host platforms, support may well not be available. |
56 | */ |
57 | #if VCOS_CAN_SET_STACK_ADDR |
58 | VCOS_INLINE_DECL |
59 | void vcos_thread_attr_setstack(VCOS_THREAD_ATTR_T *attrs, void *addr, VCOS_UNSIGNED sz); |
60 | #endif |
61 | |
62 | /** Set the stack size. If not set, a default size will be used. Attempting to call this after having |
63 | * set the stack location with vcos_thread_attr_setstack() will result in undefined behaviour. |
64 | */ |
65 | VCOS_INLINE_DECL |
66 | void vcos_thread_attr_setstacksize(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED sz); |
67 | |
68 | /** Set the task priority. If not set, a default value will be used. |
69 | */ |
70 | VCOS_INLINE_DECL |
71 | void vcos_thread_attr_setpriority(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED pri); |
72 | |
73 | /** Set the task cpu affinity. If not set, the default will be used. |
74 | */ |
75 | VCOS_INLINE_DECL |
76 | void vcos_thread_attr_setaffinity(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED aff); |
77 | |
78 | /** Set the timeslice. If not set the default will be used. |
79 | */ |
80 | VCOS_INLINE_DECL |
81 | void vcos_thread_attr_settimeslice(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED ts); |
82 | |
83 | /** The thread entry function takes (argc,argv), as per Nucleus, with |
84 | * argc being 0. This may be withdrawn in a future release and should not |
85 | * be used in new code. |
86 | */ |
87 | VCOS_INLINE_DECL |
88 | void _vcos_thread_attr_setlegacyapi(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED legacy); |
89 | |
90 | VCOS_INLINE_DECL |
91 | void vcos_thread_attr_setautostart(VCOS_THREAD_ATTR_T *attrs, VCOS_UNSIGNED autostart); |
92 | |
93 | #ifdef __cplusplus |
94 | } |
95 | #endif |
96 | #endif |
97 | |