⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 os_cpu_c.c

📁 ucosii在sharp7a400上的移植
💻 C
字号:
/***********************************************************************
 * $Workfile:   os_cpu_c.c  $
 * $Revision:   1.1  $
 * $Author:   WellsK  $
 * $Date:   Sep 26 2003 15:25:34  $
 *
 * Project: MicroCos-II SOC specific functions
 *
 * Description:
 *     This file contains ported functions for the MicroCos-II
 *     release.
 *
 * Revision History:
 * $Log:   //smaicnt2/pvcs/VM/sharpmcu/archives/sharpmcu/software/csps/lh7a400/ports/ucosii/os_cpu_c.c-arc  $
 * 
 *    Rev 1.1   Sep 26 2003 15:25:34   WellsK
 * Removed reference to includes.h. Uses ucos_ii.h instead.
 * 
 *    Rev 1.0   Jun 30 2003 15:18:32   WellsK
 * Initial revision.
 * 
 *
 ***********************************************************************
 * SHARP MICROELECTRONICS OF THE AMERICAS MAKES NO REPRESENTATION
 * OR WARRANTIES WITH RESPECT TO THE PERFORMANCE OF THIS SOFTWARE,
 * AND SPECIFICALLY DISCLAIMS ANY RESPONSIBILITY FOR ANY DAMAGES, 
 * SPECIAL OR CONSEQUENTIAL, CONNECTED WITH THE USE OF THIS SOFTWARE.
 *
 * SHARP MICROELECTRONICS OF THE AMERICAS PROVIDES THIS SOFTWARE SOLELY 
 * FOR THE PURPOSE OF SOFTWARE DEVELOPMENT INCORPORATING THE USE OF A 
 * SHARP MICROCONTROLLER OR SYSTEM-ON-CHIP PRODUCT. USE OF THIS SOURCE
 * FILE IMPLIES ACCEPTANCE OF THESE CONDITIONS.
 *
 * COPYRIGHT (C) 2001 SHARP MICROELECTRONICS OF THE AMERICAS, INC.
 *     CAMAS, WA
 **********************************************************************/

#define OS_CPU_GLOBALS
#include "ucos_ii.h"

/* Task CPSR (CPU status) register - Supervisor mode with IRQ and FIQ
   interrupts enabled */
#define INITIAL_TASK_CSPR 0x00000013

/***********************************************************************
 *
 * Function: OSTaskStkInit
 *
 * Purpose: Initialize task stack frame
 *
 * Processing:
 *     Build the task's initial stack as follows (stack builds down):
 *      Top of stack->Task status register (CPSR)
 *                    Register r0
 *                    Register r1
 *                    Register r2
 *                    Register r3
 *                    Register r4
 *                    Register r5
 *                    Register r6
 *                    Register r7
 *                    Register r8
 *                    Register r9
 *                    Register r10
 *                    Register r11
 *                    Register r12
 *                    Task's list register
 *                    Task's resume address
 *
 * Parameters:
 *     task  : Pointer to execution entry point of task
 *     pdata : Pointer to task data
 *     ptos  : Pointer to top of task stack
 *     opt   : Not used
 *
 * Outputs: None
 *
 * Returns: Nothing
 *
 * Notes: None
 *
 **********************************************************************/
OS_STK *OSTaskStkInit (void (* task)(void *pd),
                       void *pdata,
                       OS_STK *ptos,
                       INT16U opt)
{
    OS_STK *stk = ptos;
    opt = opt;

    /* Setup initial task stack */
    *--stk = (unsigned int) task;     /* Task start address */
    *--stk = 0;                       /* Task link register */
    *--stk = 0;                       /* r12 */
    *--stk = 0;                       /* r11 */
    *--stk = 0;                       /* r10 */
    *--stk = 0;                       /* r9 */
    *--stk = 0;                       /* r8 */
    *--stk = 0;                       /* r7 */
    *--stk = 0;                       /* r6 */
    *--stk = 0;                       /* r5 */
    *--stk = 0;                       /* r4 */
    *--stk = 0;                       /* r3 */
    *--stk = 0;                       /* r2 */
    *--stk = 0;                       /* r1 */
    *--stk = (unsigned int) pdata;    /* Task data (r0) */
    *--stk = INITIAL_TASK_CSPR;       /* Initial Task CPSR */

    return ((OS_STK *) stk);
}

/***********************************************************************
 * TASK CREATION HOOK
 *
 * Description: This function is called when a task is created.
 *
 * Arguments: ptcb is a pointer to the task control block of the task
 *              being created.
 *
 * Note(s): (1) Interrupts are disabled during this call.
 **********************************************************************/
void OSTaskCreateHook (OS_TCB *ptcb)
{
    /* Suppress compiler warning */
    ptcb = ptcb;
}

/***********************************************************************
 * TASK DELETION HOOK
 *
 * Description: This function is called when a task is deleted.
 *
 * Arguments: ptcb is a pointer to the task control block of the task
 *              being deleted.
 *
 * Note(s): (1) Interrupts are disabled during this call.
 **********************************************************************/
void OSTaskDelHook (OS_TCB *ptcb)
{
    /* Suppress compiler warning */
    ptcb = ptcb;
}

/***********************************************************************
 * TASK SWITCH HOOK
 *
 * Description: This function is called when a task switch is performed.
 *              This allows other operations to be performed operations
 *              during a context switch.
 *
 * Arguments:   none
 *
 * Notes:       (1) Interrupts are disabled during this call.
 *              (2) It is assumed that the global pointer 'OSTCBHighRdy'
 *                  points to the TCB of the task that will be
 *                  'switched in' (i.e. the highest priority task) and,
 *                  'OSTCBCur' points to the task being switched out,
 *                  (i.e. the preempted task).
 **********************************************************************/
void OSTaskSwHook (void)
{
}

/***********************************************************************
 * OSTaskIdle() HOOK
 *
 * Description: This function is called by OSTaskIdle() after the
 *      critical section to ensure that interrupts will be enabled for
 *      at least a few instructions.
 *      This hook has been added to allow you to do such things as
 *      STOP the CPU to conserve power.
 *
 * Arguments: None
 *
 * Note(s)    (1) Interrupts are ENABLED during this call.
 **********************************************************************/
void OSTaskIdleHook (void)
{
}

/***********************************************************************
 * STATISTIC TASK HOOK
 *
 * Description: This function is called every second by MicroC/OS-II's
 *              statistics task.  This allows your application to add
 *              functionality to the statistics task.
 *
 * Arguments: none
 **********************************************************************/
void OSTaskStatHook (void)
{
}

/***********************************************************************
 * TICK HOOK
 *
 * Description: This function is called every tick.
 *
 * Arguments: none
 *
 * Note(s): (1) Interrupts may or may not be ENABLED during this
 *                 call.
 **********************************************************************/
void OSTimeTickHook (void)
{
}

/***********************************************************************
 * OS INITIALIZATION HOOK (BEGINNING)
 *
 * Description: This function is called by OSInit() at the beginning
 * of OSInit().
 *
 * Arguments: none
 *
 * Note(s): (1) Interrupts are disabled during this call.
 **********************************************************************/
void OSInitHookBegin (void)
{
}

/***********************************************************************
 * OS INITIALIZATION HOOK (END)
 *
 * Description: This function is called by OSInit() at the end
 *              of OSInit().
 *
 * Arguments: none
 *
 * Returns: none
 *
 * Note(s): 
 **********************************************************************/
void OSInitHookEnd (void)
{
}

/***********************************************************************
 * OSTCBInit() HOOK
 *
 * Description: This function is called by OSTCBInit() after setting up
 *              most of the TCB.
 *
 * Arguments: ptcb is a pointer to the TCB of the task being created.
 *
 * Note(s)    (1) Interrupts may or may not be ENABLED during this call.
 **********************************************************************/
void OSTCBInitHook (OS_TCB *ptcb)
{
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -