author | Edouard Tisserant <edouard.tisserant@gmail.com> |
Fri, 05 Oct 2018 23:47:07 +0200 | |
branch | stable-1.5 |
changeset 2722 | 5e5bec5ee9c1 |
parent 2443 | 2c3ccdde3919 |
permissions | -rw-r--r-- |
2443
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2012 Florian Pose, Ingenieurgemeinschaft IgH |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT master userspace library. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT master userspace library is free software; you can |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* redistribute it and/or modify it under the terms of the GNU Lesser General |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* Public License as published by the Free Software Foundation; version 2.1 |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* of the License. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT master userspace library is distributed in the hope that |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* it will be useful, but WITHOUT ANY WARRANTY; without even the implied |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU Lesser General Public License for more details. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU Lesser General Public License |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT master userspace library. If not, see |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* <http://www.gnu.org/licenses/>. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* --- |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* The license mentioned above concerns the source code only. Using the |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* EtherCAT technology and brand is only permitted in compliance with the |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* industrial property and similar rights of Beckhoff Automation GmbH. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
/** \file |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
* EtherCAT register request functions. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
*/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
/*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
36 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
#include <stdio.h> |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
#include <string.h> |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
#include "ioctl.h" |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
41 |
#include "reg_request.h" |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
42 |
#include "slave_config.h" |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
#include "master.h" |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
/*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
void ec_reg_request_clear(ec_reg_request_t *reg) |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
{ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
if (reg->data) { |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
50 |
free(reg->data); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
51 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
52 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
53 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
54 |
/***************************************************************************** |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
55 |
* Application interface. |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
56 |
****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
57 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
58 |
uint8_t *ecrt_reg_request_data(ec_reg_request_t *reg) |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
59 |
{ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
60 |
return reg->data; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
61 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
62 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
63 |
/*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
64 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
65 |
ec_request_state_t ecrt_reg_request_state(ec_reg_request_t *reg) |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
66 |
{ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
67 |
ec_ioctl_reg_request_t io; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
68 |
int ret; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
69 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
70 |
io.config_index = reg->config->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
71 |
io.request_index = reg->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
72 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
73 |
ret = ioctl(reg->config->master->fd, EC_IOCTL_REG_REQUEST_STATE, &io); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
74 |
if (EC_IOCTL_IS_ERROR(ret)) { |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
75 |
fprintf(stderr, "Failed to get register request state: %s\n", |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
76 |
strerror(EC_IOCTL_ERRNO(ret))); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
77 |
return EC_REQUEST_ERROR; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
78 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
79 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
80 |
if (io.new_data) { // new data waiting to be copied |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
81 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
82 |
io.data = reg->data; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
io.mem_size = reg->mem_size; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
ret = ioctl(reg->config->master->fd, |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
86 |
EC_IOCTL_REG_REQUEST_DATA, &io); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
87 |
if (EC_IOCTL_IS_ERROR(ret)) { |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
88 |
fprintf(stderr, "Failed to get register data: %s\n", |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
89 |
strerror(EC_IOCTL_ERRNO(ret))); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
90 |
return EC_REQUEST_ERROR; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
91 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
92 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
93 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
94 |
return io.state; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
95 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
96 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
97 |
/*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
98 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
99 |
void ecrt_reg_request_write(ec_reg_request_t *reg, uint16_t address, |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
100 |
size_t size) |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
101 |
{ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
102 |
ec_ioctl_reg_request_t io; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
103 |
int ret; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
104 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
105 |
io.config_index = reg->config->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
106 |
io.request_index = reg->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
107 |
io.data = reg->data; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
108 |
io.address = address; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
109 |
io.transfer_size = size; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
110 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
111 |
ret = ioctl(reg->config->master->fd, EC_IOCTL_REG_REQUEST_WRITE, &io); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
112 |
if (EC_IOCTL_IS_ERROR(ret)) { |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
113 |
fprintf(stderr, "Failed to command an register write operation: %s\n", |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
114 |
strerror(EC_IOCTL_ERRNO(ret))); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
115 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
116 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
117 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
118 |
/*****************************************************************************/ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
119 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
120 |
void ecrt_reg_request_read(ec_reg_request_t *reg, uint16_t address, |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
121 |
size_t size) |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
122 |
{ |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
123 |
ec_ioctl_reg_request_t io; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
124 |
int ret; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
125 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
126 |
io.config_index = reg->config->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
127 |
io.request_index = reg->index; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
128 |
io.address = address; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
129 |
io.transfer_size = size; |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
130 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
131 |
ret = ioctl(reg->config->master->fd, EC_IOCTL_REG_REQUEST_READ, &io); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
132 |
if (EC_IOCTL_IS_ERROR(ret)) { |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
133 |
fprintf(stderr, "Failed to command an register read operation: %s\n", |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
134 |
strerror(EC_IOCTL_ERRNO(ret))); |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
135 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
136 |
} |
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
137 |
|
2c3ccdde3919
Added interface to read/write register contents; re-worked register requests.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
138 |
/*****************************************************************************/ |