OpenCores
URL https://opencores.org/ocsvn/1g_ethernet_dpi/1g_ethernet_dpi/trunk

Subversion Repositories 1g_ethernet_dpi

[/] [1g_ethernet_dpi/] [tags/] [vmblite_base/] [hw/] [src/] [rtl/] [wb_uart/] [drivers/] [wb_uart.c] - Blame information for rev 7

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 7 kuzmi4
 
2
#include "xil_types.h"
3
#include "wb_uart_regs.h"
4
#include "wb_uart.h"
5
 
6
u32 u32_wb_uart_base;
7
 
8
void wb_uart_init(int base)
9
{
10
    u32_wb_uart_base = (u32)base;
11
}
12
 
13
/* sync */
14
int  wb_uart_read_s(void)
15
{
16
    int rxd;
17
 
18
    IORD_WB_UART_STS(u32_wb_uart_base);
19
    while (WB_UART_RX_EF(u32_wb_uart_base));
20
    rxd = (IORD_WB_UART_DATA(u32_wb_uart_base) & 0xFF);
21
    return (rxd);
22
}
23
void wb_uart_write_s(int data)
24
{
25
    IORD_WB_UART_STS(u32_wb_uart_base);
26
    while (WB_UART_TX_BUSY(u32_wb_uart_base));
27
    IOWR_WB_UART_DATA(u32_wb_uart_base, data);
28
}
29
/* async */
30
int wb_uart_read_a(void)
31
{
32
    if (WB_UART_RX_EF(u32_wb_uart_base)) {
33
        return -1;
34
    }
35
    else {
36
        int rxd = IORD_WB_UART_DATA(u32_wb_uart_base) & 0xFF;
37
        return (rxd);
38
    }
39
}
40
int wb_uart_write_a(int data)
41
{
42
    if (WB_UART_TX_BUSY(u32_wb_uart_base)) {
43
        return -1;
44
    } else {
45
        IOWR_WB_UART_DATA(u32_wb_uart_base, data);
46
        return 0;
47
    }
48
}

powered by: WebSVN 2.1.0

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