master/ioctl.h
changeset 1826 ec6223c3b7ec
parent 1600 e36c92cf58a9
child 1831 1875b9fea0ba
equal deleted inserted replaced
1825:65781b048a47 1826:ec6223c3b7ec
    50 #define EC_IO(nr)           _IO(EC_IOCTL_TYPE, nr)
    50 #define EC_IO(nr)           _IO(EC_IOCTL_TYPE, nr)
    51 #define EC_IOR(nr, type)   _IOR(EC_IOCTL_TYPE, nr, type)
    51 #define EC_IOR(nr, type)   _IOR(EC_IOCTL_TYPE, nr, type)
    52 #define EC_IOW(nr, type)   _IOW(EC_IOCTL_TYPE, nr, type)
    52 #define EC_IOW(nr, type)   _IOW(EC_IOCTL_TYPE, nr, type)
    53 #define EC_IOWR(nr, type) _IOWR(EC_IOCTL_TYPE, nr, type)
    53 #define EC_IOWR(nr, type) _IOWR(EC_IOCTL_TYPE, nr, type)
    54 
    54 
       
    55 /** EtherCAT master ioctl() version magic.
       
    56  *
       
    57  * Increment this when changing the ioctl interface!
       
    58  */
       
    59 #define EC_IOCTL_VERSION_MAGIC 1
       
    60 
    55 // Command-line tool
    61 // Command-line tool
    56 #define EC_IOCTL_MASTER                EC_IOR(0x00, ec_ioctl_master_t)
    62 #define EC_IOCTL_MODULE                EC_IOR(0x00, ec_ioctl_module_t)
    57 #define EC_IOCTL_SLAVE                EC_IOWR(0x01, ec_ioctl_slave_t)
    63 #define EC_IOCTL_MASTER                EC_IOR(0x01, ec_ioctl_master_t)
    58 #define EC_IOCTL_SLAVE_SYNC           EC_IOWR(0x02, ec_ioctl_slave_sync_t)
    64 #define EC_IOCTL_SLAVE                EC_IOWR(0x02, ec_ioctl_slave_t)
    59 #define EC_IOCTL_SLAVE_SYNC_PDO       EC_IOWR(0x03, ec_ioctl_slave_sync_pdo_t)
    65 #define EC_IOCTL_SLAVE_SYNC           EC_IOWR(0x03, ec_ioctl_slave_sync_t)
    60 #define EC_IOCTL_SLAVE_SYNC_PDO_ENTRY EC_IOWR(0x04, ec_ioctl_slave_sync_pdo_entry_t)
    66 #define EC_IOCTL_SLAVE_SYNC_PDO       EC_IOWR(0x04, ec_ioctl_slave_sync_pdo_t)
    61 #define EC_IOCTL_DOMAIN               EC_IOWR(0x05, ec_ioctl_domain_t)
    67 #define EC_IOCTL_SLAVE_SYNC_PDO_ENTRY EC_IOWR(0x05, ec_ioctl_slave_sync_pdo_entry_t)
    62 #define EC_IOCTL_DOMAIN_FMMU          EC_IOWR(0x06, ec_ioctl_domain_fmmu_t)
    68 #define EC_IOCTL_DOMAIN               EC_IOWR(0x06, ec_ioctl_domain_t)
    63 #define EC_IOCTL_DOMAIN_DATA          EC_IOWR(0x07, ec_ioctl_domain_data_t)
    69 #define EC_IOCTL_DOMAIN_FMMU          EC_IOWR(0x07, ec_ioctl_domain_fmmu_t)
    64 #define EC_IOCTL_MASTER_DEBUG           EC_IO(0x08)
    70 #define EC_IOCTL_DOMAIN_DATA          EC_IOWR(0x08, ec_ioctl_domain_data_t)
    65 #define EC_IOCTL_SLAVE_STATE           EC_IOW(0x09, ec_ioctl_slave_state_t)
    71 #define EC_IOCTL_MASTER_DEBUG           EC_IO(0x09)
    66 #define EC_IOCTL_SLAVE_SDO            EC_IOWR(0x0a, ec_ioctl_slave_sdo_t)
    72 #define EC_IOCTL_SLAVE_STATE           EC_IOW(0x0a, ec_ioctl_slave_state_t)
    67 #define EC_IOCTL_SLAVE_SDO_ENTRY      EC_IOWR(0x0b, ec_ioctl_slave_sdo_entry_t)
    73 #define EC_IOCTL_SLAVE_SDO            EC_IOWR(0x0b, ec_ioctl_slave_sdo_t)
    68 #define EC_IOCTL_SLAVE_SDO_UPLOAD     EC_IOWR(0x0c, ec_ioctl_slave_sdo_upload_t)
    74 #define EC_IOCTL_SLAVE_SDO_ENTRY      EC_IOWR(0x0c, ec_ioctl_slave_sdo_entry_t)
    69 #define EC_IOCTL_SLAVE_SDO_DOWNLOAD   EC_IOWR(0x0d, ec_ioctl_slave_sdo_download_t)
    75 #define EC_IOCTL_SLAVE_SDO_UPLOAD     EC_IOWR(0x0d, ec_ioctl_slave_sdo_upload_t)
    70 #define EC_IOCTL_SLAVE_SII_READ       EC_IOWR(0x0e, ec_ioctl_slave_sii_t)
    76 #define EC_IOCTL_SLAVE_SDO_DOWNLOAD   EC_IOWR(0x0e, ec_ioctl_slave_sdo_download_t)
    71 #define EC_IOCTL_SLAVE_SII_WRITE       EC_IOW(0x0f, ec_ioctl_slave_sii_t)
    77 #define EC_IOCTL_SLAVE_SII_READ       EC_IOWR(0x0f, ec_ioctl_slave_sii_t)
    72 #define EC_IOCTL_SLAVE_REG_READ       EC_IOWR(0x10, ec_ioctl_slave_reg_t)
    78 #define EC_IOCTL_SLAVE_SII_WRITE       EC_IOW(0x10, ec_ioctl_slave_sii_t)
    73 #define EC_IOCTL_SLAVE_REG_WRITE       EC_IOW(0x11, ec_ioctl_slave_reg_t)
    79 #define EC_IOCTL_SLAVE_REG_READ       EC_IOWR(0x11, ec_ioctl_slave_reg_t)
    74 #define EC_IOCTL_SLAVE_FOE_READ       EC_IOWR(0x12, ec_ioctl_slave_foe_t)
    80 #define EC_IOCTL_SLAVE_REG_WRITE       EC_IOW(0x12, ec_ioctl_slave_reg_t)
    75 #define EC_IOCTL_SLAVE_FOE_WRITE       EC_IOW(0x13, ec_ioctl_slave_foe_t)
    81 #define EC_IOCTL_SLAVE_FOE_READ       EC_IOWR(0x13, ec_ioctl_slave_foe_t)
    76 #define EC_IOCTL_CONFIG               EC_IOWR(0x14, ec_ioctl_config_t)
    82 #define EC_IOCTL_SLAVE_FOE_WRITE       EC_IOW(0x14, ec_ioctl_slave_foe_t)
    77 #define EC_IOCTL_CONFIG_PDO           EC_IOWR(0x15, ec_ioctl_config_pdo_t)
    83 #define EC_IOCTL_CONFIG               EC_IOWR(0x15, ec_ioctl_config_t)
    78 #define EC_IOCTL_CONFIG_PDO_ENTRY     EC_IOWR(0x16, ec_ioctl_config_pdo_entry_t)
    84 #define EC_IOCTL_CONFIG_PDO           EC_IOWR(0x16, ec_ioctl_config_pdo_t)
    79 #define EC_IOCTL_CONFIG_SDO           EC_IOWR(0x17, ec_ioctl_config_sdo_t)
    85 #define EC_IOCTL_CONFIG_PDO_ENTRY     EC_IOWR(0x17, ec_ioctl_config_pdo_entry_t)
       
    86 #define EC_IOCTL_CONFIG_SDO           EC_IOWR(0x18, ec_ioctl_config_sdo_t)
    80 #ifdef EC_EOE
    87 #ifdef EC_EOE
    81 #define EC_IOCTL_EOE_HANDLER          EC_IOWR(0x18, ec_ioctl_eoe_handler_t)
    88 #define EC_IOCTL_EOE_HANDLER          EC_IOWR(0x19, ec_ioctl_eoe_handler_t)
    82 #endif
    89 #endif
    83 
    90 
    84 // Application interface
    91 // Application interface
    85 #define EC_IOCTL_REQUEST                EC_IO(0x19)
    92 #define EC_IOCTL_REQUEST                EC_IO(0x1a)
    86 #define EC_IOCTL_CREATE_DOMAIN          EC_IO(0x1a)
    93 #define EC_IOCTL_CREATE_DOMAIN          EC_IO(0x1b)
    87 #define EC_IOCTL_CREATE_SLAVE_CONFIG  EC_IOWR(0x1b, ec_ioctl_config_t)
    94 #define EC_IOCTL_CREATE_SLAVE_CONFIG  EC_IOWR(0x1c, ec_ioctl_config_t)
    88 #define EC_IOCTL_ACTIVATE              EC_IOR(0x1c, size_t)
    95 #define EC_IOCTL_ACTIVATE              EC_IOR(0x1d, size_t)
    89 #define EC_IOCTL_DEACTIVATE             EC_IO(0x1d)
    96 #define EC_IOCTL_DEACTIVATE             EC_IO(0x1e)
    90 #define EC_IOCTL_SEND                   EC_IO(0x1e)
    97 #define EC_IOCTL_SEND                   EC_IO(0x1f)
    91 #define EC_IOCTL_RECEIVE                EC_IO(0x1f)
    98 #define EC_IOCTL_RECEIVE                EC_IO(0x20)
    92 #define EC_IOCTL_MASTER_STATE          EC_IOR(0x20, ec_master_state_t)
    99 #define EC_IOCTL_MASTER_STATE          EC_IOR(0x21, ec_master_state_t)
    93 #define EC_IOCTL_APP_TIME              EC_IOW(0x21, ec_ioctl_app_time_t)
   100 #define EC_IOCTL_APP_TIME              EC_IOW(0x22, ec_ioctl_app_time_t)
    94 #define EC_IOCTL_SYNC_REF               EC_IO(0x22)
   101 #define EC_IOCTL_SYNC_REF               EC_IO(0x23)
    95 #define EC_IOCTL_SYNC_SLAVES            EC_IO(0x23)
   102 #define EC_IOCTL_SYNC_SLAVES            EC_IO(0x24)
    96 #define EC_IOCTL_SYNC_MON_QUEUE         EC_IO(0x24)
   103 #define EC_IOCTL_SYNC_MON_QUEUE         EC_IO(0x25)
    97 #define EC_IOCTL_SYNC_MON_PROCESS      EC_IOR(0x25, uint32_t)
   104 #define EC_IOCTL_SYNC_MON_PROCESS      EC_IOR(0x26, uint32_t)
    98 #define EC_IOCTL_SC_SYNC               EC_IOW(0x26, ec_ioctl_config_t)
   105 #define EC_IOCTL_SC_SYNC               EC_IOW(0x27, ec_ioctl_config_t)
    99 #define EC_IOCTL_SC_WATCHDOG           EC_IOW(0x27, ec_ioctl_config_t)
   106 #define EC_IOCTL_SC_WATCHDOG           EC_IOW(0x28, ec_ioctl_config_t)
   100 #define EC_IOCTL_SC_ADD_PDO            EC_IOW(0x28, ec_ioctl_config_pdo_t)
   107 #define EC_IOCTL_SC_ADD_PDO            EC_IOW(0x29, ec_ioctl_config_pdo_t)
   101 #define EC_IOCTL_SC_CLEAR_PDOS         EC_IOW(0x29, ec_ioctl_config_pdo_t)
   108 #define EC_IOCTL_SC_CLEAR_PDOS         EC_IOW(0x2a, ec_ioctl_config_pdo_t)
   102 #define EC_IOCTL_SC_ADD_ENTRY          EC_IOW(0x2a, ec_ioctl_add_pdo_entry_t)
   109 #define EC_IOCTL_SC_ADD_ENTRY          EC_IOW(0x2b, ec_ioctl_add_pdo_entry_t)
   103 #define EC_IOCTL_SC_CLEAR_ENTRIES      EC_IOW(0x2b, ec_ioctl_config_pdo_t)
   110 #define EC_IOCTL_SC_CLEAR_ENTRIES      EC_IOW(0x2c, ec_ioctl_config_pdo_t)
   104 #define EC_IOCTL_SC_REG_PDO_ENTRY     EC_IOWR(0x2c, ec_ioctl_reg_pdo_entry_t)
   111 #define EC_IOCTL_SC_REG_PDO_ENTRY     EC_IOWR(0x2d, ec_ioctl_reg_pdo_entry_t)
   105 #define EC_IOCTL_SC_DC                 EC_IOW(0x2d, ec_ioctl_config_t)
   112 #define EC_IOCTL_SC_DC                 EC_IOW(0x2e, ec_ioctl_config_t)
   106 #define EC_IOCTL_SC_SDO                EC_IOW(0x2e, ec_ioctl_sc_sdo_t)
   113 #define EC_IOCTL_SC_SDO                EC_IOW(0x2f, ec_ioctl_sc_sdo_t)
   107 #define EC_IOCTL_SC_SDO_REQUEST       EC_IOWR(0x2f, ec_ioctl_sdo_request_t)
   114 #define EC_IOCTL_SC_SDO_REQUEST       EC_IOWR(0x20, ec_ioctl_sdo_request_t)
   108 #define EC_IOCTL_SC_VOE               EC_IOWR(0x20, ec_ioctl_voe_t)
   115 #define EC_IOCTL_SC_VOE               EC_IOWR(0x31, ec_ioctl_voe_t)
   109 #define EC_IOCTL_SC_STATE             EC_IOWR(0x31, ec_ioctl_sc_state_t)
   116 #define EC_IOCTL_SC_STATE             EC_IOWR(0x32, ec_ioctl_sc_state_t)
   110 #define EC_IOCTL_DOMAIN_OFFSET          EC_IO(0x32)
   117 #define EC_IOCTL_DOMAIN_OFFSET          EC_IO(0x33)
   111 #define EC_IOCTL_DOMAIN_PROCESS         EC_IO(0x33)
   118 #define EC_IOCTL_DOMAIN_PROCESS         EC_IO(0x34)
   112 #define EC_IOCTL_DOMAIN_QUEUE           EC_IO(0x34)
   119 #define EC_IOCTL_DOMAIN_QUEUE           EC_IO(0x35)
   113 #define EC_IOCTL_DOMAIN_STATE         EC_IOWR(0x35, ec_ioctl_domain_state_t)
   120 #define EC_IOCTL_DOMAIN_STATE         EC_IOWR(0x36, ec_ioctl_domain_state_t)
   114 #define EC_IOCTL_SDO_REQUEST_TIMEOUT  EC_IOWR(0x36, ec_ioctl_sdo_request_t)
   121 #define EC_IOCTL_SDO_REQUEST_TIMEOUT  EC_IOWR(0x37, ec_ioctl_sdo_request_t)
   115 #define EC_IOCTL_SDO_REQUEST_STATE    EC_IOWR(0x37, ec_ioctl_sdo_request_t)
   122 #define EC_IOCTL_SDO_REQUEST_STATE    EC_IOWR(0x38, ec_ioctl_sdo_request_t)
   116 #define EC_IOCTL_SDO_REQUEST_READ     EC_IOWR(0x38, ec_ioctl_sdo_request_t)
   123 #define EC_IOCTL_SDO_REQUEST_READ     EC_IOWR(0x39, ec_ioctl_sdo_request_t)
   117 #define EC_IOCTL_SDO_REQUEST_WRITE    EC_IOWR(0x39, ec_ioctl_sdo_request_t)
   124 #define EC_IOCTL_SDO_REQUEST_WRITE    EC_IOWR(0x3a, ec_ioctl_sdo_request_t)
   118 #define EC_IOCTL_SDO_REQUEST_DATA     EC_IOWR(0x3a, ec_ioctl_sdo_request_t)
   125 #define EC_IOCTL_SDO_REQUEST_DATA     EC_IOWR(0x3b, ec_ioctl_sdo_request_t)
   119 #define EC_IOCTL_VOE_SEND_HEADER       EC_IOW(0x3b, ec_ioctl_voe_t)
   126 #define EC_IOCTL_VOE_SEND_HEADER       EC_IOW(0x3c, ec_ioctl_voe_t)
   120 #define EC_IOCTL_VOE_REC_HEADER       EC_IOWR(0x3c, ec_ioctl_voe_t)
   127 #define EC_IOCTL_VOE_REC_HEADER       EC_IOWR(0x3d, ec_ioctl_voe_t)
   121 #define EC_IOCTL_VOE_READ              EC_IOW(0x3d, ec_ioctl_voe_t)
   128 #define EC_IOCTL_VOE_READ              EC_IOW(0x3e, ec_ioctl_voe_t)
   122 #define EC_IOCTL_VOE_READ_NOSYNC       EC_IOW(0x3e, ec_ioctl_voe_t)
   129 #define EC_IOCTL_VOE_READ_NOSYNC       EC_IOW(0x3f, ec_ioctl_voe_t)
   123 #define EC_IOCTL_VOE_WRITE            EC_IOWR(0x3f, ec_ioctl_voe_t)
   130 #define EC_IOCTL_VOE_WRITE            EC_IOWR(0x40, ec_ioctl_voe_t)
   124 #define EC_IOCTL_VOE_EXEC             EC_IOWR(0x40, ec_ioctl_voe_t)
   131 #define EC_IOCTL_VOE_EXEC             EC_IOWR(0x41, ec_ioctl_voe_t)
   125 #define EC_IOCTL_VOE_DATA             EC_IOWR(0x41, ec_ioctl_voe_t)
   132 #define EC_IOCTL_VOE_DATA             EC_IOWR(0x42, ec_ioctl_voe_t)
   126 #define EC_IOCTL_SET_SEND_INTERVAL    EC_IOW(0x42, size_t)
   133 #define EC_IOCTL_SET_SEND_INTERVAL     EC_IOW(0x43, size_t)
   127 
   134 
   128 /*****************************************************************************/
   135 /*****************************************************************************/
   129 
   136 
   130 #define EC_IOCTL_STRING_SIZE 64
   137 #define EC_IOCTL_STRING_SIZE 64
       
   138 
       
   139 /*****************************************************************************/
       
   140 
       
   141 typedef struct {
       
   142     uint32_t ioctl_version_magic;
       
   143     uint32_t master_count;
       
   144 } ec_ioctl_module_t;
   131 
   145 
   132 /*****************************************************************************/
   146 /*****************************************************************************/
   133 
   147 
   134 typedef struct {
   148 typedef struct {
   135     uint32_t slave_count;
   149     uint32_t slave_count;