author | Florian Pose <fp@igh-essen.com> |
Tue, 29 Jul 2008 09:30:33 +0000 | |
changeset 1170 | af068174a630 |
parent 1166 | 006244d53f68 |
child 1184 | 75cd6681eb08 |
permissions | -rw-r--r-- |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/***************************************************************************** |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
|
1141 | 7 |
#ifndef __MASTER_DEVICE_H__ |
8 |
#define __MASTER_DEVICE_H__ |
|
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
#include <stdexcept> |
1136
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
11 |
#include <sstream> |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
using namespace std; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
#include "../include/ecrt.h" |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
#include "../master/ioctl.h" |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
/****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
class MasterDeviceException: |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
public runtime_error |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
{ |
1136
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
22 |
friend class MasterDevice; |
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
23 |
|
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
24 |
protected: |
1141 | 25 |
/** Constructor with stringstream parameter. */ |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
MasterDeviceException( |
1136
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
27 |
const stringstream &s /**< Message. */ |
a0982873d655
Improved exceptions and commandName usage.
Florian Pose <fp@igh-essen.com>
parents:
1126
diff
changeset
|
28 |
): runtime_error(s.str()) {} |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
}; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
/****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
class MasterDevice |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
{ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
public: |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
MasterDevice(); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
~MasterDevice(); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
void setIndex(unsigned int); |
1166 | 40 |
unsigned int getIndex() const; |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
enum Permissions {Read, ReadWrite}; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
void open(Permissions); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
void close(); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
void getMaster(ec_ioctl_master_t *); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
void getConfig(ec_ioctl_config_t *, unsigned int); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
void getConfigPdo(ec_ioctl_config_pdo_t *, unsigned int, uint8_t, |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
uint16_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
void getConfigPdoEntry(ec_ioctl_config_pdo_entry_t *, unsigned int, |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
uint8_t, uint16_t, uint8_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
void getConfigSdo(ec_ioctl_config_sdo_t *, unsigned int, unsigned int); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
void getDomain(ec_ioctl_domain_t *, unsigned int); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
void getFmmu(ec_ioctl_domain_fmmu_t *, unsigned int, unsigned int); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
void getData(ec_ioctl_domain_data_t *, unsigned int, unsigned int, |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
unsigned char *); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
void getSlave(ec_ioctl_slave_t *, uint16_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
void getSync(ec_ioctl_slave_sync_t *, uint16_t, uint8_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
void getPdo(ec_ioctl_slave_sync_pdo_t *, uint16_t, uint8_t, uint8_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
void getPdoEntry(ec_ioctl_slave_sync_pdo_entry_t *, uint16_t, uint8_t, |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
uint8_t, uint8_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
void getSdo(ec_ioctl_slave_sdo_t *, uint16_t, uint16_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
void getSdoEntry(ec_ioctl_slave_sdo_entry_t *, uint16_t, int, uint8_t); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
void readSii(ec_ioctl_slave_sii_t *); |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
void writeSii(ec_ioctl_slave_sii_t *); |
1126
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1122
diff
changeset
|
66 |
void setDebug(unsigned int); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1122
diff
changeset
|
67 |
void sdoDownload(ec_ioctl_slave_sdo_download_t *); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1122
diff
changeset
|
68 |
void sdoUpload(ec_ioctl_slave_sdo_upload_t *); |
b09fd81894cb
Moved every command into a separate file.
Florian Pose <fp@igh-essen.com>
parents:
1122
diff
changeset
|
69 |
void requestState(uint16_t, uint8_t); |
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
private: |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
unsigned int index; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
int fd; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
}; |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
|
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
/****************************************************************************/ |
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
|
1166 | 78 |
inline unsigned int MasterDevice::getIndex() const |
79 |
{ |
|
80 |
return index; |
|
81 |
} |
|
82 |
||
83 |
/****************************************************************************/ |
|
84 |
||
1122
ee305a780a02
First step of moving to command list.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
#endif |