111 lines
2.7 KiB
C
111 lines
2.7 KiB
C
/* Copyright 2018 Canaan Inc.
|
||
*
|
||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||
* you may not use this file except in compliance with the License.
|
||
* You may obtain a copy of the License at
|
||
*
|
||
* http://www.apache.org/licenses/LICENSE-2.0
|
||
*
|
||
* Unless required by applicable law or agreed to in writing, software
|
||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||
* See the License for the specific language governing permissions and
|
||
* limitations under the License.
|
||
*/
|
||
|
||
/**
|
||
* @file
|
||
* @brief Universal Asynchronous Receiver/Transmitter (UART)
|
||
*
|
||
* The UART peripheral supports the following features:
|
||
*
|
||
* - 8-N-1 and 8-N-2 formats: 8 data bits, no parity bit, 1 start
|
||
* bit, 1 or 2 stop bits
|
||
*
|
||
* - 8-entry transmit and receive FIFO buffers with programmable
|
||
* watermark interrupts
|
||
*
|
||
* - 16× Rx oversampling with 2/3 majority voting per bit
|
||
*
|
||
* The UART peripheral does not support hardware flow control or
|
||
* other modem control signals, or synchronous serial data
|
||
* tranfesrs.
|
||
*
|
||
*
|
||
*/
|
||
|
||
#ifndef _DRIVER_APBUART_H
|
||
#define _DRIVER_APBUART_H
|
||
|
||
#include <stdint.h>
|
||
#include "platform.h"
|
||
|
||
#ifdef __cplusplus
|
||
extern "C" {
|
||
#endif
|
||
|
||
typedef struct
|
||
{
|
||
union
|
||
{
|
||
volatile uint32_t RBR;
|
||
volatile uint32_t DLL;
|
||
volatile uint32_t THR;
|
||
};
|
||
|
||
union
|
||
{
|
||
volatile uint32_t DLH;
|
||
volatile uint32_t IER;
|
||
};
|
||
|
||
union
|
||
{
|
||
volatile uint32_t FCR;
|
||
volatile uint32_t IIR;
|
||
};
|
||
|
||
volatile uint32_t LCR;
|
||
volatile uint32_t MCR;
|
||
volatile uint32_t LSR;
|
||
volatile uint32_t MSR;
|
||
volatile uint32_t SCR;
|
||
volatile uint32_t LPDLL;
|
||
volatile uint32_t LPDLH;
|
||
volatile uint32_t reserve[18];
|
||
volatile uint32_t FAR;
|
||
volatile uint32_t TFR;
|
||
volatile uint32_t RFW;
|
||
volatile uint32_t USR;
|
||
volatile uint32_t TFL;
|
||
volatile uint32_t RFL;
|
||
volatile uint32_t SRR;
|
||
volatile uint32_t SRTS;
|
||
volatile uint32_t SBCR;
|
||
volatile uint32_t SDMAM;
|
||
volatile uint32_t SFE;
|
||
volatile uint32_t SRT;
|
||
volatile uint32_t STET;
|
||
volatile uint32_t HTX;
|
||
volatile uint32_t DMASA;
|
||
volatile uint32_t TCR;
|
||
volatile uint32_t DE_EN;
|
||
volatile uint32_t RE_EN;
|
||
volatile uint32_t DET;
|
||
volatile uint32_t TAT;
|
||
volatile uint32_t DLF;
|
||
volatile uint32_t RAR;
|
||
volatile uint32_t TAR;
|
||
volatile uint32_t LCR_EXT;
|
||
volatile uint32_t R[5];
|
||
volatile uint32_t CPR;
|
||
volatile uint32_t UCV;
|
||
volatile uint32_t CTR;
|
||
} uart_t;
|
||
|
||
#ifdef __cplusplus
|
||
}
|
||
#endif
|
||
|
||
#endif /* _DRIVER_APBUART_H */
|