xiaoxiang781216 commented on code in PR #15079:
URL: https://github.com/apache/nuttx/pull/15079#discussion_r1887213957
##########
drivers/timers/capture.c:
##########
@@ -391,6 +391,23 @@ static int cap_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
default:
{
cperr("Forwarding unrecognized cmd: %d arg: %ld\n", cmd, arg);
+
+ /* Unrecognized cmd will be forwarded to lower half driver for
+ * specific use cases (e.g Pulse Counter (PCNT))
+ */
+
+ FAR long unsigned int *ptr =
+ (FAR long unsigned int *)arg;
+ for (i = 0; i < upper->nchan; i++)
+ {
+ DEBUGASSERT(lower[i]->ops->ioctl != NULL);
Review Comment:
need skip instead assert to keep the backward compatibility
##########
drivers/timers/capture.c:
##########
@@ -391,6 +391,23 @@ static int cap_ioctl(FAR struct file *filep, int cmd,
unsigned long arg)
default:
{
cperr("Forwarding unrecognized cmd: %d arg: %ld\n", cmd, arg);
+
+ /* Unrecognized cmd will be forwarded to lower half driver for
+ * specific use cases (e.g Pulse Counter (PCNT))
+ */
+
+ FAR long unsigned int *ptr =
Review Comment:
`long unsigned int` to `unsigned long int`
##########
include/nuttx/timers/capture.h:
##########
@@ -40,6 +40,11 @@
#define CAPIOC_FREQUENCE _CAPIOC(2)
#define CAPIOC_EDGES _CAPIOC(3)
#define CAPIOC_ALL _CAPIOC(4)
+#define CAPIOC_PULSES _CAPIOC(5)
+#define CAPIOC_CLR_CNT _CAPIOC(6)
Review Comment:
what's different from stop and then start?
##########
include/nuttx/timers/capture.h:
##########
@@ -40,6 +40,11 @@
#define CAPIOC_FREQUENCE _CAPIOC(2)
#define CAPIOC_EDGES _CAPIOC(3)
#define CAPIOC_ALL _CAPIOC(4)
+#define CAPIOC_PULSES _CAPIOC(5)
Review Comment:
can you add callback to cap_ops_s or explain how each ioctl work and which
argument it accepts?
--
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]