/*
*********************************************************************************************************
* 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_CORE_SOURCE
#define _OS_CORE_SOURCE
#define OS_GLOBALS
#include "..\CPU_source\includes.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 */
};
/*
*********************************************************************************************************
* 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);
/*
*********************************************************************************************************
* 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
/*
*********************************************************************************************************
* 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
没有合适的资源?快使用搜索试试~ 我知道了~
ucos.rar_系统
共99个文件
c:21个
h:12个
lis:9个
1.该资源内容由用户上传,如若侵权请联系客服进行举报
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
2.虚拟产品一经售出概不退款(资源遇到问题,请及时私信上传者)
版权申诉
0 下载量 184 浏览量
2022-09-24
19:41:32
上传
评论
收藏 282KB RAR 举报
温馨提示
单片机操作系统 单片机开发,操作系统嵌入式操作系统
资源推荐
资源详情
资源评论
收起资源包目录
ucos.rar (99个子文件)
MEGA16
MEGA16PRO.mak 1KB
obj
MEGA16PRO.mak 4KB
btask.lis 17KB
MEGA16PRO.hex 20KB
MEGA16PRO.mp 7KB
delay.lis 4KB
os_cpu_a.lis 27KB
btask.o 8KB
delay.o 1KB
MEGA16PRO.cof 30KB
MEGA16PRO.lk 88B
os_cpu_c.o 6KB
os_cpu_c.lis 37KB
bms_asm.lis 30KB
os_cpu_a.o 3KB
main.lis 14KB
74HC595.o 2KB
uCOS_II.o 34KB
uCOS_II.lis 295KB
MEGA16PRO.dbg 18KB
bms_task.lis 14KB
mega16pro_cof.aws 417B
MEGA16PRO.lst 267KB
main.o 4KB
74HC595.lis 8KB
bms_asm.o 4KB
MEGA16PRO_cof.aps 5KB
bms_task.o 3KB
MEGA16PRO.lk 51B
mega16pro.prj 1KB
BACKUP
main.c.111020173814 2KB
bms_asm.s.101209093322 9KB
bms_task._c 3KB
bms_task.c.111020173814 405B
os_cpu_a._s 9KB
bms_asm.s.111021161908 9KB
main.c.111019195526 2KB
bms_task.c.111020175230 1013B
bms_task.c.111020175044 1KB
bms_task.c.111021142308 3KB
bms_cfg._h 3KB
bms_task.c.111021161910 3KB
main.c.111019200232 2KB
main._c 3KB
includes.h.111019191938 1KB
bms_asm.s.111021122638 9KB
bms_task.c.111020175240 1017B
bms_task.c.111021142254 3KB
74HC595._c 930B
includes._h 892B
main.c.111019200646 2KB
ADC7923._h 2KB
main.c.111021140010 3KB
bms_asm.s.111021141422 9KB
includes.h.111020174910 893B
bms_task.c.111021142042 3KB
bms_task._h 187B
bms_task.c.111020174726 1018B
os_cpu_a.s.111019191938 8KB
bms_asm._s 9KB
os_cpu_a.s.111020172610 9KB
bms_task.c.111020173206 405B
includes.h.111020173814 891B
MEGA16PRO.SRC 482B
source
bms
delay.c 532B
bms_asm.s 9KB
bms_task.h 232B
main.c 3KB
74HC595.c 926B
btask.c 3KB
bms_main.c 2KB
74HC595.h 842B
OSMessage.c 2KB
delay.h 275B
bms_cfg.h 3KB
btask.h 3KB
OSMessage.h 1KB
bms_task.c 3KB
CPU_source
os_cpu_a.s 8KB
os_cfg.h 10KB
os_cpu_c.c 14KB
includes.h 896B
os_cpu.h 6KB
os_cpu_a.h 4KB
comm
serialcomm.c 5KB
serialcomm.h 1KB
ucos_source
OS_MBOX.C 30KB
uCOS_II.C 983B
uCOS_II.H 80KB
os_time.c 11KB
OS_MUTEX.C 37KB
os_q.c 41KB
os_core.c 86KB
OS_FLAG.C 55KB
OS_SEM.C 29KB
os_dbg_r.c 12KB
os_task.c 51KB
os_tmr.c 46KB
OS_MEM.C 19KB
共 99 条
- 1
资源评论
朱moyimi
- 粉丝: 64
- 资源: 1万+
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功