Skip to content

Commit 2574d98

Browse files
scottwcpgcfriedt
authored andcommitted
Microchip: MEC172x: Add macro to encode ECIA GIRQ information
Add a macro for encoding interrupt source information: GIRQ number, GIRQ bit position, GIRQ aggregated NVIC connection, and source direct NVIC connection. Signed-off-by: Scott Worley <[email protected]>
1 parent 19dd46e commit 2574d98

File tree

1 file changed

+19
-1
lines changed

1 file changed

+19
-1
lines changed

include/dt-bindings/interrupt-controller/mchp-xec-ecia.h

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,24 @@
66
#ifndef __DT_BINDING_MCHP_XEC_ECIA_H
77
#define __DT_BINDING_MCHP_XEC_ECIA_H
88

9-
#define MCHP_ECIA_DIRECT_BITMAP 0x00bfe000
9+
/*
10+
* Encode peripheral interrupt information into a 32-bit unsigned.
11+
* g = bits[0:4], GIRQ number in [8, 26]
12+
* gb = bits[12:8], peripheral source bit position [0, 31] in the GIRQ
13+
* na = bits[23:16], aggregated GIRQ NVIC number
14+
* nd = bits[31:24], direct NVIC number. For sources without a direct
15+
* connection nd = na.
16+
* NOTE: GIRQ22 is a peripheral clock wake only. GIRQ22 and its sources
17+
* are not connected to the NVIC. Use 255 for na and nd.
18+
*/
19+
#define MCHP_XEC_ECIA(g, gb, na, nd) \
20+
(((g) & 0x1f) + (((gb) & 0x1f) << 8) + (((na) & 0xff) << 16) + \
21+
(((nd) & 0xff) << 24))
22+
23+
/* extract specific information from encoded MCHP_XEC_ECIA */
24+
#define MCHP_XEC_ECIA_GIRQ(e) ((e) & 0x1f)
25+
#define MCHP_XEC_ECIA_GIRQ_POS(e) (((e) >> 8) & 0x1f)
26+
#define MCHP_XEC_ECIA_NVIC_AGGR(e) (((e) >> 16) & 0xff)
27+
#define MCHP_XEC_ECIA_NVIC_DIRECT(e) (((e) >> 24) & 0xff)
1028

1129
#endif /* __DT_BINDING_MCHP_XEC_ECIA_H */

0 commit comments

Comments
 (0)