summaryrefslogtreecommitdiff
path: root/cesar/hal/leon/itc2.h
blob: 39d60a09a54f9c988c43d69c212b495f8c3173f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
#ifndef itc2_h
#define itc2_h
/* Cesar project {{{
 *
 * Copyright (C) 2008 Spidcom
 *
 * <<<Licence>>>
 *
 * }}} */
/**
 * \file    hal/leon/itc2.h
 * \brief   Secondary interrupt controller support.
 * \ingroup hal_leon
 */

/** Secondary interrupt controller base address. */
#define LEON_ITC2_BASE 0x800000b0

/** Interrupt mask, 0 for masked, 1 for enabled. */
#define LEON_ITC2_MASK (* (volatile u32 *) (LEON_ITC2_BASE + 0x00))

/** Interrupt pending, 1 for pending. */
#define LEON_ITC2_PENDING (* (volatile u32 *) (LEON_ITC2_BASE + 0x04))

/** Interrupt status. */
#define LEON_ITC2_STATUS (* (volatile u32 *) (LEON_ITC2_BASE + 0x08))
/** Interrupt request level. */
#define LEON_ITC2_STATUS__IRL 4, 0
/** Interrupt pending. */
#define LEON_ITC2_STATUS__IP 5, 5

/** Interrupt clear, write 1 to clear. */
#define LEON_ITC2_CLEAR (* (volatile u32 *) (LEON_ITC2_BASE + 0x0c))

/* Interrupt assignment: */
#define LEON_ITC2_IT__RESYS                      20
#define LEON_ITC2_IT__PRATIC_ACCESS_CONF         19
#define LEON_ITC2_IT__PRATIC_ACCESS              18
#define LEON_ITC2_IT__PRATIC_INTERRUPT           17
#define LEON_ITC2_IT__PB_DMA_END                 16
#define LEON_ITC2_IT__PRATIC_CAPTURE             15
#define LEON_ITC2_IT__ME10DOI_END                14
#define LEON_ITC2_IT__MAILBOXES_A2L              13
#define LEON_ITC2_IT__MAILBOXES_A2L_ACK          12
#define LEON_ITC2_IT__BRIDGE_DMA_END             11
#define LEON_ITC2_IT__TM_DMA_END                 10
#define LEON_ITC2_IT__MAPPOWSE_END_TX_FRAME       9
#define LEON_ITC2_IT__MACRASS_OUT_LAST_PB_SENT    8
#define LEON_ITC2_IT__MACRASS_OUT_FCTX_SENT       7
#define LEON_ITC2_IT__OSYSEQ_OSYSEQ_END           6
#define LEON_ITC2_IT__OSYSEQ_OUT_EARLY_END_FC10   5
#define LEON_ITC2_IT__RESYS_PRE_NOT_EXPECTED      4
#define LEON_ITC2_IT__START_TX_ERROR              3
#define LEON_ITC2_IT__BRIDGE_DMA_ERROR            2
#define LEON_ITC2_IT__PB_DMA_ERROR                1
#define LEON_ITC2_IT__TM_DMA_ERROR                0

/** High priority interrupt number on primary interrupt controller. */
#define LEON_ITC2_HIGH_PRIORITY_ITC1_IT 13

/** High priority interrupt priority on primary interrupt controller. */
#define LEON_ITC2_HIGH_PRIORITY_ITC1_IT_PRIORITY 1

/** Low priority interrupt number on primary interrupt controller. */
#define LEON_ITC2_LOW_PRIORITY_ITC1_IT 10

/** Low priority interrupt priority on primary interrupt controller. */
#define LEON_ITC2_LOW_PRIORITY_ITC1_IT_PRIORITY 0

/**
 * Initialise the secondary interrupt controller.
 */
inline void
leon_itc2_init (void)
{
    LEON_ITC2_MASK = 0;
    LEON_ITC2_CLEAR = 0xffffffff;
}

/**
 * Mask all interrupts and uninitialise the secondary interrupt controller.
 */
inline void
leon_itc2_uninit (void)
{
    LEON_ITC2_MASK = 0;
}

#endif /* itc2_h */