master/ioctl.h
changeset 990 4f223f3df05a
parent 989 816663ca9370
child 1001 a8eab75aa8e3
equal deleted inserted replaced
989:816663ca9370 990:4f223f3df05a
    52 #define EC_IO(nr)          _IO(EC_IOCTL_TYPE,nr)
    52 #define EC_IO(nr)          _IO(EC_IOCTL_TYPE,nr)
    53 #define EC_IOR(nr,type)   _IOR(EC_IOCTL_TYPE,nr,type)
    53 #define EC_IOR(nr,type)   _IOR(EC_IOCTL_TYPE,nr,type)
    54 #define EC_IOW(nr,type)   _IOW(EC_IOCTL_TYPE,nr,type)
    54 #define EC_IOW(nr,type)   _IOW(EC_IOCTL_TYPE,nr,type)
    55 #define EC_IOWR(nr,type) _IOWR(EC_IOCTL_TYPE,nr,type)
    55 #define EC_IOWR(nr,type) _IOWR(EC_IOCTL_TYPE,nr,type)
    56 
    56 
    57 #define EC_IOCTL_MASTER        EC_IOR(0x00, ec_ioctl_master_t)
    57 #define EC_IOCTL_MASTER            EC_IOR(0x00, ec_ioctl_master_t)
    58 #define EC_IOCTL_SLAVE        EC_IOWR(0x01, ec_ioctl_slave_t)
    58 #define EC_IOCTL_SLAVE            EC_IOWR(0x01, ec_ioctl_slave_t)
    59 #define EC_IOCTL_SYNC         EC_IOWR(0x02, ec_ioctl_sync_t)
    59 #define EC_IOCTL_SYNC             EC_IOWR(0x02, ec_ioctl_sync_t)
    60 #define EC_IOCTL_PDO          EC_IOWR(0x03, ec_ioctl_pdo_t)
    60 #define EC_IOCTL_PDO              EC_IOWR(0x03, ec_ioctl_pdo_t)
    61 #define EC_IOCTL_PDO_ENTRY    EC_IOWR(0x04, ec_ioctl_pdo_entry_t)
    61 #define EC_IOCTL_PDO_ENTRY        EC_IOWR(0x04, ec_ioctl_pdo_entry_t)
    62 #define EC_IOCTL_DOMAIN_COUNT   EC_IO(0x05)
    62 #define EC_IOCTL_DOMAIN_COUNT       EC_IO(0x05)
    63 #define EC_IOCTL_DOMAIN       EC_IOWR(0x06, ec_ioctl_domain_t)
    63 #define EC_IOCTL_DOMAIN           EC_IOWR(0x06, ec_ioctl_domain_t)
    64 #define EC_IOCTL_DOMAIN_FMMU  EC_IOWR(0x07, ec_ioctl_domain_fmmu_t)
    64 #define EC_IOCTL_DOMAIN_FMMU      EC_IOWR(0x07, ec_ioctl_domain_fmmu_t)
    65 #define EC_IOCTL_DATA         EC_IOWR(0x08, ec_ioctl_data_t)
    65 #define EC_IOCTL_DATA             EC_IOWR(0x08, ec_ioctl_data_t)
    66 #define EC_IOCTL_SET_DEBUG      EC_IO(0x09)
    66 #define EC_IOCTL_SET_DEBUG          EC_IO(0x09)
    67 #define EC_IOCTL_SLAVE_STATE   EC_IOW(0x0a, ec_ioctl_slave_state_t)
    67 #define EC_IOCTL_SLAVE_STATE       EC_IOW(0x0a, ec_ioctl_slave_state_t)
    68 #define EC_IOCTL_SDO          EC_IOWR(0x0b, ec_ioctl_sdo_t)
    68 #define EC_IOCTL_SDO              EC_IOWR(0x0b, ec_ioctl_sdo_t)
    69 #define EC_IOCTL_SDO_ENTRY    EC_IOWR(0x0c, ec_ioctl_sdo_entry_t)
    69 #define EC_IOCTL_SDO_ENTRY        EC_IOWR(0x0c, ec_ioctl_sdo_entry_t)
    70 #define EC_IOCTL_SDO_UPLOAD   EC_IOWR(0x0d, ec_ioctl_sdo_upload_t)
    70 #define EC_IOCTL_SDO_UPLOAD       EC_IOWR(0x0d, ec_ioctl_sdo_upload_t)
    71 #define EC_IOCTL_SDO_DOWNLOAD  EC_IOW(0x0e, ec_ioctl_sdo_download_t)
    71 #define EC_IOCTL_SDO_DOWNLOAD      EC_IOW(0x0e, ec_ioctl_sdo_download_t)
    72 #define EC_IOCTL_SII_READ     EC_IOWR(0x0f, ec_ioctl_sii_t)
    72 #define EC_IOCTL_SII_READ         EC_IOWR(0x0f, ec_ioctl_sii_t)
    73 #define EC_IOCTL_SII_WRITE     EC_IOW(0x10, ec_ioctl_sii_t)
    73 #define EC_IOCTL_SII_WRITE         EC_IOW(0x10, ec_ioctl_sii_t)
       
    74 #define EC_IOCTL_CONFIG           EC_IOWR(0x11, ec_ioctl_config_t)
       
    75 #define EC_IOCTL_CONFIG_PDO       EC_IOWR(0x12, ec_ioctl_config_pdo_t)
       
    76 #define EC_IOCTL_CONFIG_PDO_ENTRY EC_IOWR(0x12, ec_ioctl_config_pdo_entry_t)
       
    77 #define EC_IOCTL_CONFIG_SDO       EC_IOWR(0x13, ec_ioctl_config_sdo_t)
       
    78 
       
    79 #define EC_IOCTL_STRING_SIZE 64
    74 
    80 
    75 /*****************************************************************************/
    81 /*****************************************************************************/
    76 
    82 
    77 typedef struct {
    83 typedef struct {
    78     uint32_t slave_count;
    84     uint32_t slave_count;
       
    85     uint32_t config_count;
    79     uint8_t mode;
    86     uint8_t mode;
    80     struct {
    87     struct {
    81         uint8_t address[6];
    88         uint8_t address[6];
    82         uint8_t attached;
    89         uint8_t attached;
    83         uint32_t tx_count;
    90         uint32_t tx_count;
    84         uint32_t rx_count;
    91         uint32_t rx_count;
    85     } devices[2];
    92     } devices[2];
    86 } ec_ioctl_master_t;
    93 } ec_ioctl_master_t;
    87 
    94 
    88 /*****************************************************************************/
    95 /*****************************************************************************/
    89 
       
    90 #define EC_IOCTL_SLAVE_NAME_SIZE 77
       
    91 
    96 
    92 typedef struct {
    97 typedef struct {
    93     // input
    98     // input
    94     uint16_t position;
    99     uint16_t position;
    95 
   100 
   111     uint8_t state;
   116     uint8_t state;
   112     uint8_t error_flag;
   117     uint8_t error_flag;
   113     uint8_t sync_count;
   118     uint8_t sync_count;
   114     uint16_t sdo_count;
   119     uint16_t sdo_count;
   115     uint32_t sii_nwords;
   120     uint32_t sii_nwords;
   116     char name[EC_IOCTL_SLAVE_NAME_SIZE];
   121     char name[EC_IOCTL_STRING_SIZE];
   117 } ec_ioctl_slave_t;
   122 } ec_ioctl_slave_t;
   118 
   123 
   119 /*****************************************************************************/
   124 /*****************************************************************************/
   120 
   125 
   121 typedef struct {
   126 typedef struct {
   132     uint8_t pdo_count;
   137     uint8_t pdo_count;
   133 } ec_ioctl_sync_t;
   138 } ec_ioctl_sync_t;
   134 
   139 
   135 /*****************************************************************************/
   140 /*****************************************************************************/
   136 
   141 
   137 #define EC_IOCTL_PDO_NAME_SIZE 114
       
   138 
       
   139 typedef struct {
   142 typedef struct {
   140     // inputs
   143     // inputs
   141     uint16_t slave_position;
   144     uint16_t slave_position;
   142     uint32_t sync_index;
   145     uint32_t sync_index;
   143     uint32_t pdo_pos;
   146     uint32_t pdo_pos;
   144 
   147 
   145     // outputs
   148     // outputs
   146     uint8_t dir;
   149     uint8_t dir;
   147     uint16_t index;
   150     uint16_t index;
   148     uint8_t entry_count;
   151     uint8_t entry_count;
   149     char name[EC_IOCTL_PDO_NAME_SIZE];
   152     int8_t name[EC_IOCTL_STRING_SIZE];
   150 } ec_ioctl_pdo_t;
   153 } ec_ioctl_pdo_t;
   151 
   154 
   152 /*****************************************************************************/
   155 /*****************************************************************************/
   153 
       
   154 #define EC_IOCTL_PDO_ENTRY_NAME_SIZE 110
       
   155 
   156 
   156 typedef struct {
   157 typedef struct {
   157     // inputs
   158     // inputs
   158     uint16_t slave_position;
   159     uint16_t slave_position;
   159     uint32_t sync_index;
   160     uint32_t sync_index;
   162 
   163 
   163     // outputs
   164     // outputs
   164     uint16_t index;
   165     uint16_t index;
   165     uint8_t subindex;
   166     uint8_t subindex;
   166     uint8_t bit_length;
   167     uint8_t bit_length;
   167     char name[EC_IOCTL_PDO_NAME_SIZE];
   168     int8_t name[EC_IOCTL_STRING_SIZE];
   168 } ec_ioctl_pdo_entry_t;
   169 } ec_ioctl_pdo_entry_t;
   169 
   170 
   170 /*****************************************************************************/
   171 /*****************************************************************************/
   171 
   172 
   172 typedef struct {
   173 typedef struct {
   200 
   201 
   201 typedef struct {
   202 typedef struct {
   202     // inputs
   203     // inputs
   203 	uint32_t domain_index;
   204 	uint32_t domain_index;
   204     uint32_t data_size;
   205     uint32_t data_size;
   205     unsigned char *target;
   206     uint8_t *target;
   206 } ec_ioctl_data_t;
   207 } ec_ioctl_data_t;
   207 
   208 
   208 /*****************************************************************************/
   209 /*****************************************************************************/
   209 
   210 
   210 typedef struct {
   211 typedef struct {
   213     uint8_t requested_state;
   214     uint8_t requested_state;
   214 } ec_ioctl_slave_state_t;
   215 } ec_ioctl_slave_state_t;
   215 
   216 
   216 /*****************************************************************************/
   217 /*****************************************************************************/
   217 
   218 
   218 #define EC_IOCTL_SDO_NAME_SIZE 121
       
   219 
       
   220 typedef struct {
   219 typedef struct {
   221     // inputs
   220     // inputs
   222     uint16_t slave_position;
   221     uint16_t slave_position;
   223     uint16_t sdo_position;
   222     uint16_t sdo_position;
   224 
   223 
   225     // outputs
   224     // outputs
   226     uint16_t sdo_index;
   225     uint16_t sdo_index;
   227     uint8_t max_subindex;
   226     uint8_t max_subindex;
   228     char name[EC_IOCTL_SDO_NAME_SIZE];
   227     int8_t name[EC_IOCTL_STRING_SIZE];
   229 } ec_ioctl_sdo_t;
   228 } ec_ioctl_sdo_t;
   230 
   229 
   231 /*****************************************************************************/
   230 /*****************************************************************************/
   232 
       
   233 #define EC_IOCTL_SDO_ENTRY_DESCRIPTION_SIZE 120
       
   234 
   231 
   235 typedef struct {
   232 typedef struct {
   236     // inputs
   233     // inputs
   237     uint16_t slave_position;
   234     uint16_t slave_position;
   238     int sdo_spec; // positive: index, negative: list position
   235     int sdo_spec; // positive: index, negative: list position
   239     uint8_t sdo_entry_subindex;
   236     uint8_t sdo_entry_subindex;
   240 
   237 
   241     // outputs
   238     // outputs
   242     uint16_t data_type;
   239     uint16_t data_type;
   243     uint16_t bit_length;
   240     uint16_t bit_length;
   244     char description[EC_IOCTL_SDO_ENTRY_DESCRIPTION_SIZE];
   241     int8_t description[EC_IOCTL_STRING_SIZE];
   245 } ec_ioctl_sdo_entry_t;
   242 } ec_ioctl_sdo_entry_t;
   246 
   243 
   247 /*****************************************************************************/
   244 /*****************************************************************************/
   248 
   245 
   249 typedef struct {
   246 typedef struct {
   279     uint16_t *words;
   276     uint16_t *words;
   280 } ec_ioctl_sii_t;
   277 } ec_ioctl_sii_t;
   281 
   278 
   282 /*****************************************************************************/
   279 /*****************************************************************************/
   283 
   280 
       
   281 typedef struct {
       
   282     // inputs
       
   283     uint32_t config_index;
       
   284 
       
   285     // outputs
       
   286     uint16_t alias;
       
   287     uint16_t position;
       
   288     uint32_t vendor_id;
       
   289     uint32_t product_code;
       
   290     uint32_t pdo_count[2];
       
   291     uint32_t sdo_count;
       
   292     uint8_t attached;
       
   293 } ec_ioctl_config_t;
       
   294 
       
   295 /*****************************************************************************/
       
   296 
       
   297 typedef struct {
       
   298     // inputs
       
   299     uint32_t config_index;
       
   300     uint32_t direction;
       
   301     uint32_t pdo_pos;
       
   302 
       
   303     // outputs
       
   304     uint16_t index;
       
   305     uint8_t entry_count;
       
   306     int8_t name[EC_IOCTL_STRING_SIZE];
       
   307 } ec_ioctl_config_pdo_t;
       
   308 
       
   309 /*****************************************************************************/
       
   310 
       
   311 typedef struct {
       
   312     // inputs
       
   313     uint32_t config_index;
       
   314     uint32_t direction;
       
   315     uint32_t pdo_pos;
       
   316     uint32_t entry_pos;
       
   317 
       
   318     // outputs
       
   319     uint16_t index;
       
   320     uint8_t subindex;
       
   321     uint8_t bit_length;
       
   322     int8_t name[EC_IOCTL_STRING_SIZE];
       
   323 } ec_ioctl_config_pdo_entry_t;
       
   324 
       
   325 /*****************************************************************************/
       
   326 
       
   327 typedef struct {
       
   328     // inputs
       
   329     uint32_t config_index;
       
   330     uint32_t sdo_pos;
       
   331 
       
   332     // outputs
       
   333     uint16_t index;
       
   334     uint8_t subindex;
       
   335     uint32_t size;
       
   336     uint8_t data[4];
       
   337 } ec_ioctl_config_sdo_t;
       
   338 
       
   339 /*****************************************************************************/
       
   340 
   284 #endif
   341 #endif