Skip to content

Commit

Permalink
samples: wifi: Fix nRF clock header inclusion
Browse files Browse the repository at this point in the history
The nRF clock header isn't applicable for 54H, and this was already
fixes in shell sample but not for other Wi-Fi samples:

* Few samples don't set the CPU frequency, so, remove the header
  inclusion

* For those samples that try to set the CPU frequency, fix the guards
  for header inclusion.

Signed-off-by: Chaitanya Tata <Chaitanya.Tata@nordicsemi.no>
  • Loading branch information
krish2718 authored and rlubos committed Sep 17, 2024
1 parent 5a3639b commit 3e9f9c0
Show file tree
Hide file tree
Showing 12 changed files with 10 additions and 18 deletions.
4 changes: 2 additions & 2 deletions samples/wifi/ble_coex/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
LOG_MODULE_REGISTER(coex, CONFIG_LOG_DEFAULT_LEVEL);

#include <zephyr/kernel.h>
#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
#include <nrfx_clock.h>
#endif
#include <zephyr/init.h>
Expand Down Expand Up @@ -358,7 +358,7 @@ int main(void)

net_mgmt_add_event_callback(&net_addr_mgmt_cb);

#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK, NRF_CLOCK_HFCLK_DIV_1);
#endif

Expand Down
3 changes: 0 additions & 3 deletions samples/wifi/scan/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@
LOG_MODULE_REGISTER(scan, CONFIG_LOG_DEFAULT_LEVEL);

#include <zephyr/kernel.h>
#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#include <nrfx_clock.h>
#endif
#include <stdio.h>
#include <stdlib.h>
#include <zephyr/shell/shell.h>
Expand Down
1 change: 0 additions & 1 deletion samples/wifi/shutdown/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(shutdown, CONFIG_LOG_DEFAULT_LEVEL);

#include <nrfx_clock.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion samples/wifi/sta/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(sta, CONFIG_LOG_DEFAULT_LEVEL);

#include <nrfx_clock.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
2 changes: 0 additions & 2 deletions samples/wifi/thread_coex/src/main.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(main, CONFIG_LOG_DEFAULT_LEVEL);

#include <nrfx_clock.h>

#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <zephyr/device.h>
Expand Down
4 changes: 4 additions & 0 deletions samples/wifi/thread_coex/src/ot_coex_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@

#include "ot_coex_functions.h"

#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
#include <nrfx_clock.h>
#endif

bool is_ot_device_role_client;

uint8_t ot_wait4_ping_reply_from_peer;
Expand Down
2 changes: 0 additions & 2 deletions samples/wifi/thread_coex/src/ot_coex_functions.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,6 @@
#include <zephyr/logging/log.h>
LOG_MODULE_REGISTER(ot_coex_functions, CONFIG_LOG_DEFAULT_LEVEL);

#include <nrfx_clock.h>

#include <zephyr/kernel.h>
#include <zephyr/init.h>
#include <zephyr/device.h>
Expand Down
4 changes: 2 additions & 2 deletions samples/wifi/throughput/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@

#include <zephyr/sys/printk.h>
#include <zephyr/kernel.h>
#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
#include <nrfx_clock.h>
#endif
#include <stdio.h>

int main(void)
{
#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
/* For now hardcode to 128MHz */
nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK,
NRF_CLOCK_HFCLK_DIV_1);
Expand Down
1 change: 0 additions & 1 deletion samples/wifi/twt/modules/traffic_gen/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LOG_MODULE_REGISTER(traffic_gen, CONFIG_TRAFFIC_GEN_LOG_LEVEL);
#include <zephyr/posix/sys/socket.h>
#endif

#include <nrfx_clock.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion samples/wifi/twt/modules/traffic_gen/src/tcp.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LOG_MODULE_DECLARE(traffic_gen, CONFIG_TRAFFIC_GEN_LOG_LEVEL);
#include <zephyr/posix/sys/socket.h>
#endif

#include <nrfx_clock.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
1 change: 0 additions & 1 deletion samples/wifi/twt/src/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ LOG_MODULE_REGISTER(twt, CONFIG_LOG_DEFAULT_LEVEL);
#include <zephyr/posix/sys/socket.h>
#endif

#include <nrfx_clock.h>
#include <zephyr/kernel.h>
#include <stdio.h>
#include <stdlib.h>
Expand Down
4 changes: 2 additions & 2 deletions samples/wifi/wfa_qt_app/src/qt_app_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include <zephyr/sys/printk.h>
#include <zephyr/kernel.h>
#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
#include <nrfx_clock.h>
#endif
#include <zephyr/device.h>
Expand Down Expand Up @@ -38,7 +38,7 @@ int main(void)
struct in_addr addr = {0};
struct in_addr mask;

#if defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M
#if NRFX_CLOCK_ENABLED && (defined(CLOCK_FEATURE_HFCLK_DIVIDE_PRESENT) || NRF_CLOCK_HAS_HFCLK192M)
/* For now hardcode to 128MHz */
nrfx_clock_divider_set(NRF_CLOCK_DOMAIN_HFCLK,
NRF_CLOCK_HFCLK_DIV_1);
Expand Down

0 comments on commit 3e9f9c0

Please sign in to comment.