xref: /freebsd/sys/contrib/ncsw/inc/Peripherals/fm_rtc_ext.h (revision dd41de95a84d979615a2ef11df6850622bf6184e)
1 /*
2  * Copyright 2008-2012 Freescale Semiconductor Inc.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are met:
6  *     * Redistributions of source code must retain the above copyright
7  *       notice, this list of conditions and the following disclaimer.
8  *     * Redistributions in binary form must reproduce the above copyright
9  *       notice, this list of conditions and the following disclaimer in the
10  *       documentation and/or other materials provided with the distribution.
11  *     * Neither the name of Freescale Semiconductor nor the
12  *       names of its contributors may be used to endorse or promote products
13  *       derived from this software without specific prior written permission.
14  *
15  *
16  * ALTERNATIVELY, this software may be distributed under the terms of the
17  * GNU General Public License ("GPL") as published by the Free Software
18  * Foundation, either version 2 of that License or (at your option) any
19  * later version.
20  *
21  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
22  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
23  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
24  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
25  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
26  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
27  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
28  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
30  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31  */
32 
33 
34 /**************************************************************************//**
35  @File          fm_rtc_ext.h
36 
37  @Description   External definitions and API for FM RTC IEEE1588 Timer Module.
38 
39  @Cautions      None.
40 *//***************************************************************************/
41 
42 #ifndef __FM_RTC_EXT_H__
43 #define __FM_RTC_EXT_H__
44 
45 
46 #include "error_ext.h"
47 #include "std_ext.h"
48 #include "fsl_fman_rtc.h"
49 
50 /**************************************************************************//**
51 
52  @Group         FM_grp Frame Manager API
53 
54  @Description   FM API functions, definitions and enums
55 
56  @{
57 *//***************************************************************************/
58 
59 /**************************************************************************//**
60  @Group         fm_rtc_grp FM RTC
61 
62  @Description   FM RTC functions, definitions and enums.
63 
64  @{
65 *//***************************************************************************/
66 
67 /**************************************************************************//**
68  @Group         fm_rtc_init_grp FM RTC Initialization Unit
69 
70  @Description   FM RTC initialization API.
71 
72  @{
73 *//***************************************************************************/
74 
75 /**************************************************************************//**
76  @Description   FM RTC Alarm Polarity Options.
77 *//***************************************************************************/
78 typedef enum e_FmRtcAlarmPolarity
79 {
80     e_FM_RTC_ALARM_POLARITY_ACTIVE_HIGH = E_FMAN_RTC_ALARM_POLARITY_ACTIVE_HIGH,    /**< Active-high output polarity */
81     e_FM_RTC_ALARM_POLARITY_ACTIVE_LOW = E_FMAN_RTC_ALARM_POLARITY_ACTIVE_LOW     /**< Active-low output polarity */
82 } e_FmRtcAlarmPolarity;
83 
84 /**************************************************************************//**
85  @Description   FM RTC Trigger Polarity Options.
86 *//***************************************************************************/
87 typedef enum e_FmRtcTriggerPolarity
88 {
89     e_FM_RTC_TRIGGER_ON_RISING_EDGE = E_FMAN_RTC_TRIGGER_ON_RISING_EDGE,    /**< Trigger on rising edge */
90     e_FM_RTC_TRIGGER_ON_FALLING_EDGE = E_FMAN_RTC_TRIGGER_ON_FALLING_EDGE   /**< Trigger on falling edge */
91 } e_FmRtcTriggerPolarity;
92 
93 /**************************************************************************//**
94  @Description   IEEE1588 Timer Module FM RTC Optional Clock Sources.
95 *//***************************************************************************/
96 typedef enum e_FmSrcClock
97 {
98     e_FM_RTC_SOURCE_CLOCK_EXTERNAL = E_FMAN_RTC_SOURCE_CLOCK_EXTERNAL,  /**< external high precision timer reference clock */
99     e_FM_RTC_SOURCE_CLOCK_SYSTEM = E_FMAN_RTC_SOURCE_CLOCK_SYSTEM,    /**< MAC system clock */
100     e_FM_RTC_SOURCE_CLOCK_OSCILATOR = E_FMAN_RTC_SOURCE_CLOCK_OSCILATOR  /**< RTC clock oscilator */
101 }e_FmSrcClk;
102 
103 /**************************************************************************//**
104  @Description   FM RTC configuration parameters structure.
105 
106                 This structure should be passed to FM_RTC_Config().
107 *//***************************************************************************/
108 typedef struct t_FmRtcParams
109 {
110     t_Handle                 h_Fm;               /**< FM Handle*/
111     uintptr_t                baseAddress;        /**< Base address of FM RTC registers */
112     t_Handle                 h_App;              /**< A handle to an application layer object; This handle will
113                                                       be passed by the driver upon calling the above callbacks */
114 } t_FmRtcParams;
115 
116 
117 /**************************************************************************//**
118  @Function      FM_RTC_Config
119 
120  @Description   Configures the FM RTC module according to user's parameters.
121 
122                 The driver assigns default values to some FM RTC parameters.
123                 These parameters can be overwritten using the advanced
124                 configuration routines.
125 
126  @Param[in]     p_FmRtcParam    - FM RTC configuration parameters.
127 
128  @Return        Handle to the new FM RTC object; NULL pointer on failure.
129 
130  @Cautions      None
131 *//***************************************************************************/
132 t_Handle FM_RTC_Config(t_FmRtcParams *p_FmRtcParam);
133 
134 /**************************************************************************//**
135  @Function      FM_RTC_Init
136 
137  @Description   Initializes the FM RTC driver and hardware.
138 
139  @Param[in]     h_FmRtc - Handle to FM RTC object.
140 
141  @Return        E_OK on success; Error code otherwise.
142 
143  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
144 *//***************************************************************************/
145 t_Error FM_RTC_Init(t_Handle h_FmRtc);
146 
147 /**************************************************************************//**
148  @Function      FM_RTC_Free
149 
150  @Description   Frees the FM RTC object and all allocated resources.
151 
152  @Param[in]     h_FmRtc - Handle to FM RTC object.
153 
154  @Return        E_OK on success; Error code otherwise.
155 
156  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
157 *//***************************************************************************/
158 t_Error FM_RTC_Free(t_Handle h_FmRtc);
159 
160 
161 /**************************************************************************//**
162  @Group         fm_rtc_adv_config_grp  FM RTC Advanced Configuration Unit
163 
164  @Description   FM RTC advanced configuration functions.
165 
166  @{
167 *//***************************************************************************/
168 
169 /**************************************************************************//**
170  @Function      FM_RTC_ConfigPeriod
171 
172  @Description   Configures the period of the timestamp if different than
173                 default [DEFAULT_clockPeriod].
174 
175  @Param[in]     h_FmRtc         - Handle to FM RTC object.
176  @Param[in]     period          - Period in nano-seconds.
177 
178  @Return        E_OK on success; Error code otherwise.
179 
180  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
181 *//***************************************************************************/
182 t_Error FM_RTC_ConfigPeriod(t_Handle h_FmRtc, uint32_t period);
183 
184 /**************************************************************************//**
185  @Function      FM_RTC_ConfigSourceClock
186 
187  @Description   Configures the source clock of the RTC.
188 
189  @Param[in]     h_FmRtc         - Handle to FM RTC object.
190  @Param[in]     srcClk          - Source clock selection.
191  @Param[in]     freqInMhz       - the source-clock frequency (in MHz).
192 
193  @Return        E_OK on success; Error code otherwise.
194 
195  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
196 *//***************************************************************************/
197 t_Error FM_RTC_ConfigSourceClock(t_Handle      h_FmRtc,
198                                  e_FmSrcClk    srcClk,
199                                  uint32_t      freqInMhz);
200 
201 /**************************************************************************//**
202  @Function      FM_RTC_ConfigPulseRealignment
203 
204  @Description   Configures the RTC to automatic FIPER pulse realignment in
205                 response to timer adjustments [DEFAULT_pulseRealign]
206 
207                 In this mode, the RTC clock is identical to the source clock.
208                 This feature can be useful when the system contains an external
209                 RTC with inherent frequency compensation.
210 
211  @Param[in]     h_FmRtc     - Handle to FM RTC object.
212  @Param[in]     enable      - TRUE to enable automatic realignment.
213 
214  @Return        E_OK on success; Error code otherwise.
215 
216  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
217 *//***************************************************************************/
218 t_Error FM_RTC_ConfigPulseRealignment(t_Handle h_FmRtc, bool enable);
219 
220 /**************************************************************************//**
221  @Function      FM_RTC_ConfigFrequencyBypass
222 
223  @Description   Configures the RTC to bypass the frequency compensation
224                 mechanism. [DEFAULT_bypass]
225 
226                 In this mode, the RTC clock is identical to the source clock.
227                 This feature can be useful when the system contains an external
228                 RTC with inherent frequency compensation.
229 
230  @Param[in]     h_FmRtc     - Handle to FM RTC object.
231  @Param[in]     enabled     - TRUE to bypass frequency compensation;
232                               FALSE otherwise.
233 
234  @Return        E_OK on success; Error code otherwise.
235 
236  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
237 *//***************************************************************************/
238 t_Error FM_RTC_ConfigFrequencyBypass(t_Handle h_FmRtc, bool enabled);
239 
240 /**************************************************************************//**
241  @Function      FM_RTC_ConfigInvertedInputClockPhase
242 
243  @Description   Configures the RTC to invert the source clock phase on input.
244                 [DEFAULT_invertInputClkPhase]
245 
246  @Param[in]     h_FmRtc  - Handle to FM RTC object.
247  @Param[in]     inverted    - TRUE to invert the source clock phase on input.
248                               FALSE otherwise.
249 
250  @Return        E_OK on success; Error code otherwise.
251 
252  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
253 *//***************************************************************************/
254 t_Error FM_RTC_ConfigInvertedInputClockPhase(t_Handle h_FmRtc, bool inverted);
255 
256 /**************************************************************************//**
257  @Function      FM_RTC_ConfigInvertedOutputClockPhase
258 
259  @Description   Configures the RTC to invert the output clock phase.
260                 [DEFAULT_invertOutputClkPhase]
261 
262  @Param[in]     h_FmRtc  - Handle to FM RTC object.
263  @Param[in]     inverted    - TRUE to invert the output clock phase.
264                               FALSE otherwise.
265 
266  @Return        E_OK on success; Error code otherwise.
267 
268  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
269 *//***************************************************************************/
270 t_Error FM_RTC_ConfigInvertedOutputClockPhase(t_Handle h_FmRtc, bool inverted);
271 
272 /**************************************************************************//**
273  @Function      FM_RTC_ConfigOutputClockDivisor
274 
275  @Description   Configures the divisor for generating the output clock from
276                 the RTC clock. [DEFAULT_outputClockDivisor]
277 
278  @Param[in]     h_FmRtc  - Handle to FM RTC object.
279  @Param[in]     divisor     - Divisor for generation of the output clock.
280 
281  @Return        E_OK on success; Error code otherwise.
282 
283  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
284 *//***************************************************************************/
285 t_Error FM_RTC_ConfigOutputClockDivisor(t_Handle h_FmRtc, uint16_t divisor);
286 
287 /**************************************************************************//**
288  @Function      FM_RTC_ConfigAlarmPolarity
289 
290  @Description   Configures the polarity (active-high/active-low) of a specific
291                 alarm signal. [DEFAULT_alarmPolarity]
292 
293  @Param[in]     h_FmRtc      - Handle to FM RTC object.
294  @Param[in]     alarmId         - Alarm ID.
295  @Param[in]     alarmPolarity   - Alarm polarity.
296 
297  @Return        E_OK on success; Error code otherwise.
298 
299  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
300 *//***************************************************************************/
301 t_Error FM_RTC_ConfigAlarmPolarity(t_Handle             h_FmRtc,
302                                    uint8_t              alarmId,
303                                    e_FmRtcAlarmPolarity alarmPolarity);
304 
305 /**************************************************************************//**
306  @Function      FM_RTC_ConfigExternalTriggerPolarity
307 
308  @Description   Configures the polarity (rising/falling edge) of a specific
309                 external trigger signal. [DEFAULT_triggerPolarity]
310 
311  @Param[in]     h_FmRtc      - Handle to FM RTC object.
312  @Param[in]     triggerId       - Trigger ID.
313  @Param[in]     triggerPolarity - Trigger polarity.
314 
315  @Return        E_OK on success; Error code otherwise.
316 
317  @Cautions      h_FmRtc must have been previously created using FM_RTC_Config().
318 *//***************************************************************************/
319 t_Error FM_RTC_ConfigExternalTriggerPolarity(t_Handle               h_FmRtc,
320                                              uint8_t                triggerId,
321                                              e_FmRtcTriggerPolarity triggerPolarity);
322 
323 /** @} */ /* end of fm_rtc_adv_config_grp */
324 /** @} */ /* end of fm_rtc_init_grp */
325 
326 
327 /**************************************************************************//**
328  @Group         fm_rtc_control_grp FM RTC Control Unit
329 
330  @Description   FM RTC runtime control API.
331 
332  @{
333 *//***************************************************************************/
334 
335 /**************************************************************************//**
336  @Function      t_FmRtcExceptionsCallback
337 
338  @Description   Exceptions user callback routine, used for RTC different mechanisms.
339 
340  @Param[in]     h_App       - User's application descriptor.
341  @Param[in]     id          - source id.
342 *//***************************************************************************/
343 typedef void (t_FmRtcExceptionsCallback) ( t_Handle  h_App, uint8_t id);
344 
345 /**************************************************************************//**
346  @Description   FM RTC alarm parameters.
347 *//***************************************************************************/
348 typedef struct t_FmRtcAlarmParams {
349     uint8_t                     alarmId;            /**< 0 or 1 */
350     uint64_t                    alarmTime;          /**< In nanoseconds, the time when the alarm
351                                                          should go off - must be a multiple of
352                                                          the RTC period */
353     t_FmRtcExceptionsCallback   *f_AlarmCallback;   /**< This routine will be called when RTC
354                                                          reaches alarmTime */
355     bool                        clearOnExpiration;  /**< TRUE to turn off the alarm once expired. */
356 } t_FmRtcAlarmParams;
357 
358 /**************************************************************************//**
359  @Description   FM RTC Periodic Pulse parameters.
360 *//***************************************************************************/
361 typedef struct t_FmRtcPeriodicPulseParams {
362     uint8_t                     periodicPulseId;            /**< 0 or 1 */
363     uint64_t                    periodicPulsePeriod;        /**< In Nanoseconds. Must be
364                                                                  a multiple of the RTC period */
365     t_FmRtcExceptionsCallback   *f_PeriodicPulseCallback;   /**< This routine will be called every
366                                                                  periodicPulsePeriod. */
367 } t_FmRtcPeriodicPulseParams;
368 
369 /**************************************************************************//**
370  @Description   FM RTC Periodic Pulse parameters.
371 *//***************************************************************************/
372 typedef struct t_FmRtcExternalTriggerParams {
373     uint8_t                     externalTriggerId;              /**< 0 or 1 */
374     bool                        usePulseAsInput;                /**< Use the pulse interrupt instead of
375                                                                      an external signal */
376     t_FmRtcExceptionsCallback   *f_ExternalTriggerCallback;     /**< This routine will be called every
377                                                                      periodicPulsePeriod. */
378 } t_FmRtcExternalTriggerParams;
379 
380 
381 /**************************************************************************//**
382  @Function      FM_RTC_Enable
383 
384  @Description   Enable the RTC (time count is started).
385 
386                 The user can select to resume the time count from previous
387                 point, or to restart the time count.
388 
389  @Param[in]     h_FmRtc     - Handle to FM RTC object.
390  @Param[in]     resetClock  - Restart the time count from zero.
391 
392  @Return        E_OK on success; Error code otherwise.
393 
394  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
395 *//***************************************************************************/
396 t_Error FM_RTC_Enable(t_Handle h_FmRtc, bool resetClock);
397 
398 /**************************************************************************//**
399  @Function      FM_RTC_Disable
400 
401  @Description   Disables the RTC (time count is stopped).
402 
403  @Param[in]     h_FmRtc - Handle to FM RTC object.
404 
405  @Return        E_OK on success; Error code otherwise.
406 
407  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
408 *//***************************************************************************/
409 t_Error FM_RTC_Disable(t_Handle h_FmRtc);
410 
411 /**************************************************************************//**
412  @Function      FM_RTC_SetClockOffset
413 
414  @Description   Sets the clock offset (usually relative to another clock).
415 
416                 The user can pass a negative offset value.
417 
418  @Param[in]     h_FmRtc  - Handle to FM RTC object.
419  @Param[in]     offset   - New clock offset (in nanoseconds).
420 
421  @Return        E_OK on success; Error code otherwise.
422 
423  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
424 *//***************************************************************************/
425 t_Error FM_RTC_SetClockOffset(t_Handle h_FmRtc, int64_t offset);
426 
427 /**************************************************************************//**
428  @Function      FM_RTC_SetAlarm
429 
430  @Description   Schedules an alarm event to a given RTC time.
431 
432  @Param[in]     h_FmRtc             - Handle to FM RTC object.
433  @Param[in]     p_FmRtcAlarmParams  - Alarm parameters.
434 
435  @Return        E_OK on success; Error code otherwise.
436 
437  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
438                 Must be called only prior to FM_RTC_Enable().
439 *//***************************************************************************/
440 t_Error FM_RTC_SetAlarm(t_Handle h_FmRtc, t_FmRtcAlarmParams *p_FmRtcAlarmParams);
441 
442 /**************************************************************************//**
443  @Function      FM_RTC_SetPeriodicPulse
444 
445  @Description   Sets a periodic pulse.
446 
447  @Param[in]     h_FmRtc                         - Handle to FM RTC object.
448  @Param[in]     p_FmRtcPeriodicPulseParams      - Periodic pulse parameters.
449 
450  @Return        E_OK on success; Error code otherwise.
451 
452  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
453                 Must be called only prior to FM_RTC_Enable().
454 *//***************************************************************************/
455 t_Error FM_RTC_SetPeriodicPulse(t_Handle h_FmRtc, t_FmRtcPeriodicPulseParams *p_FmRtcPeriodicPulseParams);
456 
457 /**************************************************************************//**
458  @Function      FM_RTC_ClearPeriodicPulse
459 
460  @Description   Clears a periodic pulse.
461 
462  @Param[in]     h_FmRtc                         - Handle to FM RTC object.
463  @Param[in]     periodicPulseId                 - Periodic pulse id.
464 
465  @Return        E_OK on success; Error code otherwise.
466 
467  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
468 *//***************************************************************************/
469 t_Error FM_RTC_ClearPeriodicPulse(t_Handle h_FmRtc, uint8_t periodicPulseId);
470 
471 /**************************************************************************//**
472  @Function      FM_RTC_SetExternalTrigger
473 
474  @Description   Sets an external trigger indication and define a callback
475                 routine to be called on such event.
476 
477  @Param[in]     h_FmRtc                         - Handle to FM RTC object.
478  @Param[in]     p_FmRtcExternalTriggerParams    - External Trigger parameters.
479 
480  @Return        E_OK on success; Error code otherwise.
481 
482  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
483 *//***************************************************************************/
484 t_Error FM_RTC_SetExternalTrigger(t_Handle h_FmRtc, t_FmRtcExternalTriggerParams *p_FmRtcExternalTriggerParams);
485 
486 /**************************************************************************//**
487  @Function      FM_RTC_ClearExternalTrigger
488 
489  @Description   Clears external trigger indication.
490 
491  @Param[in]     h_FmRtc                         - Handle to FM RTC object.
492  @Param[in]     id                              - External Trigger id.
493 
494  @Return        E_OK on success; Error code otherwise.
495 
496  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
497 *//***************************************************************************/
498 t_Error FM_RTC_ClearExternalTrigger(t_Handle h_FmRtc, uint8_t id);
499 
500 /**************************************************************************//**
501  @Function      FM_RTC_GetExternalTriggerTimeStamp
502 
503  @Description   Reads the External Trigger TimeStamp.
504 
505  @Param[in]     h_FmRtc                 - Handle to FM RTC object.
506  @Param[in]     triggerId               - External Trigger id.
507  @Param[out]    p_TimeStamp             - External Trigger timestamp (in nanoseconds).
508 
509  @Return        E_OK on success; Error code otherwise.
510 
511  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
512 *//***************************************************************************/
513 t_Error FM_RTC_GetExternalTriggerTimeStamp(t_Handle             h_FmRtc,
514                                            uint8_t              triggerId,
515                                            uint64_t             *p_TimeStamp);
516 
517 /**************************************************************************//**
518  @Function      FM_RTC_GetCurrentTime
519 
520  @Description   Returns the current RTC time.
521 
522  @Param[in]     h_FmRtc - Handle to FM RTC object.
523  @Param[out]    p_Ts - returned time stamp (in nanoseconds).
524 
525  @Return        E_OK on success; Error code otherwise.
526 
527  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
528 *//***************************************************************************/
529 t_Error FM_RTC_GetCurrentTime(t_Handle h_FmRtc, uint64_t *p_Ts);
530 
531 /**************************************************************************//**
532  @Function      FM_RTC_SetCurrentTime
533 
534  @Description   Sets the current RTC time.
535 
536  @Param[in]     h_FmRtc - Handle to FM RTC object.
537  @Param[in]     ts - The new time stamp (in nanoseconds).
538 
539  @Return        E_OK on success; Error code otherwise.
540 
541  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
542 *//***************************************************************************/
543 t_Error FM_RTC_SetCurrentTime(t_Handle h_FmRtc, uint64_t ts);
544 
545 /**************************************************************************//**
546  @Function      FM_RTC_GetFreqCompensation
547 
548  @Description   Retrieves the frequency compensation value
549 
550  @Param[in]     h_FmRtc         - Handle to FM RTC object.
551  @Param[out]    p_Compensation  - A pointer to the returned value of compensation.
552 
553  @Return        E_OK on success; Error code otherwise.
554 
555  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
556 *//***************************************************************************/
557 t_Error FM_RTC_GetFreqCompensation(t_Handle h_FmRtc, uint32_t *p_Compensation);
558 
559 /**************************************************************************//**
560  @Function      FM_RTC_SetFreqCompensation
561 
562  @Description   Sets a new frequency compensation value.
563 
564  @Param[in]     h_FmRtc             - Handle to FM RTC object.
565  @Param[in]     freqCompensation    - The new frequency compensation value to set.
566 
567  @Return        E_OK on success; Error code otherwise.
568 
569  @Cautions      h_FmRtc must have been previously initialized using FM_RTC_Init().
570 *//***************************************************************************/
571 t_Error FM_RTC_SetFreqCompensation(t_Handle h_FmRtc, uint32_t freqCompensation);
572 
573 #ifdef CONFIG_PTP_1588_CLOCK_DPAA
574 /**************************************************************************//**
575 *@Function      FM_RTC_EnableInterrupt
576 *
577 *@Description   Enable interrupt of FM RTC.
578 *
579 *@Param[in]     h_FmRtc             - Handle to FM RTC object.
580 *@Param[in]     events              - Interrupt events.
581 *
582 *@Return        E_OK on success; Error code otherwise.
583 *//***************************************************************************/
584 t_Error FM_RTC_EnableInterrupt(t_Handle h_FmRtc, uint32_t events);
585 
586 /**************************************************************************//**
587 *@Function      FM_RTC_DisableInterrupt
588 *
589 *@Description   Disable interrupt of FM RTC.
590 *
591 *@Param[in]     h_FmRtc             - Handle to FM RTC object.
592 *@Param[in]     events              - Interrupt events.
593 *
594 *@Return        E_OK on success; Error code otherwise.
595 *//***************************************************************************/
596 t_Error FM_RTC_DisableInterrupt(t_Handle h_FmRtc, uint32_t events);
597 #endif
598 
599 #if (defined(DEBUG_ERRORS) && (DEBUG_ERRORS > 0))
600 /**************************************************************************//**
601  @Function      FM_RTC_DumpRegs
602 
603  @Description   Dumps all FM registers
604 
605  @Param[in]     h_FmRtc      A handle to an FM RTC Module.
606 
607  @Return        E_OK on success;
608 
609  @Cautions      Allowed only FM_Init().
610 *//***************************************************************************/
611 t_Error FM_RTC_DumpRegs(t_Handle h_FmRtc);
612 #endif /* (defined(DEBUG_ERRORS) && ... */
613 
614 /** @} */ /* end of fm_rtc_control_grp */
615 /** @} */ /* end of fm_rtc_grp */
616 /** @} */ /* end of FM_grp group */
617 
618 
619 #endif /* __FM_RTC_EXT_H__ */
620