PIC24 Support Libraries
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
esos_irq.h
Go to the documentation of this file.
1 /*
2  * "Copyright (c) 2008 Robert B. Reese, Bryan A. Jones, J. W. Bruce ("AUTHORS")"
3  * All rights reserved.
4  * (R. Reese, reese_AT_ece.msstate.edu, Mississippi State University)
5  * (B. A. Jones, bjones_AT_ece.msstate.edu, Mississippi State University)
6  * (J. W. Bruce, jwbruce_AT_ece.msstate.edu, Mississippi State University)
7  *
8  * Permission to use, copy, modify, and distribute this software and its
9  * documentation for any purpose, without fee, and without written agreement is
10  * hereby granted, provided that the above copyright notice, the following
11  * two paragraphs and the authors appear in all copies of this software.
12  *
13  * IN NO EVENT SHALL THE "AUTHORS" BE LIABLE TO ANY PARTY FOR
14  * DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
15  * OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE "AUTHORS"
16  * HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
17  *
18  * THE "AUTHORS" SPECIFICALLY DISCLAIMS ANY WARRANTIES,
19  * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
20  * AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
21  * ON AN "AS IS" BASIS, AND THE "AUTHORS" HAS NO OBLIGATION TO
22  * PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
23  *
24  * Please maintain this header in its entirety when copying/modifying
25  * these files.
26  *
27  *
28  */
29 
30 /** \file
31  * This file contains macros, prototypes, and definitions for
32  * relatively hardware-independent interrupts on ESOS
33  */
34 
35 
36 #ifndef ESOS_IRQ_H
37 #define ESOS_IRQ_H
38 
39 //#include "user_config.h"
40 #include "all_generic.h"
41 
42 void _esos_hw_InitUserInterrupts(void);
43 
44 
45 #if 0
46 // a helpful macro used to declare and prototype user ISRs
47 #define ESOS_USER_ISR(fcn) void fcn(void)
48 
49 // Prototypes for all the hardware specific routines we expect
50 /**
51 * Enables the already-registered user interrupt denoted by the interrupt descriptor
52 * \param u16_desc Descriptor of the hardware interrupt
53 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
54 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
55 * \hideinitializer
56 */
57 void esos_EnableVerifiedUserInterrupt( uint16 u16_desc );
58 void _esos_hw_DisableAllUserInterrupts(void);
59 void _esos_hw_EnableAllUserInterrupts(void);
60 void _esos_hw_InitUserInterrupts(void);
61 uint8 _esos_hw_IsUserInterruptEnabled(uint16 u16_desc );
62 uint8 _esos_hw_IsUserInterruptFlagSet(uint16 u16_desc );
63 
64 /**
65 * Unregisters the user interrupt denoted by the interrupt descriptor
66 * \param u16_desc Descriptor of the hardware interrupt
67 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
68 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
69 * \hideinitializer
70 * \sa esos_RegisterUserInterrupt
71 * \sa esos_EnableUserInterrupt
72 * \sa esos_DisableUserInterrupt
73 */
74 void esos_UnregisterUserInterrupt( uint16 u16_desc );
75 
76 /**
77 * Registers the user interrupt denoted by the interrupt descriptor
78 * \param u16_desc Descriptor of the hardware interrupt
79 * \param u8_IPL Interrupt Priority Level (IPL) for the interrupt being registered
80 * \param p2f Pointer to function to serve as the ISR. Function must have <em>void</em>
81 * arguments and return <em>void</em>
82 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
83 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
84 * \hideinitializer
85 * \sa esos_RegisterUserInterrupt
86 * \sa esos_EnableUserInterrupt
87 * \sa esos_DisableUserInterrupt
88 */
89 void esos_RegisterUserInterrupt( uint16 u16_desc, uint8 u8_IPL, void (*p2f)(void) );
90 
91 void _esos_DoNothingIsr(void);
92 void _esos_hw_DoNothingIsr(void);
93 
94 // Map the HW-specific routine names into osXXXXXX ones
95 //#define esos_InitUserInterrupts _esos_hw_InitUserInterrupts
96 
97 /**
98 * Disables all registered user interrupts.
99 * \note This function does <em>NOT</em> disable all interrupts. Interrupts used by
100 * ESOS will continue to function.
101 * \hideinitializer
102 */
103 #define esos_DisableAllUserInterrupts _esos_hw_DisableAllUserInterrupts
104 
105 /**
106 * Enables all registered user interrupts.
107 * \note Does not affect interrupts used by ESOS
108 * \hideinitializer
109 */
110 #define esos_EnableAllUserInterrupts _esos_hw_EnableAllUserInterrupts
111 
112 /**
113 * Queries the enabled state of user interrupt denoted by the interrupt descriptor
114 * \param u16_desc Descriptor of the hardware interrupt
115 * \retval TRUE If the user interrupt is currently enabled
116 * \retval FALSE If the user interrupt is currently disabled
117 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
118 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
119 * \hideinitializer
120 * \sa esos_RegisterUserInterrupt
121 * \sa esos_UnregisterUserInterrupt
122 * \sa esos_EnableUserInterrupt
123 * \sa esos_DisableUserInterrupt
124 */
125 #define esos_IsUserInterruptEnabled _esos_hw_IsUserInterruptEnabled
126 
127 /**
128 * Queries the "flag" state of user interrupt denoted by the interrupt descriptor
129 * \param u16_desc Descriptor of the hardware interrupt
130 * \retval TRUE If the user interrupt is needs to be serviced
131 * \retval FALSE Otherwise
132 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
133 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
134 * \hideinitializer
135 * \sa esos_MarkUserInterruptServiced
136 */
137 #define esos_DoesUserInterruptNeedServicing _esos_hw_IsUserInterruptFlagSet
138 
139 /**
140 * Tells ESOS to mark the user interrupt denoted by the interrupt descriptor as being serviced
141 * \param u16_desc Descriptor of the hardware interrupt
142 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
143 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
144 * \hideinitializer
145 * \sa esos_DoesUserInterruptNeedServicing
146 */
147 #define esos_MarkUserInterruptServiced _esos_hw_ClearUserInterruptFlag
148 
149 /**
150 * Enables the user interrupt denoted by the interrupt descriptor
151 * \param u16_desc Descriptor of the hardware interrupt
152 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
153 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
154 * \hideinitializer
155 * \sa esos_RegisterUserInterrupt
156 * \sa esos_UnregisterUserInterrupt
157 * \sa esos_IsUserInterruptEnabled
158 * \sa esos_DisableUserInterrupt
159 */
160 #define esos_EnableUserInterrupt _esos_hw_EnableUserInterrupt
161 
162 /**
163 * Disables the user interrupt denoted by the interrupt descriptor
164 * \param u16_desc Descriptor of the hardware interrupt
165 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
166 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
167 * \hideinitializer
168 * \sa esos_RegisterUserInterrupt
169 * \sa esos_UnregisterUserInterrupt
170 * \sa esos_IsUserInterruptEnabled
171 * \sa esos_EnableUserInterrupt
172 */
173 #define esos_DisableUserInterrupt _esos_hw_DisableUserInterrupt
174 
175 /*
176  * And define the private data storage we need
177  */
178 //extern void (*__esos_IsrFcns[NUM_USER_IRQS])(void);
179 
180 #endif // IF 0
181 
182 #endif // ESOS_IRQ_H