| 1 | /***********************************************************************/ |
|---|
| 2 | /* */ |
|---|
| 3 | /* MODULE: bcmuart.h */ |
|---|
| 4 | /* DATE: 02/15/02 */ |
|---|
| 5 | /* PURPOSE: Definitions for UART block */ |
|---|
| 6 | /* */ |
|---|
| 7 | /***********************************************************************/ |
|---|
| 8 | #ifndef _BCMUART_H |
|---|
| 9 | #define _BCMUART_H |
|---|
| 10 | |
|---|
| 11 | #include "bcmmips.h" |
|---|
| 12 | #include "boardcfg.h" |
|---|
| 13 | #include "bchp_common.h" |
|---|
| 14 | #include "bchp_uarta.h" |
|---|
| 15 | #include "bchp_uartb.h" |
|---|
| 16 | |
|---|
| 17 | #if !defined _ASMLANGUAGE |
|---|
| 18 | #if __cplusplus |
|---|
| 19 | extern "C" { |
|---|
| 20 | #endif |
|---|
| 21 | #endif |
|---|
| 22 | |
|---|
| 23 | /* UART register base addresses */ |
|---|
| 24 | #define UARTA_ADR_BASE BCM_PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_UARTA_RBR) |
|---|
| 25 | #define UARTB_ADR_BASE BCM_PHYS_TO_K1(BCHP_PHYSICAL_OFFSET+BCHP_UARTA_RBR) |
|---|
| 26 | |
|---|
| 27 | #define UART_ADR_BASE UARTA_ADR_BASE |
|---|
| 28 | #define console_out _writeasm |
|---|
| 29 | |
|---|
| 30 | /* UART registers */ |
|---|
| 31 | #define UART_RXSTAT 0x00 |
|---|
| 32 | #define UART_RXDATA 0x04 |
|---|
| 33 | #define UART_CONTROL 0x0c |
|---|
| 34 | #define UART_BAUDHI 0x10 |
|---|
| 35 | #define UART_BAUDLO 0x14 |
|---|
| 36 | #define UART_TXSTAT 0x18 |
|---|
| 37 | #define UART_TXDATA 0x1c |
|---|
| 38 | |
|---|
| 39 | /* RXSTAT bit definitions */ |
|---|
| 40 | #define PARERR 0x20 |
|---|
| 41 | #define FRAMEERR 0x10 |
|---|
| 42 | #define OVERRUNERR 0x08 |
|---|
| 43 | #define RXDATARDY 0x04 |
|---|
| 44 | #define RXINTEN 0x02 |
|---|
| 45 | /* CONTROL bit definitions */ |
|---|
| 46 | #define BITM8 0x10 |
|---|
| 47 | #define PAREN 0x08 |
|---|
| 48 | #define TXEN 0x04 |
|---|
| 49 | #define RXEN 0x02 |
|---|
| 50 | #define PODD 0x01 |
|---|
| 51 | /* TXSTAT bit definitions */ |
|---|
| 52 | #define TXINTEN 0x04 |
|---|
| 53 | #define TXIDLE 0x02 |
|---|
| 54 | #define TXDREGEMT 0x01 |
|---|
| 55 | |
|---|
| 56 | |
|---|
| 57 | #if !defined _ASMLANGUAGE |
|---|
| 58 | |
|---|
| 59 | /********************************************************************** |
|---|
| 60 | Uart Register Structure |
|---|
| 61 | **********************************************************************/ |
|---|
| 62 | typedef struct UartChannel { |
|---|
| 63 | volatile unsigned long rxstat; |
|---|
| 64 | volatile unsigned long rxdata; |
|---|
| 65 | volatile unsigned long unused; |
|---|
| 66 | volatile unsigned long control; |
|---|
| 67 | volatile unsigned long baudh; |
|---|
| 68 | /* When divide SysClk/2/(1+baudword) we should get 32*bit-rate |
|---|
| 69 | */ |
|---|
| 70 | volatile unsigned long baudl; |
|---|
| 71 | volatile unsigned long txstat; |
|---|
| 72 | volatile unsigned long txdata; |
|---|
| 73 | } UartChannel; |
|---|
| 74 | |
|---|
| 75 | #define UARTA ((volatile UartChannel *) UARTA_ADR_BASE) |
|---|
| 76 | #define UARTB ((volatile UartChannel *) UARTB_ADR_BASE) |
|---|
| 77 | |
|---|
| 78 | #define UART ((volatile UartChannel *) UART_ADR_BASE) |
|---|
| 79 | |
|---|
| 80 | #endif /* _ASMLANGUAGE */ |
|---|
| 81 | |
|---|
| 82 | /****************************************************************** |
|---|
| 83 | * Baud Rate Table |
|---|
| 84 | * XTALFREQ / baud rate / 16 |
|---|
| 85 | ******************************************************************/ |
|---|
| 86 | #define XTALFREQ 27000000 |
|---|
| 87 | |
|---|
| 88 | |
|---|
| 89 | #if !defined _ASMLANGUAGE |
|---|
| 90 | #if __cplusplus |
|---|
| 91 | } |
|---|
| 92 | #endif |
|---|
| 93 | #endif |
|---|
| 94 | |
|---|
| 95 | #endif /* _BCMUART_H */ |
|---|