master/module.c
changeset 792 3778920f61e4
parent 758 8fa6f825eb7d
child 794 684dea874956
equal deleted inserted replaced
791:3b81d074735c 792:3778920f61e4
    29  *  standard) as the (only) precondition to have the right to use EtherCAT
    29  *  standard) as the (only) precondition to have the right to use EtherCAT
    30  *  Technology, IP and trade marks.
    30  *  Technology, IP and trade marks.
    31  *
    31  *
    32  *****************************************************************************/
    32  *****************************************************************************/
    33 
    33 
    34 /**
    34 /** \file
    35    \file
    35  * EtherCAT master driver module.
    36    EtherCAT master driver module.
    36  */
    37 */
       
    38 
    37 
    39 /*****************************************************************************/
    38 /*****************************************************************************/
    40 
    39 
    41 #include <linux/module.h>
    40 #include <linux/module.h>
    42 #include <linux/kernel.h>
    41 #include <linux/kernel.h>
    47 #include "device.h"
    46 #include "device.h"
    48 #include "xmldev.h"
    47 #include "xmldev.h"
    49 
    48 
    50 /*****************************************************************************/
    49 /*****************************************************************************/
    51 
    50 
    52 #define MAX_MASTERS 5 /**< maximum number of masters */
    51 #define MAX_MASTERS 5 /**< Maximum number of masters. */
    53 
    52 
    54 /*****************************************************************************/
    53 /*****************************************************************************/
    55 
    54 
    56 int __init ec_init_module(void);
    55 int __init ec_init_module(void);
    57 void __exit ec_cleanup_module(void);
    56 void __exit ec_cleanup_module(void);
   539 
   538 
   540 /******************************************************************************
   539 /******************************************************************************
   541  *  Realtime interface
   540  *  Realtime interface
   542  *****************************************************************************/
   541  *****************************************************************************/
   543 
   542 
   544 /**
   543 ec_master_t *ecrt_request_master(unsigned int master_index)
   545  * Returns the version magic of the realtime interface.
       
   546  * \return ECRT version magic.
       
   547  * \ingroup RealtimeInterface
       
   548  */
       
   549 
       
   550 unsigned int ecrt_version_magic(void)
       
   551 {
       
   552     return ECRT_VERSION_MAGIC;
       
   553 }
       
   554 
       
   555 /*****************************************************************************/
       
   556 
       
   557 /**
       
   558    Reserves an EtherCAT master for realtime operation.
       
   559    \return pointer to reserved master, or NULL on error
       
   560    \ingroup RealtimeInterface
       
   561 */
       
   562 
       
   563 ec_master_t *ecrt_request_master(unsigned int master_index
       
   564                                  /**< master index */
       
   565                                  )
       
   566 {
   544 {
   567     ec_master_t *master;
   545     ec_master_t *master;
   568 
   546 
   569     EC_INFO("Requesting master %u...\n", master_index);
   547     EC_INFO("Requesting master %u...\n", master_index);
   570 
   548 
   620     return NULL;
   598     return NULL;
   621 }
   599 }
   622 
   600 
   623 /*****************************************************************************/
   601 /*****************************************************************************/
   624 
   602 
   625 /**
   603 void ecrt_release_master(ec_master_t *master)
   626    Releases a reserved EtherCAT master.
       
   627    \ingroup RealtimeInterface
       
   628 */
       
   629 
       
   630 void ecrt_release_master(ec_master_t *master /**< EtherCAT master */)
       
   631 {
   604 {
   632     EC_INFO("Releasing master %u...\n", master->index);
   605     EC_INFO("Releasing master %u...\n", master->index);
   633 
   606 
   634     if (master->mode != EC_MASTER_MODE_OPERATION) {
   607     if (master->mode != EC_MASTER_MODE_OPERATION) {
   635         EC_WARN("Master %u was was not requested!\n", master->index);
   608         EC_WARN("Master %u was was not requested!\n", master->index);
   640 
   613 
   641     module_put(master->main_device.module);
   614     module_put(master->main_device.module);
   642     master->reserved = 0;
   615     master->reserved = 0;
   643 
   616 
   644     EC_INFO("Released master %u.\n", master->index);
   617     EC_INFO("Released master %u.\n", master->index);
       
   618 }
       
   619 
       
   620 /*****************************************************************************/
       
   621 
       
   622 unsigned int ecrt_version_magic(void)
       
   623 {
       
   624     return ECRT_VERSION_MAGIC;
   645 }
   625 }
   646 
   626 
   647 /*****************************************************************************/
   627 /*****************************************************************************/
   648 
   628 
   649 /** \cond */
   629 /** \cond */