244 lines
9.8 KiB
C
244 lines
9.8 KiB
C
/**
|
|
* @copyright 2023 indie Semiconductor
|
|
*
|
|
* This file is proprietary to indie Semiconductor.
|
|
* All rights reserved. Reproduction or distribution, in whole
|
|
* or in part, is forbidden except by express written permission
|
|
* of indie Semiconductor.
|
|
*
|
|
* @file uart0_sfr.h
|
|
*/
|
|
|
|
#ifndef UART0_SFR_H__
|
|
#define UART0_SFR_H__
|
|
|
|
#include <stdint.h>
|
|
|
|
/* ------- Start of section using anonymous unions and disabling warnings ------- */
|
|
#if defined (__CC_ARM)
|
|
#pragma push
|
|
#pragma anon_unions
|
|
#elif defined (__ICCARM__)
|
|
#pragma language=extended
|
|
#elif defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050)
|
|
#pragma clang diagnostic push
|
|
#pragma clang diagnostic ignored "-Wc11-extensions"
|
|
#pragma clang diagnostic ignored "-Wreserved-id-macro"
|
|
#elif defined (__GNUC__)
|
|
/* anonymous unions are enabled by default */
|
|
#elif defined (__TMS470__)
|
|
/* anonymous unions are enabled by default */
|
|
#elif defined (__TASKING__)
|
|
#pragma warning 586
|
|
#elif defined (__CSMC__)
|
|
/* anonymous unions are enabled by default */
|
|
#else
|
|
#warning Not supported compiler type
|
|
#endif
|
|
|
|
/**
|
|
* @brief A structure to represent Special Function Registers for UART0.
|
|
*/
|
|
typedef struct {
|
|
|
|
union {
|
|
struct {
|
|
uint8_t BYTE : 8; /*!< Data */
|
|
uint8_t DUMMY0 : 8; /*!< Data */
|
|
uint8_t DUMMY1 : 8; /*!< Data */
|
|
uint8_t DUMMY2 : 8; /*!< Data */
|
|
};
|
|
uint32_t WORD;
|
|
} DATA; /* +0x000 */
|
|
|
|
union {
|
|
struct {
|
|
uint8_t FRAMEERROR : 1; /*!< Framing Error */
|
|
uint8_t PARITYERROR : 1; /*!< Parity Error */
|
|
uint8_t BREAKERROR : 1; /*!< Break Error */
|
|
uint8_t : 5; /* (reserved) */
|
|
uint32_t : 24; /* (reserved) */
|
|
};
|
|
uint32_t WORD;
|
|
} UARTDATARECEIVESTATUS; /* +0x004 */
|
|
|
|
union {
|
|
struct {
|
|
uint8_t ENABLE : 1;
|
|
uint8_t ENABLE_STS : 1; /*!< Enable status */
|
|
uint8_t UFIFOSOFTRESET : 1; /*!< FIFO SOFT RESET */
|
|
uint8_t RXXFERCNTCLR : 1; /*!< RX Transfer Counter Clear */
|
|
uint8_t TXXFERCNTCLR : 1; /*!< TX Transfer Counter Clear */
|
|
uint8_t : 3; /* (reserved) */
|
|
uint8_t SIZE : 2; /*!< Transmission word size */
|
|
uint8_t STOP : 1; /*!< Stop bit control */
|
|
uint8_t PARITY : 2; /*!< Parity: 00: NONE, 01: EVEN, 11: ODD */
|
|
uint8_t STICKENA : 1; /*!< Sticky parity enable */
|
|
uint8_t : 2; /* (reserved) */
|
|
uint8_t : 6; /* (reserved) */
|
|
uint8_t BREAKENA : 1; /*!< Break enable */
|
|
uint8_t LOOPENA : 1; /*!< Loopback enable */
|
|
uint8_t : 8; /* (reserved) */
|
|
};
|
|
uint32_t WORD;
|
|
} MSGCTRL; /* +0x008 */
|
|
|
|
union {
|
|
struct {
|
|
union {
|
|
struct {
|
|
uint8_t RXDONE : 1; /*!< Rx Data ready Interrupt Enable */
|
|
uint8_t OVRUNERR : 1; /*!< RX FIFO overflow error Interrupt Enable */
|
|
uint8_t FRMERR : 1; /*!< Framing error Interrupt Enable */
|
|
uint8_t PRTYERR : 1; /*!< Parity Error Interrupt Enable */
|
|
uint8_t BREAKKERR : 1; /*!< Break Error Interrupt Enable */
|
|
uint8_t TXDONE : 1; /*!< Transmission done Interrupt Enable */
|
|
uint8_t RXMULTDONE : 1; /*!< Multiple Receive Transactions Done Interrupt Enable */
|
|
uint8_t TXMULTDONE : 1; /*!< Multiple Transmit Transactions Done Interrupt Enable */
|
|
};
|
|
uint8_t BYTE;
|
|
} ENABLE;
|
|
union {
|
|
struct {
|
|
uint8_t RXDONE : 1; /*!< Rx Data ready Interrupt Clear */
|
|
uint8_t OVRUNERR : 1; /*!< RX FIFO overflow error Interrupt Clear */
|
|
uint8_t FRMERR : 1; /*!< Framing error Interrupt Clear */
|
|
uint8_t PRTYERR : 1; /*!< Parity Error Interrupt Clear */
|
|
uint8_t BREAKKERR : 1; /*!< Break Error Interrupt Clear */
|
|
uint8_t TXDONE : 1; /*!< Transmission done Interrupt Clear */
|
|
uint8_t RXMULTDONE : 1; /*!< Multiple Receive Transactions Done Interrupt Clear */
|
|
uint8_t TXMULTDONE : 1; /*!< Multiple Transmit Transactions Done Interrupt Clear */
|
|
};
|
|
uint8_t BYTE;
|
|
} CLEAR;
|
|
union {
|
|
struct {
|
|
uint8_t RXDONE : 1; /*!< Rx Data ready */
|
|
uint8_t OVRUNERR : 1; /*!< RX FIFO overflow error */
|
|
uint8_t FRMERR : 1; /*!< Framing error */
|
|
uint8_t PRTYERR : 1; /*!< Parity Error */
|
|
uint8_t BREAKKERR : 1; /*!< Break IRQ */
|
|
uint8_t TXDONE : 1; /*!< Transmission is done */
|
|
uint8_t RXMULTDONE : 1; /*!< Multiple Receive Transactions Done */
|
|
uint8_t TXMULTDONE : 1; /*!< Multiple Transmit Transactions Done */
|
|
};
|
|
uint8_t BYTE;
|
|
} STATUS;
|
|
union {
|
|
struct {
|
|
uint8_t RXDONE : 1; /*!< Rx Data ready Interrupt */
|
|
uint8_t OVRUNERR : 1; /*!< RX FIFO overflow error Interrupt */
|
|
uint8_t FRMERR : 1; /*!< Framing error Interrupt */
|
|
uint8_t PRTYERR : 1; /*!< Parity Error Interrupt */
|
|
uint8_t BREAKKERR : 1; /*!< Break Error Interrupt */
|
|
uint8_t TXDONE : 1; /*!< Transmission done Interrupt */
|
|
uint8_t RXMULTDONE : 1; /*!< Multiple Receive Transactions Done Interrupt */
|
|
uint8_t TXMULTDONE : 1; /*!< Multiple Transmit Transactions Done Interrupt */
|
|
};
|
|
uint8_t BYTE;
|
|
} IRQ;
|
|
};
|
|
uint32_t WORD;
|
|
} UARTINT; /* +0x00C */
|
|
|
|
union {
|
|
struct {
|
|
union {
|
|
struct {
|
|
uint8_t RXTOUT : 1; /*!< Rx Time-out Interrupt Enable */
|
|
uint8_t UNRUNERR : 1; /*!< RX FIFO underflow error Interrupt Enable */
|
|
uint8_t OVERRUNERR : 1; /*!< TX FIFO overflow error Interrupt Enable */
|
|
uint8_t : 5; /* (reserved) */
|
|
};
|
|
uint8_t BYTE;
|
|
} ENABLE;
|
|
union {
|
|
struct {
|
|
uint8_t RXTOUT : 1; /*!< Rx Time-out Interrupt Clear */
|
|
uint8_t UNRUNERR : 1; /*!< RX FIFO underflow error Interrupt Clear */
|
|
uint8_t OVERRUNERR : 1; /*!< TX FIFO overflow error Interrupt Clear */
|
|
uint8_t : 5; /* (reserved) */
|
|
};
|
|
uint8_t BYTE;
|
|
} CLEAR;
|
|
union {
|
|
struct {
|
|
uint8_t RXTOUT : 1; /*!< Rx Time-out */
|
|
uint8_t UNRUNERR : 1; /*!< RX FIFO underflow error */
|
|
uint8_t OVERRUNERR : 1; /*!< TX FIFO overflow error */
|
|
uint8_t : 5; /* (reserved) */
|
|
};
|
|
uint8_t BYTE;
|
|
} STATUS;
|
|
union {
|
|
struct {
|
|
uint8_t RXTOUT : 1; /*!< Rx Time-out Interrupt */
|
|
uint8_t UNRUNERR : 1; /*!< RX FIFO underflow error Interrupt */
|
|
uint8_t OVERRUNERR : 1; /*!< TX FIFO overflow error Interrupt */
|
|
uint8_t : 5; /* (reserved) */
|
|
};
|
|
uint8_t BYTE;
|
|
} IRQ;
|
|
};
|
|
uint32_t WORD;
|
|
} UARTINT2; /* +0x010 */
|
|
|
|
union {
|
|
struct {
|
|
uint8_t FDIV : 3; /*!< Fractional divider */
|
|
uint32_t BAUDDIV : 16; /*!< Baud rate divider !!misaligned!! */
|
|
uint8_t : 5; /* (reserved) */
|
|
uint8_t OSR : 5; /*!< Over-sampling ratio */
|
|
uint8_t UADVANCE : 1; /*!< Advance Register */
|
|
uint8_t URETARD : 1; /*!< Retard Register */
|
|
uint8_t : 1; /* (reserved) */
|
|
};
|
|
uint32_t WORD;
|
|
} UARTBAUD; /* +0x014 */
|
|
|
|
union {
|
|
struct {
|
|
uint8_t : 1; /* (reserved) */
|
|
uint8_t RXEMPTY : 1; /*!< Reception FIFO empty */
|
|
uint8_t RXFULL : 1; /*!< Reception FIFO full */
|
|
uint8_t RXCOUNT : 5; /*!< Reception FIFO current count */
|
|
uint8_t : 1; /* (reserved) */
|
|
uint8_t TXEMPTY : 1; /*!< Transmit FIFO empty */
|
|
uint8_t TXFULL : 1; /*!< Transmit FIFO full */
|
|
uint8_t TXCOUNT : 5; /*!< Transmit FIFO current count */
|
|
uint8_t RXMULTIPLEXFERDONECNT : 8; /*!< Receive Data Count Interrupt */
|
|
uint8_t TXMULTIPLEXFERDONECNT : 8; /*!< Transmit Data Count Interrupt */
|
|
};
|
|
uint32_t WORD;
|
|
} UARTFIFO; /* +0x018 */
|
|
|
|
} UART0_SFRS_t;
|
|
|
|
/* -------- End of section using anonymous unions and disabling warnings -------- */
|
|
#if defined (__CC_ARM)
|
|
#pragma pop
|
|
#elif defined (__ICCARM__)
|
|
/* leave anonymous unions enabled */
|
|
#elif (__ARMCC_VERSION >= 6010050)
|
|
#pragma clang diagnostic pop
|
|
#elif defined (__GNUC__)
|
|
/* anonymous unions are enabled by default */
|
|
#elif defined (__TMS470__)
|
|
/* anonymous unions are enabled by default */
|
|
#elif defined (__TASKING__)
|
|
#pragma warning restore
|
|
#elif defined (__CSMC__)
|
|
/* anonymous unions are enabled by default */
|
|
#else
|
|
#warning Not supported compiler type
|
|
#endif
|
|
|
|
/**
|
|
* @brief The starting address of UART0 SFRS.
|
|
*/
|
|
#define UART0_SFRS ((__IO UART0_SFRS_t *)0x40015400)
|
|
|
|
#endif /* end of __UART0_SFR_H__ section */
|
|
|
|
|