ppisa commented on code in PR #18039:
URL: https://github.com/apache/nuttx/pull/18039#discussion_r2712452692


##########
drivers/can/ctucanfd_pci.c:
##########
@@ -800,6 +803,70 @@ static int ctucanfd_chrdev_txconfirm(struct can_dev_s 
*dev, int idx)
 }
 #endif
 
+/*****************************************************************************
+ * Name: ctucanfd_chrdev_cancel
+ *
+ * Description:
+ *   Cancel one can message.
+ *
+ * Input Parameters:
+ *   dev - An instance of the "upper half" can driver state structure.
+ *   msg - One can message.
+ *
+ * Returned Value:
+ *   true on success; zero on failure.
+ *****************************************************************************/
+
+static bool ctucanfd_chrdev_cancel(FAR struct can_dev_s *dev,
+                                   FAR struct can_msg_s *msg)
+{
+  FAR struct ctucanfd_can_s *priv = (FAR struct ctucanfd_can_s *)dev;
+  uint32_t regval;
+  uint32_t offset;
+  uint32_t id;
+  int i;
+
+  /* Find TXB to be canceled */
+
+  for (i = 0; i < CTUCANFD_TXBUF_CNT; i++)
+    {
+      offset = CTUCANFD_TXT1 + CTUCANFD_TXT_SIZE * i;
+      id = ctucanfd_getreg(priv, offset + CTUCANFD_TXBUF_ID);

Review Comment:
   When I have looked at code again, I see another problem. The Tx buffers area 
is write only on real CTU CAN FD IP core integrated into chips to reduce memory 
read ports count.
   
   So it would worth to keep IDs in some array as is  `tx_idbuf` and it should 
be enabled unconditionally or when one or both of cancel and Tx confirm are 
enabled. Then the ID should be compared with copy in the driver private 
structure there. It would be even faster, peripheral access on AXI is much 
slower.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to