MityDSP Documentation Index
Classes | Public Types | Public Member Functions | Public Attributes | Static Public Attributes | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | Static Protected Attributes
MityDSP::tcDspClk1305G Class Reference

Instances of this class handle an interface to the frequency-adjustable HW clock core, based upon Appendix G of RFC-1305 (NTP). More...

#include <core/DspClk1305G.h>

List of all members.

Classes

struct  alarm_queue
 Structure for alarm queue. More...

Public Types

typedef void(* tfAlarmCallback )(unsigned int, void *)
 prototype for the alarm callbacks.

Public Member Functions

 tcDspClk1305G (void *apAddress)
 This constructor is used to open a tcDspClk1305G interface.
virtual ~tcDspClk1305G ()
 This destructor is used to close up and free the resources tied to the associated RTC-1305G clock interface.
bool getTime (unsigned int &arSecs, unsigned int &arNanoSecs)
 Returns the seconds and nanoseconds fields from the RTC-1305 clock.
bool setTime (unsigned int anSecs, unsigned int anNanoSecs)
 Sets the current seconds and nanoseconds fields of the RTC-1305 clock.
int adjFreq (int anPPB)
 Adjusts the clock frequency by the given parts-per-billion.
int getFreq (void)
 Returns the total clock frequency adjustment in parts-per-billion.
int setFreq (int anPPB)
 Sets the total clock frequency adjustment in parts-per-billion.
unsigned int setAlarm (unsigned int anSecs, unsigned int anNanoSecs, tfAlarmCallback afCallback, void *apUserData)
 Schedules an alarm at the provided time.
bool cancelAlarm (unsigned int ahAlarmId)
 Removes a pending alarm from the queue.

Public Attributes

unsigned int mnInterruptCount
 ISR counter (debug).

Static Public Attributes

static const int gnMaxAdjPPB = 10000000
 maximum frequency adjustment, in parts-per-billion

Protected Types

typedef struct
MityDSP::tcDspClk1305G::alarm_queue 
tsAlarmQueue
 Structure for alarm queue.

Protected Member Functions

void alarmInterrupt (void)
 Interrupt service routine for alarm interrupts.
void scheduleAlarm (void)
 Internal method used to schedule the next alarm in the queue.

Static Protected Member Functions

static int interrupt_dispatch (Arg arMyObject)
 Static interrupt dispatch routine.

Protected Attributes

volatile unsigned int * mpBaseAddr
LCK_Handle mhMutex
 mutex to serialize access
unsigned int mnNominalSwallow
 the "nominal swallow count"
int mnPPB
 accumulated parts-per-billion adjustment
volatile tsAlarmQueuempAlarmQueue
 queue of pending alarms
unsigned short mnMyIntMask
 core interrupt mask
int mnMyIntLevel
 core interrupt level
int mnMyIntVector
 core interrupt vector

Static Protected Attributes

static const int gnMaxPD = 1048575
 max prescaler divider
static const int gnMinPPB = 954
 minimum possible PPB adjustment
static const unsigned int gnCLK_LSB = 200
 LSB of nanoseconds field.

Detailed Description

Instances of this class handle an interface to the frequency-adjustable HW clock core, based upon Appendix G of RFC-1305 (NTP).

See also:
tcDspClk1305G Page

Member Typedef Documentation

typedef void(* MityDSP::tcDspClk1305G::tfAlarmCallback)(unsigned int, void *)

prototype for the alarm callbacks.

Structure for alarm queue.


Constructor & Destructor Documentation

tcDspClk1305G::tcDspClk1305G ( void *  apAddress)

This constructor is used to open a tcDspClk1305G interface.

The clock is initialized to time zero, and is immediately available for use.

Parameters:
[in]apAddressBase Address of ADC core.
Returns:
None.
See also:
DspClk1305G.h
tcDspClk1305G::~tcDspClk1305G ( )
virtual

This destructor is used to close up and free the resources tied to the associated RTC-1305G clock interface.

Returns:
None.
See also:
DspClk1305G.h

Member Function Documentation

bool tcDspClk1305G::getTime ( unsigned int &  arSecs,
unsigned int &  arNanoSecs 
)

Returns the seconds and nanoseconds fields from the RTC-1305 clock.

The fields are latched so there's no rollover concerns to be addressed.

Parameters:
[out]arSecsReference to the seconds field to fill.
[out]arNanoSecsReference to the nsec field to fill.
Returns:
True.
See also:
DspClk1305G.h
bool tcDspClk1305G::setTime ( unsigned int  anSecs,
unsigned int  anNanoSecs 
)

Sets the current seconds and nanoseconds fields of the RTC-1305 clock.

Parameters:
[in]anSecsSeconds value to set.
[in]anNanoSecsNanoseconds value to set.
Returns:
True.
See also:
DspClk1305G.h
int tcDspClk1305G::adjFreq ( int  anPPB)

Adjusts the clock frequency by the given parts-per-billion.

Parameters:
[in]anPPBAdjustment to the current parts-per-billion setting.
Returns:
Total PPB setting.
See also:
DspClk1305G.h
int tcDspClk1305G::getFreq ( void  )

Returns the total clock frequency adjustment in parts-per-billion.

Returns:
Total PPB setting.
See also:
DspClk1305G.h
int tcDspClk1305G::setFreq ( int  anPPB)

Sets the total clock frequency adjustment in parts-per-billion.

Parameters:
[in]anPPBAbsolute parts-per-billion setting.
Returns:
Actual current PPB setting.
See also:
DspClk1305G.h
unsigned int tcDspClk1305G::setAlarm ( unsigned int  anSecs,
unsigned int  anNanoSecs,
tfAlarmCallback  afCallback,
void *  apUserData 
)

Schedules an alarm at the provided time.

Alarm will trigger immediately if time is past. If other alarms are pending, the new alarm will be added to a queue of alarms at the appropriate point.

Parameters:
[in]anSecsSeconds alarm value to set.
[in]anNanoSecsNanoseconds alarm value to set.
[in]afCallbackThe function to call when the alarm occurs.
[in]apUserDataAn argument to be supplied with the callback.
Returns:
Handle associated with this alarm
See also:
DspClk1305G.h
bool tcDspClk1305G::cancelAlarm ( unsigned int  ahAlarmId)

Removes a pending alarm from the queue.

Parameters:
[in]ahAlarmIdHandle of alarm to remove (returned by setAlarm)
Returns:
True if removed, false if handle not in queue.
See also:
DspClk1305G.h
int tcDspClk1305G::interrupt_dispatch ( Arg  ahMyObject)
staticprotected

Static interrupt dispatch routine.

Required because of the hidden this pointer associated with a member function, which cannot be passed directly to the interrupt dispatcher.

Parameters:
[in]ahMyObjectThe "this->" pointer for the instance of tcDspClk1305G associated with this ISR.
Returns:
0
void tcDspClk1305G::alarmInterrupt ( void  )
protected

Interrupt service routine for alarm interrupts.

The ISR reads and disables any pending interrupts. The callback associated with the alarm is activated. The next alarm in the queue (if any) is then scheduled.

"Interrupt-ness" is taken care of by the 'dispatcher' in DSP/BIOS. Installed by the constructor.

void tcDspClk1305G::scheduleAlarm ( void  )
protected

Internal method used to schedule the next alarm in the queue.

If there is no alarm pending, alarms are left disabled.

Note:
All thread and interrupt protection must be done by the caller.
Returns:
None.
See also:
DspClk1305G.h

Member Data Documentation

const int MityDSP::tcDspClk1305G::gnMaxAdjPPB = 10000000
static

maximum frequency adjustment, in parts-per-billion

unsigned int MityDSP::tcDspClk1305G::mnInterruptCount

ISR counter (debug).

const int MityDSP::tcDspClk1305G::gnMaxPD = 1048575
staticprotected

max prescaler divider

const int MityDSP::tcDspClk1305G::gnMinPPB = 954
staticprotected

minimum possible PPB adjustment

const unsigned int MityDSP::tcDspClk1305G::gnCLK_LSB = 200
staticprotected

LSB of nanoseconds field.

volatile unsigned int* MityDSP::tcDspClk1305G::mpBaseAddr
protected
LCK_Handle MityDSP::tcDspClk1305G::mhMutex
protected

mutex to serialize access

unsigned int MityDSP::tcDspClk1305G::mnNominalSwallow
protected

the "nominal swallow count"

int MityDSP::tcDspClk1305G::mnPPB
protected

accumulated parts-per-billion adjustment

volatile tsAlarmQueue* MityDSP::tcDspClk1305G::mpAlarmQueue
protected

queue of pending alarms

unsigned short MityDSP::tcDspClk1305G::mnMyIntMask
protected

core interrupt mask

int MityDSP::tcDspClk1305G::mnMyIntLevel
protected

core interrupt level

int MityDSP::tcDspClk1305G::mnMyIntVector
protected

core interrupt vector


  
Generated on Mon Apr 22 2013 11:33:03 for MityDSP Core by  Doxygen Version 1.8.1.1
Copyright © 2009, Critical Link LLC, All rights reserved.