1 |
27 |
unneback |
#ifndef CYGONCE_HAL_SYNTH_PROTOCOL_H
|
2 |
|
|
#define CYGONCE_HAL_SYNTH_PROTOCOL_H
|
3 |
|
|
|
4 |
|
|
//=============================================================================
|
5 |
|
|
//
|
6 |
|
|
// synth_protocol.h
|
7 |
|
|
//
|
8 |
|
|
// Generic protocol between eCos and the I/O auxiliary.
|
9 |
|
|
//
|
10 |
|
|
//=============================================================================
|
11 |
|
|
//####ECOSGPLCOPYRIGHTBEGIN####
|
12 |
|
|
// -------------------------------------------
|
13 |
|
|
// This file is part of eCos, the Embedded Configurable Operating System.
|
14 |
|
|
// Copyright (C) 2002 Bart Veer
|
15 |
|
|
//
|
16 |
|
|
// eCos is free software; you can redistribute it and/or modify it under
|
17 |
|
|
// the terms of the GNU General Public License as published by the Free
|
18 |
|
|
// Software Foundation; either version 2 or (at your option) any later version.
|
19 |
|
|
//
|
20 |
|
|
// eCos is distributed in the hope that it will be useful, but WITHOUT ANY
|
21 |
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
22 |
|
|
// FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
|
23 |
|
|
// for more details.
|
24 |
|
|
//
|
25 |
|
|
// You should have received a copy of the GNU General Public License along
|
26 |
|
|
// with eCos; if not, write to the Free Software Foundation, Inc.,
|
27 |
|
|
// 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
|
28 |
|
|
//
|
29 |
|
|
// As a special exception, if other files instantiate templates or use macros
|
30 |
|
|
// or inline functions from this file, or you compile this file and link it
|
31 |
|
|
// with other works to produce a work based on this file, this file does not
|
32 |
|
|
// by itself cause the resulting work to be covered by the GNU General Public
|
33 |
|
|
// License. However the source code for this file must still be made available
|
34 |
|
|
// in accordance with section (3) of the GNU General Public License.
|
35 |
|
|
//
|
36 |
|
|
// This exception does not invalidate any other reasons why a work based on
|
37 |
|
|
// this file might be covered by the GNU General Public License.
|
38 |
|
|
//
|
39 |
|
|
// Alternative licenses for eCos may be arranged by contacting Red Hat, Inc.
|
40 |
|
|
// at http://sources.redhat.com/ecos/ecos-license/
|
41 |
|
|
// -------------------------------------------
|
42 |
|
|
//####ECOSGPLCOPYRIGHTEND####
|
43 |
|
|
//=============================================================================
|
44 |
|
|
//#####DESCRIPTIONBEGIN####
|
45 |
|
|
//
|
46 |
|
|
// Author(s): bartv
|
47 |
|
|
// Contributors:bartv
|
48 |
|
|
// Date: 2002-08-05
|
49 |
|
|
// Purpose: Protocol definitions.
|
50 |
|
|
// Description: This header file defines the protocol used between the
|
51 |
|
|
// synthetic target HAL and the I/O auxiliary. The relevant
|
52 |
|
|
// code in the latter is implemented in Tcl (making
|
53 |
|
|
// use of the "binary" command) so this header file is
|
54 |
|
|
// not actually used on the host-side. Instead the protocol
|
55 |
|
|
// is defined in terms of byte arrays.
|
56 |
|
|
//
|
57 |
|
|
// The header file is not exported to any higher-level packages
|
58 |
|
|
// that wish to communicate with the auxiliary. Instead those
|
59 |
|
|
// packages are expected to use the functions synth_auxiliary_xchgmsg()
|
60 |
|
|
// and synth_auxiliary_instantiate().
|
61 |
|
|
//
|
62 |
|
|
// Usage: #include "synth_protocol.h"
|
63 |
|
|
//
|
64 |
|
|
//####DESCRIPTIONEND####
|
65 |
|
|
//
|
66 |
|
|
//=============================================================================
|
67 |
|
|
|
68 |
|
|
// Messages from the eCos synthetic target application to the I/O
|
69 |
|
|
// auxiliary are exactly 24 bytes long, consisting of six 32-bit
|
70 |
|
|
// little-endian integers. Inside the auxiliary they will be decoded
|
71 |
|
|
// using the Tcl binary scan command and the format i6. The top bit
|
72 |
|
|
// of RXLEN is overloaded to indicate whether or not a reply is expected
|
73 |
|
|
// at all.
|
74 |
|
|
#define SYNTH_REQUEST_LENGTH 24
|
75 |
|
|
#define SYNTH_REQUEST_DEVID_OFFSET 0
|
76 |
|
|
#define SYNTH_REQUEST_REQUEST_OFFSET 4
|
77 |
|
|
#define SYNTH_REQUEST_ARG1_OFFSET 8
|
78 |
|
|
#define SYNTH_REQUEST_ARG2_OFFSET 12
|
79 |
|
|
#define SYNTH_REQUEST_TXLEN_OFFSET 16
|
80 |
|
|
#define SYNTH_REQUEST_RXLEN_OFFSET 20
|
81 |
|
|
|
82 |
|
|
// And the response. This consists of two 32-bit little-endian integers,
|
83 |
|
|
// a result code and an actual rx_len field.
|
84 |
|
|
#define SYNTH_REPLY_LENGTH 8
|
85 |
|
|
#define SYNTH_REPLY_RESULT_OFFSET 0
|
86 |
|
|
#define SYNTH_REPLY_RXLEN_OFFSET 4
|
87 |
|
|
|
88 |
|
|
// Device 0 is special, it is for control messages with the auxiliary
|
89 |
|
|
// itself - for example, to instantiate a device.
|
90 |
|
|
#define SYNTH_DEV_AUXILIARY 0
|
91 |
|
|
|
92 |
|
|
// Requests intended directly for the auxiliary.
|
93 |
|
|
|
94 |
|
|
// Instantiate a device. arg1 and arg2 are ignored. The tx buffer
|
95 |
|
|
// holds a string for the given device. The rx buffer will be for a
|
96 |
|
|
// single integer, the device id or -1.
|
97 |
|
|
#define SYNTH_AUXREQ_INSTANTIATE 0x01
|
98 |
|
|
|
99 |
|
|
// Second-stage initialization, once all eCos device drivers have been
|
100 |
|
|
// activated.
|
101 |
|
|
#define SYNTH_AUXREQ_CONSTRUCTORS_DONE 0x02
|
102 |
|
|
|
103 |
|
|
// Get the current mask of pending interrupts. arg1 and arg2 are
|
104 |
|
|
// ignored, and there is no tx buffer. The reply code holds the irq
|
105 |
|
|
// pending mask. Normally there is no additional reply data, but if
|
106 |
|
|
// rx_len is non-zero then that indicates that the auxiliary has been
|
107 |
|
|
// asked to exit.
|
108 |
|
|
#define SYNTH_AUXREQ_GET_IRQPENDING 0x03
|
109 |
|
|
|
110 |
|
|
// Versioning. The core protocol cannot be changed without breaking
|
111 |
|
|
// lots of code. However it is still a good idea to allow the eCos
|
112 |
|
|
// application to verify that the host-side is the right version, in
|
113 |
|
|
// case new requests are added. arg1 and arg2 are ignored, there is no
|
114 |
|
|
// tx buffer or reply data, and the reply code holds the version.
|
115 |
|
|
#define SYNTH_AUXREQ_GET_VERSION 0x04
|
116 |
|
|
|
117 |
|
|
// The version has to be kept in synch with ecosynth.tcl
|
118 |
|
|
#define SYNTH_AUXILIARY_PROTOCOL_VERSION 0x01
|
119 |
|
|
|
120 |
|
|
// The console device is also provided by the architectural package,
|
121 |
|
|
// but only implements one function (write some output) so there is no
|
122 |
|
|
// need for any function codes.
|
123 |
|
|
|
124 |
|
|
#endif // CYGONCE_HAL_SYNTH_PROTOCOL.H
|