87 lines
2.8 KiB
C
87 lines
2.8 KiB
C
/*****************************************************************************
|
|
* Copyright (C) 2008
|
|
* ProbeStar Telematics, LLC
|
|
* All Rights Reserved. Proprietary and Confidential.
|
|
*============================================================================
|
|
* Linux Clock Emulation Driver
|
|
*----------------------------------------------------------------------------
|
|
* Details
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* includes
|
|
*****************************************************************************/
|
|
|
|
#include "system.h"
|
|
#include "clock.h"
|
|
#include "delay.h"
|
|
|
|
#include <time.h>
|
|
|
|
#ifdef __linux__
|
|
/*****************************************************************************
|
|
* defines
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* macros
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* structs & typedefs
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* global variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static constants
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static variables
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* static prototypes
|
|
*****************************************************************************/
|
|
|
|
/*****************************************************************************
|
|
* C functions
|
|
*****************************************************************************/
|
|
|
|
void ClkNju6355Init( void )
|
|
{
|
|
}
|
|
|
|
void ClkNju6355Write( CLKBANK NJU6355Clock * pClk )
|
|
{
|
|
}
|
|
|
|
void ClkNju6355Read( CLKBANK NJU6355Clock * pClk )
|
|
{
|
|
// read time
|
|
time_t t;
|
|
struct tm *ptm;
|
|
|
|
time( &t );
|
|
ptm = localtime( &t );
|
|
|
|
// 52 bits
|
|
pClk->byYear = bin2bcd( ptm->tm_year - 100 );
|
|
pClk->byMonth = bin2bcd( ptm->tm_mon + 1 );
|
|
pClk->byDay = bin2bcd( ptm->tm_mday );
|
|
pClk->byWeekDay = ptm->tm_wday + 1;
|
|
pClk->byHour = bin2bcd( ptm->tm_hour );
|
|
pClk->byMinute = bin2bcd( ptm->tm_min );
|
|
pClk->bySecond = bin2bcd( ptm->tm_sec );
|
|
pClk->byHundredth = 0;
|
|
}
|
|
|
|
#endif
|