OpenCores
URL https://opencores.org/ocsvn/uart_plb/uart_plb/trunk

Subversion Repositories uart_plb

[/] [uart_plb/] [trunk/] [firmware/] [uart_plb_test/] [src/] [uart_plb_test.c] - Blame information for rev 3

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 3 gavinux
/*
2
 * helloworld.c: simple uart test application
3
 */
4
 
5
#include <stdio.h>
6
#include "platform.h"
7
#include "xparameters.h"
8
 
9
int main()
10
{
11
    unsigned int data;
12
 
13
    init_platform();
14
 
15
    print("Hello World\n\r");
16
 
17
    data = 0x000019;  // baudrate 115200Hz @ 50MHz clock
18
    *((volatile int *)(XPAR_UART_PLB_0_BASEADDR + 0x10)) = data;
19
    data = 3; // reset RX FIFO & TX FIFO
20
    *((volatile int *)(XPAR_UART_PLB_0_BASEADDR + 0x08)) = data;
21
    data = 0; // enable RX FIFO & TX FIFO
22
    *((volatile int *)(XPAR_UART_PLB_0_BASEADDR + 0x08)) = data;
23
    while(1) {
24
        data = *((volatile int *)(XPAR_UART_PLB_0_BASEADDR + 0x0C));
25
        if (data & 0x3000000)
26
        {
27
            data = *((volatile int *)(XPAR_UART_PLB_0_BASEADDR));
28
            *((volatile int *)(XPAR_UARTLITE_1_BASEADDR + 0x04)) = data;
29
        }
30
    }
31
 
32
    cleanup_platform();
33
 
34
    return 0;
35
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.