ST20-C1 STMICROELECTRONICS [STMicroelectronics], ST20-C1 Datasheet - Page 54

no-image

ST20-C1

Manufacturer Part Number
ST20-C1
Description
Instruction Set Reference Manual
Manufacturer
STMICROELECTRONICS [STMicroelectronics]
Datasheet
4.11 Peripherals and I/O
The code to execute steps 3 to 4 must not be interrupted, since otherwise the periph-
eral job may be completed before the process is descheduled by a stop instruction,
which may crash the processor. Interrupts may be temporarily disabled by clearing the
local_interrupt_enable bit of the status register, which is set automatically when the
process is descheduled. Steps 5 to 7 happen automatically and need no coding.
The code to drive the peripheral will depend on the peripheral and the interface to it.
Typically the parameters (e.g. the byte count and the buffer address) would be written
to memory mapped registers and then a further write would be needed to start the
peripheral job.
The code to perform a DMA to transmit param_count bytes to or from param_buffer
using exception level except_level where the DMA registers periph_count ,
periph_buffer and periph_start are in a block at peripheral would be similar to the
following:
The process will resume at the next instruction after the stop when the peripheral job
is complete.
Single tasking
For programs which are not multi-tasking, it is not desirable to deschedule the
program while the peripheral is busy. The main program should continue with other
jobs while the peripheral is busy. An interrupt handler can be written to signal to the
main program that the peripheral job is complete. The descriptor of the interrupt
handler exception control block is placed in the exception vector table. The descriptor
54/205
1
2
3
4
5
6
7
The CPU saves the task descriptor of the current process in the exception
vector table at the exception level for the peripheral.
The CPU tells the peripheral the number of bytes to be read or written, the
address of the start of the data or input buffer.
The CPU signals to the peripheral that the job can start.
The CPU deschedules the process, using the stop instruction, to wait for the
peripheral to complete the job.
The CPU executes other processes while the peripheral performs the job.
The peripheral completes the job and sends a micro-interrupt to the CPU, with
the exception level.
The CPU reads the exception vector table and recognises the entry as a user
process. The process is added to the back of the scheduling queue, or if the
schedule execution trap is enabled then the trap is taken.
ldtdesc; ld ExceptionBase; stnl except_level;
ld param_count; ld peripheral; stnl periph_count;
rev; ld param_buffer; stnl periph_buffer;
ldc local_interrupt_enable; bitmask; statusclr;
rot; ldc start_value; arot; stnl periph_start;
stop;

Related parts for ST20-C1