Esempio n. 1
0
/*******************************************************************************
* mvRtcDS1339Init - Initialize the clock.
*
* DESCRIPTION:
*       This function initialize the clock registers and read\write functions
*
* INPUT:
*       None.
*
* OUTPUT:
*       None.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_VOID mvRtcDS1339Init(MV_VOID)
{
	MV_U8 ucTemp;
#if defined(CONFIG_USE_RS5C372)
	/* We will disable interrupts as default .*/

	/* Adjust OSC */
	ucTemp =  0x15;
	mvRtcCharWrite(RTC_ADJUST_XTAL,ucTemp);
	
	/* 24hour Set*/
	mvRtcCharRead(RTC_STATUS,&ucTemp);
	ucTemp |= RTC_CLOCK_HOUR_12_24_BIT;
	mvRtcCharWrite(RTC_STATUS,ucTemp);
#else
	/* We will disable interrupts as default .*/
	mvRtcCharRead(RTC_CONTROL,&ucTemp);
	ucTemp|=RTC_CONTROL_INTCN_BIT;
	mvRtcCharWrite(RTC_CONTROL,ucTemp);
    
	/* disable trickle */
	mvRtcCharWrite(RTC_TRICKLE_CHARGE,0);
#endif

	return;
}
Esempio n. 2
0
/*******************************************************************************
* mvRtcDS1338Init - Initialize the clock.
*
* DESCRIPTION:
*       This function initialize the clock registers and read\write functions
*
* INPUT:
*       None.
*
* OUTPUT:
*       None.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_VOID mvRtcDS1338Init(MV_VOID)
{
	MV_U8 ucTemp;

	/* We will enable OSC .*/
	mvRtcCharRead(RTC_CLOCK_SECONDS,&ucTemp);
	ucTemp &=~RTC_CONTROL_EOSC_MSK;
	mvRtcCharWrite(RTC_CLOCK_SECONDS,ucTemp);

	return;
}
Esempio n. 3
0
/*******************************************************************************
* mvRtcDS1339Init - Initialize the clock.
*
* DESCRIPTION:
*       This function initialize the clock registers and read\write functions
*
* INPUT:
*       None.
*
* OUTPUT:
*       None.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_VOID mvRtcDS1339Init(MV_VOID)
{
	MV_U8 ucTemp;

	/* We will disable interrupts as default .*/
	mvRtcCharRead(RTC1339_CONTROL,&ucTemp);
	ucTemp|=RTC_CONTROL_INTCN_BIT;
	mvRtcCharWrite(RTC1339_CONTROL,ucTemp);
    
	/* disable trickle */
	mvRtcCharWrite(RTC_TRICKLE_CHARGE,0);

	return;
}
Esempio n. 4
0
/*******************************************************************************
* mvRtcDS133xTimeGet - Read the time from the RTC.
*
* DESCRIPTION:
*       This function reads the current time and date from the RTC into the 
*       structure RTC_TIME (defined in mvDS133x.h).
*
* INPUT:
*       time - A pointer to a structure TIME (defined in mvDS133x.h).
*
* OUTPUT:
*       The structure RTC_TIME is updated with the time read from the RTC.
*
* RETURN:
*       None.
*
*******************************************************************************/
MV_VOID mvRtcDS133xTimeGet(MV_RTC_TIME* time)
{
	MV_U8 tempValue;
	MV_U32 tens;
	MV_U32 single;

	/* seconds */
	mvRtcCharRead(RTC_CLOCK_SECONDS,&tempValue);
	tens = ( tempValue & RTC_CLOCK_10SECONDS_MSK) >> RTC_CLOCK_10SECONDS_SHF;   
	single = (tempValue & RTC_CLOCK_SECONDS_MSK) >> RTC_CLOCK_SECONDS_SHF ;
	time->seconds = 10*tens + single;

	/* minutes */
	mvRtcCharRead(RTC_CLOCK_MINUTES,&tempValue);
	tens = (tempValue & RTC_CLOCK_10MINUTES_MSK) >> RTC_CLOCK_10MINUTES_SHF;   
	single = (tempValue & RTC_CLOCK_MINUTES_MSK) >> RTC_CLOCK_MINUTES_SHF;
	time->minutes = 10*tens + single;

	/* hours */
	mvRtcCharRead(RTC_CLOCK_HOUR,&tempValue);
	tens = (tempValue & RTC_CLOCK_10HOURS_MSK2) >> RTC_CLOCK_10HOURS_SHF;   
	single = (tempValue & RTC_CLOCK_HOURS_MSK) >> RTC_CLOCK_HOURS_SHF;
	time->hours = 10*tens + single;

	/* day */
	mvRtcCharRead(RTC_CLOCK_DAY,&tempValue);
	time->day = (tempValue & RTC_CLOCK_DAY_MSK) >> RTC_CLOCK_DAY_SHF ;
	time->day--; 

	/* date */
	mvRtcCharRead(RTC_CLOCK_DATE,&tempValue);
	tens = (tempValue & RTC_CLOCK_10DATE_MSK) >> RTC_CLOCK_10DATE_SHF;   
	single = (tempValue & RTC_CLOCK_DATE_MSK) >> RTC_CLOCK_DATE_SHF;
	time->date = 10*tens + single;

	/* century/ month */
	mvRtcCharRead(RTC_CLOCK_MONTH_CENTURY,&tempValue);
	tens = (tempValue & RTC_CLOCK_10MONTH_MSK) >> RTC_CLOCK_10MONTH_SHF;   
	single = (tempValue & RTC_CLOCK_MONTH_MSK) >> RTC_CLOCK_MONTH_SHF;
	time->month = 10*tens + single;
	time->century = (tempValue & RTC_CLOCK_CENTURY_MSK)>>RTC_CLOCK_CENTURY_SHF;

	/* year */
	mvRtcCharRead(RTC_CLOCK_YEAR,&tempValue);
	tens = (tempValue & RTC_CLOCK_10YEAR_MSK) >> RTC_CLOCK_10YEAR_SHF;   
	single = (tempValue & RTC_CLOCK_YEAR_MSK) >> RTC_CLOCK_YEAR_SHF;
	time->year = 10*tens + single;

	return;	
}
Esempio n. 5
0
MV_VOID BufRtcDS1339AlarmBGet(int8_t *data)
{
	mvRtcCharRead(RTC_ALARM2_MINUTES, (MV_U8 *)data);
	return;
}