PIC24 Support Libraries
Main Page
Related Pages
Modules
Data Structures
Files
File List
Globals
All
Data Structures
Files
Functions
Variables
Typedefs
Enumerations
Enumerator
Macros
Groups
Pages
esos
src
pic24
esos_pic24_irq.c
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
/************************************************************************
31
* esos_pic24_irq.c
32
************************************************************************
33
* User provided (HW-specific) ES_OS routines for individual IRQs
34
*
35
* NOTE: The actual handler ISR (the one that the CPU will vector to
36
* does NOT go in this file. The real HW handler for the user
37
* IRQs goes in the file esos_p18_uisr.c
38
*
39
* This allows us to emulate the p18 hardware on PCs since
40
* goofy INTERRUPT keywords are kept away from this code.
41
*/
42
43
#include "
esos_pic24_irq.h
"
44
45
/*
46
* User must provide a routine to setup the user (low-priority) IRQs
47
* This routine must only init the user IRQs.... It can not disable
48
* or other mess with IRQs beyond its purview because they may be
49
* being used to generate the system tick.
50
*/
51
void
_esos_hw_InitUserInterrupts(
void
) {
52
// Set all possible user IRQs to the lowest priority (0)
53
// However, ESOS may use a few IRQs for its own purposes, so
54
// preserve them.
55
//
56
// At this time, ESOS for PIC24 family uses T1, U1TX, U1RX
57
uint8_t
u8_T1IP, u8_U1TXIP, u8_U1RXIP;
58
uint8_t
u8_i;
59
uint16_t* pu16_IpcPtr;
60
61
u8_T1IP = _T1IP;
62
u8_U1RXIP = _U1RXIP;
63
u8_U1TXIP = _U1TXIP;
64
65
// Set all IRQs to 0 (ZERO) IP level
66
pu16_IpcPtr = (uint16_t*) &IPC0;
67
for
(u8_i=0; u8_i<=17; u8_i++) {
68
*pu16_IpcPtr=0;
69
pu16_IpcPtr++;
70
}
71
72
// restore the ESOS IRQ IP levels
73
_T1IP = u8_T1IP;
74
_U1RXIP = u8_U1RXIP;
75
_U1TXIP = u8_U1TXIP;
76
77
}
// end _esos_hw_InitUserInterrupts()
78
79
void
_esos_hw_DoNothingIsr(
void
) {
80
/*
81
DO NOTHING.... DON'T CALL PRINTF.
82
It makes the image HUGE!!!
83
printf("Doing nothing, of course!\n\r");
84
printf("PIR1 register is: %x\n\r", PIR1);
85
printf("PIR2 register is: %x\n\r", PIR2);
86
printf("INTCON3 register is: %x\n\r", INTCON3);
87
*/
88
//BIT_CLEAR( INTCON3, 0); // INTCON3bits.INT1IF = 0;
89
90
}
// end _esos_hw_DoNothingIsr()
Generated by
1.8.4