/*
*********************************************************************************************************
* uC/OS-II
* The Real-Time Kernel
* CORE FUNCTIONS
*
* (c) Copyright 1992-2003, Jean J. Labrosse, Weston, FL
* All Rights Reserved
*
* File : OS_CORE.C
* By : Jean J. Labrosse
*********************************************************************************************************
*/
#ifndef OS_MASTER_FILE
#define OS_GLOBALS
#include <ucos_ii.h>
#endif
/*
*********************************************************************************************************
* MAPPING TABLE TO MAP BIT POSITION TO BIT MASK
*
* Note: Index into table is desired bit position, 0..7
* Indexed value corresponds to bit mask
*********************************************************************************************************
*/
INT8U const OSMapTbl[8] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20, 0x40, 0x80};
/*
*********************************************************************************************************
* 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);
/*$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_NO_ERR 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_NAME_SIZE > 1
INT8U OSEventNameGet (OS_EVENT *pevent, char *pname, INT8U *err)
{
#if OS_CRITICAL_METHOD == 3 /* Allocate storage for CPU status register */
OS_CPU_SR cpu_sr;
#endif
INT8U len;
OS_ENTER_CRITICAL();
#if OS_ARG_CHK_EN > 0
if (pevent == (OS_EVENT *)0) { /* Is 'pevent' a NULL pointer? */
OS_EXIT_CRITICAL(); /* Yes */
*err = OS_ERR_PEVENT_NULL;
return (0);
}
if (pname == (char *)0) { /* Is 'pname' a NULL pointer? */
OS_EXIT_CRITICAL(); /* Yes */
*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:
OS_EXIT_CRITICAL();
*err = OS_ERR_EVENT_TYPE;
return (0);
}
len = OS_StrCopy(pname, pevent->OSEventName); /* Copy name from OS_EVENT */
OS_EXIT_CRITICAL();
*err = OS_NO_ERR;
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_NO_ERR if the requested task is resumed
* OS_ERR_EVENT_TYPE if 'pevent' is not pointing to the proper event
*
没有合适的资源?快使用搜索试试~ 我知道了~
PROTEUS 在 MCS-51&ARM7系统中的应用百例程序
共2000个文件
c:252个
o:236个
h:222个
需积分: 10 6 下载量 194 浏览量
2009-07-29
15:01:45
上传
评论
收藏 11.16MB RAR 举报
温馨提示
《PROTEUS 在 MCS-51&ARM7系统中的应用百例》一书中的所有程序
资源推荐
资源详情
资源评论
收起资源包目录
PROTEUS 在 MCS-51&ARM7系统中的应用百例程序 (2000个子文件)
4X4 KeyBoard (1) 955B
4X4 KeyBoard (2) 969B
74LS245 295B
74LS273 304B
8255 435B
8255(1) 449B
8255(2) 472B
8x8 LED 868B
8x8 Matrix LED 1KB
99s Clock 908B
LEDCON.a79 1KB
AD Convert 809B
Ad Lamp 448B
Ad Lamp(Table) 542B
ADC0809 Basic 834B
Alarm 430B
ASCII Conv 448B
os_cpu_a.asm 16KB
os_cpu_a.asm 16KB
os_cpu_a.asm 16KB
os_cpu_a.asm 16KB
os_cpu_a.asm 16KB
Trafic Lamp.asm 6KB
Calculator.asm 6KB
Key Lock (2).asm 6KB
I2C.asm 5KB
Number Input.asm 4KB
Key Lock (1).asm 3KB
Text2.asm 3KB
Digital Clock (2).asm 3KB
Cymometer.asm 2KB
Digital Clock (1).asm 2KB
Turn Lamp.asm 2KB
Temperature Monitor.asm 2KB
Electronic Organ.asm 2KB
8x8 Matrix LED.asm 2KB
AD Convert.asm 2KB
Key Board.asm 2KB
8x8 LED.asm 2KB
Text4.ASM 1KB
4X4 KeyBoard (1).asm 1KB
99s Clock.asm 1KB
BCD Sub.asm 1KB
Numb LED.asm 1KB
Dyn Scan LED.asm 1KB
Digital Voltmeter.ASM 1KB
Text3.asm 1KB
4X4 KeyBoard (2).asm 1KB
Graph LED.asm 1KB
ADC0809 Basic.asm 1KB
Text2.ASM 1KB
Door Bell.asm 1KB
Timer Application (2).asm 1KB
Dyn Display.asm 1KB
Text3l.asm 1KB
Step Motor.asm 1KB
Serial LED Disp.asm 1KB
LED Display.asm 1022B
Interrupt.ASM 995B
Timer.asm 879B
Data Sorting.asm 741B
8255(1).asm 689B
Counter(4_bit).asm 689B
Counter(0-99).asm 679B
Ad Lamp(Table).asm 675B
Prog JMP.asm 661B
DC Motor.asm 658B
PWM.asm 658B
Timer(Soft).asm 626B
Serial to Parallel.asm 593B
ASCII Conv.asm 587B
Di-Di Alarm.asm 581B
ASK.ASM 549B
LED.ASM 532B
Key Function.asm 529B
BCD Add.asm 521B
Move RAM.asm 511B
BCD Shift.asm 510B
Key Recg.asm 503B
8255(2).asm 495B
BCD NEG.asm 484B
Serial Communication.asm 477B
Port1 (1).asm 447B
Ad Lamp.asm 422B
Alarm.asm 419B
Parallel to Serial.asm 404B
External Interrupt.asm 385B
Text2.asm 381B
Port1 (2).asm 366B
Text1.asm 350B
BCD Conv.asm 328B
Audio.asm 302B
EEPROM.asm 241B
Flash Lamp.asm 236B
74LS273.asm 204B
CLR RAM.asm 197B
Counter Design.asm 195B
Multi Switch.asm 169B
Switch Lamp.asm 141B
Text2.ASM 126B
共 2000 条
- 1
- 2
- 3
- 4
- 5
- 6
- 20
资源评论
zhangjpp
- 粉丝: 0
- 资源: 24
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
- Screenshot_20240427_031602.jpg
- 网页PDF_2024年04月26日 23-46-14_QQ浏览器网页保存_QQ浏览器转格式(6).docx
- 直接插入排序,冒泡排序,直接选择排序.zip
- 在排序2的基础上,再次对快排进行优化,其次增加快排非递归,归并排序,归并排序非递归版.zip
- 实现了7种排序算法.三种复杂度排序.三种nlogn复杂度排序(堆排序,归并排序,快速排序)一种线性复杂度的排序.zip
- 冒泡排序 直接选择排序 直接插入排序 随机快速排序 归并排序 堆排序.zip
- 课设-内部排序算法比较 包括冒泡排序、直接插入排序、简单选择排序、快速排序、希尔排序、归并排序和堆排序.zip
- Python排序算法.zip
- C语言实现直接插入排序、希尔排序、选择排序、冒泡排序、堆排序、快速排序、归并排序、计数排序,并带图详解.zip
- 常用工具集参考用于图像等数据处理
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功