この記事では、バイリンガルソースRK-SM-YF-210 V1.0の技術的な体をカバーしています。 RTL8723CS と Rockchip BSP カーネルインターフェイスを使用します。 ソースはカーネルバージョンを指定しません。WIFI_HALの要件は、Android 8.0以降に適用されます。 ArmSoM では、このプラットフォームのリファレンスです。実際のワイヤレスモジュール、SoC、BSP、カーネルインターフェイスを確認してください。 ハードウェア検証は行いません。 中国語UIを含む単一のバイリンガルPDFから図が来ます。別の英語の数字は存在しません。
1 目的 {#1-purpose}
開発者がRealtek Wi-FiドライバをRockchipに移植するのを支援します。 以下はrtl8723csです。
2 ドライバーの変更 {#2-driver-changes}
2.1 ドライバをカーネルに追加する {#21-add-the-driver-to-the-kernel}
一般的なディレクトリは、drivers/net/wireless/rockchip_wlan/です。 Makefile に追加:
obj-$(CONFIG_RTL8723CS) += rtl8723cs/
同じディレクトリに Kconfig に追加します。
source "drivers/net/wireless/rockchip_wlan/rtl8723cs/Kconfig"
ドライバーパッケージをrtl8723csに名前を変更し、drivers/net/wireless/rockchip_wlan/rtl8723csに置きます。
2.2 ドライバーの Makefile を修正 {#22-modify-the-driver-makefile}
Realtek ドライバーは PC にデフォルト設定します。 Rockchipへの切り替え: CONFIG_PLATFORM_I386_PC = y を n に変更し、 CONFIG_PLATFORM_ARM_RK3188 = n を y に切り替えます。 Rockchipは.koドライバを使用します。モジュール名を8723csに変更します。
ifeq ($(CONFIG_PLATFORM_ARM_RK3188), y)
EXTRA_CFLAGS+= -DCONFIG_LITTLE_ENDIAN -DCONFIG_PLATFORM_ANDROID -DCONFIG_PLATFORM_ROCKCHIPS
……
#EXTRA_CFLAGS += -DRTW_ENABLE_WIFI_CONTROL_FUNC //注意这个要注释掉 Need to comment this out
……
MODULE_NAME := 8723cs
Endif
ソースの抜粋には、Endifで楕円と端が含まれているので、ここに保持されます。 実際のGNU のクローズキーワード、endifを下げて下さい。 RTW_ENABLE_WIFI_CONTROL_FUNCラインをコメントアウトします。 Android 8.0以降では、CONFIG_RTW_WIFI_HAL = nをCONFIG_RTW_WIFI_HAL = yに変更することもできます。
2.3 エントリー関数の修正 {#23-modify-entry-functions}
一般的なRealtekエントリは、rtw_drv_entryです: USBは、os_dep/linux/usb_intf.c、SDIOはos_dep/linux/sdio_intf.cを使用し、PCIeはos_dep/linux/pci_intf.cを使用しています。
static int __init rtw_drv_entry(void)をstatic int rtw_drv_entry(void)に変更。static void __exit rtw_drv_halt(void)をstatic void rtw_drv_halt(void)に変更。module_init(rtw_drv_entry);とmodule_exit(rtw_drv_halt);のコメントを受け付けていません。- Rockchip エントリーのラッパーを追加します。

変更前のエントリー関数(バイリンガルソース)

変更後のエントリーラッパー(ログラインはソースの右に既にクリップされています)
以下は、可視コードを記述します。 DRIVERVERSIONを含む2つのログラインは、元の画像でクリップされます。コメントは、欠落文字を発明することなく識別します。 スクリーンショットで元の関数体が崩壊するので、これは完全なソースファイルではありません。
#include <linux/rfkill-wlan.h>
extern int get_wifi_chip_type(void);
extern int rockchip_wifi_power(int on);
extern int rockchip_wifi_set_carddetect(int val);
int rockchip_wifi_init_module_rtkwifi(void)
{
#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
int type = get_wifi_chip_type();
if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return 0;
#endif
printk("\n");
printk("=======================================================\n");
printk("==== Launching Wi-Fi driver! (Powered by Rockchip) ====\n");
printk("=======================================================\n");
/* Source log line clipped after DRIVERVERSION; see original figure. */
rockchip_wifi_power(1);
rockchip_wifi_set_carddetect(1);
return rtw_drv_entry();
}
void rockchip_wifi_exit_module_rtkwifi(void)
{
#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
int type = get_wifi_chip_type();
if (type < WIFI_AP6XXX_SERIES || type == WIFI_ESP8089) return;
#endif
printk("\n");
printk("=======================================================\n");
printk("==== Dislaunching Wi-Fi driver! (Powered by Rockchip) ====\n");
printk("=======================================================\n");
/* Source log line clipped after DRIVERVERSION; see original figure. */
rtw_drv_halt();
rockchip_wifi_set_carddetect(0);
rockchip_wifi_power(0);
}
#ifdef CONFIG_WIFI_BUILD_MODULE
module_init(rockchip_wifi_init_module_rtkwifi);
module_exit(rockchip_wifi_exit_module_rtkwifi);
#else
#ifdef CONFIG_WIFI_LOAD_DRIVER_WHEN_KERNEL_BOOTUP
late_initcall(rockchip_wifi_init_module_rtkwifi);
module_exit(rockchip_wifi_exit_module_rtkwifi);
#else
EXPORT_SYMBOL(rockchip_wifi_init_module_rtkwifi);
EXPORT_SYMBOL(rockchip_wifi_exit_module_rtkwifi);
#endif
#endif
//module_init(rtw_drv_entry);
//module_exit(rtw_drv_halt);
2.4 RockchipMACアドレス対応(オプション) {#24-rockchip-mac-address-support-optional}
プロジェクトの必要があれば、rtl8723cs/core/rtw_ieee80211.c: #include <linux/rfkill-wlan.h> の rockchip_wifi_mac_addr(mac) のサポートを void rtw_macaddr_cfg(u8 *out, const u8 *hw_mac_addr) で加えて下さい。

MACアドレス変更
/* Use the mac address stored in the Efuse */
if (hw_mac_addr) {
_rtw_memcpy(mac, hw_mac_addr, ETH_ALEN);
}
if (!rockchip_wifi_mac_addr(mac)) {
printk("Get mac address from flash:[%02x:%02x:%02x:%02x:%02x:%02x]\n", mac[0], mac[1],
mac[2], mac[3], mac[4], mac[5]);
}
2.5 WOWLAN対応(オプション) {#25-wowlan-support-optional}
必要に応じてプロジェクトを切り替える CONFIG_WOWLAN = n とりあえず CONFIG_GPIO_WAKEUP = n に へ へ へ y ドライバー Makefile . . . アクセサリー rockchip_wifi_get_oob_irq() サポート platform/platform_ops.c:

ウェイク割込みの変更
#include <linux/rfkill-wlan.h>
extern unsigned int oob_irq;
int platform_wifi_power_on(void)
{
int ret = 0;
oob_irq = rockchip_wifi_get_oob_irq();
return ret;
}
リファレンス
公式ArmSoMのドキュメント、RK-SM-YF-210 V1.0、PDFページ5〜10。
