author | Florian Pose <fp@igh-essen.com> |
Thu, 16 Oct 2008 09:23:06 +0000 | |
changeset 1273 | a73fdcfa8274 |
parent 1209 | 8be462afb7f4 |
child 1318 | 76b4014391bd |
permissions | -rw-r--r-- |
409
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
1 |
/****************************************************************************** |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
2 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
3 |
* $Id$ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
4 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
5 |
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
6 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
7 |
* This file is part of the IgH EtherCAT Master. |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
8 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
9 |
* The IgH EtherCAT Master is free software; you can redistribute it |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
10 |
* and/or modify it under the terms of the GNU General Public License |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
11 |
* as published by the Free Software Foundation; either version 2 of the |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
12 |
* License, or (at your option) any later version. |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
13 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
14 |
* The IgH EtherCAT Master is distributed in the hope that it will be |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
15 |
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
16 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
17 |
* GNU General Public License for more details. |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
18 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
19 |
* You should have received a copy of the GNU General Public License |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
20 |
* along with the IgH EtherCAT Master; if not, write to the Free Software |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
21 |
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
22 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
23 |
* The right to use EtherCAT Technology is granted and comes free of |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
24 |
* charge under condition of compatibility of product made by |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
25 |
* Licensee. People intending to distribute/sell products based on the |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
26 |
* code, have to sign an agreement to guarantee that products using |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
27 |
* software based on IgH EtherCAT master stay compatible with the actual |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
28 |
* EtherCAT specification (which are released themselves as an open |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
29 |
* standard) as the (only) precondition to have the right to use EtherCAT |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
30 |
* Technology, IP and trade marks. |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
31 |
* |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
32 |
*****************************************************************************/ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
33 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
34 |
/** |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
35 |
\file |
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
36 |
EtherCAT CANopen Sdo request structure. |
409
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
37 |
*/ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
38 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
39 |
/*****************************************************************************/ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
40 |
|
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
41 |
#ifndef __EC_SDO_REQUEST_H__ |
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
42 |
#define __EC_SDO_REQUEST_H__ |
409
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
43 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
44 |
#include <linux/list.h> |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
45 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
46 |
#include "globals.h" |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
47 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
48 |
/*****************************************************************************/ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
49 |
|
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
50 |
/** CANopen Sdo request. |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
51 |
*/ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
52 |
struct ec_sdo_request { |
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
53 |
struct list_head list; /**< List item. */ |
831
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
54 |
uint16_t index; /**< Sdo index. */ |
ded9519c8d6e
Reading of Pdo mapping via CoE during scan.
Florian Pose <fp@igh-essen.com>
parents:
814
diff
changeset
|
55 |
uint8_t subindex; /**< Sdo subindex. */ |
847
92266462d411
Saparated ec_sdo_t, ec_sdo_entry_t and ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
831
diff
changeset
|
56 |
uint8_t *data; /**< Pointer to Sdo data. */ |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
57 |
size_t mem_size; /**< Size of Sdo data memory. */ |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
58 |
size_t data_size; /**< Size of Sdo data. */ |
1035
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
59 |
uint32_t issue_timeout; /**< Maximum time in ms, the processing of the |
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
60 |
request may take. */ |
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
61 |
uint32_t response_timeout; /**< Maximum time in ms, the transfer is |
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
62 |
retried, if the slave does not respond. */ |
859
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
63 |
ec_direction_t dir; /**< Direction. EC_DIR_OUTPUT means downloading to |
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
64 |
the slave, EC_DIR_INPUT means uploading from the |
233e32f428e1
Replaced ec_fsm_coe_\(upload\|download\)() with ec_fsm_coe_transfer();
Florian Pose <fp@igh-essen.com>
parents:
858
diff
changeset
|
65 |
slave. */ |
1209 | 66 |
ec_internal_request_state_t state; /**< Sdo request state. */ |
1035
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
67 |
unsigned long jiffies_start; /**< Jiffies, when the request was issued. */ |
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
68 |
unsigned long jiffies_sent; /**< Jiffies, when the upload/download |
7fafc1a7451e
Added response timeout to sdo_request; removed timout from fsm_coe_map.
Florian Pose <fp@igh-essen.com>
parents:
880
diff
changeset
|
69 |
request was sent. */ |
1037
59f191c9185b
Store abort code in sdo request; output it in user space; added some
Florian Pose <fp@igh-essen.com>
parents:
1035
diff
changeset
|
70 |
uint32_t abort_code; /**< Sdo request abort code. Zero on success. */ |
858
69122084d066
Basic reading realtime Sdo access working.
Florian Pose <fp@igh-essen.com>
parents:
854
diff
changeset
|
71 |
}; |
430
74754f45d5fa
Implemented SDO reading via Sysfs.
Florian Pose <fp@igh-essen.com>
parents:
409
diff
changeset
|
72 |
|
74754f45d5fa
Implemented SDO reading via Sysfs.
Florian Pose <fp@igh-essen.com>
parents:
409
diff
changeset
|
73 |
/*****************************************************************************/ |
74754f45d5fa
Implemented SDO reading via Sysfs.
Florian Pose <fp@igh-essen.com>
parents:
409
diff
changeset
|
74 |
|
852
ab439cbc7a81
Separated ec_sdo_request_init() and ec_sdo_request_read().
Florian Pose <fp@igh-essen.com>
parents:
849
diff
changeset
|
75 |
void ec_sdo_request_init(ec_sdo_request_t *); |
739
4a02162a6301
Removed 'sdo' field from ec_sdo_request_t; Exported
Florian Pose <fp@igh-essen.com>
parents:
646
diff
changeset
|
76 |
void ec_sdo_request_clear(ec_sdo_request_t *); |
4a02162a6301
Removed 'sdo' field from ec_sdo_request_t; Exported
Florian Pose <fp@igh-essen.com>
parents:
646
diff
changeset
|
77 |
|
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
78 |
void ec_sdo_request_address(ec_sdo_request_t *, uint16_t, uint8_t); |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
79 |
int ec_sdo_request_alloc(ec_sdo_request_t *, size_t); |
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
80 |
int ec_sdo_request_copy_data(ec_sdo_request_t *, const uint8_t *, size_t); |
880 | 81 |
int ec_sdo_request_timed_out(const ec_sdo_request_t *); |
854
f4f53be425ac
Removed ec_sdodata_t; CoE state machines work on ec_sdo_request_t.
Florian Pose <fp@igh-essen.com>
parents:
852
diff
changeset
|
82 |
|
409
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
83 |
/*****************************************************************************/ |
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
84 |
|
bc4c852e1b93
Implemented fetching of SDO dictionary.
Florian Pose <fp@igh-essen.com>
parents:
diff
changeset
|
85 |
#endif |