1 /***************************************************************************
2  * Copyright (c) 2024 Microsoft Corporation
3  *
4  * This program and the accompanying materials are made available under the
5  * terms of the MIT License which is available at
6  * https://opensource.org/licenses/MIT.
7  *
8  * SPDX-License-Identifier: MIT
9  **************************************************************************/
10 
11 
12 /**************************************************************************/
13 /**************************************************************************/
14 /**                                                                       */
15 /** GUIX Component                                                        */
16 /**                                                                       */
17 /**   System Management (System)                                          */
18 /**                                                                       */
19 /**************************************************************************/
20 
21 #define GX_SOURCE_CODE
22 
23 /* Include necessary system files.  */
24 
25 #include "gx_api.h"
26 #include "gx_system.h"
27 
28 /**************************************************************************/
29 /*                                                                        */
30 /*  FUNCTION                                               RELEASE        */
31 /*                                                                        */
32 /*    _gx_system_start                                    PORTABLE C      */
33 /*                                                           6.1          */
34 /*  AUTHOR                                                                */
35 /*                                                                        */
36 /*    Kenneth Maxwell, Microsoft Corporation                              */
37 /*                                                                        */
38 /*  DESCRIPTION                                                           */
39 /*                                                                        */
40 /*    This service starts GUIX processing.                                */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    None                                                                */
45 /*                                                                        */
46 /*  OUTPUT                                                                */
47 /*                                                                        */
48 /*    status                                Completion status             */
49 /*                                                                        */
50 /*  CALLS                                                                 */
51 /*                                                                        */
52 /*    tx_thread_create                      Create system thread          */
53 /*    _gx_system_error_process              Process an error              */
54 /*    tx_queue_delete                       Delete a queue                */
55 /*    tx_mutex_delete                       Delete a mutex                */
56 /*                                                                        */
57 /*  CALLED BY                                                             */
58 /*                                                                        */
59 /*    Application Code                                                    */
60 /*                                                                        */
61 /*  RELEASE HISTORY                                                       */
62 /*                                                                        */
63 /*    DATE              NAME                      DESCRIPTION             */
64 /*                                                                        */
65 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
66 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
67 /*                                            resulting in version 6.1    */
68 /*                                                                        */
69 /**************************************************************************/
_gx_system_start(VOID)70 UINT  _gx_system_start(VOID)
71 {
72 UINT status;
73 
74 #ifdef GX_THREADX_BINDING
75     status =  tx_thread_resume(&_gx_system_thread);
76 
77     /* Determine if the system thread creation was successful.  */
78     if (status == TX_SUCCESS)
79     {
80         status = GX_SUCCESS;
81     }
82     else
83     {
84         /* Thread create failed - call system error handler.  */
85         _gx_system_error_process(GX_SYSTEM_THREAD_CREATE_FAILED);
86 
87         /* Return error!  */
88         return(GX_SYSTEM_ERROR);
89     }
90 #else
91     status = GX_SYSTEM_THREAD_START(_gx_system_thread_entry);
92 #endif
93 
94     /* Return successful completion.  */
95     return(status);
96 }
97 
98