MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / rt_pm_run_enter

Function rt_pm_run_enter

components/drivers/pm/pm.c:938–971  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

936}
937
938rt_err_t rt_pm_run_enter(rt_uint8_t mode)
939{
940 rt_base_t level = 0;
941 struct rt_pm *pm = RT_NULL;
942 rt_err_t ret = RT_EOK;
943
944 if (_pm_init_flag == 0)
945 return -RT_EIO;
946
947 if (mode > PM_RUN_MODE_MAX)
948 return -RT_EINVAL;
949
950 pm = &_pm;
951
952 level = rt_hw_interrupt_disable();
953 if (mode < pm->run_mode)
954 {
955 /* change system runing mode */
956 if(pm->ops != RT_NULL && pm->ops->run != RT_NULL)
957 {
958 pm->ops->run(pm, mode);
959 }
960 /* changer device frequency */
961 _pm_device_frequency_change(mode);
962 }
963 else
964 {
965 pm->flags |= RT_PM_FREQUENCY_PENDING;
966 }
967 pm->run_mode = mode;
968 rt_hw_interrupt_enable(level);
969
970 return ret;
971}
972
973#ifdef RT_USING_DEVICE_OPS
974const static struct rt_device_ops pm_ops =

Callers 2

rt_pm_run_mode_switchFunction · 0.85
pm_run_mainFunction · 0.85

Calls 4

rt_hw_interrupt_disableFunction · 0.50
rt_hw_interrupt_enableFunction · 0.50
runMethod · 0.45

Tested by 1

pm_run_mainFunction · 0.68