Appendix b, Digital input/output control – Lanner LEC-2110 User Manual

Page 38

Advertising
background image

38

Digital Input/Output Control

Appendix B

Embedded and Industrial Computing

#include <string.h>
#define delay(x) usleep(x)
#endif

#ifdef MODULE

#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/fs.h>
#include <asm/io.h>
#include <linux/delay.h>

#undef delay
#define delay(x) mdelay(x)
#undef fprintf
#define fprintf(S, A) printk(A)

#endif //MODULE

#ifdef KLD_MODULE

#include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/malloc.h>
#include <sys/kernel.h>
#include <sys/bus.h>
#include <sys/errno.h>

#include <machine/bus.h>
#include <machine/resource.h>

#endif

#endif

/* local include file */
#include “../include/ioaccess.h”

#if (defined(MODULE) || defined(DIRECT_IO_ACCESS) ||

defined(KLD_MODULE))

/*
*---------------------------------------------------------------------------

---
* LEB-2110 Version V1.0
*output3-0 = GPIO3-0, input3/2/1/0= GPIO 52/51/50/4
*---------------------------------------------------------------------------

--------
*/

/*
* Device Depend Definition :
*/

#define INDEX_PORT

0x2E

#define DATA_PORT

0x2F

void enter_SIO_config(void)
{
outportb(INDEX_PORT, 0x87); // Must Do It Twice
outportb(INDEX_PORT, 0x87);
return;
}

void exit_SIO_config(void)
{
outportb(INDEX_PORT, 0xAA);
return;
}

unsigned char read_SIO_reg(int LDN, int reg)

Advertising