master/ioctl.c
branchstable-1.5
changeset 2498 9cdd7669dc0b
parent 2487 ccafdf1e261f
child 2504 5ef9d5b14879
equal deleted inserted replaced
2497:505cf41488a4 2498:9cdd7669dc0b
  1751         ec_master_t *master, /**< EtherCAT master. */
  1751         ec_master_t *master, /**< EtherCAT master. */
  1752         void *arg, /**< ioctl() argument. */
  1752         void *arg, /**< ioctl() argument. */
  1753         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1753         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1754         )
  1754         )
  1755 {
  1755 {
  1756     if (unlikely(!ctx->requested))
  1756     if (unlikely(!ctx->requested)) {
  1757         return -EPERM;
  1757         return -EPERM;
  1758 
  1758     }
  1759     down(&master->io_sem);
  1759 
  1760     ecrt_master_send(master);
  1760     ecrt_master_send(master);
  1761     up(&master->io_sem);
       
  1762     return 0;
  1761     return 0;
  1763 }
  1762 }
  1764 
  1763 
  1765 /*****************************************************************************/
  1764 /*****************************************************************************/
  1766 
  1765 
  1770         ec_master_t *master, /**< EtherCAT master. */
  1769         ec_master_t *master, /**< EtherCAT master. */
  1771         void *arg, /**< ioctl() argument. */
  1770         void *arg, /**< ioctl() argument. */
  1772         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1771         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1773         )
  1772         )
  1774 {
  1773 {
  1775     if (unlikely(!ctx->requested))
  1774     if (unlikely(!ctx->requested)) {
  1776         return -EPERM;
  1775         return -EPERM;
  1777 
  1776     }
  1778     down(&master->io_sem);
  1777 
  1779     ecrt_master_receive(master);
  1778     ecrt_master_receive(master);
  1780     up(&master->io_sem);
       
  1781     return 0;
  1779     return 0;
  1782 }
  1780 }
  1783 
  1781 
  1784 /*****************************************************************************/
  1782 /*****************************************************************************/
  1785 
  1783 
  1862         ec_master_t *master, /**< EtherCAT master. */
  1860         ec_master_t *master, /**< EtherCAT master. */
  1863         void *arg, /**< ioctl() argument. */
  1861         void *arg, /**< ioctl() argument. */
  1864         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1862         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1865         )
  1863         )
  1866 {
  1864 {
  1867     if (unlikely(!ctx->requested))
  1865     if (unlikely(!ctx->requested)) {
  1868         return -EPERM;
  1866         return -EPERM;
  1869 
  1867     }
  1870     down(&master->io_sem);
  1868 
  1871     ecrt_master_sync_reference_clock(master);
  1869     ecrt_master_sync_reference_clock(master);
  1872     up(&master->io_sem);
       
  1873     return 0;
  1870     return 0;
  1874 }
  1871 }
  1875 
  1872 
  1876 /*****************************************************************************/
  1873 /*****************************************************************************/
  1877 
  1874 
  1881         ec_master_t *master, /**< EtherCAT master. */
  1878         ec_master_t *master, /**< EtherCAT master. */
  1882         void *arg, /**< ioctl() argument. */
  1879         void *arg, /**< ioctl() argument. */
  1883         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1880         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1884         )
  1881         )
  1885 {
  1882 {
  1886     if (unlikely(!ctx->requested))
  1883     if (unlikely(!ctx->requested)) {
  1887         return -EPERM;
  1884         return -EPERM;
  1888 
  1885     }
  1889     down(&master->io_sem);
  1886 
  1890     ecrt_master_sync_slave_clocks(master);
  1887     ecrt_master_sync_slave_clocks(master);
  1891     up(&master->io_sem);
       
  1892     return 0;
  1888     return 0;
  1893 }
  1889 }
  1894 
  1890 
  1895 /*****************************************************************************/
  1891 /*****************************************************************************/
  1896 
  1892 
  1929         ec_master_t *master, /**< EtherCAT master. */
  1925         ec_master_t *master, /**< EtherCAT master. */
  1930         void *arg, /**< ioctl() argument. */
  1926         void *arg, /**< ioctl() argument. */
  1931         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1927         ec_ioctl_context_t *ctx /**< Private data structure of file handle. */
  1932         )
  1928         )
  1933 {
  1929 {
  1934     if (unlikely(!ctx->requested))
  1930     if (unlikely(!ctx->requested)) {
  1935         return -EPERM;
  1931         return -EPERM;
  1936 
  1932     }
  1937     down(&master->io_sem);
  1933 
  1938     ecrt_master_sync_monitor_queue(master);
  1934     ecrt_master_sync_monitor_queue(master);
  1939     up(&master->io_sem);
       
  1940     return 0;
  1935     return 0;
  1941 }
  1936 }
  1942 
  1937 
  1943 /*****************************************************************************/
  1938 /*****************************************************************************/
  1944 
  1939