Most architectures support a timer library.  The <chip>_oneshot.c file is a wrapper around the library that creates an internal one shot driver.  That oneshot does not depend on the onshot driver and can be used anywhere in the OS architecture-specific code where you need a oneshot.  The <chip>_lowerhalf.c file is another wrapper around the oneshot implementation that implements the lower half of the oneshot character driver that is used only by applications.  So those are different things:  One is for the OS and one is for applications.

That file structure also used to support the tickless mode. Tickless mode may be implemented in one of either two ways:  With one or two timers.  See https://cwiki.apache.org/confluence/display/NUTTX/Tickless+OS

When tickless mode is implemented with a single timer, it is usually in a file called <chip>_tickless.c.  when it is implemented with two timers, it is usually implemented in three files:  <chip>_freerun.c, <chip>_oneshot.c, and <chip>_tickless.c.  If the hardware can support the single timer tickless solution, that is a better way to go.  In most cases, the two timer implementations have been converted to one timer implementations but these two file remain in the directories for the free-running and oneshot timers, but are otherwise not used for tickless mode by the OS.

On 3/16/2021 11:12 AM, Sara da Cunha Monteiro de Souza wrote:
Hi all,

      I've been working on the oneshot driver implementation for ESP32 and
I've noticed that other chips split the implementation into 2 files:

- <chip>_oneshot_lowerhalf.c
- <chip>_oneshot.c

      The second file is not used at all besides the lowerhalf. And the
lowerhalf file seems more like  a wrapper for the API that is
in <chip>_oneshot.c.

       That stated, is it fine if I keep only the lowerhalf file?
        Why the <chip>_oneshot.c was created in the other implementations
instead of only keeping everything on the lowerhalf file?

Thanks in advance for reading it.
My best regards,

Sara


Reply via email to