Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
W
White Rabbit Switch - Software
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
86
Issues
86
List
Board
Labels
Milestones
Merge Requests
4
Merge Requests
4
CI / CD
CI / CD
Pipelines
Schedules
Wiki
Wiki
image/svg+xml
Discourse
Discourse
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
Projects
White Rabbit Switch - Software
Commits
0bc237b6
Commit
0bc237b6
authored
Jan 30, 2013
by
Benoit Rat
Committed by
Alessandro Rubini
Apr 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswitchhw: improve pwm fan control
parent
78719448
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
7 deletions
+4
-7
fan.c
userspace/libswitchhw/fan.c
+4
-7
No files found.
userspace/libswitchhw/fan.c
View file @
0bc237b6
...
...
@@ -141,11 +141,8 @@ void pwm_configure_fpga(int enmask, float rate)
{
uint8_t
u8speed
=
(
uint8_t
)((
rate
>=
1
)
?
0xff
:
(
rate
*
255
.
0
));
if
(
enmask
&
0x1
)
spwm_wbr
->
DR0
=
u8speed
;
else
spwm_wbr
->
DR0
=
0
;
if
(
enmask
&
0x2
)
spwm_wbr
->
DR1
=
u8speed
;
else
spwm_wbr
->
DR0
=
0
;
if
((
enmask
&
0x1
)
>
0
)
spwm_wbr
->
DR0
=
u8speed
;
if
((
enmask
&
0x2
)
>
0
)
spwm_wbr
->
DR1
=
u8speed
;
}
/* Configures a PWM output. Rate accepts range is from 0 (0%) to 1 (100%) */
...
...
@@ -241,8 +238,8 @@ int shw_init_fans()
//Point to the corresponding WB direction
spwm_wbr
=
(
volatile
struct
SPWM_WB
*
)
(
FPGA_BASE_ADDR
+
FPGA_BASE_SPWM
);
//Configure SPWM register the
60=(62.5MHz÷(4
kHz×2^8))−1
val
=
SPWM_CR_PRESC_W
(
6
0
)
|
SPWM_CR_PERIOD_W
(
255
);
//Configure SPWM register the
30~=(62.5MHz÷(8
kHz×2^8))−1
val
=
SPWM_CR_PRESC_W
(
3
0
)
|
SPWM_CR_PERIOD_W
(
255
);
spwm_wbr
->
CR
=
val
;
fan_pi
.
ki
=
1
.
0
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment