[af85485] | 1 | /* |
---|
| 2 | * Interrupt handler Header file |
---|
| 3 | * |
---|
| 4 | * Copyright (c) 2004 by Jay Monkman <jtm@lopingdog.com> |
---|
| 5 | * |
---|
| 6 | * The license and distribution terms for this file may be |
---|
| 7 | * found in the file LICENSE in this distribution or at |
---|
| 8 | * |
---|
| 9 | * http://www.OARcorp.com/rtems/license.html. |
---|
| 10 | * |
---|
| 11 | * |
---|
| 12 | * $Id$ |
---|
| 13 | */ |
---|
| 14 | |
---|
| 15 | #ifndef __IRQ_H__ |
---|
| 16 | #define __IRQ_H__ |
---|
| 17 | |
---|
| 18 | #ifdef __cplusplus |
---|
| 19 | extern "C" { |
---|
| 20 | #endif |
---|
| 21 | |
---|
| 22 | #ifndef __asm__ |
---|
| 23 | |
---|
| 24 | /* |
---|
| 25 | * Include some preprocessor value also used by assember code |
---|
| 26 | */ |
---|
| 27 | |
---|
| 28 | #include <rtems.h> |
---|
| 29 | #include <at91rm9200.h> |
---|
| 30 | |
---|
| 31 | extern void default_int_handler(); |
---|
| 32 | /*********************************************************************** |
---|
| 33 | * Constants |
---|
| 34 | **********************************************************************/ |
---|
| 35 | /* enum of the possible interrupt sources on the AT91RM9200 */ |
---|
| 36 | typedef enum { |
---|
| 37 | AT91RM9200_INT_FIQ = 0, |
---|
| 38 | AT91RM9200_INT_SYSIRQ, |
---|
| 39 | AT91RM9200_INT_PIOA, |
---|
| 40 | AT91RM9200_INT_PIOB, |
---|
| 41 | AT91RM9200_INT_PIOC, |
---|
| 42 | AT91RM9200_INT_PIOD, |
---|
| 43 | AT91RM9200_INT_US0, |
---|
| 44 | AT91RM9200_INT_US1, |
---|
| 45 | AT91RM9200_INT_US2, |
---|
| 46 | AT91RM9200_INT_US3, |
---|
| 47 | AT91RM9200_INT_MCI, |
---|
| 48 | AT91RM9200_INT_UDP, |
---|
| 49 | AT91RM9200_INT_TWI, |
---|
| 50 | AT91RM9200_INT_SPI, |
---|
| 51 | AT91RM9200_INT_SSC0, |
---|
| 52 | AT91RM9200_INT_SSC1, |
---|
| 53 | AT91RM9200_INT_SSC2, |
---|
| 54 | AT91RM9200_INT_TC0, |
---|
| 55 | AT91RM9200_INT_TC1, |
---|
| 56 | AT91RM9200_INT_TC2, |
---|
| 57 | AT91RM9200_INT_TC3, |
---|
| 58 | AT91RM9200_INT_TC4, |
---|
| 59 | AT91RM9200_INT_TC5, |
---|
| 60 | AT91RM9200_INT_UHP, |
---|
| 61 | AT91RM9200_INT_EMAC, |
---|
| 62 | AT91RM9200_INT_IRQ0, |
---|
| 63 | AT91RM9200_INT_IRQ1, |
---|
| 64 | AT91RM9200_INT_IRQ2, |
---|
| 65 | AT91RM9200_INT_IRQ3, |
---|
| 66 | AT91RM9200_INT_IRQ4, |
---|
| 67 | AT91RM9200_INT_IRQ5, |
---|
| 68 | AT91RM9200_INT_IRQ6, |
---|
| 69 | AT91RM9200_MAX_INT |
---|
| 70 | } rtems_irq_symbolic_name; |
---|
| 71 | |
---|
| 72 | /* vector table used by shared/irq_init.c */ |
---|
| 73 | /* we can treat the AT91RM9200 AIC_SVR_BASE as */ |
---|
| 74 | /* a vector table */ |
---|
| 75 | #define VECTOR_TABLE AIC_SVR_BASE |
---|
| 76 | |
---|
| 77 | typedef unsigned char rtems_irq_level; |
---|
| 78 | typedef unsigned char rtems_irq_trigger; |
---|
| 79 | |
---|
| 80 | struct __rtems_irq_connect_data__; /* forward declaratiuon */ |
---|
| 81 | |
---|
| 82 | typedef void (*rtems_irq_hdl) (void); |
---|
| 83 | typedef void (*rtems_irq_enable) (const struct __rtems_irq_connect_data__*); |
---|
| 84 | typedef void (*rtems_irq_disable) (const struct __rtems_irq_connect_data__*); |
---|
| 85 | typedef int (*rtems_irq_is_enabled)(const struct __rtems_irq_connect_data__*); |
---|
| 86 | |
---|
| 87 | typedef struct __rtems_irq_connect_data__ { |
---|
| 88 | /* IRQ line */ |
---|
| 89 | rtems_irq_symbolic_name name; |
---|
| 90 | |
---|
| 91 | /* Handler */ |
---|
| 92 | rtems_irq_hdl hdl; |
---|
| 93 | |
---|
| 94 | /* function for enabling interrupts at device level. */ |
---|
| 95 | rtems_irq_enable on; |
---|
| 96 | |
---|
| 97 | /* function for disabling interrupts at device level. */ |
---|
| 98 | rtems_irq_disable off; |
---|
| 99 | |
---|
| 100 | /* Function to test if interrupt is enabled */ |
---|
| 101 | rtems_irq_is_enabled isOn; |
---|
| 102 | |
---|
| 103 | /* priority level of interrupt */ |
---|
| 104 | rtems_irq_level irqLevel; |
---|
| 105 | |
---|
| 106 | /* Trigger method (rising/falling edge or high/low level) */ |
---|
| 107 | rtems_irq_trigger irqTrigger; |
---|
| 108 | } rtems_irq_connect_data; |
---|
| 109 | |
---|
| 110 | /* |
---|
| 111 | * function to initialize the interrupt for a specific BSP |
---|
| 112 | */ |
---|
| 113 | void BSP_rtems_irq_mngt_init(); |
---|
| 114 | |
---|
| 115 | |
---|
| 116 | /* |
---|
| 117 | * function to connect a particular irq handler. |
---|
| 118 | */ |
---|
| 119 | int BSP_install_rtems_irq_handler (const rtems_irq_connect_data*); |
---|
| 120 | |
---|
| 121 | /* |
---|
| 122 | * function to get the current RTEMS irq handler for ptr->name. |
---|
| 123 | */ |
---|
| 124 | int BSP_get_current_rtems_irq_handler (rtems_irq_connect_data* ptr); |
---|
| 125 | |
---|
| 126 | /* |
---|
| 127 | * function to disconnect the RTEMS irq handler for ptr->name. |
---|
| 128 | */ |
---|
| 129 | int BSP_remove_rtems_irq_handler (const rtems_irq_connect_data*); |
---|
| 130 | |
---|
| 131 | #endif /* __asm__ */ |
---|
| 132 | |
---|
| 133 | #ifdef __cplusplus |
---|
| 134 | } |
---|
| 135 | #endif |
---|
| 136 | |
---|
| 137 | #endif /* __IRQ_H__ */ |
---|