Lanner LEC-2110 Uživatelský manuál Strana 27

  • Stažení
  • Přidat do mých příruček
  • Tisk
  • Strana
    / 41
  • Tabulka s obsahem
  • KNIHY
  • Hodnocené. / 5. Na základě hodnocení zákazníků
Zobrazit stránku 26
27
Programming Watchdog Timer
Embedded and Industrial Computing
Appendix A
Watch Dog sample code:
#include “../include/config.h
#include “../include/version.h
/* standard include file */
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#ifdef DJGPP
/* For DOS DJGPP */
#include <dos.h>
#include <inlines/pc.h>
#ifndef DIRECT_IO_ACCESS
#error ***Error: define DIRECT_IO_ACCESS in config.h for
DOS ***
#endif
#else
/* For Linux */
#if defined(LINUX_ENV)
#include <sys/io.h>
#endif
#if defined(FreeBSD_ENV)
#define SET_IOPL() (iofl=open(“/dev/io,000))
#define RESET_IOPL() close(iofl)
#include <machine/cpufunc.h>
#endif
#include <time.h>
#include <stdint.h>
#include <fcntl.h>
#include <errno.h>
#include <string.h>
#include “../include/wd_ioctl.h
#define delay(x) usleep(x)
#ifdef DIRECT_IO_ACCESS
#warning ***** Note: You build with DIRECT_IO_ACCESS
defined *****
#warning ***** Note: undefine this to build for driver code
*****
#endif
#endif
/* local include file */
#include “../include/ioaccess.h
#ifndef BYPASS_PAIR_NUMBER
#error You should defined PAIR_NUMBER in include/
config.h
#endif
#if BYPASS_PAIR_NUMBER == 1
char pair_str[16]=”[1]”;
#endif
#if BYPASS_PAIR_NUMBER == 2
char pair_str[16]=”[1|2]”;
#endif
#if BYPASS_PAIR_NUMBER == 3
char pair_str[16]=”[1|2|3]”;
#endif
#if BYPASS_PAIR_NUMBER == 4
char pair_str[16]=”[1|2|3|4]”;
Zobrazit stránku 26
1 2 ... 22 23 24 25 26 27 28 29 30 31 32 ... 40 41

Komentáře k této Příručce

Žádné komentáře