los_hw.h

浏览该文件的文档。
00001 /*----------------------------------------------------------------------------
00002  * Copyright (c) <2013-2015>, <Huawei Technologies Co., Ltd>
00003  * All rights reserved.
00004  * Redistribution and use in source and binary forms, with or without modification,
00005  * are permitted provided that the following conditions are met:
00006  * 1. Redistributions of source code must retain the above copyright notice, this list of
00007  * conditions and the following disclaimer.
00008  * 2. Redistributions in binary form must reproduce the above copyright notice, this list
00009  * of conditions and the following disclaimer in the documentation and/or other materials
00010  * provided with the distribution.
00011  * 3. Neither the name of the copyright holder nor the names of its contributors may be used
00012  * to endorse or promote products derived from this software without specific prior written
00013  * permission.
00014  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
00015  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
00016  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
00017  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
00018  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
00019  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
00020  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
00021  * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
00022  * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
00023  * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
00024  * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
00025  *---------------------------------------------------------------------------*/
00026 /*----------------------------------------------------------------------------
00027  * Notice of Export Control Law
00028  * ===============================================
00029  * Huawei LiteOS may be subject to applicable export control laws and regulations, which might
00030  * include those applicable to Huawei LiteOS of U.S. and the country in which you are located.
00031  * Import, export and usage of Huawei LiteOS in any manner by you shall be in compliance with such
00032  * applicable export control laws and regulations.
00033  *---------------------------------------------------------------------------*/
00034 
00035  /**@defgroup los_hw hardware
00036    *@ingroup kernel
00037  */
00038 
00039 #ifndef _LOS_HW_H
00040 #define _LOS_HW_H
00041 
00042 #include "los_base.h"
00043 #ifdef __cplusplus
00044 #if __cplusplus
00045 extern "C" {
00046 #endif /* __cplusplus */
00047 #endif /* __cplusplus */
00048 
00049 /**
00050  * @ingroup los_hw
00051  * The initialization value of stack space.
00052  */
00053 #define EMPTY_STACK                 0xCACA
00054 
00055 /**
00056  * @ingroup los_hw
00057  * Trigger a task.
00058  */
00059 #define osTaskTrap()                __asm("   TRAP    #31")
00060 
00061 /**
00062  * @ingroup los_hw
00063  * Check task schedule.
00064  */
00065 #define LOS_CHECK_SCHEDULE          ((!g_usLosTaskLock))
00066 
00067 /**
00068  * @ingroup los_hw
00069  * Define the type of a task context control block.
00070  */
00071 typedef struct tagTskContext
00072 {
00073 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
00074      (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )
00075     UINT32 S16;
00076     UINT32 S17;
00077     UINT32 S18;
00078     UINT32 S19;
00079     UINT32 S20;
00080     UINT32 S21;
00081     UINT32 S22;
00082     UINT32 S23;
00083     UINT32 S24;
00084     UINT32 S25;
00085     UINT32 S26;
00086     UINT32 S27;
00087     UINT32 S28;
00088     UINT32 S29;
00089     UINT32 S30;
00090     UINT32 S31;
00091 #endif
00092     UINT32 uwR4;
00093     UINT32 uwR5;
00094     UINT32 uwR6;
00095     UINT32 uwR7;
00096     UINT32 uwR8;
00097     UINT32 uwR9;
00098     UINT32 uwR10;
00099     UINT32 uwR11;
00100     UINT32 uwPriMask;
00101     UINT32 uwR0;
00102     UINT32 uwR1;
00103     UINT32 uwR2;
00104     UINT32 uwR3;
00105     UINT32 uwR12;
00106     UINT32 uwLR;
00107     UINT32 uwPC;
00108     UINT32 uwxPSR;
00109 #if ((defined (__FPU_PRESENT) && (__FPU_PRESENT == 1U)) && \
00110      (defined (__FPU_USED   ) && (__FPU_USED    == 1U))     )
00111     UINT32 S0;
00112     UINT32 S1;
00113     UINT32 S2;
00114     UINT32 S3;
00115     UINT32 S4;
00116     UINT32 S5;
00117     UINT32 S6;
00118     UINT32 S7;
00119     UINT32 S8;
00120     UINT32 S9;
00121     UINT32 S10;
00122     UINT32 S11;
00123     UINT32 S12;
00124     UINT32 S13;
00125     UINT32 S14;
00126     UINT32 S15;
00127     UINT32 FPSCR;
00128     UINT32 NO_NAME;
00129 #endif
00130 } TSK_CONTEXT_S;
00131 
00132 
00133 
00134 /**
00135  * @ingroup  los_hw
00136  * @brief: Task stack initialization.
00137  *
00138  * @par Description:
00139  * This API is used to initialize the task stack.
00140  *
00141  * @attention:
00142  * <ul><li>None.</li></ul>
00143  *
00144  * @param  uwTaskID     [IN] Type#UINT32: TaskID.
00145  * @param  uwStackSize  [IN] Type#UINT32: Total size of the stack.
00146  * @param  pTopStack    [IN] Type#VOID *: Top of task's stack.
00147  *
00148  * @retval: pstContext Type#TSK_CONTEXT_S *.
00149  * @par Dependency:
00150  * <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
00151  * @see None.
00152  * @since Huawei LiteOS V100R001C00
00153  */
00154 extern VOID * osTskStackInit(UINT32 uwTaskID, UINT32 uwStackSize, VOID *pTopStack);
00155 
00156 
00157 
00158 /**
00159  * @ingroup  los_hw
00160  * @brief: Task scheduling Function.
00161  *
00162  * @par Description:
00163  * This API is used to scheduling task.
00164  *
00165  * @attention:
00166  * <ul><li>None.</li></ul>
00167  *
00168  * @param  None.
00169  *
00170  * @retval: None.
00171  * @par Dependency:
00172  * <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
00173  * @see None.
00174  * @since Huawei LiteOS V100R001C00
00175  */
00176 extern VOID osSchedule(VOID);
00177 
00178 
00179 /**
00180  * @ingroup  los_hw
00181  * @brief: Function to determine whether task scheduling is required.
00182  *
00183  * @par Description:
00184  * This API is used to Judge and entry task scheduling.
00185  *
00186  * @attention:
00187  * <ul><li>None.</li></ul>
00188  *
00189  * @param  None.
00190  *
00191  * @retval: None.
00192  * @par Dependency:
00193  * <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
00194  * @see None.
00195  * @since Huawei LiteOS V100R001C00
00196  */
00197 extern VOID LOS_Schedule(VOID);
00198 
00199 LITE_OS_SEC_TEXT_MINOR VOID osTaskExit(VOID);
00200 
00201 /**
00202  * @ingroup  los_hw
00203  * @brief: The M3 wait interrupt instruction.
00204  *
00205  * @par Description:
00206  * This API is used to make CPU enter to power-save mode.
00207  *
00208  * @attention:
00209  * <ul><li>None.</li></ul>
00210  *
00211  * @param  None.
00212  *
00213  * @retval: None.
00214  * @par Dependency:
00215  * <ul><li>los_hw.h: the header file that contains the API declaration.</li></ul>
00216  * @see None.
00217  * @since Huawei LiteOS V100R001C00
00218  */
00219 
00220 extern VOID osEnterSleep(VOID);
00221 
00222 #ifdef __cplusplus
00223 #if __cplusplus
00224 }
00225 #endif /* __cplusplus */
00226 #endif /* __cplusplus */
00227 
00228 
00229 #endif /* _LOS_HW_H */
00230