Skip to content

Commit 9d314fa

Browse files
heinwesselscarlescufi
authored andcommitted
tests: drivers: adc_dma: remove test userspace
These test uses DMA which sometimes require buffers to be placed in custom specific section. This is not compatible with ztest userspace, which requires variables to be placed in a specific partition. Signed-off-by: Hein Wessels <[email protected]>
1 parent 6e21ebf commit 9d314fa

File tree

3 files changed

+11
-52
lines changed

3 files changed

+11
-52
lines changed

tests/drivers/adc/adc_dma/prj.conf

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,4 @@ CONFIG_ZTEST_NEW_API=y
33

44
CONFIG_ADC=y
55
CONFIG_ADC_LOG_LEVEL_INF=y
6-
CONFIG_HEAP_MEM_POOL_SIZE=1024
7-
CONFIG_TEST_USERSPACE=y
86
CONFIG_DMA=y

tests/drivers/adc/adc_dma/src/main.c

Lines changed: 1 addition & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,4 @@
88
#include <zephyr/kernel.h>
99
#include <zephyr/ztest.h>
1010

11-
extern const struct device *get_adc_device(void);
12-
extern const struct device *get_count_device(void);
13-
extern struct k_poll_signal async_sig;
14-
15-
void *adc_dma_setup(void)
16-
{
17-
k_object_access_grant(get_adc_device(), k_current_get());
18-
k_object_access_grant(get_count_device(), k_current_get());
19-
#ifdef CONFIG_ADC_ASYNC
20-
k_object_access_grant(&async_sig, k_current_get());
21-
k_poll_signal_init(&async_sig);
22-
k_thread_system_pool_assign(k_current_get());
23-
#endif
24-
25-
return NULL;
26-
}
27-
28-
ZTEST_SUITE(adc_dma, NULL, adc_dma_setup, NULL, NULL, NULL);
11+
ZTEST_SUITE(adc_dma, NULL, NULL, NULL, NULL, NULL);

tests/drivers/adc/adc_dma/src/test_adc.c

Lines changed: 10 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,14 @@
4545
#define ALIGNMENT DMA_BUF_ADDR_ALIGNMENT(DT_NODELABEL(test_dma))
4646
#endif
4747

48-
static ZTEST_BMEM __aligned(ALIGNMENT) int16_t m_sample_buffer[BUFFER_SIZE];
49-
static ZTEST_BMEM __aligned(ALIGNMENT) int16_t m_sample_buffer2[2][BUFFER_SIZE];
48+
static __aligned(ALIGNMENT) int16_t m_sample_buffer[BUFFER_SIZE];
49+
static __aligned(ALIGNMENT) int16_t m_sample_buffer2[2][BUFFER_SIZE];
5050
static int current_buf_inx;
5151

52+
#if defined(CONFIG_ADC_ASYNC)
53+
static struct k_poll_signal async_sig;
54+
#endif
55+
5256
static const struct adc_channel_cfg m_1st_channel_cfg = {
5357
.gain = ADC_GAIN,
5458
.reference = ADC_REFERENCE,
@@ -70,34 +74,6 @@ static const struct adc_channel_cfg m_2nd_channel_cfg = {
7074
};
7175
#endif /* defined(ADC_2ND_CHANNEL_ID) */
7276

73-
const struct device *get_adc_device(void)
74-
{
75-
const struct device *const dev = DEVICE_DT_GET(ADC_DEVICE_NODE);
76-
77-
if (!device_is_ready(dev)) {
78-
printk("ADC device is not ready\n");
79-
return NULL;
80-
}
81-
82-
return dev;
83-
}
84-
85-
const struct device *get_count_device(void)
86-
{
87-
#if defined(COUNTER_NODE_NAME)
88-
const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(pit0));
89-
90-
if (!device_is_ready(dev)) {
91-
printk("count device is not ready\n");
92-
return NULL;
93-
}
94-
95-
return dev;
96-
#else
97-
return NULL;
98-
#endif
99-
}
100-
10177
#if defined(COUNTER_NODE_NAME)
10278
static void init_counter(void)
10379
{
@@ -138,6 +114,10 @@ static const struct device *init_adc(void)
138114

139115
(void)memset(m_sample_buffer, 0, sizeof(m_sample_buffer));
140116

117+
#if defined(CONFIG_ADC_ASYNC)
118+
k_poll_signal_init(&async_sig);
119+
#endif
120+
141121
#if defined(COUNTER_NODE_NAME)
142122
init_counter();
143123
#endif
@@ -251,8 +231,6 @@ ZTEST_USER(adc_dma, test_adc_sample_two_channels)
251231
* test_adc_asynchronous_call
252232
*/
253233
#if defined(CONFIG_ADC_ASYNC)
254-
struct k_poll_signal async_sig;
255-
256234
static int test_task_asynchronous_call(void)
257235
{
258236
int ret;

0 commit comments

Comments
 (0)