• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Device Driver Porting<a name="EN-US_TOPIC_0000001200252097"></a>
2
3-   [LCD Driver Porting](#section1574513454119)
4-   [Touchscreen Driver Porting](#section20284142116422)
5-   [WLAN Driver Porting](#section0969448164217)
6
7This section describes how to port device drivers.
8
9## LCD Driver Porting<a name="section1574513454119"></a>
10
11To port an LCD driver, write the driver, create an instance of the corresponding model in the driver, and complete the registration.
12
13The LCD drivers are stored in  **//drivers/framework/model/display/driver/panel**.
14
151.  Create a panel driver.
16
17    Create an HDF driver and call the  **RegisterPanel**  method to register a model instance during driver initialization.
18
19    ```
20    int32_t LCDxxEntryInit(struct HdfDeviceObject *object)
21    {
22        struct PanelData *panel = CreateYourPanel();
23        // Register a model instance.
24        if (RegisterPanel(panel) != HDF_SUCCESS) {
25            HDF_LOGE("%s: RegisterPanel failed", __func__);
26            return HDF_FAILURE;
27        }
28        return HDF_SUCCESS;
29    }
30
31    struct HdfDriverEntry g_xxxxDevEntry = {
32        .moduleVersion = 1,
33        .moduleName = "LCD_XXXX",
34        .Init = LCDxxEntryInit,
35    };
36
37    HDF_INIT(g_xxxxDevEntry);
38    ```
39
402.  Configure and load the panel driver.
41
42    Modify the source code file  **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Add configurations for the device named  **device\_lcd**  for the display host.
43
44    >![](../public_sys-resources/icon-caution.gif) **CAUTION:**
45    >Make sure the value of  **moduleName**  is the same as that of  **moduleName**  in the panel driver.
46
47    ```
48    root {
49        ...
50        display :: host {
51            device_lcd :: device {
52                    deviceN :: deviceNode {
53                        policy = 0;
54                        priority = 100;
55                        preload = 2;
56                        moduleName = "LCD_XXXX";
57                    }
58            }
59        }
60    }
61    ```
62
63
64## Touchscreen Driver Porting<a name="section20284142116422"></a>
65
66This section describes how to port a touchscreen driver. The touchscreen drivers are stored in the source code directory  **//drivers/framework/model/input/driver/touchscreen**. To port a touchscreen driver, register a  **ChipDevice**  model instance with the system.
67
68For details about how to develop a touchscreen driver, see  [Touchscreen Development Guidelines](../driver/driver-peripherals-touch-des.md).
69
701.  Create a touchscreen driver.
71
72    Create the  **touch\_ic\_name.c**  file in the  **touchscreen**  directory. Write the following content:
73
74    ```
75    #include "hdf_touch.h"
76
77    static int32_t HdfXXXXChipInit(struct HdfDeviceObject *device)
78    {
79        ChipDevice *tpImpl = CreateXXXXTpImpl();
80        if(RegisterChipDevice(tpImpl) != HDF_SUCCESS) {// Register the ChipDevice model instance.
81            ReleaseXXXXTpImpl(tpImpl);
82            return HDF_FAILURE;
83        }
84        return HDF_SUCCESS;
85    }
86
87    struct HdfDriverEntry g_touchXXXXChipEntry = {
88        .moduleVersion = 1,
89        .moduleName = "HDF_TOUCH_XXXX", // Make sure the value is the same as that in the subsequent configuration.
90        .Init = HdfXXXXChipInit,
91    };
92
93    HDF_INIT(g_touchXXXXChipEntry);
94    ```
95
96    The following methods need to be implemented in  **ChipDevice**:
97
98    <a name="table63781245516"></a>
99    <table><thead align="left"><tr id="row1639713218557"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p53981829557"><a name="p53981829557"></a><a name="p53981829557"></a>Method</p>
100    </th>
101    <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p739811218557"><a name="p739811218557"></a><a name="p739811218557"></a>Description</p>
102    </th>
103    </tr>
104    </thead>
105    <tbody><tr id="row113981214559"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p339813214552"><a name="p339813214552"></a><a name="p339813214552"></a>int32_t (*Init)(ChipDevice *device)</p>
106    </td>
107    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1139810214552"><a name="p1139810214552"></a><a name="p1139810214552"></a>Initializes the device.</p>
108    </td>
109    </tr>
110    <tr id="row15398122145511"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1139820212557"><a name="p1139820212557"></a><a name="p1139820212557"></a>int32_t (*Detect)(ChipDevice *device)</p>
111    </td>
112    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p939820217555"><a name="p939820217555"></a><a name="p939820217555"></a>Detects the device.</p>
113    </td>
114    </tr>
115    <tr id="row183981216550"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p8398142165517"><a name="p8398142165517"></a><a name="p8398142165517"></a>int32_t (*Suspend)(ChipDevice *device)</p>
116    </td>
117    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p539815218558"><a name="p539815218558"></a><a name="p539815218558"></a>Places the device in sleep mode.</p>
118    </td>
119    </tr>
120    <tr id="row1239842115519"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p43981295511"><a name="p43981295511"></a><a name="p43981295511"></a>int32_t (*Resume)(ChipDevice *device)</p>
121    </td>
122    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p173985245515"><a name="p173985245515"></a><a name="p173985245515"></a>Wakes up the device.</p>
123    </td>
124    </tr>
125    <tr id="row5398326559"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p103981324554"><a name="p103981324554"></a><a name="p103981324554"></a>int32_t (*DataHandle)(ChipDevice *device)</p>
126    </td>
127    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p93980212554"><a name="p93980212554"></a><a name="p93980212554"></a>Reads data from the device and writes touch point data to <strong id="b576475914217"><a name="b576475914217"></a><a name="b576475914217"></a>device</strong> &gt; <strong id="b976511597218"><a name="b976511597218"></a><a name="b976511597218"></a>driver</strong> &gt; <strong id="b117661559162110"><a name="b117661559162110"></a><a name="b117661559162110"></a>frameData</strong>.</p>
128    </td>
129    </tr>
130    <tr id="row03987215550"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1039814295515"><a name="p1039814295515"></a><a name="p1039814295515"></a>int32_t (*UpdateFirmware)(ChipDevice *device)</p>
131    </td>
132    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p18398102105520"><a name="p18398102105520"></a><a name="p18398102105520"></a>Updates the firmware.</p>
133    </td>
134    </tr>
135    </tbody>
136    </table>
137
1382.  Configure the product and load the driver.
139
140    All device information of the product is defined in the source code file  **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the  **device**  named  **device\_touch\_chip**  in the  **host**  of the  **input**  command.
141
142    >![](../public_sys-resources/icon-note.gif) **NOTE:**
143    >Make sure the value of  **moduleName**  is the same as that of  **moduleName**  in the touchscreen driver.
144
145    ```
146                    deviceN :: deviceNode {
147                        policy = 0;
148                        priority = 130;
149                        preload = 0;
150                        permission = 0660;
151                        moduleName = "HDF_TOUCH_XXXX";
152                        deviceMatchAttr = "touch_XXXX_configs";
153                    }
154    ```
155
156
157## WLAN Driver Porting<a name="section0969448164217"></a>
158
159The WLAN driver is divided into two parts. One of the parts manages WLAN devices, and the other part manages WLAN traffic.
160
161**Figure  1**  OpenHarmony WLAN driver architecture<a name="fig155920160203"></a>
162
163
164![](figure/hdf_wifi.png)
165
166As shown in  [Figure 1](#fig155920160203), the part on the left manages WLAN devices, and the part on the right manages WLAN traffic. The HDF WLAN framework abstracts these two parts. The porting process of the driver can be considered as the implementation of the APIs required by the two parts. These APIs are described as follows:
167
168<a name="table1349145511213"></a>
169<table><thead align="left"><tr id="row867115517211"><th class="cellrowborder" valign="top" width="17.28172817281728%" id="mcps1.1.4.1.1"><p id="p667255120"><a name="p667255120"></a><a name="p667255120"></a>API</p>
170</th>
171<th class="cellrowborder" valign="top" width="39.48394839483948%" id="mcps1.1.4.1.2"><p id="p9672551125"><a name="p9672551125"></a><a name="p9672551125"></a>Header File</p>
172</th>
173<th class="cellrowborder" valign="top" width="43.23432343234324%" id="mcps1.1.4.1.3"><p id="p166785515214"><a name="p166785515214"></a><a name="p166785515214"></a>API Description</p>
174</th>
175</tr>
176</thead>
177<tbody><tr id="row16671955128"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p86712551023"><a name="p86712551023"></a><a name="p86712551023"></a>HdfChipDriverFactory</p>
178</td>
179<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p10671551126"><a name="p10671551126"></a><a name="p10671551126"></a>drivers\framework\include\wifi\hdf_wlan_chipdriver_manager.h</p>
180</td>
181<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p26725514220"><a name="p26725514220"></a><a name="p26725514220"></a>Factory of the <strong id="b88841282246"><a name="b88841282246"></a><a name="b88841282246"></a>ChipDriver</strong>, which is used to support multiple WLAN interfaces of a chip.</p>
182</td>
183</tr>
184<tr id="row186810552214"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p11686551323"><a name="p11686551323"></a><a name="p11686551323"></a>HdfChipDriver</p>
185</td>
186<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p11686551723"><a name="p11686551723"></a><a name="p11686551723"></a>drivers\framework\include\wifi\wifi_module.h</p>
187</td>
188<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p26814555217"><a name="p26814555217"></a><a name="p26814555217"></a>Manages a specific WLAN interface.</p>
189</td>
190</tr>
191<tr id="row13686559215"><td class="cellrowborder" valign="top" width="17.28172817281728%" headers="mcps1.1.4.1.1 "><p id="p76810555214"><a name="p76810555214"></a><a name="p76810555214"></a>NetDeviceInterFace</p>
192</td>
193<td class="cellrowborder" valign="top" width="39.48394839483948%" headers="mcps1.1.4.1.2 "><p id="p166818551825"><a name="p166818551825"></a><a name="p166818551825"></a>drivers\framework\include\wifi\net_device.h</p>
194</td>
195<td class="cellrowborder" valign="top" width="43.23432343234324%" headers="mcps1.1.4.1.3 "><p id="p368195513213"><a name="p368195513213"></a><a name="p368195513213"></a>Communicates with the protocol stack, such as sending data and setting the status of network interfaces.</p>
196</td>
197</tr>
198</tbody>
199</table>
200
201>![](../public_sys-resources/icon-note.gif) **NOTE:**
202>For details about the API development, see  [WLAN Development Guidelines](../driver/driver-peripherals-external-des.md).
203
204The porting procedure is as follows:
205
2061.  Create a WLAN chip driver.
207
208    Create the  **hdf\_wlan\_chip\_name.c**  file in  **/device/vendor\_name/peripheral/wifi/chip\_name/**. The sample code is as follows:
209
210    ```
211    static int32_t HdfWlanHisiChipDriverInit(struct HdfDeviceObject *device) {
212        static struct HdfChipDriverFactory factory = CreateChipDriverFactory(); // Implement the method.
213        struct HdfChipDriverManager *driverMgr = HdfWlanGetChipDriverMgr();
214        if (driverMgr->RegChipDriver(&factory) != HDF_SUCCESS) {// Register the driver factory.
215            HDF_LOGE("%s fail: driverMgr is NULL!", __func__);
216            return HDF_FAILURE;
217        }
218        return HDF_SUCCESS;
219    }
220
221    struct HdfDriverEntry g_hdfXXXChipEntry = {
222        .moduleVersion = 1,
223        .Init = HdfWlanXXXChipDriverInit,
224        .Release = HdfWlanXXXChipRelease,
225        .moduleName = "HDF_WIFI_CHIP_XXX" // Make sure the name is the same as the configured one.
226    };
227
228    HDF_INIT(g_hdfXXXChipEntry);
229    ```
230
231    In the  **CreateChipDriverFactory**  method, create an object of the  **HdfChipDriverFactory**  type. This object provides the following methods:
232
233    <a name="table8351533595"></a>
234    <table><thead align="left"><tr id="row25693318916"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p125683311913"><a name="p125683311913"></a><a name="p125683311913"></a>Method</p>
235    </th>
236    <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p1656103318919"><a name="p1656103318919"></a><a name="p1656103318919"></a>Description</p>
237    </th>
238    </tr>
239    </thead>
240    <tbody><tr id="row15612331994"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p185663314920"><a name="p185663314920"></a><a name="p185663314920"></a>const char *driverName</p>
241    </td>
242    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p7563330917"><a name="p7563330917"></a><a name="p7563330917"></a>Indicates the driver name.</p>
243    </td>
244    </tr>
245    <tr id="row20561733993"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p13561331297"><a name="p13561331297"></a><a name="p13561331297"></a>int32_t (*InitChip)(struct HdfWlanDevice *device)</p>
246    </td>
247    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p756163312914"><a name="p756163312914"></a><a name="p756163312914"></a>Initializes the chip.</p>
248    </td>
249    </tr>
250    <tr id="row155612337919"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p135633315917"><a name="p135633315917"></a><a name="p135633315917"></a>int32_t (*DeinitChip)(struct HdfWlanDevice *device)</p>
251    </td>
252    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p3566331094"><a name="p3566331094"></a><a name="p3566331094"></a>Deinitializes the chip.</p>
253    </td>
254    </tr>
255    <tr id="row18567337916"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p157203315917"><a name="p157203315917"></a><a name="p157203315917"></a>void (*ReleaseFactory)(struct HdfChipDriverFactory *factory)</p>
256    </td>
257    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p165716331596"><a name="p165716331596"></a><a name="p165716331596"></a>Releases the <strong id="b17274134462416"><a name="b17274134462416"></a><a name="b17274134462416"></a>HdfChipDriverFactory</strong> object.</p>
258    </td>
259    </tr>
260    <tr id="row1757143314912"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p105710331694"><a name="p105710331694"></a><a name="p105710331694"></a>struct HdfChipDriver *(*Build)(struct HdfWlanDevice *device, uint8_t ifIndex)</p>
261    </td>
262    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p457143320911"><a name="p457143320911"></a><a name="p457143320911"></a>Creates an <strong id="b118260459243"><a name="b118260459243"></a><a name="b118260459243"></a>HdfChipDriver</strong>. In the input parameters, <strong id="b28271845162411"><a name="b28271845162411"></a><a name="b28271845162411"></a>device</strong> indicates the device information, and <strong id="b16827144519241"><a name="b16827144519241"></a><a name="b16827144519241"></a>ifIndex</strong> indicates the sequence number of this interface in the chip.</p>
263    </td>
264    </tr>
265    <tr id="row1157153310912"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p155714334917"><a name="p155714334917"></a><a name="p155714334917"></a>void (*Release)(struct HdfChipDriver *chipDriver)</p>
266    </td>
267    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p95717338919"><a name="p95717338919"></a><a name="p95717338919"></a>Releases the chip driver.</p>
268    </td>
269    </tr>
270    <tr id="row1157143313914"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p19571433993"><a name="p19571433993"></a><a name="p19571433993"></a>uint8_t (*GetMaxIFCount)(struct HdfChipDriverFactory *factory)</p>
271    </td>
272    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p14571334915"><a name="p14571334915"></a><a name="p14571334915"></a>Obtains the maximum number of interfaces supported by the current chip.</p>
273    </td>
274    </tr>
275    </tbody>
276    </table>
277
278    The  **Build**  method creates an  **HdfChipDriver**  object that manages the specified network interface. This object needs to provide the following methods:
279
280    <a name="table16989183941017"></a>
281    <table><thead align="left"><tr id="row61014406100"><th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.1"><p id="p111094011015"><a name="p111094011015"></a><a name="p111094011015"></a>Method</p>
282    </th>
283    <th class="cellrowborder" valign="top" width="50%" id="mcps1.1.3.1.2"><p id="p11102040201014"><a name="p11102040201014"></a><a name="p11102040201014"></a>Description</p>
284    </th>
285    </tr>
286    </thead>
287    <tbody><tr id="row111014409104"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p21084017106"><a name="p21084017106"></a><a name="p21084017106"></a>int32_t (*init)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p>
288    </td>
289    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p1310184012103"><a name="p1310184012103"></a><a name="p1310184012103"></a>Initializes the current network interface. The <strong id="b18435181416253"><a name="b18435181416253"></a><a name="b18435181416253"></a>NetDeviceInterFace</strong> needs to be provided for the <strong id="b1543511144251"><a name="b1543511144251"></a><a name="b1543511144251"></a>netDev</strong>.</p>
290    </td>
291    </tr>
292    <tr id="row210840101012"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p71064031013"><a name="p71064031013"></a><a name="p71064031013"></a>int32_t (*deinit)(struct HdfChipDriver *chipDriver, NetDevice *netDev)</p>
293    </td>
294    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p710144015101"><a name="p710144015101"></a><a name="p710144015101"></a>Deinitializes the current network interface.</p>
295    </td>
296    </tr>
297    <tr id="row151094011100"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1910340171018"><a name="p1910340171018"></a><a name="p1910340171018"></a>struct HdfMac80211BaseOps *ops</p>
298    </td>
299    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p31034071020"><a name="p31034071020"></a><a name="p31034071020"></a>Provides the WLAN basic capability interface set.</p>
300    </td>
301    </tr>
302    <tr id="row91012407102"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p191014051019"><a name="p191014051019"></a><a name="p191014051019"></a>struct HdfMac80211STAOps *staOps</p>
303    </td>
304    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p810104013106"><a name="p810104013106"></a><a name="p810104013106"></a>Provides the interface set required for supporting the STA mode.</p>
305    </td>
306    </tr>
307    <tr id="row17101840111020"><td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.1 "><p id="p1010204081015"><a name="p1010204081015"></a><a name="p1010204081015"></a>struct HdfMac80211APOps *apOps</p>
308    </td>
309    <td class="cellrowborder" valign="top" width="50%" headers="mcps1.1.3.1.2 "><p id="p710184013105"><a name="p710184013105"></a><a name="p710184013105"></a>Provides the interface set required for supporting the AP mode.</p>
310    </td>
311    </tr>
312    </tbody>
313    </table>
314
3152.  Create a configuration file to describe the chips supported by the driver.
316
317    Create a chip configuration file in the product configuration directory and save it to the source code path  **//vendor/vendor\_name/product\_name/config/wifi/wlan\_chip\_chip\_name.hcs**.
318
319    The sample code is as follows:
320
321    ```
322    root {
323        wlan_config {
324            chip_name :& chipList {
325                chip_name :: chipInst {
326                    match_attr = "hdf_wlan_chips_chip_name"; /* Indicates the configuration matching attribute, which is used to provide the configuration root of the driver.*/
327                    driverName = "driverName"; /* Indicates the driver name, which must be the same as that of driverName in HdfChipDriverFactory.*/
328                    sdio {
329                        vendorId = 0xXXXX; /* your vendor id */
330                        deviceId = [0xXXXX]; /*your supported devices */
331                    }
332                }
333            }
334        }
335    }
336    ```
337
338    >![](../public_sys-resources/icon-note.gif) **NOTE:**
339    >Replace the values of  **vendor\_name**,  **product\_name**, and  **chip\_name**  in the path and file with the actual names.
340    >Set  **vendorId**  and  **deviceId**  to the actual vendor ID and chip ID, respectively.
341
3423.  Edit the configuration file and load the driver.
343
344    All device information of the product is defined in the source code file  **//vendor/vendor\_name/product\_name/config/device\_info/device\_info.hcs**. Modify the file and add configurations to the  **device**  named  **device\_wlan\_chips**  in the  **host**  of the  **network**  command. The sample code is as follows:
345
346    ```
347                    deviceN :: deviceNode {
348                        policy = 0;
349                        preload = 2;
350                        moduleName = "HDF_WLAN_CHIPS";
351                        deviceMatchAttr = "hdf_wlan_chips_chip_name";
352                        serviceName = "driverName";
353                    }
354    ```
355
356    >![](../public_sys-resources/icon-note.gif) **NOTE:**
357    >Make sure the value of  **moduleName**  is the same as that of  **moduleName**  in the WLAN driver.
358
3594.  Modify the  **Kconfig**  file to make the ported WLAN driver appear in the kernel configuration.
360
361    Add configurations to  **device/vendor\_name/drivers/Kconfig**. The sample code is as follows:
362
363    ```
364    config DRIVERS_HDF_WIFI_chip_name
365        bool "Enable chip_name Host driver"
366        default n
367        depends on DRIVERS_HDF_WLAN   help
368          Answer Y to enable chip_name Host driver.
369    ```
370
371    >![](../public_sys-resources/icon-note.gif) **NOTE:**
372    >Replace  **chip\_name**  with the actual chip name.
373
3745.  Modify the build script to enable the driver to participate in the kernel build.
375
376    Add the following content to the end of the source code file  **//device/vendor\_name/drivers/lite.mk**:
377
378    ```
379    ifeq ($(LOSCFG_DRIVERS_HDF_WIFI_chip_name), y)
380        # After the build is complete, an object named hdf_wlan_chipdriver_chip_name needs to be linked. You are advised to use this name to prevent conflicts.
381        LITEOS_BASELIB += -lhdf_wlan_chipdriver_chip_name
382        # Add the build directory gpio.
383        LIB_SUBDIRS    += ../peripheral/wifi/chip_name
384    endif
385    ```
386
387    >![](../public_sys-resources/icon-note.gif) **NOTE:**
388    >Replace  **chip\_name**  with the actual chip name.
389
390
391