1 /*
2  Copyright (c) 2018, MIPI Alliance, Inc.
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
7  are met:
8 
9  * Redistributions of source code must retain the above copyright
10    notice, this list of conditions and the following disclaimer.
11 
12  * Redistributions in binary form must reproduce the above copyright
13    notice, this list of conditions and the following disclaimer in
14    the documentation and/or other materials provided with the
15    distribution.
16 
17  * Neither the name of the copyright holder nor the names of its
18    contributors may be used to endorse or promote products derived
19    from this software without specific prior written permission.
20 
21  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
22  "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
23  LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
24  A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
25  OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
26  SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
27  LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
28  DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
29  THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
30  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
31  OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
32 */
33 
34 #include "mipi_syst.h"   /* SyS-T definitions     */
35 
36 
37 /* Define origin used by this example as the message client ID
38  */
39 static const struct mipi_syst_origin origin =
40 MIPI_SYST_GEN_ORIGIN_GUID(0x494E5443, 0xA2AE, 0x4C70, 0xABB5, 0xD1A79E9CEA35, 1);
41 
42 
main(int argc,char * argv[])43 int main(int argc, char* argv[])
44 {
45     struct mipi_syst_handle* systh;
46 
47 #if defined(MIPI_SYST_STATIC)
48     /* Initialize SyS-T subsystem when using static linking to SyS-T.
49      * Note: The call to MIPI_SYS_INIT() is done by the shared library
50      * loader initialization function when dyanmic linking is used.
51      */
52     MIPI_SYST_INIT(mipi_syst_platform_init, 0);
53 #endif
54 
55     /* Initialize a SyS-T output handle structure
56      */
57     systh = MIPI_SYST_ALLOC_HANDLE( &origin );
58 
59     /* Send a string message with payload "Hello World!"
60      */
61     MIPI_SYST_DEBUG(systh, MIPI_SYST_SEVERITY_INFO, "Hello SyS-T!" ,sizeof("Hello SyS-T!"));
62 
63     /* Release any resources associated with this SyS-T handle.
64      */
65     MIPI_SYST_DELETE_HANDLE(systh);
66 
67 #if defined(MIPI_SYST_STATIC)
68     /* Perform SyS-T subsystem cleanup when using static linking.
69      */
70     MIPI_SYST_SHUTDOWN(mipi_syst_platform_destroy);
71 #endif
72     return 0;
73 }