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

iio: iio_app: simplify uart print + don't overwrite status-code in iio_app_init() on the error path #2329

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

commodo
Copy link
Contributor

@commodo commodo commented Oct 4, 2024

Pull Request Description

Two changes done during the development of the ad7606x-fmc project

PR Type

  • Bug fix (change that fixes an issue)
  • New feature (change that adds new functionality)
  • Breaking change (has dependencies in other repos or will cause CI to fail)

PR Checklist

  • I have followed the Coding style guidelines
  • I have performed a self-review of the changes
  • I have commented my code, at least hard-to-understand parts
  • I have build all projects affected by the changes in this PR
  • I have tested in hardware affected projects, at the relevant boards
  • I have signed off all commits from this PR
  • I have updated the documentation (wiki pages, ReadMe etc), if applies

The status code on the error path is pretty useful.
Don't overwrite it.

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
For one thing, printing any message with 'iio_print_uart_info_message()'
will needlessly reset the already initialized uart_desc object.

Then the delay for the xfer rate seems un-needed.

The 'no_os_uart_write()' should handle all this properly.

Signed-off-by: Alexandru Ardelean <aardelean@baylibre.com>
no_os_mdelay(delay_ms);

/** Reinitialize UART with parameters required by the IIO application */
no_os_uart_remove(*uart_desc);
Copy link
Contributor

Choose a reason for hiding this comment

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

IIRC this was needed and is still needed because there is no API to change baudrate once the UART was initialized. And sometimes the iiod runs at higher baudrate than the iio greeting message. I think adding an UART baudrate change API would be the proper way to address this mess.

And because there was no API, we had to "needlessly" _remove() and _init() with a delay in between because on fast processors or slow UARTs or both, you'd see a partial iio greeting message.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

so, if that's the case then i'd need to re-visit this

because the no_os_uart_remove() + no_os_uart_init() doesn't seem to initialize properly;
some init_data gets lost

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.

2 participants