master/fsm_coe.c
author Florian Pose <fp@igh-essen.com>
Tue, 07 Nov 2006 13:50:03 +0000
branchstable-1.1
changeset 1734 8590d2fcd839
parent 1732 1cc865ba17c2
child 1739 5fcbd29151d2
permissions -rw-r--r--
MERGE trunk -r686:687 -> branches/stable-1.1 (ChangeLog)
1732
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT CoE state machines.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "globals.h"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "master.h"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "mailbox.h"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include "fsm_coe.h"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
void ec_fsm_coe_dict_start(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
void ec_fsm_coe_dict_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
void ec_fsm_coe_dict_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
void ec_fsm_coe_dict_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
void ec_fsm_coe_dict_desc_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
void ec_fsm_coe_dict_desc_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
void ec_fsm_coe_dict_entry_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
void ec_fsm_coe_dict_entry_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
void ec_fsm_coe_down_start(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
void ec_fsm_coe_down_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
void ec_fsm_coe_down_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
void ec_fsm_coe_down_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
void ec_fsm_coe_up_start(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
void ec_fsm_coe_up_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
void ec_fsm_coe_up_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
void ec_fsm_coe_up_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
void ec_fsm_coe_up_seg_request(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
void ec_fsm_coe_up_seg_check(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
void ec_fsm_coe_end(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
void ec_fsm_coe_error(ec_fsm_coe_t *);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
   SDO abort messages.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
   The "abort SDO transfer request" supplies an abort code,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
   which can be translated to clear text. This table does
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
   the mapping of the codes and messages.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
const ec_code_msg_t sdo_abort_messages[] = {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
    {0x05030000, "Toggle bit not changed"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
    {0x05040000, "SDO protocol timeout"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
    {0x05040001, "Client/Server command specifier not valid or unknown"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
    {0x05040005, "Out of memory"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
    {0x06010000, "Unsupported access to an object"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
    {0x06010001, "Attempt to read a write-only object"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
    {0x06010002, "Attempt to write a read-only object"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
    {0x06020000, "This object does not exist in the object directory"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
    {0x06040041, "The object cannot be mapped into the PDO"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
    {0x06040042, "The number and length of the objects to be mapped would"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
     " exceed the PDO length"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
    {0x06040043, "General parameter incompatibility reason"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
    {0x06040047, "Gerneral internal incompatibility in device"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
    {0x06060000, "Access failure due to a hardware error"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
    {0x06070010, "Data type does not match, length of service parameter does"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
     " not match"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
    {0x06070012, "Data type does not match, length of service parameter too"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
     " high"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
    {0x06070013, "Data type does not match, length of service parameter too"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
     " low"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
    {0x06090011, "Subindex does not exist"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
    {0x06090030, "Value range of parameter exceeded"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
    {0x06090031, "Value of parameter written too high"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
    {0x06090032, "Value of parameter written too low"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
    {0x06090036, "Maximum value is less than minimum value"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
    {0x08000000, "General error"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
    {0x08000020, "Data cannot be transferred or stored to the application"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
    {0x08000021, "Data cannot be transferred or stored to the application"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
     " because of local control"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
    {0x08000022, "Data cannot be transferred or stored to the application"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
     " because of the present device state"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
    {0x08000023, "Object dictionary dynamic generation fails or no object"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
     " dictionary is present"},
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
    {}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
};
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
   Outputs an SDO abort message.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
void ec_canopen_abort_msg(uint32_t abort_code)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
    const ec_code_msg_t *abort_msg;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
    for (abort_msg = sdo_abort_messages; abort_msg->code; abort_msg++) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
        if (abort_msg->code == abort_code) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
            EC_ERR("SDO abort message 0x%08X: \"%s\".\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
                   abort_msg->code, abort_msg->message);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
    EC_ERR("Unknown SDO abort code 0x%08X.\n", abort_code);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
   Constructor.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
void ec_fsm_coe_init(ec_fsm_coe_t *fsm, /**< finite state machine */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
                     ec_datagram_t *datagram /**< datagram */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
                     )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
    fsm->state = NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
    fsm->datagram = datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
   Destructor.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
void ec_fsm_coe_clear(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
   Starts reading a slaves' SDO dictionary.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
void ec_fsm_coe_dictionary(ec_fsm_coe_t *fsm, /**< finite state machine */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
                           ec_slave_t *slave /**< EtherCAT slave */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
                           )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
    fsm->slave = slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
    fsm->state = ec_fsm_coe_dict_start;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
   Starts to download an SDO to a slave.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
void ec_fsm_coe_download(ec_fsm_coe_t *fsm, /**< finite state machine */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
                         ec_slave_t *slave, /**< EtherCAT slave */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
                         ec_sdo_data_t *sdodata /**< SDO data object */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
                         )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
    fsm->slave = slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
    fsm->sdodata = sdodata;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
    fsm->state = ec_fsm_coe_down_start;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
   Starts to upload an SDO from a slave.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
void ec_fsm_coe_upload(ec_fsm_coe_t *fsm, /**< finite state machine */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
                       ec_slave_t *slave, /**< EtherCAT slave */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
                       ec_sdo_request_t *request /**< SDO request */
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
                       )
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
    fsm->slave = slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
    fsm->request = request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
    fsm->state = ec_fsm_coe_up_start;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
   Executes the current state of the state machine.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
   \return false, if state machine has terminated
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
int ec_fsm_coe_exec(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
    fsm->state(fsm);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
    return fsm->state != ec_fsm_coe_end && fsm->state != ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
   Returns, if the state machine terminated with success.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
   \return non-zero if successful.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
int ec_fsm_coe_success(ec_fsm_coe_t *fsm /**< Finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
    return fsm->state == ec_fsm_coe_end;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
/******************************************************************************
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
 *  CoE dictionary state machine
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   240
 *****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
   CoE state: DICT START.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
void ec_fsm_coe_dict_start(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
    uint8_t *data;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
    if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
    EC_WRITE_U16(data, 0x8 << 12); // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
    EC_WRITE_U8 (data + 2, 0x01); // Get OD List Request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
    EC_WRITE_U8 (data + 3, 0x00);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
    EC_WRITE_U16(data + 4, 0x0000);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
    EC_WRITE_U16(data + 6, 0x0001); // deliver all SDOs!
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
    fsm->state = ec_fsm_coe_dict_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
   CoE state: DICT REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
void ec_fsm_coe_dict_request(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
        EC_ERR("Reception of CoE dictionary request failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
    fsm->state = ec_fsm_coe_dict_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   295
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
   CoE state: DICT CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
void ec_fsm_coe_dict_check(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
        EC_ERR("Reception of CoE mailbox check datagram failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   310
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   311
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   312
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   313
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   314
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   315
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
            EC_ERR("Timeout while checking SDO dictionary on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   319
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   320
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   326
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
    fsm->state = ec_fsm_coe_dict_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
   CoE state: DICT RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
void ec_fsm_coe_dict_response(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   339
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   341
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   342
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   343
    size_t rec_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   344
    unsigned int sdo_count, i;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   345
    uint16_t sdo_index;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   346
    ec_sdo_t *sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   347
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   348
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   349
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   350
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   351
        EC_ERR("Reception of CoE dictionary response failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   352
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   353
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   354
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   355
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   356
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   357
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   358
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   359
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   361
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   362
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   363
        EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
    if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
        (EC_READ_U8(data + 2) & 0x7F) == 0x07) { // error response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
        EC_ERR("SDO information error response at slave %i!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
        ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
    if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
        (EC_READ_U8 (data + 2) & 0x7F) != 0x02) { // Get OD List response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
        EC_ERR("Invalid SDO list response at slave %i!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
    if (rec_size < 8) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
        EC_ERR("Invalid data size!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
    sdo_count = (rec_size - 8) / 2;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
    for (i = 0; i < sdo_count; i++) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
        sdo_index = EC_READ_U16(data + 8 + i * 2);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
        if (!sdo_index) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
            if (slave->master->debug_level)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
                EC_WARN("SDO dictionary of slave %i contains index 0x0000.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
                        slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
            continue;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   404
        if (!(sdo = (ec_sdo_t *) kmalloc(sizeof(ec_sdo_t), GFP_ATOMIC))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
            EC_ERR("Failed to allocate memory for SDO!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   407
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   408
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   409
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   410
        if (ec_sdo_init(sdo, sdo_index, slave)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   411
            EC_ERR("Failed to init SDO!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   412
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   414
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   415
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
        list_add_tail(&sdo->list, &slave->sdo_dictionary);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
    if (EC_READ_U8(data + 2) & 0x80) { // more messages waiting. check again.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
        fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   422
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   423
        fsm->state = ec_fsm_coe_dict_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   424
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   425
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   426
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   427
    if (list_empty(&slave->sdo_dictionary)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   428
        // no SDOs in dictionary. finished.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   429
        fsm->state = ec_fsm_coe_end; // success
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   430
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   431
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   432
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   433
    // fetch SDO descriptions
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   434
    fsm->sdo = list_entry(slave->sdo_dictionary.next, ec_sdo_t, list);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   435
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   436
    if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   437
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   438
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   439
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   440
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   441
    EC_WRITE_U16(data, 0x8 << 12); // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   442
    EC_WRITE_U8 (data + 2, 0x03); // Get object description request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   443
    EC_WRITE_U8 (data + 3, 0x00);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   444
    EC_WRITE_U16(data + 4, 0x0000);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   445
    EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   446
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   447
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   448
    fsm->state = ec_fsm_coe_dict_desc_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   449
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   450
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   451
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   452
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   453
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   454
   CoE state: DICT DESC REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   455
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   456
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   457
void ec_fsm_coe_dict_desc_request(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   458
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   459
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   460
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   461
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   462
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   463
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   464
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   465
        EC_ERR("Reception of CoE SDO description"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   466
               " request failed on slave %i.\n", slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   467
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   468
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   469
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   470
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   471
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   472
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   473
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   474
    fsm->state = ec_fsm_coe_dict_desc_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   475
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   476
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   477
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   478
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   479
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   480
   CoE state: DICT DESC CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   481
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   482
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   483
void ec_fsm_coe_dict_desc_check(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   484
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   485
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   486
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   487
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   488
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   489
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   490
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   491
        EC_ERR("Reception of CoE mailbox check datagram failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   492
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   493
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   494
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   495
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   496
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   497
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   498
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   499
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   500
            EC_ERR("Timeout while checking SDO description on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   501
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   502
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   503
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   504
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   505
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   506
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   507
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   508
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   509
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   510
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   511
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   512
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   513
    fsm->state = ec_fsm_coe_dict_desc_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   514
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   515
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   516
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   517
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   518
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   519
   CoE state: DICT DESC RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   520
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   521
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   522
void ec_fsm_coe_dict_desc_response(ec_fsm_coe_t *fsm
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   523
                                   /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   524
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   525
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   526
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   527
    ec_sdo_t *sdo = fsm->sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   528
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   529
    size_t rec_size, name_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   530
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   531
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   532
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   533
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   534
        EC_ERR("Reception of CoE SDO description"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   535
               "response failed on slave %i.\n", slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   536
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   537
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   538
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   539
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   540
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   541
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   542
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   543
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   544
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   545
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   546
        EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   547
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   548
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   549
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   550
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   551
    if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   552
        (EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   553
        EC_ERR("SDO information error response at slave %i while"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   554
               " fetching SDO 0x%04X!\n", slave->ring_position,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   555
               sdo->index);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   556
        ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   557
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   558
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   559
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   560
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   561
    if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   562
        (EC_READ_U8 (data + 2) & 0x7F) != 0x04 || // Object desc. response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   563
        EC_READ_U16(data + 6) != sdo->index) { // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   564
        EC_ERR("Invalid object description response at slave %i while"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   565
               " fetching SDO 0x%04X!\n", slave->ring_position,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   566
               sdo->index);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   567
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   568
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   569
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   570
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   571
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   572
    if (rec_size < 12) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   573
        EC_ERR("Invalid data size!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   574
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   575
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   576
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   577
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   578
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   579
    sdo->subindices = EC_READ_U8(data + 10);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   580
    sdo->object_code = EC_READ_U8(data + 11);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   581
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   582
    name_size = rec_size - 12;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   583
    if (name_size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   584
        if (!(sdo->name = kmalloc(name_size + 1, GFP_ATOMIC))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   585
            EC_ERR("Failed to allocate SDO name!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   586
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   587
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   588
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   589
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   590
        memcpy(sdo->name, data + 12, name_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   591
        sdo->name[name_size] = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   592
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   593
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   594
    if (EC_READ_U8(data + 2) & 0x80) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   595
        EC_ERR("Fragment follows (not implemented)!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   596
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   597
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   598
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   599
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   600
    // start fetching entries
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   601
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   602
    fsm->subindex = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   603
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   604
    if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   605
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   606
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   607
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   608
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   609
    EC_WRITE_U16(data, 0x8 << 12); // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   610
    EC_WRITE_U8 (data + 2, 0x05); // Get entry description request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   611
    EC_WRITE_U8 (data + 3, 0x00);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   612
    EC_WRITE_U16(data + 4, 0x0000);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   613
    EC_WRITE_U16(data + 6, sdo->index); // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   614
    EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   615
    EC_WRITE_U8 (data + 9, 0x00); // value info (no values)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   616
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   617
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   618
    fsm->state = ec_fsm_coe_dict_entry_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   619
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   620
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   621
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   622
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   623
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   624
   CoE state: DICT ENTRY REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   625
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   626
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   627
void ec_fsm_coe_dict_entry_request(ec_fsm_coe_t *fsm
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   628
                                   /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   629
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   630
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   631
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   632
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   633
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   634
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   635
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   636
        EC_ERR("Reception of CoE SDO entry request failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   637
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   638
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   639
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   640
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   641
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   642
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   643
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   644
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   645
    fsm->state = ec_fsm_coe_dict_entry_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   646
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   647
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   648
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   649
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   650
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   651
   CoE state: DICT ENTRY CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   652
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   653
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   654
void ec_fsm_coe_dict_entry_check(ec_fsm_coe_t *fsm
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   655
                                 /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   656
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   657
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   658
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   659
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   660
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   661
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   662
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   663
        EC_ERR("Reception of CoE mailbox check datagram failed on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   664
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   665
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   666
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   667
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   668
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   669
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   670
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   671
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   672
            EC_ERR("Timeout while checking SDO entry on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   673
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   674
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   675
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   676
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   677
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   678
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   679
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   680
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   681
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   682
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   683
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   684
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   685
    fsm->state = ec_fsm_coe_dict_entry_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   686
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   687
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   688
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   689
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   690
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   691
   CoE state: DICT ENTRY RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   692
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   693
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   694
void ec_fsm_coe_dict_entry_response(ec_fsm_coe_t *fsm
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   695
                                    /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   696
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   697
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   698
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   699
    ec_sdo_t *sdo = fsm->sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   700
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   701
    size_t rec_size, data_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   702
    ec_sdo_entry_t *entry;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   703
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   704
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   705
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   706
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   707
        EC_ERR("Reception of CoE SDO description"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   708
               " response failed on slave %i.\n", slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   709
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   710
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   711
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   712
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   713
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   714
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   715
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   716
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   717
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   718
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   719
        EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   720
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   721
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   722
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   723
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   724
    if (EC_READ_U16(data) >> 12 == 0x8 && // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   725
        (EC_READ_U8 (data + 2) & 0x7F) == 0x07) { // error response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   726
        EC_ERR("SDO information error response at slave %i while"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   727
               " fetching SDO entry 0x%04X:%i!\n", slave->ring_position,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   728
               sdo->index, fsm->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   729
        ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   730
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   731
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   732
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   733
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   734
    if (EC_READ_U16(data) >> 12 != 0x8 || // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   735
        (EC_READ_U8(data + 2) & 0x7F) != 0x06 || // Entry desc. response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   736
        EC_READ_U16(data + 6) != sdo->index || // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   737
        EC_READ_U8(data + 8) != fsm->subindex) { // SDO subindex
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   738
        EC_ERR("Invalid entry description response at slave %i while"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   739
               " fetching SDO entry 0x%04X:%i!\n", slave->ring_position,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   740
               sdo->index, fsm->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   741
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   742
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   743
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   744
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   745
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   746
    if (rec_size < 16) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   747
        EC_ERR("Invalid data size!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   748
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   749
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   750
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   751
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   752
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   753
    data_size = rec_size - 16;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   754
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   755
    if (!(entry = (ec_sdo_entry_t *)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   756
          kmalloc(sizeof(ec_sdo_entry_t), GFP_ATOMIC))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   757
        EC_ERR("Failed to allocate entry!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   758
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   759
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   760
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   761
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   762
    if (ec_sdo_entry_init(entry, fsm->subindex, sdo)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   763
        EC_ERR("Failed to init entry!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   764
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   765
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   766
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   767
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   768
    entry->data_type = EC_READ_U16(data + 10);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   769
    entry->bit_length = EC_READ_U16(data + 12);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   770
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   771
    if (data_size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   772
        uint8_t *desc;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   773
        if (!(desc = kmalloc(data_size + 1, GFP_ATOMIC))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   774
            EC_ERR("Failed to allocate SDO entry name!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   775
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   776
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   777
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   778
        memcpy(desc, data + 16, data_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   779
        desc[data_size] = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   780
        entry->description = desc;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   781
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   782
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   783
    list_add_tail(&entry->list, &sdo->entries);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   784
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   785
    if (fsm->subindex < sdo->subindices) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   786
        fsm->subindex++;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   787
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   788
        if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   789
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   790
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   791
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   792
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   793
        EC_WRITE_U16(data, 0x8 << 12); // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   794
        EC_WRITE_U8 (data + 2, 0x05); // Get entry description request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   795
        EC_WRITE_U8 (data + 3, 0x00);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   796
        EC_WRITE_U16(data + 4, 0x0000);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   797
        EC_WRITE_U16(data + 6, sdo->index); // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   798
        EC_WRITE_U8 (data + 8, fsm->subindex); // SDO subindex
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   799
        EC_WRITE_U8 (data + 9, 0x00); // value info (no values)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   800
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   801
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   802
        fsm->state = ec_fsm_coe_dict_entry_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   803
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   804
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   805
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   806
    // another SDO description to fetch?
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   807
    if (fsm->sdo->list.next != &slave->sdo_dictionary) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   808
        fsm->sdo = list_entry(fsm->sdo->list.next, ec_sdo_t, list);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   809
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   810
        if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 8))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   811
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   812
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   813
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   814
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   815
        EC_WRITE_U16(data, 0x8 << 12); // SDO information
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   816
        EC_WRITE_U8 (data + 2, 0x03); // Get object description request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   817
        EC_WRITE_U8 (data + 3, 0x00);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   818
        EC_WRITE_U16(data + 4, 0x0000);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   819
        EC_WRITE_U16(data + 6, fsm->sdo->index); // SDO index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   820
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   821
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   822
        fsm->state = ec_fsm_coe_dict_desc_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   823
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   824
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   825
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   826
    fsm->state = ec_fsm_coe_end;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   827
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   828
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   829
/******************************************************************************
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   830
 *  CoE state machine
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   831
 *****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   832
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   833
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   834
   CoE state: DOWN START.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   835
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   836
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   837
void ec_fsm_coe_down_start(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   838
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   839
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   840
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   841
    ec_sdo_data_t *sdodata = fsm->sdodata;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   842
    uint8_t *data;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   843
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   844
    if (fsm->slave->master->debug_level)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   845
        EC_DBG("Downloading SDO 0x%04X:%i to slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   846
               sdodata->index, sdodata->subindex, slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   847
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   848
    if (slave->sii_rx_mailbox_size < 6 + 10 + sdodata->size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   849
        EC_ERR("SDO fragmenting not supported yet!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   850
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   851
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   852
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   853
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   854
    if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   855
                                            sdodata->size + 10))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   856
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   857
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   858
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   859
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   860
    EC_WRITE_U16(data, 0x2 << 12); // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   861
    EC_WRITE_U8 (data + 2, (0x1 // size specified
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   862
                            | 0x1 << 5)); // Download request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   863
    EC_WRITE_U16(data + 3, sdodata->index);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   864
    EC_WRITE_U8 (data + 5, sdodata->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   865
    EC_WRITE_U32(data + 6, sdodata->size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   866
    memcpy(data + 10, sdodata->data, sdodata->size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   867
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   868
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   869
    fsm->state = ec_fsm_coe_down_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   870
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   871
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   872
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   873
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   874
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   875
   CoE state: DOWN REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   876
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   877
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   878
void ec_fsm_coe_down_request(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   879
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   880
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   881
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   882
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   883
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   884
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   885
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   886
        EC_ERR("Reception of CoE download request failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   887
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   888
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   889
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   890
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   891
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   892
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   893
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   894
    fsm->state = ec_fsm_coe_down_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   895
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   896
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   897
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   898
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   899
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   900
   CoE state: DOWN CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   901
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   902
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   903
void ec_fsm_coe_down_check(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   904
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   905
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   906
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   907
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   908
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   909
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   910
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   911
        EC_ERR("Reception of CoE mailbox check datagram failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   912
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   913
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   914
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   915
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   916
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   917
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   918
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   919
            EC_ERR("Timeout while checking SDO configuration on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   920
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   921
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   922
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   923
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   924
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   925
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   926
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   927
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   928
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   929
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   930
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   931
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   932
    fsm->state = ec_fsm_coe_down_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   933
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   934
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   935
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   936
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   937
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   938
   CoE state: DOWN RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   939
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   940
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   941
void ec_fsm_coe_down_response(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   942
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   943
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   944
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   945
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   946
    size_t rec_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   947
    ec_sdo_data_t *sdodata = fsm->sdodata;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   948
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   949
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   950
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   951
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   952
        EC_ERR("Reception of CoE download response failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   953
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   954
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   955
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   956
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   957
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   958
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   959
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   960
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   961
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   962
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   963
        EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   964
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   965
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   966
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   967
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   968
    if (rec_size < 6) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   969
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   970
        EC_ERR("Received data is too small (%i bytes):\n", rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   971
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   972
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   973
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   974
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   975
    if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   976
        EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   977
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   978
        EC_ERR("SDO download 0x%04X:%X (%i bytes) aborted on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   979
               sdodata->index, sdodata->subindex, sdodata->size,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   980
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   981
        if (rec_size < 10) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   982
            EC_ERR("Incomplete Abort command:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   983
            ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   984
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   985
        else
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   986
            ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   987
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   988
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   989
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   990
    if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   991
        EC_READ_U8 (data + 2) >> 5 != 0x3 || // Download response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   992
        EC_READ_U16(data + 3) != sdodata->index || // index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   993
        EC_READ_U8 (data + 5) != sdodata->subindex) { // subindex
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   994
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   995
        EC_ERR("SDO download 0x%04X:%X (%i bytes) failed:\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   996
               sdodata->index, sdodata->subindex, sdodata->size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   997
        EC_ERR("Invalid SDO download response at slave %i!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   998
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   999
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1000
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1001
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1002
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1003
    fsm->state = ec_fsm_coe_end; // success
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1004
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1005
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1006
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1007
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1008
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1009
   CoE state: UP START.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1010
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1011
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1012
void ec_fsm_coe_up_start(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1013
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1014
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1015
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1016
    ec_master_t *master = slave->master;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1017
    ec_sdo_request_t *request = fsm->request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1018
    ec_sdo_t *sdo = request->sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1019
    ec_sdo_entry_t *entry = request->entry;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1020
    uint8_t *data;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1021
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1022
    if (master->debug_level)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1023
        EC_DBG("Uploading SDO 0x%04X:%i from slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1024
               sdo->index, entry->subindex, slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1025
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1026
    if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 10))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1027
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1028
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1029
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1030
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1031
    EC_WRITE_U16(data, 0x2 << 12); // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1032
    EC_WRITE_U8 (data + 2, 0x2 << 5); // initiate upload request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1033
    EC_WRITE_U16(data + 3, sdo->index);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1034
    EC_WRITE_U8 (data + 5, entry->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1035
    memset(data + 6, 0x00, 4);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1036
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1037
    if (master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1038
        EC_DBG("Upload request:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1039
        ec_print_data(data, 10);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1040
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1041
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1042
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1043
    fsm->state = ec_fsm_coe_up_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1044
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1045
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1046
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1047
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1048
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1049
   CoE state: UP REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1050
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1051
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1052
void ec_fsm_coe_up_request(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1053
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1054
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1055
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1056
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1057
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1058
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1059
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1060
        EC_ERR("Reception of CoE upload request failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1061
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1062
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1063
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1064
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1065
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1066
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1067
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1068
    fsm->state = ec_fsm_coe_up_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1069
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1070
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1071
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1072
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1073
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1074
   CoE state: UP CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1075
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1076
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1077
void ec_fsm_coe_up_check(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1078
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1079
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1080
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1081
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1082
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1083
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1084
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1085
        EC_ERR("Reception of CoE mailbox check datagram failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1086
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1087
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1088
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1089
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1090
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1091
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1092
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1093
            EC_ERR("Timeout while checking SDO upload on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1094
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1095
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1096
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1097
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1098
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1099
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1100
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1101
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1102
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1103
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1104
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1105
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1106
    fsm->state = ec_fsm_coe_up_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1107
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1108
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1109
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1110
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1111
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1112
   CoE state: UP RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1113
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1114
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1115
void ec_fsm_coe_up_response(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1116
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1117
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1118
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1119
    ec_master_t *master = slave->master;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1120
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1121
    size_t rec_size, data_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1122
    ec_sdo_request_t *request = fsm->request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1123
    ec_sdo_t *sdo = request->sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1124
    ec_sdo_entry_t *entry = request->entry;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1125
    uint32_t complete_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1126
    unsigned int expedited, size_specified;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1127
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1128
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1129
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1130
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1131
        EC_ERR("Reception of CoE upload response failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1132
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1133
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1134
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1135
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1136
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1137
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1138
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1139
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1140
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1141
    if (master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1142
        EC_DBG("Upload response:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1143
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1144
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1145
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1146
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1147
        EC_WARN("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1148
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1149
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1150
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1151
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1152
    if (rec_size < 10) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1153
        EC_ERR("Received currupted SDO upload response!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1154
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1155
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1156
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1157
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1158
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1159
    if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1160
        EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1161
        EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1162
               sdo->index, entry->subindex, slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1163
        ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1164
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1165
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1166
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1167
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1168
    if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1169
        EC_READ_U8 (data + 2) >> 5 != 0x2 || // upload response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1170
        EC_READ_U16(data + 3) != sdo->index || // index
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1171
        EC_READ_U8 (data + 5) != entry->subindex) { // subindex
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1172
        EC_ERR("SDO upload 0x%04X:%X failed:\n", sdo->index, entry->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1173
        EC_ERR("Invalid SDO upload response at slave %i!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1174
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1175
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1176
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1177
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1178
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1179
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1180
    data_size = rec_size - 10;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1181
    expedited = EC_READ_U8(data + 2) & 0x02;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1182
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1183
    if (expedited) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1184
        size_specified = EC_READ_U8(data + 2) & 0x01;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1185
        if (size_specified) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1186
            complete_size = 4 - ((EC_READ_U8(data + 2) & 0x0C) >> 2);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1187
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1188
        else {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1189
            complete_size = 4;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1190
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1191
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1192
    else {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1193
        complete_size = EC_READ_U32(data + 6);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1194
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1195
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1196
    if (request->data) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1197
        kfree(request->data);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1198
        request->data = NULL;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1199
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1200
    request->size = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1201
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1202
    if (complete_size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1203
        if (!(request->data = (uint8_t *)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1204
              kmalloc(complete_size + 1, GFP_ATOMIC))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1205
            EC_ERR("Failed to allocate %i bytes of SDO data!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1206
                   complete_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1207
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1208
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1209
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1210
        request->data[complete_size] = 0x00; // just to be sure...
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1211
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1212
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1213
    if (expedited) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1214
        memcpy(request->data, data + 6, complete_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1215
        request->size = complete_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1216
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1217
    else {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1218
        memcpy(request->data, data + 10, data_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1219
        request->size = data_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1220
        fsm->toggle = 0;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1221
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1222
        if (data_size < complete_size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1223
            EC_WARN("SDO data incomplete (%i / %i).\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1224
                    data_size, complete_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1225
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1226
            if (!(data = ec_slave_mbox_prepare_send(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1227
                                                    0x03, 3))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1228
                fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1229
                return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1230
            }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1231
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1232
            EC_WRITE_U16(data, 0x2 << 12); // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1233
            EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1234
                                    | 0x3 << 5)); // upload segment request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1235
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1236
            if (master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1237
                EC_DBG("Upload segment request:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1238
                ec_print_data(data, 3);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1239
            }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1240
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1241
            ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1242
            fsm->state = ec_fsm_coe_up_seg_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1243
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1244
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1245
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1246
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1247
    fsm->state = ec_fsm_coe_end; // success
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1248
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1249
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1250
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1251
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1252
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1253
   CoE state: UP REQUEST.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1254
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1255
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1256
void ec_fsm_coe_up_seg_request(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1257
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1258
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1259
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1260
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1261
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1262
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1263
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1264
        EC_ERR("Reception of CoE upload segment request failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1265
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1266
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1267
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1268
    fsm->cycles_start = datagram->cycles_sent;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1269
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1270
    ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1271
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1272
    fsm->state = ec_fsm_coe_up_seg_check;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1273
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1274
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1275
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1276
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1277
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1278
   CoE state: UP CHECK.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1279
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1280
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1281
void ec_fsm_coe_up_seg_check(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1282
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1283
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1284
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1285
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1286
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1287
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1288
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1289
        EC_ERR("Reception of CoE mailbox check datagram failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1290
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1291
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1292
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1293
    if (!ec_slave_mbox_check(datagram)) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1294
        if (datagram->cycles_received
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1295
            - fsm->cycles_start >= (cycles_t) 100 * cpu_khz) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1296
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1297
            EC_ERR("Timeout while checking SDO upload segment on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1298
                   slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1299
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1300
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1301
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1302
        ec_slave_mbox_prepare_check(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1303
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1304
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1305
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1306
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1307
    // Fetch response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1308
    ec_slave_mbox_prepare_fetch(slave, datagram); // can not fail.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1309
    ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1310
    fsm->state = ec_fsm_coe_up_seg_response;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1311
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1312
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1313
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1314
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1315
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1316
   CoE state: UP RESPONSE.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1317
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1318
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1319
void ec_fsm_coe_up_seg_response(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1320
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1321
    ec_datagram_t *datagram = fsm->datagram;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1322
    ec_slave_t *slave = fsm->slave;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1323
    ec_master_t *master = slave->master;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1324
    uint8_t *data, mbox_prot;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1325
    size_t rec_size, data_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1326
    ec_sdo_request_t *request = fsm->request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1327
    ec_sdo_t *sdo = request->sdo;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1328
    ec_sdo_entry_t *entry = request->entry;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1329
    uint32_t seg_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1330
    unsigned int last_segment;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1331
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1332
    if (datagram->state != EC_DATAGRAM_RECEIVED
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1333
        || datagram->working_counter != 1) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1334
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1335
        EC_ERR("Reception of CoE upload segment response failed.\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1336
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1337
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1338
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1339
    if (!(data = ec_slave_mbox_fetch(slave, datagram,
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1340
				     &mbox_prot, &rec_size))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1341
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1342
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1343
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1344
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1345
    if (master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1346
        EC_DBG("Upload segment response:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1347
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1348
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1349
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1350
    if (mbox_prot != 0x03) { // CoE
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1351
        EC_ERR("Received mailbox protocol 0x%02X as response.\n", mbox_prot);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1352
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1353
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1354
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1355
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1356
    if (rec_size < 10) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1357
        EC_ERR("Received currupted SDO upload segment response!\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1358
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1359
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1360
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1361
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1362
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1363
    if (EC_READ_U16(data) >> 12 == 0x2 && // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1364
        EC_READ_U8 (data + 2) >> 5 == 0x4) { // abort SDO transfer request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1365
        EC_ERR("SDO upload 0x%04X:%X aborted on slave %i.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1366
               sdo->index, entry->subindex, slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1367
        ec_canopen_abort_msg(EC_READ_U32(data + 6));
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1368
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1369
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1370
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1371
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1372
    if (EC_READ_U16(data) >> 12 != 0x3 || // SDO response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1373
        EC_READ_U8 (data + 2) >> 5 != 0x0) { // upload segment response
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1374
        EC_ERR("SDO upload 0x%04X:%X failed:\n", sdo->index, entry->subindex);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1375
        EC_ERR("Invalid SDO upload segment response at slave %i!\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1376
               slave->ring_position);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1377
        ec_print_data(data, rec_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1378
        fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1379
	return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1380
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1381
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1382
    last_segment = EC_READ_U8(data + 2) & 0x01;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1383
    seg_size = (EC_READ_U8(data + 2) & 0xE) >> 1;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1384
    data_size = rec_size - 10;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1385
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1386
    if (data_size != seg_size) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1387
        EC_WARN("SDO segment data invalid (%i / %i)"
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1388
                " - Fragmenting not implemented.\n",
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1389
                data_size, seg_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1390
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1391
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1392
    memcpy(request->data + request->size, data + 10, data_size);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1393
    request->size += data_size;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1394
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1395
    if (!last_segment) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1396
        fsm->toggle = !fsm->toggle;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1397
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1398
        if (!(data = ec_slave_mbox_prepare_send(slave, datagram, 0x03, 3))) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1399
            fsm->state = ec_fsm_coe_error;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1400
            return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1401
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1402
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1403
        EC_WRITE_U16(data, 0x2 << 12); // SDO request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1404
        EC_WRITE_U8 (data + 2, (fsm->toggle << 4 // toggle
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1405
                                | 0x3 << 5)); // upload segment request
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1406
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1407
        if (master->debug_level) {
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1408
            EC_DBG("Upload segment request:\n");
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1409
            ec_print_data(data, 3);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1410
        }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1411
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1412
        ec_master_queue_datagram(fsm->slave->master, datagram);
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1413
        fsm->state = ec_fsm_coe_up_seg_request;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1414
        return;
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1415
    }
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1416
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1417
    fsm->state = ec_fsm_coe_end; // success
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1418
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1419
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1420
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1421
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1422
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1423
   State: ERROR.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1424
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1425
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1426
void ec_fsm_coe_error(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1427
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1428
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1429
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1430
/*****************************************************************************/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1431
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1432
/**
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1433
   State: END.
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1434
*/
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1435
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1436
void ec_fsm_coe_end(ec_fsm_coe_t *fsm /**< finite state machine */)
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1437
{
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1438
}
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1439
1cc865ba17c2 MERGE trunk -r588:681 -> branches/stable-1.1 (Bugfixes, Ack behaviour, CoE via Sysfs, PDO ranges, 2.6.17 support, improved autotools, documentation)
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
  1440
/*****************************************************************************/