Go to the documentation of this file.00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #ifndef __CAN_PROTO_H__
00027 #define __CAN_PROTO_H__
00028
00029
00030
00031
00032
00033
00034 #define CAN_MSGID_FULL_M 0x1fffffff
00035 #define CAN_MSGID_DEVNO_M 0x0000003f
00036 #define CAN_MSGID_API_M 0x0000ffc0
00037 #define CAN_MSGID_MFR_M 0x00ff0000
00038 #define CAN_MSGID_DTYPE_M 0x1f000000
00039 #define CAN_MSGID_DEVNO_S 0
00040 #define CAN_MSGID_API_S 6
00041 #define CAN_MSGID_MFR_S 16
00042 #define CAN_MSGID_DTYPE_S 24
00043
00044
00045
00046
00047
00048
00049 #define CAN_MSGID_DEVNO_BCAST 0x00000000
00050
00051
00052
00053
00054
00055
00056 #define CAN_MSGID_API_SYSHALT 0x00000000
00057 #define CAN_MSGID_API_SYSRST 0x00000040
00058 #define CAN_MSGID_API_DEVASSIGN 0x00000080
00059 #define CAN_MSGID_API_DEVQUERY 0x000000c0
00060 #define CAN_MSGID_API_HEARTBEAT 0x00000140
00061 #define CAN_MSGID_API_SYNC 0x00000180
00062 #define CAN_MSGID_API_UPDATE 0x000001c0
00063 #define CAN_MSGID_API_FIRMVER 0x00000200
00064 #define CAN_MSGID_API_ENUMERATE 0x00000240
00065 #define CAN_MSGID_API_SYSRESUME 0x00000280
00066
00067
00068
00069
00070
00071
00072 #define CAN_STATUS_CODE_M 0x0000ffff
00073 #define CAN_STATUS_MFG_M 0x00ff0000
00074 #define CAN_STATUS_DTYPE_M 0x1f000000
00075 #define CAN_STATUS_CODE_S 0
00076 #define CAN_STATUS_MFG_S 16
00077 #define CAN_STATUS_DTYPE_S 24
00078
00079
00080
00081
00082
00083
00084 #define CAN_MSGID_MFR_NI 0x00010000
00085 #define CAN_MSGID_MFR_LM 0x00020000
00086 #define CAN_MSGID_MFR_DEKA 0x00030000
00087
00088
00089
00090
00091
00092
00093 #define CAN_MSGID_DTYPE_BCAST 0x00000000
00094 #define CAN_MSGID_DTYPE_ROBOT 0x01000000
00095 #define CAN_MSGID_DTYPE_MOTOR 0x02000000
00096 #define CAN_MSGID_DTYPE_RELAY 0x03000000
00097 #define CAN_MSGID_DTYPE_GYRO 0x04000000
00098 #define CAN_MSGID_DTYPE_ACCEL 0x05000000
00099 #define CAN_MSGID_DTYPE_USONIC 0x06000000
00100 #define CAN_MSGID_DTYPE_GEART 0x07000000
00101 #define CAN_MSGID_DTYPE_UPDATE 0x1f000000
00102
00103
00104
00105
00106
00107
00108 #define CAN_MSGID_API_CLASS_M 0x0000fc00
00109 #define CAN_MSGID_API_ID_M 0x000003c0
00110
00111
00112
00113
00114
00115
00116
00117
00118 #define CAN_API_MC_VOLTAGE 0x00000000
00119 #define CAN_API_MC_SPD 0x00000400
00120 #define CAN_API_MC_VCOMP 0x00000800
00121 #define CAN_API_MC_POS 0x00000c00
00122 #define CAN_API_MC_ICTRL 0x00001000
00123 #define CAN_API_MC_STATUS 0x00001400
00124 #define CAN_API_MC_PSTAT 0x00001800
00125 #define CAN_API_MC_CFG 0x00001c00
00126 #define CAN_API_MC_ACK 0x00002000
00127
00128
00129
00130
00131
00132
00133 #define LM_API_VOLT (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00134 CAN_API_MC_VOLTAGE)
00135 #define LM_API_VOLT_EN (LM_API_VOLT | (0 << CAN_MSGID_API_S))
00136 #define LM_API_VOLT_DIS (LM_API_VOLT | (1 << CAN_MSGID_API_S))
00137 #define LM_API_VOLT_SET (LM_API_VOLT | (2 << CAN_MSGID_API_S))
00138 #define LM_API_VOLT_SET_RAMP (LM_API_VOLT | (3 << CAN_MSGID_API_S))
00139 #define LM_API_VOLT_SET_NO_ACK (LM_API_VOLT | (8 << CAN_MSGID_API_S))
00140
00141
00142
00143
00144
00145
00146 #define LM_API_VOLT_RAMP_DIS 0
00147
00148
00149
00150
00151
00152
00153 #define LM_API_SYNC_PEND_NOW 0
00154
00155
00156
00157
00158
00159
00160 #define LM_API_SPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00161 CAN_API_MC_SPD)
00162 #define LM_API_SPD_EN (LM_API_SPD | (0 << CAN_MSGID_API_S))
00163 #define LM_API_SPD_DIS (LM_API_SPD | (1 << CAN_MSGID_API_S))
00164 #define LM_API_SPD_SET (LM_API_SPD | (2 << CAN_MSGID_API_S))
00165 #define LM_API_SPD_PC (LM_API_SPD | (3 << CAN_MSGID_API_S))
00166 #define LM_API_SPD_IC (LM_API_SPD | (4 << CAN_MSGID_API_S))
00167 #define LM_API_SPD_DC (LM_API_SPD | (5 << CAN_MSGID_API_S))
00168 #define LM_API_SPD_REF (LM_API_SPD | (6 << CAN_MSGID_API_S))
00169 #define LM_API_SPD_SET_NO_ACK (LM_API_SPD | (11 << CAN_MSGID_API_S))
00170
00171
00172
00173
00174
00175
00176 #define LM_API_VCOMP (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00177 CAN_API_MC_VCOMP)
00178 #define LM_API_VCOMP_EN (LM_API_VCOMP | (0 << CAN_MSGID_API_S))
00179 #define LM_API_VCOMP_DIS (LM_API_VCOMP | (1 << CAN_MSGID_API_S))
00180 #define LM_API_VCOMP_SET (LM_API_VCOMP | (2 << CAN_MSGID_API_S))
00181 #define LM_API_VCOMP_IN_RAMP (LM_API_VCOMP | (3 << CAN_MSGID_API_S))
00182 #define LM_API_VCOMP_COMP_RAMP (LM_API_VCOMP | (4 << CAN_MSGID_API_S))
00183 #define LM_API_VCOMP_SET_NO_ACK (LM_API_VCOMP | (9 << CAN_MSGID_API_S))
00184
00185
00186
00187
00188
00189
00190 #define LM_API_POS (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00191 CAN_API_MC_POS)
00192 #define LM_API_POS_EN (LM_API_POS | (0 << CAN_MSGID_API_S))
00193 #define LM_API_POS_DIS (LM_API_POS | (1 << CAN_MSGID_API_S))
00194 #define LM_API_POS_SET (LM_API_POS | (2 << CAN_MSGID_API_S))
00195 #define LM_API_POS_PC (LM_API_POS | (3 << CAN_MSGID_API_S))
00196 #define LM_API_POS_IC (LM_API_POS | (4 << CAN_MSGID_API_S))
00197 #define LM_API_POS_DC (LM_API_POS | (5 << CAN_MSGID_API_S))
00198 #define LM_API_POS_REF (LM_API_POS | (6 << CAN_MSGID_API_S))
00199 #define LM_API_POS_SET_NO_ACK (LM_API_POS | (11 << CAN_MSGID_API_S))
00200
00201
00202
00203
00204
00205
00206 #define LM_API_ICTRL (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00207 CAN_API_MC_ICTRL)
00208 #define LM_API_ICTRL_EN (LM_API_ICTRL | (0 << CAN_MSGID_API_S))
00209 #define LM_API_ICTRL_DIS (LM_API_ICTRL | (1 << CAN_MSGID_API_S))
00210 #define LM_API_ICTRL_SET (LM_API_ICTRL | (2 << CAN_MSGID_API_S))
00211 #define LM_API_ICTRL_PC (LM_API_ICTRL | (3 << CAN_MSGID_API_S))
00212 #define LM_API_ICTRL_IC (LM_API_ICTRL | (4 << CAN_MSGID_API_S))
00213 #define LM_API_ICTRL_DC (LM_API_ICTRL | (5 << CAN_MSGID_API_S))
00214 #define LM_API_ICTRL_SET_NO_ACK (LM_API_ICTRL | (10 << CAN_MSGID_API_S))
00215
00216
00217
00218
00219
00220
00221 #define LM_API_UPD (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_UPDATE)
00222 #define LM_API_UPD_PING (LM_API_UPD | (0 << CAN_MSGID_API_S))
00223 #define LM_API_UPD_DOWNLOAD (LM_API_UPD | (1 << CAN_MSGID_API_S))
00224 #define LM_API_UPD_SEND_DATA (LM_API_UPD | (2 << CAN_MSGID_API_S))
00225 #define LM_API_UPD_RESET (LM_API_UPD | (3 << CAN_MSGID_API_S))
00226 #define LM_API_UPD_ACK (LM_API_UPD | (4 << CAN_MSGID_API_S))
00227 #define LM_API_HWVER (LM_API_UPD | (5 << CAN_MSGID_API_S))
00228 #define LM_API_UPD_REQUEST (LM_API_UPD | (6 << CAN_MSGID_API_S))
00229
00230
00231
00232
00233
00234
00235 #define LM_API_STATUS (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00236 CAN_API_MC_STATUS)
00237 #define LM_API_STATUS_VOLTOUT (LM_API_STATUS | (0 << CAN_MSGID_API_S))
00238 #define LM_API_STATUS_VOLTBUS (LM_API_STATUS | (1 << CAN_MSGID_API_S))
00239 #define LM_API_STATUS_CURRENT (LM_API_STATUS | (2 << CAN_MSGID_API_S))
00240 #define LM_API_STATUS_TEMP (LM_API_STATUS | (3 << CAN_MSGID_API_S))
00241 #define LM_API_STATUS_POS (LM_API_STATUS | (4 << CAN_MSGID_API_S))
00242 #define LM_API_STATUS_SPD (LM_API_STATUS | (5 << CAN_MSGID_API_S))
00243 #define LM_API_STATUS_LIMIT (LM_API_STATUS | (6 << CAN_MSGID_API_S))
00244 #define LM_API_STATUS_FAULT (LM_API_STATUS | (7 << CAN_MSGID_API_S))
00245 #define LM_API_STATUS_POWER (LM_API_STATUS | (8 << CAN_MSGID_API_S))
00246 #define LM_API_STATUS_CMODE (LM_API_STATUS | (9 << CAN_MSGID_API_S))
00247 #define LM_API_STATUS_VOUT (LM_API_STATUS | (10 << CAN_MSGID_API_S))
00248
00249 #define CPR_API_STATUS_ANALOG (LM_API_STATUS | (15 << CAN_MSGID_API_S))
00250 #define LM_API_STATUS_STKY_FLT (LM_API_STATUS | (11 << CAN_MSGID_API_S))
00251 #define LM_API_STATUS_FLT_COUNT (LM_API_STATUS | (12 << CAN_MSGID_API_S))
00252
00253
00254
00255
00256
00257
00258
00259
00260 #define LM_STATUS_LIMIT_FWD 0x01
00261 #define LM_STATUS_LIMIT_REV 0x02
00262
00263
00264
00265
00266
00267
00268 #define LM_STATUS_FAULT_ILIMIT 0x01
00269 #define LM_STATUS_FAULT_TLIMIT 0x02
00270 #define LM_STATUS_FAULT_VLIMIT 0x04
00271
00272
00273
00274
00275
00276
00277 #define LM_API_CFG (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00278 CAN_API_MC_CFG)
00279 #define LM_API_CFG_NUM_BRUSHES (LM_API_CFG | (0 << CAN_MSGID_API_S))
00280 #define LM_API_CFG_ENC_LINES (LM_API_CFG | (1 << CAN_MSGID_API_S))
00281 #define LM_API_CFG_POT_TURNS (LM_API_CFG | (2 << CAN_MSGID_API_S))
00282 #define LM_API_CFG_BRAKE_COAST (LM_API_CFG | (3 << CAN_MSGID_API_S))
00283 #define LM_API_CFG_LIMIT_MODE (LM_API_CFG | (4 << CAN_MSGID_API_S))
00284 #define LM_API_CFG_LIMIT_FWD (LM_API_CFG | (5 << CAN_MSGID_API_S))
00285 #define LM_API_CFG_LIMIT_REV (LM_API_CFG | (6 << CAN_MSGID_API_S))
00286 #define LM_API_CFG_MAX_VOUT (LM_API_CFG | (7 << CAN_MSGID_API_S))
00287 #define LM_API_CFG_FAULT_TIME (LM_API_CFG | (8 << CAN_MSGID_API_S))
00288
00289 #define CPR_API_CFG_SHUTDOWN_TEMP (LM_API_CFG | (11 << CAN_MSGID_API_S))
00290 #define CPR_API_CFG_MINIMUM_LEVEL (LM_API_CFG | (12 << CAN_MSGID_API_S))
00291 #define CPR_API_CFG_NOMINAL_LEVEL (LM_API_CFG | (13 << CAN_MSGID_API_S))
00292 #define CPR_API_CFG_SHUTOFF_LEVEL (LM_API_CFG | (14 << CAN_MSGID_API_S))
00293 #define CPR_API_CFG_SHUTOFF_TIME (LM_API_CFG | (15 << CAN_MSGID_API_S))
00294
00295
00296
00297
00298
00299
00300
00301 #define LM_API_ACK (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00302 CAN_API_MC_ACK)
00303
00304
00305
00306
00307
00308
00309 #define LM_HWVER_UNKNOWN 0x00
00310 #define LM_HWVER_JAG_1_0 0x01
00311 #define LM_HWVER_JAG_2_0 0x02
00312
00313
00314
00315
00316
00317
00318 #define LM_STATUS_CMODE_VOLT 0x00
00319 #define LM_STATUS_CMODE_CURRENT 0x01
00320 #define LM_STATUS_CMODE_SPEED 0x02
00321 #define LM_STATUS_CMODE_POS 0x03
00322 #define LM_STATUS_CMODE_VCOMP 0x04
00323
00324
00325
00326
00327
00328
00329
00330
00331 #define LM_REF_ENCODER 0x00
00332 #define LM_REF_POT 0x01
00333 #define LM_REF_INV_ENCODER 0x02
00334 #define LM_REF_QUAD_ENCODER 0x03
00335 #define LM_REF_NONE 0xff
00336
00337
00338
00339
00340
00341
00342 #define LM_FAULT_CURRENT 0x01
00343 #define LM_FAULT_TEMP 0x02
00344 #define LM_FAULT_VBUS 0x04
00345 #define LM_FAULT_GATE_DRIVE 0x08
00346 #define LM_FAULT_COMM 0x10
00347
00348
00349
00350
00351
00352
00353 #define LM_API_PSTAT (CAN_MSGID_MFR_LM | CAN_MSGID_DTYPE_MOTOR | \
00354 CAN_API_MC_PSTAT)
00355 #define LM_API_PSTAT_PER_EN_S0 (LM_API_PSTAT | (0 << CAN_MSGID_API_S))
00356 #define LM_API_PSTAT_PER_EN_S1 (LM_API_PSTAT | (1 << CAN_MSGID_API_S))
00357 #define LM_API_PSTAT_PER_EN_S2 (LM_API_PSTAT | (2 << CAN_MSGID_API_S))
00358 #define LM_API_PSTAT_PER_EN_S3 (LM_API_PSTAT | (3 << CAN_MSGID_API_S))
00359 #define LM_API_PSTAT_CFG_S0 (LM_API_PSTAT | (4 << CAN_MSGID_API_S))
00360 #define LM_API_PSTAT_CFG_S1 (LM_API_PSTAT | (5 << CAN_MSGID_API_S))
00361 #define LM_API_PSTAT_CFG_S2 (LM_API_PSTAT | (6 << CAN_MSGID_API_S))
00362 #define LM_API_PSTAT_CFG_S3 (LM_API_PSTAT | (7 << CAN_MSGID_API_S))
00363 #define LM_API_PSTAT_DATA_S0 (LM_API_PSTAT | (8 << CAN_MSGID_API_S))
00364 #define LM_API_PSTAT_DATA_S1 (LM_API_PSTAT | (9 << CAN_MSGID_API_S))
00365 #define LM_API_PSTAT_DATA_S2 (LM_API_PSTAT | (10 << CAN_MSGID_API_S))
00366 #define LM_API_PSTAT_DATA_S3 (LM_API_PSTAT | (11 << CAN_MSGID_API_S))
00367
00368
00369
00370
00371
00372
00373
00374
00375 #define LM_PSTAT_END 0
00376 #define LM_PSTAT_VOLTOUT_B0 1
00377 #define LM_PSTAT_VOLTOUT_B1 2
00378 #define LM_PSTAT_VOLTBUS_B0 3
00379 #define LM_PSTAT_VOLTBUS_B1 4
00380 #define LM_PSTAT_CURRENT_B0 5
00381 #define LM_PSTAT_CURRENT_B1 6
00382 #define LM_PSTAT_TEMP_B0 7
00383 #define LM_PSTAT_TEMP_B1 8
00384 #define LM_PSTAT_POS_B0 9
00385 #define LM_PSTAT_POS_B1 10
00386 #define LM_PSTAT_POS_B2 11
00387 #define LM_PSTAT_POS_B3 12
00388 #define LM_PSTAT_SPD_B0 13
00389 #define LM_PSTAT_SPD_B1 14
00390 #define LM_PSTAT_SPD_B2 15
00391 #define LM_PSTAT_SPD_B3 16
00392 #define LM_PSTAT_LIMIT_NCLR 17
00393 #define LM_PSTAT_LIMIT_CLR 18
00394 #define LM_PSTAT_FAULT 19
00395 #define LM_PSTAT_STKY_FLT_NCLR 20
00396 #define LM_PSTAT_STKY_FLT_CLR 21
00397 #define LM_PSTAT_VOUT_B0 22
00398 #define LM_PSTAT_VOUT_B1 23
00399 #define LM_PSTAT_FLT_COUNT_CURRENT \
00400 24
00401 #define LM_PSTAT_FLT_COUNT_TEMP 25
00402 #define LM_PSTAT_FLT_COUNT_VOLTBUS \
00403 26
00404 #define LM_PSTAT_FLT_COUNT_GATE 27
00405 #define LM_PSTAT_FLT_COUNT_COMM 28
00406 #define LM_PSTAT_CANSTS 29
00407 #define LM_PSTAT_CANERR_B0 30
00408 #define LM_PSTAT_CANERR_B1 31
00409
00410 #endif // __CAN_PROTO_H__