K74B/87400/drivers/hdf/sfrs/lins_sfr.h
2024-01-25 14:22:18 +08:00

262 lines
11 KiB
C

/**
* @copyright 2022 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 lins_sfr.h
*/
#ifndef LINS_SFR_H__
#define LINS_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
#define LINS_DL_LENGTH_POS (0)
#define LINS_DL_DISBITMON_POS (6)
#define LINS_DL_ENHCHK_POS (7)
#define DATAACK_TPYE_RECEIVE (0x01)
#define DATAACK_TPYE_TRANSMIT (0x03)
/**
* @brief A structure to represent Special Function Registers for LINS.
*/
typedef union{
struct{
uint8_t DATA; /*<! Data Buffer 1 +0x000 */
uint8_t _RESERVED_01[3]; /* +0x001 */
};
uint32_t WORD;
}LINS_DATABUF_t;
typedef struct {
LINS_DATABUF_t DATABUFF[8]; /*<! Data Buffer 1 +0x000 */
union {
struct {
uint8_t STARTREQ : 1; /*!< Start Request */
uint8_t WAKEUPREQ : 1; /*!< WakeUp Request */
uint8_t RST_INT_ERR : 2; /*!< Reset Reset interrupt, Error */
uint8_t DATAACK_TPYE : 2; /*!< Data Acknowledgement type : 0x01: received ack, 0x03: Transmit ack*/
uint8_t : 1; /* (reserved) */
uint8_t STOP : 1; /*!< Stop Register */
uint8_t : 8; /* (reserved) */
uint8_t MASTERMODE : 1; /*!< Master Mode Register */
uint8_t UARTMODE : 1; /*!< UART Mode Register */
uint8_t AUTOBAUDMODE : 1; /*!< AUTOBAUD Enable Register */
uint8_t : 5; /* (reserved) */
uint8_t : 8; /* (reserved) */
};
uint32_t WORD;
} CTRL; /* +0x020 */
union {
struct {
uint8_t COMPLETE : 1;
uint8_t WAKEUP : 1;
uint8_t ERROR : 1; /*!< Lin Error */
uint8_t INTR : 1; /*!< Interupt Request */
uint8_t DATAREQ : 1; /*!< Data Request */
uint8_t ABORTED : 1;
uint8_t BUSIDLETIMEOUT : 1; /*!< BUS Idle Timeout */
uint8_t ACTIVE : 1; /*!< Lin Bus Active */
uint8_t SYNCHRONIZED : 8; /*!< Synchronized Flag */
uint16_t : 16; /* (reserved) */
};
uint32_t WORD;
} STATUS; /* +0x024 */
union {
struct {
uint8_t BITERR : 1; /*!< Bit Error in Byte field */
uint8_t CHK : 1; /*!< Checksum Error */
uint8_t TIMEOUT : 1; /*!< Timeout Error */
uint8_t PARITY : 1; /*!< Parity Error */
uint8_t BITMON : 1; /*!< Bit Monitor Error */
uint8_t SBITERR : 1; /*!< Start Bit Error in Byte field */
uint8_t FRAMEERR : 1; /*!< Byte Field Framing Error */
uint8_t BITMONSTOP : 1; /*!< Bit Monitor Error occurred in Stop Bit */
uint8_t BITMONDATA : 8; /*!< Bit Monitor Error occurred in Start or Data Bits */
uint16_t : 16; /* (reserved) */
};
uint32_t WORD;
} ERROR; /* +0x028 */
union {
struct {
uint8_t LENGTH : 4; /*!< Data Length */
uint8_t : 2; /* (reserved) */
uint8_t DISBITMON : 1; /*!< Disable Bit Monitor */
uint8_t ENHCHK : 1; /*!< Enhancement Check */
uint32_t : 24; /* (reserved) */
};
uint32_t WORD;
} DL; /* +0x02C */
uint16_t BTDIVSYNC; /*<! Bit time Divider +0x030 */
uint8_t _RESERVED_32[2]; /* +0x032 */
union {
struct {
uint8_t : 6; /* (reserved) */
uint8_t PRESCL : 2; /*!< Prescaler Register */
uint32_t : 24; /* (reserved) */
};
uint32_t WORD;
} BITTIME; /* +0x034 */
uint8_t ID; /* +0x038 */
uint8_t _RESERVED_39[3]; /* +0x039 */
union {
struct {
uint8_t WUPREPEAT : 2; /*!< wakeup repeat time */
uint8_t BUSINACTIVE : 2; /*!< Bus Inactivity Time */
uint8_t BUSDOMINANTRELEASEWUPENA : 1; /*!< Bus Dominant Release Wakeup Enable */
uint8_t : 3; /* (reserved) */
uint8_t : 8; /* (reserved) */
uint8_t TIMEOUT_COUNT : 8; /*!< Timeout Count Value */
uint8_t : 8; /* (reserved) */
};
uint32_t WORD;
} BUSTIME; /* +0x03C */
union {
struct {
uint8_t COMPLETETX : 1; /*!< Complete TX */
uint8_t BUSIDLETIMEOUTDOMINANT : 1; /*!< Dominant Bus Idle Timeout */
uint8_t BUSIDLEMONITOR : 2; /*!< Bus Idle Monitor Status */
uint8_t : 4; /* (reserved) */
uint32_t : 24; /* (reserved) */
};
uint32_t WORD;
} TX_STATUS; /* +0x040 */
uint8_t WUPDETECTTHRES; /*<! Wakeup Detection Threshold +0x044 */
uint8_t _RESERVED_45[3]; /* +0x045 */
union {
struct {
uint8_t INTERBYTECNT : 8; /*!< Inter-Byte Space Bit Count */
uint8_t BITMONMODE : 8; /*!< BIT Monitor Mode */
uint8_t DUTYMINSEL : 1; /*!< Minimum Duty Select */
uint8_t DUTYMAXSEL : 1; /*!< Maximum Duty Select */
uint8_t DISBIT2CHECK : 1; /*!< Disable Two Bits Width Check */
uint8_t : 5; /* (reserved) */
uint8_t : 8; /* (reserved) */
};
uint32_t WORD;
} CONF; /* +0x048 */
union {
struct {
uint8_t RXDONE : 1; /*!< Rx Data ready Interrupt Enable */
uint8_t OVRUNERR : 1; /*!< RX overflow error Interrupt Enable */
uint8_t FRMERR : 1; /*!< Framing error Interrupt Enable */
uint8_t : 1; /* (reserved) */
uint8_t BREAKKERR : 1; /*!< Break Error Interrupt Enable */
uint8_t TXDONE : 1; /*!< Transmission done Interrupt Enable */
uint8_t : 2; /* (reserved) */
uint8_t RXTOUT : 1; /*!< Rx Time-out Interrupt Enable */
uint8_t UNRUNERR : 1; /*!< RX underflow error Interrupt Enable */
uint8_t OVERRUNERR : 1; /*!< TX overflow error Interrupt Enable */
uint8_t SYNC_FIELD_RECEIVED : 1; /*!< Sync Received Interrupt Enable */
uint8_t : 4; /* (reserved) */
uint16_t : 16; /* (reserved) */
};
uint32_t WORD;
} UARTINTENA; /* +0x04C */
union {
struct {
uint8_t RXDONE : 1; /*!< Rx Data ready Interrupt Clear */
uint8_t OVRUNERR : 1; /*!< RX overflow error Interrupt Clear */
uint8_t FRMERR : 1; /*!< Framing error Interrupt Clear */
uint8_t : 1; /* (reserved) */
uint8_t BREAKKERR : 1; /*!< Break Error Interrupt Clear */
uint8_t TXDONE : 1; /*!< Transmission done Interrupt Clear */
uint8_t : 2; /* (reserved) */
uint8_t RXTOUT : 1; /*!< Rx Time-out Interrupt Clear */
uint8_t UNRUNERR : 1; /*!< RX underflow error Interrupt Clear */
uint8_t OVERRUNERR : 1; /*!< TX overflow error Interrupt Clear */
uint8_t SYNC_FIELD_RECEIVED : 1; /*!< Sync Received Interrupt Clear */
uint8_t : 4; /* (reserved) */
uint16_t : 16; /* (reserved) */
};
uint32_t WORD;
} UARTINTCLR; /* +0x050 */
union {
struct {
uint8_t RXDONE : 1; /*!< Rx Data ready */
uint8_t OVRUNERR : 1; /*!< RX overflow error */
uint8_t FRMERR : 1; /*!< Framing error */
uint8_t : 1; /* (reserved) */
uint8_t BREAKKERR : 1; /*!< Break IRQ */
uint8_t TXDONE : 1; /*!< Transmission is done */
uint8_t : 2; /* (reserved) */
uint8_t RXTOUT : 1; /*!< Rx Time-out */
uint8_t UNRUNERR : 1; /*!< RX underflow error */
uint8_t OVERRUNERR : 1; /*!< TX overflow error */
uint8_t SYNC_FIELD_RECEIVED : 1; /*!< Sync Received Flag */
uint8_t : 4; /* (reserved) */
uint16_t : 16; /* (reserved) */
};
uint32_t WORD;
} UARTINTSTATUS; /* +0x054 */
} LINS_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 LINS SFRS.
*/
#define LINS_SFRS ((__IO LINS_SFRS_t *)0x40001C00)
#endif /* end of __LINS_SFR_H__ section */