xref: /freebsd/sys/contrib/ncsw/Peripherals/FM/Rtc/fm_rtc.h (revision c2c014f24c10f90d85126ac5fbd4d8524de32b1c)
1*852ba100SJustin Hibbits /*
2*852ba100SJustin Hibbits  * Copyright 2008-2012 Freescale Semiconductor Inc.
30aeed3e9SJustin Hibbits  *
40aeed3e9SJustin Hibbits  * Redistribution and use in source and binary forms, with or without
50aeed3e9SJustin Hibbits  * modification, are permitted provided that the following conditions are met:
60aeed3e9SJustin Hibbits  *     * Redistributions of source code must retain the above copyright
70aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer.
80aeed3e9SJustin Hibbits  *     * Redistributions in binary form must reproduce the above copyright
90aeed3e9SJustin Hibbits  *       notice, this list of conditions and the following disclaimer in the
100aeed3e9SJustin Hibbits  *       documentation and/or other materials provided with the distribution.
110aeed3e9SJustin Hibbits  *     * Neither the name of Freescale Semiconductor nor the
120aeed3e9SJustin Hibbits  *       names of its contributors may be used to endorse or promote products
130aeed3e9SJustin Hibbits  *       derived from this software without specific prior written permission.
140aeed3e9SJustin Hibbits  *
150aeed3e9SJustin Hibbits  *
160aeed3e9SJustin Hibbits  * ALTERNATIVELY, this software may be distributed under the terms of the
170aeed3e9SJustin Hibbits  * GNU General Public License ("GPL") as published by the Free Software
180aeed3e9SJustin Hibbits  * Foundation, either version 2 of that License or (at your option) any
190aeed3e9SJustin Hibbits  * later version.
200aeed3e9SJustin Hibbits  *
210aeed3e9SJustin Hibbits  * THIS SOFTWARE IS PROVIDED BY Freescale Semiconductor ``AS IS'' AND ANY
220aeed3e9SJustin Hibbits  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
230aeed3e9SJustin Hibbits  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
240aeed3e9SJustin Hibbits  * DISCLAIMED. IN NO EVENT SHALL Freescale Semiconductor BE LIABLE FOR ANY
250aeed3e9SJustin Hibbits  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
260aeed3e9SJustin Hibbits  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
270aeed3e9SJustin Hibbits  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
280aeed3e9SJustin Hibbits  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
290aeed3e9SJustin Hibbits  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
300aeed3e9SJustin Hibbits  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
310aeed3e9SJustin Hibbits  */
320aeed3e9SJustin Hibbits 
33*852ba100SJustin Hibbits 
340aeed3e9SJustin Hibbits /******************************************************************************
350aeed3e9SJustin Hibbits  @File          fm_rtc.h
360aeed3e9SJustin Hibbits 
370aeed3e9SJustin Hibbits  @Description   Memory map and internal definitions for FM RTC IEEE1588 Timer driver.
380aeed3e9SJustin Hibbits 
390aeed3e9SJustin Hibbits  @Cautions      None
400aeed3e9SJustin Hibbits *//***************************************************************************/
410aeed3e9SJustin Hibbits 
420aeed3e9SJustin Hibbits #ifndef __FM_RTC_H__
430aeed3e9SJustin Hibbits #define __FM_RTC_H__
440aeed3e9SJustin Hibbits 
450aeed3e9SJustin Hibbits #include "std_ext.h"
460aeed3e9SJustin Hibbits #include "fm_rtc_ext.h"
470aeed3e9SJustin Hibbits 
480aeed3e9SJustin Hibbits 
490aeed3e9SJustin Hibbits #define __ERR_MODULE__  MODULE_FM_RTC
500aeed3e9SJustin Hibbits 
510aeed3e9SJustin Hibbits /* General definitions */
520aeed3e9SJustin Hibbits 
530aeed3e9SJustin Hibbits #define ACCUMULATOR_OVERFLOW            ((uint64_t)(1LL << 32))
54*852ba100SJustin Hibbits #define DEFAULT_OUTPUT_CLOCK_DIVISOR     0x00000002
55*852ba100SJustin Hibbits #define DEFAULT_BYPASS      			 FALSE
56*852ba100SJustin Hibbits #define DEFAULT_CLOCK_PERIOD             1000
570aeed3e9SJustin Hibbits 
580aeed3e9SJustin Hibbits 
590aeed3e9SJustin Hibbits 
600aeed3e9SJustin Hibbits typedef struct t_FmRtcAlarm
610aeed3e9SJustin Hibbits {
620aeed3e9SJustin Hibbits     t_FmRtcExceptionsCallback   *f_AlarmCallback;
630aeed3e9SJustin Hibbits     bool                        clearOnExpiration;
640aeed3e9SJustin Hibbits } t_FmRtcAlarm;
650aeed3e9SJustin Hibbits 
660aeed3e9SJustin Hibbits typedef struct t_FmRtcPeriodicPulse
670aeed3e9SJustin Hibbits {
680aeed3e9SJustin Hibbits     t_FmRtcExceptionsCallback   *f_PeriodicPulseCallback;
690aeed3e9SJustin Hibbits } t_FmRtcPeriodicPulse;
700aeed3e9SJustin Hibbits 
710aeed3e9SJustin Hibbits typedef struct t_FmRtcExternalTrigger
720aeed3e9SJustin Hibbits {
730aeed3e9SJustin Hibbits     t_FmRtcExceptionsCallback   *f_ExternalTriggerCallback;
740aeed3e9SJustin Hibbits } t_FmRtcExternalTrigger;
750aeed3e9SJustin Hibbits 
760aeed3e9SJustin Hibbits 
770aeed3e9SJustin Hibbits /**************************************************************************//**
780aeed3e9SJustin Hibbits  @Description RTC FM driver control structure.
790aeed3e9SJustin Hibbits *//***************************************************************************/
800aeed3e9SJustin Hibbits typedef struct t_FmRtc
810aeed3e9SJustin Hibbits {
820aeed3e9SJustin Hibbits     t_Part                  *p_Part;            /**< Pointer to the integration device              */
830aeed3e9SJustin Hibbits     t_Handle                h_Fm;
840aeed3e9SJustin Hibbits     t_Handle                h_App;              /**< Application handle */
85*852ba100SJustin Hibbits     struct rtc_regs			*p_MemMap;
860aeed3e9SJustin Hibbits     uint32_t                clockPeriodNanoSec; /**< RTC clock period in nano-seconds (for FS mode) */
870aeed3e9SJustin Hibbits     uint32_t                srcClkFreqMhz;
880aeed3e9SJustin Hibbits     uint16_t                outputClockDivisor; /**< Output clock divisor (for FS mode) */
890aeed3e9SJustin Hibbits     t_FmRtcAlarm            alarmParams[FM_RTC_NUM_OF_ALARMS];
900aeed3e9SJustin Hibbits     t_FmRtcPeriodicPulse    periodicPulseParams[FM_RTC_NUM_OF_PERIODIC_PULSES];
910aeed3e9SJustin Hibbits     t_FmRtcExternalTrigger  externalTriggerParams[FM_RTC_NUM_OF_EXT_TRIGGERS];
92*852ba100SJustin Hibbits     struct rtc_cfg 			*p_RtcDriverParam;  /**< RTC Driver parameters (for Init phase) */
930aeed3e9SJustin Hibbits } t_FmRtc;
940aeed3e9SJustin Hibbits 
950aeed3e9SJustin Hibbits 
960aeed3e9SJustin Hibbits #endif /* __FM_RTC_H__ */
97