ADuCM302x Device Drivers API Reference Manual  Release 3.1.2.0
adi_rtc.h
1 
47 #ifndef ADI_RTC_H__
48 #define ADI_RTC_H__
49 #include "adi_processor.h"
50 
51 #include <stdint.h>
52 #include <adi_callback.h>
53 #include <adi_rtc_config.h>
54 
59 #ifdef __cplusplus
60 extern "C" {
61 #endif /* __cplusplus */
62 
63 
64 
68 #define ADI_RTC_MEMORY_SIZE (24u)
69 
71 #define ADI_RTC_GATEWAY_FLUSH 0xa2c5
72 
74 typedef void* ADI_RTC_HANDLE;
75 
77 #define ADI_RTC_IRQ_SOURCE_OFFSET_SR0 (0u)
78 
80 #define ADI_RTC_IRQ_SOURCE_MASK_SR0 (0x7Eu)
81 
83 #define ADI_RTC_IRQ_SOURCE_OFFSET_SR2 (8u)
84 
86 #define ADI_RTC0_IRQ_SOURCE_MASK_SR2 (0x0Fu)
87 
88 #define ADI_RTC1_IRQ_SOURCE_MASK_SR2 (0x1Fu)
89 
91 #define ADI_RTC_IRQ_SOURCE_OFFSET_SR3 (16u)
92 
94 #if defined(__ADUCM302x__)
95 #define ADI_RTC_IRQ_SOURCE_MASK_SR3 (0x031Du)
96 #elif defined(__ADUCM4x50__)
97 #define ADI_RTC_IRQ_SOURCE_MASK_SR3 (0x1FFDu)
98 #endif
99 
103 typedef enum
104 {
125 
127 
128 
134 typedef uint32_t ADI_RTC_INT_TYPE;
135 
136 #define ADI_RTC_ALARM_INT 0x00000001u
137 #define ADI_RTC_MOD60ALM_INT 0x00000002u
138 #define ADI_RTC_ISO_DONE_INT 0x00000004u
139 #define ADI_RTC_WRITE_PENDERR_INT 0x00000008u
140 #define ADI_RTC_WRITE_SYNC_INT 0x00000010u
141 #define ADI_RTC_WRITE_PEND_INT 0x00000020u
142 #define ADI_RTC_COUNT_INT 0x00000040u
143 #define ADI_RTC_PSI_INT 0x00000080u
144 #define ADI_RTC_TRIM_INT 0x00000100u
145 #define ADI_RTC_COUNT_ROLLOVER_INT 0x00000200u
146 #define ADI_RTC_MOD60_ROLLOVER_INT 0x00000400u
147 #define ADI_RTC_SENSOR_STROBE_CH1_INT 0x00000800u
148 #define ADI_RTC_INPUT_CAPTURE_CH0_INT 0x00008000u
149 #define ADI_RTC_INPUT_CAPTURE_CH2_INT 0x00010000u
150 #define ADI_RTC_INPUT_CAPTURE_CH3_INT 0x00020000u
151 #define ADI_RTC_INPUT_CAPTURE_CH4_INT 0x00040000u
152 #define ADI_RTC_LFXTL_FAILURE_INT 0x00080000u
153 #define ADI_RTC_RTCSS1MSKEN 0x08000000u
155 #if defined(__ADUCM4x50__)
156 #define ADI_RTC_RTCSS4_FE_INT 0x00100000u
157 #define ADI_RTC_RTCSS3_FE_INT 0x00200000u
158 #define ADI_RTC_RTCSS2_FE_INT 0x00400000u
159 #define ADI_RTC_RTCSS1_FE_INT 0x00800000u
160 #define ADI_RTC_RTCSS4MSKEN 0x01000000u
161 #define ADI_RTC_RTCSS3MSKEN 0x02000000u
162 #define ADI_RTC_RTCSS2MSKEN 0x04000000u
163 #define ADI_RTC_CR5OCS_SS3SMPMTCHIRQEN 0x10000000u
164 #define ADI_RTC_CR5OCS_SS2SMPMTCHIRQEN 0x20000000u
165 #define ADI_RTC_CR5OCS_SS1SMPMTCHIRQEN 0x40000000u
166 #define ADI_RTC_SENSOR_STROBE_CH2_INT 0x00001000u
167 #define ADI_RTC_SENSOR_STROBE_CH3_INT 0x00002000u
168 #define ADI_RTC_SENSOR_STROBE_CH4_INT 0x00004000u
169 #endif
170 
171 #if defined(__ADUCM4x50__)
172 #define ADI_RTC_NUM_INTERRUPTS 31
173 #else
174 #define ADI_RTC_NUM_INTERRUPTS 18
175 #endif
176 
177 
181 typedef enum
182 {
184  ADI_RTC_WRITE_STATUS_CONTROL0 = 1 << BITP_RTC_SR0_WSYNCCR0,
186  ADI_RTC_WRITE_STATUS_STATUS0 = 1 << BITP_RTC_SR0_WSYNCSR0,
188  ADI_RTC_WRITE_STATUS_COUNT0 = 1 << BITP_RTC_SR0_WSYNCCNT0,
190  ADI_RTC_WRITE_STATUS_COUNT1 = 1 << BITP_RTC_SR0_WSYNCCNT1,
192  ADI_RTC_WRITE_STATUS_ALARM0 = 1 << BITP_RTC_SR0_WSYNCALM0,
194  ADI_RTC_WRITE_STATUS_ALARM1 = 1 << BITP_RTC_SR0_WSYNCALM1,
196  ADI_RTC_WRITE_STATUS_TRIM = 1 << BITP_RTC_SR0_WSYNCTRM
198 
199 
203 typedef enum
204 {
206  ADI_RTC_TRIM_INTERVAL_2 = (2 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
208  ADI_RTC_TRIM_INTERVAL_3 = (3 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
210  ADI_RTC_TRIM_INTERVAL_4 = (4 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
212  ADI_RTC_TRIM_INTERVAL_5 = (5 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
214  ADI_RTC_TRIM_INTERVAL_6 = (6 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
216  ADI_RTC_TRIM_INTERVAL_7 = (7 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
218  ADI_RTC_TRIM_INTERVAL_8 = (8 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
220  ADI_RTC_TRIM_INTERVAL_9 = (9 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
222  ADI_RTC_TRIM_INTERVAL_10 = (10 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
224  ADI_RTC_TRIM_INTERVAL_11 = (11 << BITP_RTC_TRM_IVL2EXPMIN | 0x1 << BITP_RTC_TRM_IVL),
226  ADI_RTC_TRIM_INTERVAL_12 = (12 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
228  ADI_RTC_TRIM_INTERVAL_13 = (13 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
230  ADI_RTC_TRIM_INTERVAL_14 = (14 << BITP_RTC_TRM_IVL2EXPMIN | 0x0 << BITP_RTC_TRM_IVL),
232  ADI_RTC_TRIM_INTERVAL_15 = (14 << BITP_RTC_TRM_IVL2EXPMIN | 0x1 << BITP_RTC_TRM_IVL),
234  ADI_RTC_TRIM_INTERVAL_16 = (14 << BITP_RTC_TRM_IVL2EXPMIN | 0x2 << BITP_RTC_TRM_IVL ),
236  ADI_RTC_TRIM_INTERVAL_17 = (14 << BITP_RTC_TRM_IVL2EXPMIN | 0x3 << BITP_RTC_TRM_IVL)
237 
239 
243 typedef enum
244 {
246  ADI_RTC_INPUT_CHANNEL_0 = 1 << BITP_RTC_CR2IC_IC0EN,
248  ADI_RTC_INPUT_CHANNEL_2 = 1 << BITP_RTC_CR2IC_IC2EN,
250  ADI_RTC_INPUT_CHANNEL_3 = 1 << BITP_RTC_CR2IC_IC3EN,
252  ADI_RTC_INPUT_CHANNEL_4 = 1 << BITP_RTC_CR2IC_IC4EN
253 
255 
259 typedef enum
260 {
262  ADI_RTC_SS_CHANNEL_1 = 1 << BITP_RTC_CR3SS_SS1EN,
263 #if defined(__ADUCM4x50__)
264 
265  ADI_RTC_SS_CHANNEL_2 = 1 << BITP_RTC_CR3SS_SS2EN,
267  ADI_RTC_SS_CHANNEL_3 = 1 << BITP_RTC_CR3SS_SS3EN,
269  ADI_RTC_SS_CHANNEL_4 = 1 << BITP_RTC_CR3SS_SS4EN,
270 #endif /* __ADUCM4x50__ */
272 
276 typedef enum
277 {
279  ADI_RTC_TRIM_ADD = (1 << BITP_RTC_TRM_ADD),
281  ADI_RTC_TRIM_SUB = (0 << BITP_RTC_TRM_ADD),
283 
287 typedef enum
288 {
290  ADI_RTC_TRIM_0 = (0 << BITP_RTC_TRM_VALUE),
292  ADI_RTC_TRIM_1 = (1 << BITP_RTC_TRM_VALUE),
294  ADI_RTC_TRIM_2 = (2 << BITP_RTC_TRM_VALUE),
296  ADI_RTC_TRIM_3 = (3 << BITP_RTC_TRM_VALUE),
298  ADI_RTC_TRIM_4 = (4 << BITP_RTC_TRM_VALUE),
300  ADI_RTC_TRIM_5 = (5 << BITP_RTC_TRM_VALUE),
302  ADI_RTC_TRIM_6 = (6 << BITP_RTC_TRM_VALUE),
304  ADI_RTC_TRIM_7 = (7 << BITP_RTC_TRM_VALUE)
306 
310 typedef enum
311 {
317 
318 /*================ E X T E R N A L S ==================*/
319 
320 /*
321  */
322 
323 /*************************************/
324 /* RTC API */
325 /*************************************/
326 ADI_RTC_RESULT adi_rtc_Open(
327  uint32_t DeviceNumber,
328  void *pDeviceMemory,
329  uint32_t MemorySize,
330  ADI_RTC_HANDLE *phDevice
331  );
332 
333 ADI_RTC_RESULT adi_rtc_Close(
334  ADI_RTC_HANDLE const hDevice
335  );
336 
337 /*************************************/
338 /* Enable APIs for RTC Device */
339 /*************************************/
340 
341 ADI_RTC_RESULT adi_rtc_EnableAlarm(
342  ADI_RTC_HANDLE const hDevice,
343  bool bEnable
344  );
345 
346 ADI_RTC_RESULT adi_rtc_EnableMod60Alarm(
347  ADI_RTC_HANDLE const hDevice,
348  bool bEnable
349  );
350 
351 ADI_RTC_RESULT adi_rtc_Enable(
352  ADI_RTC_HANDLE const hDevice,
353  bool bEnable
354  );
355 
356 ADI_RTC_RESULT adi_rtc_EnableInterrupts(
357  ADI_RTC_HANDLE const hDevice,
358  ADI_RTC_INT_TYPE Interrupts,
359  bool bEnable
360  );
361 
362 ADI_RTC_RESULT adi_rtc_EnableTrim(
363  ADI_RTC_HANDLE const hDevice,
364  bool bEnable
365  );
366 
367 ADI_RTC_RESULT adi_rtc_EnableAutoReload(
368  ADI_RTC_HANDLE const hDevice,
369  ADI_RTC_SS_CHANNEL eSSChannel,
370  bool bEnable);
371 
372 ADI_RTC_RESULT adi_rtc_EnableSensorStrobeOutput (
373  ADI_RTC_HANDLE const hDevice,
374  ADI_RTC_SS_CHANNEL eSSChannel,
375  bool bEnable);
376 
377 ADI_RTC_RESULT adi_rtc_EnableInputCapture (
378  ADI_RTC_HANDLE const hDevice,
379  ADI_RTC_INPUT_CHANNEL eInpChannel,
380  bool bEnable);
381 
383  ADI_RTC_HANDLE const hDevice,
384  ADI_RTC_SS_CHANNEL eSSChannel,
385  bool bEnable);
386 
387 ADI_RTC_RESULT adi_rtc_EnableOverwriteSnapshot (
388  ADI_RTC_HANDLE const hDevice,
389  bool bEnable);
390 
391 /*************************************/
392 /* Set APIs for RTC Device */
393 /*************************************/
394 
395 
396 ADI_RTC_RESULT adi_rtc_SetMod60AlarmPeriod(
397  ADI_RTC_HANDLE const hDevice,
398  uint8_t nPeriod
399  );
400 
401 ADI_RTC_RESULT adi_rtc_SetAlarm(
402  ADI_RTC_HANDLE const hDevice,
403  uint32_t nAlarm
404  );
405 
406 ADI_RTC_RESULT adi_rtc_SetAlarmRegs
407  (ADI_RTC_HANDLE const hDevice,
408  uint16_t nAlarm0,
409  uint16_t nAlarm1,
410  uint16_t nAlarm2);
411 
412 ADI_RTC_RESULT adi_rtc_SetAlarmAsync(
413  ADI_RTC_HANDLE const hDevice,
414  uint32_t nAlarm
415  );
416 
417 ADI_RTC_RESULT adi_rtc_SetAlarmRegsAsync
418  (ADI_RTC_HANDLE const hDevice,
419  uint16_t nAlarm0,
420  uint16_t nAlarm1,
421  uint16_t nAlarm2);
422 
423 ADI_RTC_RESULT adi_rtc_SyncAlarm(
424  ADI_RTC_HANDLE const hDevice
425  );
426 
427 ADI_RTC_RESULT adi_rtc_SetAlarmEx(
428  ADI_RTC_HANDLE const hDevice,
429  float fAlarm
430  );
431 
432 
433 ADI_RTC_RESULT adi_rtc_SetControlRegister(
434  ADI_RTC_HANDLE const hDevice,
435  ADI_RTC_CONTROL_REGISTER eRegister,
436  uint32_t Control
437  );
438 
439 ADI_RTC_RESULT adi_rtc_SetCount(
440  ADI_RTC_HANDLE const hDevice,
441  uint32_t nCount
442  );
443 
444 ADI_RTC_RESULT adi_rtc_SetGateway(
445  ADI_RTC_HANDLE const hDevice,
446  uint16_t Command
447  );
448 
449 
450 ADI_RTC_RESULT adi_rtc_SetPreScale(
451  ADI_RTC_HANDLE const hDevice,
452  uint8_t nPreScale
453  );
454 
455 ADI_RTC_RESULT adi_rtc_SetTrim(
456  ADI_RTC_HANDLE const hDevice,
457  ADI_RTC_TRIM_INTERVAL eInterval,
458  ADI_RTC_TRIM_VALUE eTrimValue,
459  ADI_RTC_TRIM_POLARITY eOperation
460  );
461 
463  ADI_RTC_HANDLE const hDevice,
464  ADI_RTC_SS_CHANNEL eSSChannel,
465  uint8_t nMask);
466 
467 #if defined(__ADUCM302x__)
468 ADI_RTC_RESULT adi_rtc_SetAutoReloadValue(
469  ADI_RTC_HANDLE const hDevice,
470  ADI_RTC_SS_CHANNEL eSSChannel,
471  uint16_t nValue);
472 #elif defined (__ADUCM4x50__)
473 ADI_RTC_RESULT adi_rtc_SetAutoReloadValue(
474  ADI_RTC_HANDLE const hDevice,
475  ADI_RTC_SS_CHANNEL eSSChannel,
476  uint16_t nLowValue,
477  uint16_t nHighValue);
478 #else
479 #error "RTC driver not ported to this proccessor"
480 #endif
481 
482 
483 ADI_RTC_RESULT adi_rtc_SetInputCapturePolarity (
484  ADI_RTC_HANDLE const hDevice,
485  ADI_RTC_INPUT_CHANNEL eInpChannel,
486  bool bEnable);
487 
488 ADI_RTC_RESULT adi_rtc_SetSensorStrobeValue(
489  ADI_RTC_HANDLE const hDevice,
490  ADI_RTC_SS_CHANNEL eSSChannel,
491  uint16_t nValue);
492 
493 /*************************************/
494 /* Get APIs for RTC Device */
495 /*************************************/
496 
497 ADI_RTC_RESULT adi_rtc_GetAlarm (
498  ADI_RTC_HANDLE hDevice,
499  uint32_t *pAlarm
500  );
501 
502 ADI_RTC_RESULT adi_rtc_GetAlarmEx (
503  ADI_RTC_HANDLE hDevice,
504  float *pAlarm);
505 
506 ADI_RTC_RESULT adi_rtc_GetAlarmRegs(
507  ADI_RTC_HANDLE hDevice,
508  uint16_t *pAlarm0,
509  uint16_t *pAlarm1,
510  uint16_t *pAlarm2);
511 
512 
513 ADI_RTC_RESULT adi_rtc_GetControl (
514  ADI_RTC_HANDLE hDevice,
515  ADI_RTC_CONTROL_REGISTER eRegister ,
516  uint32_t *pControl);
517 
518 ADI_RTC_RESULT adi_rtc_GetTrim(
519  ADI_RTC_HANDLE hDevice,
520  ADI_RTC_TRIM_VALUE *peTrim
521  );
522 
523 ADI_RTC_RESULT adi_rtc_GetCount(
524  ADI_RTC_HANDLE const hDevice,
525  uint32_t *pCount
526  );
527 
528 ADI_RTC_RESULT adi_rtc_GetCountEx(
529  ADI_RTC_HANDLE const hDevice,
530  float *pfCount
531  );
532 
533 ADI_RTC_RESULT adi_rtc_GetSnapShot(
534  ADI_RTC_HANDLE const hDevice,
535  ADI_RTC_INPUT_CHANNEL eChannel,
536  uint32_t *pValue,
537  uint16_t *pFraction);
538 
539 ADI_RTC_RESULT adi_rtc_GetInputCaptureValueEx(
540  ADI_RTC_HANDLE const hDevice,
541  ADI_RTC_INPUT_CHANNEL eChannel,
542  uint16_t *pSnap0, uint16_t * pSnap1,
543  uint16_t * pSnap2);
544 
545 ADI_RTC_RESULT adi_rtc_GetInputCaptureValue(
546  ADI_RTC_HANDLE const hDevice,
547  ADI_RTC_INPUT_CHANNEL eChannel,
548  uint16_t *pValue);
549 
550 ADI_RTC_RESULT adi_rtc_GetWritePendStatus(
551  ADI_RTC_HANDLE const hDevice,
552  ADI_RTC_WRITE_STATUS *pPendBits
553  );
554 
555 ADI_RTC_RESULT adi_rtc_GetWriteSyncStatus(
556  ADI_RTC_HANDLE const hDevice,
557  ADI_RTC_WRITE_STATUS *pSyncBits
558  );
559 
560 ADI_RTC_RESULT adi_rtc_GetSensorStrobeValue(
561  ADI_RTC_HANDLE const hDevice,
562  ADI_RTC_SS_CHANNEL eSSChannel,
563  uint16_t *pValue);
564 
565 ADI_RTC_RESULT adi_rtc_GetCountRegs(
566  ADI_RTC_HANDLE const hDevice,
567  uint32_t *pnCount,
568  uint32_t *pfCount);
569 
570 /************************************************/
571 /* RTC APIs for managing interrupt/sync */
572 /***********************************************/
573 
574 ADI_RTC_RESULT adi_rtc_GetInterruptStatus(
575  ADI_RTC_HANDLE const hDevice,
576  ADI_RTC_INT_TYPE *pStatus);
577 
578 ADI_RTC_RESULT adi_rtc_ClearInterruptStatus(
579  ADI_RTC_HANDLE const hDevice,
580  ADI_RTC_INT_TYPE Status);
581 
582 ADI_RTC_RESULT adi_rtc_SynchronizeAllWrites(
583  ADI_RTC_HANDLE const hDevice
584  );
585 
586 ADI_RTC_RESULT adi_rtc_RegisterCallback(
587  ADI_RTC_HANDLE const hDevice,
588  ADI_CALLBACK const pfCallback,
589  void *const pCBparam
590  );
591 
592 #ifdef __cplusplus
593 }
594 #endif
595 
598 #endif /* ADI_RTC_H__ */
599 
ADI_RTC_RESULT adi_rtc_ClearInterruptStatus(ADI_RTC_HANDLE const hDevice, ADI_RTC_INT_TYPE Status)
Clear an RTC interrupt status bit(s).
Definition: adi_rtc.c:1643
ADI_RTC_RESULT adi_rtc_GetInputCaptureValueEx(ADI_RTC_HANDLE const hDevice, ADI_RTC_INPUT_CHANNEL eChannel, uint16_t *pSnap0, uint16_t *pSnap1, uint16_t *pSnap2)
Get input capture value for specified input channel.
Definition: adi_rtc.c:1915
ADI_RTC_RESULT adi_rtc_SetAutoReloadValue(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, uint16_t nValue)
Set auto reload value for the given Sensor Strobe channel.
Definition: adi_rtc.c:1057
ADI_RTC_RESULT adi_rtc_GetCount(ADI_RTC_HANDLE const hDevice, uint32_t *pCount)
Get current RTC count value.
Definition: adi_rtc.c:1444
ADI_RTC_RESULT adi_rtc_SetSensorStrobeValue(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, uint16_t nValue)
Set Sensor Strobe value for the given Sensor Strobe channel.
Definition: adi_rtc.c:1834
ADI_RTC_RESULT adi_rtc_SetGateway(ADI_RTC_HANDLE const hDevice, uint16_t Command)
Set an RTC gateway command.
Definition: adi_rtc.c:2763
ADI_RTC_RESULT adi_rtc_Close(ADI_RTC_HANDLE const hDevice)
Uninitialize and deallocate an RTC device.
Definition: adi_rtc.c:399
ADI_RTC_RESULT adi_rtc_SetAlarm(ADI_RTC_HANDLE const hDevice, uint32_t nAlarm)
Set a new RTC alarm value.
Definition: adi_rtc.c:2199
ADI_RTC_RESULT adi_rtc_GetTrim(ADI_RTC_HANDLE hDevice, ADI_RTC_TRIM_VALUE *peTrim)
Get current RTC clock trim value.
Definition: adi_rtc.c:1735
uint32_t ADI_RTC_INT_TYPE
Definition: adi_rtc.h:134
ADI_RTC_RESULT adi_rtc_GetInterruptStatus(ADI_RTC_HANDLE const hDevice, ADI_RTC_INT_TYPE *pStatus)
Get current RTC interrupt source status.
Definition: adi_rtc.c:1577
ADI_RTC_RESULT adi_rtc_SetAlarmRegsAsync(ADI_RTC_HANDLE const hDevice, uint16_t nAlarm0, uint16_t nAlarm1, uint16_t nAlarm2)
Set a new RTC alarm value for RTC ALM0, ALM1 and ALM2 Registers without waiting for synchronization...
Definition: adi_rtc.c:2357
ADI_RTC_RESULT adi_rtc_SynchronizeAllWrites(ADI_RTC_HANDLE const hDevice)
Force synchronization of all pending writes.
Definition: adi_rtc.c:2853
void * ADI_RTC_HANDLE
Definition: adi_rtc.h:74
ADI_RTC_RESULT adi_rtc_GetInputCaptureValue(ADI_RTC_HANDLE const hDevice, ADI_RTC_INPUT_CHANNEL eChannel, uint16_t *pValue)
Get input capture value for specified input channel.
Definition: adi_rtc.c:1975
ADI_RTC_RESULT adi_rtc_GetSensorStrobeValue(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, uint16_t *pValue)
Get Sensor Strobe value for the given Sensor Strobe channel.
Definition: adi_rtc.c:1774
ADI_RTC_RESULT adi_rtc_GetCountRegs(ADI_RTC_HANDLE const hDevice, uint32_t *pnCount, uint32_t *pfCount)
Get current RTC count value of all registers.
Definition: adi_rtc.c:1524
ADI_RTC_RESULT adi_rtc_GetWriteSyncStatus(ADI_RTC_HANDLE const hDevice, ADI_RTC_WRITE_STATUS *pSyncBits)
Get current RTC posted write synchronization status.
Definition: adi_rtc.c:2149
ADI_RTC_RESULT adi_rtc_SyncAlarm(ADI_RTC_HANDLE const hDevice)
Sync after writing RTC alarm registers.
Definition: adi_rtc.c:2406
ADI_RTC_RESULT adi_rtc_SetTrim(ADI_RTC_HANDLE const hDevice, ADI_RTC_TRIM_INTERVAL eInterval, ADI_RTC_TRIM_VALUE eTrimValue, ADI_RTC_TRIM_POLARITY eOperation)
Set a new RTC trim value.
Definition: adi_rtc.c:2805
ADI_RTC_RESULT adi_rtc_GetCountEx(ADI_RTC_HANDLE const hDevice, float *pfCount)
Get current RTC count value with fraction.
Definition: adi_rtc.c:1480
ADI_RTC_RESULT adi_rtc_Open(uint32_t DeviceNumber, void *pDeviceMemory, uint32_t MemorySize, ADI_RTC_HANDLE *phDevice)
RTC Initialization.
Definition: adi_rtc.c:301
ADI_RTC_WRITE_STATUS
Definition: adi_rtc.h:181
ADI_RTC_RESULT adi_rtc_SetPreScale(ADI_RTC_HANDLE const hDevice, uint8_t nPreScale)
Set Prescale. This is power of 2 division factor for the RTC base clock.
Definition: adi_rtc.c:2442
ADI_RTC_RESULT adi_rtc_EnableMod60Alarm(ADI_RTC_HANDLE const hDevice, bool bEnable)
Enable MOD60 RTC alarm.
Definition: adi_rtc.c:524
ADI_RTC_RESULT adi_rtc_GetAlarmEx(ADI_RTC_HANDLE hDevice, float *pAlarm)
Get current RTC alarm value with fractional part also.
Definition: adi_rtc.c:1304
ADI_RTC_RESULT adi_rtc_EnableTrim(ADI_RTC_HANDLE const hDevice, bool bEnable)
Enable RTC automatic clock trimming.
Definition: adi_rtc.c:745
ADI_RTC_RESULT adi_rtc_GetAlarmRegs(ADI_RTC_HANDLE hDevice, uint16_t *pAlarm0, uint16_t *pAlarm1, uint16_t *pAlarm2)
Get current RTC alarm value from RTC Alarm register.
Definition: adi_rtc.c:1352
ADI_RTC_RESULT adi_rtc_RegisterCallback(ADI_RTC_HANDLE const hDevice, ADI_CALLBACK const pfCallback, void *const pCBparam)
Registers a Callback function with the RTC device driver. The registered call back function will be c...
Definition: adi_rtc.c:2653
ADI_RTC_RESULT adi_rtc_SetInputCapturePolarity(ADI_RTC_HANDLE const hDevice, ADI_RTC_INPUT_CHANNEL eInpChannel, bool bEnable)
Set input capture polarity for the specified channel.
Definition: adi_rtc.c:884
ADI_RTC_RESULT adi_rtc_SetAlarmAsync(ADI_RTC_HANDLE const hDevice, uint32_t nAlarm)
Set a new RTC alarm value without waiting for synchronization.
Definition: adi_rtc.c:2307
ADI_RTC_RESULT adi_rtc_GetControl(ADI_RTC_HANDLE hDevice, ADI_RTC_CONTROL_REGISTER eRegister, uint32_t *pControl)
Get current RTC control register value.
Definition: adi_rtc.c:1396
ADI_RTC_RESULT adi_rtc_EnableInputCapture(ADI_RTC_HANDLE const hDevice, ADI_RTC_INPUT_CHANNEL eInpChannel, bool bEnable)
Enable input capture for the specified channel.
Definition: adi_rtc.c:791
ADI_RTC_RESULT adi_rtc_SetAlarmEx(ADI_RTC_HANDLE const hDevice, float fAlarm)
Set a new RTC alarm value with fractional value.
Definition: adi_rtc.c:2544
ADI_RTC_RESULT adi_rtc_Enable(ADI_RTC_HANDLE const hDevice, bool bEnable)
Enable RTC device.
Definition: adi_rtc.c:586
ADI_RTC_RESULT adi_rtc_EnableAlarm(ADI_RTC_HANDLE const hDevice, bool bEnable)
Enable RTC alarm.
Definition: adi_rtc.c:461
ADI_RTC_RESULT adi_rtc_SetSensorStrobeChannelMask(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, uint8_t nMask)
To set channel mask for the given Sensor Strobe channel.
Definition: adi_rtc.c:1193
ADI_RTC_RESULT adi_rtc_SetControlRegister(ADI_RTC_HANDLE const hDevice, ADI_RTC_CONTROL_REGISTER eRegister, uint32_t Control)
Set a new RTC control register value.
Definition: adi_rtc.c:2605
ADI_RTC_RESULT adi_rtc_GetSnapShot(ADI_RTC_HANDLE const hDevice, ADI_RTC_INPUT_CHANNEL eChannel, uint32_t *pValue, uint16_t *pFraction)
Read RTC snapshot registers values.
Definition: adi_rtc.c:2025
ADI_RTC_RESULT adi_rtc_EnableSensorStrobeOutput(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, bool bEnable)
Enable output for the specified Sensor Strobe Channel.
Definition: adi_rtc.c:931
ADI_RTC_TRIM_INTERVAL
Definition: adi_rtc.h:203
ADI_RTC_RESULT adi_rtc_EnableAutoReload(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, bool bEnable)
Enable auto reload for given Sensor Strobe Channel.
Definition: adi_rtc.c:978
ADI_RTC_RESULT adi_rtc_GetAlarm(ADI_RTC_HANDLE hDevice, uint32_t *pAlarm)
Get current RTC alarm value.
Definition: adi_rtc.c:1263
ADI_RTC_RESULT
Definition: adi_rtc.h:103
ADI_RTC_RESULT adi_rtc_EnableSensorStrobeChannelMask(ADI_RTC_HANDLE const hDevice, ADI_RTC_SS_CHANNEL eSSChannel, bool bEnable)
Enable or disable thermometer-code masking for the given Sensor Strobe Channel.
Definition: adi_rtc.c:1148
ADI_RTC_RESULT adi_rtc_GetWritePendStatus(ADI_RTC_HANDLE const hDevice, ADI_RTC_WRITE_STATUS *pPendBits)
Get current RTC posted write pending status.
Definition: adi_rtc.c:2090
ADI_RTC_INPUT_CHANNEL
Definition: adi_rtc.h:243
ADI_RTC_TRIM_VALUE
Definition: adi_rtc.h:287
ADI_RTC_RESULT adi_rtc_SetCount(ADI_RTC_HANDLE const hDevice, uint32_t nCount)
Set a new RTC count value.
Definition: adi_rtc.c:2705
ADI_RTC_TRIM_POLARITY
Definition: adi_rtc.h:276
ADI_RTC_SS_CHANNEL
Definition: adi_rtc.h:259
ADI_RTC_RESULT adi_rtc_SetMod60AlarmPeriod(ADI_RTC_HANDLE const hDevice, uint8_t nPeriod)
Set the pre-scale. This is power of 2 division factor for the RTC base clock.
Definition: adi_rtc.c:2488
ADI_RTC_CONTROL_REGISTER
Definition: adi_rtc.h:310
ADI_RTC_RESULT adi_rtc_SetAlarmRegs(ADI_RTC_HANDLE const hDevice, uint16_t nAlarm0, uint16_t nAlarm1, uint16_t nAlarm2)
Set a new RTC alarm value for RTC ALM0,ALM1 and ALM2 Register.
Definition: adi_rtc.c:2251
ADI_RTC_RESULT adi_rtc_EnableInterrupts(ADI_RTC_HANDLE const hDevice, ADI_RTC_INT_TYPE Interrupts, bool bEnable)
Manage interrupt enable/disable in the RTC and NVIC controller.
Definition: adi_rtc.c:646
ADI_RTC_RESULT adi_rtc_EnableOverwriteSnapshot(ADI_RTC_HANDLE const hDevice, bool bEnable)
Enable Overwrite of Unread Snapshots for all RTC Input Capture Channels.
Definition: adi_rtc.c:837