1b049dde5Sopenharmony_ci# Drivers<a name="EN-US_TOPIC_0000001096875497"></a>
2b049dde5Sopenharmony_ci
3b049dde5Sopenharmony_ci-   [Introduction](#section7301810197)
4b049dde5Sopenharmony_ci-   [Directory Structure](#section161941989596)
5b049dde5Sopenharmony_ci-   [Constraints](#section119744591305)
6b049dde5Sopenharmony_ci    -   [Available APIs](#section1551164914237)
7b049dde5Sopenharmony_ci    -   [Usage](#section129654513264)
8b049dde5Sopenharmony_ci
9b049dde5Sopenharmony_ci-   [Repositories Involved](#section1371113476307)
10b049dde5Sopenharmony_ci
11b049dde5Sopenharmony_ci## Introduction<a name="section7301810197"></a>
12b049dde5Sopenharmony_ci
13b049dde5Sopenharmony_ciA kernel driver acts as a bridge between software and hardware. It allows accessing hardware resources of the OpenHarmony kernel through file system APIs, providing a mode of communication between the user space and kernel space and between processes. The main kernel drivers include  **mem**,  **random**,  **video**,  **quickstart**,  **hievent**, and  **tzdriver**. The preceding four types of drivers are stored in the  **kernel/liteos\_a/drivers/char**  directory, and the last two types  **hievent**  and  **tzdriver**  are stored in the  **drivers/liteos**  directory. Each type of driver represents a capability. You can select a driver as required to transmit data. The following figure shows the kernel driver architecture.
14b049dde5Sopenharmony_ci
15b049dde5Sopenharmony_ci**Figure  1**  Kernel driver architecture<a name="fig2996151913212"></a>  
16b049dde5Sopenharmony_ci![](figures/kernel-driver-architecture.png "kernel-driver-architecture")
17b049dde5Sopenharmony_ci
18b049dde5Sopenharmony_ciWherein:
19b049dde5Sopenharmony_ci
20b049dde5Sopenharmony_ci-   **mem**  indicates the driver for accessing physical input/output \(I/O\) devices in user space. It is used together with the  **mmap**  function.
21b049dde5Sopenharmony_ci-   **random**  indicates the driver for devices to obtain random numbers, including true random number generators \(TRNGs\) and pseudorandom number generators \(PRNGs\). The device nodes for a TRNG and a PRNG are  **/dev/random**  and  **/dev/urandom**, respectively. Comparatively, TRNGs provide a higher randomness.
22b049dde5Sopenharmony_ci-   **video**  indicates the framebuffer driver framework. You need to initialize APIs, register the framebuffer driver, and operate the framebuffer driver through file system APIs.
23b049dde5Sopenharmony_ci
24b049dde5Sopenharmony_ci## Directory Structure<a name="section161941989596"></a>
25b049dde5Sopenharmony_ci
26b049dde5Sopenharmony_ci```
27b049dde5Sopenharmony_ci/drivers/liteos
28b049dde5Sopenharmony_ci├── hievent         # Driver for event log management
29b049dde5Sopenharmony_ci├── include         # Header files exposed externally
30b049dde5Sopenharmony_ci├── tzdriver        # Used for switching and communication between the rich execution environment (REE) and trusted execution environment (TEE) and provides device nodes that can be accessed from the application layer.
31b049dde5Sopenharmony_ci```
32b049dde5Sopenharmony_ci
33b049dde5Sopenharmony_ci## Constraints<a name="section119744591305"></a>
34b049dde5Sopenharmony_ci
35b049dde5Sopenharmony_ciSince the  **tzdriver**  implementation is not completely open-source, third-party vendors need to obtain the support for it through cooperation.
36b049dde5Sopenharmony_ci
37b049dde5Sopenharmony_ciThe hievent-related capabilities are not supported currently and will be opened in the future. In addition, do not modify APIs and the format of their parameters defined in the  **hievent**  folder.
38b049dde5Sopenharmony_ci
39b049dde5Sopenharmony_ciThe video-related source code is stored in the  **video/fb.c**  and  **video/fb.h**  files under the  **third\_party/NuttX**  directory.
40b049dde5Sopenharmony_ci
41b049dde5Sopenharmony_ci### Available APIs<a name="section1551164914237"></a>
42b049dde5Sopenharmony_ci
43b049dde5Sopenharmony_ciAs shown in the preceding kernel driver architecture, a kernel driver can be taken as a special file. You can call standard file system APIs, such as  **open**,  **close**,  **read**,  **write**, and  **ioctl**  to perform operations on the driver. The following lists related APIs:
44b049dde5Sopenharmony_ci
45b049dde5Sopenharmony_ci-   fb\_register
46b049dde5Sopenharmony_ci
47b049dde5Sopenharmony_ci    **Function prototype:**
48b049dde5Sopenharmony_ci
49b049dde5Sopenharmony_ci    int fb\_register\(int display, int plane\);
50b049dde5Sopenharmony_ci
51b049dde5Sopenharmony_ci    **Function description:**  Loads the framebuffer driver and registers the  **/dev/fb0**  device node. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
52b049dde5Sopenharmony_ci
53b049dde5Sopenharmony_ci    **Parameter description**
54b049dde5Sopenharmony_ci
55b049dde5Sopenharmony_ci    <a name="table13709103919318"></a>
56b049dde5Sopenharmony_ci    <table><thead align="left"><tr id="row1170923910316"><th class="cellrowborder" valign="top" width="11.92%" id="mcps1.1.3.1.1"><p id="p1709123911313"><a name="p1709123911313"></a><a name="p1709123911313"></a>Parameter</p>
57b049dde5Sopenharmony_ci    </th>
58b049dde5Sopenharmony_ci    <th class="cellrowborder" valign="top" width="88.08%" id="mcps1.1.3.1.2"><p id="p1970910395313"><a name="p1970910395313"></a><a name="p1970910395313"></a>Description</p>
59b049dde5Sopenharmony_ci    </th>
60b049dde5Sopenharmony_ci    </tr>
61b049dde5Sopenharmony_ci    </thead>
62b049dde5Sopenharmony_ci    <tbody><tr id="row7709113923117"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p1870983993114"><a name="p1870983993114"></a><a name="p1870983993114"></a>display</p>
63b049dde5Sopenharmony_ci    </td>
64b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p870963913111"><a name="p870963913111"></a><a name="p870963913111"></a>Indicates the display layer number. The value is usually <strong id="b832218348241"><a name="b832218348241"></a><a name="b832218348241"></a>0</strong>. If the hardware supports multiple display layers, this parameter can be set to other values.</p>
65b049dde5Sopenharmony_ci    </td>
66b049dde5Sopenharmony_ci    </tr>
67b049dde5Sopenharmony_ci    <tr id="row0709163973120"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p170993918319"><a name="p170993918319"></a><a name="p170993918319"></a>plane</p>
68b049dde5Sopenharmony_ci    </td>
69b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p9294182194420"><a name="p9294182194420"></a><a name="p9294182194420"></a>Indicates the color plane. The value is usually <strong id="b135661135142019"><a name="b135661135142019"></a><a name="b135661135142019"></a>0</strong>.</p>
70b049dde5Sopenharmony_ci    </td>
71b049dde5Sopenharmony_ci    </tr>
72b049dde5Sopenharmony_ci    </tbody>
73b049dde5Sopenharmony_ci    </table>
74b049dde5Sopenharmony_ci
75b049dde5Sopenharmony_ci
76b049dde5Sopenharmony_ci-   fb\_unregister
77b049dde5Sopenharmony_ci
78b049dde5Sopenharmony_ci    **Function prototype:**
79b049dde5Sopenharmony_ci
80b049dde5Sopenharmony_ci    int fb\_unregister\(int display\);
81b049dde5Sopenharmony_ci
82b049dde5Sopenharmony_ci    **Function description:**  Uninstalls the framebuffer driver. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
83b049dde5Sopenharmony_ci
84b049dde5Sopenharmony_ci    **Parameter description**
85b049dde5Sopenharmony_ci
86b049dde5Sopenharmony_ci    <a name="table1616493545014"></a>
87b049dde5Sopenharmony_ci    <table><thead align="left"><tr id="row181651335105012"><th class="cellrowborder" valign="top" width="11.92%" id="mcps1.1.3.1.1"><p id="p4165123514507"><a name="p4165123514507"></a><a name="p4165123514507"></a>Parameter</p>
88b049dde5Sopenharmony_ci    </th>
89b049dde5Sopenharmony_ci    <th class="cellrowborder" valign="top" width="88.08%" id="mcps1.1.3.1.2"><p id="p6165103514502"><a name="p6165103514502"></a><a name="p6165103514502"></a>Description</p>
90b049dde5Sopenharmony_ci    </th>
91b049dde5Sopenharmony_ci    </tr>
92b049dde5Sopenharmony_ci    </thead>
93b049dde5Sopenharmony_ci    <tbody><tr id="row71650351503"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p11651835145015"><a name="p11651835145015"></a><a name="p11651835145015"></a>display</p>
94b049dde5Sopenharmony_ci    </td>
95b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p16165183519506"><a name="p16165183519506"></a><a name="p16165183519506"></a>Indicates the display layer number.</p>
96b049dde5Sopenharmony_ci    </td>
97b049dde5Sopenharmony_ci    </tr>
98b049dde5Sopenharmony_ci    </tbody>
99b049dde5Sopenharmony_ci    </table>
100b049dde5Sopenharmony_ci
101b049dde5Sopenharmony_ci
102b049dde5Sopenharmony_ci-   up\_fbinitialize
103b049dde5Sopenharmony_ci
104b049dde5Sopenharmony_ci    **Function prototype:**
105b049dde5Sopenharmony_ci
106b049dde5Sopenharmony_ci    int up\_fbinitialize\(int display\);
107b049dde5Sopenharmony_ci
108b049dde5Sopenharmony_ci    **Function description:**  Initializes the framebuffer driver. This function needs your implementation by calling  **fb\_register**  to register a device node for providing the framebuffer hardware driver capability. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
109b049dde5Sopenharmony_ci
110b049dde5Sopenharmony_ci    **Parameter description**
111b049dde5Sopenharmony_ci
112b049dde5Sopenharmony_ci    <a name="table6333115110543"></a>
113b049dde5Sopenharmony_ci    <table><thead align="left"><tr id="row1333315117540"><th class="cellrowborder" valign="top" width="11.92%" id="mcps1.1.3.1.1"><p id="p1233320514548"><a name="p1233320514548"></a><a name="p1233320514548"></a>Parameter</p>
114b049dde5Sopenharmony_ci    </th>
115b049dde5Sopenharmony_ci    <th class="cellrowborder" valign="top" width="88.08%" id="mcps1.1.3.1.2"><p id="p12334125165413"><a name="p12334125165413"></a><a name="p12334125165413"></a>Description</p>
116b049dde5Sopenharmony_ci    </th>
117b049dde5Sopenharmony_ci    </tr>
118b049dde5Sopenharmony_ci    </thead>
119b049dde5Sopenharmony_ci    <tbody><tr id="row16334155113548"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p18334145115546"><a name="p18334145115546"></a><a name="p18334145115546"></a>display</p>
120b049dde5Sopenharmony_ci    </td>
121b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p15334951125417"><a name="p15334951125417"></a><a name="p15334951125417"></a>Indicates the display layer number.</p>
122b049dde5Sopenharmony_ci    </td>
123b049dde5Sopenharmony_ci    </tr>
124b049dde5Sopenharmony_ci    </tbody>
125b049dde5Sopenharmony_ci    </table>
126b049dde5Sopenharmony_ci
127b049dde5Sopenharmony_ci
128b049dde5Sopenharmony_ci-   up\_fbuninitialize
129b049dde5Sopenharmony_ci
130b049dde5Sopenharmony_ci    **Function prototype:**
131b049dde5Sopenharmony_ci
132b049dde5Sopenharmony_ci    void up\_fbuninitialize\(int display\);
133b049dde5Sopenharmony_ci
134b049dde5Sopenharmony_ci    **Function description:**  Uninstalls the framebuffer driver. This function needs your implementation by calling  **fb\_unregister**  to unregister the device node. No value is returned for this function.
135b049dde5Sopenharmony_ci
136b049dde5Sopenharmony_ci    **Parameter description**
137b049dde5Sopenharmony_ci
138b049dde5Sopenharmony_ci    <a name="table18929574553"></a>
139b049dde5Sopenharmony_ci    <table><thead align="left"><tr id="row1993012716553"><th class="cellrowborder" valign="top" width="11.92%" id="mcps1.1.3.1.1"><p id="p1593012795510"><a name="p1593012795510"></a><a name="p1593012795510"></a>Parameter</p>
140b049dde5Sopenharmony_ci    </th>
141b049dde5Sopenharmony_ci    <th class="cellrowborder" valign="top" width="88.08%" id="mcps1.1.3.1.2"><p id="p1693014715516"><a name="p1693014715516"></a><a name="p1693014715516"></a>Description</p>
142b049dde5Sopenharmony_ci    </th>
143b049dde5Sopenharmony_ci    </tr>
144b049dde5Sopenharmony_ci    </thead>
145b049dde5Sopenharmony_ci    <tbody><tr id="row4930076554"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p18930147105517"><a name="p18930147105517"></a><a name="p18930147105517"></a>display</p>
146b049dde5Sopenharmony_ci    </td>
147b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p89309705512"><a name="p89309705512"></a><a name="p89309705512"></a>Indicates the display layer number.</p>
148b049dde5Sopenharmony_ci    </td>
149b049dde5Sopenharmony_ci    </tr>
150b049dde5Sopenharmony_ci    </tbody>
151b049dde5Sopenharmony_ci    </table>
152b049dde5Sopenharmony_ci
153b049dde5Sopenharmony_ci
154b049dde5Sopenharmony_ci-   up\_fbgetvplane
155b049dde5Sopenharmony_ci
156b049dde5Sopenharmony_ci    **Function prototype:**
157b049dde5Sopenharmony_ci
158b049dde5Sopenharmony_ci    struct fb\_vtable\_s \*up\_fbgetvplane\(int display, int vplane\);
159b049dde5Sopenharmony_ci
160b049dde5Sopenharmony_ci    **Function description:**  Obtains a framebuffer driver handle, which needs your implementation. If the operation is successful, a valid pointer is returned. Otherwise,  **NULL**  is returned.
161b049dde5Sopenharmony_ci
162b049dde5Sopenharmony_ci    **Parameter description**
163b049dde5Sopenharmony_ci
164b049dde5Sopenharmony_ci    <a name="table0350124169"></a>
165b049dde5Sopenharmony_ci    <table><thead align="left"><tr id="row183519416611"><th class="cellrowborder" valign="top" width="11.92%" id="mcps1.1.3.1.1"><p id="p7351184160"><a name="p7351184160"></a><a name="p7351184160"></a>Parameter</p>
166b049dde5Sopenharmony_ci    </th>
167b049dde5Sopenharmony_ci    <th class="cellrowborder" valign="top" width="88.08%" id="mcps1.1.3.1.2"><p id="p18351347614"><a name="p18351347614"></a><a name="p18351347614"></a>Description</p>
168b049dde5Sopenharmony_ci    </th>
169b049dde5Sopenharmony_ci    </tr>
170b049dde5Sopenharmony_ci    </thead>
171b049dde5Sopenharmony_ci    <tbody><tr id="row8351174461"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p143519414618"><a name="p143519414618"></a><a name="p143519414618"></a>display</p>
172b049dde5Sopenharmony_ci    </td>
173b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p1035110419612"><a name="p1035110419612"></a><a name="p1035110419612"></a>Indicates the display layer number.</p>
174b049dde5Sopenharmony_ci    </td>
175b049dde5Sopenharmony_ci    </tr>
176b049dde5Sopenharmony_ci    <tr id="row187413238610"><td class="cellrowborder" valign="top" width="11.92%" headers="mcps1.1.3.1.1 "><p id="p118752231869"><a name="p118752231869"></a><a name="p118752231869"></a>vplane</p>
177b049dde5Sopenharmony_ci    </td>
178b049dde5Sopenharmony_ci    <td class="cellrowborder" valign="top" width="88.08%" headers="mcps1.1.3.1.2 "><p id="p16875102311611"><a name="p16875102311611"></a><a name="p16875102311611"></a>Indicates the specified color plane.</p>
179b049dde5Sopenharmony_ci    </td>
180b049dde5Sopenharmony_ci    </tr>
181b049dde5Sopenharmony_ci    </tbody>
182b049dde5Sopenharmony_ci    </table>
183b049dde5Sopenharmony_ci
184b049dde5Sopenharmony_ci
185b049dde5Sopenharmony_ci-   pse\_ran\_dev\_register
186b049dde5Sopenharmony_ci
187b049dde5Sopenharmony_ci    **Function prototype:**
188b049dde5Sopenharmony_ci
189b049dde5Sopenharmony_ci    int pse\_ran\_dev\_register\(void\);
190b049dde5Sopenharmony_ci
191b049dde5Sopenharmony_ci    **Function description:**  Initializes the PRNG device driver and registers the  **/dev/random**  device node. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
192b049dde5Sopenharmony_ci
193b049dde5Sopenharmony_ci    **Parameter description:**  none
194b049dde5Sopenharmony_ci
195b049dde5Sopenharmony_ci
196b049dde5Sopenharmony_ci-   ran\_dev\_register
197b049dde5Sopenharmony_ci
198b049dde5Sopenharmony_ci    **Function prototype:**
199b049dde5Sopenharmony_ci
200b049dde5Sopenharmony_ci    int ran\_dev\_register\(void\);
201b049dde5Sopenharmony_ci
202b049dde5Sopenharmony_ci    **Function description:**  Initializes the TRNG driver and registers the  **/dev/urandom**  device node. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
203b049dde5Sopenharmony_ci
204b049dde5Sopenharmony_ci    **Parameter description:**  none
205b049dde5Sopenharmony_ci
206b049dde5Sopenharmony_ci
207b049dde5Sopenharmony_ci-   mem\_dev\_register
208b049dde5Sopenharmony_ci
209b049dde5Sopenharmony_ci    **Function prototype:**
210b049dde5Sopenharmony_ci
211b049dde5Sopenharmony_ci    int mem\_dev\_register\(void\);
212b049dde5Sopenharmony_ci
213b049dde5Sopenharmony_ci    **Function description:**  Initializes the mem driver and registers the  **/dev/mem**  device node. If the operation is successful,  **0**  is returned. Otherwise, an error code is returned.
214b049dde5Sopenharmony_ci
215b049dde5Sopenharmony_ci    **Parameter description:**  none
216b049dde5Sopenharmony_ci
217b049dde5Sopenharmony_ci
218b049dde5Sopenharmony_ci### Usage<a name="section129654513264"></a>
219b049dde5Sopenharmony_ci
220b049dde5Sopenharmony_ci-   The following uses the framebuffer driver as an example:
221b049dde5Sopenharmony_ci
222b049dde5Sopenharmony_ci```
223b049dde5Sopenharmony_ciint up_fbinitialize(int display)
224b049dde5Sopenharmony_ci{
225b049dde5Sopenharmony_ci    // Provide framebuffer hardware driver capabilities. The specific code logic needs your implementation.
226b049dde5Sopenharmony_ci}
227b049dde5Sopenharmony_ci
228b049dde5Sopenharmony_civoid up_fbuninitialize(int display)
229b049dde5Sopenharmony_ci{
230b049dde5Sopenharmony_ci    // This function is used together with up_fbinitialize. The specific code logic needs your implementation.
231b049dde5Sopenharmony_ci}
232b049dde5Sopenharmony_ci
233b049dde5Sopenharmony_cistruct fb_vtable_s *up_fbgetvplane(int display, int vplane)
234b049dde5Sopenharmony_ci{
235b049dde5Sopenharmony_ci    // Register a hardware driver based on information described by the fb_vtable_s structure. You can use the driver capabilities through the video framework layer. The specific code logic needs your implementation.
236b049dde5Sopenharmony_ci}
237b049dde5Sopenharmony_ci
238b049dde5Sopenharmony_ciint FrameBufferFunc(void)
239b049dde5Sopenharmony_ci{
240b049dde5Sopenharmony_ci    int ret;
241b049dde5Sopenharmony_ci    int fd = -1;
242b049dde5Sopenharmony_ci    struct hifb_info info;
243b049dde5Sopenharmony_ci    char *pShowScreen = NULL;
244b049dde5Sopenharmony_ci
245b049dde5Sopenharmony_ci    ret = fb_register(0, 0); // Register the /dev/fb0 device node. This function will call the preceding functions to enable hardware driver capabilities.
246b049dde5Sopenharmony_ci    if (ret != 0) {
247b049dde5Sopenharmony_ci        return -1;
248b049dde5Sopenharmony_ci    }
249b049dde5Sopenharmony_ci
250b049dde5Sopenharmony_ci    fd = open(file, O_RDWR, 0);  
251b049dde5Sopenharmony_ci    if (fd < 0) {
252b049dde5Sopenharmony_ci        return -1;
253b049dde5Sopenharmony_ci    }
254b049dde5Sopenharmony_ci 
255b049dde5Sopenharmony_ci    if (ioctl(fd, FBIOGET_SCREENINFO_HIFB, &info) < 0) {
256b049dde5Sopenharmony_ci        return -1;
257b049dde5Sopenharmony_ci    }
258b049dde5Sopenharmony_ci    info.vinfo.xres = 1920;
259b049dde5Sopenharmony_ci    info.vinfo.yres = 1080;
260b049dde5Sopenharmony_ci    info.oinfo.sarea.w = 1920;
261b049dde5Sopenharmony_ci    info.oinfo.sarea.h = 1080;
262b049dde5Sopenharmony_ci    info.oinfo.bpp = 16;
263b049dde5Sopenharmony_ci    info.activate = 0;
264b049dde5Sopenharmony_ci    info.vinfo.fmt = HIFB_FMT_ARGB1555;
265b049dde5Sopenharmony_ci
266b049dde5Sopenharmony_ci    if (ioctl(fd, FBIOPUT_SCREENINFO_HIFB, &info) < 0) {
267b049dde5Sopenharmony_ci        return -1;
268b049dde5Sopenharmony_ci    }
269b049dde5Sopenharmony_ci
270b049dde5Sopenharmony_ci    if (ioctl(fd, FBIOGET_SCREENINFO_HIFB, &info) < 0) {
271b049dde5Sopenharmony_ci        return -1;
272b049dde5Sopenharmony_ci    }
273b049dde5Sopenharmony_ci
274b049dde5Sopenharmony_ci    pShowScreen = mmap(HI_NULL, info.oinfo.fblen, PROT_READ | PROT_WRITE, MAP_SHARED, pstInfo->fd, 0);
275b049dde5Sopenharmony_ci    if (pShowScreen == -1) {
276b049dde5Sopenharmony_ci        return -1;
277b049dde5Sopenharmony_ci    }
278b049dde5Sopenharmony_ci
279b049dde5Sopenharmony_ci    // Fill in the memory to which pShowScreen points and display the graphics through the ioctl call.
280b049dde5Sopenharmony_ci
281b049dde5Sopenharmony_ci    munmap(pShowScreen, info.oinfo.fblen); 
282b049dde5Sopenharmony_ci  
283b049dde5Sopenharmony_ci    close(fd);
284b049dde5Sopenharmony_ci
285b049dde5Sopenharmony_ci    ret = fb_unregister(0);
286b049dde5Sopenharmony_ci    if (ret != 0) {
287b049dde5Sopenharmony_ci        return -1;
288b049dde5Sopenharmony_ci    }
289b049dde5Sopenharmony_ci}
290b049dde5Sopenharmony_ci```
291b049dde5Sopenharmony_ci
292b049dde5Sopenharmony_ci## Repositories Involved<a name="section1371113476307"></a>
293b049dde5Sopenharmony_ci
294b049dde5Sopenharmony_ci[Kernel subsystem](https://gitee.com/openharmony/docs/blob/HEAD/en/readme/kernel.md)
295b049dde5Sopenharmony_ci
296b049dde5Sopenharmony_ci[drivers\_liteos](https://gitee.com/openharmony/drivers_liteos/blob/master/README.md)
297b049dde5Sopenharmony_ci
298b049dde5Sopenharmony_ci[kernel\_liteos\_a](https://gitee.com/openharmony/kernel_liteos_a/blob/HEAD/README.md)
299b049dde5Sopenharmony_ci
300