Zephyr API Documentation 4.3.99
A Scalable Open Source RTOS
Loading...
Searching...
No Matches
mchp-xec-ecia.h
Go to the documentation of this file.
1/*
2 * Copyright (c) 2021 Microchip Technology
3 *
4 * SPDX-License-Identifier: Apache-2.0
5 */
6#ifndef ZEPHYR_INCLUDE_DT_BINDINGS_INTERRUPT_CONTROLLER_MCHP_XEC_ECIA_H_
7#define ZEPHYR_INCLUDE_DT_BINDINGS_INTERRUPT_CONTROLLER_MCHP_XEC_ECIA_H_
8
9/* Encode peripheral's GIRQ and GIRQ bit position only
10 * g = GIRQ number [8, 26], b = bit position [0, 31]
11 */
12#define MCHP_XEC_ECIA_GIRQ_ENC(g, b) (((g) & 0x1f) + (((b) & 0x1f) << 8))
13
14/*
15 * Encode peripheral interrupt information into a 32-bit unsigned.
16 * g = bits[0:4], GIRQ number in [8, 26]
17 * gb = bits[12:8], peripheral source bit position [0, 31] in the GIRQ
18 * na = bits[23:16], aggregated GIRQ NVIC number
19 * nd = bits[31:24], direct NVIC number. For sources without a direct
20 * connection nd = na.
21 * NOTE: GIRQ22 is a peripheral clock wake only. GIRQ22 and its sources
22 * are not connected to the NVIC. Use 255 for na and nd.
23 */
24#define MCHP_XEC_ECIA(g, gb, na, nd) \
25 (((g) & 0x1f) + (((gb) & 0x1f) << 8) + (((na) & 0xff) << 16) + \
26 (((nd) & 0xff) << 24))
27
28/* extract specific information from encoded MCHP_XEC_ECIA */
29#define MCHP_XEC_ECIA_GIRQ(e) ((e) & 0x1f)
30#define MCHP_XEC_ECIA_GIRQ_POS(e) (((e) >> 8) & 0x1f)
31#define MCHP_XEC_ECIA_NVIC_AGGR(e) (((e) >> 16) & 0xff)
32#define MCHP_XEC_ECIA_NVIC_DIRECT(e) (((e) >> 24) & 0xff)
33
34#endif /* ZEPHYR_INCLUDE_DT_BINDINGS_INTERRUPT_CONTROLLER_MCHP_XEC_ECIA_H_ */