lib/master.c
changeset 2150 5144a4bc6184
parent 2066 b544025bd696
child 2246 6f5bfbcc2010
equal deleted inserted replaced
2149:98e1e773bed0 2150:5144a4bc6184
     1 /******************************************************************************
     1 /******************************************************************************
     2  *
     2  *
     3  *  $Id$
     3  *  $Id: master.c,v b544025bd696 2011/05/12 14:45:02 fp $
     4  *
     4  *
     5  *  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
     5  *  Copyright (C) 2006-2009  Florian Pose, Ingenieurgemeinschaft IgH
     6  *
     6  *
     7  *  This file is part of the IgH EtherCAT master userspace library.
     7  *  This file is part of the IgH EtherCAT master userspace library.
     8  *
     8  *
   347     ec_ioctl_slave_sdo_download_t download;
   347     ec_ioctl_slave_sdo_download_t download;
   348 
   348 
   349     download.slave_position = slave_position;
   349     download.slave_position = slave_position;
   350     download.sdo_index = index;
   350     download.sdo_index = index;
   351     download.sdo_entry_subindex = subindex;
   351     download.sdo_entry_subindex = subindex;
       
   352     download.complete_access = 0;
       
   353     download.data_size = data_size;
       
   354     download.data = data;
       
   355 
       
   356     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
       
   357         if (errno == EIO && abort_code) {
       
   358             *abort_code = download.abort_code;
       
   359         }
       
   360         fprintf(stderr, "Failed to execute SDO download: %s\n",
       
   361             strerror(errno));
       
   362         return -1;
       
   363     }
       
   364 
       
   365     return 0;
       
   366 }
       
   367 
       
   368 /*****************************************************************************/
       
   369 
       
   370 int ecrt_master_sdo_download_complete(ec_master_t *master,
       
   371         uint16_t slave_position, uint16_t index, uint8_t *data,
       
   372         size_t data_size, uint32_t *abort_code)
       
   373 {
       
   374     ec_ioctl_slave_sdo_download_t download;
       
   375 
       
   376     download.slave_position = slave_position;
       
   377     download.sdo_index = index;
       
   378     download.sdo_entry_subindex = 0;
       
   379     download.complete_access = 1;
   352     download.data_size = data_size;
   380     download.data_size = data_size;
   353     download.data = data;
   381     download.data = data;
   354 
   382 
   355     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
   383     if (ioctl(master->fd, EC_IOCTL_SLAVE_SDO_DOWNLOAD, &download) == -1) {
   356         if (errno == EIO && abort_code) {
   384         if (errno == EIO && abort_code) {