/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* (c) Copyright 2010, Micrium, Inc., Weston, FL
* All Rights Reserved
*
* MIPS14K
* MicroMips
*
*
* File : os_cpu_c.c
* Version : v2.90
* By : NB
*********************************************************************************************************
*/
#define OS_CPU_GLOBALS
#include "includes.h"
/*
*********************************************************************************************************
* HARDWARE INTERRUPT VECTOR
*********************************************************************************************************
*/
extern char vec[], endvec[]; /* Create the hardware interrupt vector */
asm (".set push\n"
".set nomicromips\n"
".align 2\n"
"vec:\n"
"\tla $26,InterruptHandler\n"
"\tjr $26\n"
"endvec:\n"
".set pop\n");
/*
*********************************************************************************************************
* EXCEPTION VECTOR
*********************************************************************************************************
*/
extern char vec2[], endvec2[]; /* Create the exception vector */
asm (".set push\n"
".set nomicromips\n"
".align 2\n"
"vec2:\n"
"\tla $26,ExceptionHandler\n"
"\tjr $26\n"
"endvec2:\n"
".set pop\n");
/*
*********************************************************************************************************
* OS INITIALIZATION HOOK
* (BEGINNING)
*
* Description: This function is called by OSInit() at the beginning of OSInit().
*
* Arguments : None
*
* Note(s) : 1) Interrupts should be disabled during this call.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
void OSInitHookBegin (void)
{
memcpy ((void *) 0x80000200, vec, endvec - vec); /* Install the hardware interrupt vector */
memcpy ((void *) 0x80000180, vec2, endvec2 - vec2); /* Install the exception vector */
mips_clean_cache (0x80000200, 0x80); /* Remove the old vectors from cache. */
}
#endif
/*
*********************************************************************************************************
* OS INITIALIZATION HOOK
* (END)
*
* Description: This function is called by OSInit() at the end of OSInit().
*
* Arguments : None
*
* Note(s) : 1) Interrupts should be disabled during this call.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0 && OS_VERSION > 203
void OSInitHookEnd (void)
{
}
#endif
/*
*********************************************************************************************************
* TASK CREATION HOOK
*
* Description: This function is called whenever 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.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
void OSTaskCreateHook (OS_TCB *ptcb)
{
}
#endif
/*
*********************************************************************************************************
* 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.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
void OSTaskDelHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
#endif
/*
*********************************************************************************************************
* TASK RETURN HOOK
*
* Description: This function is called when a task returns without being properly deleted.
*
* Arguments : ptcb is a pointer to the task control block of the task that was accidently returned.
*
* Note(s) : 1) Interrupts are disabled during this call.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
void OSTaskReturnHook (OS_TCB *ptcb)
{
ptcb = ptcb; /* Prevent compiler warning */
}
#endif
/*
*********************************************************************************************************
* IDLE TASK HOOK
*
* Description: This function is called by the idle task. 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.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0 && OS_VERSION >= 251
void OSTaskIdleHook (void)
{
}
#endif
/*
*********************************************************************************************************
* STATISTIC TASK HOOK
*
* Description: This function is called every second by uC/OS-II's statistics task. This allows your
* application to add functionality to the statistics task.
*
* Arguments : None
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
void OSTaskStatHook (void)
{
}
#endif
/*
*********************************************************************************************************
* INITIALIZE A TASK'S STACK
*
* Description: This function is called by either OSTaskCreate() or OSTaskCreateExt() to initialize the
* stack frame of the task being created. This function is processor-specific.
*
* Arguments : task is a pointer to the task code.
*
* p_arg is a pointer to a user supplied data area
*
* ptos is a pointer to the top of stack. OSTaskStkInit() assumes that 'ptos' points to
* a free entry on the stack. If OS_STK_GROWTH is set to 1 then 'ptos' will contain
* the HIGHEST valid address of the stack. Similarly, if OS_STK_GROWTH is set to 0,
* 'ptos' will contain the lowest valid address of the stack.
*
* opt specifies options that can be used to alter the behavior of OSTaskStkInit()
* (see ucos_ii.h for OS_TASK_OPT_???).
*
* Returns : The location corresponding to the top of the stack
*
* Note(s) : 1) Interrupts are enabled when each task starts executing.
*
* 2) An initialized stack has the structure shown below.
*
* OSTCBHighRdy->OSTCBStkPtr + 0x00 Free Entry
评论0