| Subject: |
|
New port questions |
| Name: |
|
Mike |
| Date Posted: |
|
Apr 17, 08 - 10:59 AM |
| Email: |
|
delsauce@hotmail.com |
| Message: |
|
I am testing out the QPNano framework v4.0 (w/QK) for an application that I am building on a Freescale Coldfire part. I have a simple state machine up and running at the moment but have some questions about how ISRs are handled before I move on.
The coldfire part uses priority scheme for its interrupts (highest priority is 7, lowest is 1) and I'd like to make use of nested interrupts. Here are the defintions that I've got for the ISR stuff in the qpn_port.h file:
#define QF_ISR_NEST
#define QF_ISR_KEY_TYPE uint8_t
#define QF_ISR_LOCK(key) key = SetInterruptMaskLevel(7)
#define QF_ISR_UNLOCK(key) SetInterruptMaskLevel(key)
#define QF_INT_LOCK() SetInterruptMaskLevel(7)
#define QF_INT_UNLOCK() SetInterruptMaskLevel(0)
#define QK_ISR_ENTRY(level, pin, prio) do { \
level = SetInterruptMaskLevel(7); \
pin = QK_currPrio_; \
QK_currPrio_ = prio; \
QK_intNest_++; \
SetInterruptMaskLevel(level); \
} while (0)
#define QK_ISR_EXIT(pin) do { \
SetInterruptMaskLevel(7); \
QK_intNest_--; \
QK_currPrio_ = pin; \
QK_SCHEDULE_(); \
} while (0)
A brief description of what I am doing here- On ISR entry, I am disabling interrupts to save and set the QK_currPrio_ variable to the new priority. I then reenable interrupts (at the current level of the active ISR) and process the ISR normally. At the end of the ISR I disable interrupts again, restore the QK_currPrio variable and call the scheduler.
Here are the questions:
1. Does each interrupt have to have its own priority in the QK sense or can all interrupts just set QK_currPrio to 0xFF?
2. If an interrupt does not make use of any OS calls (e.g. a serial port interrupt that just buffers the next char) does it need to call QK_ISR_ENTRY() and OK_ISR_EXIT()?
3. Finally, is there anything here that looks odd that I might be missing?
Thanks in advance for the help... |
|
Replies:
|
|
|
|
|