114 lines
4.1 KiB
C
114 lines
4.1 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 gtimer_sfr.h
|
||
|
*/
|
||
|
|
||
|
#ifndef GTIMER_SFR_H__
|
||
|
#define GTIMER_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
|
||
|
|
||
|
typedef struct {
|
||
|
union {
|
||
|
struct {
|
||
|
uint8_t GTDCEN : 1; /*!< <b>GT1 Direction Control Enable</b> */
|
||
|
uint8_t GTPRES : 4; /*!< <b>Prescaler select</b> */
|
||
|
uint8_t GTEDGE : 1; /*!< <b>GT1 Edge select in capture mode/reload mode</b> */
|
||
|
uint8_t GTHRSEL : 2; /*!< <b>GT1 hardware run selection</b> */
|
||
|
uint8_t GTCAPEN : 1; /*!< <b>GT1 Capture Enable</b> */
|
||
|
uint8_t GTCNTEN : 1; /*!< <b>GT1 Counter Mode Enable</b> */
|
||
|
uint8_t GTR : 1; /*!< <b>Timer GT1 run bit</b> */
|
||
|
uint8_t GTEXTEN : 1; /*!< <b>GT1 external enable control</b> */
|
||
|
uint8_t GTSSE : 1; /*!< <b>GT1 single shot enable</b> */
|
||
|
uint8_t : 1; /* (reserved) */
|
||
|
uint8_t GTEXTF : 1; /*!< <b>GT1 external flag</b> */
|
||
|
uint8_t GTTF : 1; /*!< <b>GT1 overflow/underflow flag</b> */
|
||
|
uint16_t : 16; /* (reserved) */
|
||
|
};
|
||
|
uint32_t WORD;
|
||
|
} GTCTRLR; /* +0x000 */
|
||
|
|
||
|
union {
|
||
|
struct {
|
||
|
uint8_t : 6; /* (reserved) */
|
||
|
uint8_t GTEXTFIE : 1; /*!< <b>External interrupt enable</b> */
|
||
|
uint8_t GTTFIE : 1; /*!< <b>Overflow/underflow interrupt enable</b> */
|
||
|
uint8_t : 6; /* (reserved) */
|
||
|
uint8_t GTEXTFC : 1; /*!< <b>GT1EXTF Clear</b> */
|
||
|
uint8_t GTTFC : 1; /*!< <b>GT1TF Clear</b> */
|
||
|
uint16_t : 16; /* (reserved) */
|
||
|
};
|
||
|
uint32_t WORD;
|
||
|
} GTINTCTRLR; /* +0x004 */
|
||
|
uint16_t GTRCV; /*<! <b>GT1 Reload/Capture Value</b> +0x008 */
|
||
|
uint8_t _RESERVED_0A[2]; /* +0x00A */
|
||
|
uint16_t GTCV; /* +0x00C */
|
||
|
uint8_t _RESERVED_0E[2]; /* +0x00E */
|
||
|
}GTimer_t;
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
/**
|
||
|
* @brief A structure to represent Special Function Registers for GTIMER.
|
||
|
*/
|
||
|
typedef struct {
|
||
|
GTimer_t TIMER[5];
|
||
|
} GTIMER_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 GTIMER SFRS.
|
||
|
*/
|
||
|
#define GTIMER_SFRS ((__IO GTIMER_SFRS_t *)0x40010c00)
|
||
|
|
||
|
#endif /* end of __GTIMER_SFR_H__ section */
|
||
|
|
||
|
|