no-OS
Loading...
Searching...
No Matches
test_irq.c File Reference

CAPI IRQ controller GPIO external-interrupt integration tests. More...

#include "parameters.h"
#include "test_framework.h"
#include "test_irq.h"
#include <errno.h>
#include <stdbool.h>
#include <stdint.h>
#include "capi_irq.h"
#include "capi_gpio.h"
#include "common_data.h"
Include dependency graph for test_irq.c:

Functions

int test_irq (void)
 Run all IRQ controller test cases available on the mapped platform.
 

Detailed Description

CAPI IRQ controller GPIO external-interrupt integration tests.

Copyright (c) 2026 Analog Devices, Inc. SPDX-License-Identifier: BSD-3-Clause

These are integration tests, not unit tests: every case raises a REAL interrupt by driving a GPIO output pin that is externally wired to a GPIO input pin (the same JAx loopback pair used by test_gpio), and observes it arriving through the CAPI IRQ contract. We test the CAPI idea – connect a callback, gate it with enable/disable and the global switch, deliver the argument, re-point the handler – not the underlying vendor BSP.

To run this suite on a new platform, implement three hooks (declared in common_data.h, defined in that platform's main.c – not here, and not tied to any vendor):

platform_gpio_irq_arm(&irq_line) route the loopback input pin to an IRQ and return its CAPI line; -ENOTSUP if the board has no GPIO-IRQ path (suite skips). platform_gpio_irq_ack() clear that pin as the source, called from inside the ISR. platform_gpio_irq_disarm() mask the pin's interrupt again.

Everything else here is pure CAPI.

Function Documentation

◆ test_irq()

int test_irq ( void )

Run all IRQ controller test cases available on the mapped platform.

Returns
0 if all executed cases passed, first non-zero test error otherwise.