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
2b7fadba
Commit
2b7fadba
authored
Jan 30, 2013
by
Benoit Rat
Committed by
Alessandro Rubini
Feb 18, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
libswitchhw: return version as integer to ensure comparison
parent
40deb0eb
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
13 additions
and
11 deletions
+13
-11
fan.c
userspace/libswitchhw/fan.c
+1
-1
i2c_io.c
userspace/libswitchhw/i2c_io.c
+5
-5
i2c_io.h
userspace/libswitchhw/i2c_io.h
+1
-1
shw_io.c
userspace/libswitchhw/shw_io.c
+6
-4
No files found.
userspace/libswitchhw/fan.c
View file @
2b7fadba
...
...
@@ -217,7 +217,7 @@ int shw_init_fans()
TRACE
(
TRACE_INFO
,
"Configuring PWMs for fans (desired temperature = %.1f degC)..."
,
DESIRED_TEMPERATURE
);
//Set the type of PWM
if
(
shw_get_hw_ver
()
<
3
.
3
)
is_cpu_pwn
=
1
;
if
(
shw_get_hw_ver
()
<
3
30
)
is_cpu_pwn
=
1
;
else
is_cpu_pwn
=
0
;
if
(
is_cpu_pwn
)
...
...
userspace/libswitchhw/i2c_io.c
View file @
2b7fadba
...
...
@@ -102,7 +102,7 @@ int shw_i2c_io_scan(uint8_t *dev_map)
}
floa
t
shw_get_hw_ver
()
in
t
shw_get_hw_ver
()
{
uint8_t
ret
;
struct
i2c_bus
*
bus
=
&
i2c_io_bus
;
...
...
@@ -114,9 +114,9 @@ float shw_get_hw_ver()
ret
=
wrswhw_pca9554_get_input
(
bus
,
I2C_SCB_VER_ADDR
);
switch
((
ret
>>
1
)
&
0x7
)
{
case
0
:
return
3
.
3
;
case
1
:
return
3
.
4
;
//version is not available
case
2
:
return
3
.
41
;
case
0
:
return
3
30
;
case
1
:
return
3
40
;
//version is not available
case
2
:
return
341
;
default:
TRACE
(
TRACE_FATAL
,
"Unknown HW version (0x%x), check the DIP switch under the SCB"
,(
ret
>>
1
)
&
0x7
);
return
-
1
;
...
...
@@ -127,7 +127,7 @@ float shw_get_hw_ver()
}
else
{
return
3
.
2
;
return
3
20
;
}
}
...
...
userspace/libswitchhw/i2c_io.h
View file @
2b7fadba
...
...
@@ -25,7 +25,7 @@ int shw_i2c_io_scan(uint8_t *dev_map);
uint8_t
shw_i2c_read
(
const
*
i2c_bus
,
uint8_t
addr
);
uint8_t
shw_i2c_write
(
const
*
i2c_bus
,
uint8_t
addr
,
uint8_t
value
,
uint8_t
mask
);
floa
t
shw_get_hw_ver
();
in
t
shw_get_hw_ver
();
uint8_t
shw_get_fpga_type
();
#endif //I2C_SFP_H
userspace/libswitchhw/shw_io.c
View file @
2b7fadba
...
...
@@ -69,8 +69,7 @@ const shw_io_t _all_shw_io[NUM_SHW_IO_ID];
int
shw_io_init
()
{
float
ver
;
int
ret
;
int
ret
,
ver
;
//Remove const for writing
shw_io_t
*
all_shw_io
=
(
shw_io_t
*
)
_all_shw_io
;
...
...
@@ -86,7 +85,7 @@ int shw_io_init()
ver
=
shw_get_hw_ver
();
//Finally assigned the input/ouput according to version number.
if
(
ver
<
3
.
3
)
if
(
ver
<
3
30
)
{
IOARR_SET_GPIO
(
shw_io_reset_n
);
IOARR_SET_GPIO
(
shw_io_box_fan_en
);
...
...
@@ -96,6 +95,7 @@ int shw_io_init()
IOARR_SET_GPIO
(
shw_io_led_cpu2
);
IOARR_SET_GPIO
(
shw_io_arm_boot_sel
);
IOARR_SET_GPIO
(
shw_io_arm_gen_but
);
TRACE
(
TRACE_INFO
,
"version=%f %d %d %d"
,
ver
,
ver
>=
3
.
3
f
,
ver
<
3
.
3
f
,
ver
==
3
.
3
f
);
}
else
{
...
...
@@ -234,11 +234,13 @@ int shw_io_write(shw_io_id_t id, uint32_t value)
const
char
*
get_shw_info
(
const
char
cmd
)
{
static
char
str_hwver
[
10
];
int
tmp
;
switch
(
cmd
)
{
case
'p'
:
snprintf
(
str_hwver
,
10
,
"%g"
,
shw_get_hw_ver
());
//generate a non harmful warning with our compiler
tmp
=
shw_get_hw_ver
();
snprintf
(
str_hwver
,
10
,
"%d.%d"
,
tmp
/
100
,
tmp
%
100
);
return
str_hwver
;
case
'f'
:
return
(
shw_get_fpga_type
()
==
SHW_FPGA_LX240T
)
?
"LX240T"
:
"LX130T"
;
...
...
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