I/O Interface ------------- The I/O interface is character-based and memory-mapped. Three 16-bit word-addressable memory addresses are used: 1) the input/output control register, REG_IOCONTROL, 2) the input/output character buffer #1, REG_IOBUFFER_1, and 3) the input/output character buffer #2, REG_IOBUFFER_2. The three memory addresses may also be read and/or written using byte-mode operations rather than word-mode operations. The memory layout is as follows: Address Name Description 0x00FF00 REG_IOCONTROL Read/write control register 0x00FF04 REG_IOBUFFER_1 I/O buffer 0x00FF08 REG_IOBUFFER_2 I/O buffer The bits read from REG_IOCONTROL are: Bit Name Description 0 BIT_SERIAL_INPUTREADY If set, there is a character ready to be read from the serial port device (RS-232) via REG_IOBUFFER_1, i.e., the user has sent at least one character to the Altera DE2-70 (or DE2-115) via the serial port. 1 BIT_SERIAL_OUTPUTREADY If set, the serial port device (RS-232) is ready to accept a character by writing that character to REG_IOBUFFER_1. After the character is written to REG_IOBUFFER_1, it will be transmitted from the Altera DE2-70 (or DE2-115) via the serial port. 2 BIT_PS2_INPUTREADY If set, there is a character ready to be read from the PS/2 port device via REG_IOBUFFER_2, i.e., the user has sent at least one character to the Altera DE2-70 (or DE2-115) via the PS/2 port. 3 BIT_LCD_OUTPUTREADY If set, the LCD device is ready to accept a character by writing that character to REG_IOBUFFER_2. After the character is written to REG_IOBUFFER_2, it will be displayed on the Altera DE2-70's (or DE2-115's) LCD display. The bits written to REG_IOCONTROL are: Bit Name Description 0 BIT_SERIAL_INPUTFLUSH Flush the serial port (RS-232) input queue when this bit is set. That is, delete any characters in the serial port input queue (those that have been received (i.e., entered or typed at the peripheral), but not already read). This operation causes characters in the input queue (that have not already been read) to *never* be read. 1 BIT_SERIAL_OUTPUTFLUSH Flush the serial port (RS-232) output queue when this bit is set. That is, delete any characters in the serial port output queue (those that have been successfully written to REG_IOBUFFER_1, but not already sent via the serial port). This operation causes characters in the output queue (that have not already been written) to *never* be written. 2 BIT_PS2_INPUTFLUSH Flush the PS/2 port input queue when this bit is set. That is, delete any characters in the PS/2 port input queue (those that have been received (i.e., entered or typed at the peripheral), but not already read). This operation causes characters in the input queue (that have not already been read) to *never* be read. 3 BIT_LCD_OUTPUTFLUSH Flush the LCD device output queue when this bit is set. That is, delete any characters in the LCD device output queue (those that have been successfully written to REG_IOBUFFER_2, but not already sent to the LCD device). This operation causes characters in the output queue (that have not already been written) to *never* be written. Note: "read" bits are set by the memory subsystem, "write" bits change the state of the I/O device when the processor writes onto them. Undocumented bits are reserved for future expansion and they should not be set; therefore, all unused bits should be set to zero when the REG_IOCONTROL register is written. Writing a one bit to them may cause indeterminate behavior. Reading REG_IOBUFFER_1 when the BIT_SERIAL_INPUTREADY bit in the REG_IOCONTROL register is not set produces undefined results. Writing to REG_IOBUFFER_1 when the BIT_SERIAL_OUTPUTREADY bit in the REG_IOCONTROL register is not set produces undefined results. Reading REG_IOBUFFER_2 when the BIT_PS2_INPUTREADY bit in the REG_IOCONTROL register is not set produces undefined results. Writing to REG_IOBUFFER_2 when the BIT_LCD_OUTPUTREADY bit in the REG_IOCONTROL register is not set produces undefined results.