Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Tammo Jan Dijkema
dt_ctrl
Commits
faff5c5e
Commit
faff5c5e
authored
Jun 09, 2015
by
Jeroen Vreeken
Browse files
Change am335x adc programming to use more time if available.
More retries in the same time for vesp commands.
parent
28f20769
Changes
2
Hide whitespace changes
Inline
Side-by-side
controller/am335x/block_am335x_adc.c
View file @
faff5c5e
...
@@ -177,17 +177,25 @@ static struct controller_block * block_am335x_adc_create(char *name, int argc, v
...
@@ -177,17 +177,25 @@ static struct controller_block * block_am335x_adc_create(char *name, int argc, v
factor
=
200000
/
frequency
;
factor
=
200000
/
frequency
;
if
(
factor
>
16
)
{
if
(
factor
>
16
)
{
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_16
;
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_16
;
factor
/=
16
;
}
else
if
(
factor
>
8
)
{
}
else
if
(
factor
>
8
)
{
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_8
;
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_8
;
factor
/=
8
;
}
else
if
(
factor
>
4
)
{
}
else
if
(
factor
>
4
)
{
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_4
;
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_4
;
factor
/=
4
;
}
else
if
(
factor
>
2
)
{
}
else
if
(
factor
>
2
)
{
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_2
;
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_2
;
factor
/=
2
;
}
else
{
}
else
{
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_1
;
avg
=
AM335X_ADC_STEPCONFIG_AVERAGE_1
;
}
}
factor
/=
100
;
if
(
!
factor
)
factor
=
1
;
log_send
(
LOG_T_DEBUG
,
"%s: factor: %d"
,
name
,
factor
);
am335x_write32
(
base
,
AM335X_ADC_REG_ADC_CLKDIV
,
0
);
am335x_write32
(
base
,
AM335X_ADC_REG_ADC_CLKDIV
,
factor
-
1
);
am335x_write32
(
base
,
AM335X_ADC_REG_IDLECONFIG
,
0
);
am335x_write32
(
base
,
AM335X_ADC_REG_IDLECONFIG
,
0
);
am335x_write32
(
base
,
AM335X_ADC_REG_TS_CHARGE_DELAY
,
1
);
am335x_write32
(
base
,
AM335X_ADC_REG_TS_CHARGE_DELAY
,
1
);
...
...
controller/vesp/vesp.c
View file @
faff5c5e
...
@@ -353,7 +353,11 @@ ssize_t vesp_command_real(struct controller_bus *bus,
...
@@ -353,7 +353,11 @@ ssize_t vesp_command_real(struct controller_bus *bus,
struct
timespec
t_timeout
;
struct
timespec
t_timeout
;
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_timeout
);
clock_gettime
(
CLOCK_MONOTONIC
,
&
t_timeout
);
t_timeout
.
tv_sec
+=
1
;
t_timeout
.
tv_nsec
+=
100000000
;
if
(
t_timeout
.
tv_nsec
>
1000000000
)
{
t_timeout
.
tv_nsec
-=
1000000000
;
t_timeout
.
tv_sec
++
;
}
while
(
1
)
{
while
(
1
)
{
struct
timespec
timeout
,
t_now
;
struct
timespec
timeout
,
t_now
;
...
@@ -418,7 +422,7 @@ ssize_t vesp_command(struct controller_bus *bus,
...
@@ -418,7 +422,7 @@ ssize_t vesp_command(struct controller_bus *bus,
void
*
res
,
size_t
res_size
)
void
*
res
,
size_t
res_size
)
{
{
struct
command_data
data
;
struct
command_data
data
;
int
retries
=
3
;
int
retries
=
3
0
;
do
{
do
{
data
.
bus
=
bus
;
data
.
bus
=
bus
;
...
...
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