/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* CORE FUNCTIONS
*
* (c) Copyright 1992-2007, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
* File : OS_CORE.C
* By : Jean J. Labrosse
* Version : V2.84
*
* 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.
*
* err 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'
*
* 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 *err)
{
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 (err == (INT8U *)0) { /* Validate 'err' */
return (0);
}
if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
*err = OS_ERR_PEVENT_NULL;
return (0);
}
if (pname == (INT8U *)0) { /* Is 'pname' a NULL pointer? */
*err = OS_ERR_PNAME_NULL;
return (0);
}
#endif
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:
*err = OS_ERR_EVENT_TYPE;
return (0);
}
OS_ENTER_CRITICAL();
len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
OS_EXIT_CRITICAL();
*err = 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.
*
* err is a pointer to an error code that can contain one of the following values:
*
* OS_ERR_NONE if the requested task is resumed
* OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
*
没有合适的资源?快使用搜索试试~ 我知道了~
uCOS.rar_LPC2478_iar ucos lpc_uCOS IAR LPC_uCOS LPC2478_ucos ii
共114个文件
h:50个
c:39个
dbgdt:3个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
5星 · 超过95%的资源 1 下载量 19 浏览量
2022-09-20
15:18:19
上传
评论
收藏 278KB RAR 举报
温馨提示
在IAR环境下基于LPC2478移植的UCOS-II。
资源推荐
资源详情
资源评论
收起资源包目录
uCOS.rar_LPC2478_iar ucos lpc_uCOS IAR LPC_uCOS LPC2478_ucos ii (114个子文件)
os_cpu_a.asm 27KB
LPC2468-EA-OS-View.cspy.bat 2KB
LPC2468-uCOS.cspy.bat 2KB
uCOS.cspy.bat 2KB
os_core.c 68KB
os_flag.c 55KB
lib_str.c 54KB
bsp.c 54KB
os_task.c 49KB
os_tmr.c 46KB
os_view.c 43KB
mci.c 41KB
os_q.c 41KB
os_mutex.c 36KB
os_mbox.c 30KB
os_sem.c 28KB
os_cpu_c.c 23KB
lib_mem.c 20KB
os_mem.c 20KB
os_viewc.c 15KB
os_dbg.c 13KB
os_time.c 11KB
ex_nandflash.c 10KB
os_dcc.c 9KB
can.c 8KB
i2c.c 8KB
uart0.c 7KB
uCOS_app.c 7KB
pwm.c 6KB
uart1.c 6KB
adc.c 6KB
timer.c 6KB
dma.c 6KB
rtc.c 5KB
target.c 5KB
i2s.c 5KB
ex_sdram.c 4KB
irq.c 3KB
wdt.c 3KB
fio.c 2KB
keyboard.c 2KB
extint.c 2KB
dac.c 1KB
LPC2468-uCOS.dbgdt 3KB
uCOS.dbgdt 63B
LPC2468-EA-OS-View.dbgdt 63B
LPC2468-uCOS.dep 37KB
LPC2468-uCOS.dni 658B
uCOS.dni 313B
LPC2468-EA-OS-View.dni 198B
LPC2468-uCOS.ewd 31KB
LPC2468-uCOS.ewp 46KB
LPC2468-uCOS.eww 166B
iolpc2458.h 170KB
ucos_ii.h 76KB
ucos_ii.h 76KB
LPC2468.h 71KB
LPC2468.h 71KB
lib_mem.h 34KB
lib_mem.h 34KB
lib_def.h 18KB
lib_def.h 18KB
cpu.h 16KB
lib_str.h 11KB
lib_str.h 11KB
os_cpu.h 11KB
os_cpu.h 11KB
os_cfg.h 10KB
cpu_def.h 8KB
os_view.h 7KB
os_view.h 7KB
mci.h 6KB
bsp.h 5KB
bsp.h 5KB
can.h 5KB
app_cfg.h 4KB
target.h 4KB
target.h 4KB
irq.h 2KB
irq.h 2KB
rtc.h 2KB
ex_nandflash.h 2KB
pwm.h 2KB
i2c.h 2KB
includes.h 2KB
os_viewc.h 2KB
os_viewc.h 2KB
uart0.h 1KB
fio.h 1KB
dma.h 1KB
uart1.h 1KB
ex_sdram.h 1KB
extint.h 1KB
timer.h 1KB
adc.h 1KB
timer.h 1024B
wdt.h 907B
i2s.h 903B
type.h 744B
type.h 744B
共 114 条
- 1
- 2
资源评论
- weixin_357374932023-11-09感谢资源主分享的资源解决了我当下的问题,非常有用的资源。
邓凌佳
- 粉丝: 65
- 资源: 1万+
下载权益
C知道特权
VIP文章
课程特权
开通VIP
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功