1 /*
2  * Copyright (c) 2022 Intel Corporation
3  *
4  * SPDX-License-Identifier: Apache-2.0
5  */
6 
7 #include <zephyr/drivers/interrupt_controller/dw_ace.h>
8 #include <zephyr/logging/log.h>
9 
10 LOG_MODULE_REGISTER(ace_v1x_soc, CONFIG_SOC_LOG_LEVEL);
11 
z_soc_irq_enable(uint32_t irq)12 void z_soc_irq_enable(uint32_t irq)
13 {
14 	const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(ace_intc));
15 	const struct dw_ace_v1_ictl_driver_api *api;
16 
17 	if (!device_is_ready(dev)) {
18 		LOG_DBG("board: ACE V1X device is not ready");
19 		return;
20 	}
21 
22 	api = (const struct dw_ace_v1_ictl_driver_api *)dev->api;
23 	api->intr_enable(dev, irq);
24 }
25 
z_soc_irq_disable(uint32_t irq)26 void z_soc_irq_disable(uint32_t irq)
27 {
28 	const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(ace_intc));
29 	const struct dw_ace_v1_ictl_driver_api *api;
30 
31 	if (!device_is_ready(dev)) {
32 		LOG_DBG("board: ACE V1X device is not ready");
33 		return;
34 	}
35 
36 	api = (const struct dw_ace_v1_ictl_driver_api *)dev->api;
37 	api->intr_disable(dev, irq);
38 }
39 
z_soc_irq_is_enabled(unsigned int irq)40 int z_soc_irq_is_enabled(unsigned int irq)
41 {
42 	const struct device *const dev = DEVICE_DT_GET(DT_NODELABEL(ace_intc));
43 	const struct dw_ace_v1_ictl_driver_api *api;
44 
45 	if (!device_is_ready(dev)) {
46 		LOG_DBG("board: ACE V1X device is not ready");
47 		return -ENODEV;
48 	}
49 
50 	api = (const struct dw_ace_v1_ictl_driver_api *)dev->api;
51 	return api->intr_is_enabled(dev, irq);
52 }
53