예제 #1
0
파일: biostime.cpp 프로젝트: Ga-vin/sgos
int GetBiosDate(int &c, int &y, int &m, int &d)
{
	vmRegs.eax = 0x0400;
	if( Vm86Call( &vmRegs ) < 0 )
		return -1;
	c = BCD_TO_HEX(vmRegs.ecx>>8);
	y = BCD_TO_HEX(vmRegs.ecx&0xff);
	m = BCD_TO_HEX(vmRegs.edx>>8);
	d = BCD_TO_HEX(vmRegs.edx&0xff);
	return 0;
}
예제 #2
0
파일: biostime.cpp 프로젝트: Ga-vin/sgos
int GetBiosTime(int &h, int &m, int &s)
{
	vmRegs.eax = 0x0200;
	if( Vm86Call( &vmRegs ) < 0 )
		return -1;
	h = BCD_TO_HEX(vmRegs.ecx>>8);
	m = BCD_TO_HEX(vmRegs.ecx&0xff);
	s = BCD_TO_HEX(vmRegs.edx>>8);
	return 0;
}
예제 #3
0
void TIME_BspSystemTimeInit(void)
{
    uint8 err = 0;
    uint8 tempRead[17] = {0x00};
    uint8 temptime[6]  = {0x00};
    CPU_SR cpu_sr;

    Rd8025(tempRead);

    if((tempRead[15] & 0x20) == 0)   //如果检测到RX8025出现过震动停止。
    {
        OSSemPend(I2cReqSem, 0, &err);
        RX8025_ClearXST();
        OSSemPost(I2cReqSem);
    }

    temptime[ARRAY_YEAR]   = BCD_TO_HEX(tempRead[ARRAY_YEAR + 1]);
    temptime[ARRAY_MONTH]  = BCD_TO_HEX(tempRead[ARRAY_MONTH + 1]);
    temptime[ARRAY_DAY]    = BCD_TO_HEX(tempRead[ARRAY_DAY + 1]);
    temptime[ARRAY_HOUR]   = BCD_TO_HEX(tempRead[ARRAY_HOUR]);
    temptime[ARRAY_MINUTE] = BCD_TO_HEX(tempRead[ARRAY_MINUTE]);
    temptime[ARRAY_SECOND] = BCD_TO_HEX(tempRead[ARRAY_SECOND]);

    OS_ENTER_CRITICAL();
    memcpy(gSystemTime, temptime, 6);
    OS_EXIT_CRITICAL();
}
예제 #4
0
void TIME_UpdateSystemTime(void)
{
    uint8 temptime[13] = {0};
    CPU_SR cpu_sr;

    /*yangfei added temp*/
    UserReadDateTime(temptime);
    temptime[4] = (temptime[4] & 0x1F);

    temptime[ARRAY_YEAR]   = BCD_TO_HEX(temptime[ARRAY_YEAR]);
    temptime[ARRAY_MONTH]  = BCD_TO_HEX(temptime[ARRAY_MONTH]);
    temptime[ARRAY_DAY]    = BCD_TO_HEX(temptime[ARRAY_DAY]);
    temptime[ARRAY_HOUR]   = BCD_TO_HEX(temptime[ARRAY_HOUR]);
    temptime[ARRAY_MINUTE] = BCD_TO_HEX(temptime[ARRAY_MINUTE]);
    temptime[ARRAY_SECOND] = BCD_TO_HEX(temptime[ARRAY_SECOND]);

    OS_ENTER_CRITICAL();
    memcpy(gSystemTime, temptime, 6);
    OS_EXIT_CRITICAL();
}