99#include <zephyr/drivers/gpio.h>
1010#include <zephyr/drivers/counter.h>
1111#include <zephyr/logging/log.h>
12- #include <zephyr/devicetree/clocks.h>
13- #include <zephyr/drivers/clock_control/nrf_clock_control.h>
1412
1513LOG_MODULE_REGISTER (idle_counter );
1614
@@ -26,33 +24,6 @@ const struct device *const counter_dev = DEVICE_DT_GET(DT_ALIAS(counter));
2624
2725static K_SEM_DEFINE (my_sem , 0 , 1 ) ;
2826
29- const uint32_t freq [] = {320 , 256 , 128 , 64 };
30-
31- #if defined(CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING )
32- /*
33- * Set Global Domain frequency (HSFLL120)
34- */
35- void set_global_domain_frequency (uint32_t freq )
36- {
37- int err ;
38- int res ;
39- struct onoff_client cli ;
40- const struct device * hsfll_dev = DEVICE_DT_GET (DT_NODELABEL (hsfll120 ));
41- const struct nrf_clock_spec clk_spec_global_hsfll = {.frequency = MHZ (freq )};
42-
43- LOG_INF ("Requested frequency [Hz]: %d" , clk_spec_global_hsfll .frequency );
44- sys_notify_init_spinwait (& cli .notify );
45- err = nrf_clock_control_request (hsfll_dev , & clk_spec_global_hsfll , & cli );
46- __ASSERT ((err >= 0 && err < 3 ), "Wrong nrf_clock_control_request return code" );
47- do {
48- err = sys_notify_fetch_result (& cli .notify , & res );
49- k_yield ();
50- } while (err == - EAGAIN );
51- __ASSERT (err == 0 , "Wrong clock control request return code" );
52- __ASSERT (res == 0 , "Wrong clock control request response" );
53- }
54- #endif /* CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING */
55-
5627void counter_handler (const struct device * counter_dev , uint8_t chan_id , uint32_t ticks ,
5728 void * user_data )
5829{
@@ -148,16 +119,9 @@ int main(void)
148119
149120 while (1 ) {
150121 sleep_with_state_indication (CONFIG_TEST_SLEEP_DURATION_MS );
151- for (int i = 0 ; i < ARRAY_SIZE (freq ); i ++ ) {
152- start_time = start_timer (counter_dev );
153- k_msleep (100 );
154- #if defined(CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING )
155- sleep_with_state_indication (CONFIG_TEST_SLEEP_DURATION_MS / 2 - 100 );
156- set_global_domain_frequency (freq [(i + 1 ) % ARRAY_SIZE (freq )]);
157- k_msleep (10 );
158- #endif /* CONFIG_GLOBAL_DOMAIN_CLOCK_FREQUENCY_SWITCHING */
159- verify_timer (start_time );
160- }
122+ start_time = start_timer (counter_dev );
123+ k_msleep (100 );
124+ verify_timer (start_time );
161125 ret = gpio_pin_set_dt (& led , 1 );
162126 __ASSERT (ret == 0 , "Unable to turn on LED" );
163127 k_msleep (100 );
0 commit comments