PIC24 Support Libraries
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 #define NUM_USER_IRQS 16
43 
44 void _esos_hw_InitUserInterrupts(void);
45 
46 #if 0
47 // a helpful macro used to declare and prototype user ISRs
48 #define ESOS_USER_ISR(fcn) void fcn(void)
49 
50 // Prototypes for all the hardware specific routines we expect
51 /**
52 * Enables the already-registered user interrupt denoted by the interrupt descriptor
53 * \param u16_desc Descriptor of the hardware interrupt
54 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
55 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
56 * \hideinitializer
57 */
58 void esos_EnableVerifiedUserInterrupt( uint16_t u16_desc );
59 void _esos_hw_DisableAllUserInterrupts(void);
60 void _esos_hw_EnableAllUserInterrupts(void);
61 void _esos_hw_InitUserInterrupts(void);
62 uint8_t _esos_hw_IsUserInterruptEnabled(uint16_t u16_desc );
63 uint8_t _esos_hw_IsUserInterruptFlagSet(uint16_t u16_desc );
64 
65 /**
66 * Unregisters the user interrupt denoted by the interrupt descriptor
67 * \param u16_desc Descriptor of the hardware interrupt
68 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
69 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
70 * \hideinitializer
71 * \sa esos_RegisterUserInterrupt
72 * \sa esos_EnableUserInterrupt
73 * \sa esos_DisableUserInterrupt
74 */
75 void esos_UnregisterUserInterrupt( uint16_t u16_desc );
76 
77 /**
78 * Registers the user interrupt denoted by the interrupt descriptor
79 * \param u16_desc Descriptor of the hardware interrupt
80 * \param u8_IPL Interrupt Priority Level (IPL) for the interrupt being registered
81 * \param p2f Pointer to function to serve as the ISR. Function must have <em>void</em>
82 * arguments and return <em>void</em>
83 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
84 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
85 * \hideinitializer
86 * \sa esos_RegisterUserInterrupt
87 * \sa esos_EnableUserInterrupt
88 * \sa esos_DisableUserInterrupt
89 */
90 void esos_RegisterUserInterrupt( uint16_t u16_desc, uint8_t u8_IPL, void (*p2f)(void) );
91 
92 void _esos_DoNothingIsr(void);
93 void _esos_hw_DoNothingIsr(void);
94 
95 // Map the HW-specific routine names into osXXXXXX ones
96 //#define esos_InitUserInterrupts _esos_hw_InitUserInterrupts
97 
98 /**
99 * Disables all registered user interrupts.
100 * \note This function does <em>NOT</em> disable all interrupts. Interrupts used by
101 * ESOS will continue to function.
102 * \hideinitializer
103 */
104 #define esos_DisableAllUserInterrupts _esos_hw_DisableAllUserInterrupts
105 
106 /**
107 * Enables all registered user interrupts.
108 * \note Does not affect interrupts used by ESOS
109 * \hideinitializer
110 */
111 #define esos_EnableAllUserInterrupts _esos_hw_EnableAllUserInterrupts
112 
113 /**
114 * Queries the enabled state of user interrupt denoted by the interrupt descriptor
115 * \param u16_desc Descriptor of the hardware interrupt
116 * \retval TRUE If the user interrupt is currently enabled
117 * \retval FALSE If the user interrupt is currently disabled
118 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
119 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
120 * \hideinitializer
121 * \sa esos_RegisterUserInterrupt
122 * \sa esos_UnregisterUserInterrupt
123 * \sa esos_EnableUserInterrupt
124 * \sa esos_DisableUserInterrupt
125 */
126 #define esos_IsUserInterruptEnabled _esos_hw_IsUserInterruptEnabled
127 
128 /**
129 * Queries the "flag" state of user interrupt denoted by the interrupt descriptor
130 * \param u16_desc Descriptor of the hardware interrupt
131 * \retval TRUE If the user interrupt is needs to be serviced
132 * \retval FALSE Otherwise
133 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
134 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
135 * \hideinitializer
136 * \sa esos_MarkUserInterruptServiced
137 */
138 #define esos_DoesUserInterruptNeedServicing _esos_hw_IsUserInterruptFlagSet
139 
140 /**
141 * Tells ESOS to mark the user interrupt denoted by the interrupt descriptor as being serviced
142 * \param u16_desc Descriptor of the hardware interrupt
143 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
144 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
145 * \hideinitializer
146 * \sa esos_DoesUserInterruptNeedServicing
147 */
148 #define esos_MarkUserInterruptServiced _esos_hw_ClearUserInterruptFlag
149 
150 /**
151 * Enables the user interrupt denoted by the interrupt descriptor
152 * \param u16_desc Descriptor of the hardware interrupt
153 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
154 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
155 * \hideinitializer
156 * \sa esos_RegisterUserInterrupt
157 * \sa esos_UnregisterUserInterrupt
158 * \sa esos_IsUserInterruptEnabled
159 * \sa esos_DisableUserInterrupt
160 */
161 #define esos_EnableUserInterrupt _esos_hw_EnableUserInterrupt
162 
163 /**
164 * Disables the user interrupt denoted by the interrupt descriptor
165 * \param u16_desc Descriptor of the hardware interrupt
166 * \note Hardware interrupt descriptors are found in the file <b>esos_<i>hw</i>_irq.h</b>
167 * where <i>hw</i> is the name of the chip for the ESOS port has been written.
168 * \hideinitializer
169 * \sa esos_RegisterUserInterrupt
170 * \sa esos_UnregisterUserInterrupt
171 * \sa esos_IsUserInterruptEnabled
172 * \sa esos_EnableUserInterrupt
173 */
174 #define esos_DisableUserInterrupt _esos_hw_DisableUserInterrupt
175 
176 /*
177  * And define the private data storage we need
178  */
179 //extern void (*__esos_IsrFcns[NUM_USER_IRQS])(void);
180 
181 #endif // IF 0
182 
183 #endif // ESOS_IRQ_H
unsigned char uint8_t
An abbreviation for an 8-bit unsigned integer.
Definition: dataXferImpl.h:194
Embedded Systems Operating System (ESOS) Definitions to make ESOS code more generic and portable...