2015-04-11 07:44:37 +08:00
|
|
|
/* advidle.h - header file for custom advanced idle manager */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Copyright (c) 2012-2014 Wind River Systems, Inc.
|
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
* You may obtain a copy of the License at
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
2015-10-07 00:00:37 +08:00
|
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
* See the License for the specific language governing permissions and
|
|
|
|
* limitations under the License.
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
/*
|
|
|
|
DESCRIPTION
|
|
|
|
This header file specifies the custom advanced idle management interface.
|
|
|
|
All of the APIs declared here must be supplied by the custom advanced idle
|
|
|
|
management system, namely the _AdvIdleCheckSleep(), _AdvIdleFunc()
|
|
|
|
and _AdvIdleStart() functions.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef __INCadvidle
|
|
|
|
#define __INCadvidle
|
|
|
|
|
|
|
|
#ifdef CONFIG_ADVANCED_IDLE
|
|
|
|
|
|
|
|
/*
|
2015-07-02 05:51:40 +08:00
|
|
|
* @brief Determine if advanced sleep has occurred
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
|
|
|
* This routine checks if the system is recovering from advanced
|
|
|
|
* sleep or cold booting.
|
|
|
|
*
|
2015-07-02 05:29:04 +08:00
|
|
|
* @return 0 if the system is cold booting on a non-zero
|
2015-04-11 07:44:37 +08:00
|
|
|
* value if the system is recovering from advanced sleep.
|
|
|
|
*/
|
|
|
|
|
|
|
|
extern int _AdvIdleCheckSleep(void);
|
|
|
|
|
|
|
|
/*
|
2015-07-02 05:51:40 +08:00
|
|
|
* @brief Continue kernel start-up or awaken kernel from sleep
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
|
|
|
* This routine checks if the system is recovering from advanced sleep and
|
|
|
|
* either continues the kernel's cold boot sequence at _Cstart or resumes
|
|
|
|
* kernel operation at the point it went to sleep; in the latter case, control
|
|
|
|
* passes to the _AdvIdleFunc() that put the system to sleep, which then
|
|
|
|
* finishes executing.
|
|
|
|
*
|
2015-10-21 00:42:33 +08:00
|
|
|
* @param _Cstart the address of the _Cstart function
|
|
|
|
* @param _gdt the address of the global descriptor table in RAM
|
|
|
|
* @param _GlobalTss the address of the TSS descriptor
|
|
|
|
*
|
2015-07-02 05:29:04 +08:00
|
|
|
* @return does not return to caller
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-10-21 00:42:33 +08:00
|
|
|
extern void _AdvIdleStart(void (*_Cstart)(void), void *_gdt, void *_GlobalTss);
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
/*
|
2015-07-02 05:51:40 +08:00
|
|
|
* @brief Perform advanced sleep
|
2015-04-11 07:44:37 +08:00
|
|
|
*
|
|
|
|
* This routine checks if the upcoming kernel idle interval is sufficient to
|
|
|
|
* justify entering advanced sleep mode. If it is, the routine puts the system
|
|
|
|
* to sleep and then later allows it to resume processing; if not, the routine
|
|
|
|
* returns immediately without sleeping.
|
|
|
|
*
|
2015-10-21 00:42:33 +08:00
|
|
|
* @param ticks the upcoming kernel idle time
|
|
|
|
*
|
2015-07-02 05:29:04 +08:00
|
|
|
* @return non-zero if advanced sleep occurred; otherwise zero
|
2015-04-11 07:44:37 +08:00
|
|
|
*/
|
|
|
|
|
2015-10-21 00:42:33 +08:00
|
|
|
extern int _AdvIdleFunc(int32_t ticks);
|
2015-04-11 07:44:37 +08:00
|
|
|
|
|
|
|
#endif /* CONFIG_ADVANCED_IDLE */
|
|
|
|
|
|
|
|
#endif /* __INCadvidle */
|