123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380 |
- /*==================================================================================================
- * Project : RTD AUTOSAR 4.4
- * Platform : CORTEXM
- * Peripheral : Ftm_Srtc_Lptmr_LPit
- * Dependencies : none
- *
- * Autosar Version : 4.4.0
- * Autosar Revision : ASR_REL_4_4_REV_0000
- * Autosar Conf.Variant :
- * SW Version : 1.0.0
- * Build Version : S32K1_RTD_1_0_0_HF01_D2109_ASR_REL_4_4_REV_0000_20210907
- *
- * (c) Copyright 2020-2021 NXP Semiconductors
- * All Rights Reserved.
- *
- * NXP Confidential. This software is owned or controlled by NXP and may only be
- * used strictly in accordance with the applicable license terms. By expressly
- * accepting such terms or by downloading, installing, activating and/or otherwise
- * using the software, you are agreeing that you have read, and that you agree to
- * comply with and are bound by, such license terms. If you do not agree to be
- * bound by the applicable license terms, then you may not retain, install,
- * activate or otherwise use the software.
- ==================================================================================================*/
- #ifndef SRTC_IP_H
- #define SRTC_IP_H
- /**
- * @file SRtc_Ip.h
- *
- * @addtogroup srtc_ip Rtc IPL
- *
- * @{
- */
- #ifdef __cplusplus
- extern "C"{
- #endif
- /*==================================================================================================
- * INCLUDE FILES
- * 1) system and project includes
- * 2) needed interfaces from external units
- * 3) internal and external interfaces from this unit
- ==================================================================================================*/
- #include "SRtc_Ip_Types.h"
- #include "SRtc_Ip_Cfg.h"
- #include "OsIf.h"
- #include "Mcal.h"
- #if SRTC_IP_DEV_ERROR_DETECT == STD_ON
- #include "Devassert.h"
- #endif
- #include "SchM_Gpt.h"
- /*==================================================================================================
- * SOURCE FILE VERSION INFORMATION
- ==================================================================================================*/
- #define SRTC_IP_VENDOR_ID 43
- #define SRTC_IP_AR_RELEASE_MAJOR_VERSION 4
- #define SRTC_IP_AR_RELEASE_MINOR_VERSION 4
- #define SRTC_IP_AR_RELEASE_REVISION_VERSION 0
- #define SRTC_IP_SW_MAJOR_VERSION 1
- #define SRTC_IP_SW_MINOR_VERSION 0
- #define SRTC_IP_SW_PATCH_VERSION 0
- /*==================================================================================================
- * FILE VERSION CHECKS
- ==================================================================================================*/
- #if (SRTC_IP_VENDOR_ID != SRTC_IP_TYPES_VENDOR_ID)
- #error "SRtc_Ip.h and SRtc_Ip_Types.h have different vendor ids"
- #endif
- /* Check if header file and Gpt header file are of the same Autosar version */
- #if ((SRTC_IP_AR_RELEASE_MAJOR_VERSION != SRTC_IP_TYPES_AR_RELEASE_MAJOR_VERSION) || \
- (SRTC_IP_AR_RELEASE_MINOR_VERSION != SRTC_IP_TYPES_AR_RELEASE_MINOR_VERSION) || \
- (SRTC_IP_AR_RELEASE_REVISION_VERSION != SRTC_IP_TYPES_AR_RELEASE_REVISION_VERSION) \
- )
- #error "AutoSar Version Numbers of SRtc_Ip.h and SRtc_Ip_Types.h are different"
- #endif
- /* Check if source file and GPT header file are of the same Software version */
- #if ((SRTC_IP_SW_MAJOR_VERSION != SRTC_IP_TYPES_SW_MAJOR_VERSION) || \
- (SRTC_IP_SW_MINOR_VERSION != SRTC_IP_TYPES_SW_MINOR_VERSION) || \
- (SRTC_IP_SW_PATCH_VERSION != SRTC_IP_TYPES_SW_PATCH_VERSION) \
- )
- #error "Software Version Numbers of SRtc_Ip.h and SRtc_Ip_Types.h are different"
- #endif
- #if (SRTC_IP_VENDOR_ID != SRTC_IP_VENDOR_ID_CFG)
- #error "SRtc_Ip.h and SRtc_Ip_Cfg.h have different vendor ids"
- #endif
- /* Check if RTC_IP header file and RTC_IP_Cfg header file are of the same Autosar version */
- #if ((SRTC_IP_AR_RELEASE_MAJOR_VERSION != SRTC_IP_AR_RELEASE_MAJOR_VERSION_CFG) || \
- (SRTC_IP_AR_RELEASE_MINOR_VERSION != SRTC_IP_AR_RELEASE_MINOR_VERSION_CFG) || \
- (SRTC_IP_AR_RELEASE_REVISION_VERSION != SRTC_IP_AR_RELEASE_REVISION_VERSION_CFG) \
- )
- #error "AutoSar Version Numbers of SRtc_Ip.h and SRtc_Ip_Cfg.h are different"
- #endif
- /* Check if RTC_IP file and RTC_IP_Cfg header file are of the same Software version */
- #if ((SRTC_IP_SW_MAJOR_VERSION != SRTC_IP_SW_MAJOR_VERSION_CFG) || \
- (SRTC_IP_SW_MINOR_VERSION != SRTC_IP_SW_MINOR_VERSION_CFG) || \
- (SRTC_IP_SW_PATCH_VERSION != SRTC_IP_SW_PATCH_VERSION_CFG) \
- )
- #error "Software Version Numbers of SRtc_Ip.h and SRtc_Ip_Cfg.h are different"
- #endif
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
- #if ((SRTC_IP_AR_RELEASE_MAJOR_VERSION != SCHM_GPT_AR_RELEASE_MAJOR_VERSION) || \
- (SRTC_IP_AR_RELEASE_MINOR_VERSION != SCHM_GPT_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of SRtc_Ip.h and SchM_Gpt.h are different"
- #endif
- /* Check if this header file and OsIf.h file are of the same Autosar version */
- #if ((SRTC_IP_AR_RELEASE_MAJOR_VERSION != OSIF_AR_RELEASE_MAJOR_VERSION) || \
- (SRTC_IP_AR_RELEASE_MINOR_VERSION != OSIF_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of SRtc_Ip.h and OsIf.h are different"
- #endif
- #endif
- #if SRTC_IP_DEV_ERROR_DETECT == STD_ON
- #ifndef DISABLE_MCAL_INTERMODULE_ASR_CHECK
- #if ((SRTC_IP_AR_RELEASE_MAJOR_VERSION != DEVASSERT_AR_RELEASE_MAJOR_VERSION) || \
- (SRTC_IP_AR_RELEASE_MINOR_VERSION != DEVASSERT_AR_RELEASE_MINOR_VERSION))
- #error "AutoSar Version Numbers of SRtc_Ip.h and Devassert.h are different"
- #endif
- #endif
- #endif
- /*==================================================================================================
- * CONSTANTS
- ==================================================================================================*/
- /*==================================================================================================
- * DEFINES AND MACROS
- ==================================================================================================*/
- /*==================================================================================================
- * ENUMS
- ==================================================================================================*/
- /*==================================================================================================
- * STRUCTURES AND OTHER TYPEDEFS
- ==================================================================================================*/
- /*==================================================================================================
- * GLOBAL VARIABLE DECLARATIONS
- ==================================================================================================*/
- #if (SRTC_IP_USED == STD_ON)
- extern uint32 Srtc_Ip_u32TargetValue;
- /*==================================================================================================
- * FUNCTION PROTOTYPES
- ==================================================================================================*/
- #define GPT_START_SEC_CODE
- #include "Gpt_MemMap.h"
- uint32 Srtc_Ip_GetStatusFlags(uint8 instance, Srtc_Ip_InterruptType interruptMode);
- uint32 Srtc_Ip_GetTimeSecondsRegister(uint8 instance);
- uint32 Srtc_Ip_GetTimeAlarmRegister(uint8 instance);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - will convert seconds into time-date format.
- *
- * @param[in] seconds number of seconds
- * @param[in] *timeDate pointer to configuration
- * @return void
- * @pre The driver needs to be initialized.
- *
- */
- void Srtc_Ip_ConvertSecondsToTimeDate(const uint32 *seconds,
- Srtc_Ip_TimedateType * const timeDate);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - will convert time-date into seconds.
- *
- * @param[in] seconds number of seconds
- * @param[in] *timeDate pointer to configuration
- * @return void
- * @pre The driver needs to be initialized.
- *
- */
- void Srtc_Ip_ConvertTimeDateToSeconds(const Srtc_Ip_TimedateType *timeDate,
- uint32 * const seconds);
- /*================================================================================================*/
- /**
- * @brief SRtc driver initialization function for SRtc module.
- * @details This function:
- * - Disables the time counter
- * - Disables all interupt modes
- * - Clears Time Invalid Flag
- * - Selects source Clock
- * - If compensation support is enabled sets the configured values
- * - Sets channel state variables
- *
- * @param[in] instance hw instance
- * @param[in] *config pointer to configuration
- * @return void
- * @pre The data structure including the configuration set required for initializing the driver
- *
- */
- void Srtc_Ip_Init(uint8 instance, const Srtc_Ip_ConfigType *config);
- /*================================================================================================*/
- /**
- * @brief SRtc driver de-initialization function
- * @details This function:
- * - Performs a software reset
- * - Clears global variables
- * @param[in] instance Rtc hw instance
- * @return void
- * @pre The data structure including the configuration set required for initializing the GPT driver
- *
- */
- void Srtc_Ip_DeInit(uint8 instance);
- /*================================================================================================*/
- /**
- * @brief SRtc Driver function for starting the Rtc counter.
- * @details This function:
- * - Enables the counter
- * @param[in] instance Rtc hw instance
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_StartCounter(uint8 instance);
- /*================================================================================================*/
- /**
- * @brief SRtc Driver function for stopping the Rtc counter.
- * @details This function:
- * - Disables Time Alaram Interrupt
- * - Clears interrupt flag
- * - Disables the counter
- * @param[in] instance Rtc hw instance
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_StopCounter(uint8 instance);
- /*================================================================================================*/
- /**
- * @brief SRtc Driver function for starting the Rtc timer channel with a timeout value.
- * @details This function:
- * - Disables counter
- * - Disables Time Alaram Interrupt
- * - Gets Time Seconds Register value
- * - Calcutates new compare value
- * - Sets Time Alarm Register
- * - Enables Time Alaram Interrupt
- * - Enables counter
- *
- * @param[in] instance Rtc hw instance
- * value channel timeout value
- * @return void
- * @pre The data structure including the configuration set required for initializing the GPT driver
- *
- */
- void Srtc_Ip_StartTimer(uint8 instance, uint32 value);
- /*================================================================================================*/
- /**
- * @brief SRtc Driver function for enabling interrupt for RTC channel
- * @details This function:
- * - Enables Interrupt for RTC channel based on selected mode
- *
- * @param[in] instance Rtc hw instance
- * interruptMode Rtc hw interrupt mode
- * @return void
- * @pre The driver needs to be initialized.
- *
- */
- void Srtc_Ip_EnableInterrupt(uint8 instance, Srtc_Ip_InterruptType interruptMode);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function for Disable Interrupt for RTC channel
- * @details This function:
- * - Disable Interrupt for RTC channel based on selected mode
- *
- * @param[in] instance Rtc hw instance
- * @return void
- * @pre The driver needs to be initialized.
- *
- */
- void Srtc_Ip_DisableInterrupt(uint8 instance, Srtc_Ip_InterruptType interruptMode);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - Sets the date passed by the user.
- *
- * @param[in] instance SRtc hw instance
- * @param[in] *timeDate pointer to configuration
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_SetTimeDate(uint8 instance,
- const Srtc_Ip_TimedateType *timeDate);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - Gets the current time and date and it will
- * store in the state structure.
- *
- * @param[in] instance sRtc hw instance
- * @param[in] *timeDate pointer to configuration
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_GetTimeDate(uint8 instance,
- Srtc_Ip_TimedateType * const timeDate);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - Configures the alarm based on the
- * configuration structure passed by the user.
- * When using alarm that are configured to be repetitive,
- * enable the interrupt. Otherwise the repeat function will
- * not work.
- *
- * @param[in] instance Rtc hw instance
- * @param[in] *alarmConfig pointer to configuration
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_ConfigureAlarm(uint8 instance,
- const Srtc_Ip_AlarmConfigType *alarmConfig);
- /*================================================================================================*/
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - Configures the Time Seconds Interrupt with the Seconds interrupt Configuration Type.
- * @param[in] instance Rtc hw instance
- * @param[in] occursFrequency how often seconds interrupt occurs
- * @return Srtc_Ip_StatusType status error
- * @pre The driver needs to be initialized.
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_ConfigureSecondsInterrupt(uint8 instance,
- Srtc_Ip_SecIntFreqType occursFrequency);
- /*================================================================================================*/
- #if (STD_ON == SRTC_IP_ENABLE_LOCK_REGISTER_API)
- /**
- *
- * @brief SRtc Driver function
- * @details This function:
- * - Configures register lock for the corresponding
- * RTC instance. Remember that all the registers are unlocked
- * only by software reset or power on reset.
- * (Except for CR that is unlocked only by POR).
- * @param[in] instance Rtc hw instance
- * @param[in] lockRegister register that will be locked
- * @return Srtc_Ip_StatusType status error
- *
- */
- Srtc_Ip_StatusType Srtc_Ip_ConfigureLockRegister(uint8 instance,
- Srtc_Ip_LockRegConfigType * const lockRegister);
- #endif
- #define GPT_STOP_SEC_CODE
- #include "Gpt_MemMap.h"
- #endif /* SRTC_IP_USED == STD_ON */
- #ifdef __cplusplus
- }
- #endif
- /** @} */
- #endif /* SRTC_IP_H*/
|