00001
00002 #ifndef PMAC_H
00003 #define PMAC_H
00004
00005 #include "rcs_defs.hh"
00006
00007
00008 #ifdef __cplusplus
00009 extern "C" {
00010 #endif
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032 #define PMAC_MSG_LEN 256
00033
00034
00035 typedef enum {PMAC_ACK=0, PMAC_ERR, PMAC_BUF_TOO_SMALL,
00036 PMAC_BAD_PARAMS, PMAC_TIMEOUT,
00037 PMAC_INVALID_COMM_PARAMS,
00038 PMAC_WRITE_TIMEOUT } PMAC_RETURN_VAL;
00039
00040
00041
00042
00043 #define AXIS_MAX 4
00044
00045 #ifdef lynxosPC
00046
00047 extern void *pmac;
00048 #endif
00049
00050
00051 int pmac_set_base_addr(unsigned int addr);
00052
00053
00054 int pmac_set_io_addr(unsigned int addr);
00055
00056
00057 void pmac_init();
00058
00059
00060 void pmac_exit();
00061
00062 #ifdef lynxosPC
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073 void *pmac_get(char *name, void *base, long int size);
00074
00075
00076
00077
00078
00079 void *pmac_valid_base();
00080
00081
00082
00083
00084
00085 void *pmac_msg_base();
00086
00087
00088
00089
00090
00091 void *pmac_data_base();
00092
00093 #endif
00094
00095
00096
00097
00098
00099
00100 void pmac_free(char *name, void *base);
00101
00102 typedef unsigned char PMAC_UINT8;
00103 typedef unsigned short PMAC_UINT16;
00104 typedef unsigned long PMAC_UINT32;
00105
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116 PMAC_UINT8 read_pmac_uint8(int index);
00117
00118
00119
00120
00121
00122
00123
00124
00125
00126 void write_pmac_uint8(int index, PMAC_UINT8 val);
00127
00128
00129
00130
00131
00132
00133
00134
00135
00136
00137 PMAC_UINT16 read_pmac_uint16(int index);
00138
00139
00140
00141
00142
00143
00144
00145
00146
00147 void write_pmac_uint16(int index, PMAC_UINT16 val);
00148
00149
00150
00151
00152
00153
00154
00155
00156
00157
00158 PMAC_UINT32 read_pmac_uint32(int index);
00159
00160
00161
00162
00163
00164
00165
00166
00167
00168 void write_pmac_uint32(int index, PMAC_UINT32 val);
00169
00170
00171
00172
00173
00174
00175
00176
00177
00178
00179 float pmac_readfloat(int index);
00180
00181
00182
00183
00184
00185
00186
00187
00188
00189 void pmac_writefloat(int index, float val);
00190
00191
00192
00193
00194
00195
00196 PMAC_RETURN_VAL pmac_writemsg(const char *msg, char *reply, int len);
00197
00198
00199 PMAC_RETURN_VAL pmac_reset();
00200
00201
00202 int pmac_sendstring(const char *string);
00203
00204
00205 int pmac_online();
00206
00207
00208 int pmac_program();
00209
00210
00211
00212 int pmac_in_position(int axis);
00213
00214
00215
00216 int pmac_at_home(int axis);
00217
00218
00219 int pmac_at_limit(int axis);
00220
00221
00222 int pmac_at_sw_limit(int axis);
00223
00224
00225
00226
00227
00228 int pmac_prog_running();
00229
00230
00231 double pmac_pos(int axis);
00232
00233
00234 double pmac_target_pos(int axis);
00235
00236
00237
00238
00239 void pmac_print_error(int dperr, const char *reply);
00240
00241
00242 void pmac_spindle_speed(double speed, int gear);
00243
00244 int pmac_enable_spindle();
00245 int pmac_disable_spindle();
00246 int pmac_spindle_is_open_loop();
00247
00248
00249 int pmac_probe_on();
00250 int pmac_probe_off();
00251 int pmac_probe_tripped(int axis);
00252 int pmac_probe_clear(int axis);
00253 int pmac_probe_value(int axis);
00254
00255
00256
00257
00258
00259
00260
00261
00262
00263
00264
00265
00266
00267
00268
00269
00270
00271
00272
00273
00274
00275
00276
00277
00278
00279
00280
00281
00282
00283
00284
00285
00286
00287
00288
00289
00290
00291
00292
00293
00294
00295
00296
00297
00298
00299
00300
00301
00302
00303
00304
00305
00306
00307
00308
00309
00310
00311
00312
00313
00314
00315
00316
00317
00318
00319
00320
00321
00322
00323
00324
00325
00326
00327
00328
00329
00330
00331
00332
00333
00334
00335
00336
00337
00338
00339
00340
00341
00342
00343
00344
00345
00346
00347
00348
00349
00350
00351
00352
00353
00354
00355
00356
00357
00358
00359
00360
00361
00362
00363
00364
00365
00366
00367
00368
00369
00370
00371
00372
00373
00374
00375
00376
00377
00378
00379
00380
00381
00382 #define ANALOG_1_OUT 0
00383 #define AMP_EN_1_OUT 1
00384 #define HOME_FLAG_1 2
00385 #define NEG_LIM_1 3
00386 #define POS_LIM_1 4
00387 #define PROG_RUNNING_1 5
00388 #define OPEN_LOOP_1 6
00389 #define AMP_EN_1 7
00390 #define IPOS_1 8
00391 #define HOMED_1 9
00392 #define ACT_POS_1 10
00393 #define TARGET_POS_1 11
00394 #define SW_LIM_1 12
00395 #define SW_POS_LIM_1 13
00396 #define SW_NEG_LIM_1 14
00397 #define UNUSED_1 15
00398 #define CAPTURE_READY_1 16
00399 #define HOME_OFFSET_1 17
00400
00401
00402 #define ANALOG_2_OUT 20
00403 #define AMP_EN_2_OUTPUT 21
00404 #define HOME_FLAG_2 22
00405 #define NEG_LIM_2 23
00406 #define POS_LIM_2 24
00407 #define PROG_RUNNING_2 25
00408 #define OPEN_LOOP_2 26
00409 #define AMP_EN_2 27
00410 #define IPOS_2 28
00411 #define HOMED_2 29
00412 #define ACT_POS_2 30
00413 #define TARGET_POS_2 31
00414 #define SW_LIM_2 32
00415 #define SW_POS_LIM_2 33
00416 #define SW_NEG_LIM_2 34
00417 #define UNUSED_2 35
00418 #define CAPTURE_READY_2 36
00419 #define HOME_OFFSET_2 37
00420
00421
00422 #define ANALOG_3_OUT 40
00423 #define AMP_EN_3_OUT 41
00424 #define HOME_FLAG_3 42
00425 #define NEG_LIM_3 43
00426 #define POS_LIM_3 44
00427 #define PROG_RUNNING_3 45
00428 #define OPEN_LOOP_3 46
00429 #define AMP_EN_3 47
00430 #define IPOS_3 48
00431 #define HOMED_3 49
00432 #define ACT_POS_3 50
00433 #define TARGET_POS_3 51
00434 #define SW_LIM_3 52
00435 #define SW_POS_LIM_3 53
00436 #define SW_NEG_LIM_3 54
00437 #define UNUSED_3 55
00438 #define CAPTURE_READY_3 56
00439 #define HOME_OFFSET_3 57
00440
00441
00442 #define ANALOG_4_OUT 60
00443 #define AMP_EN_4_OUT 61
00444 #define HOME_FLAG_4 62
00445 #define NEG_LIM_4 63
00446 #define POS_LIM_4 64
00447 #define PROG_RUNNING_4 65
00448 #define OPEN_LOOP_4 66
00449 #define AMP_EN_4 67
00450 #define IPOS_4 68
00451 #define HOMED_4 69
00452 #define ACT_POS_4 70
00453 #define TARGET_POS_4 71
00454 #define SW_LIM_4 72
00455 #define SW_POS_LIM_4 73
00456 #define SW_NEG_LIM_4 74
00457 #define UNUSED_4 75
00458 #define CAPTURE_READY_4 76
00459 #define HOME_OFFSET_4 77
00460
00461
00462 #define ANALOG_5_OUT 80
00463 #define AMP_EN_5_OUT 81
00464 #define HOME_FLAG_5 82
00465 #define NEG_LIM_5 83
00466 #define POS_LIM_5 84
00467 #define PROG_RUNNING_5 85
00468 #define OPEN_LOOP_5 86
00469 #define AMP_EN_5 87
00470 #define IPOS_5 88
00471 #define HOMED_5 89
00472 #define ACT_POS_5 90
00473 #define TARGET_POS_5 91
00474 #define SW_LIM_5 92
00475 #define SW_POS_LIM_5 93
00476 #define SW_NEG_LIM_5 94
00477 #define UNUSED_5 95
00478 #define CAPTURE_READY_5 96
00479 #define HOME_OFFSET_5 97
00480
00481
00482 #define ANALOG_6_OUT 100
00483 #define AMP_EN_6_OUT 101
00484 #define HOME_FLAG_6 102
00485 #define NEG_LIM_6 103
00486 #define POS_LIM_6 104
00487 #define PROG_RUNNING_6 105
00488 #define OPEN_LOOP_6 106
00489 #define AMP_EN_6 107
00490 #define IPOS_6 108
00491 #define HOMED_6 109
00492 #define ACT_POS_6 110
00493 #define TARGET_POS_6 111
00494 #define SW_LIM_6 112
00495 #define SW_POS_LIM_6 113
00496 #define SW_NEG_LIM_6 114
00497 #define UNUSED_6 115
00498 #define CAPTURE_READY_6 116
00499 #define HOME_OFFSET_6 117
00500
00501
00502 #define ANALOG_7_OUT 120
00503 #define AMP_EN_7_OUT 121
00504 #define HOME_FLAG_7 122
00505 #define NEG_LIM_7 123
00506 #define POS_LIM_7 124
00507 #define PROG_RUNNING_7 125
00508 #define OPEN_LOOP_7 126
00509 #define AMP_EN_7 127
00510 #define IPOS_7 128
00511 #define HOMED_7 129
00512 #define ACT_POS_7 130
00513 #define TARGET_POS_7 131
00514 #define SW_LIM_7 132
00515 #define SW_POS_LIM_7 133
00516 #define SW_NEG_LIM_7 134
00517 #define UNUSED_7 135
00518 #define CAPTURE_READY_7 136
00519 #define HOME_OFFSET_7 137
00520
00521
00522 #define ANALOG_8_OUT 140
00523 #define AMP_EN_8_OUT 141
00524 #define HOME_FLAG_8 142
00525 #define NEG_LIM_8 143
00526 #define POS_LIM_8 144
00527 #define PROG_RUNNING_8 145
00528 #define OPEN_LOOP_8 146
00529 #define AMP_EN_8 147
00530 #define IPOS_8 148
00531 #define HOMED_8 149
00532 #define ACT_POS_8 150
00533 #define TARGET_POS_8 151
00534 #define SW_LIM_8 152
00535 #define SW_POS_LIM_8 153
00536 #define SW_NEG_LIM_8 154
00537 #define UNUSED_8 155
00538 #define CAPTURE_READY_8 156
00539 #define HOME_OFFSET_8 157
00540
00541 #define CS_PROG_RUNNING 160
00542 #define CS_IPOS 161
00543
00544 #define SPINDLE_SPEED ANALOG_4_OUT
00545
00546
00547 #define OFFSET_1 162
00548 #define OFFSET_2 163
00549 #define OFFSET_3 164
00550
00551 #define CAPTURED_1 171
00552 #define CAPTURED_2 172
00553 #define CAPTURED_3 173
00554
00555
00556 #ifdef __cplusplus
00557 }
00558 #endif
00559
00560 #endif