Main Page | Modules | Alphabetical List | Data Structures | Directories | File List | Data Fields | Globals | Related Pages | Examples

rtc.c File Reference


Detailed Description

RTC for Philips PCF8563 clock chip.

 *
 * $Log: rtc.c,v $
 * Revision 1.2  2006/10/08 16:48:09  haraldkipp
 * Documentation fixed
 *
 * Revision 1.1  2006/10/05 17:18:49  haraldkipp
 * Hardware independant RTC layer added.
 *
 *
 * 


Functions

int NutRegisterRtc (NUTRTC *rtc)
 Register a specified RTC.
int NutRtcGetTime (struct _tm *tm)
 Get date and time from the registered RTC.
int NutRtcSetTime (CONST struct _tm *tm)
 Set date and time of the registered RTC.
int NutRtcGetAlarm (int idx, struct _tm *tm, int *aflags)
 Get alarm date and time from the registered RTC.
int NutRtcSetAlarm (int idx, CONST struct _tm *tm, int aflags)
 Set alarm date and time of the registered RTC.
int NutRtcGetStatus (u_long *sflags)
 Query status flags from the registered RTC.
int NutRtcClearStatus (u_long sflags)
 Clear status flags of the registered RTC.


Function Documentation

int NutRegisterRtc NUTRTC rtc  ) 
 

Register a specified RTC.

This will also initialize any hardware, if required.

Parameters:
rtc Pointer to the NUTRTC structure.
Returns:
0 on success or -1 in case of an error.

int NutRtcGetTime struct _tm tm  ) 
 

Get date and time from the registered RTC.

Portable applications should use standard C functions.

Parameters:
tm Points to a structure that receives the date and time information.
Returns:
0 on success or -1 in case of an error.

int NutRtcSetTime CONST struct _tm tm  ) 
 

Set date and time of the registered RTC.

Portable applications should stime().

Parameters:
tm Points to a structure which contains the date and time information.
Returns:
0 on success or -1 in case of an error.

int NutRtcGetAlarm int  idx,
struct _tm tm,
int *  aflags
 

Get alarm date and time from the registered RTC.

Parameters:
idx Zero based index. Two alarms are supported.
tm Points to a structure that receives the date and time information.
aflags Points to an unsigned long that receives the enable flags.
Returns:
0 on success or -1 in case of an error.

int NutRtcSetAlarm int  idx,
CONST struct _tm tm,
int  aflags
 

Set alarm date and time of the registered RTC.

Parameters:
idx Zero based index. Two alarms are supported.
tm Points to a structure which contains the date and time information. May be NULL to clear the alarm.
aflags Each bit enables a specific comparision.
  • Bit 0: Seconds
  • Bit 1: Minutes
  • Bit 2: Hours
  • Bit 3: Day of month
  • Bit 4: Month
  • Bit 7: Day of week (Sunday is zero)
Returns:
0 on success or -1 in case of an error.

int NutRtcGetStatus u_long sflags  ) 
 

Query status flags from the registered RTC.

Parameters:
sflags Points to an unsigned long that receives the status flags.
  • Bit 0: Power fail.
  • Bit 5: Alarm 0 occured.
  • Bit 6: Alarm 1 occured.
Returns:
0 on success or -1 in case of an error.

int NutRtcClearStatus u_long  sflags  ) 
 

Clear status flags of the registered RTC.

Parameters:
sflags Status flags to clear.
Returns:
Always 0.


© 2000-2006 by egnite Software GmbH - visit http://www.ethernut.de/