// NOTE : Because our alarm only has a 1-day rollover, the full alarm // time needs to be stored and compared on alarm interrupts to see if // it is at the correct day. RTC_AlarmTime = *lpst; Year = lpst->wYear % 100; // Read the update in progress bit, wait for it to be clear. This bit // will be set once per second for about 2us (Undoc. PC, page 897) do { cStatusRegA = CMOS_Read( RTC_STATUS_A); } while ( cStatusRegA & RTC_SRA_UIP ); // Disable updates while the values are changed cStatusRegB = CMOS_Read( RTC_STATUS_B ); cStatusRegB |= RTC_SRB_UPDT; CMOS_Write( RTC_STATUS_B, cStatusRegB ); if ( !(cStatusRegB & RTC_SRB_DM) ) { // BCD Mode CMOS_Write( RTC_ALRM_HOUR, (BYTE)(CREATE_BCD(lpst->wHour))); CMOS_Write( RTC_ALRM_MINUTE, (BYTE)(CREATE_BCD(lpst->wMinute))); CMOS_Write( RTC_ALRM_SECOND, (BYTE)(CREATE_BCD(lpst->wSecond))); } else { // Binary mode CMOS_Write( RTC_ALRM_HOUR, (UCHAR)lpst->wHour); CMOS_Write( RTC_ALRM_MINUTE, (UCHAR)lpst->wMinute); CMOS_Write( RTC_ALRM_SECOND, (UCHAR)lpst->wSecond); } // Enable alarm interrupt and reenable updates cStatusRegB = (cStatusRegB | RTC_SRB_AI) & ~RTC_SRB_UPDT; CMOS_Write( RTC_STATUS_B, cStatusRegB ); return( TRUE ); }看看人家外国人都可以写出来啦..可惜是在WINCE下面的,有谁知道这些RTC_SRV_UPDT,RTC_SRB_AI的值吗???高手在哪里???
我的电脑主板和BIOS支持定时开机。也就是说硬件支持本身没什么问题,也已经在一些产品上实现了。如果按照这个思路,要做到楼主说的“软件定时开机”的问题,就变成用软件来更改CMOS里面的设置的问题了。我提到病毒,并不是说病毒寄存在CMOS中(除非硬件产商留了足够的空间给病毒),而是说病毒更改CMOS导致故障。因此,关键在于你的软件能否访问并更改CMOS(中的定时开机部分的设置参数)。另外,带NetBios的网卡和部分主板支持 Lan wakeup 和 Lan Boot,也就是说通过局域网“唤醒”计算机。呵呵,“用服务器来启动办公室的一群计算机?”
哪里有呢???
晕倒,不怕病毒啊?有的CMOS(比如Toshiba笔记本)是用软件来设置的,只是开放一些固定的功能,倒是不怕病毒,但要支持你说的,可能要和厂商好好商量一下了。
我要的不过如此,不想客户去CMOS设置中设置.....用软件设置比较直观..
CMOS中的定时启动小时分钟和秒钟都能设置了,但是就差RTC激活这一步.
有谁做过吗??
查一查你的主板说明书,上面应该有相关的资料.
我想实现的功能是:每天7:00点开机,11:00关机,13:00开机,17:00关机.
这就要求能在软件里面更改CMOS中设置的自动开机时间啊.
是不是有点意思呢???带定时器的电源开关能不能实现这种功能啊??
不知道地址在哪里,直接修改不知道行不行??还有不同的主板这个地址会不会不同??
时间已经知道怎么修改了..
小弟不怎么懂汇编,谁能解释一下,现在要用直接写端口(WINIO)
将 8:00:00写入定时开机,该怎么修改?code segment
.486p
assume cs:code
start:
;set stack for return
push dx
sub ax,ax
push ax
//激活自动开机功能.这一段不知何解??看来汇编要学好啊....兄弟们
;test RTC status
repeat: mov al,0ah
out 70h,al
in al,71h
and al,80h
jnz repeat
;RTC-REG
mov al,0bh
out 70h,al
in al,71h
or al,26h
out 71h,al
;set RTC event enable
mov eax,8000f840h
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx
add eax,02h
mov edx,eax
dec dx
in ax,dx
or ax,0500h out dx,ax
//写入秒分时,已经在VC中实现:(用WINIO)
/*
#define IOADDRESS 0x070
#define IODATA 0x071
SetPortVal(IOADDRESS,0x01,1);
SetPortVal(IODATA,0x00,1);
SetPortVal(IOADDRESS,0x03,1);
SetPortVal(IODATA,0x00,1);
SetPortVal(IOADDRESS,0x05,1);
SetPortVal(IODATA,0x08,1);
*/
;write seconds
mov al,00h
out 70h,al
in al,71h
add al,6
daa
mov bl,al
mov al,01h
out 70h,al
mov al,bl
out 71h,al
;write minutes
mov al,02h
out 70h,al
in al,71h
mov bl,al
mov al,03h
out 70h,al
mov al,bl
out 71h,al
;write hours
mov al,04h
out 70h,al
in al,71h
mov bl,al
mov al,05h
out 70h,al
mov al,bl
out 71h,al;shutdown
mov eax,8000f840h
mov dx,0cf8h
out dx,eax
mov dx,0cfch
in eax,dx
add eax,04h
mov edx,eax
dec dx
mov eax,00003c00h
out dx,eax;return
mov ah,4ch
int 21h code ends
end start
{ BYTE cStatusRegA, cStatusRegB, Year;#ifdef NOTDEF
NKDbgPrintfW(TEXT("\r\nSet Alarm Time %d, %d, %d, %d, %d, %d, %d,
%d\r\n"),
lpst->wYear,
lpst->wMonth,
lpst->wDayOfWeek,
lpst->wDay,
lpst->wHour,
lpst->wMinute,
lpst->wSecond,
lpst->wMilliseconds );
#endif
// NOTE : Because our alarm only has a 1-day rollover, the full alarm
// time needs to be stored and compared on alarm interrupts to see if
// it is at the correct day.
RTC_AlarmTime = *lpst; Year = lpst->wYear % 100; // Read the update in progress bit, wait for it to be clear. This bit
// will be set once per second for about 2us (Undoc. PC, page 897)
do {
cStatusRegA = CMOS_Read( RTC_STATUS_A);
} while ( cStatusRegA & RTC_SRA_UIP ); // Disable updates while the values are changed
cStatusRegB = CMOS_Read( RTC_STATUS_B );
cStatusRegB |= RTC_SRB_UPDT;
CMOS_Write( RTC_STATUS_B, cStatusRegB ); if ( !(cStatusRegB & RTC_SRB_DM) ) {
// BCD Mode
CMOS_Write( RTC_ALRM_HOUR, (BYTE)(CREATE_BCD(lpst->wHour)));
CMOS_Write( RTC_ALRM_MINUTE, (BYTE)(CREATE_BCD(lpst->wMinute)));
CMOS_Write( RTC_ALRM_SECOND, (BYTE)(CREATE_BCD(lpst->wSecond)));
} else {
// Binary mode
CMOS_Write( RTC_ALRM_HOUR, (UCHAR)lpst->wHour);
CMOS_Write( RTC_ALRM_MINUTE, (UCHAR)lpst->wMinute);
CMOS_Write( RTC_ALRM_SECOND, (UCHAR)lpst->wSecond);
} // Enable alarm interrupt and reenable updates
cStatusRegB = (cStatusRegB | RTC_SRB_AI) & ~RTC_SRB_UPDT;
CMOS_Write( RTC_STATUS_B, cStatusRegB ); return( TRUE );
}看看人家外国人都可以写出来啦..可惜是在WINCE下面的,有谁知道这些RTC_SRV_UPDT,RTC_SRB_AI的值吗???高手在哪里???
不知道 AIM Phonix 这几家BIOS研发商网站上有没有?另外,不知道在 CMOS 写保护的情况下,是否可以通过软件更改定时开机参数?(否则要担心招来恶意代码的破坏了)
http://expert.csdn.net/Expert/topic/2102/2102444.xml?temp=.8663904
你可以自己设置好,再读出来看看哪些不一样了。
看你给出的程序,也就是对端口70、71的操作。
循环给70送00-ff,看看71的数据都是什么,然后手工在coms设置后,在来一边,看看数据有什么不同。
你真的能解决吗??不同的主板不同的BIOS,设置都可能会不同哦...
好啊..那要多少啊???
有问题发 EMAIL 给我 [email protected]
i/o port 070h和071h 是cmos的端口吗 还有cf8h和cfch端口 有趣 回去查查
所以,习惯用 Tel 和 Email 联系了。
用汇编写cmos端口的对应字段就可以了吧?