Ktam3874/pitx software guide – Kontron KTAM3874-pITX User Manual
Page 264

KTD-S0057-I
Page 260 Linux® Programming Examples (DebianTM)
KTAM3874/pITX Software Guide
#define CMD_SIZE
4
#define CMD_WDIO
"wdio"
#define CMD_GPIO
"gpio"
#define CMD_EXIT
"exit"
#define ACK_SIZE
3
#define ACK_STR
"ok\n"
#define ACK_APP
" :"
#define NAK_SIZE
4
#define NAK_STR
"nok\n"
#define DATA_STR
"ok - input value = %d\n"
#define CMD_STR
" cmd>"
#define TIMEOUT_STR
" :timeout !\n"
#define WD_ON
"on"
#define WD_OFF
"off"
#define WD_TRIG
"trig"
#define IO_OPEN
"open"
#define IO_CLOSE
"close"
#define IO_DATA
"data"
#define IO_IN
"in"
#define IO_OUT
"out"
#define IO_LOW
"0"
#define IO_HIGH
"1"
#define IO_DIR_IN
0
#define IO_DIR_OUT
1
#define ERROR do { fprintf (stderr, "Error: %s\n", strerror (errno)); exit (EXIT_FAILURE); } while(0)
static const char *root_rd
= "/tmp/root_rd";
static const char *root_wr
= "/tmp/root_wr";
static const char *wdt
= "/dev/watchdog";
static const char *io_exp
= "/sys/class/gpio/export";
static const char *io_unexp
= "/sys/class/gpio/unexport";
static const char *io_dir
= "/sys/class/gpio/gpio%d/direction";
static const char *io_val
= "/sys/class/gpio/gpio%d/value";
static const int io_num [] = {
10,
11,
12,
13, 14, 15, 16, 17,
18,
19,
20,
21, 22, 23, 24, 25,
26,
27,
28,
66, 80, 81, 82, 83,
84,
41,
43,
44, 59, 60, 61, 62,
64, 66, 71, 72, 73, 74, 75, 76 };
#endif
following the sourcecode of the server application 'server.c':
/* Server application
* Copyright (c) 2014 Kontron Technology A/S
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License. */