master/ioctl.c
branchstable-1.5
changeset 2481 c99ff159b60d
parent 2477 1d5ebfb7fec1
child 2483 ec53d873dc5e
equal deleted inserted replaced
2480:8b1e26cc88ac 2481:c99ff159b60d
    46  *
    46  *
    47  * Requires CPU timestamp counter!
    47  * Requires CPU timestamp counter!
    48  */
    48  */
    49 #define DEBUG_LATENCY 0
    49 #define DEBUG_LATENCY 0
    50 
    50 
       
    51 #if 0
       
    52 #define ATTRIBUTES __attribute__ ((__noinline__))
       
    53 #else
       
    54 #define ATTRIBUTES
       
    55 #endif
       
    56 
    51 /*****************************************************************************/
    57 /*****************************************************************************/
    52 
    58 
    53 /** Copies a string to an ioctl structure.
    59 /** Copies a string to an ioctl structure.
    54  */
    60  */
    55 static void ec_ioctl_strcpy(
    61 static void ec_ioctl_strcpy(
    67 
    73 
    68 /*****************************************************************************/
    74 /*****************************************************************************/
    69 
    75 
    70 /** Get module information.
    76 /** Get module information.
    71  */
    77  */
    72 static int ec_ioctl_module(
    78 static ATTRIBUTES int ec_ioctl_module(
    73         void *arg /**< Userspace address to store the results. */
    79         void *arg /**< Userspace address to store the results. */
    74         )
    80         )
    75 {
    81 {
    76     ec_ioctl_module_t data;
    82     ec_ioctl_module_t data;
    77 
    83 
    86 
    92 
    87 /*****************************************************************************/
    93 /*****************************************************************************/
    88 
    94 
    89 /** Get master information.
    95 /** Get master information.
    90  */
    96  */
    91 static int ec_ioctl_master(
    97 static ATTRIBUTES int ec_ioctl_master(
    92         ec_master_t *master, /**< EtherCAT master. */
    98         ec_master_t *master, /**< EtherCAT master. */
    93         void *arg /**< Userspace address to store the results. */
    99         void *arg /**< Userspace address to store the results. */
    94         )
   100         )
    95 {
   101 {
    96     ec_ioctl_master_t io;
   102     ec_ioctl_master_t io;
   179 
   185 
   180 /*****************************************************************************/
   186 /*****************************************************************************/
   181 
   187 
   182 /** Get slave information.
   188 /** Get slave information.
   183  */
   189  */
   184 static int ec_ioctl_slave(
   190 static ATTRIBUTES int ec_ioctl_slave(
   185         ec_master_t *master, /**< EtherCAT master. */
   191         ec_master_t *master, /**< EtherCAT master. */
   186         void *arg /**< Userspace address to store the results. */
   192         void *arg /**< Userspace address to store the results. */
   187         )
   193         )
   188 {
   194 {
   189     ec_ioctl_slave_t data;
   195     ec_ioctl_slave_t data;
   264 
   270 
   265 /*****************************************************************************/
   271 /*****************************************************************************/
   266 
   272 
   267 /** Get slave sync manager information.
   273 /** Get slave sync manager information.
   268  */
   274  */
   269 static int ec_ioctl_slave_sync(
   275 static ATTRIBUTES int ec_ioctl_slave_sync(
   270         ec_master_t *master, /**< EtherCAT master. */
   276         ec_master_t *master, /**< EtherCAT master. */
   271         void *arg /**< Userspace address to store the results. */
   277         void *arg /**< Userspace address to store the results. */
   272         )
   278         )
   273 {
   279 {
   274     ec_ioctl_slave_sync_t data;
   280     ec_ioctl_slave_sync_t data;
   315 
   321 
   316 /*****************************************************************************/
   322 /*****************************************************************************/
   317 
   323 
   318 /** Get slave sync manager PDO information.
   324 /** Get slave sync manager PDO information.
   319  */
   325  */
   320 static int ec_ioctl_slave_sync_pdo(
   326 static ATTRIBUTES int ec_ioctl_slave_sync_pdo(
   321         ec_master_t *master, /**< EtherCAT master. */
   327         ec_master_t *master, /**< EtherCAT master. */
   322         void *arg /**< Userspace address to store the results. */
   328         void *arg /**< Userspace address to store the results. */
   323         )
   329         )
   324 {
   330 {
   325     ec_ioctl_slave_sync_pdo_t data;
   331     ec_ioctl_slave_sync_pdo_t data;
   372 
   378 
   373 /*****************************************************************************/
   379 /*****************************************************************************/
   374 
   380 
   375 /** Get slave sync manager PDO entry information.
   381 /** Get slave sync manager PDO entry information.
   376  */
   382  */
   377 static int ec_ioctl_slave_sync_pdo_entry(
   383 static ATTRIBUTES int ec_ioctl_slave_sync_pdo_entry(
   378         ec_master_t *master, /**< EtherCAT master. */
   384         ec_master_t *master, /**< EtherCAT master. */
   379         void *arg /**< Userspace address to store the results. */
   385         void *arg /**< Userspace address to store the results. */
   380         )
   386         )
   381 {
   387 {
   382     ec_ioctl_slave_sync_pdo_entry_t data;
   388     ec_ioctl_slave_sync_pdo_entry_t data;
   439 
   445 
   440 /*****************************************************************************/
   446 /*****************************************************************************/
   441 
   447 
   442 /** Get domain information.
   448 /** Get domain information.
   443  */
   449  */
   444 static int ec_ioctl_domain(
   450 static ATTRIBUTES int ec_ioctl_domain(
   445         ec_master_t *master, /**< EtherCAT master. */
   451         ec_master_t *master, /**< EtherCAT master. */
   446         void *arg /**< Userspace address to store the results. */
   452         void *arg /**< Userspace address to store the results. */
   447         )
   453         )
   448 {
   454 {
   449     ec_ioctl_domain_t data;
   455     ec_ioctl_domain_t data;
   482 
   488 
   483 /*****************************************************************************/
   489 /*****************************************************************************/
   484 
   490 
   485 /** Get domain FMMU information.
   491 /** Get domain FMMU information.
   486  */
   492  */
   487 static int ec_ioctl_domain_fmmu(
   493 static ATTRIBUTES int ec_ioctl_domain_fmmu(
   488         ec_master_t *master, /**< EtherCAT master. */
   494         ec_master_t *master, /**< EtherCAT master. */
   489         void *arg /**< Userspace address to store the results. */
   495         void *arg /**< Userspace address to store the results. */
   490         )
   496         )
   491 {
   497 {
   492     ec_ioctl_domain_fmmu_t data;
   498     ec_ioctl_domain_fmmu_t data;
   532 
   538 
   533 /*****************************************************************************/
   539 /*****************************************************************************/
   534 
   540 
   535 /** Get domain data.
   541 /** Get domain data.
   536  */
   542  */
   537 static int ec_ioctl_domain_data(
   543 static ATTRIBUTES int ec_ioctl_domain_data(
   538         ec_master_t *master, /**< EtherCAT master. */
   544         ec_master_t *master, /**< EtherCAT master. */
   539         void *arg /**< Userspace address to store the results. */
   545         void *arg /**< Userspace address to store the results. */
   540         )
   546         )
   541 {
   547 {
   542     ec_ioctl_domain_data_t data;
   548     ec_ioctl_domain_data_t data;
   575 
   581 
   576 /*****************************************************************************/
   582 /*****************************************************************************/
   577 
   583 
   578 /** Set master debug level.
   584 /** Set master debug level.
   579  */
   585  */
   580 static int ec_ioctl_master_debug(
   586 static ATTRIBUTES int ec_ioctl_master_debug(
   581         ec_master_t *master, /**< EtherCAT master. */
   587         ec_master_t *master, /**< EtherCAT master. */
   582         void *arg /**< ioctl() argument. */
   588         void *arg /**< ioctl() argument. */
   583         )
   589         )
   584 {
   590 {
   585     return ec_master_debug_level(master, (unsigned int) arg);
   591     return ec_master_debug_level(master, (unsigned int) arg);
   587 
   593 
   588 /*****************************************************************************/
   594 /*****************************************************************************/
   589 
   595 
   590 /** Issue a bus scan.
   596 /** Issue a bus scan.
   591  */
   597  */
   592 static int ec_ioctl_master_rescan(
   598 static ATTRIBUTES int ec_ioctl_master_rescan(
   593         ec_master_t *master, /**< EtherCAT master. */
   599         ec_master_t *master, /**< EtherCAT master. */
   594         void *arg /**< ioctl() argument. */
   600         void *arg /**< ioctl() argument. */
   595         )
   601         )
   596 {
   602 {
   597     master->fsm.rescan_required = 1;
   603     master->fsm.rescan_required = 1;
   600 
   606 
   601 /*****************************************************************************/
   607 /*****************************************************************************/
   602 
   608 
   603 /** Set slave state.
   609 /** Set slave state.
   604  */
   610  */
   605 static int ec_ioctl_slave_state(
   611 static ATTRIBUTES int ec_ioctl_slave_state(
   606         ec_master_t *master, /**< EtherCAT master. */
   612         ec_master_t *master, /**< EtherCAT master. */
   607         void *arg /**< ioctl() argument. */
   613         void *arg /**< ioctl() argument. */
   608         )
   614         )
   609 {
   615 {
   610     ec_ioctl_slave_state_t data;
   616     ec_ioctl_slave_state_t data;
   633 
   639 
   634 /*****************************************************************************/
   640 /*****************************************************************************/
   635 
   641 
   636 /** Get slave SDO information.
   642 /** Get slave SDO information.
   637  */
   643  */
   638 static int ec_ioctl_slave_sdo(
   644 static ATTRIBUTES int ec_ioctl_slave_sdo(
   639         ec_master_t *master, /**< EtherCAT master. */
   645         ec_master_t *master, /**< EtherCAT master. */
   640         void *arg /**< ioctl() argument. */
   646         void *arg /**< ioctl() argument. */
   641         )
   647         )
   642 {
   648 {
   643     ec_ioctl_slave_sdo_t data;
   649     ec_ioctl_slave_sdo_t data;
   680 
   686 
   681 /*****************************************************************************/
   687 /*****************************************************************************/
   682 
   688 
   683 /** Get slave SDO entry information.
   689 /** Get slave SDO entry information.
   684  */
   690  */
   685 static int ec_ioctl_slave_sdo_entry(
   691 static ATTRIBUTES int ec_ioctl_slave_sdo_entry(
   686         ec_master_t *master, /**< EtherCAT master. */
   692         ec_master_t *master, /**< EtherCAT master. */
   687         void *arg /**< ioctl() argument. */
   693         void *arg /**< ioctl() argument. */
   688         )
   694         )
   689 {
   695 {
   690     ec_ioctl_slave_sdo_entry_t data;
   696     ec_ioctl_slave_sdo_entry_t data;
   758 
   764 
   759 /*****************************************************************************/
   765 /*****************************************************************************/
   760 
   766 
   761 /** Upload SDO.
   767 /** Upload SDO.
   762  */
   768  */
   763 static int ec_ioctl_slave_sdo_upload(
   769 static ATTRIBUTES int ec_ioctl_slave_sdo_upload(
   764         ec_master_t *master, /**< EtherCAT master. */
   770         ec_master_t *master, /**< EtherCAT master. */
   765         void *arg /**< ioctl() argument. */
   771         void *arg /**< ioctl() argument. */
   766         )
   772         )
   767 {
   773 {
   768     ec_ioctl_slave_sdo_upload_t data;
   774     ec_ioctl_slave_sdo_upload_t data;
   802 
   808 
   803 /*****************************************************************************/
   809 /*****************************************************************************/
   804 
   810 
   805 /** Download SDO.
   811 /** Download SDO.
   806  */
   812  */
   807 static int ec_ioctl_slave_sdo_download(
   813 static ATTRIBUTES int ec_ioctl_slave_sdo_download(
   808         ec_master_t *master, /**< EtherCAT master. */
   814         ec_master_t *master, /**< EtherCAT master. */
   809         void *arg /**< ioctl() argument. */
   815         void *arg /**< ioctl() argument. */
   810         )
   816         )
   811 {
   817 {
   812     ec_ioctl_slave_sdo_download_t data;
   818     ec_ioctl_slave_sdo_download_t data;
   848 
   854 
   849 /*****************************************************************************/
   855 /*****************************************************************************/
   850 
   856 
   851 /** Read a slave's SII.
   857 /** Read a slave's SII.
   852  */
   858  */
   853 static int ec_ioctl_slave_sii_read(
   859 static ATTRIBUTES int ec_ioctl_slave_sii_read(
   854         ec_master_t *master, /**< EtherCAT master. */
   860         ec_master_t *master, /**< EtherCAT master. */
   855         void *arg /**< ioctl() argument. */
   861         void *arg /**< ioctl() argument. */
   856         )
   862         )
   857 {
   863 {
   858     ec_ioctl_slave_sii_t data;
   864     ec_ioctl_slave_sii_t data;
   894 
   900 
   895 /*****************************************************************************/
   901 /*****************************************************************************/
   896 
   902 
   897 /** Write a slave's SII.
   903 /** Write a slave's SII.
   898  */
   904  */
   899 static int ec_ioctl_slave_sii_write(
   905 static ATTRIBUTES int ec_ioctl_slave_sii_write(
   900         ec_master_t *master, /**< EtherCAT master. */
   906         ec_master_t *master, /**< EtherCAT master. */
   901         void *arg /**< ioctl() argument. */
   907         void *arg /**< ioctl() argument. */
   902         )
   908         )
   903 {
   909 {
   904     ec_ioctl_slave_sii_t data;
   910     ec_ioctl_slave_sii_t data;
   980 
   986 
   981 /*****************************************************************************/
   987 /*****************************************************************************/
   982 
   988 
   983 /** Read a slave's registers.
   989 /** Read a slave's registers.
   984  */
   990  */
   985 static int ec_ioctl_slave_reg_read(
   991 static ATTRIBUTES int ec_ioctl_slave_reg_read(
   986         ec_master_t *master, /**< EtherCAT master. */
   992         ec_master_t *master, /**< EtherCAT master. */
   987         void *arg /**< ioctl() argument. */
   993         void *arg /**< ioctl() argument. */
   988         )
   994         )
   989 {
   995 {
   990     ec_ioctl_slave_reg_t io;
   996     ec_ioctl_slave_reg_t io;
  1057 
  1063 
  1058 /*****************************************************************************/
  1064 /*****************************************************************************/
  1059 
  1065 
  1060 /** Write a slave's registers.
  1066 /** Write a slave's registers.
  1061  */
  1067  */
  1062 static int ec_ioctl_slave_reg_write(
  1068 static ATTRIBUTES int ec_ioctl_slave_reg_write(
  1063         ec_master_t *master, /**< EtherCAT master. */
  1069         ec_master_t *master, /**< EtherCAT master. */
  1064         void *arg /**< ioctl() argument. */
  1070         void *arg /**< ioctl() argument. */
  1065         )
  1071         )
  1066 {
  1072 {
  1067     ec_ioctl_slave_reg_t io;
  1073     ec_ioctl_slave_reg_t io;
  1133 
  1139 
  1134 /*****************************************************************************/
  1140 /*****************************************************************************/
  1135 
  1141 
  1136 /** Get slave configuration information.
  1142 /** Get slave configuration information.
  1137  */
  1143  */
  1138 static int ec_ioctl_config(
  1144 static ATTRIBUTES int ec_ioctl_config(
  1139         ec_master_t *master, /**< EtherCAT master. */
  1145         ec_master_t *master, /**< EtherCAT master. */
  1140         void *arg /**< ioctl() argument. */
  1146         void *arg /**< ioctl() argument. */
  1141         )
  1147         )
  1142 {
  1148 {
  1143     ec_ioctl_config_t data;
  1149     ec_ioctl_config_t data;
  1189 
  1195 
  1190 /*****************************************************************************/
  1196 /*****************************************************************************/
  1191 
  1197 
  1192 /** Get slave configuration PDO information.
  1198 /** Get slave configuration PDO information.
  1193  */
  1199  */
  1194 static int ec_ioctl_config_pdo(
  1200 static ATTRIBUTES int ec_ioctl_config_pdo(
  1195         ec_master_t *master, /**< EtherCAT master. */
  1201         ec_master_t *master, /**< EtherCAT master. */
  1196         void *arg /**< ioctl() argument. */
  1202         void *arg /**< ioctl() argument. */
  1197         )
  1203         )
  1198 {
  1204 {
  1199     ec_ioctl_config_pdo_t data;
  1205     ec_ioctl_config_pdo_t data;
  1243 
  1249 
  1244 /*****************************************************************************/
  1250 /*****************************************************************************/
  1245 
  1251 
  1246 /** Get slave configuration PDO entry information.
  1252 /** Get slave configuration PDO entry information.
  1247  */
  1253  */
  1248 static int ec_ioctl_config_pdo_entry(
  1254 static ATTRIBUTES int ec_ioctl_config_pdo_entry(
  1249         ec_master_t *master, /**< EtherCAT master. */
  1255         ec_master_t *master, /**< EtherCAT master. */
  1250         void *arg /**< ioctl() argument. */
  1256         void *arg /**< ioctl() argument. */
  1251         )
  1257         )
  1252 {
  1258 {
  1253     ec_ioctl_config_pdo_entry_t data;
  1259     ec_ioctl_config_pdo_entry_t data;
  1306 
  1312 
  1307 /*****************************************************************************/
  1313 /*****************************************************************************/
  1308 
  1314 
  1309 /** Get slave configuration SDO information.
  1315 /** Get slave configuration SDO information.
  1310  */
  1316  */
  1311 static int ec_ioctl_config_sdo(
  1317 static ATTRIBUTES int ec_ioctl_config_sdo(
  1312         ec_master_t *master, /**< EtherCAT master. */
  1318         ec_master_t *master, /**< EtherCAT master. */
  1313         void *arg /**< ioctl() argument. */
  1319         void *arg /**< ioctl() argument. */
  1314         )
  1320         )
  1315 {
  1321 {
  1316     ec_ioctl_config_sdo_t *ioctl;
  1322     ec_ioctl_config_sdo_t *ioctl;
  1368 
  1374 
  1369 /*****************************************************************************/
  1375 /*****************************************************************************/
  1370 
  1376 
  1371 /** Get slave configuration IDN information.
  1377 /** Get slave configuration IDN information.
  1372  */
  1378  */
  1373 static int ec_ioctl_config_idn(
  1379 static ATTRIBUTES int ec_ioctl_config_idn(
  1374         ec_master_t *master, /**< EtherCAT master. */
  1380         ec_master_t *master, /**< EtherCAT master. */
  1375         void *arg /**< ioctl() argument. */
  1381         void *arg /**< ioctl() argument. */
  1376         )
  1382         )
  1377 {
  1383 {
  1378     ec_ioctl_config_idn_t *ioctl;
  1384     ec_ioctl_config_idn_t *ioctl;
  1432 
  1438 
  1433 #ifdef EC_EOE
  1439 #ifdef EC_EOE
  1434 
  1440 
  1435 /** Get EoE handler information.
  1441 /** Get EoE handler information.
  1436  */
  1442  */
  1437 static int ec_ioctl_eoe_handler(
  1443 static ATTRIBUTES int ec_ioctl_eoe_handler(
  1438         ec_master_t *master, /**< EtherCAT master. */
  1444         ec_master_t *master, /**< EtherCAT master. */
  1439         void *arg /**< ioctl() argument. */
  1445         void *arg /**< ioctl() argument. */
  1440         )
  1446         )
  1441 {
  1447 {
  1442     ec_ioctl_eoe_handler_t data;
  1448     ec_ioctl_eoe_handler_t data;
  1482 
  1488 
  1483 /*****************************************************************************/
  1489 /*****************************************************************************/
  1484 
  1490 
  1485 /** Request the master from userspace.
  1491 /** Request the master from userspace.
  1486  */
  1492  */
  1487 static int ec_ioctl_request(
  1493 static ATTRIBUTES int ec_ioctl_request(
  1488         ec_master_t *master, /**< EtherCAT master. */
  1494         ec_master_t *master, /**< EtherCAT master. */
  1489         void *arg, /**< ioctl() argument. */
  1495         void *arg, /**< ioctl() argument. */
  1490         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1496         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1491         )
  1497         )
  1492 {
  1498 {
  1505 
  1511 
  1506 /*****************************************************************************/
  1512 /*****************************************************************************/
  1507 
  1513 
  1508 /** Create a domain.
  1514 /** Create a domain.
  1509  */
  1515  */
  1510 static int ec_ioctl_create_domain(
  1516 static ATTRIBUTES int ec_ioctl_create_domain(
  1511         ec_master_t *master, /**< EtherCAT master. */
  1517         ec_master_t *master, /**< EtherCAT master. */
  1512         void *arg, /**< ioctl() argument. */
  1518         void *arg, /**< ioctl() argument. */
  1513         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1519         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1514         )
  1520         )
  1515 {
  1521 {
  1527 
  1533 
  1528 /*****************************************************************************/
  1534 /*****************************************************************************/
  1529 
  1535 
  1530 /** Create a slave configuration.
  1536 /** Create a slave configuration.
  1531  */
  1537  */
  1532 static int ec_ioctl_create_slave_config(
  1538 static ATTRIBUTES int ec_ioctl_create_slave_config(
  1533         ec_master_t *master, /**< EtherCAT master. */
  1539         ec_master_t *master, /**< EtherCAT master. */
  1534         void *arg, /**< ioctl() argument. */
  1540         void *arg, /**< ioctl() argument. */
  1535         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1541         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1536         )
  1542         )
  1537 {
  1543 {
  1571 
  1577 
  1572 /*****************************************************************************/
  1578 /*****************************************************************************/
  1573 
  1579 
  1574 /** Select the DC reference clock.
  1580 /** Select the DC reference clock.
  1575  */
  1581  */
  1576 static int ec_ioctl_select_ref_clock(
  1582 static ATTRIBUTES int ec_ioctl_select_ref_clock(
  1577         ec_master_t *master, /**< EtherCAT master. */
  1583         ec_master_t *master, /**< EtherCAT master. */
  1578         void *arg, /**< ioctl() argument. */
  1584         void *arg, /**< ioctl() argument. */
  1579         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1585         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1580         )
  1586         )
  1581 {
  1587 {
  1610 
  1616 
  1611 /*****************************************************************************/
  1617 /*****************************************************************************/
  1612 
  1618 
  1613 /** Activates the master.
  1619 /** Activates the master.
  1614  */
  1620  */
  1615 static int ec_ioctl_activate(
  1621 static ATTRIBUTES int ec_ioctl_activate(
  1616         ec_master_t *master, /**< EtherCAT master. */
  1622         ec_master_t *master, /**< EtherCAT master. */
  1617         void *arg, /**< ioctl() argument. */
  1623         void *arg, /**< ioctl() argument. */
  1618         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1624         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1619         )
  1625         )
  1620 {
  1626 {
  1691 
  1697 
  1692 /*****************************************************************************/
  1698 /*****************************************************************************/
  1693 
  1699 
  1694 /** Deactivates the master.
  1700 /** Deactivates the master.
  1695  */
  1701  */
  1696 static int ec_ioctl_deactivate(
  1702 static ATTRIBUTES int ec_ioctl_deactivate(
  1697         ec_master_t *master, /**< EtherCAT master. */
  1703         ec_master_t *master, /**< EtherCAT master. */
  1698         void *arg, /**< ioctl() argument. */
  1704         void *arg, /**< ioctl() argument. */
  1699         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1705         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1700         )
  1706         )
  1701 {
  1707 {
  1708 
  1714 
  1709 /*****************************************************************************/
  1715 /*****************************************************************************/
  1710 
  1716 
  1711 /** Set max. number of databytes in a cycle
  1717 /** Set max. number of databytes in a cycle
  1712  */
  1718  */
  1713 static int ec_ioctl_set_send_interval(
  1719 static ATTRIBUTES int ec_ioctl_set_send_interval(
  1714         ec_master_t *master, /**< EtherCAT master. */
  1720         ec_master_t *master, /**< EtherCAT master. */
  1715         void *arg, /**< ioctl() argument. */
  1721         void *arg, /**< ioctl() argument. */
  1716         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1722         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1717         )
  1723         )
  1718 {
  1724 {
  1738 
  1744 
  1739 /*****************************************************************************/
  1745 /*****************************************************************************/
  1740 
  1746 
  1741 /** Send frames.
  1747 /** Send frames.
  1742  */
  1748  */
  1743 static int ec_ioctl_send(
  1749 static ATTRIBUTES int ec_ioctl_send(
  1744         ec_master_t *master, /**< EtherCAT master. */
  1750         ec_master_t *master, /**< EtherCAT master. */
  1745         void *arg, /**< ioctl() argument. */
  1751         void *arg, /**< ioctl() argument. */
  1746         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1752         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1747         )
  1753         )
  1748 {
  1754 {
  1757 
  1763 
  1758 /*****************************************************************************/
  1764 /*****************************************************************************/
  1759 
  1765 
  1760 /** Receive frames.
  1766 /** Receive frames.
  1761  */
  1767  */
  1762 static int ec_ioctl_receive(
  1768 static ATTRIBUTES int ec_ioctl_receive(
  1763         ec_master_t *master, /**< EtherCAT master. */
  1769         ec_master_t *master, /**< EtherCAT master. */
  1764         void *arg, /**< ioctl() argument. */
  1770         void *arg, /**< ioctl() argument. */
  1765         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1771         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1766         )
  1772         )
  1767 {
  1773 {
  1776 
  1782 
  1777 /*****************************************************************************/
  1783 /*****************************************************************************/
  1778 
  1784 
  1779 /** Get the master state.
  1785 /** Get the master state.
  1780  */
  1786  */
  1781 static int ec_ioctl_master_state(
  1787 static ATTRIBUTES int ec_ioctl_master_state(
  1782         ec_master_t *master, /**< EtherCAT master. */
  1788         ec_master_t *master, /**< EtherCAT master. */
  1783         void *arg, /**< ioctl() argument. */
  1789         void *arg, /**< ioctl() argument. */
  1784         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1790         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1785         )
  1791         )
  1786 {
  1792 {
  1796 
  1802 
  1797 /*****************************************************************************/
  1803 /*****************************************************************************/
  1798 
  1804 
  1799 /** Get the master state.
  1805 /** Get the master state.
  1800  */
  1806  */
  1801 static int ec_ioctl_master_link_state(
  1807 static ATTRIBUTES int ec_ioctl_master_link_state(
  1802         ec_master_t *master, /**< EtherCAT master. */
  1808         ec_master_t *master, /**< EtherCAT master. */
  1803         void *arg, /**< ioctl() argument. */
  1809         void *arg, /**< ioctl() argument. */
  1804         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1810         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1805         )
  1811         )
  1806 {
  1812 {
  1826 
  1832 
  1827 /*****************************************************************************/
  1833 /*****************************************************************************/
  1828 
  1834 
  1829 /** Set the master dc app time.
  1835 /** Set the master dc app time.
  1830  */
  1836  */
  1831 static int ec_ioctl_app_time(
  1837 static ATTRIBUTES int ec_ioctl_app_time(
  1832         ec_master_t *master, /**< EtherCAT master. */
  1838         ec_master_t *master, /**< EtherCAT master. */
  1833         void *arg, /**< ioctl() argument. */
  1839         void *arg, /**< ioctl() argument. */
  1834         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1840         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1835         )
  1841         )
  1836 {
  1842 {
  1849 
  1855 
  1850 /*****************************************************************************/
  1856 /*****************************************************************************/
  1851 
  1857 
  1852 /** Sync the reference clock.
  1858 /** Sync the reference clock.
  1853  */
  1859  */
  1854 static int ec_ioctl_sync_ref(
  1860 static ATTRIBUTES int ec_ioctl_sync_ref(
  1855         ec_master_t *master, /**< EtherCAT master. */
  1861         ec_master_t *master, /**< EtherCAT master. */
  1856         void *arg, /**< ioctl() argument. */
  1862         void *arg, /**< ioctl() argument. */
  1857         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1863         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1858         )
  1864         )
  1859 {
  1865 {
  1868 
  1874 
  1869 /*****************************************************************************/
  1875 /*****************************************************************************/
  1870 
  1876 
  1871 /** Sync the slave clocks.
  1877 /** Sync the slave clocks.
  1872  */
  1878  */
  1873 static int ec_ioctl_sync_slaves(
  1879 static ATTRIBUTES int ec_ioctl_sync_slaves(
  1874         ec_master_t *master, /**< EtherCAT master. */
  1880         ec_master_t *master, /**< EtherCAT master. */
  1875         void *arg, /**< ioctl() argument. */
  1881         void *arg, /**< ioctl() argument. */
  1876         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1882         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1877         )
  1883         )
  1878 {
  1884 {
  1887 
  1893 
  1888 /*****************************************************************************/
  1894 /*****************************************************************************/
  1889 
  1895 
  1890 /** Get the system time of the reference clock.
  1896 /** Get the system time of the reference clock.
  1891  */
  1897  */
  1892 static int ec_ioctl_ref_clock_time(
  1898 static ATTRIBUTES int ec_ioctl_ref_clock_time(
  1893         ec_master_t *master, /**< EtherCAT master. */
  1899         ec_master_t *master, /**< EtherCAT master. */
  1894         void *arg, /**< ioctl() argument. */
  1900         void *arg, /**< ioctl() argument. */
  1895         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1901         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1896         )
  1902         )
  1897 {
  1903 {
  1916 
  1922 
  1917 /*****************************************************************************/
  1923 /*****************************************************************************/
  1918 
  1924 
  1919 /** Queue the sync monitoring datagram.
  1925 /** Queue the sync monitoring datagram.
  1920  */
  1926  */
  1921 static int ec_ioctl_sync_mon_queue(
  1927 static ATTRIBUTES int ec_ioctl_sync_mon_queue(
  1922         ec_master_t *master, /**< EtherCAT master. */
  1928         ec_master_t *master, /**< EtherCAT master. */
  1923         void *arg, /**< ioctl() argument. */
  1929         void *arg, /**< ioctl() argument. */
  1924         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1930         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1925         )
  1931         )
  1926 {
  1932 {
  1935 
  1941 
  1936 /*****************************************************************************/
  1942 /*****************************************************************************/
  1937 
  1943 
  1938 /** Processes the sync monitoring datagram.
  1944 /** Processes the sync monitoring datagram.
  1939  */
  1945  */
  1940 static int ec_ioctl_sync_mon_process(
  1946 static ATTRIBUTES int ec_ioctl_sync_mon_process(
  1941         ec_master_t *master, /**< EtherCAT master. */
  1947         ec_master_t *master, /**< EtherCAT master. */
  1942         void *arg, /**< ioctl() argument. */
  1948         void *arg, /**< ioctl() argument. */
  1943         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1949         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1944         )
  1950         )
  1945 {
  1951 {
  1960 
  1966 
  1961 /*****************************************************************************/
  1967 /*****************************************************************************/
  1962 
  1968 
  1963 /** Reset configuration.
  1969 /** Reset configuration.
  1964  */
  1970  */
  1965 static int ec_ioctl_reset(
  1971 static ATTRIBUTES int ec_ioctl_reset(
  1966         ec_master_t *master, /**< EtherCAT master. */
  1972         ec_master_t *master, /**< EtherCAT master. */
  1967         void *arg, /**< ioctl() argument. */
  1973         void *arg, /**< ioctl() argument. */
  1968         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1974         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1969         )
  1975         )
  1970 {
  1976 {
  1976 
  1982 
  1977 /*****************************************************************************/
  1983 /*****************************************************************************/
  1978 
  1984 
  1979 /** Configure a sync manager.
  1985 /** Configure a sync manager.
  1980  */
  1986  */
  1981 static int ec_ioctl_sc_sync(
  1987 static ATTRIBUTES int ec_ioctl_sc_sync(
  1982         ec_master_t *master, /**< EtherCAT master. */
  1988         ec_master_t *master, /**< EtherCAT master. */
  1983         void *arg, /**< ioctl() argument. */
  1989         void *arg, /**< ioctl() argument. */
  1984         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1990         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1985         )
  1991         )
  1986 {
  1992 {
  2027 
  2033 
  2028 /*****************************************************************************/
  2034 /*****************************************************************************/
  2029 
  2035 
  2030 /** Configure a slave's watchdogs.
  2036 /** Configure a slave's watchdogs.
  2031  */
  2037  */
  2032 static int ec_ioctl_sc_watchdog(
  2038 static ATTRIBUTES int ec_ioctl_sc_watchdog(
  2033         ec_master_t *master, /**< EtherCAT master. */
  2039         ec_master_t *master, /**< EtherCAT master. */
  2034         void *arg, /**< ioctl() argument. */
  2040         void *arg, /**< ioctl() argument. */
  2035         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2041         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2036         )
  2042         )
  2037 {
  2043 {
  2070 
  2076 
  2071 /*****************************************************************************/
  2077 /*****************************************************************************/
  2072 
  2078 
  2073 /** Add a PDO to the assignment.
  2079 /** Add a PDO to the assignment.
  2074  */
  2080  */
  2075 static int ec_ioctl_sc_add_pdo(
  2081 static ATTRIBUTES int ec_ioctl_sc_add_pdo(
  2076         ec_master_t *master, /**< EtherCAT master. */
  2082         ec_master_t *master, /**< EtherCAT master. */
  2077         void *arg, /**< ioctl() argument. */
  2083         void *arg, /**< ioctl() argument. */
  2078         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2084         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2079         )
  2085         )
  2080 {
  2086 {
  2102 
  2108 
  2103 /*****************************************************************************/
  2109 /*****************************************************************************/
  2104 
  2110 
  2105 /** Clears the PDO assignment.
  2111 /** Clears the PDO assignment.
  2106  */
  2112  */
  2107 static int ec_ioctl_sc_clear_pdos(
  2113 static ATTRIBUTES int ec_ioctl_sc_clear_pdos(
  2108         ec_master_t *master, /**< EtherCAT master. */
  2114         ec_master_t *master, /**< EtherCAT master. */
  2109         void *arg, /**< ioctl() argument. */
  2115         void *arg, /**< ioctl() argument. */
  2110         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2116         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2111         )
  2117         )
  2112 {
  2118 {
  2135 
  2141 
  2136 /*****************************************************************************/
  2142 /*****************************************************************************/
  2137 
  2143 
  2138 /** Add an entry to a PDO's mapping.
  2144 /** Add an entry to a PDO's mapping.
  2139  */
  2145  */
  2140 static int ec_ioctl_sc_add_entry(
  2146 static ATTRIBUTES int ec_ioctl_sc_add_entry(
  2141         ec_master_t *master, /**< EtherCAT master. */
  2147         ec_master_t *master, /**< EtherCAT master. */
  2142         void *arg, /**< ioctl() argument. */
  2148         void *arg, /**< ioctl() argument. */
  2143         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2149         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2144         )
  2150         )
  2145 {
  2151 {
  2168 
  2174 
  2169 /*****************************************************************************/
  2175 /*****************************************************************************/
  2170 
  2176 
  2171 /** Clears the mapping of a PDO.
  2177 /** Clears the mapping of a PDO.
  2172  */
  2178  */
  2173 static int ec_ioctl_sc_clear_entries(
  2179 static ATTRIBUTES int ec_ioctl_sc_clear_entries(
  2174         ec_master_t *master, /**< EtherCAT master. */
  2180         ec_master_t *master, /**< EtherCAT master. */
  2175         void *arg, /**< ioctl() argument. */
  2181         void *arg, /**< ioctl() argument. */
  2176         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2182         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2177         )
  2183         )
  2178 {
  2184 {
  2201 
  2207 
  2202 /*****************************************************************************/
  2208 /*****************************************************************************/
  2203 
  2209 
  2204 /** Registers a PDO entry.
  2210 /** Registers a PDO entry.
  2205  */
  2211  */
  2206 static int ec_ioctl_sc_reg_pdo_entry(
  2212 static ATTRIBUTES int ec_ioctl_sc_reg_pdo_entry(
  2207         ec_master_t *master, /**< EtherCAT master. */
  2213         ec_master_t *master, /**< EtherCAT master. */
  2208         void *arg, /**< ioctl() argument. */
  2214         void *arg, /**< ioctl() argument. */
  2209         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2215         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2210         )
  2216         )
  2211 {
  2217 {
  2246 
  2252 
  2247 /*****************************************************************************/
  2253 /*****************************************************************************/
  2248 
  2254 
  2249 /** Sets the DC AssignActivate word and the sync signal times.
  2255 /** Sets the DC AssignActivate word and the sync signal times.
  2250  */
  2256  */
  2251 static int ec_ioctl_sc_dc(
  2257 static ATTRIBUTES int ec_ioctl_sc_dc(
  2252         ec_master_t *master, /**< EtherCAT master. */
  2258         ec_master_t *master, /**< EtherCAT master. */
  2253         void *arg, /**< ioctl() argument. */
  2259         void *arg, /**< ioctl() argument. */
  2254         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2260         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2255         )
  2261         )
  2256 {
  2262 {
  2284 
  2290 
  2285 /*****************************************************************************/
  2291 /*****************************************************************************/
  2286 
  2292 
  2287 /** Configures an SDO.
  2293 /** Configures an SDO.
  2288  */
  2294  */
  2289 static int ec_ioctl_sc_sdo(
  2295 static ATTRIBUTES int ec_ioctl_sc_sdo(
  2290         ec_master_t *master, /**< EtherCAT master. */
  2296         ec_master_t *master, /**< EtherCAT master. */
  2291         void *arg, /**< ioctl() argument. */
  2297         void *arg, /**< ioctl() argument. */
  2292         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2298         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2293         )
  2299         )
  2294 {
  2300 {
  2341 
  2347 
  2342 /*****************************************************************************/
  2348 /*****************************************************************************/
  2343 
  2349 
  2344 /** Set the emergency ring buffer size.
  2350 /** Set the emergency ring buffer size.
  2345  */
  2351  */
  2346 static int ec_ioctl_sc_emerg_size(
  2352 static ATTRIBUTES int ec_ioctl_sc_emerg_size(
  2347         ec_master_t *master, /**< EtherCAT master. */
  2353         ec_master_t *master, /**< EtherCAT master. */
  2348         void *arg, /**< ioctl() argument. */
  2354         void *arg, /**< ioctl() argument. */
  2349         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2355         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2350         )
  2356         )
  2351 {
  2357 {
  2377 
  2383 
  2378 /*****************************************************************************/
  2384 /*****************************************************************************/
  2379 
  2385 
  2380 /** Get an emergency message from the ring.
  2386 /** Get an emergency message from the ring.
  2381  */
  2387  */
  2382 static int ec_ioctl_sc_emerg_pop(
  2388 static ATTRIBUTES int ec_ioctl_sc_emerg_pop(
  2383         ec_master_t *master, /**< EtherCAT master. */
  2389         ec_master_t *master, /**< EtherCAT master. */
  2384         void *arg, /**< ioctl() argument. */
  2390         void *arg, /**< ioctl() argument. */
  2385         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2391         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2386         )
  2392         )
  2387 {
  2393 {
  2422 
  2428 
  2423 /*****************************************************************************/
  2429 /*****************************************************************************/
  2424 
  2430 
  2425 /** Clear the emergency ring.
  2431 /** Clear the emergency ring.
  2426  */
  2432  */
  2427 static int ec_ioctl_sc_emerg_clear(
  2433 static ATTRIBUTES int ec_ioctl_sc_emerg_clear(
  2428         ec_master_t *master, /**< EtherCAT master. */
  2434         ec_master_t *master, /**< EtherCAT master. */
  2429         void *arg, /**< ioctl() argument. */
  2435         void *arg, /**< ioctl() argument. */
  2430         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2436         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2431         )
  2437         )
  2432 {
  2438 {
  2458 
  2464 
  2459 /*****************************************************************************/
  2465 /*****************************************************************************/
  2460 
  2466 
  2461 /** Get the number of emergency overruns.
  2467 /** Get the number of emergency overruns.
  2462  */
  2468  */
  2463 static int ec_ioctl_sc_emerg_overruns(
  2469 static ATTRIBUTES int ec_ioctl_sc_emerg_overruns(
  2464         ec_master_t *master, /**< EtherCAT master. */
  2470         ec_master_t *master, /**< EtherCAT master. */
  2465         void *arg, /**< ioctl() argument. */
  2471         void *arg, /**< ioctl() argument. */
  2466         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2472         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2467         )
  2473         )
  2468 {
  2474 {
  2504 
  2510 
  2505 /*****************************************************************************/
  2511 /*****************************************************************************/
  2506 
  2512 
  2507 /** Create an SDO request.
  2513 /** Create an SDO request.
  2508  */
  2514  */
  2509 static int ec_ioctl_sc_create_sdo_request(
  2515 static ATTRIBUTES int ec_ioctl_sc_create_sdo_request(
  2510         ec_master_t *master, /**< EtherCAT master. */
  2516         ec_master_t *master, /**< EtherCAT master. */
  2511         void *arg, /**< ioctl() argument. */
  2517         void *arg, /**< ioctl() argument. */
  2512         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2518         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2513         )
  2519         )
  2514 {
  2520 {
  2553 
  2559 
  2554 /*****************************************************************************/
  2560 /*****************************************************************************/
  2555 
  2561 
  2556 /** Create a register request.
  2562 /** Create a register request.
  2557  */
  2563  */
  2558 static int ec_ioctl_sc_create_reg_request(
  2564 static ATTRIBUTES int ec_ioctl_sc_create_reg_request(
  2559         ec_master_t *master, /**< EtherCAT master. */
  2565         ec_master_t *master, /**< EtherCAT master. */
  2560         void *arg, /**< ioctl() argument. */
  2566         void *arg, /**< ioctl() argument. */
  2561         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2567         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2562         )
  2568         )
  2563 {
  2569 {
  2605 
  2611 
  2606 /*****************************************************************************/
  2612 /*****************************************************************************/
  2607 
  2613 
  2608 /** Create a VoE handler.
  2614 /** Create a VoE handler.
  2609  */
  2615  */
  2610 static int ec_ioctl_sc_create_voe_handler(
  2616 static ATTRIBUTES int ec_ioctl_sc_create_voe_handler(
  2611         ec_master_t *master, /**< EtherCAT master. */
  2617         ec_master_t *master, /**< EtherCAT master. */
  2612         void *arg, /**< ioctl() argument. */
  2618         void *arg, /**< ioctl() argument. */
  2613         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2619         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2614         )
  2620         )
  2615 {
  2621 {
  2653 
  2659 
  2654 /*****************************************************************************/
  2660 /*****************************************************************************/
  2655 
  2661 
  2656 /** Get the slave configuration's state.
  2662 /** Get the slave configuration's state.
  2657  */
  2663  */
  2658 static int ec_ioctl_sc_state(
  2664 static ATTRIBUTES int ec_ioctl_sc_state(
  2659         ec_master_t *master, /**< EtherCAT master. */
  2665         ec_master_t *master, /**< EtherCAT master. */
  2660         void *arg, /**< ioctl() argument. */
  2666         void *arg, /**< ioctl() argument. */
  2661         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2667         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2662         )
  2668         )
  2663 {
  2669 {
  2689 
  2695 
  2690 /*****************************************************************************/
  2696 /*****************************************************************************/
  2691 
  2697 
  2692 /** Configures an IDN.
  2698 /** Configures an IDN.
  2693  */
  2699  */
  2694 static int ec_ioctl_sc_idn(
  2700 static ATTRIBUTES int ec_ioctl_sc_idn(
  2695         ec_master_t *master, /**< EtherCAT master. */
  2701         ec_master_t *master, /**< EtherCAT master. */
  2696         void *arg, /**< ioctl() argument. */
  2702         void *arg, /**< ioctl() argument. */
  2697         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2703         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2698         )
  2704         )
  2699 {
  2705 {
  2741 
  2747 
  2742 /*****************************************************************************/
  2748 /*****************************************************************************/
  2743 
  2749 
  2744 /** Gets the domain's offset in the total process data.
  2750 /** Gets the domain's offset in the total process data.
  2745  */
  2751  */
  2746 static int ec_ioctl_domain_offset(
  2752 static ATTRIBUTES int ec_ioctl_domain_offset(
  2747         ec_master_t *master, /**< EtherCAT master. */
  2753         ec_master_t *master, /**< EtherCAT master. */
  2748         void *arg, /**< ioctl() argument. */
  2754         void *arg, /**< ioctl() argument. */
  2749         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2755         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2750         )
  2756         )
  2751 {
  2757 {
  2773 
  2779 
  2774 /*****************************************************************************/
  2780 /*****************************************************************************/
  2775 
  2781 
  2776 /** Process the domain.
  2782 /** Process the domain.
  2777  */
  2783  */
  2778 static int ec_ioctl_domain_process(
  2784 static ATTRIBUTES int ec_ioctl_domain_process(
  2779         ec_master_t *master, /**< EtherCAT master. */
  2785         ec_master_t *master, /**< EtherCAT master. */
  2780         void *arg, /**< ioctl() argument. */
  2786         void *arg, /**< ioctl() argument. */
  2781         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2787         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2782         )
  2788         )
  2783 {
  2789 {
  2799 
  2805 
  2800 /*****************************************************************************/
  2806 /*****************************************************************************/
  2801 
  2807 
  2802 /** Queue the domain.
  2808 /** Queue the domain.
  2803  */
  2809  */
  2804 static int ec_ioctl_domain_queue(
  2810 static ATTRIBUTES int ec_ioctl_domain_queue(
  2805         ec_master_t *master, /**< EtherCAT master. */
  2811         ec_master_t *master, /**< EtherCAT master. */
  2806         void *arg, /**< ioctl() argument. */
  2812         void *arg, /**< ioctl() argument. */
  2807         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2813         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2808         )
  2814         )
  2809 {
  2815 {
  2825 
  2831 
  2826 /*****************************************************************************/
  2832 /*****************************************************************************/
  2827 
  2833 
  2828 /** Get the domain state.
  2834 /** Get the domain state.
  2829  */
  2835  */
  2830 static int ec_ioctl_domain_state(
  2836 static ATTRIBUTES int ec_ioctl_domain_state(
  2831         ec_master_t *master, /**< EtherCAT master. */
  2837         ec_master_t *master, /**< EtherCAT master. */
  2832         void *arg, /**< ioctl() argument. */
  2838         void *arg, /**< ioctl() argument. */
  2833         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2839         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2834         )
  2840         )
  2835 {
  2841 {
  2861 
  2867 
  2862 /*****************************************************************************/
  2868 /*****************************************************************************/
  2863 
  2869 
  2864 /** Sets an SDO request's SDO index and subindex.
  2870 /** Sets an SDO request's SDO index and subindex.
  2865  */
  2871  */
  2866 static int ec_ioctl_sdo_request_index(
  2872 static ATTRIBUTES int ec_ioctl_sdo_request_index(
  2867         ec_master_t *master, /**< EtherCAT master. */
  2873         ec_master_t *master, /**< EtherCAT master. */
  2868         void *arg, /**< ioctl() argument. */
  2874         void *arg, /**< ioctl() argument. */
  2869         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2875         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2870         )
  2876         )
  2871 {
  2877 {
  2896 
  2902 
  2897 /*****************************************************************************/
  2903 /*****************************************************************************/
  2898 
  2904 
  2899 /** Sets an SDO request's timeout.
  2905 /** Sets an SDO request's timeout.
  2900  */
  2906  */
  2901 static int ec_ioctl_sdo_request_timeout(
  2907 static ATTRIBUTES int ec_ioctl_sdo_request_timeout(
  2902         ec_master_t *master, /**< EtherCAT master. */
  2908         ec_master_t *master, /**< EtherCAT master. */
  2903         void *arg, /**< ioctl() argument. */
  2909         void *arg, /**< ioctl() argument. */
  2904         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2910         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2905         )
  2911         )
  2906 {
  2912 {
  2931 
  2937 
  2932 /*****************************************************************************/
  2938 /*****************************************************************************/
  2933 
  2939 
  2934 /** Gets an SDO request's state.
  2940 /** Gets an SDO request's state.
  2935  */
  2941  */
  2936 static int ec_ioctl_sdo_request_state(
  2942 static ATTRIBUTES int ec_ioctl_sdo_request_state(
  2937         ec_master_t *master, /**< EtherCAT master. */
  2943         ec_master_t *master, /**< EtherCAT master. */
  2938         void *arg, /**< ioctl() argument. */
  2944         void *arg, /**< ioctl() argument. */
  2939         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2945         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2940         )
  2946         )
  2941 {
  2947 {
  2974 
  2980 
  2975 /*****************************************************************************/
  2981 /*****************************************************************************/
  2976 
  2982 
  2977 /** Starts an SDO read operation.
  2983 /** Starts an SDO read operation.
  2978  */
  2984  */
  2979 static int ec_ioctl_sdo_request_read(
  2985 static ATTRIBUTES int ec_ioctl_sdo_request_read(
  2980         ec_master_t *master, /**< EtherCAT master. */
  2986         ec_master_t *master, /**< EtherCAT master. */
  2981         void *arg, /**< ioctl() argument. */
  2987         void *arg, /**< ioctl() argument. */
  2982         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2988         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  2983         )
  2989         )
  2984 {
  2990 {
  3009 
  3015 
  3010 /*****************************************************************************/
  3016 /*****************************************************************************/
  3011 
  3017 
  3012 /** Starts an SDO write operation.
  3018 /** Starts an SDO write operation.
  3013  */
  3019  */
  3014 static int ec_ioctl_sdo_request_write(
  3020 static ATTRIBUTES int ec_ioctl_sdo_request_write(
  3015         ec_master_t *master, /**< EtherCAT master. */
  3021         ec_master_t *master, /**< EtherCAT master. */
  3016         void *arg, /**< ioctl() argument. */
  3022         void *arg, /**< ioctl() argument. */
  3017         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3023         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3018         )
  3024         )
  3019 {
  3025 {
  3058 
  3064 
  3059 /*****************************************************************************/
  3065 /*****************************************************************************/
  3060 
  3066 
  3061 /** Read SDO data.
  3067 /** Read SDO data.
  3062  */
  3068  */
  3063 static int ec_ioctl_sdo_request_data(
  3069 static ATTRIBUTES int ec_ioctl_sdo_request_data(
  3064         ec_master_t *master, /**< EtherCAT master. */
  3070         ec_master_t *master, /**< EtherCAT master. */
  3065         void *arg, /**< ioctl() argument. */
  3071         void *arg, /**< ioctl() argument. */
  3066         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3072         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3067         )
  3073         )
  3068 {
  3074 {
  3096 
  3102 
  3097 /*****************************************************************************/
  3103 /*****************************************************************************/
  3098 
  3104 
  3099 /** Read register data.
  3105 /** Read register data.
  3100  */
  3106  */
  3101 static int ec_ioctl_reg_request_data(
  3107 static ATTRIBUTES int ec_ioctl_reg_request_data(
  3102         ec_master_t *master, /**< EtherCAT master. */
  3108         ec_master_t *master, /**< EtherCAT master. */
  3103         void *arg, /**< ioctl() argument. */
  3109         void *arg, /**< ioctl() argument. */
  3104         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3110         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3105         )
  3111         )
  3106 {
  3112 {
  3141 
  3147 
  3142 /*****************************************************************************/
  3148 /*****************************************************************************/
  3143 
  3149 
  3144 /** Gets an register request's state.
  3150 /** Gets an register request's state.
  3145  */
  3151  */
  3146 static int ec_ioctl_reg_request_state(
  3152 static ATTRIBUTES int ec_ioctl_reg_request_state(
  3147         ec_master_t *master, /**< EtherCAT master. */
  3153         ec_master_t *master, /**< EtherCAT master. */
  3148         void *arg, /**< ioctl() argument. */
  3154         void *arg, /**< ioctl() argument. */
  3149         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3155         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3150         )
  3156         )
  3151 {
  3157 {
  3184 
  3190 
  3185 /*****************************************************************************/
  3191 /*****************************************************************************/
  3186 
  3192 
  3187 /** Starts an register write operation.
  3193 /** Starts an register write operation.
  3188  */
  3194  */
  3189 static int ec_ioctl_reg_request_write(
  3195 static ATTRIBUTES int ec_ioctl_reg_request_write(
  3190         ec_master_t *master, /**< EtherCAT master. */
  3196         ec_master_t *master, /**< EtherCAT master. */
  3191         void *arg, /**< ioctl() argument. */
  3197         void *arg, /**< ioctl() argument. */
  3192         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3198         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3193         )
  3199         )
  3194 {
  3200 {
  3230 
  3236 
  3231 /*****************************************************************************/
  3237 /*****************************************************************************/
  3232 
  3238 
  3233 /** Starts an register read operation.
  3239 /** Starts an register read operation.
  3234  */
  3240  */
  3235 static int ec_ioctl_reg_request_read(
  3241 static ATTRIBUTES int ec_ioctl_reg_request_read(
  3236         ec_master_t *master, /**< EtherCAT master. */
  3242         ec_master_t *master, /**< EtherCAT master. */
  3237         void *arg, /**< ioctl() argument. */
  3243         void *arg, /**< ioctl() argument. */
  3238         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3244         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3239         )
  3245         )
  3240 {
  3246 {
  3271 
  3277 
  3272 /*****************************************************************************/
  3278 /*****************************************************************************/
  3273 
  3279 
  3274 /** Sets the VoE send header.
  3280 /** Sets the VoE send header.
  3275  */
  3281  */
  3276 static int ec_ioctl_voe_send_header(
  3282 static ATTRIBUTES int ec_ioctl_voe_send_header(
  3277         ec_master_t *master, /**< EtherCAT master. */
  3283         ec_master_t *master, /**< EtherCAT master. */
  3278         void *arg, /**< ioctl() argument. */
  3284         void *arg, /**< ioctl() argument. */
  3279         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3285         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3280         )
  3286         )
  3281 {
  3287 {
  3314 
  3320 
  3315 /*****************************************************************************/
  3321 /*****************************************************************************/
  3316 
  3322 
  3317 /** Gets the received VoE header.
  3323 /** Gets the received VoE header.
  3318  */
  3324  */
  3319 static int ec_ioctl_voe_rec_header(
  3325 static ATTRIBUTES int ec_ioctl_voe_rec_header(
  3320         ec_master_t *master, /**< EtherCAT master. */
  3326         ec_master_t *master, /**< EtherCAT master. */
  3321         void *arg, /**< ioctl() argument. */
  3327         void *arg, /**< ioctl() argument. */
  3322         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3328         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3323         )
  3329         )
  3324 {
  3330 {
  3360 
  3366 
  3361 /*****************************************************************************/
  3367 /*****************************************************************************/
  3362 
  3368 
  3363 /** Starts a VoE read operation.
  3369 /** Starts a VoE read operation.
  3364  */
  3370  */
  3365 static int ec_ioctl_voe_read(
  3371 static ATTRIBUTES int ec_ioctl_voe_read(
  3366         ec_master_t *master, /**< EtherCAT master. */
  3372         ec_master_t *master, /**< EtherCAT master. */
  3367         void *arg, /**< ioctl() argument. */
  3373         void *arg, /**< ioctl() argument. */
  3368         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3374         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3369         )
  3375         )
  3370 {
  3376 {
  3395 
  3401 
  3396 /*****************************************************************************/
  3402 /*****************************************************************************/
  3397 
  3403 
  3398 /** Starts a VoE read operation without sending a sync message first.
  3404 /** Starts a VoE read operation without sending a sync message first.
  3399  */
  3405  */
  3400 static int ec_ioctl_voe_read_nosync(
  3406 static ATTRIBUTES int ec_ioctl_voe_read_nosync(
  3401         ec_master_t *master, /**< EtherCAT master. */
  3407         ec_master_t *master, /**< EtherCAT master. */
  3402         void *arg, /**< ioctl() argument. */
  3408         void *arg, /**< ioctl() argument. */
  3403         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3409         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3404         )
  3410         )
  3405 {
  3411 {
  3430 
  3436 
  3431 /*****************************************************************************/
  3437 /*****************************************************************************/
  3432 
  3438 
  3433 /** Starts a VoE write operation.
  3439 /** Starts a VoE write operation.
  3434  */
  3440  */
  3435 static int ec_ioctl_voe_write(
  3441 static ATTRIBUTES int ec_ioctl_voe_write(
  3436         ec_master_t *master, /**< EtherCAT master. */
  3442         ec_master_t *master, /**< EtherCAT master. */
  3437         void *arg, /**< ioctl() argument. */
  3443         void *arg, /**< ioctl() argument. */
  3438         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3444         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3439         )
  3445         )
  3440 {
  3446 {
  3474 
  3480 
  3475 /*****************************************************************************/
  3481 /*****************************************************************************/
  3476 
  3482 
  3477 /** Executes the VoE state machine.
  3483 /** Executes the VoE state machine.
  3478  */
  3484  */
  3479 static int ec_ioctl_voe_exec(
  3485 static ATTRIBUTES int ec_ioctl_voe_exec(
  3480         ec_master_t *master, /**< EtherCAT master. */
  3486         ec_master_t *master, /**< EtherCAT master. */
  3481         void *arg, /**< ioctl() argument. */
  3487         void *arg, /**< ioctl() argument. */
  3482         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3488         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3483         )
  3489         )
  3484 {
  3490 {
  3517 
  3523 
  3518 /*****************************************************************************/
  3524 /*****************************************************************************/
  3519 
  3525 
  3520 /** Reads the received VoE data.
  3526 /** Reads the received VoE data.
  3521  */
  3527  */
  3522 static int ec_ioctl_voe_data(
  3528 static ATTRIBUTES int ec_ioctl_voe_data(
  3523         ec_master_t *master, /**< EtherCAT master. */
  3529         ec_master_t *master, /**< EtherCAT master. */
  3524         void *arg, /**< ioctl() argument. */
  3530         void *arg, /**< ioctl() argument. */
  3525         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3531         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  3526         )
  3532         )
  3527 {
  3533 {
  3555 
  3561 
  3556 /*****************************************************************************/
  3562 /*****************************************************************************/
  3557 
  3563 
  3558 /** Read a file from a slave via FoE.
  3564 /** Read a file from a slave via FoE.
  3559  */
  3565  */
  3560 static int ec_ioctl_slave_foe_read(
  3566 static ATTRIBUTES int ec_ioctl_slave_foe_read(
  3561         ec_master_t *master, /**< EtherCAT master. */
  3567         ec_master_t *master, /**< EtherCAT master. */
  3562         void *arg /**< ioctl() argument. */
  3568         void *arg /**< ioctl() argument. */
  3563         )
  3569         )
  3564 {
  3570 {
  3565     ec_ioctl_slave_foe_t io;
  3571     ec_ioctl_slave_foe_t io;
  3649 
  3655 
  3650 /*****************************************************************************/
  3656 /*****************************************************************************/
  3651 
  3657 
  3652 /** Write a file to a slave via FoE
  3658 /** Write a file to a slave via FoE
  3653  */
  3659  */
  3654 static int ec_ioctl_slave_foe_write(
  3660 static ATTRIBUTES int ec_ioctl_slave_foe_write(
  3655         ec_master_t *master, /**< EtherCAT master. */
  3661         ec_master_t *master, /**< EtherCAT master. */
  3656         void *arg /**< ioctl() argument. */
  3662         void *arg /**< ioctl() argument. */
  3657         )
  3663         )
  3658 {
  3664 {
  3659     ec_ioctl_slave_foe_t io;
  3665     ec_ioctl_slave_foe_t io;
  3735 
  3741 
  3736 /*****************************************************************************/
  3742 /*****************************************************************************/
  3737 
  3743 
  3738 /** Read an SoE IDN.
  3744 /** Read an SoE IDN.
  3739  */
  3745  */
  3740 static int ec_ioctl_slave_soe_read(
  3746 static ATTRIBUTES int ec_ioctl_slave_soe_read(
  3741         ec_master_t *master, /**< EtherCAT master. */
  3747         ec_master_t *master, /**< EtherCAT master. */
  3742         void *arg /**< ioctl() argument. */
  3748         void *arg /**< ioctl() argument. */
  3743         )
  3749         )
  3744 {
  3750 {
  3745     ec_ioctl_slave_soe_read_t ioctl;
  3751     ec_ioctl_slave_soe_read_t ioctl;
  3782 
  3788 
  3783 /*****************************************************************************/
  3789 /*****************************************************************************/
  3784 
  3790 
  3785 /** Write an IDN to a slave via SoE.
  3791 /** Write an IDN to a slave via SoE.
  3786  */
  3792  */
  3787 static int ec_ioctl_slave_soe_write(
  3793 static ATTRIBUTES int ec_ioctl_slave_soe_write(
  3788         ec_master_t *master, /**< EtherCAT master. */
  3794         ec_master_t *master, /**< EtherCAT master. */
  3789         void *arg /**< ioctl() argument. */
  3795         void *arg /**< ioctl() argument. */
  3790         )
  3796         )
  3791 {
  3797 {
  3792     ec_ioctl_slave_soe_write_t ioctl;
  3798     ec_ioctl_slave_soe_write_t ioctl;