Line No. | Rev | Author | Line |
---|---|---|---|
1 | 6 | kaklik | /*! \file edp.h \brief Emerald Data Protocol System. */ |
2 | //***************************************************************************** |
||
3 | // |
||
4 | // File Name : 'edp.h' |
||
5 | // Title : Emerald Data Protocol System |
||
6 | // Author : Pascal Stang - Copyright (C) 2003 |
||
7 | // Created : 2003.07.01 |
||
8 | // Revised : 2003.07.21 |
||
9 | // Version : 0.1 |
||
10 | // Target MCU : Atmel AVR series |
||
11 | // Editor Tabs : 4 |
||
12 | // |
||
13 | // This code is distributed under the GNU Public License |
||
14 | // which can be found at http://www.gnu.org/licenses/gpl.txt |
||
15 | // |
||
16 | //***************************************************************************** |
||
17 | |||
18 | #ifndef EDP_H |
||
19 | #define EDP_H |
||
20 | |||
21 | #include "edpdefs.h" |
||
22 | |||
23 | // defines |
||
24 | //#define EDP_DEBUG |
||
25 | // edp reply buffer size |
||
26 | #ifndef EDP_REPLY_BUFFER_SIZE |
||
27 | #define EDP_REPLY_BUFFER_SIZE 128 |
||
28 | #endif |
||
29 | // edpSendCommand return values |
||
30 | #define EDP_COMMAND_OK 0 |
||
31 | #define EDP_COMMAND_NODEV 1 |
||
32 | // edpGetCommandReply return values |
||
33 | #define EDP_REPLY_OK 0 |
||
34 | #define EDP_REPLY_BADCHKSUM 1 |
||
35 | |||
36 | // structs and typedefs |
||
37 | typedef struct |
||
38 | { |
||
39 | u08 SrcAddr; |
||
40 | u08 Command; |
||
41 | u08 Data[]; |
||
42 | } EdpCommand; |
||
43 | |||
44 | typedef struct |
||
45 | { |
||
46 | u08 Length; |
||
47 | u08 Data[]; |
||
48 | } EdpReply; |
||
49 | |||
50 | // typedefs |
||
51 | typedef u08 (*EdpSlaveHandlerFuncType)(u08 edpCmdLength, EdpCommand* edpCmd, |
||
52 | u08 edpReplyLengthMax, EdpReply* edpReply); |
||
53 | |||
54 | // functions |
||
55 | void edpInit(void); |
||
56 | void edpSetSlaveHandler(EdpSlaveHandlerFuncType edpSlaveHandlerFunction); |
||
57 | |||
58 | // ************ EDP Master operations ************ |
||
59 | u08 edpSendCommand(u08 deviceAddr, u08 cmdLength, EdpCommand* edpCommand); |
||
60 | u08 edpGetCommandReply(u08* responseCode, EdpReply** edpReply); |
||
61 | //u08 edpSendCommand(u08 deviceAddr, u08 sendLength, u08* sendData); |
||
62 | //u08 edpGetCommandReply(u08* responseCode, u08* replyLength, u08** replyData); |
||
63 | |||
64 | // ************ EDP Slave operations ************ |
||
65 | void edpSlaveReceiveService(u08 receiveDataLength, u08* receiveData); |
||
66 | u08 edpSlaveTransmitService(u08 transmitDataLengthMax, u08* transmitData); |
||
67 | |||
68 | #endif |
Powered by WebSVN v2.8.3