developer | 9037957 | 2024-05-29 17:23:20 +0800 | [diff] [blame^] | 1 | From 26ae462db9f0ad61ff3199412d7a4455259682eb Mon Sep 17 00:00:00 2001 |
| 2 | From: Rex Lu <rex.lu@mediatek.com> |
| 3 | Date: Wed, 29 May 2024 11:16:08 +0800 |
| 4 | Subject: [PATCH] filogic platform support |
| 5 | |
| 6 | --- |
| 7 | platform/mtk-filogic/platform_filogic.c | 206 ++++++++++++++++++++++++ |
| 8 | src/Makefile.am | 4 + |
| 9 | src/configure.ac | 1 + |
| 10 | src/wifi_hal_nl80211_utils.c | 36 ++++- |
| 11 | src/wifi_hal_priv.h | 8 +- |
| 12 | 5 files changed, 250 insertions(+), 5 deletions(-) |
| 13 | create mode 100644 platform/mtk-filogic/platform_filogic.c |
| 14 | |
| 15 | diff --git a/platform/mtk-filogic/platform_filogic.c b/platform/mtk-filogic/platform_filogic.c |
| 16 | new file mode 100644 |
| 17 | index 0000000..0d09599 |
| 18 | --- /dev/null |
| 19 | +++ b/platform/mtk-filogic/platform_filogic.c |
| 20 | @@ -0,0 +1,206 @@ |
| 21 | +#include <stddef.h> |
| 22 | +#include <string.h> |
| 23 | +#include <stdlib.h> |
| 24 | +#include "wifi_hal_priv.h" |
| 25 | +#include "wifi_hal.h" |
| 26 | + |
| 27 | +int platform_pre_init() |
| 28 | +{ |
| 29 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 30 | + return 0; |
| 31 | +} |
| 32 | + |
| 33 | +int platform_post_init(wifi_vap_info_map_t *vap_map) |
| 34 | +{ |
| 35 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 36 | + system("brctl addif brlan0 wifi0"); |
| 37 | + system("brctl addif brlan0 wifi1"); |
| 38 | + system("brctl addif brlan0 wifi2"); |
| 39 | + return 0; |
| 40 | +} |
| 41 | + |
| 42 | + |
| 43 | +int platform_set_radio(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam) |
| 44 | +{ |
| 45 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 46 | + return 0; |
| 47 | +} |
| 48 | + |
| 49 | +int platform_set_radio_pre_init(wifi_radio_index_t index, wifi_radio_operationParam_t *operationParam) |
| 50 | +{ |
| 51 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 52 | + return 0; |
| 53 | +} |
| 54 | + |
| 55 | +int platform_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map) |
| 56 | +{ |
| 57 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 58 | + return 0; |
| 59 | +} |
| 60 | + |
| 61 | +int nvram_get_vap_enable_status(bool *vap_enable, int vap_index) |
| 62 | +{ |
| 63 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 64 | + return 0; |
| 65 | +} |
| 66 | + |
| 67 | +int nvram_get_current_security_mode(wifi_security_modes_t *security_mode,int vap_index) |
| 68 | +{ |
| 69 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 70 | + return 0; |
| 71 | +} |
| 72 | + |
| 73 | +int platform_get_keypassphrase_default(char *password, int vap_index) |
| 74 | +{ |
| 75 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 76 | + /*password is not sensitive,won't grant access to real devices*/ |
| 77 | + strcpy(password,"12345678"); |
| 78 | + return 0; |
| 79 | +} |
| 80 | + |
| 81 | +int platform_get_ssid_default(char *ssid, int vap_index) |
| 82 | +{ |
| 83 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 84 | + sprintf(ssid,"filogic-onewifi%d",vap_index); |
| 85 | + return 0; |
| 86 | +} |
| 87 | + |
| 88 | +int platform_get_wps_pin_default(char *pin) |
| 89 | +{ |
| 90 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 91 | + /* dummy pin value */ |
| 92 | + strcpy(pin,"45276453"); |
| 93 | + return 0; |
| 94 | +} |
| 95 | + |
| 96 | +int platform_wps_event(wifi_wps_event_t data) |
| 97 | +{ |
| 98 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 99 | + return 0; |
| 100 | +} |
| 101 | + |
| 102 | +int platform_get_country_code_default(char *code) |
| 103 | +{ |
| 104 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 105 | + strcpy(code,"US"); |
| 106 | + return 0; |
| 107 | +} |
| 108 | + |
| 109 | +int nvram_get_current_password(char *l_password, int vap_index) |
| 110 | +{ |
| 111 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 112 | + /*password is not sensitive,won't grant access to real devices*/ |
| 113 | + strcpy(l_password,"12345678"); |
| 114 | + return 0; |
| 115 | +} |
| 116 | + |
| 117 | +int nvram_get_current_ssid(char *l_ssid, int vap_index) |
| 118 | +{ |
| 119 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 120 | + sprintf(l_ssid,"filogic-onewifi%d",vap_index); |
| 121 | + return 0; |
| 122 | +} |
| 123 | + |
| 124 | +int platform_pre_create_vap(wifi_radio_index_t index, wifi_vap_info_map_t *map) |
| 125 | +{ |
| 126 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 127 | + return 0; |
| 128 | +} |
| 129 | + |
| 130 | +int platform_flags_init(int *flags) |
| 131 | +{ |
| 132 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 133 | + return 0; |
| 134 | +} |
| 135 | + |
| 136 | +int platform_get_aid(void* priv, u16* aid, const u8* addr) |
| 137 | +{ |
| 138 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 139 | + return 0; |
| 140 | +} |
| 141 | + |
| 142 | +int platform_free_aid(void* priv, u16* aid) |
| 143 | +{ |
| 144 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 145 | + return 0; |
| 146 | +} |
| 147 | + |
| 148 | +int platform_sync_done(void* priv) |
| 149 | +{ |
| 150 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 151 | + return 0; |
| 152 | +} |
| 153 | + |
| 154 | +int platform_get_channel_bandwidth(wifi_radio_index_t index, wifi_channelBandwidth_t *channelWidth) |
| 155 | +{ |
| 156 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 157 | + return 0; |
| 158 | +} |
| 159 | + |
| 160 | +int platform_update_radio_presence(void) |
| 161 | +{ |
| 162 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 163 | + return 0; |
| 164 | +} |
| 165 | + |
| 166 | +int nvram_get_mgmt_frame_power_control(int vap_index, int* output_dbm) |
| 167 | +{ |
| 168 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 169 | + return 0; |
| 170 | +} |
| 171 | + |
| 172 | +int platform_set_txpower(void* priv, uint txpower) |
| 173 | +{ |
| 174 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 175 | + return 0; |
| 176 | +} |
| 177 | + |
| 178 | +int platform_get_radius_key_default(char *radius_key) |
| 179 | +{ |
| 180 | + wifi_hal_dbg_print("%s:%d \n",__func__,__LINE__); |
| 181 | + return 0; |
| 182 | +} |
| 183 | + |
| 184 | +INT wifi_setRadioDfsAtBootUpEnable(INT radioIndex, BOOL enabled) |
| 185 | +{ |
| 186 | + return RETURN_OK; |
| 187 | +} |
| 188 | +INT wifi_setApMacAddressControlMode(INT apIndex, INT filterMode) |
| 189 | +{ |
| 190 | + return RETURN_OK; |
| 191 | +} |
| 192 | +INT wifi_setApManagementFramePowerControl(INT wlanIndex, INT ManagementFramePowerControl) |
| 193 | +{ |
| 194 | + return RETURN_OK; |
| 195 | +} |
| 196 | + |
| 197 | +int platform_get_acl_num(int vap_index, uint *acl_count) |
| 198 | +{ |
| 199 | + return 0; |
| 200 | +} |
| 201 | + |
| 202 | +int platform_get_vendor_oui(char *vendor_oui, int vendor_oui_len) |
| 203 | +{ |
| 204 | + return -1; |
| 205 | +} |
| 206 | + |
| 207 | +int platform_set_neighbor_report(uint index, uint add, mac_address_t mac) |
| 208 | +{ |
| 209 | + return 0; |
| 210 | +} |
| 211 | + |
| 212 | +int platform_get_radio_phytemperature(wifi_radio_index_t index, |
| 213 | + wifi_radioTemperature_t *radioPhyTemperature) |
| 214 | +{ |
| 215 | + return 0; |
| 216 | +} |
| 217 | + |
| 218 | +int wifi_setQamPlus(void *priv) |
| 219 | +{ |
| 220 | + return 0; |
| 221 | +} |
| 222 | + |
| 223 | +int wifi_setApRetrylimit(void *priv) |
| 224 | +{ |
| 225 | + return 0; |
| 226 | +} |
| 227 | \ No newline at end of file |
| 228 | diff --git a/src/Makefile.am b/src/Makefile.am |
| 229 | index 055bb1d..5974ed1 100644 |
| 230 | --- a/src/Makefile.am |
| 231 | +++ b/src/Makefile.am |
| 232 | @@ -104,6 +104,10 @@ librdk_wifihal_la_CPPFLAGS += -I$(top_srcdir)/../platform/raspberry-pi |
| 233 | librdk_wifihal_la_SOURCES += ../platform/raspberry-pi/platform_pi.c |
| 234 | endif |
| 235 | |
| 236 | +if MTK_FILOGIC |
| 237 | +librdk_wifihal_la_CPPFLAGS += -I$(top_srcdir)/../platform/mtk-filogic |
| 238 | +librdk_wifihal_la_SOURCES += ../platform/mtk-filogic/platform_filogic.c |
| 239 | +endif |
| 240 | include_HEADERS = wifi_hal_rdk.h wifi_hal_rdk_framework.h ieee80211.h ../util_crypto/aes_siv.h |
| 241 | |
| 242 | if ONE_WIFIBUILD |
| 243 | diff --git a/src/configure.ac b/src/configure.ac |
| 244 | index f1ca7d2..03c4d97 100644 |
| 245 | --- a/src/configure.ac |
| 246 | +++ b/src/configure.ac |
| 247 | @@ -52,6 +52,7 @@ AM_CONDITIONAL([SCXER10_PORT], [test "x$SCXER10_PORT" = "xtrue"]) |
| 248 | AM_CONDITIONAL([SKYSR213_PORT], [test "x$SKYSR213_PORT" = "xtrue"]) |
| 249 | AM_CONDITIONAL([CMXB7_PORT], [test "x$CMXB7_PORT" = "xtrue"]) |
| 250 | AM_CONDITIONAL([HAL_IPC], [test "x$HAL_IPC" = "xtrue"]) |
| 251 | +AM_CONDITIONAL([MTK_FILOGIC], [test "x$MTK_FILOGIC" = "xtrue"]) |
| 252 | |
| 253 | AC_PREFIX_DEFAULT(`pwd`) |
| 254 | AC_ENABLE_SHARED |
| 255 | diff --git a/src/wifi_hal_nl80211_utils.c b/src/wifi_hal_nl80211_utils.c |
| 256 | index 02251a3..da9dc33 100644 |
| 257 | --- a/src/wifi_hal_nl80211_utils.c |
| 258 | +++ b/src/wifi_hal_nl80211_utils.c |
| 259 | @@ -285,6 +285,10 @@ wifi_interface_name_idex_map_t interface_index_map[] = { |
| 260 | #endif |
| 261 | |
| 262 | // for Intel based platforms |
| 263 | +#ifdef MTK_FILOGIC |
| 264 | + {0, 0, "wifi0", "brlan0", 0, 0, "private_ssid_2g"}, |
| 265 | + {1, 1, "wifi1", "brlan0", 0, 1, "private_ssid_5g"}, |
| 266 | +#endif |
| 267 | }; |
| 268 | |
| 269 | static radio_interface_mapping_t l_radio_interface_map[] = { |
| 270 | @@ -331,6 +335,10 @@ static radio_interface_mapping_t l_radio_interface_map[] = { |
| 271 | { 0, 0, "radio1", "wlan0"}, |
| 272 | { 1, 1, "radio2", "wlan1"}, |
| 273 | #endif |
| 274 | +#ifdef MTK_FILOGIC |
| 275 | + { 0, 0, "radio1", "wifi0"}, |
| 276 | + { 1, 1, "radio2", "wifi1"}, |
| 277 | +#endif |
| 278 | }; |
| 279 | |
| 280 | const wifi_driver_info_t driver_info = { |
| 281 | @@ -614,7 +622,33 @@ const wifi_driver_info_t driver_info = { |
| 282 | platform_set_neighbor_report, |
| 283 | platform_get_radio_phytemperature, |
| 284 | #endif |
| 285 | - |
| 286 | +#ifdef MTK_FILOGIC |
| 287 | + "filogic", |
| 288 | + "cfg80211", |
| 289 | + {"Filogic Wireless Gateway","Filogic","Filogic","Filogic","Model Description","Model URL","267","WPS Access Point","Manufacturer URL"}, |
| 290 | + platform_pre_init, |
| 291 | + platform_post_init, |
| 292 | + platform_set_radio, |
| 293 | + platform_set_radio_pre_init, |
| 294 | + platform_pre_create_vap, |
| 295 | + platform_create_vap, |
| 296 | + platform_get_ssid_default, |
| 297 | + platform_get_keypassphrase_default, |
| 298 | + platform_get_radius_key_default, |
| 299 | + platform_get_wps_pin_default, |
| 300 | + platform_get_country_code_default, |
| 301 | + platform_wps_event, |
| 302 | + platform_flags_init, |
| 303 | + platform_get_aid, |
| 304 | + platform_free_aid, |
| 305 | + platform_sync_done, |
| 306 | + platform_update_radio_presence, |
| 307 | + platform_set_txpower, |
| 308 | + platform_get_acl_num, |
| 309 | + platform_get_vendor_oui, |
| 310 | + platform_set_neighbor_report, |
| 311 | + platform_get_radio_phytemperature, |
| 312 | +#endif |
| 313 | }; |
| 314 | |
| 315 | static struct wifiCountryEnumStrMap wifi_country_map[] = |
| 316 | diff --git a/src/wifi_hal_priv.h b/src/wifi_hal_priv.h |
| 317 | index abdfe12..a1b173b 100644 |
| 318 | --- a/src/wifi_hal_priv.h |
| 319 | +++ b/src/wifi_hal_priv.h |
| 320 | @@ -177,16 +177,16 @@ extern "C" { |
| 321 | #define MAX_CHANNEL_2G 11 |
| 322 | |
| 323 | /* 5GHz radio */ |
| 324 | -#define MIN_FREQ_MHZ_5G 5180 |
| 325 | -#define MAX_FREQ_MHZ_5G 5825 |
| 326 | +#define MIN_FREQ_MHZ_5G 4920 |
| 327 | +#define MAX_FREQ_MHZ_5G 5885 |
| 328 | #define MIN_CHANNEL_5G 36 |
| 329 | -#define MAX_CHANNEL_5G 165 |
| 330 | +#define MAX_CHANNEL_5G 177 |
| 331 | |
| 332 | /* 6GHz radio */ |
| 333 | #define MIN_FREQ_MHZ_6G 5935 |
| 334 | #define MAX_FREQ_MHZ_6G 7115 |
| 335 | #define MIN_CHANNEL_6G 1 |
| 336 | -#define MAX_CHANNEL_6G 229 |
| 337 | +#define MAX_CHANNEL_6G 233 |
| 338 | |
| 339 | #define MAX_WPS_CONN_TIMEOUT 120 |
| 340 | |
| 341 | -- |
| 342 | 2.18.0 |
| 343 | |