Hi Vipul,

On Tue, Oct 09, 2018 at 12:01:46PM -0700, Vipul Rahane wrote:
> Sorry for the late reply. 

No problem!

> I really like the idea. Thank you for doing this Chris. A much needed
> feature. A possible use case just came to my mind.
> 
> One module might have to be shutdown before shutting down others for
> example: Sensors using I2C/SPI would have to be shut down before
> shutting down the underlying interfaces.
> 
> This is kind of similar to pkg.init levels. I wanted to understand if
> you had any kind of priority in mind.

That is exactly what I had in mind.  I have submitted the relevant PRs
for this feature here:

Newt: https://github.com/apache/mynewt-newt/pull/218
Core: https://github.com/apache/mynewt-core/pull/1447
Nimble: https://github.com/apache/mynewt-nimble/pull/216

The newt PR describes the syntax for configuring a package's sysdown
functions:

    pkg.down:
        <C-function-name>: <stage-number>
e.g.,

    pkg.down:
        ble_hs_shutdown: 200

As with sysinit, sysdown functions are excuted in ascending order of
stage number.  When there are two or more identical stage numbers, the
functions are executed in lexicographic order according to their C
function name.

Thanks,
Chris

Reply via email to