/******************************************************************************
*04 Global functions 全局函数
*****************************************************************************/
#ifdef __cplusplus
extern "C" {
#endif
/**01 Returns the version magic of the realtime interface.
*返回实时接口的版本魔法。
* \return Value of ECRT_VERSION_MAGIC() at EtherCAT master compile time.
*/
unsigned int ecrt_version_magic(void);
/**02 Requests an EtherCAT master for realtime operation.
*请求EtherCAT主机进行实时操作。
* Before an application can access an EtherCAT master, it has to reserve one
* for exclusive use.
*在应用程序访问EtherCAT主机之前,它必须为独占使用预留一台主机。
* In userspace, this is a convenience function for ecrt_open_master() and
* ecrt_master_reserve().
*在用户空间中,这是一个方便的函数,用于ecrt open master()和ecrt master reserve()。我
* This function has to be the first function an application has to call to
* use EtherCAT. The function takes the index of the master as its argument.
* The first master has index 0, the n-th master has index n - 1. The number
* of masters has to be specified when loading the master module.
*这个函数必须是应用程序使用EtherCAT必须调用的第一个函数。该函数以master的索引作为参数。
*第一个主节点索引为0,第n个主节点索引为n- 1。加载主模块时必须指定主模块的数量。
* \return Pointer to the reserved master, otherwise \a NULL.
*/
ec_master_t *ecrt_request_master(
unsigned int master_index /**< Index of the master to request.主站请求索引 */
);
#ifndef __KERNEL__
/**03 Opens an EtherCAT master for userspace access.
*
* This function has to be the first function an application has to call to
* use EtherCAT. The function takes the index of the master as its argument.
* The first master has index 0, the n-th master has index n - 1. The number
* of masters has to be specified when loading the master module.
*这个函数必须是应用程序使用EtherCAT必须调用的第一个函数。该函数以master的索引作为参数。
*第一个主节点索引为0,第n个主节点索引为n -1。加载主模块时必须指定主模块的数量。
* For convenience, the function ecrt_request_master() can be used.
*
* \return Pointer to the opened master, otherwise \a NULL.
*/
ec_master_t *ecrt_open_master(
unsigned int master_index /**< Index of the master to request. 主站请求索引。*/
);
#endif // #ifndef __KERNEL__
/**04 Releases a requested EtherCAT master.
*•释放请求的EtherCAT主站
* After use, a master it has to be released to make it available for other
* applications.
*在使用后,master必须被释放,以使其他应用程序可以使用它。
* This method frees all created data structures. It should not be called in
* realtime context.
*此方法释放所有创建的数据结构。不应该在实时上下文中调用它。
* If the master was activated, ecrt_master_deactivate() is called internally.
*/
void ecrt_release_master(
ec_master_t *master /**< EtherCAT master主站 */
);