Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
R
RIOT
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
cm-projects
RIOT
Commits
11361ec7
"src/editor/editor.php" did not exist on "49d2d05e31a36167e07bb3d96ac7126fc3c8c543"
Commit
11361ec7
authored
8 years ago
by
Joakim Nohlgård
Browse files
Options
Downloads
Patches
Plain Diff
kinetis: Add support for CPUs with a single IRQ for all PIT channels
parent
2b64452c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
cpu/kinetis/isr_kinetis.c
+1
-0
1 addition, 0 deletions
cpu/kinetis/isr_kinetis.c
cpu/kinetis/periph/timer.c
+32
-1
32 additions, 1 deletion
cpu/kinetis/periph/timer.c
with
33 additions
and
1 deletion
cpu/kinetis/isr_kinetis.c
+
1
−
0
View file @
11361ec7
...
...
@@ -169,6 +169,7 @@ WEAK_DEFAULT void isr_lvd_lvw(void);
WEAK_DEFAULT
void
isr_mcg
(
void
);
WEAK_DEFAULT
void
isr_mcm
(
void
);
WEAK_DEFAULT
void
isr_pdb0
(
void
);
WEAK_DEFAULT
void
isr_pit
(
void
);
WEAK_DEFAULT
void
isr_pit0
(
void
);
WEAK_DEFAULT
void
isr_pit1
(
void
);
WEAK_DEFAULT
void
isr_pit2
(
void
);
...
...
This diff is collapsed.
Click to expand it.
cpu/kinetis/periph/timer.c
+
32
−
1
View file @
11361ec7
...
...
@@ -32,6 +32,16 @@
#include
"periph_conf.h"
#include
"periph/timer.h"
#ifdef PIT_LTMR64H_LTH_MASK
/* The KW41Z PIT module provides only one IRQ for all PIT channels combined. */
/* TODO: find a better way to distinguish which Kinetis CPUs have separate PIT
* channel interrupts */
#define KINETIS_PIT_COMBINED_IRQ 1
#else
/* K60, K64F etc have a separate IRQ number for each PIT channel */
#define KINETIS_PIT_COMBINED_IRQ 0
#endif
#define ENABLE_DEBUG (0)
#include
"debug.h"
...
...
@@ -189,10 +199,15 @@ static inline int pit_init(uint8_t dev, uint32_t freq, timer_cb_t cb, void *arg)
/* Clear IRQ flag */
PIT
->
CHANNEL
[
pit_config
[
dev
].
count_ch
].
TFLG
=
PIT_TFLG_TIF_MASK
;
#if KINETIS_PIT_COMBINED_IRQ
/* One IRQ for all channels */
/* NVIC_ClearPendingIRQ(PIT_IRQn); */
/* does it make sense to clear this IRQ flag? */
NVIC_EnableIRQ
(
PIT_IRQn
);
#else
/* Refactor the below lines if there are any CPUs where the PIT IRQs are not sequential */
NVIC_ClearPendingIRQ
(
PIT0_IRQn
+
pit_config
[
dev
].
count_ch
);
NVIC_EnableIRQ
(
PIT0_IRQn
+
pit_config
[
dev
].
count_ch
);
#endif
/* Reset up-counter */
pit
[
dev
].
count
=
PIT_MAX_VALUE
;
pit
[
dev
].
ldval
=
PIT_MAX_VALUE
;
...
...
@@ -711,6 +726,22 @@ void timer_stop(tim_t dev)
/* ****** ISR instances ****** */
void
isr_pit
(
void
)
{
/* Some of the lower end Kinetis CPUs combine the individual PIT interrupt
* flags into a single NVIC IRQ signal. This means that software needs to
* test which timer(s) went off when an IRQ occurs. */
for
(
size_t
i
=
0
;
i
<
PIT_NUMOF
;
++
i
)
{
if
(
PIT
->
CHANNEL
[
pit_config
[
i
].
count_ch
].
TCTRL
&
PIT_TCTRL_TIE_MASK
)
{
/* Interrupt is enabled */
if
(
PIT
->
CHANNEL
[
pit_config
[
i
].
count_ch
].
TFLG
)
{
/* Timer interrupt flag is set */
pit_irq_handler
(
_pit_tim_t
(
i
));
}
}
}
}
#ifdef PIT_ISR_0
void
PIT_ISR_0
(
void
)
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment