diff --git a/NEWS b/NEWS index 474938ea..2bdba60e 100644 --- a/NEWS +++ b/NEWS @@ -20,6 +20,7 @@ Changes in version 1.2.0: ecrt_domain_register_pdo_list() and ecrt_domain_register_pdo_range() may not be NULL any more. - Removed ecrt_slave_pdo_size(). This function was deprecated long before. + - Introduced ECRT_VERSION_MAGIC macro and ecrt_version_magic() function. * Device interface changes: - ec_isr_t was replaced by ec_pollfunc_t, the device driver has to supply a poll function to call its ISR. This was introduced because some network diff --git a/include/ecrt.h b/include/ecrt.h index 698069ca..24bbea7b 100644 --- a/include/ecrt.h +++ b/include/ecrt.h @@ -59,6 +59,14 @@ /*****************************************************************************/ +#define ECRT_VER_MAJOR 1U +#define ECRT_VER_MINOR 2U + +#define ECRT_VERSION(a,b) (((a) << 8) + (b)) +#define ECRT_VERSION_MAGIC ECRT_VERSION(ECRT_VER_MAJOR, ECRT_VER_MINOR) + +/*****************************************************************************/ + struct ec_master; typedef struct ec_master ec_master_t; /**< \see ec_master */ @@ -99,6 +107,8 @@ typedef enum {EC_DIR_INPUT, EC_DIR_OUTPUT} ec_direction_t; ec_master_t *ecrt_request_master(unsigned int master_index); void ecrt_release_master(ec_master_t *master); +unsigned int ecrt_version_magic(void); + /****************************************************************************** * Master methods *****************************************************************************/ diff --git a/master/module.c b/master/module.c index 765ea608..67cd4296 100644 --- a/master/module.c +++ b/master/module.c @@ -400,6 +400,19 @@ void ecdev_close(ec_device_t *device /**< EtherCAT device */) * Realtime interface *****************************************************************************/ +/** + * Returns the version magic of the realtime interface. + * \return ECRT version magic. + * \ingroup RealtimeInterface + */ + +unsigned int ecrt_version_magic(void) +{ + return ECRT_VERSION_MAGIC; +} + +/*****************************************************************************/ + /** Reserves an EtherCAT master for realtime operation. \return pointer to reserved master, or NULL on error