summaryrefslogtreecommitdiffstats
path: root/bsps/bfin/include/bsp/interrupt.h
blob: 7a98775dd59df49fcf8f45349c284eb9e9a5b897 (plain) (blame)
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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/**
 *@file interrupt.h
 *
 *@brief
 *  - This file implements interrupt dispatcher. The init code is taken from
 *  the 533 implementation for blackfin. Since 52X supports 56 line and 2 ISR
 *  registers some portion is written twice.
 *
 * Target:   TLL6527v1-0
 * Compiler:
 *
 * COPYRIGHT (c) 2010 by ECE Northeastern University.
 *
 * The license and distribution terms for this file may be
 * found in the file LICENSE in this distribution or at
 * http://www.rtems.org/license
 *
 * @author Rohan Kangralkar, ECE, Northeastern University
 *         (kangralkar.r@husky.neu.edu)
 *
 * LastChange:
 */

#ifndef _BFIN_INTERRUPT_H_
#define _BFIN_INTERRUPT_H_


#ifdef __cplusplus
extern "C" {
#endif

/** The type of interrupts handled by the SIC
 */
typedef enum {
    IRQ_PLL_WAKEUP_INTERRUPT,                 /* 0 */
    IRQ_DMA_ERROR_0,                          /* 1 */
    IRQ_DMAR0_BLOCK_INTERRUPT,                /* 2 */
    IRQ_DMAR1_BLOCK_INTERRUPT,                /* 3 */
    IRQ_DMAR0_OVERFLOW_ERROR,                 /* 4 */
    IRQ_DMAR1_OVERFLOW_ERROR,                 /* 5 */
    IRQ_PPI_STATUS,                           /* 6 */
    IRQ_MAC_STATUS,                           /* 7 */
    IRQ_SPORT0_STATUS,                        /* 8 */
    IRQ_SPORT1_STATUS,                        /* 9 */
    IRQ_RESERVED_10,                          /* 10 */
    IRQ_RESERVED_11,                          /* 11 */
    IRQ_UART0_STATUS,                         /* 12 */
    IRQ_UART1_STATUS,                         /* 13 */
    IRQ_REAL_TIME_CLOCK,                      /* 14 */
    IRQ_DMA0_PPI_NFC,                         /* 15 */
    IRQ_DMA3_SPORT0_RX,                       /* 16 */
    IRQ_DMA4_SPORT0_TX,                       /* 17 */
    IRQ_DMA5_SPORT1_RX,                       /* 18 */
    IRQ_DMA6_SPORT1_TX,                       /* 19 */
    IRQ_TWI_INTERRUPT,                        /* 20 */
    IRQ_DMA7_SPI,                             /* 21 */
    IRQ_DMA8_UART0_RX,                        /* 22 */
    IRQ_DMA9_UART0_TX,                        /* 23 */
    IRQ_DMA10_UART1_RX,                       /* 24 */
    IRQ_DMA11_UART1_TX,                       /* 25 */
    IRQ_OTP,                                  /* 26 */
    IRQ_GP_COUNTER,                           /* 27 */
    IRQ_DMA1_MAC_RX_HOSTDP,                   /* 28 */
    IRQ_PORT_H_INTERRUPT_A,                   /* 29 */
    IRQ_DMA2_MAC_TX_NFC,                      /* 30 */
    IRQ_PORT_H_INTERRUPT_B,                   /* 31 */
    SIC_ISR0_MAX,                             /* 32 ***/
    IRQ_TIMER0 = SIC_ISR0_MAX,                /* 32 */
    IRQ_TIMER1,                               /* 33 */
    IRQ_TIMER2,                               /* 34 */
    IRQ_TIMER3,                               /* 35 */
    IRQ_TIMER4,                               /* 36 */
    IRQ_TIMER5,                               /* 37 */
    IRQ_TIMER6,                               /* 38 */
    IRQ_TIMER7,                               /* 39 */
    IRQ_PORT_G_INTERRUPT_A,                   /* 40 */
    IRQ_PORT_G_INTERRUPT_B,                   /* 41 */
    IRQ_MDMA0_STREAM_0_INTERRUPT,             /* 42 */
    IRQ_MDMA1_STREAM_0_INTERRUPT,             /* 43 */
    IRQ_SOFTWARE_WATCHDOG_INTERRUPT,          /* 44 */
    IRQ_PORT_F_INTERRUPT_A,                   /* 45 */
    IRQ_PORT_F_INTERRUPT_B,                   /* 46 */
    IRQ_SPI_STATUS,                           /* 47 */
    IRQ_NFC_STATUS,                           /* 48 */
    IRQ_HOSTDP_STATUS,                        /* 49 */
    IRQ_HOREAD_DONE_INTERRUPT,                /* 50 */
    IRQ_RESERVED_19,                          /* 51 */
    IRQ_USB_INT0_INTERRUPT,                   /* 52 */
    IRQ_USB_INT1_INTERRUPT,                   /* 53 */
    IRQ_USB_INT2_INTERRUPT,                   /* 54 */
    IRQ_USB_DMAINT,                           /* 55 */
    IRQ_MAX,                                  /* 56 */
} e_isr_t;




/* source is the source to the SIC (the bit number in SIC_ISR).  isr is
   the function that will be called when the interrupt is active. */
typedef struct bfin_isr_s {
#if INTERRUPT_USE_TABLE
  e_isr_t source;
  void (*pFunc)(void *arg);
  void *pArg;
  int priority; /** not used */
#else
  int source;
  void (*isr)(void *arg);
  void *_arg;
  /* the following are for internal use only */
  uint32_t mask0;
  uint32_t mask1;
  uint32_t vector;
  struct bfin_isr_s *next;
#endif
} bfin_isr_t;

/**
 * This routine registers a new ISR. It will write a new entry to the IVT table
 * @param isr contains a callback function and source
 * @return rtems status code
 */
rtems_status_code bfin_interrupt_register(bfin_isr_t *isr);

/**
 * This function unregisters a registered interrupt handler.
 * @param isr
 */
rtems_status_code bfin_interrupt_unregister(bfin_isr_t *isr);

/**
 * blackfin interrupt initialization routine. It initializes the bfin ISR
 * dispatcher. It will also create SIC CEC map which will be used for
 * identifying the ISR.
 */
void bfin_interrupt_init(void);


#ifdef __cplusplus
}
#endif

#endif /* _BFIN_INTERRUPT_H_ */