AEWIN Technologies Co., Ltd PM-6101 User Manual
32
3.1 GPIO Sample Program for DOS environment
#include <stdio.h>
#include <string.h>
#include <dos.h>
#include <stdlib.h>
#include <inlines/pc.h>
#define index_port 0x2E
//Super IO Index port address
#define data_port 0x2F
//Super IO Data port address
#define GPIO_port 0x378
#define GPIO_read_port GPI 3
void Enter_sio_config();
void Exit_sio_config();
void ENABLE_GPIO();
void Input_mode();
void Output_mode();
void help();
int main(int argc, char *argv[])
{
int data_rw8;
if (argc<2){
help();
return;
}
ENABLE_GPIO();
if(strcmp(argv[1], "-i") == 0){
Input_mode();
data_rw8 = inportb(GPIO_read_port);
if ((data_rw8&0x01) == 0x00)
printf("GPI0 -> Low\n");