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 /**************************************************************************/
26 /*                                                                        */
27 /*  FUNCTION                                               RELEASE        */
28 /*                                                                        */
29 /*    _gx_system_rtos_bind                                PORTABLE C      */
30 /*                                                           6.1          */
31 /*  AUTHOR                                                                */
32 /*                                                                        */
33 /*    Kenneth Maxwell, Microsoft Corporation                              */
34 /*                                                                        */
35 /*  DESCRIPTION                                                           */
36 /*                                                                        */
37 /*    This file contains a small set of functions that bind GUIX to the   */
38 /*    underlying RTOS. This is by default the ThreadX RTOS, but can be    */
39 /*    modified to support other operating systems. Refer to the GUIX      */
40 /*    User Guide for more information.                                    */
41 /*                                                                        */
42 /*  INPUT                                                                 */
43 /*                                                                        */
44 /*    Refer to GUIX User Guide                                            */
45 /*                                                                        */
46 /*  OUTPUT                                                                */
47 /*                                                                        */
48 /*    Refer to GUIX User Guide                                            */
49 /*                                                                        */
50 /*  CALLS                                                                 */
51 /*                                                                        */
52 /*    Refer to GUIX User Guide                                            */
53 /*                                                                        */
54 /*  CALLED BY                                                             */
55 /*                                                                        */
56 /*    GUIX system serives                                                 */
57 /*                                                                        */
58 /*  RELEASE HISTORY                                                       */
59 /*                                                                        */
60 /*    DATE              NAME                      DESCRIPTION             */
61 /*                                                                        */
62 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
63 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
64 /*                                            resulting in version 6.1    */
65 /*                                                                        */
66 /**************************************************************************/
67 
68 #ifdef GX_DISABLE_THREADX_BINDING
69 
70 /* If you are porting GUIX to another RTOS, the function shells below serve as prototypes to
71    demonstrate what each RTOS specific service should look like. The user will need to complete
72    each of these functions using syntax and services available within the chosen RTOS
73  */
74 
75 /* types used by GUIX, normally provided by ThreadX API, but replaced here */
76 
77 
78 
79 VOID  gx_generic_rtos_initialize(VOID);
80 UINT  gx_generic_thread_start(VOID (*thread_entry)(ULONG));
81 UINT  gx_generic_event_post(GX_EVENT *event_ptr);
82 UINT  gx_generic_event_fold(GX_EVENT *event_ptr);
83 VOID  gx_generic_event_purge(GX_WIDGET *widget);
84 UINT  gx_generic_event_pop(GX_EVENT *put_event, GX_BOOL wait);
85 VOID  gx_generic_timer_start(VOID);
86 VOID  gx_generic_timer_stop(VOID);
87 VOID  gx_generic_system_mutex_lock(VOID);
88 VOID  gx_generic_system_mutex_unlock(VOID);
89 ULONG gx_generic_system_time_get(VOID);
90 VOID *gx_generic_thread_identify(VOID);
91 VOID  gx_generic_time_delay(INT ticks);
92 
93 
94 #define GX_RTOS_BINDING_INITIALIZE gx_generic_rtos_initialize()
95 #define GX_SYSTEM_THREAD_START     gx_generic_thread_start
96 #define GX_EVENT_PUSH              gx_generic_event_post
97 #define GX_EVENT_POP               gx_generic_event_pop
98 #define GX_EVENT_FOLD              gx_generic_event_fold
99 #define GX_EVENT_PURGE             gx_generic_event_purge
100 #define GX_TIMER_START             gx_generic_timer_start()
101 #define GX_TIMER_STOP              gx_generic_timer_stop()
102 #define GX_SYSTEM_MUTEX_LOCK       gx_generic_system_mutex_lock()
103 #define GX_SYSTEM_MUTEX_UNLOCK     gx_generic_system_mutex_unlock()
104 #define GX_SYSTEM_TIME_GET         gx_generic_system_time_get()
105 #define GX_CURRENT_THREAD          gx_generic_thread_identify()
106 #define GX_GENERIC_TIME_DELAY(a)   gx_generic_time_delay(a)
107 
108 
109 
110 #endif
111 
112