1 |
|
|
/*************************************************************************** |
2 |
|
|
* Copyright (c) 2024 Microsoft Corporation |
3 |
|
|
* Copyright (c) 2026-present Eclipse ThreadX contributors |
4 |
|
|
* |
5 |
|
|
* This program and the accompanying materials are made available under the |
6 |
|
|
* terms of the MIT License which is available at |
7 |
|
|
* https://opensource.org/licenses/MIT. |
8 |
|
|
* |
9 |
|
|
* SPDX-License-Identifier: MIT |
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_system.h" |
29 |
|
|
#include "gx_display.h" |
30 |
|
|
|
31 |
|
|
|
32 |
|
|
/**************************************************************************/ |
33 |
|
|
/* */ |
34 |
|
|
/* FUNCTION RELEASE */ |
35 |
|
|
/* */ |
36 |
|
|
/* _gx_display_create PORTABLE C */ |
37 |
|
|
/* 6.1 */ |
38 |
|
|
/* AUTHOR */ |
39 |
|
|
/* */ |
40 |
|
|
/* Kenneth Maxwell, Microsoft Corporation */ |
41 |
|
|
/* */ |
42 |
|
|
/* DESCRIPTION */ |
43 |
|
|
/* */ |
44 |
|
|
/* This function creates the display and calls the display driver */ |
45 |
|
|
/* setup function. */ |
46 |
|
|
/* */ |
47 |
|
|
/* INPUT */ |
48 |
|
|
/* */ |
49 |
|
|
/* display Display control block */ |
50 |
|
|
/* name Name of display */ |
51 |
|
|
/* display_driver_setup Display driver setup function */ |
52 |
|
|
/* width Display width in pixels */ |
53 |
|
|
/* height Display height in pixels */ |
54 |
|
|
/* */ |
55 |
|
|
/* OUTPUT */ |
56 |
|
|
/* */ |
57 |
|
|
/* status Completion status */ |
58 |
|
|
/* */ |
59 |
|
|
/* CALLS */ |
60 |
|
|
/* */ |
61 |
|
|
/* memset Set control block to zero */ |
62 |
|
|
/* _gx_system_error_process System error handler */ |
63 |
|
|
/* [dispaly_driver_setup] Call display driver setup */ |
64 |
|
|
/* */ |
65 |
|
|
/* CALLED BY */ |
66 |
|
|
/* */ |
67 |
|
|
/* Application Code */ |
68 |
|
|
/* */ |
69 |
|
|
/**************************************************************************/ |
70 |
|
737 |
UINT _gx_display_create(GX_DISPLAY *display, GX_CONST GX_CHAR *name, |
71 |
|
|
UINT (*display_driver_setup)(GX_DISPLAY *), |
72 |
|
|
GX_VALUE width, GX_VALUE height) |
73 |
|
|
{ |
74 |
|
|
|
75 |
|
|
UINT status; |
76 |
|
|
|
77 |
|
|
/* Clear the display control block. */ |
78 |
|
737 |
memset(display, 0, sizeof(GX_DISPLAY)); |
79 |
|
737 |
display -> gx_display_width = width; |
80 |
|
737 |
display -> gx_display_height = height; |
81 |
|
|
|
82 |
|
|
/* Call the display driver setup function. This function initializes the underlying |
83 |
|
|
hardware and sets up all the primitive drawing function pointers. */ |
84 |
|
|
|
85 |
|
737 |
status = display_driver_setup(display); |
86 |
|
|
|
87 |
|
|
/* Determine if the display driver setup was successful. */ |
88 |
✓✓ |
737 |
if (status) |
89 |
|
|
{ |
90 |
|
|
/* Error setting up display driver - call system error handler. */ |
91 |
|
1 |
_gx_system_error_process(GX_SYSTEM_DRIVER_SETUP_ERROR); |
92 |
|
|
|
93 |
|
|
/* Return to system error. */ |
94 |
|
1 |
return(GX_SYSTEM_ERROR); |
95 |
|
|
} |
96 |
|
|
|
97 |
|
|
/* Load the display ID field in the display control block. */ |
98 |
|
736 |
display -> gx_display_id = GX_DISPLAY_ID; |
99 |
|
|
|
100 |
|
|
/* Save the display name. */ |
101 |
|
736 |
display -> gx_display_name = name; |
102 |
|
|
|
103 |
|
|
/* Place the display on the list of created displays. |
104 |
|
|
First, check for an empty list. */ |
105 |
|
|
|
106 |
|
736 |
_gx_system_display_created_count++; |
107 |
|
|
|
108 |
✓✓ |
736 |
if (_gx_system_display_created_list) |
109 |
|
|
{ |
110 |
|
8 |
_gx_system_display_created_list -> gx_display_created_previous = display; |
111 |
|
8 |
display -> gx_display_created_next = _gx_system_display_created_list; |
112 |
|
|
} |
113 |
|
|
|
114 |
|
736 |
_gx_system_display_created_list = display; |
115 |
|
|
|
116 |
|
|
/* Return successful status. */ |
117 |
|
736 |
return(GX_SUCCESS); |
118 |
|
|
} |
119 |
|
|
|