realy working WDT1 Linux Example for ICOP Vortex86, оказалочь что в примере инструкции небольшая синтаксическая ошибка в определении define outport, да еще kbhit характерна только для старого доброго DOS, хорошо что все рашаемо:
=========== wd2.c ====
#include <stdio.h> #include <curses.h> #include <sys/io.h> #include <sys/select.h>
#define outp(a,b) outb(b,a) #define inp(a) inb(a)
int kbhit(void) { struct timeval tv; fd_set read_fd; /* Do not wait at all, not even a microsecond */ tv.tv_sec=0; tv.tv_usec=0; /* Must be done first to initialize read_fd */ FD_ZERO(&read_fd); /* Makes select() ask if input is ready: * 0 is the file descriptor for stdin */ FD_SET(0,&read_fd); /* The first parameter is the number of the * largest file descriptor to check + 1. */ if(select(1, &read_fd,NULL, /*No writes*/NULL, /*No exceptions*/&tv) == -1) return 0; /* An error occured */ /* read_fd now holds a bit map of files that are * readable. We test the entry for the standard * input (file 0). */ if(FD_ISSET(0,&read_fd)) /* Character pending on stdin */ return 1; /* no characters were pending */ return 0; } int main(void) { iopl(3); unsigned char c; unsigned long lTime; // 500 mini-second //lTime = 0x20L * 500L; lTime = 0x20L * 512000L; outp(0x6c, (lTime >> 16) & 0xff); outp(0x6b, (lTime >> 8) & 0xff); outp(0x6a, (lTime >> 0) & 0xff); // Reset system. For example, 0x50 to trigger IRQ7 outp(0x69, 0xd0); // Enable watchdog timer c = inp(0x68); c |= 0x40; outp(0x68, c); printf("Press any key to stop trigger timer.\n"); while(!kbhit()) outp(0x67, 0x00); printf("System will reboot after 500 milli-seconds.\n"); return 0; }
=========== gcc -Wall wd2.c -o wd2.o
однако программу надо запускать через сервисы, там уже не нужен вывод на экран
попытка №2
- #include <stdio.h>
- #include <curses.h>
- #include <unistd.h>
- #include <time.h>
- #include <sys/io.h>
- #include <sys/select.h>
- #define outp(a,b) outb(b,a)
- #define inp(a) inb(a)
- int main(void)
- {
- iopl(3);
- unsigned char c;
- unsigned long lTime;
- unsigned int i;
- i=1;
- // 500 mini-second
- //lTime = 0x20L * 500L;
- lTime = 0x20L * 512000L;
- outp(0x6c, (lTime >> 16) & 0xff);
- outp(0x6b, (lTime >> 8) & 0xff);
- outp(0x6a, (lTime >> 0) & 0xff);
- // Reset system. For example, 0x50 to trigger IRQ7
- outp(0x69, 0xd0);
- // Enable watchdog timer
- c = inp(0x68);
- c |= 0x40;
- outp(0x68, c);
- while(i!=0){
- outp(0x67, 0x00);
- //usleep(10000000);//10 sec
- //usleep(300000000);//300 sec
- sleep(300);
- }
- return 0;
- }
Casino at Foxwoods Casino- Casino in Welch, MN
ОтветитьУдалитьA map showing Foxwoods Casino-Casino, located in 공주 출장샵 Welch, 과천 출장샵 MN, with 19091 안성 출장안마 slot machines and 13 table 양산 출장안마 games, located 과천 출장샵 in Welch,