Doxygen added interface modules and file documentation.
This commit is contained in:
parent
0cd13361e7
commit
42fca68ae7
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* 8 1 3 9 t o o . c
|
||||
*
|
||||
* EtherCAT driver for RTL8139-compatible NICs.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,7 +21,16 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT driver for RTL8139-compatible NICs.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/*
|
||||
Former documentation:
|
||||
|
||||
8139too.c: A RealTek RTL-8139 Fast Ethernet driver for Linux.
|
||||
|
||||
Maintained by Jeff Garzik <jgarzik@pobox.com>
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* EtherCAT interface for EtherCAT device drivers.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -23,6 +21,22 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT interface for EtherCAT device drivers.
|
||||
*/
|
||||
|
||||
/**
|
||||
\defgroup DeviceInterface EtherCAT device interface
|
||||
Master interface for EtherCAT-capable network device drivers.
|
||||
Through the EtherCAT device interface, EtherCAT-capable network device
|
||||
drivers are able to connect their device(s) to the master, pass received
|
||||
frames and notify the master about status changes. The master on his part,
|
||||
can send his frames through connected devices.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _ETHERCAT_DEVICE_H_
|
||||
#define _ETHERCAT_DEVICE_H_
|
||||
|
||||
|
|
|
|||
188
include/ecrt.h
188
include/ecrt.h
|
|
@ -1,6 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* EtherCAT realtime interface.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -23,6 +21,21 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT realtime interface.
|
||||
*/
|
||||
|
||||
/**
|
||||
\defgroup RealtimeInterface EtherCAT realtime interface
|
||||
EtherCAT interface for realtime modules.
|
||||
This interface is designed for realtime modules that want to use EtherCAT.
|
||||
There are functions to request a master, to map process data, to communicate
|
||||
with slaves via CoE and to configure and activate the bus.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef __ECRT_H__
|
||||
#define __ECRT_H__
|
||||
|
||||
|
|
@ -57,14 +70,16 @@ typedef struct
|
|||
}
|
||||
ec_field_init_t;
|
||||
|
||||
/*****************************************************************************/
|
||||
// Master request functions
|
||||
/******************************************************************************
|
||||
* Master request functions
|
||||
*****************************************************************************/
|
||||
|
||||
ec_master_t *ecrt_request_master(unsigned int master_index);
|
||||
void ecrt_release_master(ec_master_t *master);
|
||||
|
||||
/*****************************************************************************/
|
||||
// Master methods
|
||||
/******************************************************************************
|
||||
* Master methods
|
||||
*****************************************************************************/
|
||||
|
||||
ec_domain_t *ecrt_master_create_domain(ec_master_t *master);
|
||||
|
||||
|
|
@ -85,8 +100,9 @@ void ecrt_master_print(const ec_master_t *master, unsigned int verbosity);
|
|||
|
||||
ec_slave_t *ecrt_master_get_slave(const ec_master_t *, const char *);
|
||||
|
||||
/*****************************************************************************/
|
||||
// Domain Methods
|
||||
/******************************************************************************
|
||||
* Domain Methods
|
||||
*****************************************************************************/
|
||||
|
||||
ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
|
||||
const char *address,
|
||||
|
|
@ -103,8 +119,9 @@ void ecrt_domain_process(ec_domain_t *domain);
|
|||
|
||||
int ecrt_domain_state(ec_domain_t *domain);
|
||||
|
||||
/*****************************************************************************/
|
||||
// Slave Methods
|
||||
/******************************************************************************
|
||||
* Slave Methods
|
||||
*****************************************************************************/
|
||||
|
||||
int ecrt_slave_sdo_read_exp8(ec_slave_t *slave, uint16_t sdo_index,
|
||||
uint8_t sdo_subindex, uint8_t *value);
|
||||
|
|
@ -123,54 +140,151 @@ int ecrt_slave_sdo_read(ec_slave_t *slave, uint16_t sdo_index,
|
|||
|
||||
int ecrt_slave_write_alias(ec_slave_t *slave, uint16_t alias);
|
||||
|
||||
/*****************************************************************************/
|
||||
// Bitwise read/write macros
|
||||
/******************************************************************************
|
||||
* Bitwise read/write macros
|
||||
*****************************************************************************/
|
||||
|
||||
#define EC_READ_BIT(PD, CH) ((*((uint8_t *) (PD)) >> (CH)) & 0x01)
|
||||
/**
|
||||
Read a certain bit of an EtherCAT data byte.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param POS bit position
|
||||
*/
|
||||
|
||||
#define EC_WRITE_BIT(PD, CH, VAL) \
|
||||
#define EC_READ_BIT(DATA, POS) ((*((uint8_t *) (DATA)) >> (POS)) & 0x01)
|
||||
|
||||
/**
|
||||
Write a certain bit of an EtherCAT data byte.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param POS bit position
|
||||
\param VAL new bit value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_BIT(DATA, POS, VAL) \
|
||||
do { \
|
||||
if (VAL) *((uint8_t *) (PD)) |= (1 << (CH)); \
|
||||
else *((uint8_t *) (PD)) &= ~(1 << (CH)); \
|
||||
if (VAL) *((uint8_t *) (DATA)) |= (1 << (POS)); \
|
||||
else *((uint8_t *) (DATA)) &= ~(1 << (POS)); \
|
||||
} while (0)
|
||||
|
||||
/*****************************************************************************/
|
||||
// Read macros
|
||||
/******************************************************************************
|
||||
* Read macros
|
||||
*****************************************************************************/
|
||||
|
||||
#define EC_READ_U8(PD) ((uint8_t) *((uint8_t *) (PD)))
|
||||
#define EC_READ_S8(PD) ((int8_t) *((uint8_t *) (PD)))
|
||||
/**
|
||||
Read an 8-bit unsigned value from EtherCAT data.
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
#define EC_READ_U16(PD) ((uint16_t) le16_to_cpup((void *) (PD)))
|
||||
#define EC_READ_S16(PD) ((int16_t) le16_to_cpup((void *) (PD)))
|
||||
#define EC_READ_U8(DATA) \
|
||||
((uint8_t) *((uint8_t *) (DATA)))
|
||||
|
||||
#define EC_READ_U32(PD) ((uint32_t) le32_to_cpup((void *) (PD)))
|
||||
#define EC_READ_S32(PD) ((int32_t) le32_to_cpup((void *) (PD)))
|
||||
/**
|
||||
Read an 8-bit signed value from EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
// Write macros
|
||||
#define EC_READ_S8(DATA) \
|
||||
((int8_t) *((uint8_t *) (DATA)))
|
||||
|
||||
#define EC_WRITE_U8(PD, VAL) \
|
||||
/**
|
||||
Read a 16-bit unsigned value from EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
#define EC_READ_U16(DATA) \
|
||||
((uint16_t) le16_to_cpup((void *) (DATA)))
|
||||
|
||||
/**
|
||||
Read a 16-bit signed value from EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
#define EC_READ_S16(DATA) \
|
||||
((int16_t) le16_to_cpup((void *) (DATA)))
|
||||
|
||||
/**
|
||||
Read a 32-bit unsigned value from EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
#define EC_READ_U32(DATA) \
|
||||
((uint32_t) le32_to_cpup((void *) (DATA)))
|
||||
|
||||
/**
|
||||
Read a 32-bit signed value from EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\return EtherCAT data value
|
||||
*/
|
||||
|
||||
#define EC_READ_S32(DATA) \
|
||||
((int32_t) le32_to_cpup((void *) (DATA)))
|
||||
|
||||
|
||||
/******************************************************************************
|
||||
* Write macros
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
Write an 8-bit unsigned value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_U8(DATA, VAL) \
|
||||
do { \
|
||||
*((uint8_t *)(PD)) = ((uint8_t) (VAL)); \
|
||||
*((uint8_t *)(DATA)) = ((uint8_t) (VAL)); \
|
||||
} while (0)
|
||||
|
||||
#define EC_WRITE_S8(PD, VAL) EC_WRITE_U8(PD, VAL)
|
||||
/**
|
||||
Write an 8-bit signed value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_U16(PD, VAL) \
|
||||
#define EC_WRITE_S8(DATA, VAL) EC_WRITE_U8(DATA, VAL)
|
||||
|
||||
/**
|
||||
Write a 16-bit unsigned value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_U16(DATA, VAL) \
|
||||
do { \
|
||||
*((uint16_t *) (PD)) = (uint16_t) (VAL); \
|
||||
cpu_to_le16s(PD); \
|
||||
*((uint16_t *) (DATA)) = (uint16_t) (VAL); \
|
||||
cpu_to_le16s(DATA); \
|
||||
} while (0)
|
||||
|
||||
#define EC_WRITE_S16(PD, VAL) EC_WRITE_U16(PD, VAL)
|
||||
/**
|
||||
Write a 16-bit signed value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_U32(PD, VAL) \
|
||||
#define EC_WRITE_S16(DATA, VAL) EC_WRITE_U16(DATA, VAL)
|
||||
|
||||
/**
|
||||
Write a 32-bit unsigned value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_U32(DATA, VAL) \
|
||||
do { \
|
||||
*((uint32_t *) (PD)) = (uint32_t) (VAL); \
|
||||
cpu_to_le16s(PD); \
|
||||
*((uint32_t *) (DATA)) = (uint32_t) (VAL); \
|
||||
cpu_to_le16s(DATA); \
|
||||
} while (0)
|
||||
|
||||
#define EC_WRITE_S32(PD, VAL) EC_WRITE_U32(PD, VAL)
|
||||
/**
|
||||
Write a 32-bit signed value to EtherCAT data.
|
||||
\param DATA EtherCAT data pointer
|
||||
\param VAL new value
|
||||
*/
|
||||
|
||||
#define EC_WRITE_S32(DATA, VAL) EC_WRITE_U32(DATA, VAL)
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* c a n o p e n . c
|
||||
*
|
||||
* CANopen over EtherCAT
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Canopen-over-EtherCAT functions.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/delay.h>
|
||||
#include <linux/slab.h>
|
||||
#include <linux/module.h>
|
||||
|
|
@ -47,7 +50,6 @@ const ec_code_msg_t sdo_abort_messages[];
|
|||
/**
|
||||
Reads 32 bit of a CANopen SDO in expedited mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_sdo_read_exp(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -97,7 +99,6 @@ int ec_slave_sdo_read_exp(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Writes a CANopen SDO using expedited mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_sdo_write_exp(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -157,8 +158,8 @@ int ec_slave_sdo_write_exp(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Reads a CANopen SDO in normal mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\todo size
|
||||
\ingroup RealtimeInterface
|
||||
\todo Make size non-pointer.
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_read(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -228,7 +229,6 @@ int ecrt_slave_sdo_read(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Fetches the SDO dictionary of a slave.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_sdo_list(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -311,7 +311,6 @@ int ec_slave_fetch_sdo_list(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
/**
|
||||
Fetches the SDO descriptions for the known SDOs.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_sdo_descriptions(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -390,7 +389,6 @@ int ec_slave_fetch_sdo_descriptions(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
/**
|
||||
Fetches all entries (subindices) to an SDO.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_sdo_entries(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -538,7 +536,7 @@ const ec_code_msg_t sdo_abort_messages[] = {
|
|||
Reads an 8-bit SDO in expedited mode.
|
||||
See ec_slave_sdo_read_exp()
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_read_exp8(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -559,7 +557,7 @@ int ecrt_slave_sdo_read_exp8(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
Reads a 16-bit SDO in expedited mode.
|
||||
See ec_slave_sdo_read_exp()
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_read_exp16(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -580,7 +578,7 @@ int ecrt_slave_sdo_read_exp16(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
Reads a 32-bit SDO in expedited mode.
|
||||
See ec_slave_sdo_read_exp()
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_read_exp32(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -600,7 +598,7 @@ int ecrt_slave_sdo_read_exp32(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Writes an 8-bit SDO in expedited mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_write_exp8(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -617,7 +615,7 @@ int ecrt_slave_sdo_write_exp8(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Writes a 16-bit SDO in expedited mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_write_exp16(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -636,7 +634,7 @@ int ecrt_slave_sdo_write_exp16(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Writes a 32-bit SDO in expedited mode.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_sdo_write_exp32(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -652,6 +650,8 @@ int ecrt_slave_sdo_write_exp32(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EXPORT_SYMBOL(ecrt_slave_sdo_read_exp8);
|
||||
EXPORT_SYMBOL(ecrt_slave_sdo_read_exp16);
|
||||
EXPORT_SYMBOL(ecrt_slave_sdo_read_exp32);
|
||||
|
|
@ -660,4 +660,6 @@ EXPORT_SYMBOL(ecrt_slave_sdo_write_exp16);
|
|||
EXPORT_SYMBOL(ecrt_slave_sdo_write_exp32);
|
||||
EXPORT_SYMBOL(ecrt_slave_sdo_read);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* c o m m a n d . c
|
||||
*
|
||||
* Methods of an EtherCAT command.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Methods of an EtherCAT command.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
|
|
@ -33,6 +36,8 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
#define EC_FUNC_HEADER \
|
||||
if (unlikely(ec_command_prealloc(command, data_size))) \
|
||||
return -1; \
|
||||
|
|
@ -45,11 +50,12 @@
|
|||
memset(command->data, 0x00, data_size); \
|
||||
return 0;
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Command constructor.
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
void ec_command_init(ec_command_t *command /**< EtherCAT command */)
|
||||
|
|
@ -68,7 +74,6 @@ void ec_command_init(ec_command_t *command /**< EtherCAT command */)
|
|||
|
||||
/**
|
||||
Command destructor.
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
void ec_command_clear(ec_command_t *command /**< EtherCAT command */)
|
||||
|
|
@ -82,7 +87,6 @@ void ec_command_clear(ec_command_t *command /**< EtherCAT command */)
|
|||
Allocates command data memory.
|
||||
If the allocated memory is already larger than requested, nothing ist done.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_prealloc(ec_command_t *command, /**< EtherCAT command */
|
||||
|
|
@ -112,7 +116,6 @@ int ec_command_prealloc(ec_command_t *command, /**< EtherCAT command */
|
|||
Initializes an EtherCAT NPRD command.
|
||||
Node-adressed physical read.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_nprd(ec_command_t *command,
|
||||
|
|
@ -141,7 +144,6 @@ int ec_command_nprd(ec_command_t *command,
|
|||
Initializes an EtherCAT NPWR command.
|
||||
Node-adressed physical write.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_npwr(ec_command_t *command,
|
||||
|
|
@ -170,7 +172,6 @@ int ec_command_npwr(ec_command_t *command,
|
|||
Initializes an EtherCAT APRD command.
|
||||
Autoincrement physical read.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_aprd(ec_command_t *command,
|
||||
|
|
@ -196,7 +197,6 @@ int ec_command_aprd(ec_command_t *command,
|
|||
Initializes an EtherCAT APWR command.
|
||||
Autoincrement physical write.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_apwr(ec_command_t *command,
|
||||
|
|
@ -222,7 +222,6 @@ int ec_command_apwr(ec_command_t *command,
|
|||
Initializes an EtherCAT BRD command.
|
||||
Broadcast read.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_brd(ec_command_t *command,
|
||||
|
|
@ -246,7 +245,6 @@ int ec_command_brd(ec_command_t *command,
|
|||
Initializes an EtherCAT BWR command.
|
||||
Broadcast write.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_bwr(ec_command_t *command,
|
||||
|
|
@ -270,7 +268,6 @@ int ec_command_bwr(ec_command_t *command,
|
|||
Initializes an EtherCAT LRW command.
|
||||
Logical read write.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Command
|
||||
*/
|
||||
|
||||
int ec_command_lrw(ec_command_t *command,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* c o m m a n d . h
|
||||
*
|
||||
* EtherCAT command structure.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT command structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_COMMAND_H_
|
||||
#define _EC_COMMAND_H_
|
||||
|
||||
|
|
@ -34,16 +37,6 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup Command EtherCAT command
|
||||
Data types and functions for EtherCAT commands.
|
||||
An EtherCAT command is sent and received using the ec_command_t data type.
|
||||
It is passed to the master, which handles commands in a queue.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT command type.
|
||||
*/
|
||||
|
|
@ -98,7 +91,7 @@ ec_address_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT command
|
||||
EtherCAT command.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
|
|
@ -116,8 +109,6 @@ typedef struct
|
|||
}
|
||||
ec_command_t;
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void ec_command_init(ec_command_t *);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* d e v i c e . c
|
||||
*
|
||||
* EtherCAT device methods.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT device methods.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/skbuff.h>
|
||||
#include <linux/if_ether.h>
|
||||
|
|
@ -39,7 +42,6 @@
|
|||
/**
|
||||
Device constructor.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
int ec_device_init(ec_device_t *device, /**< EtherCAT device */
|
||||
|
|
@ -80,7 +82,6 @@ int ec_device_init(ec_device_t *device, /**< EtherCAT device */
|
|||
|
||||
/**
|
||||
EtherCAT device destuctor.
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
void ec_device_clear(ec_device_t *device /**< EtherCAT device */)
|
||||
|
|
@ -94,7 +95,6 @@ void ec_device_clear(ec_device_t *device /**< EtherCAT device */)
|
|||
/**
|
||||
Opens the EtherCAT device.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
int ec_device_open(ec_device_t *device /**< EtherCAT device */)
|
||||
|
|
@ -126,7 +126,6 @@ int ec_device_open(ec_device_t *device /**< EtherCAT device */)
|
|||
/**
|
||||
Stops the EtherCAT device.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
int ec_device_close(ec_device_t *device /**< EtherCAT device */)
|
||||
|
|
@ -151,7 +150,6 @@ int ec_device_close(ec_device_t *device /**< EtherCAT device */)
|
|||
/**
|
||||
Returns a pointer to the device's transmit memory.
|
||||
\return pointer to the TX socket buffer
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
uint8_t *ec_device_tx_data(ec_device_t *device /**< EtherCAT device */)
|
||||
|
|
@ -165,7 +163,6 @@ uint8_t *ec_device_tx_data(ec_device_t *device /**< EtherCAT device */)
|
|||
Sends the content of the transmit socket buffer.
|
||||
Cuts the socket buffer content to the (now known) size, and calls the
|
||||
start_xmit() function of the assigned net_device.
|
||||
\ingroup Device
|
||||
*/
|
||||
|
||||
void ec_device_send(ec_device_t *device, /**< EtherCAT device */
|
||||
|
|
@ -191,7 +188,9 @@ void ec_device_send(ec_device_t *device, /**< EtherCAT device */
|
|||
|
||||
/**
|
||||
Calls the interrupt service routine of the assigned net_device.
|
||||
\ingroup Device
|
||||
The master itself works without using interrupts. Therefore the processing
|
||||
of received data and status changes of the network device has to be
|
||||
done by the master calling the ISR "manually".
|
||||
*/
|
||||
|
||||
void ec_device_call_isr(ec_device_t *device /**< EtherCAT device */)
|
||||
|
|
@ -205,8 +204,9 @@ void ec_device_call_isr(ec_device_t *device /**< EtherCAT device */)
|
|||
|
||||
/**
|
||||
Accepts a received frame.
|
||||
Forwards the received data to the master.
|
||||
\ingroup Device
|
||||
Forwards the received data to the master. The master will analyze the frame
|
||||
and dispatch the received commands to the sending instances.
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
void ecdev_receive(ec_device_t *device, /**< EtherCAT device */
|
||||
|
|
@ -226,7 +226,9 @@ void ecdev_receive(ec_device_t *device, /**< EtherCAT device */
|
|||
|
||||
/**
|
||||
Sets a new link state.
|
||||
\ingroup Device
|
||||
If the device notifies the master about the link being down, the master
|
||||
will not try to send frames using this device.
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
void ecdev_link_state(ec_device_t *device, /**< EtherCAT device */
|
||||
|
|
@ -246,7 +248,11 @@ void ecdev_link_state(ec_device_t *device, /**< EtherCAT device */
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EXPORT_SYMBOL(ecdev_receive);
|
||||
EXPORT_SYMBOL(ecdev_link_state);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* d e v i c e . h
|
||||
*
|
||||
* EtherCAT device structure.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT device structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_DEVICE_H_
|
||||
#define _EC_DEVICE_H_
|
||||
|
||||
|
|
@ -36,19 +39,8 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup Device EtherCAT device
|
||||
Data types and functions for EtherCAT devices.
|
||||
An EtherCAT device is the connection from an EtherCAT master to a network
|
||||
interface card.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT device.
|
||||
|
||||
An EtherCAT device is a network interface card, that is owned by an
|
||||
EtherCAT master to send and receive EtherCAT frames with.
|
||||
*/
|
||||
|
|
@ -64,8 +56,6 @@ struct ec_device
|
|||
uint8_t link_state; /**< device link state */
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int ec_device_init(ec_device_t *, ec_master_t *, struct net_device *,
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* d o m a i n . c
|
||||
*
|
||||
* EtherCAT domain methods.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT domain methods.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "globals.h"
|
||||
#include "domain.h"
|
||||
#include "master.h"
|
||||
|
|
@ -36,6 +39,8 @@ ssize_t ec_show_domain_attribute(struct kobject *, struct attribute *, char *);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EC_SYSFS_READ_ATTR(data_size);
|
||||
|
||||
static struct attribute *def_attrs[] = {
|
||||
|
|
@ -54,12 +59,13 @@ static struct kobj_type ktype_ec_domain = {
|
|||
.default_attrs = def_attrs
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Domain constructor.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
int ec_domain_init(ec_domain_t *domain, /**< EtherCAT domain */
|
||||
|
|
@ -93,7 +99,6 @@ int ec_domain_init(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
|
||||
/**
|
||||
Domain destructor.
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
void ec_domain_clear(struct kobject *kobj /**< kobject of the domain */)
|
||||
|
|
@ -120,7 +125,6 @@ void ec_domain_clear(struct kobject *kobj /**< kobject of the domain */)
|
|||
/**
|
||||
Registeres a data field in a domain.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
int ec_domain_reg_field(ec_domain_t *domain, /**< EtherCAT domain */
|
||||
|
|
@ -158,7 +162,6 @@ int ec_domain_reg_field(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
|
||||
/**
|
||||
Clears the list of the registered data fields.
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
void ec_domain_clear_field_regs(ec_domain_t *domain /**< EtherCAT domain */)
|
||||
|
|
@ -176,7 +179,6 @@ void ec_domain_clear_field_regs(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
/**
|
||||
Allocates a process data command and appends it to the list.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
int ec_domain_add_command(ec_domain_t *domain, /**< EtherCAT domain */
|
||||
|
|
@ -210,7 +212,6 @@ int ec_domain_add_command(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
corresponding FMMUs and sets the process data pointer of the registered
|
||||
data fields.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
int ec_domain_alloc(ec_domain_t *domain, /**< EtherCAT domain */
|
||||
|
|
@ -304,7 +305,6 @@ int ec_domain_alloc(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
This number isn't really the number of responding slaves, but the sum of
|
||||
the working counters of all domain commands. Some slaves increase the
|
||||
working counter by 2, some by 1.
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
void ec_domain_response_count(ec_domain_t *domain, /**< EtherCAT domain */
|
||||
|
|
@ -323,7 +323,6 @@ void ec_domain_response_count(ec_domain_t *domain, /**< EtherCAT domain */
|
|||
/**
|
||||
Formats attribute data for SysFS reading.
|
||||
\return number of bytes to read
|
||||
\ingroup Domain
|
||||
*/
|
||||
|
||||
ssize_t ec_show_domain_attribute(struct kobject *kobj, /**< kobject */
|
||||
|
|
@ -352,7 +351,7 @@ ssize_t ec_show_domain_attribute(struct kobject *kobj, /**< kobject */
|
|||
- If \a field_count is greater then 1, it is assumed that \a data_ptr
|
||||
is an array of the respective size.
|
||||
\return pointer to the slave on success, else NULL
|
||||
\ingroup Domain
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
|
||||
|
|
@ -444,7 +443,7 @@ ec_slave_t *ecrt_domain_register_field(ec_domain_t *domain,
|
|||
Registeres a bunch of data fields.
|
||||
Caution! The list has to be terminated with a NULL structure ({})!
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Domain
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_domain_register_field_list(ec_domain_t *domain,
|
||||
|
|
@ -470,7 +469,7 @@ int ecrt_domain_register_field_list(ec_domain_t *domain,
|
|||
|
||||
/**
|
||||
Places all process data commands in the masters command queue.
|
||||
\ingroup Domain
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_domain_queue(ec_domain_t *domain /**< EtherCAT domain */)
|
||||
|
|
@ -486,7 +485,7 @@ void ecrt_domain_queue(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
|
||||
/**
|
||||
Processes received process data.
|
||||
\ingroup Domain
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */)
|
||||
|
|
@ -510,7 +509,7 @@ void ecrt_domain_process(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
/**
|
||||
Returns the state of a domain.
|
||||
\return 0 if all commands were received, else -1.
|
||||
\ingroup Domain
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_domain_state(ec_domain_t *domain /**< EtherCAT domain */)
|
||||
|
|
@ -526,10 +525,14 @@ int ecrt_domain_state(ec_domain_t *domain /**< EtherCAT domain */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EXPORT_SYMBOL(ecrt_domain_register_field);
|
||||
EXPORT_SYMBOL(ecrt_domain_register_field_list);
|
||||
EXPORT_SYMBOL(ecrt_domain_queue);
|
||||
EXPORT_SYMBOL(ecrt_domain_process);
|
||||
EXPORT_SYMBOL(ecrt_domain_state);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* d o m a i n . h
|
||||
*
|
||||
* EtherCAT domain structure.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT domain structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_DOMAIN_H_
|
||||
#define _EC_DOMAIN_H_
|
||||
|
||||
|
|
@ -37,15 +40,6 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup Domain EtherCAT domain
|
||||
Data types and methods for EtherCAT domains.
|
||||
A domain handles process data IO with a group of slaves.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Data field registration type.
|
||||
*/
|
||||
|
|
@ -81,8 +75,6 @@ struct ec_domain
|
|||
struct list_head field_regs; /**< data field registrations */
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
int ec_domain_init(ec_domain_t *, ec_master_t *, unsigned int);
|
||||
|
|
|
|||
|
|
@ -1,13 +1,33 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* d o x y g e n . c
|
||||
*
|
||||
* Just for the doxygen mainpage.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
* Copyright (C) 2006 Florian Pose, Ingenieurgemeinschaft IgH
|
||||
*
|
||||
* This file is part of the IgH EtherCAT Master.
|
||||
*
|
||||
* The IgH EtherCAT Master is free software; you can redistribute it
|
||||
* and/or modify it under the terms of the GNU General Public License
|
||||
* as published by the Free Software Foundation; version 2 of the License.
|
||||
*
|
||||
* The IgH EtherCAT Master is distributed in the hope that it will be
|
||||
* useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with the IgH EtherCAT Master; if not, write to the Free Software
|
||||
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
|
||||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Just for the doxygen mainpage.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\mainpage The IgH EtherCAT master
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* e t h e r n e t . c
|
||||
*
|
||||
* Ethernet-over-EtherCAT (EoE)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Ethernet-over-EtherCAT (EoE).
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include "../include/ecrt.h"
|
||||
#include "globals.h"
|
||||
#include "master.h"
|
||||
|
|
@ -35,7 +38,7 @@
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\ingroup EoE
|
||||
EoE constructor.
|
||||
*/
|
||||
|
||||
void ec_eoe_init(ec_eoe_t *eoe, ec_slave_t *slave)
|
||||
|
|
@ -47,7 +50,7 @@ void ec_eoe_init(ec_eoe_t *eoe, ec_slave_t *slave)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\ingroup EoE
|
||||
EoE destructor.
|
||||
*/
|
||||
|
||||
void ec_eoe_clear(ec_eoe_t *eoe)
|
||||
|
|
@ -57,7 +60,7 @@ void ec_eoe_clear(ec_eoe_t *eoe)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\ingroup EoE
|
||||
Runs the EoE state machine.
|
||||
*/
|
||||
|
||||
void ec_eoe_run(ec_eoe_t *eoe)
|
||||
|
|
@ -140,7 +143,7 @@ void ec_eoe_run(ec_eoe_t *eoe)
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\ingroup EoE
|
||||
Prints EoE object information.
|
||||
*/
|
||||
|
||||
void ec_eoe_print(const ec_eoe_t *eoe)
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* e t h e r n e t . h
|
||||
*
|
||||
* Ethernet-over-EtherCAT (EoE)
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Ethernet-over-EtherCAT (EoE)
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/list.h>
|
||||
|
||||
#include "../include/ecrt.h"
|
||||
|
|
@ -34,14 +37,6 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup EoE EtherCAT-over-Ethernet (EoE)
|
||||
Data types and functions for Ethernet-over-EtherCAT.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
State of an EoE object.
|
||||
*/
|
||||
|
|
@ -70,8 +65,6 @@ typedef struct
|
|||
}
|
||||
ec_eoe_t;
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
void ec_eoe_init(ec_eoe_t *, ec_slave_t *);
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* g l o b a l s . h
|
||||
*
|
||||
* Global definitions and macros.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Global definitions and macros.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_GLOBALS_
|
||||
#define _EC_GLOBALS_
|
||||
|
||||
|
|
@ -89,6 +92,10 @@
|
|||
#define EC_LIT(X) #X
|
||||
#define EC_STR(X) EC_LIT(X)
|
||||
|
||||
/**
|
||||
Convenience macro for defining SysFS attributes.
|
||||
*/
|
||||
|
||||
#define EC_SYSFS_READ_ATTR(NAME) \
|
||||
static struct attribute attr_##NAME = { \
|
||||
.name = EC_STR(NAME), .owner = THIS_MODULE, .mode = S_IRUGO \
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* m a i l b o x . c
|
||||
*
|
||||
* Mailbox functionality.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Mailbox functionality.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/slab.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
|
|
@ -37,7 +40,6 @@
|
|||
/**
|
||||
Prepares a mailbox-send command.
|
||||
\return pointer to mailbox command data
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
uint8_t *ec_slave_mbox_prepare_send(ec_slave_t *slave, /**< slave */
|
||||
|
|
@ -78,7 +80,6 @@ uint8_t *ec_slave_mbox_prepare_send(ec_slave_t *slave, /**< slave */
|
|||
/**
|
||||
Prepares a command for checking the mailbox state.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_mbox_prepare_check(ec_slave_t *slave /**< slave */)
|
||||
|
|
@ -97,7 +98,6 @@ int ec_slave_mbox_prepare_check(ec_slave_t *slave /**< slave */)
|
|||
/**
|
||||
Processes a mailbox state checking command.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_mbox_check(const ec_slave_t *slave /**< slave */)
|
||||
|
|
@ -110,7 +110,6 @@ int ec_slave_mbox_check(const ec_slave_t *slave /**< slave */)
|
|||
/**
|
||||
Prepares a command to fetch mailbox data.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_mbox_prepare_fetch(ec_slave_t *slave /**< slave */)
|
||||
|
|
@ -128,7 +127,6 @@ int ec_slave_mbox_prepare_fetch(ec_slave_t *slave /**< slave */)
|
|||
/**
|
||||
Processes received mailbox data.
|
||||
\return pointer to the received data
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
uint8_t *ec_slave_mbox_fetch(ec_slave_t *slave, /**< slave */
|
||||
|
|
@ -161,7 +159,6 @@ uint8_t *ec_slave_mbox_fetch(ec_slave_t *slave, /**< slave */
|
|||
/**
|
||||
Sends a mailbox command and waits for its reception.
|
||||
\return pointer to the received data
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
uint8_t *ec_slave_mbox_simple_io(ec_slave_t *slave, /**< slave */
|
||||
|
|
@ -188,7 +185,6 @@ uint8_t *ec_slave_mbox_simple_io(ec_slave_t *slave, /**< slave */
|
|||
/**
|
||||
Waits for the reception of a mailbox command.
|
||||
\return pointer to the received data
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
uint8_t *ec_slave_mbox_simple_receive(ec_slave_t *slave, /**< slave */
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* m a i l b o x . h
|
||||
*
|
||||
* Mailbox functionality.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
Mailbox functionality.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_MAILBOX_H_
|
||||
#define _EC_MAILBOX_H_
|
||||
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* m a s t e r . c
|
||||
*
|
||||
* EtherCAT master methods.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT master methods.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/string.h>
|
||||
|
|
@ -48,6 +51,8 @@ void ec_master_process_watch_command(ec_master_t *);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EC_SYSFS_READ_ATTR(slave_count);
|
||||
EC_SYSFS_READ_ATTR(mode);
|
||||
|
||||
|
|
@ -68,12 +73,13 @@ static struct kobj_type ktype_ec_master = {
|
|||
.default_attrs = ec_def_attrs
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Master constructor.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -119,7 +125,6 @@ int ec_master_init(ec_master_t *master, /**< EtherCAT master */
|
|||
Master destructor.
|
||||
Removes all pending commands, clears the slave list, clears all domains
|
||||
and frees the device.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_clear(struct kobject *kobj /**< kobject of the master */)
|
||||
|
|
@ -149,7 +154,6 @@ void ec_master_clear(struct kobject *kobj /**< kobject of the master */)
|
|||
Resets the master.
|
||||
Note: This function has to be called, everytime ec_master_release() is
|
||||
called, to free the slave list, domains etc.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_reset(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -210,7 +214,6 @@ void ec_master_reset(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Places a command in the command queue.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_queue_command(ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -238,7 +241,6 @@ void ec_master_queue_command(ec_master_t *master, /**< EtherCAT master */
|
|||
/**
|
||||
Sends the commands in the queue.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_send_commands(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -340,7 +342,6 @@ void ec_master_send_commands(ec_master_t *master /**< EtherCAT master */)
|
|||
Processes a received frame.
|
||||
This function is called by the network driver for every received frame.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_receive(ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -428,7 +429,6 @@ void ec_master_receive(ec_master_t *master, /**< EtherCAT master */
|
|||
Sends a single command and waits for its reception.
|
||||
If the slave doesn't respond, the command is sent again.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
int ec_master_simple_io(ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -473,7 +473,6 @@ int ec_master_simple_io(ec_master_t *master, /**< EtherCAT master */
|
|||
Scans the EtherCAT bus for slaves.
|
||||
Creates a list of slave structures for further processing.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
int ec_master_bus_scan(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -597,7 +596,6 @@ int ec_master_bus_scan(ec_master_t *master /**< EtherCAT master */)
|
|||
Output statistics in cyclic mode.
|
||||
This function outputs statistical data on demand, but not more often than
|
||||
necessary. The output happens at most once a second.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_output_stats(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -633,7 +631,6 @@ void ec_master_output_stats(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Starts the Free-Run mode.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_freerun_start(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -666,7 +663,6 @@ void ec_master_freerun_start(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Stops the Free-Run mode.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_freerun_stop(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -683,7 +679,6 @@ void ec_master_freerun_stop(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Free-Run mode function.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_freerun(unsigned long data /**< private timer data = master */)
|
||||
|
|
@ -709,7 +704,6 @@ void ec_master_freerun(unsigned long data /**< private timer data = master */)
|
|||
/**
|
||||
Initializes a sync manager configuration page.
|
||||
The referenced memory (\a data) must be at least EC_SYNC_SIZE bytes.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_sync_config(const ec_sync_t *sync, /**< sync manager */
|
||||
|
|
@ -728,7 +722,6 @@ void ec_sync_config(const ec_sync_t *sync, /**< sync manager */
|
|||
/**
|
||||
Initializes a sync manager configuration page with EEPROM data.
|
||||
The referenced memory (\a data) must be at least EC_SYNC_SIZE bytes.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_eeprom_sync_config(const ec_eeprom_sync_t *sync, /**< sync manager */
|
||||
|
|
@ -747,7 +740,6 @@ void ec_eeprom_sync_config(const ec_eeprom_sync_t *sync, /**< sync manager */
|
|||
/**
|
||||
Initializes an FMMU configuration page.
|
||||
The referenced memory (\a data) must be at least EC_FMMU_SIZE bytes.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_fmmu_config(const ec_fmmu_t *fmmu, /**< FMMU */
|
||||
|
|
@ -770,7 +762,6 @@ void ec_fmmu_config(const ec_fmmu_t *fmmu, /**< FMMU */
|
|||
/**
|
||||
Formats attribute data for SysFS read access.
|
||||
\return number of bytes to read
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
ssize_t ec_show_master_attribute(struct kobject *kobj, /**< kobject */
|
||||
|
|
@ -801,7 +792,6 @@ ssize_t ec_show_master_attribute(struct kobject *kobj, /**< kobject */
|
|||
|
||||
/**
|
||||
Processes the watchdog command.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_process_watch_command(ec_master_t *master
|
||||
|
|
@ -849,7 +839,6 @@ void ec_master_process_watch_command(ec_master_t *master
|
|||
|
||||
/**
|
||||
Does the Ethernet-over-EtherCAT processing.
|
||||
\ingroup Master
|
||||
*/
|
||||
|
||||
void ec_master_run_eoe(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -868,7 +857,7 @@ void ec_master_run_eoe(ec_master_t *master /**< EtherCAT master */)
|
|||
/**
|
||||
Creates a domain.
|
||||
\return pointer to new domain on success, else NULL
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */)
|
||||
|
|
@ -914,7 +903,7 @@ ec_domain_t *ecrt_master_create_domain(ec_master_t *master /**< master */)
|
|||
managers and FMMUs, and does the appropriate transitions, until the slave
|
||||
is operational.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_master_activate(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1101,7 +1090,7 @@ int ecrt_master_activate(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Resets all slaves to INIT state.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_deactivate(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1121,7 +1110,7 @@ void ecrt_master_deactivate(ec_master_t *master /**< EtherCAT master */)
|
|||
Fetches the SDO dictionaries of all slaves.
|
||||
Slaves that do not support the CoE protocol are left out.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_master_fetch_sdo_lists(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1145,7 +1134,7 @@ int ecrt_master_fetch_sdo_lists(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Sends queued commands and waits for their reception.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_sync_io(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1201,7 +1190,7 @@ void ecrt_master_sync_io(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Asynchronous sending of commands.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_async_send(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1228,7 +1217,7 @@ void ecrt_master_async_send(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Asynchronous receiving of commands.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_async_receive(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1263,7 +1252,7 @@ void ecrt_master_async_receive(ec_master_t *master /**< EtherCAT master */)
|
|||
Prepares synchronous IO.
|
||||
Queues all domain commands and sends them. Then waits a certain time, so
|
||||
that ecrt_master_sasync_receive() can be called securely.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_prepare_async_io(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1291,7 +1280,7 @@ void ecrt_master_prepare_async_io(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/**
|
||||
Does all cyclic master work.
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_run(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -1319,7 +1308,7 @@ void ecrt_master_run(ec_master_t *master /**< EtherCAT master */)
|
|||
X and Y are zero-based indices and may be provided in hexadecimal or octal
|
||||
notation (with respective prefix).
|
||||
\return pointer to the slave on success, else NULL
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
ec_slave_t *ecrt_master_get_slave(const ec_master_t *master, /**< Master */
|
||||
|
|
@ -1422,7 +1411,7 @@ ec_slave_t *ecrt_master_get_slave(const ec_master_t *master, /**< Master */
|
|||
The following levels are valid:
|
||||
- 1: only output positions marks and basic data
|
||||
- 2: additional frame data output
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_debug(ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -1443,7 +1432,7 @@ void ecrt_master_debug(ec_master_t *master, /**< EtherCAT master */
|
|||
- 0: Only slave types and positions
|
||||
- 1: with EEPROM contents
|
||||
- >1: with SDO dictionaries
|
||||
\ingroup Master
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_master_print(const ec_master_t *master, /**< EtherCAT master */
|
||||
|
|
@ -1470,6 +1459,8 @@ void ecrt_master_print(const ec_master_t *master, /**< EtherCAT master */
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EXPORT_SYMBOL(ecrt_master_create_domain);
|
||||
EXPORT_SYMBOL(ecrt_master_activate);
|
||||
EXPORT_SYMBOL(ecrt_master_deactivate);
|
||||
|
|
@ -1483,4 +1474,6 @@ EXPORT_SYMBOL(ecrt_master_debug);
|
|||
EXPORT_SYMBOL(ecrt_master_print);
|
||||
EXPORT_SYMBOL(ecrt_master_get_slave);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* m a s t e r . h
|
||||
*
|
||||
* EtherCAT master structure.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT master structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_MASTER_H_
|
||||
#define _EC_MASTER_H_
|
||||
|
||||
|
|
@ -37,14 +40,6 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup Master EtherCAT master
|
||||
Data types and functions of the EtherCAT master.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT master mode.
|
||||
*/
|
||||
|
|
@ -60,7 +55,7 @@ ec_master_mode_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Cyclic EtherCAT statistics.
|
||||
Cyclic statistics.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
|
|
@ -77,7 +72,7 @@ ec_stats_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT-Master.
|
||||
EtherCAT master.
|
||||
Manages slaves, domains and IO.
|
||||
*/
|
||||
|
||||
|
|
@ -105,8 +100,6 @@ struct ec_master
|
|||
ec_master_mode_t mode; /**< master mode */
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// master creation and deletion
|
||||
|
|
@ -127,7 +120,6 @@ int ec_master_simple_io(ec_master_t *, ec_command_t *);
|
|||
int ec_master_bus_scan(ec_master_t *);
|
||||
|
||||
// misc.
|
||||
void ec_master_debug(const ec_master_t *);
|
||||
void ec_master_output_stats(ec_master_t *);
|
||||
void ec_master_run_eoe(ec_master_t *);
|
||||
|
||||
|
|
|
|||
|
|
@ -1,10 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* m o d u l e . c
|
||||
*
|
||||
* EtherCAT master driver module.
|
||||
*
|
||||
* Author: Florian Pose <fp@igh-essen.com>
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -27,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT master driver module.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/init.h>
|
||||
|
|
@ -42,6 +43,10 @@ void __exit ec_cleanup_module(void);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Compile version info.
|
||||
*/
|
||||
|
||||
#define COMPILE_INFO EC_STR(EC_MASTER_VERSION_MAIN) \
|
||||
"." EC_STR(EC_MASTER_VERSION_SUB) \
|
||||
" (" EC_MASTER_VERSION_EXTRA ")" \
|
||||
|
|
@ -56,6 +61,8 @@ static struct list_head ec_masters;
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
MODULE_AUTHOR ("Florian Pose <fp@igh-essen.com>");
|
||||
MODULE_DESCRIPTION ("EtherCAT master driver module");
|
||||
MODULE_LICENSE("GPL");
|
||||
|
|
@ -64,6 +71,8 @@ MODULE_VERSION(COMPILE_INFO);
|
|||
module_param(ec_master_count, int, 1);
|
||||
MODULE_PARM_DESC(ec_master_count, "number of EtherCAT masters to initialize");
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
|
|
@ -214,8 +223,12 @@ void ec_print_data_diff(const uint8_t *d1, /**< first data */
|
|||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
Registeres an EtherCAT device for a certain master.
|
||||
Connects an EtherCAT device to a certain master.
|
||||
The master will use the device for sending and receiving frames. It is
|
||||
required that no other instance (for example the kernel IP stack) uses
|
||||
the device.
|
||||
\return 0 on success, else < 0
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
ec_device_t *ecdev_register(unsigned int master_index, /**< master index */
|
||||
|
|
@ -266,7 +279,12 @@ ec_device_t *ecdev_register(unsigned int master_index, /**< master index */
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Unregisteres an EtherCAT device.
|
||||
Disconnect an EtherCAT device from the master.
|
||||
The device is disconnected from the master and all device ressources
|
||||
are freed.
|
||||
\attention Before calling this function, the ecdev_stop() function has
|
||||
to be called, to be sure that the master does not use the device any more.
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
void ecdev_unregister(unsigned int master_index, /**< master index */
|
||||
|
|
@ -291,6 +309,10 @@ void ecdev_unregister(unsigned int master_index, /**< master index */
|
|||
|
||||
/**
|
||||
Starts the master associated with the device.
|
||||
This function has to be called by the network device driver to tell the
|
||||
master that the device is ready to send and receive data. The master
|
||||
will enter the free-run mode then.
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
int ecdev_start(unsigned int master_index /**< master index */)
|
||||
|
|
@ -311,6 +333,9 @@ int ecdev_start(unsigned int master_index /**< master index */)
|
|||
|
||||
/**
|
||||
Stops the master associated with the device.
|
||||
Tells the master to stop using the device for frame IO. Has to be called
|
||||
before unregistering the device.
|
||||
\ingroup DeviceInterface
|
||||
*/
|
||||
|
||||
void ecdev_stop(unsigned int master_index /**< master index */)
|
||||
|
|
@ -331,6 +356,7 @@ void ecdev_stop(unsigned int master_index /**< master index */)
|
|||
/**
|
||||
Reserves an EtherCAT master for realtime operation.
|
||||
\return pointer to reserved master, or NULL on error
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
ec_master_t *ecrt_request_master(unsigned int master_index
|
||||
|
|
@ -389,6 +415,7 @@ ec_master_t *ecrt_request_master(unsigned int master_index
|
|||
|
||||
/**
|
||||
Releases a reserved EtherCAT master.
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
void ecrt_release_master(ec_master_t *master /**< EtherCAT master */)
|
||||
|
|
@ -414,6 +441,8 @@ void ecrt_release_master(ec_master_t *master /**< EtherCAT master */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
module_init(ec_init_module);
|
||||
module_exit(ec_cleanup_module);
|
||||
|
||||
|
|
@ -424,4 +453,6 @@ EXPORT_SYMBOL(ecdev_stop);
|
|||
EXPORT_SYMBOL(ecrt_request_master);
|
||||
EXPORT_SYMBOL(ecrt_release_master);
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* s l a v e . c
|
||||
*
|
||||
* EtherCAT slave methods.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT slave methods.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
#include <linux/delay.h>
|
||||
|
||||
|
|
@ -45,6 +48,8 @@ ssize_t ec_show_slave_attribute(struct kobject *, struct attribute *, char *);
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/** \cond */
|
||||
|
||||
EC_SYSFS_READ_ATTR(ring_position);
|
||||
EC_SYSFS_READ_ATTR(coupler_address);
|
||||
EC_SYSFS_READ_ATTR(vendor_name);
|
||||
|
|
@ -73,6 +78,8 @@ static struct kobj_type ktype_ec_slave = {
|
|||
.default_attrs = def_attrs
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
const ec_code_msg_t al_status_messages[];
|
||||
|
|
@ -82,7 +89,6 @@ const ec_code_msg_t al_status_messages[];
|
|||
/**
|
||||
Slave constructor.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -153,7 +159,6 @@ int ec_slave_init(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
|
||||
/**
|
||||
Slave destructor.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
void ec_slave_clear(struct kobject *kobj /**< kobject of the slave */)
|
||||
|
|
@ -220,7 +225,6 @@ void ec_slave_clear(struct kobject *kobj /**< kobject of the slave */)
|
|||
/**
|
||||
Reads all necessary information from a slave.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -298,7 +302,6 @@ int ec_slave_fetch(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
/**
|
||||
Reads 16 bit from the slave information interface (SII).
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_sii_read16(ec_slave_t *slave,
|
||||
|
|
@ -359,7 +362,6 @@ int ec_slave_sii_read16(ec_slave_t *slave,
|
|||
/**
|
||||
Reads 32 bit from the slave information interface (SII).
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_sii_read32(ec_slave_t *slave,
|
||||
|
|
@ -420,7 +422,6 @@ int ec_slave_sii_read32(ec_slave_t *slave,
|
|||
/**
|
||||
Writes 16 bit of data to the slave information interface (SII).
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_sii_write16(ec_slave_t *slave,
|
||||
|
|
@ -491,7 +492,6 @@ int ec_slave_sii_write16(ec_slave_t *slave,
|
|||
/**
|
||||
Fetches data from slave's EEPROM.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_categories(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -584,7 +584,6 @@ int ec_slave_fetch_categories(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
/**
|
||||
Fetches data from a STRING category.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_strings(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -623,7 +622,6 @@ int ec_slave_fetch_strings(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Fetches data from a GENERAL category.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_general(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -651,7 +649,6 @@ int ec_slave_fetch_general(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Fetches data from a SYNC MANAGER category.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_sync(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -688,7 +685,6 @@ int ec_slave_fetch_sync(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Fetches data from a [RT]XPDO category.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_fetch_pdo(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -750,7 +746,6 @@ int ec_slave_fetch_pdo(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Searches the string list for an index and allocates a new string.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
\todo documentation
|
||||
*/
|
||||
|
||||
|
|
@ -800,7 +795,6 @@ int ec_slave_locate_string(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
|
||||
/**
|
||||
Acknowledges an error after a state transition.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
void ec_slave_state_ack(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -857,7 +851,6 @@ void ec_slave_state_ack(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
Reads the AL status code of a slave and displays it.
|
||||
If the AL status code is not supported, or if no error occurred (both
|
||||
resulting in code = 0), nothing is displayed.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
void ec_slave_read_al_status_code(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -893,7 +886,6 @@ void ec_slave_read_al_status_code(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
/**
|
||||
Does a state transition.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_state_change(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -963,7 +955,6 @@ int ec_slave_state_change(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
If the FMMU configuration is already prepared, the function returns with
|
||||
success.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_prepare_fmmu(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -1002,7 +993,6 @@ int ec_slave_prepare_fmmu(ec_slave_t *slave, /**< EtherCAT slave */
|
|||
- 0: Only slave types and addresses
|
||||
- 1: with EEPROM information
|
||||
- >1: with SDO dictionaries
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
void ec_slave_print(const ec_slave_t *slave, /**< EtherCAT slave */
|
||||
|
|
@ -1164,7 +1154,6 @@ void ec_slave_print(const ec_slave_t *slave, /**< EtherCAT slave */
|
|||
/**
|
||||
Outputs the values of the CRC faoult counters and resets them.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ec_slave_check_crc(ec_slave_t *slave /**< EtherCAT slave */)
|
||||
|
|
@ -1217,25 +1206,10 @@ int ec_slave_check_crc(ec_slave_t *slave /**< EtherCAT slave */)
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Writes the "configured station alias" to the slave's EEPROM.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
int ecrt_slave_write_alias(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
uint16_t alias /**< new alias */
|
||||
)
|
||||
{
|
||||
return ec_slave_sii_write16(slave, 0x0004, alias);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Formats attribute data for SysFS read access.
|
||||
\return number of bytes to read
|
||||
\ingroup Slave
|
||||
\ingroup RealTimeInterface
|
||||
*/
|
||||
|
||||
ssize_t ec_show_slave_attribute(struct kobject *kobj, /**< slave's kobject */
|
||||
|
|
@ -1278,6 +1252,10 @@ ssize_t ec_show_slave_attribute(struct kobject *kobj, /**< slave's kobject */
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Application layer status messages.
|
||||
*/
|
||||
|
||||
const ec_code_msg_t al_status_messages[] = {
|
||||
{0x0001, "Unspecified error"},
|
||||
{0x0011, "Invalud requested state change"},
|
||||
|
|
@ -1298,8 +1276,29 @@ const ec_code_msg_t al_status_messages[] = {
|
|||
{}
|
||||
};
|
||||
|
||||
/******************************************************************************
|
||||
* Realtime interface
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
Writes the "configured station alias" to the slave's EEPROM.
|
||||
\return 0 in case of success, else < 0
|
||||
\ingroup RealtimeInterface
|
||||
*/
|
||||
|
||||
int ecrt_slave_write_alias(ec_slave_t *slave, /**< EtherCAT slave */
|
||||
uint16_t alias /**< new alias */
|
||||
)
|
||||
{
|
||||
return ec_slave_sii_write16(slave, 0x0004, alias);
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**< \cond */
|
||||
|
||||
EXPORT_SYMBOL(ecrt_slave_write_alias);
|
||||
|
||||
/**< \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* s l a v e . h
|
||||
*
|
||||
* EtherCAT stave structure.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT stave structure.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_SLAVE_H_
|
||||
#define _EC_SLAVE_H_
|
||||
|
||||
|
|
@ -37,14 +40,6 @@
|
|||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
\defgroup Slave EtherCAT slave
|
||||
Data types and functions for EtherCAT slaves.
|
||||
\{
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
State of an EtherCAT slave.
|
||||
*/
|
||||
|
|
@ -209,7 +204,7 @@ ec_sdo_entry_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
EtherCAT-Slave
|
||||
EtherCAT slave.
|
||||
*/
|
||||
|
||||
struct ec_slave
|
||||
|
|
@ -269,8 +264,6 @@ struct ec_slave
|
|||
ec_command_t mbox_command; /**< mailbox command */
|
||||
};
|
||||
|
||||
/** \} */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
// slave construction/destruction
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* t y p e s . c
|
||||
*
|
||||
* EtherCAT slave descriptions.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,14 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT slave descriptions.
|
||||
\cond
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#include <linux/module.h>
|
||||
|
||||
#include "globals.h"
|
||||
|
|
@ -207,6 +211,8 @@ const ec_slave_type_t TR_Electronic_LinEnc2 = {
|
|||
{&trlinenc2_sm0, &trlinenc2_sm1, &trlinenc2_sm2, &trlinenc2_sm3, NULL}
|
||||
};
|
||||
|
||||
/** \endcond */
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
|
|
|
|||
|
|
@ -1,8 +1,4 @@
|
|||
/******************************************************************************
|
||||
*
|
||||
* t y p e s . h
|
||||
*
|
||||
* EtherCAT slave types.
|
||||
*
|
||||
* $Id$
|
||||
*
|
||||
|
|
@ -25,6 +21,13 @@
|
|||
*
|
||||
*****************************************************************************/
|
||||
|
||||
/**
|
||||
\file
|
||||
EtherCAT slave types.
|
||||
*/
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
#ifndef _EC_TYPES_H_
|
||||
#define _EC_TYPES_H_
|
||||
|
||||
|
|
@ -41,7 +44,6 @@
|
|||
|
||||
/**
|
||||
Special slaves.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
typedef enum
|
||||
|
|
@ -56,7 +58,6 @@ ec_special_type_t;
|
|||
|
||||
/**
|
||||
Process data field.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
|
|
@ -69,8 +70,7 @@ ec_field_t;
|
|||
/*****************************************************************************/
|
||||
|
||||
/**
|
||||
Sync-Manager.
|
||||
\ingroup Slave
|
||||
Sync manager.
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
|
|
@ -86,7 +86,6 @@ ec_sync_t;
|
|||
|
||||
/**
|
||||
Slave description type.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
typedef struct ec_slave_type
|
||||
|
|
@ -103,7 +102,6 @@ ec_slave_type_t;
|
|||
|
||||
/**
|
||||
Slave type identification.
|
||||
\ingroup Slave
|
||||
*/
|
||||
|
||||
typedef struct
|
||||
|
|
|
|||
Loading…
Reference in New Issue