@@ -19,6 +19,7 @@ struct test_clk_ctx {
1919 size_t clk_specs_size ;
2020};
2121
22+ #if defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP )
2223const struct nrf_clock_spec test_clk_specs_hsfll [] = {
2324 {
2425 .frequency = MHZ (128 ),
@@ -37,6 +38,15 @@ const struct nrf_clock_spec test_clk_specs_hsfll[] = {
3738 },
3839};
3940
41+ static const struct test_clk_ctx hsfll_test_clk_ctx [] = {
42+ {
43+ .clk_dev = DEVICE_DT_GET (DT_NODELABEL (cpuapp_hsfll )),
44+ .clk_specs = test_clk_specs_hsfll ,
45+ .clk_specs_size = ARRAY_SIZE (test_clk_specs_hsfll ),
46+ },
47+ };
48+ #endif /* CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP */
49+
4050const struct nrf_clock_spec test_clk_specs_global_hsfll [] = {
4151 {
4252 .frequency = MHZ (320 ),
@@ -86,14 +96,6 @@ static const struct test_clk_ctx fll16m_test_clk_ctx[] = {
8696 },
8797};
8898
89- static const struct test_clk_ctx hsfll_test_clk_ctx [] = {
90- {
91- .clk_dev = DEVICE_DT_GET (DT_NODELABEL (cpuapp_hsfll )),
92- .clk_specs = test_clk_specs_hsfll ,
93- .clk_specs_size = ARRAY_SIZE (test_clk_specs_hsfll ),
94- },
95- };
96-
9799const struct nrf_clock_spec test_clk_specs_lfclk [] = {
98100 {
99101 .frequency = 32768 ,
@@ -120,6 +122,7 @@ static const struct test_clk_ctx lfclk_test_clk_ctx[] = {
120122 },
121123};
122124
125+ #if defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP )
123126const struct nrf_clock_spec test_clk_specs_hfxo [] = {
124127 {
125128 .frequency = MHZ (32 ),
@@ -135,6 +138,7 @@ static const struct test_clk_ctx hfxo_test_clk_ctx[] = {
135138 .clk_specs_size = ARRAY_SIZE (test_clk_specs_hfxo ),
136139 },
137140};
141+ #endif /* CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP */
138142
139143static void test_request_release_clock_spec (const struct device * clk_dev ,
140144 const struct nrf_clock_spec * clk_spec )
@@ -190,6 +194,7 @@ static void test_clock_control_request(const struct test_clk_ctx *clk_contexts,
190194 }
191195}
192196
197+ #if defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP )
193198static void test_auxpll_control (const struct device * clk_dev )
194199{
195200 int err ;
@@ -207,20 +212,34 @@ static void test_auxpll_control(const struct device *clk_dev)
207212 __ASSERT_NO_MSG (clk_status == CLOCK_CONTROL_STATUS_OFF );
208213 k_msleep (1000 );
209214}
215+ #endif /* CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP */
216+
217+ void run_tests (void )
218+ {
219+ #if defined(CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP )
220+ test_auxpll_control (DEVICE_DT_GET (DT_NODELABEL (canpll )));
221+ test_clock_control_request (hfxo_test_clk_ctx , ARRAY_SIZE (hfxo_test_clk_ctx ));
222+ test_clock_control_request (hsfll_test_clk_ctx , ARRAY_SIZE (hsfll_test_clk_ctx ));
223+ #endif /* CONFIG_BOARD_NRF54H20DK_NRF54H20_CPUAPP */
224+ test_clock_control_request (global_hsfll_test_clk_ctx ,
225+ ARRAY_SIZE (global_hsfll_test_clk_ctx ));
226+ test_clock_control_request (fll16m_test_clk_ctx , ARRAY_SIZE (fll16m_test_clk_ctx ));
227+ test_clock_control_request (lfclk_test_clk_ctx , ARRAY_SIZE (lfclk_test_clk_ctx ));
228+ }
210229
211230int main (void )
212231{
213232 LOG_INF ("Idle clock_control, %s" , CONFIG_BOARD_TARGET );
214233 k_msleep (100 );
234+ #if defined(CONFIG_COVERAGE )
235+ printk ("Start testing\n" );
236+ run_tests ();
237+ printk ("Testing done\n" );
238+ #else
215239 while (1 ) {
216- test_auxpll_control (DEVICE_DT_GET (DT_NODELABEL (canpll )));
217- test_clock_control_request (hfxo_test_clk_ctx , ARRAY_SIZE (hfxo_test_clk_ctx ));
218- test_clock_control_request (hsfll_test_clk_ctx , ARRAY_SIZE (hsfll_test_clk_ctx ));
219- test_clock_control_request (global_hsfll_test_clk_ctx ,
220- ARRAY_SIZE (hsfll_test_clk_ctx ));
221- test_clock_control_request (fll16m_test_clk_ctx , ARRAY_SIZE (fll16m_test_clk_ctx ));
222- test_clock_control_request (lfclk_test_clk_ctx , ARRAY_SIZE (lfclk_test_clk_ctx ));
240+ run_tests ();
223241 }
242+ #endif /* CONFIG_COVERAGE */
224243
225244 return 0 ;
226245}
0 commit comments