Altera_Forum
Honored Contributor
16 years agohow to access the jtag uart in the nios code
Hi,
I'm trying to control the jtag uart in my small footprint nios. But I can't get it working. I mix up the instance or I'm missing header files. in my system.h file the jtag uart is declared as:
#define ALT_MODULE_CLASS_jtag_uart_0 altera_avalon_jtag_uart
#define JTAG_UART_0_BASE 0x44080
#define JTAG_UART_0_IRQ 2
#define JTAG_UART_0_IRQ_INTERRUPT_CONTROLLER_ID 0
#define JTAG_UART_0_NAME "/dev/jtag_uart_0"
#define JTAG_UART_0_READ_DEPTH 64
#define JTAG_UART_0_READ_THRESHOLD 8
#define JTAG_UART_0_SPAN 8
#define JTAG_UART_0_TYPE "altera_avalon_jtag_uart"
#define JTAG_UART_0_WRITE_DEPTH 64
#define JTAG_UART_0_WRITE_THRESHOLD 8
In my c file I try to acces the 32bits control and data register. But that doesn't work. Here is that code
#include <unistd.h>
#include <system.h>
#include "sys/alt_stdio.h"
#include "io.h"
#include "altera_avalon_pio_regs.h"
#include "iic.h"
#include "altera_avalon_jtag_uart.h"
#include "EVI_LVDS_Testchip.h"
int main (void)
{
altera_avalon_jtag_uart_init(JTAG_UART_0,altera_avalon_jtag_uart);
IOWR_ALTERA_AVALON_JTAG_UART_CONTROL(0,0);
ALT_DRIVER_READ(JTAG_UART_0_NAME, c, 1, 0);
}
When I compile it I get
EVI_LVDS_Testchip.c: In function `main':
EVI_LVDS_Testchip.c:33: warning: implicit declaration of function `altera_avalon_jtag_uart_init'
EVI_LVDS_Testchip.c:33: error: `JTAG_UART_0' undeclared (first use in this function)
EVI_LVDS_Testchip.c:33: error: (Each undeclared identifier is reported only once
EVI_LVDS_Testchip.c:33: error: for each function it appears in.)
EVI_LVDS_Testchip.c:33: error: `altera_avalon_jtag_uart' undeclared (first use in this function)
EVI_LVDS_Testchip.c:34: warning: implicit declaration of function `IOWR_ALTERA_AVALON_JTAG_UART_CONTROL'
EVI_LVDS_Testchip.c:35: warning: implicit declaration of function `ALT_DRIVER_READ'
make: *** Error 1
Any idea how to access these two registers? Rgds, Kimberley