Appendix A
58
KEMX-1750 series Use r’s Manual
Appendix A
DIO (Digital I/O) Sample Code
//***************************************************************//
//DIO sample code for KEMX-1750 //
//Please compile with Turbo C 3.0 to utilized the program //
//
//
//DIO GPIO pin define from BayTrail chipset
//
// DI_0 : SOC S5_GPIO32
DO_0 : SOC S5_GPIO36
//
// DI_1 : SOC S5_GPIO33
DO_1 : SOC S5_GPIO37 //
// DI_2 : SOC S5_GPIO34
DO_2 : SOC S5_GPIO38
//
// DI_3 : SOC S5_GPIO35
DO_3 : SOC S5_GPIO39
//
//
//
//***************************************************************//
#include <stdio.h>
#include <conio.h>
#include <dos.h>
typedef unsigned long DWORD;
#define GPIO_BASE 0x500
#define GPIO2_SEL 0xA4
#define GPIO2_LVL 0xA8
#define SET_IO32(IoAddr, dSet) outpd(IoAddr, inpd(IoAddr) | (dSet))
#define RESET_IO32(IoAddr, Rst) outpd(IoAddr, inpd(IoAddr) &~ (Rst))
#define READ_IO32(IoAddr) inpd(IoAddr)
DWORD inpd(int portid)
{
DWORD
dwRet;
asm mov dx, portid;
asm lea bx, dwRet;