Initial commit of files
This commit is contained in:
86
src/libPIC/clk_linux.c
Normal file
86
src/libPIC/clk_linux.c
Normal file
@ -0,0 +1,86 @@
|
||||
/*****************************************************************************
|
||||
* 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
|
||||
Reference in New Issue
Block a user