Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
L
lpc1769
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
Model registry
Operate
Environments
Monitor
Incidents
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
Per Lindgren
lpc1769
Commits
5e26bd68
Commit
5e26bd68
authored
7 years ago
by
Per
Browse files
Options
Downloads
Patches
Plain Diff
refactoring
parent
ba957c1f
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
examples/zero-tasks.rs
+24
-42
24 additions, 42 deletions
examples/zero-tasks.rs
with
24 additions
and
42 deletions
examples/zero-tasks.rs
+
24
−
42
View file @
5e26bd68
...
...
@@ -33,51 +33,21 @@ fn pll0_feed_sequence(syscon: &lpc176x5x::SYSCON) {
.write
(|
w
|
unsafe
{
w
.pll0feed
()
.bits
(
0x55
)
});
}
// The initialization phase.
//
// This runs first and within a *global* critical section. Nothing can preempt
// this function.
fn
init
(
p
:
init
::
Peripherals
)
{
// use lpc176x5x::syscon::clksrcsel::*;
// use lpc176x5x::syscon::scs::*;
// use lpc176x5x::syscon::clkoutcfg::*;
// This function has access to all the peripherals of the device
let
itm
=
p
.ITM
;
iprintln!
(
&
itm
.stim
[
0
],
"1769 init"
);
// let r = p.SYSCON.clksrcsel.read().clksrc();
// match r {
// CLKSRCR::SELECTS_THE_INTERNAL => rtfm::bkpt(),
// _ => rtfm::bkpt(),
// }
// sets the main clock to 100Mhz, buses to 25Mhz
fn
clk_init
(
p
:
&
init
::
Peripherals
)
{
// setup clock output to p1.27
p
.SYSCON
.clkoutcfg
.write
(|
w
|
w
.clkoutsel
()
.selects_the_cpu_cloc
()
.clkout_en
()
.set_bit
());
iprintln!
(
&
itm
.stim
[
0
],
"CLKSRSEL {:?}"
,
p
.SYSCON.clksrcsel
.read
()
.clksrc
()
);
iprintln!
(
&
itm
.stim
[
0
],
"CLKOUTDIV {:?}"
,
p
.SYSCON.clkoutcfg
.read
()
.clkoutdiv
()
.bits
()
);
// connect (rout) cklout to p1.27
p
.PINCONNECT.pinsel3
.write
(|
w
|
w
.p1_27
()
.clkout
());
// set the pin direction to output
p
.GPIO.dir1
.write
(|
w
|
w
.pindir27
()
.set_bit
());
// enable external oscillator, and spinwait until ready
let
mut
x
=
0
;
p
.SYSCON.scs
.write
(|
w
|
w
.oscen
()
.enabled
());
while
p
.SYSCON.scs
.read
()
.oscstat
()
.is_not_ready
()
{
x
+=
1
;
}
while
p
.SYSCON.scs
.read
()
.oscstat
()
.is_not_ready
()
{}
p
.SYSCON.cclkcfg
.write
(|
w
|
unsafe
{
w
.cclksel
()
.bits
(
3
)
});
// PLL0 / 4
...
...
@@ -108,10 +78,8 @@ fn init(p: init::Peripherals) {
pll0_feed_sequence
(
&
p
.SYSCON
);
// wait until PLL0 locked
x
=
0
;
while
p
.SYSCON.pll0stat
.read
()
.plock0
()
.bit_is_clear
()
{
x
+=
1
;
}
while
p
.SYSCON.pll0stat
.read
()
.plock0
()
.bit_is_clear
()
{}
// enable and connect PLL0
p
.SYSCON
.pll0con
...
...
@@ -120,19 +88,33 @@ fn init(p: init::Peripherals) {
pll0_feed_sequence
(
&
p
.SYSCON
);
// wait until PLL0 both connected and enabled
x
=
0
;
while
p
.SYSCON.pll0stat
.read
()
.plle0_stat
()
.bit_is_clear
()
||
p
.SYSCON.pll0stat
.read
()
.pllc0_stat
()
.bit_is_clear
()
{
x
+=
1
;
{}
// we are not using USB so PLL1 is left disabled
}
iprintln!
(
&
itm
.stim
[
0
],
"-- here -- {}"
,
x
);
// The initialization phase.
//
// This runs first and within a *global* critical section. Nothing can preempt
// this function.
fn
init
(
p
:
init
::
Peripherals
)
{
clk_init
(
&
p
);
let
itm
=
p
.ITM
;
iprintln!
(
&
itm
.stim
[
0
],
"-- Running at 100Mhz -- "
);
rtfm
::
bkpt
();
// use lpc176x5x::syscon::clksrcsel::*;
// use lpc176x5x::syscon::scs::*;
// use lpc176x5x::syscon::clkoutcfg::*;
// This function has access to all the peripherals of the device
// setup ethernet mac
}
// The idle loop.
//
// This runs after `init` and has a priority of 0. All tasks can preempt this
...
...
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