tests: Apply IRQ offload API change

Switching to constant parameter.

Fixes #27399

Signed-off-by: Tomasz Bursztyka <tomasz.bursztyka@linux.intel.com>
This commit is contained in:
Tomasz Bursztyka 2020-07-10 11:39:36 +02:00 committed by Carles Cufí
commit 4b9134d8d2
31 changed files with 121 additions and 120 deletions

View file

@ -33,7 +33,7 @@ static uint32_t timestamp_end;
*
* @return N/A
*/
static void latency_test_isr(void *unused)
static void latency_test_isr(const void *unused)
{
ARG_UNUSED(unused);

View file

@ -39,7 +39,7 @@ K_SEM_DEFINE(WORKSEMA, 0, 1);
*
* @return N/A
*/
static void latency_test_isr(void *unused)
static void latency_test_isr(const void *unused)
{
ARG_UNUSED(unused);

View file

@ -21,7 +21,7 @@
/* Implemented as a software interrupt so that callbacks are executed
* in the expected context
*/
static void ipm_dummy_isr(void *data)
static void ipm_dummy_isr(const void *data)
{
const struct device *d = (const struct device *)data;
struct ipm_dummy_driver_data *driver_data = d->data;
@ -70,7 +70,7 @@ static int ipm_dummy_send(const struct device *d, int wait, uint32_t id,
driver_data->regs.id = id;
driver_data->regs.busy = 1U;
irq_offload(ipm_dummy_isr, d);
irq_offload(ipm_dummy_isr, (const void *)d);
if (wait) {
while (driver_data->regs.busy) {
@ -98,7 +98,7 @@ static int ipm_dummy_set_enabled(const struct device *d, int enable)
driver_data->regs.enabled = enable;
if (enable) {
/* In case there are pending messages */
irq_offload(ipm_dummy_isr, d);
irq_offload(ipm_dummy_isr, (const void *)d);
}
return 0;
}

View file

@ -20,7 +20,7 @@
volatile uint32_t sentinel;
#define SENTINEL_VALUE 0xDEADBEEF
static void offload_function(void *param)
static void offload_function(const void *param)
{
uint32_t x = POINTER_TO_INT(param);
@ -55,8 +55,8 @@ void test_irq_offload(void)
arch_irq_unlock(key1);
/**TESTPOINT: Offload to IRQ context*/
irq_offload(offload_function, (void *)SENTINEL_VALUE);
irq_offload(offload_function, (const void *)SENTINEL_VALUE);
zassert_equal(sentinel, SENTINEL_VALUE,
"irq_offload() didn't work properly");
"irq_offload() didn't work properly");
}

View file

@ -137,7 +137,7 @@ static ISR_INFO isr_info;
*
* @return N/A
*/
static void isr_handler(void *data)
static void isr_handler(const void *data)
{
ARG_UNUSED(data);

View file

@ -66,13 +66,13 @@ static void tfifo_get(struct k_fifo *pfifo)
}
/*entry of contexts*/
static void tIsr_entry_put(void *p)
static void tIsr_entry_put(const void *p)
{
tfifo_put((struct k_fifo *)p);
zassert_false(k_fifo_is_empty((struct k_fifo *)p), NULL);
}
static void tIsr_entry_get(void *p)
static void tIsr_entry_get(const void *p)
{
tfifo_get((struct k_fifo *)p);
zassert_true(k_fifo_is_empty((struct k_fifo *)p), NULL);
@ -100,7 +100,7 @@ static void tfifo_thread_isr(struct k_fifo *pfifo)
{
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: isr-thread data passing via fifo*/
irq_offload(tIsr_entry_put, pfifo);
irq_offload(tIsr_entry_put, (const void *)pfifo);
tfifo_get(pfifo);
}
@ -109,7 +109,7 @@ static void tfifo_isr_thread(struct k_fifo *pfifo)
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: thread-isr data passing via fifo*/
tfifo_put(pfifo);
irq_offload(tIsr_entry_get, pfifo);
irq_offload(tIsr_entry_get, (const void *)pfifo);
}
static void tfifo_is_empty(void *p)
@ -194,7 +194,7 @@ void test_fifo_is_empty_isr(void)
{
k_fifo_init(&fifo);
/**TESTPOINT: check fifo is empty from isr*/
irq_offload(tfifo_is_empty, &fifo);
irq_offload((irq_offload_routine_t)tfifo_is_empty, &fifo);
}
/**
* @}

View file

@ -37,7 +37,7 @@ static void tfifo_get(struct k_fifo *pfifo)
}
/*entry of contexts*/
static void tIsr_entry(void *p)
static void tIsr_entry(const void *p)
{
TC_PRINT("isr fifo get\n");
tfifo_get((struct k_fifo *)p);

View file

@ -56,7 +56,7 @@ static struct k_thread tdata;
static struct k_sem end_sema;
/*entry of contexts*/
static void tIsr_entry_put(void *p)
static void tIsr_entry_put(const void *p)
{
uint32_t i;
@ -67,7 +67,7 @@ static void tIsr_entry_put(void *p)
zassert_false(k_fifo_is_empty((struct k_fifo *)p), NULL);
}
static void tIsr_entry_get(void *p)
static void tIsr_entry_get(const void *p)
{
void *rx_data;
uint32_t i;
@ -118,10 +118,10 @@ static void thread_entry_fn_dual(void *p1, void *p2, void *p3)
static void thread_entry_fn_isr(void *p1, void *p2, void *p3)
{
/* Get items from fifo2 */
irq_offload(tIsr_entry_get, p2);
irq_offload(tIsr_entry_get, (const void *)p2);
/* Put items into fifo1 */
irq_offload(tIsr_entry_put, p1);
irq_offload(tIsr_entry_put, (const void *)p1);
/* Give control back to Test thread */
k_sem_give(&end_sema);
@ -223,13 +223,13 @@ static void test_isr_fifo_play(void)
/* Put item into fifo */
irq_offload(tIsr_entry_put, &fifo2);
irq_offload(tIsr_entry_put, (const void *)&fifo2);
/* Let the child thread run */
k_sem_take(&end_sema, K_FOREVER);
/* Get item from fifo */
irq_offload(tIsr_entry_get, &fifo1);
irq_offload(tIsr_entry_get, (const void *)&fifo1);
/* Clear the spawn thread to avoid side effect */
k_thread_abort(tid);

View file

@ -39,12 +39,12 @@ static void tlifo_get(struct k_lifo *plifo)
}
/*entry of contexts*/
static void tIsr_entry_put(void *p)
static void tIsr_entry_put(const void *p)
{
tlifo_put((struct k_lifo *)p);
}
static void tIsr_entry_get(void *p)
static void tIsr_entry_get(const void *p)
{
tlifo_get((struct k_lifo *)p);
}
@ -71,7 +71,7 @@ static void tlifo_thread_isr(struct k_lifo *plifo)
{
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: thread-isr data passing via lifo*/
irq_offload(tIsr_entry_put, plifo);
irq_offload(tIsr_entry_put, (const void *)plifo);
tlifo_get(plifo);
}
@ -80,7 +80,7 @@ static void tlifo_isr_thread(struct k_lifo *plifo)
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: isr-thread data passing via lifo*/
tlifo_put(plifo);
irq_offload(tIsr_entry_get, plifo);
irq_offload(tIsr_entry_get, (const void *)plifo);
}
/**

View file

@ -37,7 +37,7 @@ static void tlifo_get(struct k_lifo *plifo)
}
/*entry of contexts*/
static void tIsr_entry(void *p)
static void tIsr_entry(const void *p)
{
TC_PRINT("isr lifo get\n");
tlifo_get((struct k_lifo *)p);
@ -66,7 +66,7 @@ static void tlifo_read_write(struct k_lifo *plifo)
TC_PRINT("main lifo put ---> ");
tlifo_put(plifo);
irq_offload(tIsr_entry, plifo);
irq_offload(tIsr_entry, (const void *)plifo);
k_sem_take(&end_sema, K_FOREVER);
k_sem_take(&end_sema, K_FOREVER);

View file

@ -15,6 +15,6 @@
#define BLK_NUM_MAX 2
#define BLK_ALIGN BLK_SIZE_MIN
extern void tmpool_alloc_free(void *data);
extern void tmpool_alloc_free(const void *data);
#endif /*__TEST_MPOOL_H__*/

View file

@ -12,7 +12,7 @@
/** TESTPOINT: Statically define and initialize a memory pool*/
K_MEM_POOL_DEFINE(kmpool, BLK_SIZE_MIN, BLK_SIZE_MAX, BLK_NUM_MAX, BLK_ALIGN);
void tmpool_alloc_free(void *data)
void tmpool_alloc_free(const void *data)
{
ARG_UNUSED(data);
static struct k_mem_block block[BLK_NUM_MIN];

View file

@ -49,14 +49,14 @@ struct k_thread multiple_wake_tid[TOTAL_THREADS_WAITING];
/******************************************************************************/
/* Helper functions */
void futex_isr_wake(void *futex)
void futex_isr_wake(const void *futex)
{
k_futex_wake((struct k_futex *)futex, false);
}
void futex_wake_from_isr(struct k_futex *futex)
{
irq_offload(futex_isr_wake, futex);
irq_offload(futex_isr_wake, (const void *)futex);
}
/* test futex wait, no futex wake */

View file

@ -33,24 +33,24 @@ struct k_thread multiple_tid[TOTAL_THREADS_WAITING];
/******************************************************************************/
/* Helper functions */
void isr_sem_give(void *semaphore)
void isr_sem_give(const void *semaphore)
{
sys_sem_give((struct sys_sem *)semaphore);
}
void isr_sem_take(void *semaphore)
void isr_sem_take(const void *semaphore)
{
sys_sem_take((struct sys_sem *)semaphore, K_NO_WAIT);
}
void sem_give_from_isr(void *semaphore)
{
irq_offload(isr_sem_give, semaphore);
irq_offload(isr_sem_give, (const void *)semaphore);
}
void sem_take_from_isr(void *semaphore)
{
irq_offload(isr_sem_take, semaphore);
irq_offload(isr_sem_take, (const void *)semaphore);
}
void sem_give_task(void *p1, void *p2, void *p3)

View file

@ -79,7 +79,7 @@ static void purge_msgq(struct k_msgq *pmsgq)
zassert_equal(k_msgq_peek(pmsgq, &read_data), -ENOMSG, NULL);
}
static void tisr_entry(void *p)
static void tisr_entry(const void *p)
{
put_msgq((struct k_msgq *)p);
}
@ -150,7 +150,7 @@ static void msgq_thread_overflow(struct k_msgq *pmsgq)
static void msgq_isr(struct k_msgq *pmsgq)
{
/**TESTPOINT: thread-isr data passing via message queue*/
irq_offload(tisr_entry, pmsgq);
irq_offload(tisr_entry, (const void *)pmsgq);
get_msgq(pmsgq);
/**TESTPOINT: msgq purge*/

View file

@ -89,12 +89,12 @@ static void tqueue_get(struct k_queue *pqueue)
}
/*entry of contexts*/
static void tIsr_entry_append(void *p)
static void tIsr_entry_append(const void *p)
{
tqueue_append((struct k_queue *)p);
}
static void tIsr_entry_get(void *p)
static void tIsr_entry_get(const void *p)
{
tqueue_get((struct k_queue *)p);
}
@ -121,7 +121,7 @@ static void tqueue_thread_isr(struct k_queue *pqueue)
{
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: thread-isr data passing via queue*/
irq_offload(tIsr_entry_append, pqueue);
irq_offload(tIsr_entry_append, (const void *)pqueue);
tqueue_get(pqueue);
}
@ -130,7 +130,7 @@ static void tqueue_isr_thread(struct k_queue *pqueue)
k_sem_init(&end_sema, 0, 1);
/**TESTPOINT: isr-thread data passing via queue*/
tqueue_append(pqueue);
irq_offload(tIsr_entry_get, pqueue);
irq_offload(tIsr_entry_get, (const void *)pqueue);
}
/*test cases*/

View file

@ -65,7 +65,7 @@ static void tqueue_find_and_remove(struct k_queue *pqueue)
}
/*entry of contexts*/
static void tIsr_entry(void *p)
static void tIsr_entry(const void *p)
{
TC_PRINT("isr queue find and remove\n");
tqueue_find_and_remove((struct k_queue *)p);
@ -98,7 +98,7 @@ static void tqueue_read_write(struct k_queue *pqueue)
TC_PRINT("main queue append ---> ");
tqueue_append(pqueue);
irq_offload(tIsr_entry, pqueue);
irq_offload(tIsr_entry, (const void *)pqueue);
k_sem_take(&end_sema, K_FOREVER);
k_sem_take(&end_sema, K_FOREVER);

View file

@ -161,7 +161,7 @@ void manager(void *p1, void *p2, void *p3)
k_sem_give(&main_sem);
}
void irq_waker(void *p)
void irq_waker(const void *p)
{
ARG_UNUSED(p);
k_sem_give(&worker_sems[target]);

View file

@ -12,7 +12,7 @@
static struct k_thread tdata;
static struct k_sem end_sema;
static void tIsr(void *data)
static void tIsr(const void *data)
{
/** TESTPOINT: The code is running at ISR.*/
zassert_false(k_is_preempt_thread(), NULL);

View file

@ -11,8 +11,8 @@
#define SEM_INIT_VAL (0U)
#define SEM_MAX_VAL (10U)
#define sem_give_from_isr(sema) irq_offload(isr_sem_give, sema)
#define sem_take_from_isr(sema) irq_offload(isr_sem_take, sema)
#define sem_give_from_isr(sema) irq_offload(isr_sem_give, (const void *)sema)
#define sem_take_from_isr(sema) irq_offload(isr_sem_take, (const void *)sema)
#define SEM_TIMEOUT (K_MSEC(100))
#define STACK_SIZE (512 + CONFIG_TEST_EXTRA_STACKSIZE)
@ -61,7 +61,7 @@ void sem_give_task(void *p1, void *p2, void *p3)
k_sem_give((struct k_sem *)p1);
}
void isr_sem_give(void *semaphore)
void isr_sem_give(const void *semaphore)
{
k_sem_give((struct k_sem *)semaphore);
}
@ -83,12 +83,12 @@ static void tsema_thread_thread(struct k_sem *psem)
static void tsema_thread_isr(struct k_sem *psem)
{
/**TESTPOINT: thread-isr sync via sema*/
irq_offload(isr_sem_give, psem);
irq_offload(isr_sem_give, (const void *)psem);
zassert_false(k_sem_take(psem, K_FOREVER), NULL);
}
void isr_sem_take(void *semaphore)
void isr_sem_take(const void *semaphore)
{
k_sem_take((struct k_sem *)semaphore, K_NO_WAIT);
}

View file

@ -167,7 +167,7 @@ static void test_thread(int arg1, int arg2)
test_failure = false;
}
static void irq_offload_isr(void *arg)
static void irq_offload_isr(const void *arg)
{
k_wakeup((k_tid_t) arg);
@ -181,7 +181,7 @@ static void helper_thread(int arg1, int arg2)
k_wakeup(test_thread_id);
k_sem_take(&helper_thread_sem, K_FOREVER);
/* Wake the test thread from an ISR */
irq_offload(irq_offload_isr, (void *)test_thread_id);
irq_offload(irq_offload_isr, (const void *)test_thread_id);
}
/**

View file

@ -92,7 +92,7 @@ dummy_test(test_stack_user_pop_fail);
#endif /* CONFIG_USERSPACE */
/* entry of contexts */
static void tIsr_entry_push(void *p)
static void tIsr_entry_push(const void *p)
{
uint32_t i;
@ -102,7 +102,7 @@ static void tIsr_entry_push(void *p)
}
}
static void tIsr_entry_pop(void *p)
static void tIsr_entry_pop(const void *p)
{
uint32_t i;
@ -157,12 +157,12 @@ static void thread_entry_fn_dual(void *p1, void *p2, void *p3)
static void thread_entry_fn_isr(void *p1, void *p2, void *p3)
{
/* Pop items from stack2 */
irq_offload(tIsr_entry_pop, p2);
irq_offload(tIsr_entry_pop, (const void *)p2);
zassert_false(memcmp(data_isr, data2, STACK_LEN),
"Push & Pop items does not match");
/* Push items to stack1 */
irq_offload(tIsr_entry_push, p1);
irq_offload(tIsr_entry_push, (const void *)p1);
/* Give control back to Test thread */
k_sem_give(&end_sema);
@ -255,13 +255,13 @@ static void test_isr_stack_play(void)
/* Push items to stack2 */
irq_offload(tIsr_entry_push, &stack2);
irq_offload(tIsr_entry_push, (const void *)&stack2);
/* Let the child thread run */
k_sem_take(&end_sema, K_FOREVER);
/* Pop items from stack1 */
irq_offload(tIsr_entry_pop, &stack1);
irq_offload(tIsr_entry_pop, (const void *)&stack1);
zassert_false(memcmp(data_isr, data1, STACK_LEN),
"Push & Pop items does not match");

View file

@ -39,12 +39,12 @@ static void tstack_pop(struct k_stack *pstack)
}
/*entry of contexts*/
static void tIsr_entry_push(void *p)
static void tIsr_entry_push(const void *p)
{
tstack_push((struct k_stack *)p);
}
static void tIsr_entry_pop(void *p)
static void tIsr_entry_pop(const void *p)
{
tstack_pop((struct k_stack *)p);
}
@ -79,11 +79,11 @@ static void tstack_thread_isr(struct k_stack *pstack)
{
k_sem_init(&end_sema1, 0, 1);
/**TESTPOINT: thread-isr data passing via stack*/
irq_offload(tIsr_entry_push, pstack);
irq_offload(tIsr_entry_push, (const void *)pstack);
tstack_pop(pstack);
tstack_push(pstack);
irq_offload(tIsr_entry_pop, pstack);
irq_offload(tIsr_entry_pop, (const void *)pstack);
}
/**

View file

@ -317,9 +317,9 @@ void control_entry(void *p1, void *p2, void *p3)
k_thread_abort(&join_thread);
}
void do_join_from_isr(void *arg)
void do_join_from_isr(const void *arg)
{
int *ret = arg;
int *ret = (int *)arg;
printk("isr: joining join_thread\n");
*ret = k_thread_join(&join_thread, K_NO_WAIT);
@ -365,7 +365,7 @@ int join_scenario(enum control_method m)
}
if (m == ISR_ALREADY_EXIT || m == ISR_RUNNING) {
irq_offload(do_join_from_isr, &ret);
irq_offload(do_join_from_isr, (const void *)&ret);
} else {
printk("ztest_thread: joining join_thread\n");
ret = k_thread_join(&join_thread, timeout);

View file

@ -195,9 +195,9 @@ void test_delayed_thread_abort(void)
static volatile bool isr_finished;
static void offload_func(void *param)
static void offload_func(const void *param)
{
struct k_thread *t = param;
struct k_thread *t = (struct k_thread *)param;
k_thread_abort(t);

View file

@ -235,7 +235,7 @@ static void twork_submit_1(struct k_work_q *work_q, struct k_work *w,
}
}
static void twork_submit(void *data)
static void twork_submit(const void *data)
{
struct k_work_q *work_q = (struct k_work_q *)data;
@ -322,7 +322,7 @@ static void tdelayed_work_submit_1(struct k_work_q *work_q,
zassert_true(k_work_pending((struct k_work *)w) == 0, NULL);
}
static void tdelayed_work_submit(void *data)
static void tdelayed_work_submit(const void *data)
{
struct k_work_q *work_q = (struct k_work_q *)data;
@ -331,7 +331,7 @@ static void tdelayed_work_submit(void *data)
}
}
static void tdelayed_work_cancel(void *data)
static void tdelayed_work_cancel(const void *data)
{
struct k_work_q *work_q = (struct k_work_q *)data;
int ret;
@ -392,7 +392,7 @@ static void tdelayed_work_cancel(void *data)
/*work items not cancelled: delayed_work[1], delayed_work_sleepy*/
}
static void ttriggered_work_submit(void *data)
static void ttriggered_work_submit(const void *data)
{
struct k_work_q *work_q = (struct k_work_q *)data;
@ -442,7 +442,7 @@ static void ttriggered_work_submit(void *data)
}
}
static void ttriggered_work_cancel(void *data)
static void ttriggered_work_cancel(const void *data)
{
struct k_work_q *work_q = (struct k_work_q *)data;
int ret;
@ -660,7 +660,7 @@ void test_work_resubmit_to_queue(void)
void test_work_submit_to_queue_isr(void)
{
k_sem_reset(&sync_sema);
irq_offload(twork_submit, (void *)&workq);
irq_offload(twork_submit, (const void *)&workq);
for (int i = 0; i < NUM_OF_WORK; i++) {
k_sem_take(&sync_sema, K_FOREVER);
}
@ -764,7 +764,7 @@ void test_delayed_work_submit_to_queue_thread(void)
void test_delayed_work_submit_to_queue_isr(void)
{
k_sem_reset(&sync_sema);
irq_offload(tdelayed_work_submit, (void *)&workq);
irq_offload(tdelayed_work_submit, (const void *)&workq);
for (int i = 0; i < NUM_OF_WORK; i++) {
k_sem_take(&sync_sema, K_FOREVER);
}
@ -865,7 +865,7 @@ void test_delayed_work_cancel_from_queue_thread(void)
void test_delayed_work_cancel_from_queue_isr(void)
{
k_sem_reset(&sync_sema);
irq_offload(tdelayed_work_cancel, &workq);
irq_offload(tdelayed_work_cancel, (const void *)&workq);
/*wait for work items that could not be cancelled*/
for (int i = 0; i < NUM_OF_WORK; i++) {
k_sem_take(&sync_sema, K_FOREVER);
@ -936,7 +936,7 @@ void test_triggered_work_submit_to_queue_thread(void)
void test_triggered_work_submit_to_queue_isr(void)
{
k_sem_reset(&sync_sema);
irq_offload(ttriggered_work_submit, (void *)&workq);
irq_offload(ttriggered_work_submit, (const void *)&workq);
for (int i = 0; i < NUM_OF_WORK; i++) {
k_sem_take(&sync_sema, K_FOREVER);
}
@ -1005,7 +1005,7 @@ void test_triggered_work_cancel_from_queue_thread(void)
void test_triggered_work_cancel_from_queue_isr(void)
{
k_sem_reset(&sync_sema);
irq_offload(ttriggered_work_cancel, &workq);
irq_offload(ttriggered_work_cancel, (const void *)&workq);
/*wait for work items that could not be cancelled*/
for (int i = 0; i < NUM_OF_WORK; i++) {
k_sem_take(&sync_sema, K_FOREVER);

View file

@ -138,7 +138,7 @@ static struct {
};
/*entry of contexts*/
static void tringbuf_put(void *p)
static void tringbuf_put(const void *p)
{
int index = POINTER_TO_INT(p);
/**TESTPOINT: ring buffer put*/
@ -148,7 +148,7 @@ static void tringbuf_put(void *p)
zassert_equal(ret, 0, NULL);
}
static void tringbuf_get(void *p)
static void tringbuf_get(const void *p)
{
uint16_t type;
uint8_t value, size32 = DATA_MAX_SIZE;
@ -189,60 +189,60 @@ void test_ringbuffer_declare_size(void)
void test_ringbuffer_put_get_thread(void)
{
pbuf = &ringbuf;
tringbuf_put((void *)0);
tringbuf_put((void *)1);
tringbuf_get((void *)0);
tringbuf_get((void *)1);
tringbuf_put((void *)2);
tringbuf_put((const void *)0);
tringbuf_put((const void *)1);
tringbuf_get((const void *)0);
tringbuf_get((const void *)1);
tringbuf_put((const void *)2);
zassert_false(ring_buf_is_empty(pbuf), NULL);
tringbuf_get((void *)2);
tringbuf_get((const void *)2);
zassert_true(ring_buf_is_empty(pbuf), NULL);
}
void test_ringbuffer_put_get_isr(void)
{
pbuf = &ringbuf;
irq_offload(tringbuf_put, (void *)0);
irq_offload(tringbuf_put, (void *)1);
irq_offload(tringbuf_get, (void *)0);
irq_offload(tringbuf_get, (void *)1);
irq_offload(tringbuf_put, (void *)2);
irq_offload(tringbuf_put, (const void *)0);
irq_offload(tringbuf_put, (const void *)1);
irq_offload(tringbuf_get, (const void *)0);
irq_offload(tringbuf_get, (const void *)1);
irq_offload(tringbuf_put, (const void *)2);
zassert_false(ring_buf_is_empty(pbuf), NULL);
irq_offload(tringbuf_get, (void *)2);
irq_offload(tringbuf_get, (const void *)2);
zassert_true(ring_buf_is_empty(pbuf), NULL);
}
void test_ringbuffer_put_get_thread_isr(void)
{
pbuf = &ringbuf;
tringbuf_put((void *)0);
irq_offload(tringbuf_put, (void *)1);
tringbuf_get((void *)0);
irq_offload(tringbuf_get, (void *)1);
tringbuf_put((void *)2);
irq_offload(tringbuf_get, (void *)2);
tringbuf_put((const void *)0);
irq_offload(tringbuf_put, (const void *)1);
tringbuf_get((const void *)0);
irq_offload(tringbuf_get, (const void *)1);
tringbuf_put((const void *)2);
irq_offload(tringbuf_get, (const void *)2);
}
void test_ringbuffer_pow2_put_get_thread_isr(void)
{
pbuf = &ringbuf_pow2;
tringbuf_put((void *)0);
irq_offload(tringbuf_put, (void *)1);
tringbuf_get((void *)0);
irq_offload(tringbuf_get, (void *)1);
tringbuf_put((void *)1);
irq_offload(tringbuf_get, (void *)1);
tringbuf_put((const void *)0);
irq_offload(tringbuf_put, (const void *)1);
tringbuf_get((const void *)0);
irq_offload(tringbuf_get, (const void *)1);
tringbuf_put((const void *)1);
irq_offload(tringbuf_get, (const void *)1);
}
void test_ringbuffer_size_put_get_thread_isr(void)
{
pbuf = &ringbuf_size;
tringbuf_put((void *)0);
irq_offload(tringbuf_put, (void *)1);
tringbuf_get((void *)0);
irq_offload(tringbuf_get, (void *)1);
tringbuf_put((void *)2);
irq_offload(tringbuf_get, (void *)2);
tringbuf_put((const void *)0);
irq_offload(tringbuf_put, (const void *)1);
tringbuf_get((const void *)0);
irq_offload(tringbuf_get, (const void *)1);
tringbuf_put((const void *)2);
irq_offload(tringbuf_get, (const void *)2);
}
/**

View file

@ -161,9 +161,9 @@ void test_signal_events_signalled(void)
}
/* IRQ offload function handler to set signal flag */
static void offload_function(void *param)
static void offload_function(const void *param)
{
osThreadId tid = param;
osThreadId tid = (osThreadId)param;
int signals;
/* Make sure we're in IRQ context */
@ -176,7 +176,7 @@ static void offload_function(void *param)
void test_signal_from_isr(void const *thread_id)
{
/**TESTPOINT: Offload to IRQ context*/
irq_offload(offload_function, (void *)thread_id);
irq_offload(offload_function, (const void *)thread_id);
}
osThreadDef(test_signal_from_isr, osPriorityHigh, 1, 0);

View file

@ -163,7 +163,7 @@ void test_event_flags_signalled(void)
}
/* IRQ offload function handler to set event flag */
static void offload_function(void *param)
static void offload_function(const void *param)
{
int flags;
@ -178,7 +178,7 @@ static void offload_function(void *param)
void test_event_from_isr(void *event_id)
{
/**TESTPOINT: Offload to IRQ context*/
irq_offload(offload_function, (void *)event_id);
irq_offload(offload_function, (const void *)event_id);
}
static K_THREAD_STACK_DEFINE(test_stack3, STACKSZ);

View file

@ -17,7 +17,7 @@ typedef struct {
char info[100];
} versionInfo;
void get_version_check(void *param)
void get_version_check(const void *param)
{
char infobuf[100];
osVersion_t osv;
@ -32,7 +32,7 @@ void get_version_check(void *param)
}
}
void lock_unlock_check(void *arg)
void lock_unlock_check(const void *arg)
{
ARG_UNUSED(arg);
@ -66,7 +66,7 @@ void test_kernel_apis(void)
versionInfo version, version_irq;
get_version_check(&version);
irq_offload(get_version_check, &version_irq);
irq_offload(get_version_check, (const void *)&version_irq);
/* Check if the version value retrieved in ISR and thread is same */
zassert_equal(strcmp(version.info, version_irq.info), 0, NULL);
@ -78,8 +78,9 @@ void test_kernel_apis(void)
irq_offload(lock_unlock_check, NULL);
}
void delay_until(void *param)
void delay_until(const void *param)
{
ARG_UNUSED(param);
tick = osKernelGetTickCount();
tick += 50U;

View file

@ -126,7 +126,7 @@ void test_thread_flags_signalled(void)
}
/* IRQ offload function handler to set Thread flag */
static void offload_function(void *param)
static void offload_function(const void *param)
{
int flags;
@ -143,7 +143,7 @@ void test_thread_flags_from_isr(void *thread_id)
uint32_t flags;
/**TESTPOINT: Offload to IRQ context*/
irq_offload(offload_function, (void *)osThreadGetId());
irq_offload(offload_function, (const void *)osThreadGetId());
flags = osThreadFlagsWait(ISR_FLAG, osFlagsWaitAll, TIMEOUT_TICKS);
zassert_equal((flags & ISR_FLAG),