Embedded Systems September 2000 Vol13_10

Issue link:

Contents of this Issue


Page 59 of 229

LISTING 3 Z80 __ Context __ Switch: Save the current task's context PUSH main register set PUSH secondary register Save SP into the TCB of the task to suspend; Restore the new task's context Load SP from the TCB of the task to resume; POP secondary register set POP main register RET be code or data) . The BBR can be changed at run time and thus allows you to view different chunks of code or data. The mapping of logical address to physical address for the Bank Area is given by: PhysicaLAddress = (BBR << 12) + Logi caLAddress; As shown in Figure 7, logical FIGURE 7 .. processor's MM~ • OxFFFFF address Ox4000 would map to physical address OxOCOOO if the BBR contains Ox08. You should note that steps in value of the BBR are determined by the bank size. If you etup the Bank Area to have l6KB, values of the BBR are in steps of Ox04 since each incre- ment represents 4KB. The C compiler I've used sets the I CBR = OxFO (32K) , Data joxF8000 OxFFFF --- BBR to the proper value if you com- pile your code with the banking option. From a kernel's perspective, the kernel needs to save the BBR in addition to the other Z80 registers during a context switch. This means that the context switch code for the 180-class processors would look as shown in Listing 4. A context switch for )lC/ OS-II on the 180-class proces- sors takes about 400 clock cycles (l6)ls at 25MHz). Data (32K) Common Area 1 (32K) i Ox8000 Bank Area (16K) Code Ox4000 (32K) Common Area 0 (16K) OxOOOO 16K 1 : -..., :oxocooo BBR = Ox04 ji _ ! . Ox8000 Bank #0 · BBR = OxOO 16K I _, Ox4000 l.,., ' ~-----:~ 16K OxOOOO Logical Address Space (64K) Physical Address Space (1,024K) 58 SEPTEMBER 2000 Embedded Systems Programming Code (64K) j BBR = Ox08 Rabbit 2000 Last fall, Rabbit Semiconductor intro- duced the Rabbit 2000 processor. From its name, it's not obvious that this is a Z80/ l80 derivative processor, but it is. Like the 180-class processors, the Rabbit can addres up to 1MB of code and data. Rabbit Semiconductor added new instructions that substan- tially improve 16-bit operations, allow alternate registers to be referenced explicitly, allow an offset to be added to the SP and HL registers (making stack manipulation much more effi- cient), allow tl1e interrupt disable flag to be saved and restored to/ from the stack, and more. In short, it corrects a number of deficien cies in the Z80/ l80. The Rabbit goes through code mostly at two clock cycles per byte with

Articles in this issue

Archives of this issue

view archives of EETimes - Embedded Systems September 2000 Vol13_10