liyao_ucos1
所属分类:uCOS/RTOS
开发工具:C/C++
文件大小:80KB
下载次数:16
上传日期:2005-07-13 20:36:44
上 传 者:
xuzmb
说明: 由Jean Labrosse先生写的uC/OS的实时操作系统核心的C源代码以及说明。这是Jean先生为68HC11系列写的RTOS,但是随着越来越多的MCU的出现,Jean把他的RTOS移植到许多平台上,比较适合扩展模式的应用模式,如XA,X86,但是一些客户不知道如何使用,实在糟蹋了!不过提醒各位,这仅仅是一个核心模块,嵌入应用环境太多了,许多其他模块象:文件模块,通讯模块,显示模块等,都需要大家自己努力了!那我自己也在尝试增加一些模块,象TCP/IP协议,可以为许多应用提供附加应用。
(by Mr. Jean Labrosse wrote uC/OS real-time operating system kernel of C source code and state. This is Mr. Jean wrote for the series 68HC11 RTOS, but as more and more the emergence of the MCU, Jean his many transplant RTOS platform, expansion model more suitable for the application model, such as XA, X86, but some customers do not know how to use, is wasted! But to remind you that this is only a core module, embedded application environment too much, like many other modules : File module, communications module, module, we now have our own efforts! I also try to increase their number of modules, such as TCP/IP protocol, for many applications can provide additional applications.)
文件列表:
INSTALL.BAT (38, 2000-09-11)
UCOS_XA.EXE (78736, 1996-07-30)
UCOS_XA.LST (1802, 1996-07-30)
Philips Semiconductors, Inc.
'uC/OS, The Real-Time Kernel' for the Philips XA
(Large Memory Model)
Table of Contents:
Introduction
Disclaimer
System Requirements
Directories and Files
Assumptions about the XA
Building the test code
Loading and running the test code
References
Contacts
Introduction:
-------------
uC/OS is a portable, ROMable, preemptive, real-time multitasking kernel
for microprocessors. uC/OS is written in ANSI C with target specific
code written in assembly language. uC/OS can manage up to 63 user
defined tasks and its performance is comparable to many commercially
available kernels.
Version 1.08 of uC/OS has been ported to the Philips XA (large model)
and the source code has been made available to you free of charge by
Philips Semiconductors, Inc. You are permitted to use uC/OS in your
application royalty free. You cannot, however, distribute the source
code through any medium. The port for uC/OS has been verified and
tested using the Future Designs, Inc. XTEND-G3 evaluation board. In
order to verify the large model implementation of uC/OS, however, the
board had to be modified to support the 'expanded data' version. This
means that the data RAM chips had to be replaced with two 128Kx8 chips.
This requirement is imposed by the compiler, not uC/OS.
The inner workings of uC/OS is described in the book called: 'uC/OS, The
Real-Time Kernel' by Jean J. Labrosse. The book comes with the source
code along with a port to the Intel x86 processor on floppy disk. You
can also obtain additional example code which uses uC/OS in the other
book by Jean J. Labrosse called 'Embedded Systems Building Blocks'.
Both books are available from Miller Freeman, Inc. (see the section
'Contacts'). You should note that the source code for uC/OS needed to
be modified to support the peculiarities of the HI-TECH C Compiler in
the 'large' model.
uC/OS has the following features:
1) Create, delete and manage up to 63 user tasks.
2) Create and manages binary semaphores, counting semaphores, mailboxes
or queues (in any combination).
3) Unconditionally suspend and resume any task.
4) Delay tasks for an integral number of 'ticks'.
5) Maintains a 32-bit system clock.
6) Support interrupts.
The 'large memory model' implementation of uC/OS simply means that you
are able to have your application software use the full address space
provided by the XA (i.e. 16 Mbytes of code and 16 Mbytes of data).
uC/OS has been compiled and assembled using the HI-TECH C V7.60 or
greater (see the section 'Contacts').
Disclaimer:
-----------
Although every precaution has been taken to ensure that the software
works, Philips Semiconductors, Inc., Miller Freeman, Inc. and the author
of uC/OS (Jean J. Labrosse) do not offer any warranties and do not
guarantee the accuracy, adequacy, or completeness of any information
provided and is not responsible for any errors, omissions or the results
obtained from use of such information. Neither is any liability assumed
for damages resulting from the use of uC/OS and the information
contained herein.
System Requirements:
--------------------
To use uC/OS for the XA, you must have an IBM-PC/AT (or compatible)
system, preferably equipped with an Intel 80486/33 or higher processor,
4 Mbytes of RAM and 5 Mbytes of free hard-disk space.
The development software assumes the presence of MS-DOS version 4.01 or
higher. You must also obtain a copy of the HI-TECH C compiler V7.60 or
higher. The HI-TECH C compiler must be installed in its default
directory (i.e. C:\HT-XA) and sub-directories and, the DOS path must
also include a reference to this directory.
Your target processor board must have more than *** Kbytes of RAM in
order to support the large memory model. In the case of the XTEND-G3
board, this means that you MUST have two 128K x 8 RAM chips (for the
DATA area) installed instead of the default two 32K x 8 RAM chips. Both
chips must be faster than 20 nS. You can obtain these chip from JDR
Microdevices (see the section 'Contacts') for about $40 US each (Order
part number 7C1024-15TPC or equivalent).
Directories and Files:
----------------------
The self-extracting file UCOS_XA.EXE needs to be executed from the root-
directory of the drive in which you desire to have uC/OS. UCOS_XA.EXE
creates the following directories from the MS-DOS C:\> prompt:
\SOFTWARE
\SOFTWARE\UCOS
\SOFTWARE\UCOS\8051XA
\SOFTWARE\UCOS\8051XA\SOURCE
\SOFTWARE\UCOS\8051XA\TEST_L
The \SOFTWARE\UCOS\8051XA directory contains this README.TXT file.
The SOURCE directory contains the following source files:
INCLUDES.H, is a master include file that makes references to all
the header files needed by uC/OS and your application. You may
edit the contents of INCLUDES.H to add your own header files.
OS_CFG.H contains the current configuration for uC/OS. Editing
this file will allow you to reduce the amount of ROM and RAM
needed by uC/OS when you don't need all of its features.
OS_XA-AL.AS contains the XA's processor specific interfaces to
uC/OS. The '-AL' simply indicate that the source file is written
in Assembly language for the Large model.
OS_XA-CL.C contains the XA processor specific C source code for
uC/OS. Basically, this file contains the code to create a task
under uC/OS. The '-CL' indicates that the source file is written
in C for the Large model.
OS_XA-CL.H is used to define some '#define' constants used by
uC/OS and also, the pre-processor macros OS_ENTER_CRITICAL() and
OS_EXIT_CRITICAL() which are basically used to disable and enable
interrupts, respectively. Interrupts are disabled by clearing the
XA's EA bit and re-enabled by setting the XA's EA bit.
TEST_CL.C is a test file which shows you how to properly initialize,
start and use uC/OS. You may modify this file but, you must
maintain the overall structure. Additional information about what
TEST_CL.C does is found in this file.
TICK-AL.AS contains the ticker ISR code. I assumed that TIMER #0
would be used to produce the system tick but, you can obviously
make the appropriate changes to support another interrupt source.
UCOS_CL.C is the processor independant portion of uC/OS. The
original file (UCOS_CL.C) provided in Jean J. Labrosse's book had to
be modified for the large model version of the XA because of the
compiler's use of the 'far' attribute.
UCOS_CL.H contains the definition of a number of '#define', internal
data structures and function prototypes for services provided by
uC/OS. You should not modify these values.
VECTORS.C is a file that installs 'dummy' interrupt vectors in
every of the XA's vector locations. This allows you to easily
modify this file and supply your own vectors. I have defined two
vectors to be used by uC/OS: Trap #15 which is used during context
switches and Timer #0 which is used to provide uC/OS's ticker.
VECTORS.H is the header file for VECTORS.C and a reference to this
file is placed in INCLUDES.H.
Although not source files, LISTC.EXE and HPLISTC.EXE are used to
print the source files descriped above either on a dot-matrix
printer (LISTC) or an HP Laser printer (HPLISTC). Simply type
LISTC or HPLISTC at the DOS prompt without any argument to obtain
a description.
The TEST_L directory contains the following files:
BUILD.BAT is a DOS batch file used to compile all C source
files (OS_XA-CL, TEST_CL.C, VECTORS.C and UCOS_CL.C), assemble all
assembly language source files (OS_XA-AL.AS and TICK-AL.AS) and,
link and locate the object files in order to create an executable
file (TEST_L.HEX) that can be downloaded to the XTEND-G3 board. You
will note that the source files are copied from the SOURCE
directory into the TEST_L directory before being compile, assembled
and linked. This is done to allow you to debug the code using an
emulator such as the NOHAU EMUL51XA-PC in-circuit emulator.
TEST_L.HEX is the executable file that can be loaded into the XTEND-
G3 board to verify the operation of uC/OS. TEST_CL.C provides a
description of what TEST_L.HEX does.
Assumptions about the XA:
-------------------------
uC/OS assumes very little about the XA. There are, however, a few
things you need to know about how uC/OS works with the XA.
uC/OS requires the use of two interrupts. The first interrupt is used
to perform a context switch. For lack of a better choice, I decided to
use TRAP #15. The second interrupt is generated by TIMER #0 which is
used by uC/OS to provide it with a 'tick'. In the example, I setup the
tick rate to be 100 Hz or, every 10 mS. You can change the tick rate by
modifying the code in TEST_CL.C. You can change the timer used to generate
the interrupt by modifying TICK_AL.AS.
uC/OS will disable interrupts during critical sections of code. The
amount of time that interrupts are disabled is difficult to determine
but, should not exceed about 50 uS at 24 MHz. Interrupts are disable by
uC/OS by clearing the EA bit. Interrupts are again enabled by setting
the EA bit. Your interrupt code must also be located in the XA's page 0
(this is a requirement of the XA).
In general, your interrupt service routines should be written in
assembly language as shown in TICK-AL.AS.
It is also assumed that you will have allocated sufficient stack space
on the SYSTEM stack to handle all anticipated nested interrupts.
All tasks must execute in USER mode. Upon power-up, the XA is in SYSTEM
mode and, upon starting the first task, uC/OS will switch the XA to USER
mode. A task MUST always be written as an infinite loop as shown in
TEST_CL.C. Once in the infinite loop, your application code MUST (at some
point) invoke a service provided by uC/OS to either delay itself for an
integral number of ticks, wait for a semaphore, wait for a message at a
mailbox or a queue or, explicitely suspend itself.
During a context switch, uC/OS only saves and restores R0 through R3 of
bank #0, R4 through R7, the DS, ES and SSEL registers. Register banks
#1, #2 and #3 are not saved nor altered. If you decide to switch
register banks in an ISR (Interrupt Service Routine), you MUST restore
bank #0 upon completion. It is actually not recommended to use the
other register banks.
When uC/OS is not running any of you application tasks (because all
tasks are waiting for an event to occur), uC/OS runs an internal task
called the 'idle task'. Very little actually happens in this task but,
I have still allocated 100 bytes of stack space for this task.
The contents of the PSW for each task is always set to 0x0000: USER
mode, trace mode disabled, select bank #0, all interrupt levels enabled
and, the CPU flags are all clear.
Building the test code:
-----------------------
From the TEST_L directory, you can build the test code by simply executing
the BUILD.BAT batch file from the DOS prompt. BUILD.BAT will create the
executable TEST_L.HEX which needs to be downloaded to the XTEND-G3 board
for execution.
Loading and running the test code:
----------------------------------
Follow the instructions provided in the XTEND-G3 user's manual to load
and run the test code (TEST_L.HEX).
References:
-----------
uC/OS, The Real-Time Kernel
Jean J. Labrosse
R&D Publications, 1992
ISBN 0-13-242967-5 or
ISBN 0-87930-444-8
Embedded Systems Building Blocks, Complete and Ready-to-Use Modules in C
Jean J. Labrosse
R&D Publications, 1995
ISBN 0-13-359779-2 or
ISBN 0-87930-440-5
16-bit 80C51XA Microcontrollers (eXtended Architecture)
Philips Semiconductors, 1995
IC25
Contacts:
---------
Future Designs, Inc.
P.O. Box 7362
Huntsville, AL 35807
(205) 830-4116
(205) 830-9421 FAX
teamfdi@aol.com
HI-TECH Software
P.O. Box 103 Alderley
QLD 4051, Australia
+61 7 3300 5011
+61 7 3300 5246 FAX
hitech@hitech.com.au
http://www.hitech.com.au
JDR Microdevices
1850 South 10th Street
San Jose, CA 95112-4108
(408) 494-1400
(408) 494-1420
(800) 538-5000
http://www.jdr.com
Miller Freeman, Inc.
(R&D Publications is now owned by Miller Freeman)
1601 West 23rd Street, Suite 200
Lawrence, KS 66046
(913) 841-1631
(913) 841-2626 FAX
rdorders@rdpub.com
http://www.rdbooks.com
Nohau Corporation
51 E. Campbell Avenue
Campbell, CA 95008
(408) 866-1820
(408) 378-7869 FAX
(408) 378-0940 BBS
http://www.nohau.com/nohau
Philips Semiconductors, Inc.
811 E. Argues Ave
Sunnyvale, CA 94088
(408) 991-3737
(800) 451-6***4 BBS
http://www.semiconductor.philips.com
近期下载者:
相关文件:
收藏者: