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

cdc_acm uart_fifo_fill sample app doesn't comply with the documentation #11455

Closed
kulve opened this issue Nov 17, 2018 · 1 comment

Comments

Projects
None yet
5 participants
@kulve
Copy link

commented Nov 17, 2018

The documentation in
https://github.com/zephyrproject-rtos/zephyr/blob/master/include/uart.h#L378

says:

This function is expected to be called from UART interrupt handler (ISR), if uart_irq_tx_ready() returns true. Result of calling this function not from an ISR is undefined (hardware-dependent). Likewise, not calling this function from an ISR if uart_irq_tx_ready() returns true may lead to undefined behavior, e.g. infinite interrupt loops.

Yet the USB CDC ACM sample app doesn't do this:

https://github.com/zephyrproject-rtos/zephyr/blob/master/samples/subsys/usb/cdc_acm/src/main.c#L50

Assuming the documentation is correct, writing non-compliant sample apps confuses beginners and lead to bad code.

Same applies to uart_fifo_read.

Please correct the sample app.

@carlescufi

This comment has been minimized.

Copy link
Member

commented Nov 20, 2018

@kulve the UART API documentation only applies to real, physical UARTs. Here we are using the UART API to interface with a virtual UART. What we can do is send a PR to the UART documentation that explicitly states that the calling contexts are not applicable for virtual UARTs. Would you like to give it a go and send a PR?

@galak galak added the priority: low label Nov 20, 2018

@carlescufi carlescufi added enhancement and removed bug labels Mar 5, 2019

finikorg added a commit to finikorg/zephyr that referenced this issue Apr 17, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

finikorg added a commit to finikorg/zephyr that referenced this issue Apr 26, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

finikorg added a commit to finikorg/zephyr that referenced this issue Apr 26, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

finikorg added a commit to finikorg/zephyr that referenced this issue Apr 29, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

finikorg added a commit to finikorg/zephyr that referenced this issue Apr 30, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

finikorg added a commit to finikorg/zephyr that referenced this issue May 7, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>

@nashif nashif closed this in cc1b2c7 May 8, 2019

daor-oti added a commit to daor-oti/zephyr that referenced this issue May 10, 2019

uart: doc: Add special case for virtual UART
Add virtual UART exception for uart_fifo_fill().

Fixes zephyrproject-rtos#11455

Signed-off-by: Andrei Emeltchenko <andrei.emeltchenko@intel.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.