Hi Robert,

(I'll CC the list, this may be interesting to others)

On 08/31/2017 03:52 PM, Robert Hartung wrote:
> The main problem is that it is NOT sufficient to provide pm_layered and
> periph_pm. As the various CPUs provide different implementations.

Actually, that is sufficient.

> The various defines look something like this:
> 
> cpu/saml21: cpu/cortexm_common, cpu/sam0_common
>   defines pm_set()
> 
> cpu/samd21: cpu/cortexm_common, cpu/sam0_common
>   defines pm_set()
> 
> boards/mulle: cpu/k60
> 
> cpu/k60: cpu/cortexm_common, cpu/kinetis_common
> 
> cpu/cortexm_common:
>   defines pm_set(), pm_set_lowest(), pm_reboot()
> 
> cpu/kinetis_common:
>   defines pm_set()

All of them who define pm_set() support pm_layered.
cortexm_common just provides a fallback for pm_set_lowest() which at
least sets the ARM CPU into idle.

> These are only two examples of conflicts. The question here would be why
> do we have multiple "common" CPUs and where should the sleep modes be
> implemented?

The common cpus are nested, e.g., k60 -> kinetis_common -> cortexm_common.

This is how I envision it:

- if a CPU has a proper pm_set(), it depends on pm_layered
- if not, possibly e.g., kinetis_common has pm_set(), then that should
depend on pm_layered
- if not, the cpu (or e.g., kinetis_common) might depend on
cortexm_periph_pm_fallback (where the current cortexm weak defines
should go)
- if the cpu (or any common ancestor) has it's own way of power
management, it implements pm_set_lowest()
- if not, it depends on periph_pm_fallback (which should wrap current
drivers/periph_common/pm.c)

That should cover all cases, right?

> I guess I could just remove the periph/pm.c from kinetis_common?

Yes! kinetis_common should use the cortexm_fallback, they're equivalent.

Kaspar
_______________________________________________
devel mailing list
devel@riot-os.org
https://lists.riot-os.org/mailman/listinfo/devel

Reply via email to