EasyManua.ls Logo

Altera DE1-SoC - Page 12

Altera DE1-SoC
45 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
DE1-SOC COMPUTER SYSTEM WITH NIOS II For Quartus II 15.0
/* function prototypes */
void put_jtag(char);
char get_jtag(void);
/********************************************************************************
* This program demonstrates use of the JTAG UART port in the DE1-SoC Computer
* It performs the following:
* 1. sends a text string to the JTAG UART
* 2. reads and echos character data from/to the JTAG UART
********************************************************************************/
int main(void)
{
char text_string[] = "\nJTAG UART example code\n> \0";
char *str, c;
/* print a text string */
for (str = text_string; *str != 0; ++str)
put_jtag (*str);
/* read and echo characters */
while (1)
{
c = get_jtag ( );
if (c != ’\0’)
put_jtag (c);
}
}
/********************************************************************************
* Subroutine to send a character to the JTAG UART
********************************************************************************/
void put_jtag( char c )
{
volatile int * JTAG_UART_ptr = (int *) 0xFF201000; // JTAG UART address
int control;
control = *(JTAG_UART_ptr + 1); // read the JTAG_UART control register
if (control & 0xFFFF0000) // if space, echo character, else ignore
*(JTAG_UART_ptr) = c;
}
Figure 12. An example of C code that uses the JTAG UART (Part a).
12 Altera Corporation - University Program
2015

Other manuals for Altera DE1-SoC

Related product manuals