        uC/OS-II for the Intel 196NT and IAR x96 C compiler
               SMALL, COMPACT and LARGE memory models

Ported by : Michael Evstafiev 
            evstaf@yahoo.com, evstaf@lumex.ru, www.geocities.com/evstaf

                            June, 2001

Port is developed and tested with IAR x96 C Compiler v5.30B and uCOS-II v2.00.

To install the port, unzip all the files into the root directory to the
disk with uCOS-II files from the book companion diskette.

Directory \SOFTWARE\UCOS-II\I196NT\IAR\SOURCE\ contain port source files:
os_cpu.h
	Port include file. 
os_cpu_c.c
	C port routines.
os_cpu_a.s32
	Assembly port routines and interrupts entry points.

Directory \SOFTWARE\UCOS-II\I196NT\IAR\TEST\ contain simple project files
with example of port usage:

test.prj 
	Project file for IAR Embedded Workbench IDE. Project contain three
	targets for SMALL, COMPACT and LARGE memory nodels.

includes.h
	Project include file. See the book.

os_cfg.h
	OS configuration file. Contain some port specific
	definitions for interrupts control described below.	

test.c
	Simple example of uCOS application with two tasks and one semaphore.
	One task turn on the LED, post the semaphore and delay itself to 2 sec.
	Other task wait the semaphore, delay to 1 sec and turn off the LED.

hardware.h
	Hardware related definitions: oscillator frequency, ports 
	initialization data and other. You should adapt this file for
	your hardware.

hardware.c
	Hardware initialization routine.

os_tick.c
	System timer initialization and service routines. 
	One of the channels EPA is used. Which is exactly defined by macroses 
	in os_cfg.h. COMP1 is used in the given example. Part of channels EPA 
	has an individual interrupt vector, but others has single multiplexed 
	vector. For using EPA channel with the multiplexed vector 
	define OS_TICKER_ON_EPAX as 1 in the file os_cfg.h, for using channel 
	with the individual vector, define OS_TICKER_ON_EPAX as 0.

epax.c
	Multiplexed interrupts (EPAX) subroutine. If you use multiplexed 
	interrupts you should add here the calls of their own interrupt 
	subroutines. 

196nt.h
	196NT bit masks for interrupt control registers.

small.xcl
compact.xcl
large.xcl
	Linker command files for different memory models. You should adapt 
	these files for your ROM and RAM memory map. In this example  
	chip internal RAM is used only.

Port expects an using the fixed names of ISR such as RX_int. Full list of 
names is kept in os_cpu_a.s32 file. In your program these ISR must be 
described as "void RX_int(void)". Code of the saving and restoring a context 
is created automatically in os_cpu_a.s32 for that interrupt vectors for 
which in the file os_cfg.h macroses with the suffix _CTX_SAVE determined 
as 1. Full macroses list is in os_cfg.h file.

ATTENTION! You must not to include a call OSIntExit() at the end of the ISR as 
described in the book. This call I place inside procedures of the context 
restoring in os_cpu_a.s32. This is why because IAR compiler optimizes this 
call to the command JMP, but to CALL sometimes. But You still must to call 
OSIntEnter() at the beginning of ISR. This is made for to be possible to 
change interrupts enable masks before the call OSIntEnter(). After the 
OSIntEnter() the nested interrupts become enabled. 

Compiler can use a different amount (8-32) of registers for keeping of temporary 
datas. Used value must be given in variable WORKSEG_SIZE. I am define this value 
in the project options dialog on the bookmark "defines" both for the assembler 
and for the C compiler. When assembliling os_cpu_a.s32 needed to define
the memory model by the macro Chip_196NT_S or Chip_196NT_C or Chip_196NT_L for 
SMALL, COMPACT or LARGE models respectively. See test.prj.

Please contact me for a questions.

Good luck,
Michael

---------------------------
June 12, 2001: V1.00
---------------------------

 1) First release of the I196NT port.

