master/fsm_coe_map.c
author Florian Pose <fp@igh-essen.com>
Thu, 20 Sep 2007 10:05:37 +0000
changeset 745 3f4e5a50733e
parent 741 aece53f82df3
child 749 c8f1395f818a
permissions -rw-r--r--
Minor: Moved setting of alternate PDO mapping flag.
741
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id: fsm_coe.c 920 2007-09-12 10:07:55Z fp $
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT CoE mapping state machines.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#include "globals.h"
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#include "master.h"
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
#include "mailbox.h"
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include "canopen.h"
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
#include "fsm_coe_map.h"
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
void ec_fsm_coe_map_state_start(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
void ec_fsm_coe_map_state_pdo_count(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
void ec_fsm_coe_map_state_pdo(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
void ec_fsm_coe_map_state_pdo_entry_count(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
void ec_fsm_coe_map_state_pdo_entry(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
void ec_fsm_coe_map_state_end(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
void ec_fsm_coe_map_state_error(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
void ec_fsm_coe_map_action_next_sync(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
void ec_fsm_coe_map_action_next_pdo(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    60
void ec_fsm_coe_map_action_next_pdo_entry(ec_fsm_coe_map_t *);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
   Constructor.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
void ec_fsm_coe_map_init(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    69
        ec_fsm_coe_map_t *fsm, /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    70
        ec_fsm_coe_t *fsm_coe /*< CoE state machine to use */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
    fsm->state = NULL;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    74
    fsm->fsm_coe = fsm_coe;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    75
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    76
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    77
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    78
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    79
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    80
   Destructor.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    81
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    82
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    83
void ec_fsm_coe_map_clear(ec_fsm_coe_map_t *fsm /**< finite state machine */)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    84
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    85
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    86
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    87
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    88
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    89
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    90
   Starts to upload an SDO from a slave.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    91
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    92
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    93
void ec_fsm_coe_map_start(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    94
        ec_fsm_coe_map_t *fsm, /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    95
        ec_slave_t *slave /**< EtherCAT slave */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    96
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    97
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    98
    fsm->slave = slave;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    99
    fsm->state = ec_fsm_coe_map_state_start;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   100
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   101
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   102
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   103
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   104
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   105
   Executes the current state of the state machine.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   106
   \return false, if state machine has terminated
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   107
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   108
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   109
int ec_fsm_coe_map_exec(ec_fsm_coe_map_t *fsm /**< finite state machine */)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   110
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   111
    fsm->state(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   112
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   113
    return fsm->state != ec_fsm_coe_map_state_end
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   114
        && fsm->state != ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   115
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   116
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   117
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   118
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   119
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   120
   Returns, if the state machine terminated with success.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   121
   \return non-zero if successful.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   122
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   123
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   124
int ec_fsm_coe_map_success(ec_fsm_coe_map_t *fsm /**< Finite state machine */)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   125
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   126
    return fsm->state == ec_fsm_coe_map_state_end;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   127
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   128
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   129
/******************************************************************************
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   130
 *  CoE dictionary state machine
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   131
 *****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   132
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   133
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   134
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   135
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   136
void ec_fsm_coe_map_state_start(ec_fsm_coe_map_t *fsm /**< finite state machine */)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   137
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   138
    // read mapping of first sync manager
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   139
    fsm->sync_index = 0;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   140
    ec_fsm_coe_map_action_next_sync(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   141
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   142
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   143
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   144
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   145
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   146
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   147
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   148
void ec_fsm_coe_map_action_next_sync(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   149
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   150
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   151
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   152
    ec_slave_t *slave = fsm->slave;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   153
    ec_sdo_entry_t *entry;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   154
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   155
    for (; fsm->sync_index < 4; fsm->sync_index++) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   156
        if (!(fsm->sync_sdo = ec_slave_get_sdo(slave, 0x1C10 + fsm->sync_index)))
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   157
            continue;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   158
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   159
        if (slave->master->debug_level)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   160
            EC_DBG("Reading PDO mapping of sync manager %u of slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   161
                    fsm->sync_index, slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   162
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   163
        if (!(entry = ec_sdo_get_entry(fsm->sync_sdo, 0))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   164
            EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   165
                    fsm->sync_sdo->index,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   166
                    fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   167
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   168
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   169
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   170
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   171
        ec_sdo_request_init_read(&fsm->request, entry);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   172
        fsm->state = ec_fsm_coe_map_state_pdo_count;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   173
        ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   174
        ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   175
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   176
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   177
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   178
    fsm->state = ec_fsm_coe_map_state_end;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   179
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   180
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   181
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   182
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   183
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   184
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   185
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   186
void ec_fsm_coe_map_state_pdo_count(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   187
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   188
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   189
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   190
    if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   191
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   192
    if (!ec_fsm_coe_success(fsm->fsm_coe)) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   193
        EC_ERR("Failed to read number of mapped PDOs from slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   194
                fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   195
        fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   196
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   197
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   198
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   199
    fsm->sync_subindices = EC_READ_U8(fsm->request.data);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   200
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   201
    if (fsm->slave->master->debug_level)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   202
        EC_DBG("  %u PDOs mapped.\n", fsm->sync_subindices);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   203
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   204
    // read first PDO
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   205
    fsm->sync_subindex = 1;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   206
    ec_fsm_coe_map_action_next_pdo(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   207
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   208
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   209
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   210
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   211
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   212
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   213
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   214
void ec_fsm_coe_map_action_next_pdo(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   215
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   216
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   217
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   218
    ec_sdo_entry_t *entry;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   219
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   220
    if (fsm->sync_subindex <= fsm->sync_subindices) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   221
        if (!(entry = ec_sdo_get_entry(fsm->sync_sdo,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   222
                        fsm->sync_subindex))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   223
            EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   224
                    fsm->sync_sdo->index,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   225
                    fsm->sync_subindex,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   226
                    fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   227
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   228
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   229
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   230
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   231
        ec_sdo_request_init_read(&fsm->request, entry);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   232
        fsm->state = ec_fsm_coe_map_state_pdo;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   233
        ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   234
        ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   235
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   236
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   237
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   238
    // next sync manager
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   239
    fsm->sync_index++;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   240
    ec_fsm_coe_map_action_next_sync(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   241
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   242
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   243
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   244
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   245
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   246
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   247
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   248
void ec_fsm_coe_map_state_pdo(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   249
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   250
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   251
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   252
    if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   253
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   254
    if (!ec_fsm_coe_success(fsm->fsm_coe)) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   255
        EC_ERR("Failed to read mapped PDO index from slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   256
                fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   257
        fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   258
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   259
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   260
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   261
    {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   262
        uint16_t pdo_index = EC_READ_U16(fsm->request.data);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   263
        ec_sdo_entry_t *entry;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   264
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   265
        if (fsm->slave->master->debug_level)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   266
            EC_DBG("  PDO 0x%04X.\n", pdo_index);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   267
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   268
        if (!(fsm->pdo_sdo = ec_slave_get_sdo(fsm->slave, pdo_index))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   269
            EC_ERR("Slave %u has no SDO 0x%04X.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   270
                    fsm->slave->ring_position, pdo_index);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   271
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   272
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   273
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   274
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   275
        if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo, 0))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   276
            EC_ERR("SDO 0x%04X has no subindex 0 on slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   277
                    fsm->pdo_sdo->index,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   278
                    fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   279
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   280
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   281
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   282
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   283
        ec_sdo_request_init_read(&fsm->request, entry);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   284
        fsm->state = ec_fsm_coe_map_state_pdo_entry_count;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   285
        ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   286
        ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   287
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   288
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   289
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   290
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   291
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   292
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   293
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   294
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   295
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   296
void ec_fsm_coe_map_state_pdo_entry_count(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   297
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   298
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   299
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   300
    if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   301
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   302
    if (!ec_fsm_coe_success(fsm->fsm_coe)) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   303
        EC_ERR("Failed to read number of mapped PDO entries from slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   304
                fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   305
        fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   306
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   307
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   308
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   309
    fsm->pdo_subindices = EC_READ_U8(fsm->request.data);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   310
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   311
    if (fsm->slave->master->debug_level)
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   312
        EC_DBG("    %u PDO entries mapped.\n", fsm->pdo_subindices);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   313
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   314
    // read first PDO entry
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   315
    fsm->pdo_subindex = 1;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   316
    ec_fsm_coe_map_action_next_pdo_entry(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   317
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   318
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   319
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   320
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   321
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   322
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   323
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   324
void ec_fsm_coe_map_action_next_pdo_entry(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   325
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   326
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   327
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   328
    ec_sdo_entry_t *entry;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   329
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   330
    if (fsm->pdo_subindex <= fsm->pdo_subindices) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   331
        if (!(entry = ec_sdo_get_entry(fsm->pdo_sdo,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   332
                        fsm->pdo_subindex))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   333
            EC_ERR("SDO 0x%04X has no subindex %u on slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   334
                    fsm->pdo_sdo->index, fsm->pdo_subindex,
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   335
                    fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   336
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   337
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   338
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   339
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   340
        ec_sdo_request_init_read(&fsm->request, entry);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   341
        fsm->state = ec_fsm_coe_map_state_pdo_entry;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   342
        ec_fsm_coe_upload(fsm->fsm_coe, fsm->slave, &fsm->request);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   343
        ec_fsm_coe_exec(fsm->fsm_coe); // execute immediately
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   344
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   345
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   346
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   347
    // next PDO
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   348
    fsm->sync_subindex++;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   349
    ec_fsm_coe_map_action_next_pdo(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   350
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   351
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   352
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   353
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   354
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   355
 */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   356
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   357
void ec_fsm_coe_map_state_pdo_entry(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   358
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   359
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   360
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   361
    if (ec_fsm_coe_exec(fsm->fsm_coe)) return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   362
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   363
    if (!ec_fsm_coe_success(fsm->fsm_coe)) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   364
        EC_ERR("Failed to read index of mapped PDO entry from slave %u.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   365
                fsm->slave->ring_position);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   366
        fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   367
        return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   368
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   369
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   370
    {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   371
        uint32_t pdo_entry_info;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   372
        uint16_t pdo_entry_index;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   373
        ec_sdo_t *sdo;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   374
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   375
        pdo_entry_info = EC_READ_U32(fsm->request.data);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   376
        pdo_entry_index = pdo_entry_info >> 16;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   377
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   378
        if (!(sdo = ec_slave_get_sdo(fsm->slave, pdo_entry_index))) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   379
            EC_ERR("Slave %u has no SDO 0x%04X.\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   380
                    fsm->slave->ring_position, pdo_entry_index);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   381
            fsm->state = ec_fsm_coe_map_state_error;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   382
            return;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   383
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   384
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   385
        if (fsm->slave->master->debug_level) {
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   386
            size_t bitsize = pdo_entry_info & 0xFFFF;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   387
            EC_DBG("    PDO entry 0x%04X \"%s\" (%u bit).\n",
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   388
                    pdo_entry_index, sdo->name, bitsize);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   389
        }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   390
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   391
        // next PDO entry
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   392
        fsm->pdo_subindex++;
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   393
        ec_fsm_coe_map_action_next_pdo_entry(fsm);
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   394
    }
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   395
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   396
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   397
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   398
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   399
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   400
   State: ERROR.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   401
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   402
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   403
void ec_fsm_coe_map_state_error(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   404
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   405
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   406
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   407
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   408
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   409
/*****************************************************************************/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   410
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   411
/**
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   412
   State: END.
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   413
*/
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   414
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   415
void ec_fsm_coe_map_state_end(
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   416
        ec_fsm_coe_map_t *fsm /**< finite state machine */
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   417
        )
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   418
{
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   419
}
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   420
aece53f82df3 Read PDO mapping from SDO dictionary (working, not finished yet).
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
   421
/*****************************************************************************/