char driver CAN: add tx_confirm function in upperCAN driver.

add tx_confirm function in upperCAN driver1

Signed-off-by: zhaohaiyang1 <zhaohaiyang1@xiaomi.com>
This commit is contained in:
zhaohaiyang1
2024-06-17 23:03:59 +08:00
committed by Xiang Xiao
parent e2e0706009
commit 534114395e
13 changed files with 45 additions and 27 deletions
+11
View File
@@ -59,6 +59,17 @@ config CAN_NPENDINGRTR
---help---
The size of the list of pending RTR requests. Default: 4
config CAN_TXCONFIRM
bool "can txconfirm ability"
default n
---help---
this section enables the can txconfirm ability.
Enabling this feature adds support for the can txconfirm
ability, the ability is used from CAN interrupt handler
when the transfer is complete, the ability will notify all
readers that the canid has been transferred.
config CAN_TXREADY
bool "can_txready interface"
default n
+10 -3
View File
@@ -408,7 +408,7 @@ static ssize_t can_read(FAR struct file *filep, FAR char *buffer,
#ifdef CONFIG_CAN_EXTID
msg->cm_hdr.ch_extid = 0;
#endif
msg->cm_hdr.ch_unused = 0;
msg->cm_hdr.ch_tcf = 0;
memset(&(msg->cm_data), 0, CAN_ERROR_DLC);
msg->cm_data[5] = fifo->rx_error;
@@ -1219,7 +1219,11 @@ int can_receive(FAR struct can_dev_s *dev, FAR struct can_hdr_s *hdr,
memcpy(&waitmsg->cm_hdr, hdr, sizeof(struct can_hdr_s));
nbytes = can_dlc2bytes(hdr->ch_dlc);
memcpy(waitmsg->cm_data, data, nbytes);
if (nbytes)
{
memcpy(waitmsg->cm_data, data, nbytes);
}
dev->cd_npendrtr--;
/* Restart the waiting thread and mark the entry unused */
@@ -1260,7 +1264,10 @@ int can_receive(FAR struct can_dev_s *dev, FAR struct can_hdr_s *hdr,
sizeof(struct can_hdr_s));
nbytes = can_dlc2bytes(hdr->ch_dlc);
memcpy(fifo->rx_buffer[fifo->rx_tail].cm_data, data, nbytes);
if (nbytes)
{
memcpy(fifo->rx_buffer[fifo->rx_tail].cm_data, data, nbytes);
}
/* Increment the tail of the circular buffer */
+2 -2
View File
@@ -2031,7 +2031,7 @@ static void mcp2515_error(FAR struct can_dev_s *dev, uint8_t status,
#ifdef CONFIG_CAN_EXTID
hdr.ch_extid = 0;
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;
/* And provide the error report to the upper half logic */
@@ -2141,7 +2141,7 @@ static void mcp2515_receive(FAR struct can_dev_s *dev, uint8_t offset)
#ifdef CONFIG_CAN_ERRORS
hdr.ch_error = 0; /* Error reporting not supported */
#endif
hdr.ch_unused = 0;
hdr.ch_tcf = 0;
/* Extract the RTR bit */