-
Notifications
You must be signed in to change notification settings - Fork 585
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
apps/testcase/systemio/itc: add new UART TCs #5050
base: master
Are you sure you want to change the base?
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
- add new APIs in iotbus to test UART TCs, APIs are: iotbus_uart_rxavailable() iotbus_uart_txready() iotbus_uart_txempty() - add new TCs to test UART rxavailable, txready and txempty APIs. Signed-off-by: Deepak Sharma <[email protected]>
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -175,6 +175,8 @@ | |
*/ | ||
|
||
static serial_t* sdrv[MAX_UART_INDEX + 1] = {NULL, NULL, NULL, NULL, NULL}; //uart 0~3, uart2 is configured as log uart | ||
static bool g_tc_rxavailable; | ||
static bool g_tc_rxavailable_res; // used to hold the result of rxavailable TC | ||
Comment on lines
+178
to
+179
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't agree adding codes here for tc. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. please check my comment below and let me know what you think? |
||
|
||
struct rtl8721d_up_dev_s { | ||
uint8_t parity; /* 0=none, 1=odd, 2=even */ | ||
|
@@ -571,6 +573,22 @@ static int rtl8721d_up_ioctl(FAR struct uart_dev_s *dev, int cmd, unsigned long | |
serial_control_loopback(sdrv[uart_index_get(priv->tx)], *(bool *)arg); | ||
break; | ||
|
||
case TIOCS_AVAIL: | ||
g_tc_rxavailable = 1; | ||
g_tc_rxavailable_res = 0; | ||
rtl8721d_up_send(dev, 'a'); | ||
sleep(1); | ||
ret = g_tc_rxavailable_res; | ||
Comment on lines
+577
to
+581
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't know what you want to do. Could you leave comment to explain? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. for rxavailable TC, my approach is:
please let me know what you think about this approach. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @kishore-sn @sangam-swami @jeongchanKim please review this PR. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. How about changing this implementation as follows:
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. On the other hand, I think we can change it further to make the code much cleaner. In the driver we do: In the test case file we do: There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. we can not do like this:
because when we sent the data in loopback mode then it comes on the RX FIFO immediately and generates the interrupt,
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ok.
And in rtl8721d_up_rxavailable()
|
||
break; | ||
|
||
case TIOCS_READY: | ||
ret = rtl8721d_up_txready(dev); | ||
break; | ||
|
||
case TIOCS_EMPTY: | ||
ret = rtl8721d_up_txempty(dev); | ||
break; | ||
Comment on lines
+576
to
+590
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. will add this in other boards after finalizing for this board |
||
|
||
default: | ||
ret = -ENOTTY; | ||
break; | ||
|
@@ -628,8 +646,17 @@ static void rtl8721d_up_rxint(struct uart_dev_s *dev, bool enable) | |
|
||
static bool rtl8721d_up_rxavailable(struct uart_dev_s *dev) | ||
{ | ||
bool ret = 0; | ||
struct rtl8721d_up_dev_s *priv = (struct rtl8721d_up_dev_s *)dev->priv; | ||
DEBUGASSERT(priv); | ||
if (g_tc_rxavailable) { | ||
ret = (serial_readable(sdrv[uart_index_get(priv->tx)])); | ||
if (!g_tc_rxavailable_res) { | ||
g_tc_rxavailable_res = ret; | ||
g_tc_rxavailable = 0; | ||
} | ||
return ret; | ||
} | ||
return (serial_readable(sdrv[uart_index_get(priv->tx)])); | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add a comment explaining the meaning of this variable.