30.12.2013 Views

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

T-Kernel Specification (1.B0.02)

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

5.5. IO PORT ACCESS SUPPORT FUNCTIONS 251<br />

5.5 IO Port Access Support Functions<br />

IO port access support functions are provided as library functions or C language macros. These can be<br />

called from a task-independent portion or while dispatching and interrupts are disabled.<br />

5.5.1 IO Port Access<br />

In a system with separate IO space and memory space, an IO port access function accesses IO space.<br />

In a system with memory-mapped IO only, an IO port access function accesses memory space. Using<br />

these functions will improve software portability and readability even in a memory-mapped IO system.<br />

—_w<br />

—_h<br />

—_b<br />

Word (32-bit) units<br />

Half-word (16-bit) units<br />

Byte (8-bit) units<br />

• void out_w( INT port, UW data )<br />

• void out_h( INT port, UH data )<br />

• void out_b( INT port, UB data )<br />

port IO port address data Data to be written<br />

Writes data to an IO port.<br />

• UW in_w( INT port )<br />

• UH in_h( INT port )<br />

• UB in_b( INT port ) port IO port address return code Data to be read<br />

Reads data from an IO port.<br />

5.5.2 Microwait<br />

• void WaitUsec( UINT usec )<br />

• void WaitNsec( UINT nsec )<br />

usec<br />

nsec<br />

Wait time (microseconds)<br />

Wait time (nanoseconds)<br />

Performs a microwait for the designated interval.<br />

These waits occur in an ordinary busy loop, and as such are easily influenced by the runtime<br />

environment, such as execution in RAM, execution in ROM, memory cache on or off, etc. These<br />

wait times are therefore not very accurate.<br />

These waits are not the same as an OS WAIT state. The system state remains as RUN state.<br />

Copyright c○ 2002, 2003 by T-Engine Forum<br />

T-<strong>Kernel</strong> <strong>1.B0.02</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!