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 - initialization routines |
30 | =============================================================================*/ |
31 | |
32 | |
33 | #include "interface/vcos/vcos_types.h" |
34 | #include "vcos.h" |
35 | |
36 | #ifdef __cplusplus |
37 | extern "C" { |
38 | #endif |
39 | |
40 | /** \file |
41 | * |
42 | * Some OS support libraries need some initialization. To support this, call |
43 | * vcos_init() function at the start of day; vcos_deinit() at the end. |
44 | */ |
45 | |
46 | /** |
47 | * vcos initialization. Call this function before using other vcos functions. |
48 | * Calls can be nested within the same process; they are reference counted so |
49 | * that only a call from uninitialized state has any effect. |
50 | * @note On platforms/toolchains that support it, gcc's constructor attribute or |
51 | * similar is used to invoke this function before main() or equivalent. |
52 | * @return Status of initialisation. |
53 | */ |
54 | VCOSPRE_ VCOS_STATUS_T VCOSPOST_ vcos_init(void); |
55 | |
56 | /** |
57 | * vcos deinitialization. Call this function when vcos is no longer required, |
58 | * in order to free resources. |
59 | * Calls can be nested within the same process; they are reference counted so |
60 | * that only a call that decrements the reference count to 0 has any effect. |
61 | * @note On platforms/toolchains that support it, gcc's destructor attribute or |
62 | * similar is used to invoke this function after exit() or equivalent. |
63 | * @return Status of initialisation. |
64 | */ |
65 | VCOSPRE_ void VCOSPOST_ vcos_deinit(void); |
66 | |
67 | /** |
68 | * Acquire global lock. This must be available independent of vcos_init()/vcos_deinit(). |
69 | */ |
70 | VCOSPRE_ void VCOSPOST_ vcos_global_lock(void); |
71 | |
72 | /** |
73 | * Release global lock. This must be available independent of vcos_init()/vcos_deinit(). |
74 | */ |
75 | VCOSPRE_ void VCOSPOST_ vcos_global_unlock(void); |
76 | |
77 | /** Pass in the argv/argc arguments passed to main() */ |
78 | VCOSPRE_ void VCOSPOST_ vcos_set_args(int argc, const char **argv); |
79 | |
80 | /** Return argc. */ |
81 | VCOSPRE_ int VCOSPOST_ vcos_get_argc(void); |
82 | |
83 | /** Return argv. */ |
84 | VCOSPRE_ const char ** VCOSPOST_ vcos_get_argv(void); |
85 | |
86 | /** |
87 | * Platform-specific initialisation. |
88 | * VCOS internal function, not part of public API, do not call from outside |
89 | * vcos. vcos_init()/vcos_deinit() reference count calls, so this function is |
90 | * only called from an uninitialized state, i.e. there will not be two |
91 | * consecutive calls to vcos_platform_init() without an intervening call to |
92 | * vcos_platform_deinit(). |
93 | * This function is called with vcos_global_lock held. |
94 | * @return Status of initialisation. |
95 | */ |
96 | VCOSPRE_ VCOS_STATUS_T VCOSPOST_ vcos_platform_init(void); |
97 | |
98 | /** |
99 | * Platform-specific de-initialisation. |
100 | * VCOS internal function, not part of public API, do not call from outside |
101 | * vcos. |
102 | * See vcos_platform_init() re reference counting. |
103 | * This function is called with vcos_global_lock held. |
104 | */ |
105 | VCOSPRE_ void VCOSPOST_ vcos_platform_deinit(void); |
106 | |
107 | #ifdef __cplusplus |
108 | } |
109 | #endif |
110 | |
111 | |