include/ecrt.h
changeset 2245 13ef066f37d3
parent 2150 5144a4bc6184
child 2248 82afd3a5bab1
equal deleted inserted replaced
2240:b45438edf869 2245:13ef066f37d3
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  *  $Id: ecrt.h,v ebda087981e1 2011/09/15 13:58:58 fp $
     3  *  $Id$
     4  *
     4  *
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     5  *  Copyright (C) 2006-2008  Florian Pose, Ingenieurgemeinschaft IgH
     6  *
     6  *
     7  *  This file is part of the IgH EtherCAT master userspace library.
     7  *  This file is part of the IgH EtherCAT master userspace library.
     8  *
     8  *
    79  *   ad-hoc via the user-space library.
    79  *   ad-hoc via the user-space library.
    80  * - Added ecrt_master_reset() to initiate retrying to configure slaves.
    80  * - Added ecrt_master_reset() to initiate retrying to configure slaves.
    81  * - Added support for overlapping PDOs which allows inputs to use the same
    81  * - Added support for overlapping PDOs which allows inputs to use the same
    82  *   space as outputs on the frame. This reduces the frame length.
    82  *   space as outputs on the frame. This reduces the frame length.
    83  *
    83  *
    84  *
       
    85  * @{
    84  * @{
    86  */
    85  */
    87 
    86 
    88 /*****************************************************************************/
    87 /*****************************************************************************/
    89 
    88 
   173 
   172 
   174 /*****************************************************************************/
   173 /*****************************************************************************/
   175 
   174 
   176 /** Master state.
   175 /** Master state.
   177  *
   176  *
   178  * This is used for the output parameter of ecrt_master_state().
   177  * This is used for the output parameter of ecrt_master_state() and
       
   178  * ecrt_master_configured_slaves_state().
   179  *
   179  *
   180  * \see ecrt_master_state().
   180  * \see ecrt_master_state().
       
   181  * \see ecrt_master_configured_slaves_state().
   181  */
   182  */
   182 typedef struct {
   183 typedef struct {
   183     unsigned int slaves_responding; /**< Number of slaves in the bus. */
   184     unsigned int slaves_responding; /**< Number of slaves in the bus. */
   184     unsigned int al_states : 4; /**< Application-layer states of all slaves.
   185     unsigned int al_states : 4; /**< Application-layer states of all slaves.
   185                                   The states are coded in the lower 4 bits.
   186                                   The states are coded in the lower 4 bits.
   489         );
   490         );
   490 
   491 
   491 #ifdef __KERNEL__
   492 #ifdef __KERNEL__
   492 
   493 
   493 /** Attach to a running master
   494 /** Attach to a running master
   494  *   
   495  *
   495  * This function returns the master handle for the RTDM-Interface
   496  * This function returns the master handle for the RTDM-Interface
   496  *
   497  *
   497  * \return Pointer to the opened master, otherwise \a NULL.
   498  * \return Pointer to the opened master, otherwise \a NULL.
   498  */
   499  */
   499 ec_master_t *ecrt_attach_master(
   500 ec_master_t *ecrt_attach_master(
   539         void *cb_data /**< Arbitrary user data. */
   540         void *cb_data /**< Arbitrary user data. */
   540         );
   541         );
   541 
   542 
   542 /** Returns domain structure pointer
   543 /** Returns domain structure pointer
   543  *
   544  *
       
   545  * \fixme The application knows the domain pointers!
       
   546  *
   544  * This functions return the domain structure pointer for usage inside the
   547  * This functions return the domain structure pointer for usage inside the
   545  * RTDM-Interface.
   548  * RTDM-Interface.
   546  *
   549  *
   547  * \return Pointer to the domain on success, else NULL.
   550  * \return Pointer to the domain on success, else NULL.
   548  */
   551  */
   549 ec_domain_t *ecrt_master_find_domain(
   552 ec_domain_t *ecrt_master_find_domain(
   550         ec_master_t *master, 
   553         ec_master_t *master,
   551         unsigned int index);
   554         unsigned int index);
   552 
       
   553 
   555 
   554 #endif /* __KERNEL__ */
   556 #endif /* __KERNEL__ */
   555 
   557 
   556 #ifndef __KERNEL__
   558 #ifndef __KERNEL__
   557 
   559 
   877         ec_master_state_t *state /**< Structure to store the information. */
   879         ec_master_state_t *state /**< Structure to store the information. */
   878         );
   880         );
   879 
   881 
   880 /** Reads the current master state and the al_state of all configured slaves.
   882 /** Reads the current master state and the al_state of all configured slaves.
   881  *
   883  *
   882  * use this function instead of ecrt_master_state if there are unused
   884  * Use this function instead of ecrt_master_state() if there are unused slaves
   883  * slaves on the bus
   885  * on the bus. Stores the master state information in the given \a state
   884  * Stores the master state information in the given \a state structure.
   886  * structure.
       
   887  *
   885  * \see ecrt_master_state()
   888  * \see ecrt_master_state()
   886  */
   889  */
   887 void ecrt_master_configured_slaves_state(
   890 void ecrt_master_configured_slaves_state(
   888         const ec_master_t *master, /**< EtherCAT master. */
   891         const ec_master_t *master, /**< EtherCAT master. */
   889         ec_master_state_t *state /**< Structure to store the information. */
   892         ec_master_state_t *state /**< Structure to store the information. */