Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

udelay.c: Enable providing delay calibration value through CLI #134

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

hrvach
Copy link

@hrvach hrvach commented Mar 20, 2020

This commit implements --delay option to retrieve and provide the calibration
loop delay through the command line. The delay calibration procedure can take
up to few seconds, which adds up when executed a number of times consecutively.
Therefore, this provides a means to execute it only once, and then re-use the
calibrated value on subsequent runs. Also, it implements a sanity check,
expecting the value to land within 10% of the theoretical delay expectance,
otherwise it ignores the provided value and runs the calibration procedure
instead.

    modified:   cli_classic.c
    modified:   flashrom.8.tmpl
    modified:   programmer.h
    modified:   udelay.c

Change-Id: Iea2a7f62300663bc0a32ed4abced57c8c55c90c8
Signed-off-by: Hrvoje Cavrak hrvoje@hrvoje.org

This commit implements --delay option to retrieve and provide the calibration
loop delay through the command line. The delay calibration procedure can take
up to few seconds, which adds up when executed a number of times consecutively.
Therefore, this provides a means to execute it only once, and then re-use the
calibrated value on subsequent runs. Also, it implements a sanity check,
expecting the value to land within 10% of the theoretical delay expectance,
otherwise it ignores the provided value and runs the calibration procedure
instead.

        modified:   cli_classic.c
        modified:   flashrom.8.tmpl
        modified:   programmer.h
        modified:   udelay.c

Change-Id: Iea2a7f62300663bc0a32ed4abced57c8c55c90c8
Signed-off-by: Hrvoje Cavrak <hrvoje@hrvoje.org>
cli_classic.c Outdated
Comment on lines 66 to 67
" -d | --delay <value> set loop delay calibration manually\n"
" --delay get show loop delay calibration\n"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would suggest to rename it since the delay is a bit too generic I think. loop-delay maybe? Also what is the unit of the delay?

But let's move to gerrit and other devs will comment on this I think too.

cli_classic.c Outdated
@@ -156,6 +159,7 @@ int main(int argc, char *argv[])
{"help", 0, NULL, 'h'},
{"version", 0, NULL, 'R'},
{"output", 1, NULL, 'o'},
{"delay", 1, NULL, 'd'},
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The 1, part indentation is misaligned.

udelay.c Outdated
@@ -221,6 +221,25 @@ void myusec_calibrate_delay(void)
msg_pinfo("OK.\n");
}

void set_external_calibration(unsigned long external_micro) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The '{' should go to the next line

udelay.c Outdated
}
}

unsigned long get_calibration_value(void) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The '{' should go to the next line

@hrvach
Copy link
Author

hrvach commented Mar 25, 2020

Fixed, submitted through Gerrit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants