• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (c) 2020-2021 Huawei Device Co., Ltd.
3  * Licensed under the Apache License, Version 2.0 (the "License");
4  * you may not use this file except in compliance with the License.
5  * You may obtain a copy of the License at
6  *
7  *     http://www.apache.org/licenses/LICENSE-2.0
8  *
9  * Unless required by applicable law or agreed to in writing, software
10  * distributed under the License is distributed on an "AS IS" BASIS,
11  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12  * See the License for the specific language governing permissions and
13  * limitations under the License.
14  */
15 
16 /**
17  * @addtogroup Display
18  * @{
19  *
20  * @brief Defines driver functions of the display module.
21  *
22  * This module provides driver functions for the graphics subsystem, including graphics layer management,
23  * device control, graphics hardware acceleration, display memory management, and callbacks.
24  * @since 1.0
25  * @version 2.0
26  */
27 
28  /**
29  * @file display_device.h
30  *
31  * @brief Declares control functions of the display device.
32  *
33  * @since 1.0
34  * @version 2.0
35  */
36 
37 #ifndef DISPLAY_DEVICE_H
38 #define DISPLAY_DEVICE_H
39 #include "display_type.h"
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /**
46  * @brief  Defines pointers to the functions of the display device.
47  */
48 typedef struct {
49     /**
50      * @brief Sets the power status.
51      *
52      * When the OS enters the sleep mode or wakes up from the sleep mode, the display service or
53      * the power management module can set the power status of the display device, so that the driver IC
54      * of the device can normally enter the specified state.
55      *
56      * @param devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates
57      * the first display device and 4 indicates the last display device.
58      * @param status Indicates the power status to set. The display service determines whether to set the
59      * display device to the on or off state based on this setting. For details, see @link PowerStatus}.
60      *
61      * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
62      * @since 1.0
63      * @version 1.0
64      */
65     int32_t (*SetDisplayPowerStatus)(uint32_t devId, DispPowerStatus status);
66 
67     /**
68      * @brief Obtains the power status.
69      *
70      * You can use this function to obtain the power status of the display device specified by devId.
71      *
72      * @param devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates
73      * the first display device and 4 indicates the last display device.
74      * @param status Indicates the power status of the display device specified by devId. For details,
75      * see {@link PowerStatus}.
76      *
77      * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
78      * @since 1.0
79      * @version 1.0
80      */
81     int32_t (*GetDisplayPowerStatus)(uint32_t devId, DispPowerStatus *status);
82 
83     /**
84      * @brief Sets the backlight level.
85      *
86      * You can use this function to set the backlight level of the display device specified by devId.
87      *
88      * @param devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates
89      * the first display device and 4 indicates the last display device.
90      * @param level Indicates the backlight level to set.
91      *
92      * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
93      * @since 1.0
94      * @version 1.0
95      */
96     int32_t (*SetDisplayBacklight)(uint32_t devId, uint32_t level);
97 
98     /**
99      * @brief Obtains the backlight level.
100      *
101      * You can use this function to obtain the backlight level of the display device specified by devId.
102      *
103      * @param devId Indicates the ID of a display device. The value ranges from 0 to 4, where 0 indicates
104      * the first display device and 4 indicates the last display device.
105      * @param level Indicates the backlight level.
106      *
107      * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
108      * @since 1.0
109      * @version 1.0
110      */
111     int32_t (*GetDisplayBacklight)(uint32_t devId, uint32_t *level);
112 } DeviceFuncs;
113 
114 /**
115  * @brief Initializes the control functions of the display device. You can apply for the resources for
116  * using control functions and then operate the display device by using the control functions.
117  *
118  * @param funcs Indicates the double pointer to the control functions of the display device. The caller obtains
119  * the double pointer to operate the display device. The memory is allocated during initialization, and therefore
120  * the caller does not need to allocate the memory.
121  *
122  * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
123  *
124  * @since 1.0
125  * @version 1.0
126  */
127 int32_t DeviceInitialize(DeviceFuncs **funcs);
128 
129 /**
130  * @brief Uninitializes control functions of the display device. The resources used by
131  * the control functions will be released.
132  *
133  * @param funcs Indicates the double pointer to control functions of the display device. It is used to release
134  * the memory allocated during initialization of the control functions.
135  *
136  * @return Returns 0 if the operation is successful; returns an error code defined in {@link DispErrCode} otherwise.
137  * @since 1.0
138  * @version 1.0
139  */
140 int32_t DeviceUninitialize(DeviceFuncs *funcs);
141 
142 #ifdef __cplusplus
143 }
144 #endif
145 #endif
146 /* @} */