VxWorks BSP Reference : lopec

sysRtc [lopec]

NAME

sysRtc [lopec] - Interface routines for real-time clock and alarm clock support

ROUTINES

sysAlarmSet( ) - This routine sets an alarm clock.
sysAlarmCancel( ) - This routine disables the alarm clock.
sysAlarmIntr( ) - Interrupt handler for the alarm clock.
sysAlarmGet( ) - Get the current alarm clock parameters.
sysAlarmShow( ) - Display current alarm clock settings on the user's display.
sysRtcSet( ) - Sets the real-time clock date and time.
sysRtcShow( ) - Display current RTC time and date on the user's display.
sysRtcGet( ) - Populate RTC_DATE_TIME structure with current RTC date and time.
sysRtcDateTimeHook( ) - Hook real-time clock to the dosFsLib.

DESCRIPTION

This code provides the real-time clock and alarm clock interfaces.

The routines defined in this file are intended as user-callable routines. The routines themselves call device-specific routines as defined by the following in the board header file:

RTC_SET(x)
Sets the RTC date and time.

RTC_SHOW( )
Displays the current RTC time in a user-readable form on the user's display.

RTC_GET(x)
Gets the current RTC date and time.

RTC_DATE_TIME_HOOK(x)
Hook to connect the RTC_DATE_GET routine to the dosFsLib to provide date/time values for file timestamps.

ALARM_SET(x,y)
Set an alarm.

ALARM_GET(x,y)
Gets the current alarm clock settings.

ALARM_SHOW( )
Displays the current alarm clock settings in a user-readable form on the user's display.

ALARM_CANCEL( )
Cancel an alarm.

INCLUDED FILES

m48t37.h, dosFsLib.h


lopec : Routines

sysAlarmSet( )

NAME

sysAlarmSet( ) - This routine sets an alarm clock.

SYNOPSIS

STATUS sysAlarmSet
    (
    UCHAR             method,    /* method = ALARM_EVERY_XXXX */
    ALARM_DATE_TIME * alarm_time /* alarm parameters */
    )

DESCRIPTION

The alarm can be programmed to go off once a month at a predetermined day, hour, minute, and second, to go off once a day at a predetermined hour, minute, and second, to go off once an hour at a predetermined minute, and second, to go off once a minute at a predetermined second, or to go off once a second.

method can have the following values:

ALARM_EVERY_MONTH  = once a month
ALARM_EVERY_DAY    = once a day
ALARM_EVERY_HOUR   = once an hour
ALARM_EVERY_MINUTE = once a minute
ALARM_EVERY_SECOND = once a second

The alarm values for second, minute, hour, and day_of_month must be passed to the function in an ALARM_DATE_TIME structure. The hour must be specified using a 24-hour clock.

Valid parameters:

 day of month = 01-31
         hour = 00-23
       minute = 00-59
       second = 00-59

For example:
 If you wanted to set an alarm to repeat once a month, on the 3rd day, at 
 2:45 PM, you would create an ALARM_DATE_TIME structure with the following
 values:

      ALARM_DATE_TIME * a_time;
      a_time->day_of_month = 3;
      a_time->hour = 14;
      a_time->minute = 45;
      a_time->second = 0; 

You would then pass in a value of ALARM_EVERY_MONTH for the method, and the a_time structure you created, to the function.

RETURNS

OK, or ERROR if the settings are invalid.

SEE ALSO

sysRtc


lopec : Routines

sysAlarmCancel( )

NAME

sysAlarmCancel( ) - This routine disables the alarm clock.

SYNOPSIS

STATUS sysAlarmCancel (void)

DESCRIPTION

A call to this routine will disable the alarm clock.

RETURNS

OK, or ERROR if alarm cannot be canceled.

SEE ALSO

sysRtc


lopec : Routines

sysAlarmIntr( )

NAME

sysAlarmIntr( ) - Interrupt handler for the alarm clock.

SYNOPSIS

void sysAlarmIntr (void)

DESCRIPTION

When the alarm clock expires, an interrupt is generated. This is an example interrupt handler routine. This routine prints a "@" every time the alarm clock interrupt is fired.

To define your own alarm clock interrupt handler, simply edit this routine.

RETURNS

void.

SEE ALSO

sysRtc


lopec : Routines

sysAlarmGet( )

NAME

sysAlarmGet( ) - Get the current alarm clock parameters.

SYNOPSIS

STATUS sysAlarmGet
    (
    UCHAR *           method,    /* method = ALARM_EVERY_XXXX */
    ALARM_DATE_TIME * alarm_time /* current alarm parameters */
    )

DESCRIPTION

This routine gets the current alarm clock parameters. It populates an ALARM_DATE_TIME structure with the current settings.

RETURNS

OK, or ERROR if unable to get the current settings.

SEE ALSO

sysRtc


lopec : Routines

sysAlarmShow( )

NAME

sysAlarmShow( ) - Display current alarm clock settings on the user's display.

SYNOPSIS

STATUS sysAlarmShow (void)

DESCRIPTION

This routine will display the current alarm clock settings on the user's display in a user-readable fashion.

RETURNS

OK, or ERROR if unable to get or display the current settings.

SEE ALSO

sysRtc


lopec : Routines

sysRtcSet( )

NAME

sysRtcSet( ) - Sets the real-time clock date and time.

SYNOPSIS

STATUS sysRtcSet
    (
    RTC_DATE_TIME * rtc_time  /* Real-time clock parameters */
    )

DESCRIPTION

This routine sets the real-time clock date and time as per the user's specification.

The routine expects as input, an RTC_DATE_TIME structure configured with valid date and time values.

Valid parameters:

       century = 00-99
          year = 00-99
         month = 01-12
  day of month = 01-31
   day of week = 01-07
          hour = 00-23
        minute = 00-59
        second = 00-59

For example, to set the date and time to January 1, 2001 at 4:40 PM, you would populate the structure with the following values:

      RTC_DATE_TIME *rtc_time;
      rtc_time->century = 20;
      rtc_time->year = 01;
      rtc_time->month = 1;
      rtc_time->day_of_month = 1;
      rtc_time->day_of_week = 2;
      rtc_time->hour = 16;
      rtc_time->minute = 40;
      rtc_time->second = 0;

RETURNS

OK, or ERROR if the date and time values were invalid.

SEE ALSO

sysRtc


lopec : Routines

sysRtcShow( )

NAME

sysRtcShow( ) - Display current RTC time and date on the user's display.

SYNOPSIS

STATUS sysRtcShow (void)

DESCRIPTION

This routine displays the current RTC time and date on the user's display in a user-readable fashion.

 For example:

      Time: 18:34:12  Date: 2/20/2001

RETURNS

OK, or ERROR if unable to get or display the current RTC time and date.

SEE ALSO

sysRtc


lopec : Routines

sysRtcGet( )

NAME

sysRtcGet( ) - Populate RTC_DATE_TIME structure with current RTC date and time.

SYNOPSIS

STATUS sysRtcGet
    (
    RTC_DATE_TIME * rtc_time  /* Current real-time clock parameters */
    )

DESCRIPTION

This routine expects an RTC_DATE_TIME structure as input, which it will populate with the RTC's current date and time.

RETURNS

OK, or ERROR if unable to get the current RTC date and time.

SEE ALSO

sysRtc


lopec : Routines

sysRtcDateTimeHook( )

NAME

sysRtcDateTimeHook( ) - Hook real-time clock to the dosFsLib.

SYNOPSIS

void sysRtcDateTimeHook
    (
    DOS_DATE_TIME * pDateTime /* Current date and time */
    )

DESCRIPTION

This routine expects a DOS_DATE_TIME structure as input, which it will populate with the current date and time. It is then used by the standard VxWorks dosFsLib as a way to update the date/time values used for file timestamps.

RETURNS

void.

SEE ALSO

sysRtc