summaryrefslogtreecommitdiff
path: root/cesar/hal/leon/itc2.h
blob: 30a4037133fecc30b0793e4c91706ec626691eac (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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
#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
 *
 * Can be included from assembly files.
 */

/** 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 for low priority, 1 for pending. */
#define LEON_ITC2_PENDING_LOW (* (volatile u32 *) (LEON_ITC2_BASE + 0x04))

/** Interrupt status for low priority. */
#define LEON_ITC2_STATUS_LOW (* (volatile u32 *) (LEON_ITC2_BASE + 0x08))
/** Interrupt request level. */
#define LEON_ITC2_STATUS_LOW__IRL 4, 0
/** Interrupt pending. */
#define LEON_ITC2_STATUS_LOW__IP 5, 5

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

/** Interrupt priority configuration, 1 for high. */
#define LEON_ITC2_LEVEL (* (volatile u32 *) (LEON_ITC2_BASE + 0x30))

/** Interrupt pending for high priority, 1 for pending. */
#define LEON_ITC2_PENDING_HIGH (* (volatile u32 *) (LEON_ITC2_BASE + 0x34))

/** Interrupt status for high priority, register address. */
#define LEON_ITC2_STATUS_HIGH_ADDR (LEON_ITC2_BASE + 0x38)
/** Interrupt status for high priority. */
#define LEON_ITC2_STATUS_HIGH (* (volatile u32 *) (LEON_ITC2_STATUS_HIGH_ADDR))
/** Interrupt request level. */
#define LEON_ITC2_STATUS_HIGH__IRL 4, 0
/** Interrupt pending. */
#define LEON_ITC2_STATUS_HIGH__IP 5, 5

/** First interrupt controller clear register, needed to acknowledge high
 * level ITC2 interrupts. */
#define LEON_ITC1_CLEAR (* (volatile u32 *) (0x8000009c))

/* Interrupt assignment: */
#define LEON_ITC2_IT__CONGESTION_TX_ERROR        25
#define LEON_ITC2_IT__PREAMBLE_EARLY_FOUND       24
#define LEON_ITC2_IT__PREAMBLE_FOUND             23
#define LEON_ITC2_IT__RES_FFT_ERROR              22
#define LEON_ITC2_IT__FC_RECEIVED                21
#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__PRATIC_CAPTURE             16
#define LEON_ITC2_IT__ME10DOI_END                15
#define LEON_ITC2_IT__MAILBOXES_A2L              14
#define LEON_ITC2_IT__MAILBOXES_A2L_ACK          13
#define LEON_ITC2_IT__BRIDGE_DMA_END             12
#define LEON_ITC2_IT__PB_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_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

#ifndef __ASSEMBLER__

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

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

#endif /* __ASSEMBLER__ */

#endif /* itc2_h */