summaryrefslogtreecommitdiffstats
path: root/api/cmd.h
blob: 4fb6bc7dc270c60c337a8eda82103f4abc47d42e (plain)
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
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
#ifndef __CMD_H__
#define __CMD_H__


#include "type.h"
#include "user.h"
#include "error.h"

/**
 * Bus types
 */
#define Bus_I2C             1
#define Bus_USB             2
#define Bus_SPI             3
#define Bus_SDIO            4
#define Bus_USB11           5
#define Bus_I2M             6  /** I2C bus for Mercury      */
#define Bus_I2U             7  /** I2C bus for Mercury USB  */
#define Bus_I2U2            8  /** I2C bus for Mercury USB (new, buffer size is 55) */
#define Bus_9035U2I         9  /** I2C bus for Ganymede USB */


/**
 * Define commands
 */
#define Command_REG_DEMOD_READ          0x0000
#define Command_REG_DEMOD_WRITE         0x0001
#define Command_REG_TUNER_READ          0x0002
#define Command_REG_TUNER_WRITE         0x0003
#define Command_REG_EEPROM_READ         0x0004
#define Command_REG_EEPROM_WRITE        0x0005
#define Command_VAR_READ                0x0008
#define Command_VAR_WRITE               0x0009

#define Command_DATA_READ               0x0006

#define Command_PLATFORM_GET            0x000A
#define Command_PLATFORM_SET            0x000B
#define Command_IP_CACHE                0x000D
#define Command_IP_ADD                  0x000E
#define Command_IP_REMOVE               0x000F
#define Command_PID_ADD                 0x0010
#define Command_PID_REMOVE              0x0011
#define Command_SIPSI_GET               0x0012  /** Get SI/PSI table for specific PID "once". */
#define Command_SIPSI_MPE_RESET         0x0013
#define Command_H_PID_ADD               0x0015
#define Command_H_PID_REMOVE            0x0016
#define Command_ABORT                   0x0017
#define Command_IR_GET                  0x0018
#define Command_IR_SET                  0x0019
#define Command_FW_DOWNLOAD_BEGIN       0x0024
#define Command_FW_DOWNLOAD             0x0021
#define Command_FW_DOWNLOAD_END         0x0025
#define Command_QUERYINFO               0x0022
#define Command_BOOT                    0x0023
#define Command_REBOOT                  0x0023
#define Command_RUN_CODE                0x0026
#define Command_SCATTER_READ            0x0028
#define Command_SCATTER_WRITE           0x0029
#define Command_GENERIC_READ            0x002A
#define Command_GENERIC_WRITE           0x002B
#define Command_SHORT_REG_DEMOD_READ    0x02
#define Command_SHORT_REG_DEMOD_WRITE   0X03
#define Command_SHORT_REG_TUNER_READ    0x04
#define Command_SHORT_REG_TUNER_WRITE   0X05

#define Command_SERVICES_GET            0x0083
#define Command_COMPONENT_ADD           0x0086
#define Command_COMPONENT_REMOVE        0x0087
#define Command_FIG_ADD                 0x0088
#define Command_FIG_REMOVE              0x0089


#define Bus_MAX_WRITE_SIZE              254
#define Bus_MAX_READ_SIZE               254


#define Cmd_buildCommand(command, processor, chip)  (command + (Word) (processor << 12) + (Word) (chip << 12))


/**
 *
 */
Dword Cmd_writeRegisters (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Processor       processor,
    IN  Dword           registerAddress,
    IN  Byte            registerAddressLength,
    IN  Dword           writeBufferLength,
    IN  Byte*           writeBuffer
);


/**
 *
 */
Dword Cmd_writeTunerRegisters (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Byte            tunerAddress,
    IN  Word            registerAddress,
    IN  Byte            registerAddressLength,
    IN  Byte            writeBufferLength,
    IN  Byte*           writeBuffer
);


/**
 *
 */
Dword Cmd_writeEepromValues (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Byte            eepromAddress,
    IN  Word            registerAddress,
    IN  Byte            registerAddressLength,
    IN  Byte            writeBufferLength,
    IN  Byte*           writeBuffer
);


/**
 *
 */
Dword Cmd_readRegisters (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Processor       processor,
    IN  Dword           registerAddress,
    IN  Byte            registerAddressLength,
    IN  Dword           readBufferLength,
    OUT Byte*           readBuffer
);


/**
 *
 */
Dword Cmd_readTunerRegisters (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Byte            tunerAddress,
    IN  Word            registerAddress,
    IN  Byte            registerAddressLength,
    IN  Byte            readBufferLength,
    IN  Byte*           readBuffer
);


/**
 *
 */
Dword Cmd_readEepromValues (
    IN  Demodulator*    demodulator,
    IN  Byte            chip,
    IN  Byte            eepromAddress,
    IN  Word            registerAddress,
    IN  Byte            registerAddressLength,
    IN  Byte            readBufferLength,
    OUT Byte*           readBuffer
);


/**
 *
 */
Dword Cmd_loadFirmware (
    IN  Demodulator*    demodulator,
    IN  Dword           length,
    IN  Byte*           firmware
);


/**
 *
 */
Dword Cmd_reboot (
    IN  Demodulator*    demodulator,
    IN  Byte            chip
);


/**
 *
 */
Dword Cmd_sendCommand (
    IN  Demodulator*    demodulator,
    IN  Word            command,
    IN  Byte            chip,
    IN  Processor       processor,
    IN  Dword           writeBufferLength,
    IN  Byte*           writeBuffer,
    IN  Dword           readBufferLength,
    OUT Byte*           readBuffer
);


Dword Cmd_receiveData (
    IN  Demodulator*    demodulator,
    IN  Dword           registerAddress,
    IN  Dword           readBufferLength,
    OUT Byte*           readBuffer
);

extern CmdDescription Cmd_busDescription;


#endif