/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
*
* ATmega128 Specific code
*
* File : OS_CPU_C.C
* By : Jean J. Labrosse
*********************************************************************************************************
*/
#define OS_CPU_GLOBALS
#include <ucos_ii.h>
#if OS_VIEW_MODULE > 0
#include <OS_VIEWc.H>
#include <OS_VIEW.H>
#endif
/*
*********************************************************************************************************
* LOCAL GLOBAL VARIABLES
*********************************************************************************************************
*/
#if OS_VERSION >= 281 && OS_TMR_EN > 0
static INT16U OSTmrCtr;
#endif
/*
*********************************************************************************************************
* 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)
{
#if OS_VERSION >= 281 && OS_TMR_EN > 0
OS_CPU_TmrCtr = 0;
#endif
}
#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
/*$PAGE*/
/*
*********************************************************************************************************
* 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.
*********************************************************************************************************
*/
#if OS_CPU_HOOKS_EN > 0
void OSTaskCreateHook (OS_TCB *ptcb)
{
#if OS_VIEW_MODULE > 0
OSView_TaskCreateHook(ptcb);
#else
ptcb = ptcb; /* Prevent compiler warning */
#endif
}
#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
/*
*********************************************************************************************************
* 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
/*$PAGE*/
/*
**********************************************************************************************************
* 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 highly processor specific.
*
* Arguments : task is a pointer to the task code
*
* p_arg is a pointer to a user supplied data area that will be passed to the task
* when the task first executes.
*
* ptos is a pointer to the top of stack. It is assumed that 'ptos' points to the
* highest valid address on the stack.
*
* opt specifies options that can be used to alter the behavior of OSTaskStkInit().
* (see uCOS_II.H for OS_TASK_OPT_???).
*
* Returns : Always returns the location of the new top-of-stack' once the processor registers have
* been placed on the stack in the proper order.
*
* Note(s) : Interrupts are enabled when your task starts executing. You can change this by setting the
* SREG to 0x00 instead. In this case, interrupts would be disabled upon task startup. The
* application code would be responsible for enabling interrupts at the beginning of the task
* code. You will need to modify OSTaskIdle() and OSTaskStat() so that they enable interrupts.
* Failure to do this will make your system crash!
*
* The AVR return stack is placed OS_TASK_HARD_STK_SIZE bytes before the bottom of the task's
* stack.
*
* (1) IMPORTANT: The ICC compiler handles function pointers by actually passing the pointer
* to a location in Flash that actually contains the pointer to the function.
*
* (2) IMPORTANT: You MUST set OSTaskStkSize and OSTaskStkSizeHard BEFORE calling OSInit()
* to initialize the Idle and statistic tasks stacks.
**********************************************************************************************************
*/
OS_STK *OSTaskStkInit (void (*task)(void *pd), void *p_arg, OS_STK *ptos, INT16U opt)
{
INT8U *psoft_stk;
INT8U *phard_stk; /* Temp. variable used for setting up AVR hardware stack */
INT16U tmp;
(void)opt; /* 'opt' is not used, prevent warning */
psoft_stk = (INT8U *)ptos;
phard_stk = (INT8U *)ptos
- OSTaskStkSize /* Task stack size */
+ OSTaskStkSizeHard; /* AVR return stack ("hardware stack") */
tmp = *(INT16U const *)task; /* (1) ICC compiler handles function pointers indirectly! */
*phard_stk-- = (INT8U)
没有合适的资源?快使用搜索试试~ 我知道了~
UCOS2.81Port.rar_OSView_ucos 2._ucosView
共49个文件
h:16个
c:11个
s90:7个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 192 浏览量
2022-09-24
13:41:20
上传
评论
收藏 63KB RAR 举报
温馨提示
用于在ICC上使用的ATMEL 128处理器的ucos2.81版本的移植文件以及相关例子。还包含uCOSView 和 EvalBoards
资源推荐
资源详情
资源评论
收起资源包目录
UCOS2.81Port.rar (49个子文件)
www.pudn.com.txt 218B
Software
uCOSView
Ports
AVR
ATmega128
IAR
OS_VIEWc.H 1KB
OS_VIEWc.C 13KB
OS_VIEWa.s90 8KB
ICC
OS_VIEWc.H 1KB
OS_VIEWc.C 11KB
OS_VIEWa.s 8KB
EvalBoards
Atmel
STK500
ATmega128
IAR
Ex1-OS-View
app_isr.s90 4KB
app.c 9KB
os_cfg.h 9KB
Ex1-OS-View.dep 14KB
includes.h 665B
app_cfg.h 3KB
app_vect.s90 5KB
Ex1-OS-View.ewd 35KB
Ex1-OS-View.ewp 52KB
BSP
bsp.h 1KB
bsp.c 8KB
Ex1-OS
app_isr.s90 4KB
Ex1-OS.ewd 35KB
Ex1-OS.dep 12KB
app.c 9KB
os_cfg.h 9KB
includes.h 616B
app_cfg.h 3KB
app_vect.s90 4KB
Ex1-OS.ewp 52KB
ICC
BSP
bsp.h 1KB
bsp.c 8KB
Ex1-OS
app_vect.s 893B
app.c 9KB
os_cfg.h 9KB
includes.h 586B
app_cfg.h 3KB
Ex1-OS.lk 17B
Ex1-OS.prj 1KB
app_isr.s 3KB
Ex1-OS.mak 558B
Ex1-OS.src 959B
uCOS-II
Ports
AVR
Atmega128
IAR
os_cpu_c.c 14KB
os_cpu_i.s90 5KB
os_cpu_a.s90 14KB
os_cpu.h 6KB
os_dbg.c 11KB
ICC
os_cpu_i.h 5KB
os_cpu_a.s 11KB
os_cpu_c.c 14KB
os_cpu.h 5KB
os_dbg.c 12KB
共 49 条
- 1
资源评论
Kinonoyomeo
- 粉丝: 74
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功