inport/outport
7-34
Get or Send Data To or From a TMS320C2x/C2xx/C5x I/O Port
inport/outport
Syntax
#include <ioports.h>
inport
(int port, int *ret);
outport
(int port, int value);
Defined in
ioports.asm in rts.src
Description
The following macros are used for accessing the TMS320C2x/C2xx/C5x I/O
ports.
-
The inport macro reads a value from the specified port and returns the
value via the pointer ret.
-
The outport macro writes a value to the specified port and has no return
value.
These routines are implemented as
macros
, not functions; you cannot use
them in expressions. This is an example of the incorrect
use of the macro:
call (inport (1, &i));
/* Incorrect use of macro*/
Instead, the macro must be used as below:
inport (1, &i);
call (i);
/* Correct use
*/
The port number must be a value between 0 and 15, inclusive. Using any other
value as a port number results in undefined behavior.
If you normally use these macros with a constant port number, set _PSWITCH,
a constant defined in ioports.h, to 0 (the default). If you normally use these
macros with a variable port number, set _PSWITCH to 1. The macros always
work, regardless of the value of _PSWITCH.
For additional information on I/O ports, refer to the
TMS320C2x User’s Guide,
the
TMS320C2xx User’s Guide
, or the
TMS320C5x User’s Guide
.
Summary of Contents for TMS320C2x
Page 8: ...viii...
Page 69: ...2 47 C Compiler Description...
Page 159: ...6 36...
Page 226: ...8 6...