Appendix b, Digital input/output control – Lanner LEC-7105 User Manual
Page 33

33
Digital Input/Output Control
Appendix B
Embedded and Industrial Computing
#include
#include
#include
#include
#include
#include
#endif
#endif
/* local include file */
#include “../include/ioaccess.h”
#if (defined(MODULE) || defined(DIRECT_IO_ACCESS) ||
defined(KLD_MODULE))
/*
*---------------------------------------------------------------------------
---
* LEB-7105 Version V1.0
*
* The IO interface for Digital DIO is connected to Winbond
SIO 83627.
* Platform provide 4 digital input and 4 digital output.
* GPIO24-27 as input function, GPIO60-63 as output
function
* Refer to Winbond 83627 datasheet for details.
* The truth table is defined as below:
* DIO GPIO pins as follows:
*
IN
OUT
* DIO
GP24
GP60
* DIO
GP25
GP61
* DIO
GP26
GP62
* DIO
GP27
GP63
*---------------------------------------------------------------------------
--------
*/
/*
* Device Depend Definition : Winbond 83627 SIO
*/
#define INDEX_PORT 0x2E
#define DATA_PORT 0x2F
#define GPIO2X
2
#define GPIO24_BIT
(1 << 4)
#define GPIO25_BIT
(1 << 5)
#define GPIO26_BIT
(1 << 6)
#define GPIO27_BIT
(1 << 7)
#define GPIO_GPIO24_GPIO27_MASK (GPIO24_BIT |
GPIO25_BIT | GPIO26_BIT | GPIO27_BIT)
#define GPIO6X
4
#define GPIO60_BIT
(1 << 0)
#define GPIO61_BIT
(1 << 1)
#define GPIO62_BIT
(1 << 2)
#define GPIO63_BIT
(1 << 3)
#define GPIO_GPIO60_GPIO63_MASK (GPIO60_BIT |
GPIO61_BIT | GPIO62_BIT | GPIO63_BIT)
void enter_w83627_config(void)
{
outportb(INDEX_PORT, 0x87); // Must Do It Twice
outportb(INDEX_PORT, 0x87);
return;
}
void exit_w83627_config(void)
{
outportb(INDEX_PORT, 0xAA);
return;
}
unsigned char read_w83627_reg(int LDN, int reg)
{
unsigned char tmp = 0;