fm_rtc_ext.h revision 296177
1296177Sjhibbits/* Copyright (c) 2008-2011 Freescale Semiconductor, Inc. 2296177Sjhibbits * All rights reserved. 3296177Sjhibbits * 4296177Sjhibbits * Redistribution and use in source and binary forms, with or without 5296177Sjhibbits * modification, are permitted provided that the following conditions are met: 6296177Sjhibbits * * Redistributions of source code must retain the above copyright 7296177Sjhibbits * notice, this list of conditions and the following disclaimer. 8296177Sjhibbits * * Redistributions in binary form must reproduce the above copyright 9296177Sjhibbits * notice, this list of conditions and the following disclaimer in the 10296177Sjhibbits * documentation and/or other materials provided with the distribution. 11296177Sjhibbits * * Neither the name of Freescale Semiconductor nor the 12296177Sjhibbits * names of its contributors may be used to endorse or promote products 13296177Sjhibbits * derived from this software without specific prior written permission. 14296177Sjhibbits * 15296177Sjhibbits * 16296177Sjhibbits * ALTERNATIVELY, this software may be distributed under the terms of the 17296177Sjhibbits * GNU General Public License ("GPL") as published by the Free Software 18296177Sjhibbits * Foundation, either version 2 of that License or (at your option) any 19296177Sjhibbits * later version. 20296177Sjhibbits * 21296177Sjhibbits * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY 22296177Sjhibbits * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 23296177Sjhibbits * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 24296177Sjhibbits * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY 25296177Sjhibbits * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES 26296177Sjhibbits * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 27296177Sjhibbits * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND 28296177Sjhibbits * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT 29296177Sjhibbits * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS 30296177Sjhibbits * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 31296177Sjhibbits */ 32296177Sjhibbits 33296177Sjhibbits/**************************************************************************//** 34296177Sjhibbits @File fm_rtc_ext.h 35296177Sjhibbits 36296177Sjhibbits @Description External definitions and API for FM RTC IEEE1588 Timer Module. 37296177Sjhibbits 38296177Sjhibbits @Cautions None. 39296177Sjhibbits*//***************************************************************************/ 40296177Sjhibbits 41296177Sjhibbits#ifndef __FM_RTC_EXT_H__ 42296177Sjhibbits#define __FM_RTC_EXT_H__ 43296177Sjhibbits 44296177Sjhibbits 45296177Sjhibbits#include "error_ext.h" 46296177Sjhibbits#include "std_ext.h" 47296177Sjhibbits 48296177Sjhibbits 49296177Sjhibbits/**************************************************************************//** 50296177Sjhibbits 51296177Sjhibbits @Group FM_grp Frame Manager API 52296177Sjhibbits 53296177Sjhibbits @Description FM API functions, definitions and enums 54296177Sjhibbits 55296177Sjhibbits @{ 56296177Sjhibbits*//***************************************************************************/ 57296177Sjhibbits 58296177Sjhibbits/**************************************************************************//** 59296177Sjhibbits @Group fm_rtc_grp FM RTC 60296177Sjhibbits 61296177Sjhibbits @Description FM RTC functions, definitions and enums. 62296177Sjhibbits 63296177Sjhibbits @{ 64296177Sjhibbits*//***************************************************************************/ 65296177Sjhibbits 66296177Sjhibbits/**************************************************************************//** 67296177Sjhibbits @Group fm_rtc_init_grp FM RTC Initialization Unit 68296177Sjhibbits 69296177Sjhibbits @Description FM RTC initialization API. 70296177Sjhibbits 71296177Sjhibbits @{ 72296177Sjhibbits*//***************************************************************************/ 73296177Sjhibbits 74296177Sjhibbits/**************************************************************************//** 75296177Sjhibbits @Description FM RTC Alarm Polarity Options. 76296177Sjhibbits*//***************************************************************************/ 77296177Sjhibbitstypedef enum e_FmRtcAlarmPolarity 78296177Sjhibbits{ 79296177Sjhibbits e_FM_RTC_ALARM_POLARITY_ACTIVE_HIGH, /**< Active-high output polarity */ 80296177Sjhibbits e_FM_RTC_ALARM_POLARITY_ACTIVE_LOW /**< Active-low output polarity */ 81296177Sjhibbits} e_FmRtcAlarmPolarity; 82296177Sjhibbits 83296177Sjhibbits/**************************************************************************//** 84296177Sjhibbits @Description FM RTC Trigger Polarity Options. 85296177Sjhibbits*//***************************************************************************/ 86296177Sjhibbitstypedef enum e_FmRtcTriggerPolarity 87296177Sjhibbits{ 88296177Sjhibbits e_FM_RTC_TRIGGER_ON_RISING_EDGE, /**< Trigger on rising edge */ 89296177Sjhibbits e_FM_RTC_TRIGGER_ON_FALLING_EDGE /**< Trigger on falling edge */ 90296177Sjhibbits} e_FmRtcTriggerPolarity; 91296177Sjhibbits 92296177Sjhibbits/**************************************************************************//** 93296177Sjhibbits @Description IEEE1588 Timer Module FM RTC Optional Clock Sources. 94296177Sjhibbits*//***************************************************************************/ 95296177Sjhibbitstypedef enum e_FmSrcClock 96296177Sjhibbits{ 97296177Sjhibbits e_FM_RTC_SOURCE_CLOCK_EXTERNAL, /**< external high precision timer reference clock */ 98296177Sjhibbits e_FM_RTC_SOURCE_CLOCK_SYSTEM, /**< MAC system clock */ 99296177Sjhibbits e_FM_RTC_SOURCE_CLOCK_OSCILATOR /**< RTC clock oscilator */ 100296177Sjhibbits}e_FmSrcClk; 101296177Sjhibbits 102296177Sjhibbits/**************************************************************************//** 103296177Sjhibbits @Description FM RTC configuration parameters structure. 104296177Sjhibbits 105296177Sjhibbits This structure should be passed to FM_RTC_Config(). 106296177Sjhibbits*//***************************************************************************/ 107296177Sjhibbitstypedef struct t_FmRtcParams 108296177Sjhibbits{ 109296177Sjhibbits t_Handle h_Fm; /**< FM Handle*/ 110296177Sjhibbits uintptr_t baseAddress; /**< Base address of FM RTC registers */ 111296177Sjhibbits t_Handle h_App; /**< A handle to an application layer object; This handle will 112296177Sjhibbits be passed by the driver upon calling the above callbacks */ 113296177Sjhibbits} t_FmRtcParams; 114296177Sjhibbits 115296177Sjhibbits 116296177Sjhibbits/**************************************************************************//** 117296177Sjhibbits @Function FM_RTC_Config 118296177Sjhibbits 119296177Sjhibbits @Description Configures the FM RTC module according to user's parameters. 120296177Sjhibbits 121296177Sjhibbits The driver assigns default values to some FM RTC parameters. 122296177Sjhibbits These parameters can be overwritten using the advanced 123296177Sjhibbits configuration routines. 124296177Sjhibbits 125296177Sjhibbits @Param[in] p_FmRtcParam - FM RTC configuration parameters. 126296177Sjhibbits 127296177Sjhibbits @Return Handle to the new FM RTC object; NULL pointer on failure. 128296177Sjhibbits 129296177Sjhibbits @Cautions None 130296177Sjhibbits*//***************************************************************************/ 131296177Sjhibbitst_Handle FM_RTC_Config(t_FmRtcParams *p_FmRtcParam); 132296177Sjhibbits 133296177Sjhibbits/**************************************************************************//** 134296177Sjhibbits @Function FM_RTC_Init 135296177Sjhibbits 136296177Sjhibbits @Description Initializes the FM RTC driver and hardware. 137296177Sjhibbits 138296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 139296177Sjhibbits 140296177Sjhibbits @Return E_OK on success; Error code otherwise. 141296177Sjhibbits 142296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 143296177Sjhibbits*//***************************************************************************/ 144296177Sjhibbitst_Error FM_RTC_Init(t_Handle h_FmRtc); 145296177Sjhibbits 146296177Sjhibbits/**************************************************************************//** 147296177Sjhibbits @Function FM_RTC_Free 148296177Sjhibbits 149296177Sjhibbits @Description Frees the FM RTC object and all allocated resources. 150296177Sjhibbits 151296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 152296177Sjhibbits 153296177Sjhibbits @Return E_OK on success; Error code otherwise. 154296177Sjhibbits 155296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 156296177Sjhibbits*//***************************************************************************/ 157296177Sjhibbitst_Error FM_RTC_Free(t_Handle h_FmRtc); 158296177Sjhibbits 159296177Sjhibbits 160296177Sjhibbits/**************************************************************************//** 161296177Sjhibbits @Group fm_rtc_adv_config_grp FM RTC Advanced Configuration Unit 162296177Sjhibbits 163296177Sjhibbits @Description FM RTC advanced configuration functions. 164296177Sjhibbits 165296177Sjhibbits @{ 166296177Sjhibbits*//***************************************************************************/ 167296177Sjhibbits 168296177Sjhibbits/**************************************************************************//** 169296177Sjhibbits @Function FM_RTC_ConfigPeriod 170296177Sjhibbits 171296177Sjhibbits @Description Configures the period of the timestamp if different than 172296177Sjhibbits default [1000]. 173296177Sjhibbits 174296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 175296177Sjhibbits @Param[in] period - Period in nano-seconds. 176296177Sjhibbits 177296177Sjhibbits @Return E_OK on success; Error code otherwise. 178296177Sjhibbits 179296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 180296177Sjhibbits*//***************************************************************************/ 181296177Sjhibbitst_Error FM_RTC_ConfigPeriod(t_Handle h_FmRtc, uint32_t period); 182296177Sjhibbits 183296177Sjhibbits/**************************************************************************//** 184296177Sjhibbits @Function FM_RTC_ConfigSourceClock 185296177Sjhibbits 186296177Sjhibbits @Description Configures the source clock of the RTC. 187296177Sjhibbits 188296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 189296177Sjhibbits @Param[in] srcClk - Source clock selection. 190296177Sjhibbits @Param[in] freqInMhz - the source-clock frequency (in MHz). 191296177Sjhibbits 192296177Sjhibbits @Return E_OK on success; Error code otherwise. 193296177Sjhibbits 194296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 195296177Sjhibbits*//***************************************************************************/ 196296177Sjhibbitst_Error FM_RTC_ConfigSourceClock(t_Handle h_FmRtc, 197296177Sjhibbits e_FmSrcClk srcClk, 198296177Sjhibbits uint32_t freqInMhz); 199296177Sjhibbits 200296177Sjhibbits/**************************************************************************//** 201296177Sjhibbits @Function FM_RTC_ConfigPulseRealignment 202296177Sjhibbits 203296177Sjhibbits @Description Configures the RTC to automatic FIPER pulse realignment in 204296177Sjhibbits response to timer adjustments [FALSE] 205296177Sjhibbits 206296177Sjhibbits In this mode, the RTC clock is identical to the source clock. 207296177Sjhibbits This feature can be useful when the system contains an external 208296177Sjhibbits RTC with inherent frequency compensation. 209296177Sjhibbits 210296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 211296177Sjhibbits @Param[in] enable - TRUE to enable automatic realignment. 212296177Sjhibbits 213296177Sjhibbits @Return E_OK on success; Error code otherwise. 214296177Sjhibbits 215296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 216296177Sjhibbits*//***************************************************************************/ 217296177Sjhibbitst_Error FM_RTC_ConfigPulseRealignment(t_Handle h_FmRtc, bool enable); 218296177Sjhibbits 219296177Sjhibbits/**************************************************************************//** 220296177Sjhibbits @Function FM_RTC_ConfigFrequencyBypass 221296177Sjhibbits 222296177Sjhibbits @Description Configures the RTC to bypass the frequency compensation 223296177Sjhibbits mechanism. [FALSE] 224296177Sjhibbits 225296177Sjhibbits In this mode, the RTC clock is identical to the source clock. 226296177Sjhibbits This feature can be useful when the system contains an external 227296177Sjhibbits RTC with inherent frequency compensation. 228296177Sjhibbits 229296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 230296177Sjhibbits @Param[in] enabled - TRUE to bypass frequency compensation; 231296177Sjhibbits FALSE otherwise. 232296177Sjhibbits 233296177Sjhibbits @Return E_OK on success; Error code otherwise. 234296177Sjhibbits 235296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 236296177Sjhibbits*//***************************************************************************/ 237296177Sjhibbitst_Error FM_RTC_ConfigFrequencyBypass(t_Handle h_FmRtc, bool enabled); 238296177Sjhibbits 239296177Sjhibbits/**************************************************************************//** 240296177Sjhibbits @Function FM_RTC_ConfigInvertedInputClockPhase 241296177Sjhibbits 242296177Sjhibbits @Description Configures the RTC to invert the source clock phase on input. 243296177Sjhibbits [FALSE] 244296177Sjhibbits 245296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 246296177Sjhibbits @Param[in] inverted - TRUE to invert the source clock phase on input. 247296177Sjhibbits FALSE otherwise. 248296177Sjhibbits 249296177Sjhibbits @Return E_OK on success; Error code otherwise. 250296177Sjhibbits 251296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 252296177Sjhibbits*//***************************************************************************/ 253296177Sjhibbitst_Error FM_RTC_ConfigInvertedInputClockPhase(t_Handle h_FmRtc, bool inverted); 254296177Sjhibbits 255296177Sjhibbits/**************************************************************************//** 256296177Sjhibbits @Function FM_RTC_ConfigInvertedOutputClockPhase 257296177Sjhibbits 258296177Sjhibbits @Description Configures the RTC to invert the output clock phase. 259296177Sjhibbits [FALSE] 260296177Sjhibbits 261296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 262296177Sjhibbits @Param[in] inverted - TRUE to invert the output clock phase. 263296177Sjhibbits FALSE otherwise. 264296177Sjhibbits 265296177Sjhibbits @Return E_OK on success; Error code otherwise. 266296177Sjhibbits 267296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 268296177Sjhibbits*//***************************************************************************/ 269296177Sjhibbitst_Error FM_RTC_ConfigInvertedOutputClockPhase(t_Handle h_FmRtc, bool inverted); 270296177Sjhibbits 271296177Sjhibbits/**************************************************************************//** 272296177Sjhibbits @Function FM_RTC_ConfigOutputClockDivisor 273296177Sjhibbits 274296177Sjhibbits @Description Configures the divisor for generating the output clock from 275296177Sjhibbits the RTC clock. [0x00000002] 276296177Sjhibbits 277296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 278296177Sjhibbits @Param[in] divisor - Divisor for generation of the output clock. 279296177Sjhibbits 280296177Sjhibbits @Return E_OK on success; Error code otherwise. 281296177Sjhibbits 282296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 283296177Sjhibbits*//***************************************************************************/ 284296177Sjhibbitst_Error FM_RTC_ConfigOutputClockDivisor(t_Handle h_FmRtc, uint16_t divisor); 285296177Sjhibbits 286296177Sjhibbits/**************************************************************************//** 287296177Sjhibbits @Function FM_RTC_ConfigAlarmPolarity 288296177Sjhibbits 289296177Sjhibbits @Description Configures the polarity (active-high/active-low) of a specific 290296177Sjhibbits alarm signal. [e_FM_RTC_ALARM_POLARITY_ACTIVE_HIGH] 291296177Sjhibbits 292296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 293296177Sjhibbits @Param[in] alarmId - Alarm ID. 294296177Sjhibbits @Param[in] alarmPolarity - Alarm polarity. 295296177Sjhibbits 296296177Sjhibbits @Return E_OK on success; Error code otherwise. 297296177Sjhibbits 298296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 299296177Sjhibbits*//***************************************************************************/ 300296177Sjhibbitst_Error FM_RTC_ConfigAlarmPolarity(t_Handle h_FmRtc, 301296177Sjhibbits uint8_t alarmId, 302296177Sjhibbits e_FmRtcAlarmPolarity alarmPolarity); 303296177Sjhibbits 304296177Sjhibbits/**************************************************************************//** 305296177Sjhibbits @Function FM_RTC_ConfigExternalTriggerPolarity 306296177Sjhibbits 307296177Sjhibbits @Description Configures the polarity (rising/falling edge) of a specific 308296177Sjhibbits external trigger signal. [e_FM_RTC_TRIGGER_ON_FALLING_EDGE] 309296177Sjhibbits 310296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 311296177Sjhibbits @Param[in] triggerId - Trigger ID. 312296177Sjhibbits @Param[in] triggerPolarity - Trigger polarity. 313296177Sjhibbits 314296177Sjhibbits @Return E_OK on success; Error code otherwise. 315296177Sjhibbits 316296177Sjhibbits @Cautions h_FmRtc must have been previously created using FM_RTC_Config(). 317296177Sjhibbits*//***************************************************************************/ 318296177Sjhibbitst_Error FM_RTC_ConfigExternalTriggerPolarity(t_Handle h_FmRtc, 319296177Sjhibbits uint8_t triggerId, 320296177Sjhibbits e_FmRtcTriggerPolarity triggerPolarity); 321296177Sjhibbits 322296177Sjhibbits/** @} */ /* end of fm_rtc_adv_config_grp */ 323296177Sjhibbits/** @} */ /* end of fm_rtc_init_grp */ 324296177Sjhibbits 325296177Sjhibbits 326296177Sjhibbits/**************************************************************************//** 327296177Sjhibbits @Group fm_rtc_control_grp FM RTC Control Unit 328296177Sjhibbits 329296177Sjhibbits @Description FM RTC runtime control API. 330296177Sjhibbits 331296177Sjhibbits @{ 332296177Sjhibbits*//***************************************************************************/ 333296177Sjhibbits 334296177Sjhibbits/**************************************************************************//** 335296177Sjhibbits @Function t_FmRtcExceptionsCallback 336296177Sjhibbits 337296177Sjhibbits @Description Exceptions user callback routine, used for RTC different mechanisms. 338296177Sjhibbits 339296177Sjhibbits @Param[in] h_App - User's application descriptor. 340296177Sjhibbits @Param[in] id - source id. 341296177Sjhibbits*//***************************************************************************/ 342296177Sjhibbitstypedef void (t_FmRtcExceptionsCallback) ( t_Handle h_App, uint8_t id); 343296177Sjhibbits 344296177Sjhibbits/**************************************************************************//** 345296177Sjhibbits @Description FM RTC alarm parameters. 346296177Sjhibbits*//***************************************************************************/ 347296177Sjhibbitstypedef struct t_FmRtcAlarmParams { 348296177Sjhibbits uint8_t alarmId; /**< 0 or 1 */ 349296177Sjhibbits uint64_t alarmTime; /**< In nanoseconds, the time when the alarm 350296177Sjhibbits should go off - must be a multiple of 351296177Sjhibbits the RTC period */ 352296177Sjhibbits t_FmRtcExceptionsCallback *f_AlarmCallback; /**< This routine will be called when RTC 353296177Sjhibbits reaches alarmTime */ 354296177Sjhibbits bool clearOnExpiration; /**< TRUE to turn off the alarm once expired. */ 355296177Sjhibbits} t_FmRtcAlarmParams; 356296177Sjhibbits 357296177Sjhibbits/**************************************************************************//** 358296177Sjhibbits @Description FM RTC Periodic Pulse parameters. 359296177Sjhibbits*//***************************************************************************/ 360296177Sjhibbitstypedef struct t_FmRtcPeriodicPulseParams { 361296177Sjhibbits uint8_t periodicPulseId; /**< 0 or 1 */ 362296177Sjhibbits uint64_t periodicPulsePeriod; /**< In Nanoseconds. Must be 363296177Sjhibbits a multiple of the RTC period */ 364296177Sjhibbits t_FmRtcExceptionsCallback *f_PeriodicPulseCallback; /**< This routine will be called every 365296177Sjhibbits periodicPulsePeriod. */ 366296177Sjhibbits} t_FmRtcPeriodicPulseParams; 367296177Sjhibbits 368296177Sjhibbits/**************************************************************************//** 369296177Sjhibbits @Description FM RTC Periodic Pulse parameters. 370296177Sjhibbits*//***************************************************************************/ 371296177Sjhibbitstypedef struct t_FmRtcExternalTriggerParams { 372296177Sjhibbits uint8_t externalTriggerId; /**< 0 or 1 */ 373296177Sjhibbits bool usePulseAsInput; /**< Use the pulse interrupt instead of 374296177Sjhibbits an external signal */ 375296177Sjhibbits t_FmRtcExceptionsCallback *f_ExternalTriggerCallback; /**< This routine will be called every 376296177Sjhibbits periodicPulsePeriod. */ 377296177Sjhibbits} t_FmRtcExternalTriggerParams; 378296177Sjhibbits 379296177Sjhibbits 380296177Sjhibbits/**************************************************************************//** 381296177Sjhibbits @Function FM_RTC_Enable 382296177Sjhibbits 383296177Sjhibbits @Description Enable the RTC (time count is started). 384296177Sjhibbits 385296177Sjhibbits The user can select to resume the time count from previous 386296177Sjhibbits point, or to restart the time count. 387296177Sjhibbits 388296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 389296177Sjhibbits @Param[in] resetClock - Restart the time count from zero. 390296177Sjhibbits 391296177Sjhibbits @Return E_OK on success; Error code otherwise. 392296177Sjhibbits 393296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 394296177Sjhibbits*//***************************************************************************/ 395296177Sjhibbitst_Error FM_RTC_Enable(t_Handle h_FmRtc, bool resetClock); 396296177Sjhibbits 397296177Sjhibbits/**************************************************************************//** 398296177Sjhibbits @Function FM_RTC_Disable 399296177Sjhibbits 400296177Sjhibbits @Description Disables the RTC (time count is stopped). 401296177Sjhibbits 402296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 403296177Sjhibbits 404296177Sjhibbits @Return E_OK on success; Error code otherwise. 405296177Sjhibbits 406296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 407296177Sjhibbits*//***************************************************************************/ 408296177Sjhibbitst_Error FM_RTC_Disable(t_Handle h_FmRtc); 409296177Sjhibbits 410296177Sjhibbits/**************************************************************************//** 411296177Sjhibbits @Function FM_RTC_SetClockOffset 412296177Sjhibbits 413296177Sjhibbits @Description Sets the clock offset (usually relative to another clock). 414296177Sjhibbits 415296177Sjhibbits The user can pass a negative offset value. 416296177Sjhibbits 417296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 418296177Sjhibbits @Param[in] offset - New clock offset (in nanoseconds). 419296177Sjhibbits 420296177Sjhibbits @Return E_OK on success; Error code otherwise. 421296177Sjhibbits 422296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 423296177Sjhibbits*//***************************************************************************/ 424296177Sjhibbitst_Error FM_RTC_SetClockOffset(t_Handle h_FmRtc, int64_t offset); 425296177Sjhibbits 426296177Sjhibbits/**************************************************************************//** 427296177Sjhibbits @Function FM_RTC_SetAlarm 428296177Sjhibbits 429296177Sjhibbits @Description Schedules an alarm event to a given RTC time. 430296177Sjhibbits 431296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 432296177Sjhibbits @Param[in] p_FmRtcAlarmParams - Alarm parameters. 433296177Sjhibbits 434296177Sjhibbits @Return E_OK on success; Error code otherwise. 435296177Sjhibbits 436296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 437296177Sjhibbits Must be called only prior to FM_RTC_Enable(). 438296177Sjhibbits*//***************************************************************************/ 439296177Sjhibbitst_Error FM_RTC_SetAlarm(t_Handle h_FmRtc, t_FmRtcAlarmParams *p_FmRtcAlarmParams); 440296177Sjhibbits 441296177Sjhibbits/**************************************************************************//** 442296177Sjhibbits @Function FM_RTC_SetPeriodicPulse 443296177Sjhibbits 444296177Sjhibbits @Description Sets a periodic pulse. 445296177Sjhibbits 446296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 447296177Sjhibbits @Param[in] p_FmRtcPeriodicPulseParams - Periodic pulse parameters. 448296177Sjhibbits 449296177Sjhibbits @Return E_OK on success; Error code otherwise. 450296177Sjhibbits 451296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 452296177Sjhibbits Must be called only prior to FM_RTC_Enable(). 453296177Sjhibbits*//***************************************************************************/ 454296177Sjhibbitst_Error FM_RTC_SetPeriodicPulse(t_Handle h_FmRtc, t_FmRtcPeriodicPulseParams *p_FmRtcPeriodicPulseParams); 455296177Sjhibbits 456296177Sjhibbits/**************************************************************************//** 457296177Sjhibbits @Function FM_RTC_ClearPeriodicPulse 458296177Sjhibbits 459296177Sjhibbits @Description Clears a periodic pulse. 460296177Sjhibbits 461296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 462296177Sjhibbits @Param[in] periodicPulseId - Periodic pulse id. 463296177Sjhibbits 464296177Sjhibbits @Return E_OK on success; Error code otherwise. 465296177Sjhibbits 466296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 467296177Sjhibbits*//***************************************************************************/ 468296177Sjhibbitst_Error FM_RTC_ClearPeriodicPulse(t_Handle h_FmRtc, uint8_t periodicPulseId); 469296177Sjhibbits 470296177Sjhibbits/**************************************************************************//** 471296177Sjhibbits @Function FM_RTC_SetExternalTrigger 472296177Sjhibbits 473296177Sjhibbits @Description Sets an external trigger indication and define a callback 474296177Sjhibbits routine to be called on such event. 475296177Sjhibbits 476296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 477296177Sjhibbits @Param[in] p_FmRtcExternalTriggerParams - External Trigger parameters. 478296177Sjhibbits 479296177Sjhibbits @Return E_OK on success; Error code otherwise. 480296177Sjhibbits 481296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 482296177Sjhibbits*//***************************************************************************/ 483296177Sjhibbitst_Error FM_RTC_SetExternalTrigger(t_Handle h_FmRtc, t_FmRtcExternalTriggerParams *p_FmRtcExternalTriggerParams); 484296177Sjhibbits 485296177Sjhibbits/**************************************************************************//** 486296177Sjhibbits @Function FM_RTC_ClearExternalTrigger 487296177Sjhibbits 488296177Sjhibbits @Description Clears external trigger indication. 489296177Sjhibbits 490296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 491296177Sjhibbits @Param[in] id - External Trigger id. 492296177Sjhibbits 493296177Sjhibbits @Return E_OK on success; Error code otherwise. 494296177Sjhibbits 495296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 496296177Sjhibbits*//***************************************************************************/ 497296177Sjhibbitst_Error FM_RTC_ClearExternalTrigger(t_Handle h_FmRtc, uint8_t id); 498296177Sjhibbits 499296177Sjhibbits/**************************************************************************//** 500296177Sjhibbits @Function FM_RTC_GetExternalTriggerTimeStamp 501296177Sjhibbits 502296177Sjhibbits @Description Reads the External Trigger TimeStamp. 503296177Sjhibbits 504296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 505296177Sjhibbits @Param[in] triggerId - External Trigger id. 506296177Sjhibbits @Param[out] p_TimeStamp - External Trigger timestamp (in nanoseconds). 507296177Sjhibbits 508296177Sjhibbits @Return E_OK on success; Error code otherwise. 509296177Sjhibbits 510296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 511296177Sjhibbits*//***************************************************************************/ 512296177Sjhibbitst_Error FM_RTC_GetExternalTriggerTimeStamp(t_Handle h_FmRtc, 513296177Sjhibbits uint8_t triggerId, 514296177Sjhibbits uint64_t *p_TimeStamp); 515296177Sjhibbits 516296177Sjhibbits/**************************************************************************//** 517296177Sjhibbits @Function FM_RTC_GetCurrentTime 518296177Sjhibbits 519296177Sjhibbits @Description Returns the current RTC time. 520296177Sjhibbits 521296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 522296177Sjhibbits @Param[out] p_Ts - returned time stamp (in nanoseconds). 523296177Sjhibbits 524296177Sjhibbits @Return E_OK on success; Error code otherwise. 525296177Sjhibbits 526296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 527296177Sjhibbits*//***************************************************************************/ 528296177Sjhibbitst_Error FM_RTC_GetCurrentTime(t_Handle h_FmRtc, uint64_t *p_Ts); 529296177Sjhibbits 530296177Sjhibbits/**************************************************************************//** 531296177Sjhibbits @Function FM_RTC_SetCurrentTime 532296177Sjhibbits 533296177Sjhibbits @Description Sets the current RTC time. 534296177Sjhibbits 535296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 536296177Sjhibbits @Param[in] ts - The new time stamp (in nanoseconds). 537296177Sjhibbits 538296177Sjhibbits @Return E_OK on success; Error code otherwise. 539296177Sjhibbits 540296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 541296177Sjhibbits*//***************************************************************************/ 542296177Sjhibbitst_Error FM_RTC_SetCurrentTime(t_Handle h_FmRtc, uint64_t ts); 543296177Sjhibbits 544296177Sjhibbits/**************************************************************************//** 545296177Sjhibbits @Function FM_RTC_GetFreqCompensation 546296177Sjhibbits 547296177Sjhibbits @Description TODO 548296177Sjhibbits 549296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 550296177Sjhibbits @Param[out] p_Compensation - A pointer to the returned value of compensation. 551296177Sjhibbits 552296177Sjhibbits @Return E_OK on success; Error code otherwise. 553296177Sjhibbits 554296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 555296177Sjhibbits*//***************************************************************************/ 556296177Sjhibbitst_Error FM_RTC_GetFreqCompensation(t_Handle h_FmRtc, uint32_t *p_Compensation); 557296177Sjhibbits 558296177Sjhibbits/**************************************************************************//** 559296177Sjhibbits @Function FM_RTC_SetFreqCompensation 560296177Sjhibbits 561296177Sjhibbits @Description TODO 562296177Sjhibbits 563296177Sjhibbits @Param[in] h_FmRtc - Handle to FM RTC object. 564296177Sjhibbits @Param[in] freqCompensation - the new desired compensation value to be set. 565296177Sjhibbits 566296177Sjhibbits @Return E_OK on success; Error code otherwise. 567296177Sjhibbits 568296177Sjhibbits @Cautions h_FmRtc must have been previously initialized using FM_RTC_Init(). 569296177Sjhibbits*//***************************************************************************/ 570296177Sjhibbitst_Error FM_RTC_SetFreqCompensation(t_Handle h_FmRtc, uint32_t freqCompensation); 571296177Sjhibbits 572296177Sjhibbits#if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0)) 573296177Sjhibbits/**************************************************************************//** 574296177Sjhibbits @Function FM_RTC_DumpRegs 575296177Sjhibbits 576296177Sjhibbits @Description Dumps all FM registers 577296177Sjhibbits 578296177Sjhibbits @Param[in] h_FmRtc A handle to an FM RTC Module. 579296177Sjhibbits 580296177Sjhibbits @Return E_OK on success; 581296177Sjhibbits 582296177Sjhibbits @Cautions Allowed only FM_Init(). 583296177Sjhibbits*//***************************************************************************/ 584296177Sjhibbitst_Error FM_RTC_DumpRegs(t_Handle h_FmRtc); 585296177Sjhibbits#endif /* (defined(DEBUG_ERRORS) && ... */ 586296177Sjhibbits 587296177Sjhibbits/** @} */ /* end of fm_rtc_control_grp */ 588296177Sjhibbits/** @} */ /* end of fm_rtc_grp */ 589296177Sjhibbits/** @} */ /* end of FM_grp group */ 590296177Sjhibbits 591296177Sjhibbits 592296177Sjhibbits#endif /* __FM_RTC_EXT_H__ */ 593