File: eu_msg.h

package info (click to toggle)
eagle-usb 2.1.1-2
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 5,108 kB
  • ctags: 2,612
  • sloc: ansic: 27,560; sh: 5,440; perl: 3,269; xml: 1,079; tcl: 915; makefile: 878
file content (138 lines) | stat: -rw-r--r-- 4,847 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
/*
 *
 * Copyright (c) 2003, Frederick Ros (sl33p3r@free.fr)
 *										    
 * eu_msg.h  - Message protocol subsystem functions
 *
 *
 * This file is part of the eagle-usb driver package.
 *
 * eagle-usb driver package 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,
 * or (at your option) any later version.
 *
 * "eagle-usb driver package" is distributed in the hope that it will be
 * useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with "ADI USB ADSL Driver for Linux"; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 *
 * $Id: eu_msg.h,v 1.1 2004/02/06 22:01:34 sleeper Exp $
 */


#ifndef __EU_MSG_H__
#define __EU_MSG_H__

#include "eagle-usb.h"

/* ---------------------------- Exported Macros ---------------------------- */

/*
 * Message preamble
 */
#define MSG_PREAMBLE              0x535C

/*
 * Bit pattern to access various function subfields
 */
#define MP_FUNCTION_TYPE_MASK     0xf000
#define MP_FUNCTION_SUBTYPE_MASK  0x0f00
#define MP_FUNCTION_SENDERID_MASK 0x00f0
#define MP_FUNCTION_RECEIVER_MASK 0x000f

#define MP_FUNCTION_TYPE_LSB      0xc
#define MP_FUNCTION_SUBTYPE_LSB   0x8
#define MP_FUNCTION_SENDERID_LSB  0x4
#define MP_FUNCTION_RECEIVER_LSB  0x0

/*
 * Function types
 */
#define MP_FUNCTION_TYPE_WAITING_4_REPLY              0
#define MP_FUNCTION_TYPE_MEMACCESS                  0x1
#define MP_FUNCTION_TYPE_MSGDECERR                  0x2
#define MP_FUNCTION_TYPE_MSGACCERR                  0x3
#define MP_FUNCTION_TYPE_FLASHACC                   0x4
#define MP_FUNCTION_TYPE_FLASHACCERR                0x5
#define MP_FUNCTION_TYPE_MEDIRECTIVE                0x6
#define MP_FUNCTION_TYPE_ADSLDIRECTIVE              0x7

/*
 * Functions sub-types
 */
#define SUBTYPE_MEMACCESS_REQREAD                   0x0
#define SUBTYPE_MEMACCESS_REQWRITE                  0x1
#define SUBTYPE_MEMACCESS_REPLYREAD                 0x2
#define SUBTYPE_MEMACCESS_REPLYWRITE                0x3

#define SUBTYPE_MEMACCESSERROR_UNKNOWNADDR          0x1
#define SUBTYPE_MEMACCESSERROR_DATANOTRDY           0x2
#define SUBTYPE_MEMACCESSERROR_ILLEGALREAD          0x3
#define SUBTYPE_MEMACCESSERROR_ILLEGALWRITE         0x4
#define SUBTYPE_MEMACCESSERROR_DATANOTAVAIL         0x5

#define SUBTYPE_MSGDECERR_LENGTHERROR               0x1
#define SUBTYPE_MSGDECERR_PREAMBLEERROR             0x2
#define SUBTYPE_MSGDECERR_UNKNOWNTYPE               0x3
#define SUBTYPE_MSGDECERR_CRCERROR                  0x4

#define SUBTYPE_FLASHACC_ENKERNELREBOOTREQ          0x0
#define SUBTYPE_FLASHACC_ENMODEMREBOOTREQ           0x1
#define SUBTYPE_FLASHACC_DECOMPMODEMAPPLREQ         0x2
#define SUBTYPE_FLASHACC_STREAMEDDATAWRREQ          0x3
#define SUBTYPE_FLASHACC_STREAMEDDATAWRBLOCK        0x4
#define SUBTYPE_FLASHACC_READREQ                    0x5
#define SUBTYPE_FLASHACC_CALCMODEMCRCREQ            0x7
#define SUBTYPE_FLASHACC_ENKERNELREBOOTREPLY        0x8
#define SUBTYPE_FLASHACC_ENMODEMREBOOTREPLY         0x9
#define SUBTYPE_FLASHACC_DECOMPMODEMAPPLREPLY       0xa
#define SUBTYPE_FLASHACC_STREAMEDDATAWRREPLY        0xb
#define SUBTYPE_FLASHACC_STREAMEDDATAWRBLOCKREPLY   0xc
#define SUBTYPE_FLASHACC_READREPLY                  0xd
#define SUBTYPE_FLASHACC_CALCMODEMCRCREPLY          0xf

#define SUBTYPE_FLASHACCERR_READCOMPERR             0x0
#define SUBTYPE_FLASHACCERR_DECOMPRESSERR           0x1

#define SUBTYPE_MEDIRECTIVE_REBOOT                  0x0

#define SUBTYPE_ADSLDIRECTIVE_KERNELREADY           0x0
#define SUBTYPE_ADSLDIRECTIVE_MODEMREADY            0x1
#define SUBTYPE_ADSLDIRECTIVE_MODEMCRCERROR         0x2

/*
 * Sender / Receiver ID
 */
#define SUBTYPE_ID_ADSL                             0x0
#define SUBTYPE_ID_ME                               0x1


/*
 * eu_msg_t decode function return values
 */

#define MP_DECODE_OK                                0x00000000
#define MP_DECODE_ERROR                             0x00000001
#define MP_DECODE_PREAMBLE_ERROR                    0x00000002
#define MP_DECODE_TYPE_ERROR                        0x00000004
#define MP_DECODE_SUBTYPE_ERROR                     0x00000008
#define MP_DECODE_SENDERID_ERROR                    0x00000010
#define MP_DECODE_RECEIVERID_ERROR                  0x00000020
#define MP_DECODE_SYMB_ADDR                         0x00000040




/* -------------------------- Exported Functions --------------------------- */


uint32_t eu_decode_msg ( eu_msg_t *msg, uint16_t raw_msg[8] );



#endif /* __EU_MSG_H__ */