1 /**************************************************************************/
2 /*                                                                        */
3 /*       Copyright (c) Microsoft Corporation. All rights reserved.        */
4 /*                                                                        */
5 /*       This software is licensed under the Microsoft Software License   */
6 /*       Terms for Microsoft Azure RTOS. Full text of the license can be  */
7 /*       found in the LICENSE file at https://aka.ms/AzureRTOS_EULA       */
8 /*       and in the root directory of this software.                      */
9 /*                                                                        */
10 /**************************************************************************/
11 
12 
13 /**************************************************************************/
14 /**************************************************************************/
15 /**                                                                       */
16 /** GUIX Component                                                        */
17 /**                                                                       */
18 /**   Display management (Display)                                        */
19 /**                                                                       */
20 /**************************************************************************/
21 
22 #define GX_SOURCE_CODE
23 
24 
25 /* Include necessary system files.  */
26 
27 #include "gx_api.h"
28 #include "gx_display.h"
29 
30 /* Bring in externs for caller checking code.  */
31 GX_CALLER_CHECKING_EXTERNS
32 
33 /**************************************************************************/
34 /*                                                                        */
35 /*  FUNCTION                                               RELEASE        */
36 /*                                                                        */
37 /*    _gxe_display_create                                 PORTABLE C      */
38 /*                                                           6.1          */
39 /*  AUTHOR                                                                */
40 /*                                                                        */
41 /*    Kenneth Maxwell, Microsoft Corporation                              */
42 /*                                                                        */
43 /*  DESCRIPTION                                                           */
44 /*                                                                        */
45 /*    This function checks for errors in the display create function      */
46 /*    call.                                                               */
47 /*                                                                        */
48 /*  INPUT                                                                 */
49 /*                                                                        */
50 /*    display                               Display control block         */
51 /*    name                                  Name of display               */
52 /*    display_driver_setup                  Display driver setup function */
53 /*    width                                 Display width in pixels       */
54 /*    height                                Display height in pixels      */
55 /*    display_control_block_size            Size of the display control   */
56 /*                                            block                       */
57 /*                                                                        */
58 /*  OUTPUT                                                                */
59 /*                                                                        */
60 /*    status                                Completion status             */
61 /*                                                                        */
62 /*  CALLS                                                                 */
63 /*                                                                        */
64 /*    _gx_display_create                    Actual display create         */
65 /*                                            function                    */
66 /*                                                                        */
67 /*  CALLED BY                                                             */
68 /*                                                                        */
69 /*    Application Code                                                    */
70 /*                                                                        */
71 /*  RELEASE HISTORY                                                       */
72 /*                                                                        */
73 /*    DATE              NAME                      DESCRIPTION             */
74 /*                                                                        */
75 /*  05-19-2020     Kenneth Maxwell          Initial Version 6.0           */
76 /*  09-30-2020     Kenneth Maxwell          Modified comment(s),          */
77 /*                                            resulting in version 6.1    */
78 /*                                                                        */
79 /**************************************************************************/
_gxe_display_create(GX_DISPLAY * display,GX_CONST GX_CHAR * name,UINT (* display_driver_setup)(GX_DISPLAY *),GX_VALUE width,GX_VALUE height,UINT display_control_block_size)80 UINT  _gxe_display_create(GX_DISPLAY *display, GX_CONST GX_CHAR *name,
81                           UINT (*display_driver_setup)(GX_DISPLAY *),
82                           GX_VALUE width, GX_VALUE height, UINT display_control_block_size)
83 {
84 UINT status;
85 
86     /* Check for appropriate caller.  */
87     GX_INIT_AND_THREADS_CALLER_CHECKING
88 
89     /* Check for invalid input pointers.  */
90     if ((display == GX_NULL) || (display_driver_setup == GX_NULL))
91     {
92         return(GX_PTR_ERROR);
93     }
94 
95     if (display_control_block_size != sizeof(GX_DISPLAY))
96     {
97         return(GX_INVALID_SIZE);
98     }
99 
100     if (display -> gx_display_id == GX_DISPLAY_ID)
101     {
102         return (GX_ALREADY_CREATED);
103     }
104 
105     /* Call actual window create function.  */
106     status = _gx_display_create(display, name, display_driver_setup, width, height);
107 
108     /* Return completion status.  */
109     return(status);
110 }
111 
112