1 | #ifndef __M200_PROTOCOL_HEADER__ |
---|
2 | #define __M200_PROTOCOL_HEADER__ |
---|
3 | |
---|
4 | /** |
---|
5 | * This is a C language header, defining most of the symbols |
---|
6 | * proposed in the PC Documation M200 µC Serial Communication Protocol, |
---|
7 | * as of version 1.00 |
---|
8 | * |
---|
9 | * $Id: pc-uc-protocol.h 59 2010-01-22 18:44:34Z sven-win $ |
---|
10 | * This file is part of the Punched Paper Project - Punch Card Device Drivers |
---|
11 | * Copyright (C) 2009 Sven Koeppel |
---|
12 | * |
---|
13 | * This program is free software; you can redistribute it and/or |
---|
14 | * modify it under the terms of the GNU General Public License as |
---|
15 | * published by the Free Software Foundation; either version 3 of |
---|
16 | * the License, or (at your option) any later version. |
---|
17 | * |
---|
18 | * This program is distributed in the hope that it will be useful, |
---|
19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
21 | * GNU General Public License for more details. |
---|
22 | * |
---|
23 | * You should have received a copy of the GNU General Public License |
---|
24 | * along with this program; if not, see |
---|
25 | * <http://www.gnu.org/licenses/>. |
---|
26 | * |
---|
27 | **/ |
---|
28 | |
---|
29 | /* Grundlegende Funktionen */ |
---|
30 | #define M200_digit2char( digit ) ((char)( digit + '0' - 1 )) |
---|
31 | |
---|
32 | /* Kompatibilitaet */ |
---|
33 | |
---|
34 | /* Most important entries*/ |
---|
35 | #define M200_PROTOCOL_VERSION_MAJOR 0 |
---|
36 | #define M200_PROTOCOL_VERSION_MINOR 5 |
---|
37 | |
---|
38 | /* Comparisation and output routines */ |
---|
39 | #define M200_PROTOCOL_IS_COMPATIBLE(major, minor) ((major) == M200_PROTOCOL_VERSION_MAJOR && (minor) >= M200_PROTOCOL_VERSION_MINOR) |
---|
40 | |
---|
41 | /* Just for output*/ |
---|
42 | #define M200_PROTOCOL_VERSION_REVISION "$Revision: 59 $" |
---|
43 | |
---|
44 | /* Client request codes */ |
---|
45 | |
---|
46 | #define M200_CLIENT_HELP 'h' |
---|
47 | #define M200_CLIENT_PING '0' |
---|
48 | #define M200_CLIENT_START '1' |
---|
49 | #define M200_CLIENT_STOP '2' |
---|
50 | #define M200_CLIENT_HEX '3' |
---|
51 | #define M200_CLIENT_DEBUG '4' |
---|
52 | #define M200_CLIENT_BINARY '5' |
---|
53 | #define M200_CLIENT_RESET '6' |
---|
54 | #define M200_CLIENT_VERBOSE '7' |
---|
55 | |
---|
56 | /* Server response codes */ |
---|
57 | #define M200_SERVER_PONG "100" |
---|
58 | #define M200_SERVER_HELP "110" |
---|
59 | #define M200_SERVER_STARTUP "200" |
---|
60 | #define M200_SERVER_ACK_PREFIX "20" |
---|
61 | #define M200_SERVER_ACK_START "201" |
---|
62 | #define M200_SERVER_ACK_STOP "202" |
---|
63 | #define M200_SERVER_ACK_HEX "203" |
---|
64 | #define M200_SERVER_ACK_DEBUG "204" |
---|
65 | #define M200_SERVER_ACK_BINARY "205" |
---|
66 | #define M200_SERVER_ACK_RESET "206" |
---|
67 | #define M200_SERVER_ACK_VERBOSE "207" |
---|
68 | |
---|
69 | /* Signal codes */ |
---|
70 | #define M200_SERVER_SIGNAL_PREFIX "3" |
---|
71 | #define M200_SERVER_SIGNAL_ERROR "0" |
---|
72 | #define M200_SERVER_SIGNAL_READY "1" |
---|
73 | #define M200_SERVER_SIGNAL_BUSY "2" |
---|
74 | #define M200_SERVER_SIGNAL_HCK "3" |
---|
75 | #define M200_SERVER_SIGNAL_MOCK "4" |
---|
76 | #define M200_SERVER_SIGNAL_RISE "1" |
---|
77 | #define M200_SERVER_SIGNAL_FALL "0" |
---|
78 | // can be composed by preprocessor, like in |
---|
79 | // puts(M200_SERVER_SIGNAL_PREFIX M200_SERVER_SIGNAL_READY M200_SERVER_SIGNAL_RISE " Ready rising); |
---|
80 | |
---|
81 | #define M200_SERVER_ILLEGAL_COMMAND "500" |
---|
82 | #define M200_SERVER_ILLEGAL_FOOBAR "501" |
---|
83 | #define M200_SERVER_ILLEGAL_FORMAT "502" |
---|
84 | # |
---|
85 | |
---|
86 | #define M200_SERVER_HEX_PREFIX "6" |
---|
87 | #define M200_SERVER_DEBUG_PREFIX "7" |
---|
88 | #define M200_SERVER_BINARY_PREFIX "8" |
---|
89 | #define M200_SERVER_BINARY "800" |
---|
90 | #define M200_SERVER_BINARY_FINISHED "808" |
---|
91 | |
---|
92 | #define M200_SERVER_FATAL_PREFIX "9" |
---|
93 | #define M200_SERVER_FATAL_CARD "900" |
---|
94 | #define M200_SERVER_FATAL_PRINT_BUFFER "905" |
---|
95 | |
---|
96 | |
---|
97 | |
---|
98 | #endif /* __M200_PROTOCOL_HEADER__ */ |
---|