
DE1-S
O
C C
OMPUTER
S
YSTEM WITH
N
IOS
II
For Quartus II 15.0
received from the PS/2 port in the variables
byte
1
,
byte
2
, and
byte
3
. This code is included as part of a larger sample
program called
Media
that is distributed with the Altera Monitor Program.
volatile int
* PS2_ptr = (
int
*) 0xFF200100;
// PS/2 port address
int
PS2_data, RVALID;
char
byte1 = 0, byte2 = 0, byte3 = 0;
. . .
PS2_data = *(PS2_ptr);
// read the Data register in the PS/2 port
RVALID = PS2_data & 0x8000;
// extract the RVALID field
if
(RVALID)
{
/* save the last three bytes of data */
byte1 = byte2;
byte2 = byte3;
byte3 = PS2_data & 0xFF;
}
. . .
Figure 34. An example of code that uses the PS/2 port.
4.5.1
PS/2 Port Dual
The DE1-SoC Computer includes a second PS/2 port that allows both a keyboard and mouse to be used at the same
time. To use the dual port a Y-splitter cable must be used and the keyboard and mouse must be connected to the
PS/2 connector on the DE1-SoC board through this cable. The PS/2 port dual has the same registers as the PS/2 port
shown in Figure
34
, except that the base address of its
PS2_Data
register is
0xFF200108
and the base address of
its
PS2_Control
register is
0xFF20010C
.
4.6
IrDA Infrared Serial Port
The IrDA port in the DE1-SoC Computer implements a UART that is connected to the infrared transmit/receive
device on the DE1-SoC board. This UART is configured for 8-bit data, one stop bit, and no parity, and operates at a
baud rate of 115,200. The serial port’s programming interface consists of two 32-bit registers, as illustrated in Figure
35
. The register at address
0xFF201020
is referred to as the
Data
register, and the register at address
0xFF201024
is called the
Control
register.
Address
0
9
7
31
16
. . .
0
x
FF201024
DATA
RAVAIL
14
10
. . .
8
. . .
Unused
PE
WSPACE
WI RI
WE RE
1
0
x
FF201020
Data register
Control register
RVALID
15
Unused
. . .
24 23
Unused
Unused
Figure 35. IrDA serial port UART registers.
When character data is received from the IrDA chip it is stored in a 256-character FIFO in the UART. As illustrated
in Figure
35
, the number of characters
RAVAIL
currently stored in this FIFO is provided in bits 23
−
16 of the
Data
38
Altera Corporation - University Program
2015