patacongo commented on pull request #1705:
URL: https://github.com/apache/incubator-nuttx/pull/1705#issuecomment-687653103


   > 
   > 
   > Is the oneshot supposed to keep counting after it fires? I understand that 
oneshot fires once but at least stm32_oneshot.c stops counting. So implementing 
up_timer_gettime() as arch_alarm.c does:
   > 
   > int up_timer_gettime(FAR struct timespec *ts)
   > {
   >   int ret = -EAGAIN;
   > 
   >   if (g_oneshot_lower != NULL)
   >     {
   >       ret = ONESHOT_CURRENT(g_oneshot_lower, ts);
   >     }
   > 
   >   return ret;
   > }
   > 
   > would only work if the timer continues to run AND it handles wrap-around 
by adding one period on overflow and returns this monotonic value on 
ONESHOT_CURRENT(). Neither of those two conditions are met in stm32_oneshot.c. 
So is stm32_oneshot.c wrong or is that not how oneshot should work?
   
   Yes, resetting and stopping the timer is the correct behavior for a oneshot 
timer.  I expect that that all of the implementations do that.
   
   My suspicion from what you say is that the those arch drivers are not 
compatible with the existing MCU architectures.  They are not used by any of 
the existing architectures in the repository; they are used only by Xiaomi 
hardware.  They have probably implemented an incompatible version of the one 
shot driver for their purposes and those arch drivers may not be usable by 
other architectures.
   
   I am completely unfamiliar with those drivers.  I have never used them or 
even looked at them.  You would have to discuss this with Xiaomi to see if they 
are using some non-standard oneshot driver.  I don't know what we should do if 
they are.  Certainly we do not want to corrupt the semantics of the oneshot 
driver.
   


----------------------------------------------------------------
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.

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


Reply via email to