Zephyr Project API 3.7.0
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
test_shared_irq.h
Go to the documentation of this file.
1/*
2 * Copyright 2023 NXP
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6
7#ifndef __TEST_SHARED_IRQ_H__
8#define __TEST_SHARED_IRQ_H__
9
10#include <zephyr/ztest.h>
12
13#define IRQ_PRIORITY 1
14#define TEST_VECTOR_SIZE 10
15#define TEST_INVALID_IDX 0xcafebabe
16#define TEST_DUMMY_ISR_VAL 0xdeadbeef
17#define TEST_INVALID_IRQ 0xcafebabe
18
19#define ISR_DEFINE(name) \
20static inline void name(const void *data) \
21{ \
22 int idx = POINTER_TO_INT(data); \
23 test_vector[idx] = result_vector[idx]; \
24} \
25
28
30 0xdeadbeef,
31 0xcafebabe,
32 0x1234cafe,
33};
34
38
39static inline bool client_exists_at_index(void (*routine)(const void *arg),
40 void *arg, int irq, size_t idx)
41{
42 size_t i;
43 struct z_shared_isr_table_entry *shared_entry;
44 struct _isr_table_entry *client;
45
46 shared_entry = &z_shared_sw_isr_table[irq];
47
48 if (idx == TEST_INVALID_IDX) {
49 for (i = 0; i < shared_entry->client_num; i++) {
50 client = &shared_entry->clients[i];
51
52 if (client->isr == routine && client->arg == arg) {
53 return true;
54 }
55 }
56 } else {
57 if (shared_entry->client_num <= idx) {
58 return false;
59 }
60
61 client = &shared_entry->clients[idx];
62
63 return client->isr == routine && client->arg == arg;
64 }
65
66 return false;
67}
68
69#endif /* __TEST_SHARED_IRQ_H__ */
__UINT32_TYPE__ uint32_t
Definition stdint.h:90
static void test_isr_0(const void *data)
Definition test_shared_irq.h:35
#define TEST_INVALID_IDX
Definition test_shared_irq.h:15
#define TEST_VECTOR_SIZE
Definition test_shared_irq.h:14
static uint32_t result_vector[10]
Definition test_shared_irq.h:29
static bool client_exists_at_index(void(*routine)(const void *arg), void *arg, int irq, size_t idx)
Definition test_shared_irq.h:39
static uint32_t test_vector[10]
Definition test_shared_irq.h:26
static void test_isr_2(const void *data)
Definition test_shared_irq.h:37
#define ISR_DEFINE(name)
Definition test_shared_irq.h:19
static void test_isr_1(const void *data)
Definition test_shared_irq.h:36
Zephyr Testsuite.