master/xmldev.h
author Florian Pose <fp@igh-essen.com>
Tue, 24 Oct 2006 10:37:05 +0000
changeset 439 0f5a3d983908
parent 362 ae38aeb6fde9
child 758 8fa6f825eb7d
permissions -rw-r--r--
Increased state change checking timeout to 1s.
361
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     1
/******************************************************************************
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     2
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     3
 *  $Id$
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     4
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     5
 *  Copyright (C) 2006  Florian Pose, Ingenieurgemeinschaft IgH
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     6
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     7
 *  This file is part of the IgH EtherCAT Master.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     8
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
     9
 *  The IgH EtherCAT Master is free software; you can redistribute it
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    10
 *  and/or modify it under the terms of the GNU General Public License
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    11
 *  as published by the Free Software Foundation; either version 2 of the
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    12
 *  License, or (at your option) any later version.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    13
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    14
 *  The IgH EtherCAT Master is distributed in the hope that it will be
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    15
 *  useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    16
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    17
 *  GNU General Public License for more details.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    18
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    19
 *  You should have received a copy of the GNU General Public License
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    20
 *  along with the IgH EtherCAT Master; if not, write to the Free Software
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    21
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    22
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    23
 *  The right to use EtherCAT Technology is granted and comes free of
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    24
 *  charge under condition of compatibility of product made by
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    25
 *  Licensee. People intending to distribute/sell products based on the
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    26
 *  code, have to sign an agreement to guarantee that products using
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    27
 *  software based on IgH EtherCAT master stay compatible with the actual
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    28
 *  EtherCAT specification (which are released themselves as an open
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    29
 *  standard) as the (only) precondition to have the right to use EtherCAT
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    30
 *  Technology, IP and trade marks.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    31
 *
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    32
 *****************************************************************************/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    33
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    34
/**
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    35
   \file
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    36
   EtherCAT XML device.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    37
*/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    38
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    39
/*****************************************************************************/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    40
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    41
#ifndef _EC_XMLDEV_H_
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    42
#define _EC_XMLDEV_H_
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    43
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    44
#include <linux/fs.h>
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    45
#include <linux/cdev.h>
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    46
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    47
#include "globals.h"
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    48
#include "../include/ecrt.h"
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    49
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    50
/*****************************************************************************/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    51
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    52
/**
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    53
   EtherCAT XML character device.
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    54
*/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    55
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    56
typedef struct
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    57
{
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    58
    ec_master_t *master; /**< master owning the device */
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    59
    struct cdev cdev; /**< character device */
362
ae38aeb6fde9 Allow only one open() on XML device.
Florian Pose <fp@igh-essen.com>
parents: 361
diff changeset
    60
    atomic_t available; /**< allow only one open() */
361
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    61
}
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    62
ec_xmldev_t;
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    63
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    64
/*****************************************************************************/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    65
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    66
int ec_xmldev_init(ec_xmldev_t *, ec_master_t *, dev_t);
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    67
void ec_xmldev_clear(ec_xmldev_t *);
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    68
362
ae38aeb6fde9 Allow only one open() on XML device.
Florian Pose <fp@igh-essen.com>
parents: 361
diff changeset
    69
int ec_xmldev_request(ec_xmldev_t *, uint32_t, uint32_t);
ae38aeb6fde9 Allow only one open() on XML device.
Florian Pose <fp@igh-essen.com>
parents: 361
diff changeset
    70
361
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    71
/*****************************************************************************/
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    72
29af81543ce1 Introduced per-master character devices for XML descriptions.
Florian Pose <fp@igh-essen.com>
parents:
diff changeset
    73
#endif