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
7957ce4d
Commit
7957ce4d
authored
9 years ago
by
Hauke Petersen
Browse files
Options
Downloads
Patches
Plain Diff
cpu/msp430fxyz: s/TIMER_DEV/TIMER_BASE/
parent
7f74c41c
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cpu/msp430fxyz/periph/timer.c
+16
-16
16 additions, 16 deletions
cpu/msp430fxyz/periph/timer.c
with
16 additions
and
16 deletions
cpu/msp430fxyz/periph/timer.c
+
16
−
16
View file @
7957ce4d
...
...
@@ -37,7 +37,7 @@ static void (*isr_cb)(int chan);
int
timer_init
(
tim_t
dev
,
unsigned
int
us_per_tick
,
void
(
*
callback
)(
int
))
{
/* using fixed TIMER_
DEV
for now */
/* using fixed TIMER_
BASE
for now */
if
(
dev
!=
0
)
{
return
-
1
;
}
...
...
@@ -47,23 +47,23 @@ int timer_init(tim_t dev, unsigned int us_per_tick, void (*callback)(int))
}
/* reset the timer A configuration */
TIMER_
DEV
->
CTL
=
TIMER_CTL_CLR
;
TIMER_
BASE
->
CTL
=
TIMER_CTL_CLR
;
/* save callback */
isr_cb
=
callback
;
/* configure timer to use the SMCLK with prescaler of 8 */
TIMER_
DEV
->
CTL
=
(
TIMER_CTL_TASSEL_SMCLK
|
TIMER_CTL_ID_DIV8
);
TIMER_
BASE
->
CTL
=
(
TIMER_CTL_TASSEL_SMCLK
|
TIMER_CTL_ID_DIV8
);
/* configure CC channels */
for
(
int
i
=
0
;
i
<
TIMER_CHAN
;
i
++
)
{
TIMER_
DEV
->
CCTL
[
i
]
=
0
;
TIMER_
BASE
->
CCTL
[
i
]
=
0
;
}
/* start the timer in continuous mode */
TIMER_
DEV
->
CTL
|=
TIMER_CTL_MC_CONT
;
TIMER_
BASE
->
CTL
|=
TIMER_CTL_MC_CONT
;
return
0
;
}
int
timer_set
(
tim_t
dev
,
int
channel
,
unsigned
int
timeout
)
{
uint16_t
target
=
TIMER_
DEV
->
R
+
(
uint16_t
)
timeout
;
uint16_t
target
=
TIMER_
BASE
->
R
+
(
uint16_t
)
timeout
;
return
timer_set_absolute
(
dev
,
channel
,
(
unsigned
int
)
target
);
}
...
...
@@ -72,9 +72,9 @@ int timer_set_absolute(tim_t dev, int channel, unsigned int value)
if
(
dev
!=
0
||
channel
>
TIMER_CHAN
)
{
return
-
1
;
}
TIMER_
DEV
->
CCR
[
channel
]
=
value
;
TIMER_
DEV
->
CCTL
[
channel
]
&=
~
(
TIMER_CCTL_CCIFG
);
TIMER_
DEV
->
CCTL
[
channel
]
|=
(
TIMER_CCTL_CCIE
);
TIMER_
BASE
->
CCR
[
channel
]
=
value
;
TIMER_
BASE
->
CCTL
[
channel
]
&=
~
(
TIMER_CCTL_CCIFG
);
TIMER_
BASE
->
CCTL
[
channel
]
|=
(
TIMER_CCTL_CCIE
);
return
0
;
}
...
...
@@ -83,23 +83,23 @@ int timer_clear(tim_t dev, int channel)
if
(
dev
!=
0
||
channel
>
TIMER_CHAN
)
{
return
-
1
;
}
TIMER_
DEV
->
CCTL
[
channel
]
&=
~
(
TIMER_CCTL_CCIE
);
TIMER_
BASE
->
CCTL
[
channel
]
&=
~
(
TIMER_CCTL_CCIE
);
return
0
;
}
unsigned
int
timer_read
(
tim_t
dev
)
{
return
(
unsigned
int
)
TIMER_
DEV
->
R
;
return
(
unsigned
int
)
TIMER_
BASE
->
R
;
}
void
timer_start
(
tim_t
dev
)
{
TIMER_
DEV
->
CTL
|=
TIMER_CTL_MC_CONT
;
TIMER_
BASE
->
CTL
|=
TIMER_CTL_MC_CONT
;
}
void
timer_stop
(
tim_t
dev
)
{
TIMER_
DEV
->
CTL
&=
~
(
TIMER_CTL_MC_MASK
);
TIMER_
BASE
->
CTL
&=
~
(
TIMER_CTL_MC_MASK
);
}
void
timer_irq_enable
(
tim_t
dev
)
...
...
@@ -121,14 +121,14 @@ void timer_irq_disable(tim_t dev)
void
timer_reset
(
tim_t
dev
)
{
TIMER_
DEV
->
R
=
0
;
TIMER_
BASE
->
R
=
0
;
}
ISR
(
TIMER_ISR_CC0
,
isr_timer_a_cc0
)
{
__enter_isr
();
TIMER_
DEV
->
CCTL
[
0
]
&=
~
(
TIMER_CCTL_CCIE
);
TIMER_
BASE
->
CCTL
[
0
]
&=
~
(
TIMER_CCTL_CCIE
);
isr_cb
(
0
);
__exit_isr
();
...
...
@@ -139,7 +139,7 @@ ISR(TIMER_ISR_CCX, isr_timer_a_ccx)
__enter_isr
();
int
chan
=
(
int
)(
TIMER_IVEC
->
TAIV
>>
1
);
TIMER_
DEV
->
CCTL
[
chan
]
&=
~
(
TIMER_CCTL_CCIE
);
TIMER_
BASE
->
CCTL
[
chan
]
&=
~
(
TIMER_CCTL_CCIE
);
isr_cb
(
chan
);
__exit_isr
();
...
...
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