📄 rtc41t81.h
字号:
/* **********************************************************************
Copyright (c) Yuyu 2003-2005
All rights are reserved. Reproduction in whole or in parts is
prohibited without the prior written consent of the copyright owner.
----------------------------------------------------------------------
Project : TMS320DM270 J2G project
-------------------------------------------
uC : TMS320DM270
Platfrom : TMS320DM270 RTC of ST's M41T81 for J2G project
UI : RS-232
FuntionOfNum : RTC codec function
Original Possessor : Engineer Yuyu Chen
AmRoad CORP.
Module: rtc41T81.h
Purpose: Interface of funtion.
Version: 0.1 13:59 2004/02/05
Compiler: TI's CCS V2.1
Reference:
[1] TMS320DM270 CPU Reference Guide [ARM Register Manual] TI
[2] ST's M41T81 SPEC,
SERIAL ACCESS RTC WITH ALARMS.
date: October 2002 Version: V. 1.6
********************************************************************** */
#ifndef _rtc41T81_H_
#define _rtc41T81_H_
/* ------------------------------------
Header Files
------------------------------------ */
#include <system/armsys270.h>
/* ------------------------------------
Macro Definitions
------------------------------------ */
#undef EXTERN
#ifdef _rtc41T81_C_
#define EXTERN
#else
#define EXTERN extern
#endif
/* ------------------------------------
Type Definitions
------------------------------------ */
typedef struct{
Uint8 M41T81_sec; /* Seconds (00 ~ 59) */
Uint8 M41T81_min; /* Minutes (00 ~ 59) */
Uint8 M41T81_hour; /* Hours (00 ~ 23) */
Uint8 M41T81_wday; /* Week (01 ~ 07) */
Uint8 M41T81_mday; /* Day of Month (01 ~ 31) */
Uint8 M41T81_mon; /* Months (01 ~ 12) */
Uint8 M41T81_year; /* Year (00 ~ 99) */
} M41T81_TM;
typedef enum{
OncePerYear,
OncePerMonth,
OncePerDay,
OncePerHour,
OncePerMinute,
OncePerSecond
} AlarmRepeatMode;
/* ------------------------------------
Variables Definitions
------------------------------------ */
extern Uint8 PwrSavingBase;
/* ------------------------------------
Function Prototypes
------------------------------------ */
/*=========================================================================
SubRoutine: STATUS M41T81_Init( void )
Function : Init and start M41T81.
Parameter : nil
Return : Status - error message ==> E_PASS OR E_INVALID_INPUT
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_Init( void );
/*=========================================================================
SubRoutine: STATUS M41T81_TimeInput( M41T81_TM *TimeInput )
Function : set time successive to M41T81.
Parameter : *TimeInput - time struct for input.
Return : STATUS
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_TimeInput( M41T81_TM *TimeInput );
/*=========================================================================
SubRoutine: STATUS M41T81_TimeOut( M41T81_TM *TimeOutput )
Function : read time from M41T81.
Parameter : M41T81_TM
Return : Status - error message ==> E_PASS OR E_INVALID_INPUT
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_TimeOut( M41T81_TM *TimeOutput );
/*=========================================================================
SubRoutine: STATUS M41T81_AlarmEnable( void )
Function : Write Alarm Enable register to M41T81.
Parameter : nil
Return : status
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_AlarmEnable( void );
/*=========================================================================
SubRoutine: STATUS M41T81_AlarmDisable( void )
Function : Write Alarm Disable register to M41T81.
Parameter : nil
Return : status
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_AlarmDisable( void );
/*=========================================================================
SubRoutine: STATUS M41T81_AlarmTimeInput( M41T81_TM *TimeInput )
Function : set alarm time successive to M41T81.
Parameter : *TimeInput - time struct for input.
(Just useing Month, Date, Hour, Minutes, Secons)
Return : STATUS
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_AlarmTimeInput( M41T81_TM *TimeInput );
/*=========================================================================
SubRoutine: STATUS M41T81_AlarmTimeOut( M41T81_TM *TimeOutput )
Function : read alarm time from M41T81.
Parameter : M41T81_TM (Month, Date, Hour, Minutes, Secons)
Return : Status - error message ==> E_PASS OR E_INVALID_INPUT
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_AlarmTimeOut( M41T81_TM *TimeOutput );
/*=========================================================================
SubRoutine: STATUS M41T81_AlarmRepeatMode( AlarmRepeatMode *Repeat )
Function : Write alarm repeat mode to M41T81 register.
Parameter : AlarmRepeatMode (OncePerYear, Month, Day, Hour, Minute, Second)
Return : Status - error message ==> E_PASS OR E_INVALID_INPUT
Reference : [2][1]
=========================================================================*/
EXTERN STATUS M41T81_AlarmRepeatMode( AlarmRepeatMode Repeat );
#endif
/* _RTCM41T81_H_ */
/* %% End Of File %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% */
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -