Nios® V/II Embedded Design Suite (EDS)
Support for Embedded Development Tools, Processors (SoCs and Nios® V/II processor), Embedded Development Suites (EDSs), Boot and Configuration, Operating Systems, C and C++

ioctl

Altera_Forum
Honored Contributor II
1,236 Views

In my application I'm using the JTAG UART as STDIO and one UART. The UART communicates with another application and the JTAG UART is used for service. My problem is that if there is no NIOS2-terminal connected, strings which are send over the JTAG UART are collected in the output buffer of the JTAG UART. Communication functions only as far as the JTAG buffer is not full.  

The NIOS2 processor reference handbook tells me to call the ioctl() function with the parameter TIOCGCONNECTED ( see page 9-10) to see the JTAG UART is connected, but the function seems not to work. May be I make a mistake. 

 

Here is my source code: 

 

int jtag = 99; 

 

ioctl(STDIN_FILENO, TIOCGCONNECTED, &jtag); 

 

After the function call jtag should be 0 if the JTAG Port is not connected and 1 it is connected. After compilation no error is displayed, but it doesn't work. 

 

Has anybody an idea ?
0 Kudos
2 Replies
Altera_Forum
Honored Contributor II
502 Views

Hi Andreas, 

 

> Has anybody an idea ? 

 

If you set the "Reduced device drivers" checkbox in the system library properties, 

the ioctl operation is set to NULL ... in which case I believe the ioctl call will just return 

-ENOTTY. 

 

Regards, 

--Scott
0 Kudos
Altera_Forum
Honored Contributor II
502 Views

 

--- Quote Start ---  

originally posted by smcnutt@Oct 25 2005, 04:17 PM 

hi andreas, 

 

> has anybody an idea ? 

 

if you set the "reduced device drivers" checkbox in the system library properties, 

the ioctl operation is set to null ... in which case i believe the ioctl call will just return 

-enotty. 

 

regards, 

--scott 

<div align='right'><{post_snapback}> (index.php?act=findpost&pid=10571) 

--- quote end ---  

 

--- Quote End ---  

 

 

 

Hi Scott, 

 

I think I get the answer to the problem. 

I have to read out the AC Control BIT in the JTAG UART Control Register via IORD_AVALON.... The AC bit tells an external component is connected through the JTAG connector ( AC bit = set) or not. Once set it could only be reseted by writing a one to the AC bit. (see NIOS II Reference Handbook page 9-13). 

 

Thank you for your help 

 

Regards, 

 

Andreas
0 Kudos
Reply