beautypg.com

Driver options: fast vs. small implementations, Ioctl() operations, Software files – Altera Embedded Peripherals IP User Manual

Page 65: Software files -8

background image

Driver Options: Fast vs. Small Implementations

To accommodate the requirements of different types of systems, the JTAG UART driver has two variants,

a fast version and a small version. The fast behavior is used by default. Both the fast and small drivers fully

support the C standard library functions and the HAL API.
The fast driver is an interrupt-driven implementation, which allows the processor to perform other tasks

when the device is not ready to send or receive data. Because the JTAG UART data rate is slow compared

to the processor, the fast driver can provide a large performance benefit for systems that could be

performing other tasks in the interim. In addition, the fast version of the Altera Avalon JTAG UART

monitors the connection to the host. The driver discards characters if no host is connected, or if the host

is not running an application that handles the I/O stream.
The small driver is a polled implementation that waits for the JTAG UART hardware before sending and

receiving each character. The performance of the small driver is poor if you are sending large amounts of

data. The small version assumes that the host is always connected, and will never discard characters.

Therefore, the small driver will hang the system if the JTAG UART hardware is ever disconnected from

the host while the program is sending or receiving data. There are two ways to enable the small footprint

driver:
• Enable the small footprint setting for the HAL system library project. This option affects device drivers

for all devices in the system.

• Specify the preprocessor option

-DALTERA_AVALON_JTAG_UART_SMALL

. Use this option if you want the

small, polled implementation of the JTAG UART driver, but you do not want to affect the drivers for

other devices.

ioctl() Operations

The fast version of the JTAG UART driver supports the

ioctl()

function to allow HAL-based programs

to request device-specific operations. Specifically, you can use the

ioctl()

operations to control the

timeout period, and to detect whether or not a host is connected. The fast driver defines the

ioctl()

operations shown in below.

Table 7-3: JTAG UART ioctl() Operations for the Fast Driver Only

Request

Meaning

TIOCSTIMEOUT

Set the timeout (in seconds) after which the driver will decide that the host is

not connected. A timeout of 0 makes the target assume that the host is always

connected. The

ioctl

arg parameter passed in must be a pointer to an integer.

TIOCGCON-

NECTED

Sets the integer arg parameter to a value that indicates whether the host is

connected and acting as a terminal (1), or not connected (0). The

ioctl

arg

parameter passed in must be a pointer to an integer.

Nios II Software Developer's Handbook

For details about the

ioctl()

function, refer to the Nios II Software Developer's Handbook.

Software Files

The JTAG UART core is accompanied by the following software files. These files define the low-level

interface to the hardware, and provide the HAL drivers. Application developers should not modify these

files.

7-8

Driver Options: Fast vs. Small Implementations

UG-01085

2014.24.07

Altera Corporation

JTAG UART Core

Send Feedback