MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_pic_add_traps

Function rt_pic_add_traps

components/drivers/pic/pic.c:487–517  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

485}
486
487rt_err_t rt_pic_add_traps(rt_bool_t (*handler)(void *), void *data)
488{
489 rt_err_t err = -RT_EINVAL;
490
491 if (handler)
492 {
493 struct irq_traps *traps = rt_malloc(sizeof(*traps));
494
495 if (traps)
496 {
497 rt_ubase_t level = rt_hw_interrupt_disable();
498
499 rt_list_init(&traps->list);
500
501 traps->data = data;
502 traps->handler = handler;
503
504 rt_list_insert_before(&_traps_nodes, &traps->list);
505 err = RT_EOK;
506
507 rt_hw_interrupt_enable(level);
508 }
509 else
510 {
511 LOG_E("No memory to save '%p' handler", handler);
512 err = -RT_ENOMEM;
513 }
514 }
515
516 return err;
517}
518
519rt_err_t rt_pic_do_traps(void)
520{

Callers 2

gicv3_initFunction · 0.85
gicv2_initFunction · 0.85

Calls 5

rt_mallocFunction · 0.85
rt_list_initFunction · 0.85
rt_list_insert_beforeFunction · 0.85
rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50

Tested by

no test coverage detected