2121#define ADC_REFERENCE ADC_REF_INTERNAL
2222#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
2323#define ADC_1ST_CHANNEL_ID 26
24+ #define COUNTER_NODE_NAME pit0
25+ #define HW_TRIGGER_INTERVAL (2U)
2426
2527#elif defined(CONFIG_BOARD_FRDM_K82F )
2628
3032#define ADC_REFERENCE ADC_REF_INTERNAL
3133#define ADC_ACQUISITION_TIME ADC_ACQ_TIME_DEFAULT
3234#define ADC_1ST_CHANNEL_ID 26
35+ #define COUNTER_NODE_NAME pit0
36+ #define HW_TRIGGER_INTERVAL (2U)
3337
3438#endif
3539
36- #define HW_TRIGGER_INTERVAL (2U)
3740/* for DMA HW trigger interval need large than HW trigger interval*/
3841#define SAMPLE_INTERVAL_US (10000U)
3942
4043#define BUFFER_SIZE 24
44+ #ifndef ALIGNMENT
4145#define ALIGNMENT DMA_BUF_ADDR_ALIGNMENT(DT_NODELABEL(test_dma))
46+ #endif
47+
4248static ZTEST_BMEM __aligned (ALIGNMENT ) int16_t m_sample_buffer [BUFFER_SIZE ];
4349static ZTEST_BMEM __aligned (ALIGNMENT ) int16_t m_sample_buffer2 [2 ][BUFFER_SIZE ];
4450static int current_buf_inx ;
@@ -78,6 +84,7 @@ const struct device *get_adc_device(void)
7884
7985const struct device * get_count_device (void )
8086{
87+ #if defined(COUNTER_NODE_NAME )
8188 const struct device * const dev = DEVICE_DT_GET (DT_NODELABEL (pit0 ));
8289
8390 if (!device_is_ready (dev )) {
@@ -86,12 +93,16 @@ const struct device *get_count_device(void)
8693 }
8794
8895 return dev ;
96+ #else
97+ return NULL ;
98+ #endif
8999}
90100
91- static void init_pit (void )
101+ #if defined(COUNTER_NODE_NAME )
102+ static void init_counter (void )
92103{
93104 int err ;
94- const struct device * const dev = DEVICE_DT_GET (DT_NODELABEL (pit0 ));
105+ const struct device * const dev = DEVICE_DT_GET (DT_NODELABEL (COUNTER_NODE_NAME ));
95106 struct counter_top_cfg top_cfg = { .callback = NULL ,
96107 .user_data = NULL ,
97108 .flags = 0 };
@@ -104,6 +115,7 @@ static void init_pit(void)
104115 zassert_equal (0 , err , "%s: Counter failed to set top value (err: %d)" ,
105116 dev -> name , err );
106117}
118+ #endif
107119
108120static const struct device * init_adc (void )
109121{
@@ -126,7 +138,9 @@ static const struct device *init_adc(void)
126138
127139 (void )memset (m_sample_buffer , 0 , sizeof (m_sample_buffer ));
128140
129- init_pit ();
141+ #if defined(COUNTER_NODE_NAME )
142+ init_counter ();
143+ #endif
130144
131145 return adc_dev ;
132146}
@@ -245,7 +259,7 @@ static int test_task_asynchronous_call(void)
245259 const struct adc_sequence_options options = {
246260 .extra_samplings = 4 ,
247261 /* Start consecutive samplings as fast as possible. */
248- .interval_us = HW_TRIGGER_INTERVAL ,
262+ .interval_us = 0 ,
249263 };
250264 const struct adc_sequence sequence = {
251265 .options = & options ,
0 commit comments