/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* CORE FUNCTIONS
*
* (c) Copyright 1992-2007, Micrium, Weston, FL
* All Rights Reserved
*
* File : OS_CORE.C
* By : Jean J. Labrosse
* Version : V2.86
*
* LICENSING TERMS:
* ---------------
* uC/OS-II is provided in source form for FREE evaluation, for educational use or for peaceful research.
* If you plan on using uC/OS-II in a commercial product you need to contact Micri�m to properly license
* its use in your product. We provide ALL the source code for your convenience and to help you experience
* uC/OS-II. The fact that the source is provided does NOT mean that you can use it without paying a
* licensing fee.
*********************************************************************************************************
*/
#ifndef OS_MASTER_FILE
#define OS_GLOBALS
#include "ucos_ii.h"
#endif
/*
*********************************************************************************************************
* PRIORITY RESOLUTION TABLE
*
* Note: Index into table is bit pattern to resolve highest priority
* Indexed value corresponds to highest priority bit position (i.e. 0..7)
*********************************************************************************************************
*/
INT8U const OSUnMapTbl[256] = {
0, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x00 to 0x0F */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x10 to 0x1F */
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x20 to 0x2F */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x30 to 0x3F */
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x40 to 0x4F */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x50 to 0x5F */
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x60 to 0x6F */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x70 to 0x7F */
7, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x80 to 0x8F */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0x90 to 0x9F */
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xA0 to 0xAF */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xB0 to 0xBF */
6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xC0 to 0xCF */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xD0 to 0xDF */
5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0, /* 0xE0 to 0xEF */
4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0 /* 0xF0 to 0xFF */
};
/*$PAGE*/
/*
*********************************************************************************************************
* FUNCTION PROTOTYPES
*********************************************************************************************************
*/
static void OS_InitEventList(void);
static void OS_InitMisc(void);
static void OS_InitRdyList(void);
static void OS_InitTaskIdle(void);
#if OS_TASK_STAT_EN > 0
static void OS_InitTaskStat(void);
#endif
static void OS_InitTCBList(void);
static void OS_SchedNew(void);
/*$PAGE*/
/*
*********************************************************************************************************
* GET THE NAME OF A SEMAPHORE, MUTEX, MAILBOX or QUEUE
*
* Description: This function is used to obtain the name assigned to a semaphore, mutex, mailbox or queue.
*
* Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
* a mutex, a mailbox or a queue. Where this function is concerned, the actual
* type is irrelevant.
*
* pname is a pointer to an ASCII string that will receive the name of the semaphore,
* mutex, mailbox or queue. The string must be able to hold at least
* OS_EVENT_NAME_SIZE characters.
*
* perr is a pointer to an error code that can contain one of the following values:
*
* OS_ERR_NONE if the name was copied to 'pname'
* OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
* control block type.
* OS_ERR_PNAME_NULL You passed a NULL pointer for 'pname'
* OS_ERR_PEVENT_NULL if you passed a NULL pointer for 'pevent'
* OS_ERR_NAME_GET_ISR if you are trying to call this function from an ISR
*
* Returns : The length of the string or 0 if the 'pevent' is a NULL pointer.
*********************************************************************************************************
*/
#if (OS_EVENT_EN) && (OS_EVENT_NAME_SIZE > 1)
INT8U OSEventNameGet (OS_EVENT *pevent, INT8U *pname, INT8U *perr)
{
INT8U len;
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr = 0;
#endif
#if OS_ARG_CHK_EN > 0
if (perr == (INT8U *)0) { /* Validate 'perr' */
return (0);
}
if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
*perr = OS_ERR_PEVENT_NULL;
return (0);
}
if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
*perr = OS_ERR_PNAME_NULL;
return (0);
}
#endif
if (OSIntNesting > 0) { /* See if trying to call from an ISR */
*perr = OS_ERR_NAME_GET_ISR;
return (0);
}
switch (pevent->OSEventType) {
case OS_EVENT_TYPE_SEM:
case OS_EVENT_TYPE_MUTEX:
case OS_EVENT_TYPE_MBOX:
case OS_EVENT_TYPE_Q:
break;
default:
*perr = OS_ERR_EVENT_TYPE;
return (0);
}
OS_ENTER_CRITICAL();
len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
OS_EXIT_CRITICAL();
*perr = OS_ERR_NONE;
return (len);
}
#endif
/*$PAGE*/
/*
*********************************************************************************************************
* ASSIGN A NAME TO A SEMAPHORE, MUTEX, MAILBOX or QUEUE
*
* Description: This function assigns a name to a semaphore, mutex, mailbox or queue.
*
* Arguments : pevent is a pointer to the event group. 'pevent' can point either to a semaphore,
* a mutex, a mailbox or a queue. Where this function is concerned, it doesn't
* matter the actual type.
*
* pname is a pointer to an ASCII string that will be used as the name of the semaphore,
* mutex, mailbox or queue. The string must be able to hold at least
* OS_EVENT_NAME_SIZE characters.
*
* perr is a pointer to an error cod
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
xmc4500+ucos+c.zip (98个子文件)
xmc4500+ucos+c
Dave
Model
davesupport
1.0.26
davesupport_0.app 3KB
libs
1.0.8
libs_0.app 10KB
dbg001
1.0.8
dbg001_0.app 2KB
applicationModel.applicationmodel 758B
.project 3KB
Debug
Dave
Generated
src
CLK001
subdir.mk 1KB
CLK001.o.lst 118KB
objects.mk 239B
xmc4500+ucos+c.map 53KB
xmc4500+ucos+c.lst 772KB
Main.o 22KB
xmc4500+ucos+c.hex 86KB
Source
os_mutex.d 267B
os_tmr.o 36KB
os_flag.o.lst 174KB
os_mutex.o.lst 119KB
os_mbox.o 28KB
os_q.o.lst 127KB
os_mutex.o 30KB
os_task.o.lst 160KB
os_sem.d 257B
os_core.o.lst 293KB
os_flag.o 35KB
os_mem.d 257B
os_time.o 25KB
os_mem.o.lst 57KB
subdir.mk 2KB
os_mbox.d 264B
os_q.d 251B
os_time.o.lst 39KB
os_core.d 264B
os_core.o 52KB
os_mem.o 25KB
os_tmr.o.lst 147KB
os_task.o 35KB
os_sem.o.lst 85KB
os_sem.o 28KB
os_tmr.d 257B
os_task.d 264B
os_flag.d 264B
os_q.o 32KB
os_time.d 264B
os_mbox.o.lst 90KB
sources.mk 522B
xmc4500+ucos+c.elf 1.56MB
subdir.mk 1KB
Ports
os_cpu_a.o 2KB
os_dbg.o.lst 38KB
os_cpu_a.d 56B
os_cpu_c.o.lst 48KB
subdir.mk 2KB
os_dbg.o 29KB
os_cpu_c.d 336B
os_cpu_c.o 27KB
os_dbg.d 330B
os_cpu_a.o.lst 8KB
Main.d 334B
Startup
system_XMC4500.o 624KB
startup_XMC4500.o.lst 53KB
subdir.mk 2KB
startup_XMC4500.d 87B
system_XMC4500.o.lst 75KB
system_XMC4500.d 1KB
startup_XMC4500.o 9KB
makefile 3KB
makefile.rsp 282B
Main.o.lst 21KB
BSP
bsp.d 1KB
subdir.mk 1KB
bsp.o 622KB
bsp.o.lst 95KB
Main.c 7KB
ARM_toolset_settings_Debug.jlink 578B
Source
os_time.c 11KB
os_core.c 86KB
os_flag.c 55KB
ucos_ii.h 80KB
os_q.c 41KB
os_sem.c 29KB
os_mbox.c 30KB
os_cfg_r.h 10KB
os_tmr.c 46KB
os_mutex.c 37KB
os_task.c 51KB
os_mem.c 19KB
.settings
com.dave.mbs.xc800.prefs 117B
Ports
os_dbg.c 12KB
os_cpu_c.c 14KB
os_cpu.h 5KB
os_cpu_a.s 4KB
xmc4500+ucos+c.launch 4KB
.cproject 19KB
Startup
system_XMC4500.c 27KB
startup_XMC4500.s 37KB
app_cfg.h 813B
xmc4500+ucos+c.ld 5KB
BSP
bsp.h 87B
bsp.c 26KB
共 98 条
- 1
资源评论
- wbt0002014-06-19好东西,对毕设帮助很大
无知之路
- 粉丝: 1
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功