⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 triton_rtc.h

📁 OMAP1030 处理器的ARM 侧硬件测试代码 OMAP1030 是TI的双核处理器
💻 H
📖 第 1 页 / 共 2 页
字号:
/*
* ============================================================================
*
*            TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
*
*   Property of Texas Instruments
*   For Unrestricted Internal Use Only
*   Unauthorized reproduction and/or distribution is strictly prohibited.
*   This product is protected under copyright law and trade secret law as an
*   unpublished work.
*   Created 2003, (C) Copyright 2003 Texas Instruments.  All rights reserved.
*
*    Filename    : triton_rtc.h
*
*    Author : Bruno Decroos
*
*    Description :
*      This embedded Real Time Clock module directly accessible from Rhea Bus
*      interface provides the following main features:
*        - Time Information (seconds/minute/hours) coded in BCD
*        - Calendar information (Day/Month/Year/ Day of the week) BCD 
*          coded up to 2099
*        - Alarm fcts with IT generation based either on
*        * periodical (second/minute/hour/day)
*        * precise time event in the century
*        * 30 sec time range correction
*
* =============================================================================
*/
#ifndef __TRITON_RTC_H
#define __TRITON_RTC_H


/* ============================================================================
* INCLUDE FILES (only if necessary)
* =============================================================================
*/


/* ============================================================================
* GLOBAL DEFINITIONS
* =============================================================================
*/
// RTC registers XIO address 


#define Abb_RTC_SECONDS_REG         (TRITON_MAP_RTC_REG)	  /* Seconds register */
#define Abb_RTC_MINUTES_REG         ((TRITON_MAP_RTC_REG) +  1)	  /* Minutes register */
#define Abb_RTC_HOURS_REG	    ((TRITON_MAP_RTC_REG) +  2)	  /* Hours register */
#define Abb_RTC_DAYS_REG	    ((TRITON_MAP_RTC_REG) +  3)	  /* Days register */
#define Abb_RTC_MONTHS_REG	    ((TRITON_MAP_RTC_REG) +  4)	  /* Months register */
#define Abb_RTC_YEARS_REG	    ((TRITON_MAP_RTC_REG) +  5)	  /* Years register */
#define Abb_RTC_WEEK_REG	    ((TRITON_MAP_RTC_REG) +  6)	  /* Week register */
#define Abb_RTC_ALARM_SECONDS_REG   ((TRITON_MAP_RTC_REG) +  8)   /* Alarms seconds register */
#define Abb_RTC_ALARM_MINUTES_REG   ((TRITON_MAP_RTC_REG) +  9)   /* Alarms minutes register */
#define Abb_RTC_ALARM_HOURS_REG     ((TRITON_MAP_RTC_REG) + 10)   /* Alarms hours register */
#define Abb_RTC_ALARM_DAYS_REG      ((TRITON_MAP_RTC_REG) + 11)   /* Alarms days register */
#define Abb_RTC_ALARM_MONTHS_REG    ((TRITON_MAP_RTC_REG) + 12)   /* Alarms months register */
#define Abb_RTC_ALARM_YEARS_REG     ((TRITON_MAP_RTC_REG) + 13)   /* Alarms years register */
#define Abb_RTC_CTRL_REG   	    ((TRITON_MAP_RTC_REG) + 16)   /* Control register */
#define Abb_RTC_STATUS_REG	    ((TRITON_MAP_RTC_REG) + 17)   /* Status register */
#define Abb_RTC_INTERRUPTS_REG      ((TRITON_MAP_RTC_REG) + 18)   /* Interrupts register */
#define Abb_RTC_COMP_LSB_REG        ((TRITON_MAP_RTC_REG) + 19)   /* Compensation register */
#define Abb_RTC_COMP_MSB_REG        ((TRITON_MAP_RTC_REG) + 20)   /* Compensation register */
#define Abb_RTC_RES_PROG_REG        ((TRITON_MAP_RTC_REG) + 21)   /* Oscillator resistance register */
#define Abb_RTC_POWER_ON_RESET_REG  ((TRITON_MAP_RTC_REG) + 22)   /* Power on reset register */



/* when reading */
#define RTC_SECONDS_REG_RD 	   MSI2C_MasterPollingReceiveAbb(Abb_RTC_SECONDS_REG)        /* Seconds register read */
#define RTC_MINUTES_REG_RD 	   MSI2C_MasterPollingReceiveAbb(Abb_RTC_MINUTES_REG)        /* Minutes register read */
#define RTC_HOURS_REG_RD	   MSI2C_MasterPollingReceiveAbb(Abb_RTC_HOURS_REG)              /* Hours register read */
#define RTC_DAYS_REG_RD		   MSI2C_MasterPollingReceiveAbb(Abb_RTC_DAYS_REG)           /* Days register read */
#define RTC_MONTHS_REG_RD	   MSI2C_MasterPollingReceiveAbb(Abb_RTC_MONTHS_REG)             /* Months register read */
#define RTC_YEARS_REG_RD	   MSI2C_MasterPollingReceiveAbb(Abb_RTC_YEARS_REG)          /* Years register read */
#define RTC_WEEK_REG_RD		   MSI2C_MasterPollingReceiveAbb(Abb_RTC_WEEK_REG)           /* Week register read */
#define RTC_ALARM_SECONDS_REG_RD   MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_SECONDS_REG)  /* Alarms seconds register read */
#define RTC_ALARM_MINUTES_REG_RD   MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_MINUTES_REG)  /* Alarms minutes register read */
#define RTC_ALARM_HOURS_REG_RD     MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_HOURS_REG)    /* Alarms hours register read */
#define RTC_ALARM_DAYS_REG_RD      MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_DAYS_REG)     /* Alarms days register read */
#define RTC_ALARM_MONTHS_REG_RD    MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_MONTHS_REG)   /* Alarms monthsregister read */
#define RTC_ALARM_YEARS_REG_RD     MSI2C_MasterPollingReceiveAbb(Abb_RTC_ALARM_YEARS_REG)    /* Alarms years register read */
#define RTC_CTRL_REG_RD            MSI2C_MasterPollingReceiveAbb(Abb_RTC_CTRL_REG)           /* Control register read */
#define RTC_STATUS_REG_RD          MSI2C_MasterPollingReceiveAbb(Abb_RTC_STATUS_REG)         /* Status register read */
#define RTC_INTERRUPTS_REG_RD      MSI2C_MasterPollingReceiveAbb(Abb_RTC_INTERRUPTS_REG)     /* Interrupts register read */
#define RTC_COMP_LSB_REG_RD        MSI2C_MasterPollingReceiveAbb(Abb_RTC_COMP_LSB_REG)       /* Compensation register read */
#define RTC_COMP_MSB_REG_RD        MSI2C_MasterPollingReceiveAbb(Abb_RTC_COMP_MSB_REG)       /* Compensation register read */
#define RTC_RES_PROG_REG_RD        MSI2C_MasterPollingReceiveAbb(Abb_RTC_RES_PROG_REG)       /* Compensation register read */
#define RTC_POWER_ON_RESET_REG_RD  MSI2C_MasterPollingReceiveAbb(Abb_RTC_POWER_ON_RESET_REG) /* Power on reset register read */




// RTC Control register description 
#define RTC_START_RTC	0x0001	// 1 => RTC is running 
#define RTC_ROUND_30S	0x0002	// Time rounded to the closest minute 
#define RTC_AUTO_COMP	0x0004	// Auto compensation enabled 
#define RTC_MODE_12_24	0x0008	// 12 hours mode 
#define RTC_TEST_MODE	0x0010	// Test mode 
#define RTC_SET_32_COUNTER 0x0020 // set 32 KHz counter with comp_reg 
#define RTC_nDELTA_OMEGA 0x0040 // ABB circuit is Delta-Iota if 0 or Omega-Nausica otherwise  

// RTC Interrupt register description 
#define RTC_EVERY_SEC	0x0000
#define RTC_EVERY_MIN  	0x0001
#define RTC_EVERY_HR	0x0002
#define RTC_EVERY_DAY	0x0003
#define RTC_IT_TIMER	0x0004 // Enable periodic interrupt 
#define RTC_IT_ALARM	0x0008 

// RTC Status register description 
#define RTC_BUSY	0x0001
#define RTC_RUN		0x0002 // RTC is running 
#define RTC_1S_EVENT	0x0004 // One second has occured 
#define RTC_1M_EVENT 	0x0008 // One minute has occured 
#define RTC_1H_EVENT	0x0010 // One hour has occured 
#define RTC_1D_EVENT	0x0020 // One day has occrued 
#define RTC_ALARM	0x0040 // Alarm interrupt has been generated 

#define RTC_AM		0
#define RTC_PM		1
#define RTC_24_MODE	0
#define RTC_12_MODE	1

struct rtc_tm {
            int          rtc_sec;    // seconds after the minute   - [0,59]  
            int          rtc_min;    // minutes after the hour     - [0,59]  
            int          rtc_hour;   // hours after the midnight   - [0,23]  
            int          rtc_day;    // day of the month           - [1,31]  
            int          rtc_mon;    // months 		           - [01,12] 
            int          rtc_year;   // years                      - [00,99] 
            int          rtc_wday;   // days in a week 		   - [0,6] 
            int          rtc_PM;     // only in used in PM_AM mode 0=>AM 1=>PM 
	    int 	 rtc_1224md; // 0=> 24 hours 
	  };

// ----- Macro ----- 

/*----------------------------------------------------------
  RTC_STOP : Stop the RTC (STOP_RTC is cleared)
-----------------------------------------------------------*/
#define RTC_STOP  MSI2C_MasterPollingSendAbb(Abb_RTC_CTRL_REG, (RTC_CTRL_REG_RD & ~RTC_START_RTC ))
          

/*----------------------------------------------------------
  RTC_START : Start the RTC  
-----------------------------------------------------------*/
#define RTC_START MSI2C_MasterPollingSendAbb(Abb_RTC_CTRL_REG, ( RTC_CTRL_REG_RD | RTC_START_RTC )) 

/*----------------------------------------------------------
  RTC_SET32CNT : Set the SET_32_COUNTER bit 
-----------------------------------------------------------*/
#define RTC_SET32CNT MSI2C_MasterPollingSendAbb(Abb_RTC_CTRL_REG, ( RTC_CTRL_REG_RD | RTC_SET_32_COUNTER ))

/*----------------------------------------------------------
  RTC_RESET32CNT : Reset the SET_32_COUNTER bit  
-----------------------------------------------------------*/
#define RTC_RESET32CNT  MSI2C_MasterPollingSendAbb(Abb_RTC_CTRL_REG, ( RTC_CTRL_REG_RD & ~RTC_SET_32_COUNTER ))

/*----------------------------------------------------------
  RTC_SETTESTMODE : Set the TEST_MODE bit 

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -