Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Z
Zephyr Firmware
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kestrel Collaboration
Kestrel Firmware
Zephyr Firmware
Commits
8104ca0b
Commit
8104ca0b
authored
Mar 14, 2021
by
Evan Lojewski
Committed by
Raptor Engineering Development Team
Mar 20, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
i2c: Don't allow negative cpu counts.
parent
4cf395d4
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
14 deletions
+14
-14
main.c
main.c
+14
-14
No files found.
main.c
View file @
8104ca0b
...
...
@@ -89,7 +89,7 @@ static hiomap_configuration_data_t hiomap_config;
// Background service tasks
static
uint8_t
host_background_service_task_active
=
0
;
static
uint8_t
host_console_service_task_active
=
0
;
static
int
configured_cpu_count
=
0
;
static
int
configured_cpu_count
=
1
;
// POST codes
uint8_t
post_code_high
=
0
;
...
...
@@ -103,6 +103,7 @@ typedef struct
{
int8_t
index
;
uint8_t
*
i2c_master
;
uint32_t
i2c_frequency
;
uint8_t
vdd_regulator_addr
;
uint8_t
vdn_regulator_addr
;
uint8_t
vdd_smbus_addr
;
...
...
@@ -112,6 +113,7 @@ static const cpu_info_t g_cpu_info[] = {
{
.
index
=
0
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER1_BASE
,
.
i2c_frequency
=
100000
,
.
vdd_regulator_addr
=
0x70
,
.
vdn_regulator_addr
=
0x73
,
.
vdd_smbus_addr
=
0x28
,
...
...
@@ -122,6 +124,7 @@ static const cpu_info_t g_cpu_info[] = {
{
.
index
=
1
,
.
i2c_master
=
(
uint8_t
*
)
I2CMASTER2_BASE
,
.
i2c_frequency
=
100000
,
.
vdd_regulator_addr
=
0x70
,
.
vdn_regulator_addr
=
0x73
,
.
vdd_smbus_addr
=
0x28
,
...
...
@@ -1419,13 +1422,12 @@ static int apply_avsbus_workarounds(const cpu_info_t *cpu_info, int cpu_count)
{
printf
(
"Applying AVSBus workarounds...
\n
"
);
while
(
--
cpu_count
)
for
(
int
i
=
0
;
i
<
cpu_count
;
i
++
)
{
if
(
apply_avsbus_workarounds_cpu
(
&
cpu_info
[
0
]))
if
(
apply_avsbus_workarounds_cpu
(
&
cpu_info
[
i
]))
{
return
-
1
;
}
cpu_info
++
;
}
printf
(
"
\t
AVSBus workaround application complete!
\n
"
);
...
...
@@ -1471,13 +1473,12 @@ static int enable_avsbus_pmbus(const cpu_info_t *cpu_info, int cpu_count)
{
printf
(
"Enabling AVSbus PMBUS functionality...
\n
"
);
while
(
--
cpu_count
)
for
(
int
i
=
0
;
i
<
cpu_count
;
i
++
)
{
if
(
enable_avsbus_pmbus_cpu
(
&
cpu_info
[
0
]))
if
(
enable_avsbus_pmbus_cpu
(
&
cpu_info
[
i
]))
{
return
-
1
;
}
cpu_info
++
;
}
printf
(
"
\t
AVSBus PMBUS functionality enabled!
\n
"
);
...
...
@@ -1523,14 +1524,13 @@ static int disable_avsbus_pmbus(const cpu_info_t *cpu_info, int cpu_count)
int
status
=
0
;
printf
(
"Disabling AVSbus PMBUS functionality...
\n
"
);
while
(
--
cpu_count
)
for
(
int
i
=
0
;
i
<
cpu_count
;
i
++
)
{
// Attempt to turn of power on all CPUs, even if one isn't responding.
if
(
disable_avsbus_pmbus_cpu
(
&
cpu_info
[
0
]))
if
(
disable_avsbus_pmbus_cpu
(
&
cpu_info
[
i
]))
{
status
=
-
1
;
}
cpu_info
++
;
}
printf
(
"
\t
AVSBus PMBUS functionality disabled!
\n
"
);
...
...
@@ -2428,10 +2428,10 @@ int main(void)
display_character
(
0x30
,
0
);
// STATUS CODE: 0
initialize_i2c_master
((
uint8_t
*
)
I2CMASTER1_BASE
,
100000
);
#ifdef I2CMASTER2_BASE
initialize_i2c_master
((
uint8_t
*
)
I2CMASTER2_BASE
,
100000
);
#endif
for
(
int
i
=
0
;
i
<
MAX_CPUS_SUPPORTED
;
i
++
)
{
initialize_i2c_master
(
g_cpu_info
[
i
].
i2c_master
,
g_cpu_info
[
i
].
i2c_frequency
);
}
// initialize_i2c_master((uint8_t*)I2CMASTER3_BASE, 100000);
initialize_i2c_master
((
uint8_t
*
)
I2CMASTER4_BASE
,
100000
);
...
...
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